update file loader for new VC fields

This commit is contained in:
aap 2020-05-10 18:14:14 +02:00
parent c07727eed0
commit d9a8bab631
7 changed files with 42 additions and 5 deletions

View File

@ -94,7 +94,9 @@ CFileLoader::LoadLevel(const char *filename)
CObjectData::Initialise("DATA\\OBJECT.DAT"); CObjectData::Initialise("DATA\\OBJECT.DAT");
CStreaming::Init(); CStreaming::Init();
CColStore::LoadAllCollision(); CColStore::LoadAllCollision();
// TODO(MIAMI): anim indices for(int i = 0; i < MODELINFOSIZE; i++)
if(CModelInfo::GetModelInfo(i))
CModelInfo::GetModelInfo(i)->ConvertAnimFileIndex();
objectsLoaded = true; objectsLoaded = true;
} }
LoadingScreenLoadingFile(line + 4); LoadingScreenLoadingFile(line + 4);
@ -597,7 +599,7 @@ CFileLoader::LoadObjectTypes(const char *filename)
if(id < minID) minID = id; if(id < minID) minID = id;
break; break;
case WEAP: case WEAP:
assert(0 && "can't do this yet"); LoadWeaponObject(line);
break; break;
case HIER: case HIER:
LoadClumpObject(line); LoadClumpObject(line);
@ -753,6 +755,27 @@ CFileLoader::LoadTimeObject(const char *line)
return id; return id;
} }
int
CFileLoader::LoadWeaponObject(const char *line)
{
int id, numObjs;
char model[24], txd[24], animFile[16];
float dist;
CWeaponModelInfo *mi;
sscanf(line, "%d %s %s %s %d %f", &id, model, txd, animFile, &numObjs, &dist);
mi = CModelInfo::AddWeaponModel(id);
mi->SetName(model);
mi->SetNumAtomics(1);
mi->m_lodDistances[0] = dist;
mi->SetTexDictionary(txd);
mi->SetAnimFile(animFile);
mi->SetColModel(&CTempColModels::ms_colModelWeapon);
MatchModelString(model, id);
return id;
}
void void
CFileLoader::LoadClumpObject(const char *line) CFileLoader::LoadClumpObject(const char *line)
{ {
@ -773,7 +796,7 @@ CFileLoader::LoadVehicleObject(const char *line)
{ {
int id; int id;
char model[24], txd[24]; char model[24], txd[24];
char type[8], handlingId[16], gamename[32], anims[16], vehclass[12]; char type[8], handlingId[16], gamename[32], animFile[16], vehclass[12];
uint32 frequency, comprules; uint32 frequency, comprules;
int32 level, misc; int32 level, misc;
float wheelScale; float wheelScale;
@ -782,13 +805,13 @@ CFileLoader::LoadVehicleObject(const char *line)
sscanf(line, "%d %s %s %s %s %s %s %s %d %d %x %d %f", sscanf(line, "%d %s %s %s %s %s %s %s %d %d %x %d %f",
&id, model, txd, &id, model, txd,
type, handlingId, gamename, anims, vehclass, type, handlingId, gamename, animFile, vehclass,
&frequency, &level, &comprules, &misc, &wheelScale); &frequency, &level, &comprules, &misc, &wheelScale);
mi = CModelInfo::AddVehicleModel(id); mi = CModelInfo::AddVehicleModel(id);
mi->SetName(model); mi->SetName(model);
mi->SetTexDictionary(txd); mi->SetTexDictionary(txd);
// TODO(MIAMI): anims mi->SetAnimFile(animFile);
for(p = gamename; *p; p++) for(p = gamename; *p; p++)
if(*p == '_') *p = ' '; if(*p == '_') *p = ' ';
strcpy(mi->m_gameName, gamename); strcpy(mi->m_gameName, gamename);
@ -867,6 +890,7 @@ CFileLoader::LoadPedObject(const char *line)
mi = CModelInfo::AddPedModel(id); mi = CModelInfo::AddPedModel(id);
mi->SetName(model); mi->SetName(model);
mi->SetTexDictionary(txd); mi->SetTexDictionary(txd);
mi->SetAnimFile(animFile);
mi->SetColModel(&CTempColModels::ms_colModelPed1); mi->SetColModel(&CTempColModels::ms_colModelPed1);
mi->m_pedType = CPedType::FindPedType(pedType); mi->m_pedType = CPedType::FindPedType(pedType);
mi->m_pedStatType = CPedStats::GetPedStatType(pedStats); mi->m_pedStatType = CPedStats::GetPedStatType(pedStats);
@ -876,6 +900,8 @@ CFileLoader::LoadPedObject(const char *line)
assert(animGroupId < NUM_ANIM_ASSOC_GROUPS); assert(animGroupId < NUM_ANIM_ASSOC_GROUPS);
mi->m_animGroup = animGroupId; mi->m_animGroup = animGroupId;
mi->m_carsCanDrive = carsCanDrive; mi->m_carsCanDrive = carsCanDrive;
mi->radio1 = radio1;
mi->radio2 = radio2;
} }
int int

View File

@ -25,6 +25,7 @@ public:
static void LoadObjectTypes(const char *filename); static void LoadObjectTypes(const char *filename);
static int LoadObject(const char *line); static int LoadObject(const char *line);
static int LoadTimeObject(const char *line); static int LoadTimeObject(const char *line);
static int LoadWeaponObject(const char *line);
static void LoadClumpObject(const char *line); static void LoadClumpObject(const char *line);
static void LoadVehicleObject(const char *line); static void LoadVehicleObject(const char *line);
static void LoadPedObject(const char *line); static void LoadPedObject(const char *line);

View File

@ -2358,6 +2358,8 @@ void CPad::ResetCheats(void)
CVehicle::bCheat3 = false; CVehicle::bCheat3 = false;
CVehicle::bCheat4 = false; CVehicle::bCheat4 = false;
CVehicle::bCheat5 = false; CVehicle::bCheat5 = false;
gbBlackCars = false;
gbPinkCars = false;
gbFastTime = false; gbFastTime = false;
CTimer::SetTimeScale(1.0f); CTimer::SetTimeScale(1.0f);

View File

@ -16,6 +16,7 @@ CColModel CTempColModels::ms_colModelPedGroundHit;
CColModel CTempColModels::ms_colModelBoot1; CColModel CTempColModels::ms_colModelBoot1;
CColModel CTempColModels::ms_colModelDoor1; CColModel CTempColModels::ms_colModelDoor1;
CColModel CTempColModels::ms_colModelBonnet1; CColModel CTempColModels::ms_colModelBonnet1;
CColModel CTempColModels::ms_colModelWeapon;
CColSphere s_aPedSpheres[3]; CColSphere s_aPedSpheres[3];
@ -285,5 +286,9 @@ CTempColModels::Initialise(void)
SET_COLMODEL_SPHERES(ms_colModelBodyPart2, s_aBodyPartSpheres2); SET_COLMODEL_SPHERES(ms_colModelBodyPart2, s_aBodyPartSpheres2);
ms_colModelWeapon.boundingSphere.Set(0.25f, CVector(0.0f, 0.0f, 0.0f));
ms_colModelWeapon.boundingBox.Set(CVector(-0.25f, -0.25, -0.25f), CVector(0.25f, 0.25, 0.25f));
#undef SET_COLMODEL_SPHERES #undef SET_COLMODEL_SPHERES
} }

View File

@ -18,6 +18,7 @@ public:
static CColModel ms_colModelBoot1; static CColModel ms_colModelBoot1;
static CColModel ms_colModelDoor1; static CColModel ms_colModelDoor1;
static CColModel ms_colModelBonnet1; static CColModel ms_colModelBonnet1;
static CColModel ms_colModelWeapon;
static void Initialise(void); static void Initialise(void);
}; };

View File

@ -162,6 +162,7 @@ CVehicleModelInfo::CVehicleModelInfo(void)
m_positions[i].z = 0.0f; m_positions[i].z = 0.0f;
} }
m_numColours = 0; m_numColours = 0;
m_animFileIndex = -1;
} }
void void

View File

@ -68,6 +68,7 @@ public:
uint8 m_currentColour1; uint8 m_currentColour1;
uint8 m_currentColour2; uint8 m_currentColour2;
RpAtomic *m_comps[6]; RpAtomic *m_comps[6];
// This is stupid, CClumpModelInfo already has it!
union { union {
int32 m_animFileIndex; int32 m_animFileIndex;
char *m_animFileName; char *m_animFileName;