Implemented faststrcmp, faststricmp, strcasecmp

This commit is contained in:
Sergeanur
2019-10-30 01:12:58 +02:00
parent c075b863d2
commit c202fc3b55
19 changed files with 101 additions and 53 deletions

View File

@ -1,5 +1,6 @@
#include "common.h"
#include "patcher.h"
#include "General.h"
#include "NodeName.h"
#include "VisibilityPlugins.h"
#include "ModelInfo.h"
@ -86,7 +87,7 @@ CClumpModelInfo::FindFrameFromNameCB(RwFrame *frame, void *data)
{
RwObjectNameAssociation *assoc = (RwObjectNameAssociation*)data;
if(_strcmpi(GetFrameNodeName(frame), assoc->name) != 0){
if(CGeneral::faststricmp(GetFrameNodeName(frame), assoc->name)){
RwFrameForAllChildren(frame, FindFrameFromNameCB, assoc);
return assoc->frame ? nil : frame;
}else{
@ -101,7 +102,7 @@ CClumpModelInfo::FindFrameFromNameWithoutIdCB(RwFrame *frame, void *data)
RwObjectNameAssociation *assoc = (RwObjectNameAssociation*)data;
if(CVisibilityPlugins::GetFrameHierarchyId(frame) ||
_strcmpi(GetFrameNodeName(frame), assoc->name) != 0){
CGeneral::faststricmp(GetFrameNodeName(frame), assoc->name)){
RwFrameForAllChildren(frame, FindFrameFromNameWithoutIdCB, assoc);
return assoc->frame ? nil : frame;
}else{

View File

@ -1,5 +1,6 @@
#include "common.h"
#include "patcher.h"
#include "General.h"
#include "ModelIndices.h"
#define X(name, var, addr) int16 &var = *(int16*)addr;
@ -18,7 +19,7 @@ void
MatchModelString(const char *modelname, int16 id)
{
#define X(name, var, addr) \
if(strcmp(name, modelname) == 0){ \
if(!CGeneral::faststrcmp(name, modelname)){ \
var = id; \
return; \
}

View File

@ -1,5 +1,6 @@
#include "common.h"
#include "patcher.h"
#include "General.h"
#include "TempColModels.h"
#include "ModelIndices.h"
#include "ModelInfo.h"
@ -159,7 +160,7 @@ CModelInfo::GetModelInfo(const char *name, int *id)
CBaseModelInfo *modelinfo;
for(int i = 0; i < MODELINFOSIZE; i++){
modelinfo = CModelInfo::ms_modelInfoPtrs[i];
if(modelinfo && _strcmpi(modelinfo->GetName(), name) == 0){
if(modelinfo && !CGeneral::faststricmp(modelinfo->GetName(), name)){
if(id)
*id = i;
return modelinfo;

View File

@ -1,5 +1,6 @@
#include "common.h"
#include "patcher.h"
#include "General.h"
#include "Ped.h"
#include "NodeName.h"
#include "VisibilityPlugins.h"
@ -60,7 +61,7 @@ FindPedFrameFromNameCB(RwFrame *frame, void *data)
{
RwObjectNameAssociation *assoc = (RwObjectNameAssociation*)data;
if(_strcmpi(GetFrameNodeName(frame)+1, assoc->name+1) != 0){
if(CGeneral::faststricmp(GetFrameNodeName(frame)+1, assoc->name+1)){
RwFrameForAllChildren(frame, FindPedFrameFromNameCB, assoc);
return assoc->frame ? nil : frame;
}else{

View File

@ -1,5 +1,6 @@
#include "common.h"
#include "patcher.h"
#include "General.h"
#include "Camera.h"
#include "ModelInfo.h"
@ -131,7 +132,7 @@ CSimpleModelInfo::FindRelatedModel(void)
for(i = 0; i < MODELINFOSIZE; i++){
mi = CModelInfo::GetModelInfo(i);
if(mi && mi != this &&
strcmp(GetName()+3, mi->GetName()+3) == 0){
!CGeneral::faststrcmp(GetName()+3, mi->GetName()+3)){
assert(mi->IsSimple());
this->SetRelatedModel((CSimpleModelInfo*)mi);
return;