Skip to main content
The BspDecompiler class is the main orchestrator for the BSP decompilation process. It initializes and coordinates all sub-modules (entity, brush, texture, etc.) and controls the overall decompilation workflow. Source: BspDecompiler.java:35

Overview

BspDecompiler is the central component that ties together all decompilation modules. It manages the decompilation process from start to finish, handling world geometry, entities, textures, and metadata.

Constructor

BspDecompiler
constructor
Creates a new decompiler instance.
BspDecompiler(
    BspFileReader reader,
    VmfWriter writer,
    BspSourceConfig config
)
The constructor initializes all sub-modules including:
  • TextureSource - Texture handling
  • BspProtection - Protection detection
  • VmfMeta - VMF metadata writing
  • BrushSource - Brush geometry decompilation
  • FaceSource - Face-based geometry decompilation
  • EntitySource - Entity decompilation

Methods

start
void
Start the decompilation process.
void start()
Executes the complete decompilation workflow:
  1. Configure texture fixing options
  2. Check for map protection (if enabled)
  3. Load brush-face mappings (for BRUSHPLANES mode)
  4. Write VMF header and worldspawn
  5. Write world brushes and displacements
  6. Write entities
  7. Write visgroups
  8. Finalize VMF structure
setNmoData
void
Set NMO data for No More Room in Hell maps.
void setNmoData(NmoFile nmo)
Provides additional objective data for NMRIH game mode maps.

Decompilation Workflow

The decompilation process follows this sequence:
1

Initialization

Configure texture options and check for protection mechanisms.
2

Data Loading

Load required data structures based on brush mode (BRUSHPLANES requires additional mapping data).
3

Metadata

Write VMF header, version info, and worldspawn entity.
4

World Geometry

Write world brushes and displacement surfaces if enabled.
5

Entities

Write all entities including brush entities, point entities, static props, overlays, and cubemaps.
6

Organization

Write visgroups for instance organization.
7

Finalization

Close all VMF sections and complete the file.

Sub-Modules

BspDecompiler coordinates these specialized modules:

TextureSource

Handles texture name fixing and material processing.

BspProtection

Detects and handles various map protection techniques.

VmfMeta

Manages VMF metadata, comments, and version information.

BrushSource

Decompiles brush geometry using brush and plane lumps.

FaceSource

Decompiles geometry using face lumps (alternative to BrushSource).

EntitySource

Decompiles all entity types including point and brush entities.

Usage Example

import info.ata4.bspsrc.decompiler.BspDecompiler;
import info.ata4.bspsrc.decompiler.BspSourceConfig;
import info.ata4.bspsrc.lib.BspFile;
import info.ata4.bspsrc.lib.BspFileReader;

// Load BSP file
BspFile bsp = new BspFile();
bsp.load(bspPath);

BspFileReader reader = new BspFileReader(bsp);
reader.loadAll();

// Create configuration
BspSourceConfig config = new BspSourceConfig();
config.writeWorldBrushes = true;
config.writePointEntities = true;
config.brushMode = BrushMode.BRUSHPLANES;

// Create writer
VmfWriter writer = new VmfWriter(outputFile);

// Decompile
BspDecompiler decompiler = new BspDecompiler(reader, writer, config);
decompiler.start();

// Clean up
writer.close();

Configuration Impact

The BspSourceConfig settings control what BspDecompiler writes:
  • brushMode - Determines which module (BrushSource vs FaceSource) handles geometry
  • writeWorldBrushes - Enable/disable world geometry decompilation
  • writePointEntities/writeBrushEntities - Control entity writing
  • fixCubemapTextures/fixToolTextures - Configure texture fixing
  • skipProt - Skip protection checking for faster processing

Build docs developers (and LLMs) love