WinMain // Application entry point
{
... // Check if application is already running
... // Check command line parameters (SITCOM, SHORTY, MST3K)
sub_410060 // GetModule and parse MAX_MEM command line parameter
sub_466970 // Registers the window class and create a Window
sub_466A34 // SetForegroundWindow
sub_41A7F0 // Initialize DirectDraw 640x480x16
sub_4101D0 // Find/set Application Path and CD-ROM path
sub_41031C // SetCurrentDirectory
... // Check for save game files "save\\*.sav"
sub_42C8E0 // Initialize sub-systems
{
sub_42B0A0( dword_480630 ) // Initialize time structure
sub_438E20( dword_481930 ) // Initialize MIX module
sub_438F30( "STARTUP.MIX") // Load "STARTUP.MIX"
sub_42A590( ) // Initialize GAMEINFO.DAT data structure
sub_429F9C( "GAMEINFO.DAT" ) // Load "GAMEINFO.DAT" from file
sub_42A5F4() // Check OS information
sub_42A640() // Check total and available memory
sub_424590( dword_4804C0 ) // Initialize datetime data structure
sub_42B1EC( dword_480640 ) // Initialize DirectDraw Surface
sub_42B1EC( dword_480644 )
sub_42B1EC( dword_480648 )
sub_42B1EC( dword_48064C )
... // Initialize LUT
if( save files are found )
{
sub_45EE60 // Load "10PT.FON" and display "SPLASH.IMG"
}
... // Initialize Combat Cover Waypoint data structure [dword_47F8A0]
... // Initialize Combat Flee Waypoint data structure [dword_47F8A0]
... // Initialize Global Variables data structure [dword_482CDC]
sub_40DEF0( dword_47F3E0 ) // Initialize AI-ACT%d.DLL data structure
sub_4475C0( dword_48ECC0, timeGetTime( ) ) // Set time
sub_401090( dword_47F098, 1.0 ) // LUT
sub_401090( dword_47F09C, 4.0 ) // LUT
sub_401090( dword_47F0A0, 12.0 ) // LUT
sub_42A9E0( dword_480610 ) // Initialize Game Flag data structure
sub_42FEC0( dword_4812F0 ) // Initialize World data structure
sub_410440( dword_488460 ) // Setup DirectSound
sub_4526E0( dword_48ED00 ) // Sound Effects data structure
sub_43A4C8( dword_48CB48 ) // Music data structure
sub_45E0C0( dword_490C60 ) // Speech data structure
sub_40ED88( dword_487F80 ) // Ambient Sound data structure
sub_42EB04() // Parse BLADE.INI
sub_438F30( "MUSIC.MIX", 0 ) // Load "MUSIC.MIX"
sub_438F30( "SFX.MIX", 0 ) // Load "SFX.MIX"
sub_438F30( "SPCHSFX.TLK", 1 ) // Load "SPCHSFX.MIX"
... // Initialize Actor data structures
... // Initialize Player [Actor: McCoy]
sub_4427B4( dword_48CB90 ) // Initialize Police Maze data structure
sub_4601D0( dword_483600, "ACTORS" ) // Text Resource ACTORS.TR[E]
sub_4601D0( dword_483608, "CRIMES" ) // Text Resource CRIMES.TR[E]
sub_4601D0( dword_483604, "CLUETYPE" ) // Text Resource CLUETYPE.TR[E]
sub_4601D0( dword_48360C, "KIA" ) // Text Resource KIA.TR[E]
sub_4601D0( dword_483610, "SPINDEST" ) // Text Resource SPINDEST.TR[E] (Spinner destination)
sub_4601D0( dword_483614, "VK" ) // Text Resource VK.TR[E] (Voight-Kampff)
sub_4601D0( dword_483618, "OPTIONS" ) // Text Resource OPTIONS.TR[E]
sub_41B0E4( dword_4800F4, "DLGMENU" ) // Initialize the dialog menu
... // Set/Scene database
sub_430B80( dword_4816F8 ) // KIA data structure
sub_45E4D0( dword_48354C ) // Spinner data structure
sub_41CEA0( dword_480190 ) // Elevator data structure
sub_449480( dword_482C34 ) // Score data structure
sub_428C30( dword_4805F0 ) // Font data structure
... // Load font "KIA6PT.FON"
... // Initialize and load "SHAPES.SHP"
sub_41DC90( dword_480378 ) // ESPER data structure
sub_4645D8( dword_4837C0 ) // Voight-Kampff data structure
sub_454340( dword_4831D4 ) // DAT data structure
sub_4117C0( dword_4831D4, "index.dat", dword_490C80 ) // Load "index.dat"
if( Full HDFrames is 1 ) // Load "hdframes.dat"
sub_412054( dword_4831D4, "hdframes.dat" )
else
sub_411D88( dword_4831D4, "hdframes.dat" )
sub_411F20( dword_4831D4, "coreanim.dat" ) // Load "coreanim.dat"
sub_414FF0( dword_47F870, "CLUES", gameInfoData->base12 ) // Initialize CLUES data structure
sub_4515F0( dword_482F78, -1, -1 ) // Initialize Object data structure
sub_44DA04( "_INIT.DLL" ) // Bind "_INIT.DLL"
{
SCRIPT_Initialize_Game()
{
Assign_Player_Gun_Hit_Sounds( 0, 517, 518, 519 );
Assign_Player_Gun_Hit_Sounds( 1, 520, 521, 522 );
Assign_Player_Gun_Hit_Sounds( 2, 523, 524, 525 );
Assign_Player_Gun_Miss_Sounds( 0, 526, 527, 528 );
Assign_Player_Gun_Miss_Sounds( 1, 529, 530, 531 );
Assign_Player_Gun_Miss_Sounds( 2, 532, 533, 534 );
sub_402DE0( ) // Clear Global variables | set default global variables | set score
sub_402ED0( ) // Clear and set Game Flags | Do random query
sub_403110( ) // Clear actor clue database
sub_4031A0( ) // Set actor clue database
sub_4148E0( ) // Set world waypoints
sub_410500( ) // Set scene database
sub_411374( ) // Set crime database
sub_402CF0( ) // Set spinner destinations
sub_401E14( ) // Set actor friendliness
sub_4012B0( ) // Set actor combat aggressiveness
sub_401CAC( ) // Set actor honesty
sub_401CC8( ) // Set actor intelligence
sub_401DF8( ) // Set actor stability
sub_40141C( ) // Set actor health
sub_412960( ) // Set combat waypoints
sub_4132B8( ) // Set combat flee waypoints
sub_402DC0( ) // shadows
}
}
sub_40E020( dword_47F3E0, 1 ) // Bind "AI-ACT%d.DLL"
sub_42E048() //
{
AI_DLL_Initialize(actor_id) // Initialize actor AI
AI_DLL_Change_Animation_Mode
}
}
... // Check error stack
if( save files are found )
{
sub_431040( dword_4816F8 ) // Load KIA dialog for save games
}
else
{
sub_449118( 1 ) // Initialize first time
}
sub_437870( ) // Game Loop
{
sub_4378A4()
{
sub_466E4C( ) // Windows Message Pump
if( game change )
{
sub_42ADE8( dword_48C870 ) // Initialize | Remove looping sounds | load SET DLL
}
if( save game )
{
sub_449290( dword_4808F4, 0 ) // Save Game
}
sub_45C038( ); // Sound
if ( KIA active)
{
sub_431590( dword_4816F8 ) // Process KIA
return
}
if ( Spinner active)
{
sub_45EB4C( dword_48354C ) // Process Spinner
sub_40F698( dword_487F80 ) // Ambient sound
return
}
if ( ESPER active)
{
sub_41E754( dword_480378 ) // Process ESPER
return
}
if ( Voight-Kampff active)
{
sub_461CCC( dword_4837C0 ) // Process Voight-Kampff
sub_40F698( dword_487F80 ) // Ambient sound
return
}
if ( Elevator active )
{
sub_41D650( dword_480190 ) // Process Elevator
sub_40F698( dword_487F80 ) // Ambient sound
return
}
if ( Score active )
{
sub_44975C( dword_482C34 ) // Process Score
sub_40F698( dword_487F80 ) // Ambient sound
return
}
if( Scene )
{
sub_449EC8( ) // SCRIPT_Player_Walked_In
}
... // if dialog is not active process actors
sub_442844( dword_48CB90 ) // Police Maze
sub_45C038( ); // Sound
sub_40F698( dword_487F80 ); // Ambient Sounds
sub_451F8C( dword_482F78, 0 ) // Scene obstacles
... // Process actor animation
sub_43076C( dword_4812F0 ); // Process World
... // if Dialog menu is active process
}
}
sub_42E0F8( ) // Shutdown sub-systems
sub_41A994( ) // Shutdown DirectDraw
}
BLADE.EXE Blueprint
Here is a partially unrolled loop that illustrates the sub-system initialization and the game loop.
Subscribe to:
Comments (Atom)