From 8eed6ae1794989eb15fe95d867c44c196080c4dd Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 8 Jan 2021 21:50:59 +0200 Subject: [PATCH] Use original names --- src/animation/AnimBlendAssocGroup.cpp | 4 ++-- src/audio/AudioLogic.cpp | 2 +- src/control/Script5.cpp | 2 +- src/core/FileLoader.cpp | 24 ++++++++++++------------ src/core/Pools.cpp | 2 +- src/core/Streaming.cpp | 18 +++++++++--------- src/entities/Entity.cpp | 2 +- src/modelinfo/BaseModelInfo.h | 4 ++-- src/modelinfo/ClumpModelInfo.cpp | 4 ++-- src/modelinfo/ModelInfo.cpp | 2 +- src/modelinfo/PedModelInfo.cpp | 6 +++--- src/modelinfo/SimpleModelInfo.cpp | 2 +- src/modelinfo/TimeModelInfo.cpp | 4 ++-- src/peds/PedChat.cpp | 2 +- src/vehicles/Automobile.cpp | 4 ++-- 15 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/animation/AnimBlendAssocGroup.cpp b/src/animation/AnimBlendAssocGroup.cpp index fe419f2a..1d234bb8 100644 --- a/src/animation/AnimBlendAssocGroup.cpp +++ b/src/animation/AnimBlendAssocGroup.cpp @@ -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)) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 976bbaec..777fdfe4 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -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); } diff --git a/src/control/Script5.cpp b/src/control/Script5.cpp index 7521fede..751fefa2 100644 --- a/src/control/Script5.cpp +++ b/src/control/Script5.cpp @@ -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 diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp index d847f473..22e0159c 100644 --- a/src/core/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -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 { diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp index 79841c14..d3801a2a 100644 --- a/src/core/Pools.cpp +++ b/src/core/Pools.cpp @@ -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); } } diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index dae7fadb..7b4218ba 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -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); diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp index 91b417d0..7fcc3829 100644 --- a/src/entities/Entity.cpp +++ b/src/entities/Entity.cpp @@ -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) diff --git a/src/modelinfo/BaseModelInfo.h b/src/modelinfo/BaseModelInfo.h index ae2b6668..3a94a83a 100644 --- a/src/modelinfo/BaseModelInfo.h +++ b/src/modelinfo/BaseModelInfo.h @@ -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; } diff --git a/src/modelinfo/ClumpModelInfo.cpp b/src/modelinfo/ClumpModelInfo.cpp index 64bb5ed5..ec64977b 100644 --- a/src/modelinfo/ClumpModelInfo.cpp +++ b/src/modelinfo/ClumpModelInfo.cpp @@ -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 } diff --git a/src/modelinfo/ModelInfo.cpp b/src/modelinfo/ModelInfo.cpp index dcde0df3..7aa5fc8b 100644 --- a/src/modelinfo/ModelInfo.cpp +++ b/src/modelinfo/ModelInfo.cpp @@ -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; diff --git a/src/modelinfo/PedModelInfo.cpp b/src/modelinfo/PedModelInfo.cpp index 38ce6d38..d0816467 100644 --- a/src/modelinfo/PedModelInfo.cpp +++ b/src/modelinfo/PedModelInfo.cpp @@ -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 } diff --git a/src/modelinfo/SimpleModelInfo.cpp b/src/modelinfo/SimpleModelInfo.cpp index 416bdad5..55828b31 100644 --- a/src/modelinfo/SimpleModelInfo.cpp +++ b/src/modelinfo/SimpleModelInfo.cpp @@ -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; diff --git a/src/modelinfo/TimeModelInfo.cpp b/src/modelinfo/TimeModelInfo.cpp index c1c18dac..0db5fb78 100644 --- a/src/modelinfo/TimeModelInfo.cpp +++ b/src/modelinfo/TimeModelInfo.cpp @@ -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; } diff --git a/src/peds/PedChat.cpp b/src/peds/PedChat.cpp index 81e295c6..907f5756 100644 --- a/src/peds/PedChat.cpp +++ b/src/peds/PedChat.cpp @@ -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; diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 753b853d..8f034126 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -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; }