Files
firestorm/Gameleap/code/mw4/Code/MW4/BeamEntity_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

108 lines
2.6 KiB
C++

#include "MW4Headers.hpp"
#include "BeamEntity.hpp"
#include "MWObject.hpp"
#include "MWTool.hpp"
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
BeamEntity__GameModel::ConstructGameModel(Script *script)
{
Check_Object(script);
//
//--------------
// Set up stream
//--------------
//
MemoryStream *model_stream = script->modelStream;
Check_Object(model_stream);
model_stream->AllocateBytes(sizeof(BeamEntity__GameModel));
Entity__GameModel::ConstructGameModel(script);
BeamEntity__GameModel *model =
Cast_Pointer(BeamEntity__GameModel*, model_stream->GetPointer());
//
//------------------------------
// Set up the model file pointer
//------------------------------
//
NotationFile *model_file = script->modelFile;
Check_Object(model_file);
model->hitEffectMaterialTable = ResourceID::Null;
Page *page = model_file->GetPage("GameData");
Check_Object(page);
NotationFile effects_file;
if (page->GetEntry("HitEffectsFile", &effects_file))
{
FileDependencies *old_deps = Resource::ParentFileDependencies;
FileDependencies effect_deps(*effects_file.GetFileDependencies());
Resource::ParentFileDependencies = &effect_deps;
model->hitEffectMaterialTable = MWObject__GameModel::CreateEffectTableResource(&effects_file, MaterialCount);
Resource::ParentFileDependencies = old_deps;
old_deps->AddDependencies(&effect_deps);
}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
bool
BeamEntity__GameModel::ReadAndVerify(
BeamEntity__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 =
Entity__GameModel::ReadAndVerify(
model,
attribute_entry,
data,
error,
error_buffer
);
//
//---------------------------
//Verify all the model values
//---------------------------
//
switch(attribute_entry->attributeID)
{
case HitEffectResourceAttributeID:
{
if(!valid_data)
{
ResourceID value = ResourceID::Null;
attribute_entry->SetValue(model, (void *)&value);
result = true;
}
break;
}
case DamageDecalResourceAttributeID:
{
if(!valid_data)
{
ResourceID value = ResourceID::Null;
attribute_entry->SetValue(model, (void *)&value);
result = true;
}
break;
}
}
return result;
}