summaryrefslogtreecommitdiffstats
path: root/src/modelinfo
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-12-25 14:18:13 +0100
committerSergeanur <s.anureev@yandex.ua>2020-12-25 14:18:13 +0100
commitb12eef1d56575206538abed426a296fefe22e90e (patch)
treea029f5ec513ec487d477d791e21f90ae1287965a /src/modelinfo
parentFix debug menu memory leak (diff)
downloadre3-b12eef1d56575206538abed426a296fefe22e90e.tar
re3-b12eef1d56575206538abed426a296fefe22e90e.tar.gz
re3-b12eef1d56575206538abed426a296fefe22e90e.tar.bz2
re3-b12eef1d56575206538abed426a296fefe22e90e.tar.lz
re3-b12eef1d56575206538abed426a296fefe22e90e.tar.xz
re3-b12eef1d56575206538abed426a296fefe22e90e.tar.zst
re3-b12eef1d56575206538abed426a296fefe22e90e.zip
Diffstat (limited to '')
-rw-r--r--src/modelinfo/ClumpModelInfo.cpp4
-rw-r--r--src/modelinfo/PedModelInfo.cpp6
-rw-r--r--src/modelinfo/TimeModelInfo.cpp3
-rw-r--r--src/modelinfo/VehicleModelInfo.cpp12
4 files changed, 13 insertions, 12 deletions
diff --git a/src/modelinfo/ClumpModelInfo.cpp b/src/modelinfo/ClumpModelInfo.cpp
index 1ae936a7..64bb5ed5 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(strncmp(GetName(), "playerh", 8) == 0){
+ if(strcmp(GetName(), "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(strncmp(GetName(), "playerh", 8) == 0){
+ if(strcmp(GetName(), "playerh") == 0){
RpClumpForAllAtomics(clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
#endif
}
diff --git a/src/modelinfo/PedModelInfo.cpp b/src/modelinfo/PedModelInfo.cpp
index b77cccda..38ce6d38 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(strncmp(GetName(), "player", 7) == 0)
+ if(strcmp(GetName(), "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(strncmp(GetName(), "player", 7) == 0)
+ if(strcmp(GetName(), "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(strncmp(GetName(), "player", 7) == 0)
+ if(strcmp(GetName(), "player") == 0)
RpClumpForAllAtomics(m_clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
#endif
}
diff --git a/src/modelinfo/TimeModelInfo.cpp b/src/modelinfo/TimeModelInfo.cpp
index d4f92293..c1c18dac 100644
--- a/src/modelinfo/TimeModelInfo.cpp
+++ b/src/modelinfo/TimeModelInfo.cpp
@@ -2,6 +2,7 @@
#include "Camera.h"
#include "ModelInfo.h"
+#include "General.h"
CTimeModelInfo*
CTimeModelInfo::FindOtherTimeModel(void)
@@ -23,7 +24,7 @@ CTimeModelInfo::FindOtherTimeModel(void)
for(i = 0; i < MODELINFOSIZE; i++){
CBaseModelInfo *mi = CModelInfo::GetModelInfo(i);
if (mi && mi->GetModelType() == MITYPE_TIME &&
- strncmp(name, mi->GetName(), 24) == 0){
+ !CGeneral::faststrncmp(name, mi->GetName(), MAX_MODEL_NAME)){
m_otherTimeModelID = i;
return (CTimeModelInfo*)mi;
}
diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp
index cc2a7e34..c0daaead 100644
--- a/src/modelinfo/VehicleModelInfo.cpp
+++ b/src/modelinfo/VehicleModelInfo.cpp
@@ -293,7 +293,7 @@ CVehicleModelInfo::SetAtomicRendererCB(RpAtomic *atomic, void *data)
name = GetFrameNodeName(RpAtomicGetFrame(atomic));
alpha = false;
RpGeometryForAllMaterials(RpAtomicGetGeometry(atomic), HasAlphaMaterialCB, &alpha);
- if(strstr(name, "_hi") || strncmp(name, "extra", 5) == 0){
+ if(strstr(name, "_hi") || !CGeneral::faststrncmp(name, "extra", 5)) {
if(alpha || strncmp(name, "windscreen", 10) == 0)
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailAlphaCB);
else
@@ -319,7 +319,7 @@ CVehicleModelInfo::SetAtomicRendererCB_BigVehicle(RpAtomic *atomic, void *data)
name = GetFrameNodeName(RpAtomicGetFrame(atomic));
alpha = false;
RpGeometryForAllMaterials(RpAtomicGetGeometry(atomic), HasAlphaMaterialCB, &alpha);
- if(strstr(name, "_hi") || strncmp(name, "extra", 5) == 0){
+ if(strstr(name, "_hi") || !CGeneral::faststrncmp(name, "extra", 5)) {
if(alpha)
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailAlphaCB_BigVehicle);
else
@@ -367,7 +367,7 @@ CVehicleModelInfo::SetAtomicRendererCB_Boat(RpAtomic *atomic, void *data)
clump = (RpClump*)data;
name = GetFrameNodeName(RpAtomicGetFrame(atomic));
- if(strcmp(name, "boat_hi") == 0 || strncmp(name, "extra", 5) == 0)
+ if(strcmp(name, "boat_hi") == 0 || !CGeneral::faststrncmp(name, "extra", 5))
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailCB_Boat);
else if(strstr(name, "_hi"))
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailCB);
@@ -914,11 +914,11 @@ CVehicleModelInfo::LoadVehicleColours(void)
continue;
if(section == NONE){
- if(strncmp(&line[start], "col", 3) == 0)
+ if(line[start] == 'c' && line[start + 1] == 'o' && line[start + 2] == 'l')
section = COLOURS;
- else if(strncmp(&line[start], "car", 3) == 0)
+ else if(line[start] == 'c' && line[start + 1] == 'a' && line[start + 2] == 'r')
section = CARS;
- }else if(strncmp(&line[start], "end", 3) == 0){
+ }else if(line[start] == 'e' && line[start + 1] == 'n' && line[start + 2] == 'd'){
section = NONE;
}else if(section == COLOURS){
sscanf(&line[start], // BUG: games doesn't add start