Files
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

176 lines
4.3 KiB
C++

//===========================================================================//
// File: bridge_Tool.cpp
//---------------------------------------------------------------------------//
// Date Who Modification //
// -------- --- ---------------------------------------------------------- //
// 01/12/2000 AHF Inital base class
//---------------------------------------------------------------------------//
//===========================================================================//
#include "MW4Headers.hpp"
#include "cultural.hpp"
#include <adept\tool.hpp>
#include <adept\damageobject.hpp>
#include "mwdamageobject.hpp"
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
Cultural__GameModel::ConstructGameModel(Script *script)
{
Check_Object(script);
//
//--------------
// Set up stream
//--------------
//
MemoryStream *model_stream = script->modelStream;
Check_Object(model_stream);
model_stream->AllocateBytes(sizeof(Cultural__GameModel));
BaseClass::ConstructGameModel(script);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
Cultural__CreateMessage::ConstructCreateMessage(Script *script)
{
Check_Object(script);
//
//--------------
// Set up stream
//--------------
//
MemoryStream *message_stream = script->messageStream;
Check_Object(message_stream);
message_stream->AllocateBytes(sizeof(Cultural__CreateMessage));
BaseClass::ConstructCreateMessage(script);
Cultural__CreateMessage *message =
Cast_Pointer(
Cultural__CreateMessage*,
message_stream->GetPointer()
);
message->messageLength = sizeof(*message);
//
//---------------------------------------------------------------
// Point at the notation file and make other files relative to it
//---------------------------------------------------------------
//
Page *instance_page = script->instancePage;
Check_Object(instance_page);
NotationFile *instance_file = instance_page->GetNotationFile();
Check_Object(instance_file);
Check_Object(Tool::Instance);
Tool::Instance->PushFilePath(instance_file);
Check_Object(Resource::ParentFileDependencies);
//
//----------------------------------------------------------
// Create messages a damage object stream only if it's there
//----------------------------------------------------------
//
{
message->destroyableFlag = true;
instance_page->GetEntry("destroyable", &message->destroyableFlag);
}
Tool::Instance->PopFilePath();
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
Cultural::SaveInstanceText(Page *instance_page)
{
Check_Object(this);
Check_Object(instance_page);
BaseClass::SaveInstanceText(instance_page);
instance_page->SetEntry("destroyable", destroyableFlag);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
bool
Cultural__GameModel::ReadAndVerify(
Cultural__GameModel *model,
ModelAttributeEntry *attribute_entry,
const char *data,
char **error,
int error_buffer
)
{
Check_Object(attribute_entry);
bool result = false;
bool valid_data = (*data != '\0');
//
//----------------------------------------
//Read in the values from the data entered
//----------------------------------------
//
result =
BaseClass::ReadAndVerify(
model,
attribute_entry,
data,
error,
error_buffer
);
//
//---------------------------
//Verify all the model values
//---------------------------
//
switch(attribute_entry->attributeID)
{
case DestroyedEffectResourceAttributeID:
{
if(!valid_data)
{
ResourceID value = ResourceID::Null;
attribute_entry->SetValue(model, (void *)&value);
result = true;
}
break;
}
case RammingDestroyedEffectResourceAttributeID:
{
if(!valid_data)
{
ResourceID value = ResourceID::Null;
attribute_entry->SetValue(model, (void *)&value);
result = true;
}
break;
}
case DeathEntityResourceAttributeID:
{
if(!valid_data)
{
ResourceID value = ResourceID::Null;
attribute_entry->SetValue(model, (void *)&value);
result = true;
}
break;
}
}
return result;
}