1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 16:50:07 +00:00

Merge pull request #780 from Sergeanur/VC/ObjectData

ObjectData
This commit is contained in:
erorcun 2020-10-24 17:55:40 +03:00 committed by GitHub
commit 0913abe616
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 70 additions and 5 deletions

View file

@ -23,7 +23,7 @@ enum Config {
MAXVEHICLESLOADED = 50, // 70 on mobile MAXVEHICLESLOADED = 50, // 70 on mobile
NUMOBJECTINFO = 400, // TODO(MIAMI): fantasy // object.dat NUMOBJECTINFO = 210,
// Pool sizes // Pool sizes
NUMPTRNODES = 50000, NUMPTRNODES = 50000,

View file

@ -6,6 +6,8 @@
#include "FileMgr.h" #include "FileMgr.h"
#include "ObjectData.h" #include "ObjectData.h"
//--MIAMI: file done
CObjectInfo CObjectData::ms_aObjectInfo[NUMOBJECTINFO]; CObjectInfo CObjectData::ms_aObjectInfo[NUMOBJECTINFO];
// Another ugly file reader // Another ugly file reader
@ -19,10 +21,54 @@ CObjectData::Initialise(const char *filename)
int damageEffect, responseCase, camAvoid; int damageEffect, responseCase, camAvoid;
CBaseModelInfo *mi; CBaseModelInfo *mi;
ms_aObjectInfo[0].m_fMass = 99999.0f;
ms_aObjectInfo[0].m_fTurnMass = 99999.0f;
ms_aObjectInfo[0].m_fAirResistance = 0.99f;
ms_aObjectInfo[0].m_fElasticity = 0.1f;
ms_aObjectInfo[0].m_fBuoyancy = GRAVITY * ms_aObjectInfo[0].m_fMass * 2.0f;
ms_aObjectInfo[0].m_fUprootLimit = 0.0f;
ms_aObjectInfo[0].m_fCollisionDamageMultiplier = 1.0f;
ms_aObjectInfo[0].m_nCollisionDamageEffect = 0;
ms_aObjectInfo[0].m_nSpecialCollisionResponseCases = 0;
ms_aObjectInfo[0].m_bCameraToAvoidThisObject = false;
ms_aObjectInfo[1].m_fMass = 99999.0f;
ms_aObjectInfo[1].m_fTurnMass = 99999.0f;
ms_aObjectInfo[1].m_fAirResistance = 0.99f;
ms_aObjectInfo[1].m_fElasticity = 0.1f;
ms_aObjectInfo[1].m_fBuoyancy = ms_aObjectInfo[0].m_fBuoyancy;
ms_aObjectInfo[1].m_fUprootLimit = 0.0f;
ms_aObjectInfo[1].m_fCollisionDamageMultiplier = 1.0f;
ms_aObjectInfo[1].m_nCollisionDamageEffect = 0;
ms_aObjectInfo[1].m_nSpecialCollisionResponseCases = 0;
ms_aObjectInfo[1].m_bCameraToAvoidThisObject = true;
ms_aObjectInfo[2].m_fMass = 99999.0f;
ms_aObjectInfo[2].m_fTurnMass = 99999.0f;
ms_aObjectInfo[2].m_fAirResistance = 0.99f;
ms_aObjectInfo[2].m_fElasticity = 0.1f;
ms_aObjectInfo[2].m_fBuoyancy = ms_aObjectInfo[0].m_fBuoyancy;
ms_aObjectInfo[2].m_fUprootLimit = 0.0f;
ms_aObjectInfo[2].m_fCollisionDamageMultiplier = 1.0f;
ms_aObjectInfo[2].m_nCollisionDamageEffect = 0;
ms_aObjectInfo[2].m_bCameraToAvoidThisObject = false;
ms_aObjectInfo[2].m_nSpecialCollisionResponseCases = 4;
ms_aObjectInfo[3].m_fMass = 99999.0f;
ms_aObjectInfo[3].m_fTurnMass = 99999.0f;
ms_aObjectInfo[3].m_fAirResistance = 0.99f;
ms_aObjectInfo[3].m_fElasticity = 0.1f;
ms_aObjectInfo[3].m_fBuoyancy = ms_aObjectInfo[0].m_fBuoyancy;
ms_aObjectInfo[3].m_fUprootLimit = 0.0f;
ms_aObjectInfo[3].m_fCollisionDamageMultiplier = 1.0f;
ms_aObjectInfo[3].m_nCollisionDamageEffect = 0;
ms_aObjectInfo[3].m_nSpecialCollisionResponseCases = 4;
ms_aObjectInfo[3].m_bCameraToAvoidThisObject = true;
CFileMgr::SetDir(""); CFileMgr::SetDir("");
CFileMgr::LoadFile(filename, work_buff, sizeof(work_buff), "r"); CFileMgr::LoadFile(filename, work_buff, sizeof(work_buff), "r");
id = 0; id = 4;
p = (char*)work_buff; p = (char*)work_buff;
while(*p != '*'){ while(*p != '*'){
// skip over white space and comments // skip over white space and comments
@ -44,7 +90,11 @@ CObjectData::Initialise(const char *filename)
} }
if(*p == '\n') if(*p == '\n')
p++; p++;
#ifdef FIX_BUGS
*lp = '\0'; // FIX: game wrote '\n' here *lp = '\0'; // FIX: game wrote '\n' here
#else
*lp = '\n';
#endif
assert(id < NUMOBJECTINFO); assert(id < NUMOBJECTINFO);
sscanf(line, "%s %f %f %f %f %f %f %f %d %d %d", name, sscanf(line, "%s %f %f %f %f %f %f %f %d %d %d", name,
@ -63,9 +113,23 @@ CObjectData::Initialise(const char *filename)
ms_aObjectInfo[id].m_bCameraToAvoidThisObject = camAvoid; ms_aObjectInfo[id].m_bCameraToAvoidThisObject = camAvoid;
mi = CModelInfo::GetModelInfo(name, nil); mi = CModelInfo::GetModelInfo(name, nil);
if(mi) if (mi) {
if (ms_aObjectInfo[0].m_fMass != ms_aObjectInfo[id].m_fMass
|| ms_aObjectInfo[0].m_fCollisionDamageMultiplier != ms_aObjectInfo[id].m_fCollisionDamageMultiplier
|| ms_aObjectInfo[0].m_nCollisionDamageEffect != ms_aObjectInfo[id].m_nCollisionDamageEffect
|| ((ms_aObjectInfo[0].m_nSpecialCollisionResponseCases != ms_aObjectInfo[id].m_nSpecialCollisionResponseCases)
&& (ms_aObjectInfo[2].m_nSpecialCollisionResponseCases != ms_aObjectInfo[id].m_nSpecialCollisionResponseCases))) {
mi->SetObjectID(id++); mi->SetObjectID(id++);
} else if (ms_aObjectInfo[0].m_nSpecialCollisionResponseCases == ms_aObjectInfo[id].m_nSpecialCollisionResponseCases) {
if (ms_aObjectInfo[0].m_bCameraToAvoidThisObject == ms_aObjectInfo[id].m_bCameraToAvoidThisObject)
mi->SetObjectID(0);
else else
mi->SetObjectID(1);
} else if (ms_aObjectInfo[2].m_bCameraToAvoidThisObject == ms_aObjectInfo[id].m_bCameraToAvoidThisObject)
mi->SetObjectID(2);
else
mi->SetObjectID(3);
} else
debug("CObjectData: Cannot find object %s\n", name); debug("CObjectData: Cannot find object %s\n", name);
} }
} }
@ -92,6 +156,7 @@ CObjectData::SetObjectData(int32 modelId, CObject &object)
object.m_bCameraToAvoidThisObject = objinfo->m_bCameraToAvoidThisObject; object.m_bCameraToAvoidThisObject = objinfo->m_bCameraToAvoidThisObject;
if(object.m_fMass >= 99998.0f){ if(object.m_fMass >= 99998.0f){
object.bInfiniteMass = true; object.bInfiniteMass = true;
object.m_phy_flagA08 = true;
object.bAffectedByGravity = false; object.bAffectedByGravity = false;
object.bExplosionProof = true; object.bExplosionProof = true;
} }