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

140 lines
3.0 KiB
C++

#include "MW4Headers.hpp"
#include "ArtilleryMark.hpp"
#include "MWTool.hpp"
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
ArtilleryMark__GameModel::ConstructGameModel(Script *script)
{
Check_Object(script);
//
//--------------
// Set up stream
//--------------
//
MemoryStream *model_stream = script->modelStream;
Check_Object(model_stream);
model_stream->AllocateBytes(sizeof(ArtilleryMark__GameModel));
StickyMover__GameModel::ConstructGameModel(script);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
bool
ArtilleryMark__GameModel::ReadAndVerify(
ArtilleryMark__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 =
StickyMover__GameModel::ReadAndVerify(
model,
attribute_entry,
data,
error,
error_buffer
);
//
//---------------------------
//Verify all the model values
//---------------------------
//
switch(attribute_entry->attributeID)
{
case ArtilleryModelResourceAttributeID:
{
if(!valid_data)
{
ResourceID value = ResourceID::Null;
attribute_entry->SetValue(model, (void *)&value);
result = true;
}
break;
}
case InitialLinearVelocityAttributeID:
{
if(!valid_data)
{
Vector3D value = Vector3D::Identity;
attribute_entry->SetValue(model, &value);
result = true;
}
if (model->initialLinearVelocity.x < 0)
{
_snprintf(
*error,
error_buffer,
"{[GameData]InitialLinearVelocity=%f %f %f}: value must be > 0!",
model->initialLinearVelocity.x,
model->initialLinearVelocity.y,
model->initialLinearVelocity.z
);
result = false;
}
break;
}
case InitialLinearAccelerationAttributeID:
{
if(!valid_data)
{
Vector3D value = Vector3D::Identity;
attribute_entry->SetValue(model, &value);
result = true;
}
if ((model->initialLinearAcceleration.x < 0) ||
(model->initialLinearAcceleration.z < 0))
{
_snprintf(
*error,
error_buffer,
"{[GameData]InitialLinearAcceleration=%f %f %f}: value must be > 0!",
model->initialLinearAcceleration.x,
model->initialLinearAcceleration.y,
model->initialLinearAcceleration.z
);
result = false;
}
break;
}
case DamageAmountAttributeID:
{
if(!valid_data)
{
Scalar value = 0.0f;
attribute_entry->SetValue(model, &value);
result = true;
}
if (model->damageAmount < 0)
{
_snprintf(
*error,
error_buffer,
"{[GameData]DamageAmount=%f}: value must be >= 0!",
model->damageAmount
);
result = false;
}
break;
}
}
return result;
}