This commit is contained in:
Fire-Head 2021-01-08 23:30:35 +03:00
commit 39a121351d
15 changed files with 41 additions and 41 deletions

View File

@ -111,7 +111,7 @@ GetModelFromName(const char *name)
for(i = 0; i < MODELINFOSIZE; i++){
mi = CModelInfo::GetModelInfo(i);
if(mi && mi->GetRwObject() && RwObjectGetType(mi->GetRwObject()) == rpCLUMP &&
strcmpIgnoringDigits(mi->GetName(), name))
strcmpIgnoringDigits(mi->GetModelName(), name))
return mi;
}
return nil;
@ -134,7 +134,7 @@ CAnimBlendAssocGroup::CreateAssociations(const char *name)
CAnimBlendHierarchy *anim = CAnimManager::GetAnimation(animBlock->firstIndex + i);
CBaseModelInfo *model = GetModelFromName(anim->name);
assert(model);
printf("Associated anim %s with model %s\n", anim->name, model->GetName());
printf("Associated anim %s with model %s\n", anim->name, model->GetModelName());
RpClump *clump = (RpClump*)model->CreateInstance();
#ifdef PED_SKIN
if(IsClumpSkinned(clump))

View File

@ -5788,7 +5788,7 @@ cAudioManager::GetCasualMaleOldTalkSfx(int16 sound)
uint32
cAudioManager::GetSpecialCharacterTalkSfx(int32 modelIndex, int32 sound)
{
char *modelName = CModelInfo::GetModelInfo(modelIndex)->GetName();
char *modelName = CModelInfo::GetModelInfo(modelIndex)->GetModelName();
if (!CGeneral::faststricmp(modelName, "eight") || !CGeneral::faststricmp(modelName, "eight2")) {
return GetEightTalkSfx(sound);
}

View File

@ -2556,7 +2556,7 @@ void CTheScripts::UpdateObjectIndices()
CBaseModelInfo* pModel = CModelInfo::GetModelInfo(j);
if (!pModel)
continue;
strcpy(name, pModel->GetName());
strcpy(name, pModel->GetModelName());
#ifdef FIX_BUGS
for (int k = 0; k < USED_OBJECT_NAME_LENGTH && name[k]; k++)
#else

View File

@ -445,7 +445,7 @@ bool
CFileLoader::StartLoadClumpFile(RwStream *stream, uint32 id)
{
if(RwStreamFindChunk(stream, rwID_CLUMP, nil, nil)){
printf("Start loading %s\n", CModelInfo::GetModelInfo(id)->GetName());
printf("Start loading %s\n", CModelInfo::GetModelInfo(id)->GetModelName());
return RpClumpGtaStreamRead1(stream);
}else{
printf("FAILED\n");
@ -459,7 +459,7 @@ CFileLoader::FinishLoadClumpFile(RwStream *stream, uint32 id)
RpClump *clump;
CClumpModelInfo *mi;
printf("Finish loading %s\n", CModelInfo::GetModelInfo(id)->GetName());
printf("Finish loading %s\n", CModelInfo::GetModelInfo(id)->GetModelName());
clump = RpClumpGtaStreamRead2(stream);
if(clump){
@ -1075,9 +1075,9 @@ SetModelInfoFlags(CSimpleModelInfo *mi, uint32 flags)
#ifdef HARDCODED_MODEL_FLAGS
// mobile sets these flags in CFileLoader::SetRelatedModelInfoCB, but that's stupid
if(MatchModelName(mi->GetName(), DoubleSidedNames)) mi->m_bIsDoubleSided = true;
if(MatchModelName(mi->GetName(), TreeNames)) mi->m_bIsTree = true;
if(MatchModelName(mi->GetName(), OptimizedNames)) mi->m_bCanBeIgnored = true;
if(MatchModelName(mi->GetModelName(), DoubleSidedNames)) mi->m_bIsDoubleSided = true;
if(MatchModelName(mi->GetModelName(), TreeNames)) mi->m_bIsTree = true;
if(MatchModelName(mi->GetModelName(), OptimizedNames)) mi->m_bCanBeIgnored = true;
#endif
#endif
@ -1119,7 +1119,7 @@ CFileLoader::LoadObject(const char *line)
}
mi = CModelInfo::AddSimpleModel(id);
mi->SetName(model);
mi->SetModelName(model);
mi->SetNumAtomics(numObjs);
mi->SetLodDistances(dist);
SetModelInfoFlags(mi, flags);
@ -1138,7 +1138,7 @@ CFileLoader::LoadMLO(const char *line)
sscanf(line, "%s %s %d %f", smth, name, &modelIndex, &someFloat);
CMloModelInfo *minfo = CModelInfo::AddMloModel(modelIndex);
minfo->SetName(name);
minfo->SetModelName(name);
minfo->field_34 = someFloat;
int instId = CModelInfo::GetMloInstanceStore().allocPtr;
minfo->firstInstance = instId;
@ -1216,7 +1216,7 @@ CFileLoader::LoadTimeObject(const char *line)
}
mi = CModelInfo::AddTimeModel(id);
mi->SetName(model);
mi->SetModelName(model);
mi->SetNumAtomics(numObjs);
mi->SetLodDistances(dist);
SetModelInfoFlags(mi, flags);
@ -1238,7 +1238,7 @@ CFileLoader::LoadClumpObject(const char *line)
if(sscanf(line, "%d %s %s", &id, model, txd) == 3){
mi = CModelInfo::AddClumpModel(id);
mi->SetName(model);
mi->SetModelName(model);
mi->SetTexDictionary(txd);
mi->SetColModel(&CTempColModels::ms_colModelBBox);
}
@ -1262,7 +1262,7 @@ CFileLoader::LoadVehicleObject(const char *line)
&frequency, &level, &comprules, &misc, &wheelScale);
mi = CModelInfo::AddVehicleModel(id);
mi->SetName(model);
mi->SetModelName(model);
mi->SetTexDictionary(txd);
for(p = gamename; *p; p++)
if(*p == '_') *p = ' ';
@ -1341,7 +1341,7 @@ CFileLoader::LoadPedObject(const char *line)
return;
mi = CModelInfo::AddPedModel(id);
mi->SetName(model);
mi->SetModelName(model);
mi->SetTexDictionary(txd);
mi->SetColModel(&CTempColModels::ms_colModelPed1);
mi->m_pedType = CPedType::FindPedType(pedType);
@ -1815,7 +1815,7 @@ CFileLoader::ReloadObject(const char *line)
#ifdef FIX_BUGS
mi &&
#endif
mi->GetModelType() == MITYPE_SIMPLE && !strcmp(mi->GetName(), model) && mi->m_numAtomics == numObjs) {
mi->GetModelType() == MITYPE_SIMPLE && !strcmp(mi->GetModelName(), model) && mi->m_numAtomics == numObjs) {
mi->SetLodDistances(dist);
SetModelInfoFlags(mi, flags);
} else {

View File

@ -485,7 +485,7 @@ INITSAVEBUF
#endif
CopyToBuf(buf, CWanted::MaximumWantedLevel);
CopyToBuf(buf, CWanted::nMaximumWantedLevel);
memcpy(buf, CModelInfo::GetModelInfo(pPed->GetModelIndex())->GetName(), MAX_MODEL_NAME);
memcpy(buf, CModelInfo::GetModelInfo(pPed->GetModelIndex())->GetModelName(), MAX_MODEL_NAME);
SkipSaveBuf(buf, MAX_MODEL_NAME);
}
}

