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

200 lines
5.2 KiB
C++

//===========================================================================//
// File: RTXWeaponSub_Tool.cpp
//---------------------------------------------------------------------------//
// Date Who Modification //
// -------- --- ---------------------------------------------------------- //
// 09/09/98 JSE Inital base class based off of Shadowrun/Adept
// 09/24/98 BDB Inital Weapon subsystem class based off of Subsystem_Tool.cpp
// 10/19/98 BDB Created LauchedWeapon subsytem based off of Weapon //
//---------------------------------------------------------------------------//
// Copyright (C) 1998, Fasa Interactive //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#include "MW4Headers.hpp"
#include "RTXWeaponSub.hpp"
#include "MWTool.hpp"
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
RTXWeaponSub__GameModel::ConstructGameModel(Script *script)
{
Check_Object(script);
//
//--------------
// Set up stream
//--------------
//
MemoryStream *model_stream = script->modelStream;
Check_Object(model_stream);
model_stream->AllocateBytes(sizeof(RTXWeaponSub__GameModel));
Weapon__GameModel::ConstructGameModel(script);
#if 0
RTXWeaponSub__GameModel *model =
Cast_Pointer(RTXWeaponSub__GameModel*, model_stream->GetPointer());
//
//------------------------------------
// Set up the The Beam Entity Resource
//------------------------------------
//
NotationFile *model_file = script->modelFile;
Check_Object(model_file);
Check_Object(Tool::Instance);
Tool::Instance->PushFilePath(model_file);
model->projectileModelID = ResourceID::Null;
const char *projectile_entity_name;
if(model_file->GetEntry("GameData", "ProjectileResource", &projectile_entity_name))
{
Resource projectile_resource;
Tool::Instance->ConstructDataList(&projectile_resource, projectile_entity_name);
Check_Object(&projectile_resource);
Verify(projectile_resource.DoesResourceExist());
model->projectileModelID = projectile_resource.GetResourceID();
}
Tool::Instance->PopFilePath();
#endif
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
bool
RTXWeaponSub__GameModel::ReadAndVerify(
RTXWeaponSub__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 =
Weapon__GameModel::ReadAndVerify(
model,
attribute_entry,
data,
error,
error_buffer
);
//
//---------------------------
//Verify all the model values
//---------------------------
//
switch(attribute_entry->attributeID)
{
case FireRateAttributeID:
{
if(!valid_data)
{
Scalar value = 1.0f;
attribute_entry->SetValue(model, &value);
result = true;
}
if (model->fireRate <= 0)
{
_snprintf(
*error,
error_buffer,
"{[GameData]FireRate=%f}: value must be > 0!",
model->fireRate
);
result = false;
}
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 ProjectileModelResourceAttributeID:
{
if(!valid_data)
{
ResourceID value = ResourceID::Null;
attribute_entry->SetValue(model, (void *)&value);
result = true;
}
break;
}
case TargetLockTimeAttributeID:
{
if(!valid_data)
{
Scalar value = 0.0f;
attribute_entry->SetValue(model, &value);
result = true;
}
if (model->targetLockTime < 0)
{
_snprintf(
*error,
error_buffer,
"{[GameData]TargetLockTime=%f}: value must be >= 0!",
model->targetLockTime
);
result = false;
}
break;
}
}
return result;
}