Files
firestorm/Gameleap/code/mw4/Libraries/Adept/State_Tool.cpp
T
Cyd 2b8ca921cb Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS
Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
2026-06-24 21:28:16 -05:00

58 lines
1.8 KiB
C++

#include "AdeptHeaders.hpp"
#include "State.hpp"
//#############################################################################
//########################### StateEngine ###############################
//#############################################################################
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
StateEngine__FactoryRequest::ConstructFactoryRequest(Script *script)
{
Check_Pointer(this);
Check_Object(script);
//
//----------------------------------
// Point into the notation file page
//----------------------------------
//
Page *page = script->instancePage;
Check_Object(page);
const char* engine_name = script->stateEngineName;
Check_Pointer(engine_name);
//
//-------------------------------------------------------------------------
// Find the initial state and look it up in the engine's class data. If it
// doesn't exist, we got an error
//-------------------------------------------------------------------------
//
const char* state;
page->GetEntry(engine_name, &state, true);
StateEngine::ClassData *class_data = script->engineClass;
Check_Object(class_data);
const StateEngine::StateEntry *entry = class_data->FindStateEntry(state);
if (!entry)
{
STOP((
"%s: {[%s]%s=%s}: Unknown state!",
page->GetNotationFile()->GetFileName(),
page->GetName(),
engine_name,
state
));
}
//
//-------------------------------------------------------------------------
// Stuff the state number into both old and current state, then look to see
// if a different old state is required
//-------------------------------------------------------------------------
//
Check_Object(entry);
currentState = entry->stateNumber;
Verify(static_cast<unsigned>(currentState) < class_data->GetStateCount());
}