Wing Commander II
Reconstructed Win32 source (1996)
Loading...
Searching...
No Matches
Wing Commander II reconstructed source

This is the reconstructed C and C++ source of Wing Commander II as shipped in Wing Commander: The Kilrathi Saga (1996), with the SDL2 port's code stripped out. Built with Microsoft Visual C++ 4.1, it reproduces the original Win32 WC2.EXE byte for byte: all 714,752 bytes, including code, data, padding and PE/debug metadata.

Every reference build checks the complete executable against the retail SHA-256 and fails on a mismatch: f5e133e8eca8eb1a02e21a7d1afbb44d082e384a38d39db58a694371fa583bbe.

Source files

Each group lists its files in link order, the order of their code in WC2.EXE.

Startup and Win32 shell

File Contents
config.c Reads the WINGCMDR.CFG installation configuration.
joypres.c Joystick presence query.
timer.c Multimedia frame timer callback.
console.cpp Owner and C wrappers of the Win32 developer overlay console.
mousepos.c Sets the mouse position.
input.c Menu input devices and joystick button events.
joycal.c Joystick calibration file and calibrated reads.
clock.c Splits game clock ticks.
mono.c MONODEBG developer channel.
message.c Flight input setup, fatal errors and on-screen messages.
version.c Game version string.
joystick.c Joystick sampling.
kbmouse.c Keyboard mouse pump.
winmain.c Win32 entry point, window, joystick, guarded heap and keyboard state.
debug.cpp Win32 developer overlay console.
startup.c Game startup and main.
eventmgr.c Win32 library port: random, fixed-point math, text, strings and events.
waitkey.c Waits for a queued input press.
main.c Main application loop and spaceflight frame.

Graphics

File Contents
palalloc.c Space palette layout and contiguous palette-entry reservation.
raster.asm Hand-written raster library: RLE sprites, clipped drawing and IFF, PCX and GIF image decoding.
screen.c Full-screen DIB viewport setup.
palette.c Saves and restores the game palette.
fade.c Palette transition step.
viewrect.c Sets a viewport rectangle.
gr.c Shape decoding, viewport drawing and raster effects.
pan.c Pans between screens.
text.c Cinematic sprite-font renderer.
grdriver.c Loads the graphics driver.
shpext.c Shape frame extent.
vpfree.c Frees a viewport.
wipe.c Viewport wipe transitions.
palfade.c Fades a viewport palette towards a colour.
strwidth.c Clamped text pixel width.
usedcols.c Collects the palette indices in use.
starfld.c Fireworks and constellation fields.
getmode.c Queries the graphics mode.
vpalloc.c Viewport buffer allocation.
dib.cpp DirectDraw DIB display, frame timing and palettes.

Data, files and memory

File Contents
iffload.c Cutscene IFF resource parsing and release.
disk.c Packet loading, text contexts and input waits.
hugemove.c Overlap-safe huge memory copy.
textfmt.c Formatted text output.
nearheap.c Near heap allocator.
suffix.c Graphics file suffixes and character conversion.
pload.c Packet loader (Library\Source\Pload.c).
fstrcat.c String concatenation shim.
packet.c Packet sections and data file handles.
hexnum.c Hexadecimal number parser.
pktsize.c Packet size.
parsenum.c Number parser.
iffindex.c Scene chunk decoding.
memapi.c Memory stack frames and packet handles.
datafile.c Data file I/O.
memfree.c Available main memory.
resread.c Reads packet section data.
globals.c Reference-build placeholder; native-only storage is omitted.

Flight and combat

File Contents
taperec.c Canned-scene tape recorder.
geom.c Ship velocity limits, vector arithmetic and orientation geometry.
ship.c Space objects: creation, weapons, movement and damage.
fields.c Asteroid and mine hazard fields.
spc.c Space views, star field and object simulation.
smart.c Pilot steering, formation flying and maneuver selection.
orders.c Wingman orders and landing requests.
auto.c Autopilot travel and interstitial flight sequences.
jump.c Objectives, warp arrival and star-system jumps.
logic.c Ship AI bookkeeping: alerts, collisions, goals and squads.
fl.c Flight maneuvers.
brains.c Ship intelligence and missions.
destroy.c Ship destruction and mission ejection pods.
replay.c Canned-scene playback.
fleetvw.c Fleet overview view.
mission.c Mission setup, action spheres and ship loading.
midscene.c Mid-mission ejection scene.
carrier.c Carrier fighter launches.
fltsetup.c Spaceflight setup: shapes, cockpit, constellations and music.
turret.c Fleet overview, target camera and turret guns.
select.c Weapon selection.

Cockpit

File Contents
damage.c Cockpit damage display.
cockpt.c Cockpit displays, HUD messages and VDUs.
target.c Target display.
comm.c Communications menu and transmissions.
nav.c Navigation map.

Campaign and carrier scenes

File Contents
intro.c Title orchestra sequence and victory fireworks.
hotspot.c Scene hotspot selection.
campaign.c Campaign start, continue prompt and game loop.
titlemnu.c Joystick calibration, title menu and barracks screen.
campglob.c Campaign globals and campaign scripts.
gameflow.c Cutscene engine and game flow.
personnel.c Personnel database, campaign chalkboard and pilot transfer.
eject.c Player ejection and stranding sequences.
loadmisn.c Loads mission data.
optmenu.c Text input and modal text panels.
death.c Death sequence.

Sound and music

File Contents
sound.c Wave playback, sound bookkeeping and volume settings.
stream.cpp Game wrappers around the audio streamer.
speech.c Speech packets and speech cache.
music.c Music and sound-effect control.

ix audio library (C++)

File Contents
system.cpp Sound-system startup, master volume and voice allocation.
sound.cpp Sound objects, playback control and completion callbacks.
sample.cpp Sample loading, format conversion and sample lifetime.
streamer.cpp Audio stream management, buffering and playback control.
thread.cpp Worker thread and asynchronous audio chunk delivery.
streamfile.cpp Stream-file objects and read status.
dsp.cpp DirectSound initialization, device configuration and buffers.
dspv.cpp DirectSound voices, sample playback and voice parameters.
dsps.cpp DirectSound streaming ring buffers.
mixer.cpp Software-mixer scheduling and buffer management.
dspmix.asm Hand-written software sample mixer.
lzo1x.cpp LZO1X decompression for packed audio streams.
ixfile.cpp File I/O wrappers for the audio streamer.

Headers

File Contents
externs.h Declarations for external game and runtime functions.
functions.h Declarations for reconstructed game functions.
game.h Shared Win32 declarations, types and library interfaces.
game_data.h Game data structures, constants and packed resource formats.
globals.h Shared globals and their retail address annotations.
ix.h Audio classes, DirectSound interfaces and shared ix state.