View File

@ -515,7 +515,7 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
// texDict will exist even if only first part has loaded
if(CTxdStore::GetSlot(mi->GetTxdSlot())->texDict == nil){
#endif
debug("failed to load %s because TXD %s is not in memory\n", mi->GetName(), CTxdStore::GetTxdName(mi->GetTxdSlot()));
debug("failed to load %s because TXD %s is not in memory\n", mi->GetModelName(), CTxdStore::GetTxdName(mi->GetTxdSlot()));
RemoveModel(streamId);
#ifndef FIX_BUGS
// if we're just waiting for it to load, don't remove this
@ -557,7 +557,7 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
CTxdStore::RemoveRefWithoutDelete(mi->GetTxdSlot());
if(!success){
debug("Failed to load %s\n", CModelInfo::GetModelInfo(streamId)->GetName());
debug("Failed to load %s\n", CModelInfo::GetModelInfo(streamId)->GetModelName());
RemoveModel(streamId);
ReRequestModel(streamId);
RwStreamClose(stream, &mem);
@ -598,7 +598,7 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
if(!success){
ReRequestModel(streamId);
if(streamId < STREAM_OFFSET_TXD)
debug("Failed to load %s.dff\n", mi->GetName());
debug("Failed to load %s.dff\n", mi->GetModelName());
else
debug("Failed to load %s.txd\n", CTxdStore::GetTxdName(streamId - STREAM_OFFSET_TXD));
return false;
@ -639,7 +639,7 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
timeDiff = endTime - startTime;
if(timeDiff > 5){
if(streamId < STREAM_OFFSET_TXD)
debug("model %s took %d ms\n", CModelInfo::GetModelInfo(streamId)->GetName(), timeDiff);
debug("model %s took %d ms\n", CModelInfo::GetModelInfo(streamId)->GetModelName(), timeDiff);
else
debug("txd %s took %d ms\n", CTxdStore::GetTxdName(streamId - STREAM_OFFSET_TXD), timeDiff);
}
@ -713,7 +713,7 @@ CStreaming::FinishLoadingLargeFile(int8 *buf, int32 streamId)
timeDiff = endTime - startTime;
if(timeDiff > 5){
if(streamId < STREAM_OFFSET_TXD)
debug("finish model %s took %d ms\n", CModelInfo::GetModelInfo(streamId)->GetName(), timeDiff);
debug("finish model %s took %d ms\n", CModelInfo::GetModelInfo(streamId)->GetModelName(), timeDiff);
else
debug("finish txd %s took %d ms\n", CTxdStore::GetTxdName(streamId - STREAM_OFFSET_TXD), timeDiff);
}
@ -867,14 +867,14 @@ CStreaming::RequestSpecialModel(int32 modelId, const char *modelName, int32 flag
uint32 pos, size;
mi = CModelInfo::GetModelInfo(modelId);
if(!CGeneral::faststrcmp(mi->GetName(), modelName)){
if(!CGeneral::faststrcmp(mi->GetModelName(), modelName)){
// Already have the correct name, just request it
RequestModel(modelId, flags);
return;
}
strcpy(oldName, mi->GetName());
mi->SetName(modelName);
strcpy(oldName, mi->GetModelName());
mi->SetModelName(modelName);
// What exactly is going on here?
if(CModelInfo::GetModelInfo(oldName, nil)){
@ -2775,7 +2775,7 @@ CStreaming::PrintStreamingBufferState()
sprintf(str, "txd %s, refs %d, size %dK, flags 0x%x", CTxdStore::GetTxdName(modelIndex - STREAM_OFFSET_TXD),
CTxdStore::GetNumRefs(modelIndex - STREAM_OFFSET_TXD), 2 * size, streamingInfo->m_flags);
else
sprintf(str, "model %d,%s, refs%d, size%dK, flags%x", modelIndex, modelInfo->GetName(), modelInfo->GetNumRefs(), 2 * size,
sprintf(str, "model %d,%s, refs%d, size%dK, flags%x", modelIndex, modelInfo->GetModelName(), modelInfo->GetNumRefs(), 2 * size,
streamingInfo->m_flags);
AsciiToUnicode(str, wstr);
CFont::PrintString(24.0f, y, wstr);

View File

@ -582,7 +582,7 @@ CEntity::SetupBigBuilding(void)
if(m_level == LEVEL_GENERIC){
if(mi->GetTxdSlot() != CTxdStore::FindTxdSlot("generic")){
mi->SetTexDictionary("generic");
printf("%d:%s txd has been set to generic\n", m_modelIndex, mi->GetName());
printf("%d:%s txd has been set to generic\n", m_modelIndex, mi->GetModelName());
}
}
if(mi->m_lodDistances[0] > 2000.0f)

View File

@ -54,8 +54,8 @@ public:
bool IsClump(void) { return m_type == MITYPE_CLUMP || m_type == MITYPE_PED || m_type == MITYPE_VEHICLE ||
m_type == MITYPE_MLO || m_type == MITYPE_XTRACOMPS; // unused but what the heck
}
char *GetName(void) { return m_name; }
void SetName(const char *name) { strncpy(m_name, name, MAX_MODEL_NAME); }
char *GetModelName(void) { return m_name; }
void SetModelName(const char *name) { strncpy(m_name, name, MAX_MODEL_NAME); }
void SetColModel(CColModel *col, bool owns = false){
m_colModel = col; m_bOwnsColModel = owns; }
CColModel *GetColModel(void) { return m_colModel; }

View File

@ -112,7 +112,7 @@ CClumpModelInfo::SetClump(RpClump *clump)
}
RpHAnimHierarchySetFlags(hier, (RpHAnimHierarchyFlag)(rpHANIMHIERARCHYUPDATEMODELLINGMATRICES|rpHANIMHIERARCHYUPDATELTMS));
}
if(strcmp(GetName(), "playerh") == 0){
if(strcmp(GetModelName(), "playerh") == 0){
// playerh is incompatible with the xbox player skin
// so check if player model is skinned and only apply skin to head if it isn't
CPedModelInfo *body = (CPedModelInfo*)CModelInfo::GetModelInfo(MI_PLAYER);
@ -120,7 +120,7 @@ CClumpModelInfo::SetClump(RpClump *clump)
RpClumpForAllAtomics(clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
}
#else
if(strcmp(GetName(), "playerh") == 0){
if(strcmp(GetModelName(), "playerh") == 0){
RpClumpForAllAtomics(clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
#endif
}

View File

@ -192,7 +192,7 @@ CModelInfo::GetModelInfo(const char *name, int *id)
CBaseModelInfo *modelinfo;
for(int i = 0; i < MODELINFOSIZE; i++){
modelinfo = CModelInfo::ms_modelInfoPtrs[i];
if(modelinfo && !CGeneral::faststricmp(modelinfo->GetName(), name)){
if(modelinfo && !CGeneral::faststricmp(modelinfo->GetModelName(), name)){
if(id)
*id = i;
return modelinfo;

View File

@ -97,7 +97,7 @@ CPedModelInfo::SetClump(RpClump *clump)
#endif
#ifdef PED_SKIN
// CB has to be set here before atomics are detached from clump
if(strcmp(GetName(), "player") == 0)
if(strcmp(GetModelName(), "player") == 0)
RpClumpForAllAtomics(clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
if(IsClumpSkinned(clump)){
LimbCBarg limbs = { this, clump, { 0, 0, 0 } };
@ -108,7 +108,7 @@ CPedModelInfo::SetClump(RpClump *clump)
if(m_hitColModel == nil && !IsClumpSkinned(clump))
CreateHitColModel();
// And again because CClumpModelInfo resets it
if(strcmp(GetName(), "player") == 0)
if(strcmp(GetModelName(), "player") == 0)
RpClumpForAllAtomics(m_clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
else if(IsClumpSkinned(clump))
// skinned peds have no low detail version, so they don't have the right render Cb
@ -118,7 +118,7 @@ CPedModelInfo::SetClump(RpClump *clump)
SetFrameIds(m_pPedIds);
if(m_hitColModel == nil)
CreateHitColModel();
if(strcmp(GetName(), "player") == 0)
if(strcmp(GetModelName(), "player") == 0)
RpClumpForAllAtomics(m_clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
#endif
}

View File

@ -143,7 +143,7 @@ CSimpleModelInfo::FindRelatedModel(void)
for(i = 0; i < MODELINFOSIZE; i++){
mi = CModelInfo::GetModelInfo(i);
if(mi && mi != this &&
!CGeneral::faststrcmp(GetName()+3, mi->GetName()+3)){
!CGeneral::faststrcmp(GetModelName()+3, mi->GetModelName()+3)){
assert(mi->IsSimple());
this->SetRelatedModel((CSimpleModelInfo*)mi);
return;

View File

@ -11,7 +11,7 @@ CTimeModelInfo::FindOtherTimeModel(void)
char *p;
int i;
strcpy(name, GetName());
strcpy(name, GetModelName());
// change _nt to _dy
if(p = strstr(name, "_nt"))
strncpy(p, "_dy", 4);
@ -24,7 +24,7 @@ CTimeModelInfo::FindOtherTimeModel(void)
for(i = 0; i < MODELINFOSIZE; i++){
CBaseModelInfo *mi = CModelInfo::GetModelInfo(i);
if (mi && mi->GetModelType() == MITYPE_TIME &&
!CGeneral::faststrncmp(name, mi->GetName(), MAX_MODEL_NAME)){
!CGeneral::faststrncmp(name, mi->GetModelName(), MAX_MODEL_NAME)){
m_otherTimeModelID = i;
return (CTimeModelInfo*)mi;
}

View File

@ -59,7 +59,7 @@ CPed::ServiceTalking(void)
if (bBodyPartJustCameOff && m_bodyPartBleeding == PED_HEAD)
return;
if (!CGeneral::faststricmp(CModelInfo::GetModelInfo(GetModelIndex())->GetName(), "bomber"))
if (!CGeneral::faststricmp(CModelInfo::GetModelInfo(GetModelIndex())->GetModelName(), "bomber"))
m_queuedSound = SOUND_PED_BOMBER;
else if (m_nPedState == PED_ON_FIRE)
m_queuedSound = SOUND_PED_BURNING;

View File

@ -4582,7 +4582,7 @@ CAutomobile::SetBumperDamage(int32 component, ePanels panel, bool noFlyingCompon
int status = Damage.GetPanelStatus(panel);
if(m_aCarNodes[component] == nil){
printf("Trying to damage component %d of %s\n",
component, CModelInfo::GetModelInfo(GetModelIndex())->GetName());
component, CModelInfo::GetModelInfo(GetModelIndex())->GetModelName());
return;
}
if(status == PANEL_STATUS_SMASHED1){
@ -4602,7 +4602,7 @@ CAutomobile::SetDoorDamage(int32 component, eDoors door, bool noFlyingComponents
int status = Damage.GetDoorStatus(door);
if(m_aCarNodes[component] == nil){
printf("Trying to damage component %d of %s\n",
component, CModelInfo::GetModelInfo(GetModelIndex())->GetName());
component, CModelInfo::GetModelInfo(GetModelIndex())->GetModelName());
return;
}