mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 12:40:00 +00:00
Merge pull request #263 from Sergeanur/strcmp
Implemented faststrcmp, faststricmp, strcasecmp
This commit is contained in:
commit
0df15bb73d
|
@ -1,5 +1,6 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
|
#include "General.h"
|
||||||
#include "ModelInfo.h"
|
#include "ModelInfo.h"
|
||||||
#include "AnimManager.h"
|
#include "AnimManager.h"
|
||||||
#include "RpAnimBlend.h"
|
#include "RpAnimBlend.h"
|
||||||
|
@ -38,7 +39,7 @@ CAnimBlendAssocGroup::GetAnimation(const char *name)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < numAssociations; i++)
|
for(i = 0; i < numAssociations; i++)
|
||||||
if(strcmpi(assocList[i].hierarchy->name, name) == 0)
|
if(!CGeneral::faststricmp(assocList[i].hierarchy->name, name))
|
||||||
return &assocList[i];
|
return &assocList[i];
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +65,7 @@ CAnimBlendAssocGroup::CopyAnimation(const char *name)
|
||||||
return new CAnimBlendAssociation(*anim);
|
return new CAnimBlendAssociation(*anim);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
bool
|
||||||
strcmpIgnoringDigits(const char *s1, const char *s2)
|
strcmpIgnoringDigits(const char *s1, const char *s2)
|
||||||
{
|
{
|
||||||
char c1, c2;
|
char c1, c2;
|
||||||
|
@ -75,13 +76,13 @@ strcmpIgnoringDigits(const char *s1, const char *s2)
|
||||||
if(c1) s1++;
|
if(c1) s1++;
|
||||||
if(c2) s2++;
|
if(c2) s2++;
|
||||||
if(c1 == '\0' && c2 == '\0')
|
if(c1 == '\0' && c2 == '\0')
|
||||||
return 1;
|
return true;
|
||||||
if(islower(c1)) c1 = toupper(c1);
|
if(__ascii_iswdigit(c1) && __ascii_iswdigit(c2))
|
||||||
if(islower(c2)) c2 = toupper(c2);
|
|
||||||
if(isdigit(c1) && isdigit(c2))
|
|
||||||
continue;
|
continue;
|
||||||
|
c1 = __ascii_toupper(c1);
|
||||||
|
c2 = __ascii_toupper(c2);
|
||||||
if(c1 != c2)
|
if(c1 != c2)
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
|
#include "General.h"
|
||||||
#include "ModelInfo.h"
|
#include "ModelInfo.h"
|
||||||
#include "ModelIndices.h"
|
#include "ModelIndices.h"
|
||||||
#include "FileMgr.h"
|
#include "FileMgr.h"
|
||||||
|
@ -605,7 +606,7 @@ CAnimManager::GetAnimationBlock(const char *name)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i = 0; i < ms_numAnimBlocks; i++)
|
for(i = 0; i < ms_numAnimBlocks; i++)
|
||||||
if(strcmpi(ms_aAnimBlocks[i].name, name) == 0)
|
if(strcasecmp(ms_aAnimBlocks[i].name, name) == 0)
|
||||||
return &ms_aAnimBlocks[i];
|
return &ms_aAnimBlocks[i];
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
@ -617,7 +618,7 @@ CAnimManager::GetAnimation(const char *name, CAnimBlock *animBlock)
|
||||||
CAnimBlendHierarchy *hier = &ms_aAnimations[animBlock->firstIndex];
|
CAnimBlendHierarchy *hier = &ms_aAnimations[animBlock->firstIndex];
|
||||||
|
|
||||||
for(i = 0; i < animBlock->numAnims; i++){
|
for(i = 0; i < animBlock->numAnims; i++){
|
||||||
if(strcmpi(hier->name, name) == 0)
|
if(!CGeneral::faststricmp(hier->name, name))
|
||||||
return hier;
|
return hier;
|
||||||
hier++;
|
hier++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
|
#include "General.h"
|
||||||
#include "NodeName.h"
|
#include "NodeName.h"
|
||||||
#include "VisibilityPlugins.h"
|
#include "VisibilityPlugins.h"
|
||||||
#include "AnimBlendClumpData.h"
|
#include "AnimBlendClumpData.h"
|
||||||
|
@ -320,7 +321,7 @@ void
|
||||||
FrameFindCallBack(AnimBlendFrameData *frame, void *arg)
|
FrameFindCallBack(AnimBlendFrameData *frame, void *arg)
|
||||||
{
|
{
|
||||||
char *nodename = GetFrameNodeName(frame->frame);
|
char *nodename = GetFrameNodeName(frame->frame);
|
||||||
if(strcmpi(nodename, (char*)arg) == 0)
|
if(!CGeneral::faststricmp(nodename, (char*)arg))
|
||||||
pFrameDataFound = frame;
|
pFrameDataFound = frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
|
#include "General.h"
|
||||||
#include "audio_enums.h"
|
#include "audio_enums.h"
|
||||||
|
|
||||||
#include "AudioManager.h"
|
#include "AudioManager.h"
|
||||||
|
@ -2130,16 +2131,16 @@ uint32
|
||||||
cAudioManager::GetSpecialCharacterTalkSfx(int32 modelIndex, int32 sound)
|
cAudioManager::GetSpecialCharacterTalkSfx(int32 modelIndex, int32 sound)
|
||||||
{
|
{
|
||||||
char *modelName = CModelInfo::GetModelInfo(modelIndex)->GetName();
|
char *modelName = CModelInfo::GetModelInfo(modelIndex)->GetName();
|
||||||
if(strcmpi(modelName, "eight") == 0 || strcmpi(modelName, "eight2") == 0) { return GetEightTalkSfx(sound); }
|
if(!CGeneral::faststricmp(modelName, "eight") || !CGeneral::faststricmp(modelName, "eight2")) { return GetEightTalkSfx(sound); }
|
||||||
if(strcmpi(modelName, "frankie") == 0) { return GetFrankieTalkSfx(sound); }
|
if(!CGeneral::faststricmp(modelName, "frankie")) { return GetFrankieTalkSfx(sound); }
|
||||||
if(strcmpi(modelName, "misty") == 0) { return GetMistyTalkSfx(sound); }
|
if(!CGeneral::faststricmp(modelName, "misty")) { return GetMistyTalkSfx(sound); }
|
||||||
if(strcmpi(modelName, "ojg") == 0 || strcmpi(modelName, "ojg_p") == 0) { return GetOJGTalkSfx(sound); }
|
if(!CGeneral::faststricmp(modelName, "ojg") || !CGeneral::faststricmp(modelName, "ojg_p")) { return GetOJGTalkSfx(sound); }
|
||||||
if(strcmpi(modelName, "cat") == 0) { return GetCatatalinaTalkSfx(sound); }
|
if(!CGeneral::faststricmp(modelName, "cat")) { return GetCatatalinaTalkSfx(sound); }
|
||||||
if(strcmpi(modelName, "bomber") == 0) { return GetBomberTalkSfx(sound); }
|
if(!CGeneral::faststricmp(modelName, "bomber")) { return GetBomberTalkSfx(sound); }
|
||||||
if(strcmpi(modelName, "s_guard") == 0) { return GetSecurityGuardTalkSfx(sound); }
|
if(!CGeneral::faststricmp(modelName, "s_guard")) { return GetSecurityGuardTalkSfx(sound); }
|
||||||
if(strcmpi(modelName, "chunky") == 0) { return GetChunkyTalkSfx(sound); }
|
if(!CGeneral::faststricmp(modelName, "chunky")) { return GetChunkyTalkSfx(sound); }
|
||||||
if(strcmpi(modelName, "asuka") == 0) { return GetGenericFemaleTalkSfx(sound); }
|
if(!CGeneral::faststricmp(modelName, "asuka")) { return GetGenericFemaleTalkSfx(sound); }
|
||||||
if(strcmpi(modelName, "maria") == 0) { return GetGenericFemaleTalkSfx(sound); }
|
if(!CGeneral::faststricmp(modelName, "maria")) { return GetGenericFemaleTalkSfx(sound); }
|
||||||
|
|
||||||
return GetGenericMaleTalkSfx(sound);
|
return GetGenericMaleTalkSfx(sound);
|
||||||
}
|
}
|
||||||
|
@ -3100,7 +3101,7 @@ int32
|
||||||
FindMissionAudioSfx(const char *name)
|
FindMissionAudioSfx(const char *name)
|
||||||
{
|
{
|
||||||
for(uint32 i = 0; i < ARRAY_SIZE(MissionAudioNameSfxAssoc); ++i) {
|
for(uint32 i = 0; i < ARRAY_SIZE(MissionAudioNameSfxAssoc); ++i) {
|
||||||
if(strcmpi(MissionAudioNameSfxAssoc[i].m_pName, name) == 0) return MissionAudioNameSfxAssoc[i].m_nId;
|
if(!CGeneral::faststricmp(MissionAudioNameSfxAssoc[i].m_pName, name)) return MissionAudioNameSfxAssoc[i].m_nId;
|
||||||
}
|
}
|
||||||
debug("Can't find mission audio %s", name);
|
debug("Can't find mission audio %s", name);
|
||||||
return NO_SAMPLE;
|
return NO_SAMPLE;
|
||||||
|
|
|
@ -116,7 +116,7 @@ typedef struct provider_stuff
|
||||||
|
|
||||||
static int __cdecl comp(const provider_stuff*s1,const provider_stuff*s2)
|
static int __cdecl comp(const provider_stuff*s1,const provider_stuff*s2)
|
||||||
{
|
{
|
||||||
return( _stricmp(s1->name,s2->name) );
|
return(strcasecmp(s1->name, s2->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
|
#include "General.h"
|
||||||
#include "CutsceneMgr.h"
|
#include "CutsceneMgr.h"
|
||||||
#include "Directory.h"
|
#include "Directory.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
|
@ -107,7 +108,7 @@ int
|
||||||
FindCutsceneAudioTrackId(const char *szCutsceneName)
|
FindCutsceneAudioTrackId(const char *szCutsceneName)
|
||||||
{
|
{
|
||||||
for (int i = 0; musicNameIdAssoc[i].szTrackName; i++) {
|
for (int i = 0; musicNameIdAssoc[i].szTrackName; i++) {
|
||||||
if (!strcmpi(musicNameIdAssoc[i].szTrackName, szCutsceneName))
|
if (!CGeneral::faststricmp(musicNameIdAssoc[i].szTrackName, szCutsceneName))
|
||||||
return musicNameIdAssoc[i].iTrackId;
|
return musicNameIdAssoc[i].iTrackId;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -171,7 +172,7 @@ CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName)
|
||||||
CPlayerPed *pPlayerPed;
|
CPlayerPed *pPlayerPed;
|
||||||
|
|
||||||
ms_cutsceneProcessing = true;
|
ms_cutsceneProcessing = true;
|
||||||
if (!strcmpi(szCutsceneName, "jb"))
|
if (!strcasecmp(szCutsceneName, "jb"))
|
||||||
ms_useLodMultiplier = true;
|
ms_useLodMultiplier = true;
|
||||||
CTimer::Stop();
|
CTimer::Stop();
|
||||||
|
|
||||||
|
@ -207,7 +208,7 @@ CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName)
|
||||||
|
|
||||||
CFileMgr::CloseFile(file);
|
CFileMgr::CloseFile(file);
|
||||||
|
|
||||||
if (strcmpi(ms_cutsceneName, "end")) {
|
if (CGeneral::faststricmp(ms_cutsceneName, "end")) {
|
||||||
DMAudio.ChangeMusicMode(MUSICMODE_CUTSCENE);
|
DMAudio.ChangeMusicMode(MUSICMODE_CUTSCENE);
|
||||||
int trackId = FindCutsceneAudioTrackId(szCutsceneName);
|
int trackId = FindCutsceneAudioTrackId(szCutsceneName);
|
||||||
if (trackId != -1) {
|
if (trackId != -1) {
|
||||||
|
@ -364,9 +365,9 @@ CCutsceneMgr::DeleteCutsceneData(void)
|
||||||
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_80;
|
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_80;
|
||||||
CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(false);
|
CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(false);
|
||||||
|
|
||||||
if (strcmpi(ms_cutsceneName, "end")) {
|
if (CGeneral::faststricmp(ms_cutsceneName, "end")) {
|
||||||
DMAudio.StopCutSceneMusic();
|
DMAudio.StopCutSceneMusic();
|
||||||
if (strcmpi(ms_cutsceneName, "bet"))
|
if (CGeneral::faststricmp(ms_cutsceneName, "bet"))
|
||||||
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
|
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
|
||||||
}
|
}
|
||||||
CTimer::Stop();
|
CTimer::Stop();
|
||||||
|
@ -389,7 +390,7 @@ CCutsceneMgr::Update(void)
|
||||||
switch (ms_cutsceneLoadStatus) {
|
switch (ms_cutsceneLoadStatus) {
|
||||||
case CUTSCENE_LOADING_AUDIO:
|
case CUTSCENE_LOADING_AUDIO:
|
||||||
SetupCutsceneToStart();
|
SetupCutsceneToStart();
|
||||||
if (strcmpi(ms_cutsceneName, "end"))
|
if (CGeneral::faststricmp(ms_cutsceneName, "end"))
|
||||||
DMAudio.PlayPreloadedCutSceneMusic();
|
DMAudio.PlayPreloadedCutSceneMusic();
|
||||||
ms_cutsceneLoadStatus++;
|
ms_cutsceneLoadStatus++;
|
||||||
break;
|
break;
|
||||||
|
@ -407,7 +408,7 @@ CCutsceneMgr::Update(void)
|
||||||
if (!ms_running) return;
|
if (!ms_running) return;
|
||||||
|
|
||||||
ms_cutsceneTimer += CTimer::GetTimeStepNonClipped() * 0.02f;
|
ms_cutsceneTimer += CTimer::GetTimeStepNonClipped() * 0.02f;
|
||||||
if (strcmpi(ms_cutsceneName, "end") && TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FLYBY && ms_cutsceneLoadStatus == CUTSCENE_LOADING_0) {
|
if (CGeneral::faststricmp(ms_cutsceneName, "end") && TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FLYBY && ms_cutsceneLoadStatus == CUTSCENE_LOADING_0) {
|
||||||
if (CPad::GetPad(0)->GetCrossJustDown()
|
if (CPad::GetPad(0)->GetCrossJustDown()
|
||||||
|| (CGame::playingIntro && CPad::GetPad(0)->GetStartJustDown())
|
|| (CGame::playingIntro && CPad::GetPad(0)->GetStartJustDown())
|
||||||
|| CPad::GetPad(0)->GetLeftMouseJustDown()
|
|| CPad::GetPad(0)->GetLeftMouseJustDown()
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
|
#include "General.h"
|
||||||
#include "FileMgr.h"
|
#include "FileMgr.h"
|
||||||
#include "Directory.h"
|
#include "Directory.h"
|
||||||
|
|
||||||
|
@ -49,7 +50,7 @@ CDirectory::FindItem(const char *name, uint32 &offset, uint32 &size)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i = 0; i < numEntries; i++)
|
for(i = 0; i < numEntries; i++)
|
||||||
if(strcmpi(entries[i].name, name) == 0){
|
if(!CGeneral::faststricmp(entries[i].name, name)){
|
||||||
offset = entries[i].offset;
|
offset = entries[i].offset;
|
||||||
size = entries[i].size;
|
size = entries[i].size;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -104,6 +104,29 @@ public:
|
||||||
return (int)floorf(angle / DEGTORAD(45.0f));
|
return (int)floorf(angle / DEGTORAD(45.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Unlike usual string comparison functions, these don't care about greater or lesser
|
||||||
|
static bool faststrcmp(const char *str1, const char *str2)
|
||||||
|
{
|
||||||
|
for (; *str1; str1++, str2++) {
|
||||||
|
if (*str1 != *str2)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return *str2 != '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool faststricmp(const char *str1, const char *str2)
|
||||||
|
{
|
||||||
|
for (; *str1; str1++, str2++) {
|
||||||
|
#if MUCH_SLOWER
|
||||||
|
if (toupper(*str1) != toupper(*str2))
|
||||||
|
#else
|
||||||
|
if (__ascii_toupper(*str1) != __ascii_toupper(*str2))
|
||||||
|
#endif
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return *str2 != '\0';
|
||||||
|
}
|
||||||
|
|
||||||
// not too sure about all these...
|
// not too sure about all these...
|
||||||
static uint16 GetRandomNumber(void)
|
static uint16 GetRandomNumber(void)
|
||||||
{ return myrand() & MYRAND_MAX; }
|
{ return myrand() & MYRAND_MAX; }
|
||||||
|
|
|
@ -28,7 +28,7 @@ FindPlayerDff(uint32 &offset, uint32 &size)
|
||||||
do {
|
do {
|
||||||
if (!CFileMgr::Read(file, (char*)&info, sizeof(CDirectory::DirectoryInfo)))
|
if (!CFileMgr::Read(file, (char*)&info, sizeof(CDirectory::DirectoryInfo)))
|
||||||
return;
|
return;
|
||||||
} while (strcmpi("player.dff", info.name));
|
} while (strcasecmp("player.dff", info.name) != 0);
|
||||||
|
|
||||||
offset = info.offset;
|
offset = info.offset;
|
||||||
size = info.size;
|
size = info.size;
|
||||||
|
@ -94,7 +94,7 @@ CPlayerSkin::GetSkinTexture(const char *texName)
|
||||||
CTxdStore::PopCurrentTxd();
|
CTxdStore::PopCurrentTxd();
|
||||||
if (tex) return tex;
|
if (tex) return tex;
|
||||||
|
|
||||||
if (!strcmp(DEFAULT_SKIN_NAME, texName))
|
if (strcmp(DEFAULT_SKIN_NAME, texName) == 0)
|
||||||
sprintf(gString, "models\\generic\\player.bmp");
|
sprintf(gString, "models\\generic\\player.bmp");
|
||||||
else
|
else
|
||||||
sprintf(gString, "skins\\%s.bmp", texName);
|
sprintf(gString, "skins\\%s.bmp", texName);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
|
#include "General.h"
|
||||||
#include "Pad.h"
|
#include "Pad.h"
|
||||||
#include "Hud.h"
|
#include "Hud.h"
|
||||||
#include "Text.h"
|
#include "Text.h"
|
||||||
|
@ -347,7 +348,7 @@ CStreaming::LoadCdDirectory(const char *dirname, int n)
|
||||||
if(direntry.size > (uint32)ms_streamingBufferSize)
|
if(direntry.size > (uint32)ms_streamingBufferSize)
|
||||||
ms_streamingBufferSize = direntry.size;
|
ms_streamingBufferSize = direntry.size;
|
||||||
|
|
||||||
if(strcmp(dot+1, "DFF") == 0 || strcmp(dot+1, "dff") == 0){
|
if(!CGeneral::faststrcmp(dot+1, "DFF") || !CGeneral::faststrcmp(dot+1, "dff")){
|
||||||
if(CModelInfo::GetModelInfo(direntry.name, &modelId)){
|
if(CModelInfo::GetModelInfo(direntry.name, &modelId)){
|
||||||
if(ms_aInfoForModel[modelId].GetCdPosnAndSize(posn, size)){
|
if(ms_aInfoForModel[modelId].GetCdPosnAndSize(posn, size)){
|
||||||
debug("%s appears more than once in %s\n", direntry.name, dirname);
|
debug("%s appears more than once in %s\n", direntry.name, dirname);
|
||||||
|
@ -364,20 +365,20 @@ CStreaming::LoadCdDirectory(const char *dirname, int n)
|
||||||
ms_pExtraObjectsDir->AddItem(direntry);
|
ms_pExtraObjectsDir->AddItem(direntry);
|
||||||
lastID = -1;
|
lastID = -1;
|
||||||
}
|
}
|
||||||
}else if(strcmp(dot+1, "TXD") == 0 || strcmp(dot+1, "txd") == 0){
|
}else if(!CGeneral::faststrcmp(dot+1, "TXD") || !CGeneral::faststrcmp(dot+1, "txd")){
|
||||||
txdId = CTxdStore::FindTxdSlot(direntry.name);
|
txdId = CTxdStore::FindTxdSlot(direntry.name);
|
||||||
if(txdId == -1)
|
if(txdId == -1)
|
||||||
txdId = CTxdStore::AddTxdSlot(direntry.name);
|
txdId = CTxdStore::AddTxdSlot(direntry.name);
|
||||||
if(ms_aInfoForModel[txdId + STREAM_OFFSET_TXD].GetCdPosnAndSize(posn, size)){
|
if(ms_aInfoForModel[txdId + STREAM_OFFSET_TXD].GetCdPosnAndSize(posn, size)){
|
||||||
debug("%s appears more than once in %s\n", direntry.name, dirname);
|
debug("%s appears more than once in %s\n", direntry.name, dirname);
|
||||||
lastID = -1;
|
lastID = -1;
|
||||||
}else{
|
}else{
|
||||||
direntry.offset |= imgSelector;
|
direntry.offset |= imgSelector;
|
||||||
ms_aInfoForModel[txdId + STREAM_OFFSET_TXD].SetCdPosnAndSize(direntry.offset, direntry.size);
|
ms_aInfoForModel[txdId + STREAM_OFFSET_TXD].SetCdPosnAndSize(direntry.offset, direntry.size);
|
||||||
if(lastID != -1)
|
if(lastID != -1)
|
||||||
ms_aInfoForModel[lastID].m_nextID = txdId + STREAM_OFFSET_TXD;
|
ms_aInfoForModel[lastID].m_nextID = txdId + STREAM_OFFSET_TXD;
|
||||||
lastID = txdId + STREAM_OFFSET_TXD;
|
lastID = txdId + STREAM_OFFSET_TXD;
|
||||||
}
|
}
|
||||||
}else
|
}else
|
||||||
lastID = -1;
|
lastID = -1;
|
||||||
}
|
}
|
||||||
|
@ -720,7 +721,7 @@ CStreaming::RequestSpecialModel(int32 modelId, const char *modelName, int32 flag
|
||||||
uint32 pos, size;
|
uint32 pos, size;
|
||||||
|
|
||||||
mi = CModelInfo::GetModelInfo(modelId);
|
mi = CModelInfo::GetModelInfo(modelId);
|
||||||
if(strcmp(mi->GetName(), modelName) == 0){
|
if(!CGeneral::faststrcmp(mi->GetName(), modelName)){
|
||||||
// Already have the correct name, just request it
|
// Already have the correct name, just request it
|
||||||
RequestModel(modelId, flags);
|
RequestModel(modelId, flags);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
|
#include "General.h"
|
||||||
#include "Streaming.h"
|
#include "Streaming.h"
|
||||||
#include "RwHelper.h"
|
#include "RwHelper.h"
|
||||||
#include "TxdStore.h"
|
#include "TxdStore.h"
|
||||||
|
@ -61,7 +62,7 @@ CTxdStore::FindTxdSlot(const char *name)
|
||||||
int size = ms_pTxdPool->GetSize();
|
int size = ms_pTxdPool->GetSize();
|
||||||
for(int i = 0; i < size; i++){
|
for(int i = 0; i < size; i++){
|
||||||
defname = GetTxdName(i);
|
defname = GetTxdName(i);
|
||||||
if(defname && _strcmpi(defname, name) == 0)
|
if(defname && !CGeneral::faststricmp(defname, name))
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -153,6 +153,10 @@ public:
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if (defined(_MSC_VER))
|
||||||
|
extern int strcasecmp(const char *str1, const char *str2);
|
||||||
|
#endif
|
||||||
|
|
||||||
#define clamp(v, low, high) ((v)<(low) ? (low) : (v)>(high) ? (high) : (v))
|
#define clamp(v, low, high) ((v)<(low) ? (low) : (v)>(high) ? (high) : (v))
|
||||||
|
|
||||||
inline float sq(float x) { return x*x; }
|
inline float sq(float x) { return x*x; }
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
|
#include "General.h"
|
||||||
#include "NodeName.h"
|
#include "NodeName.h"
|
||||||
#include "VisibilityPlugins.h"
|
#include "VisibilityPlugins.h"
|
||||||
#include "ModelInfo.h"
|
#include "ModelInfo.h"
|
||||||
|
@ -86,7 +87,7 @@ CClumpModelInfo::FindFrameFromNameCB(RwFrame *frame, void *data)
|
||||||
{
|
{
|
||||||
RwObjectNameAssociation *assoc = (RwObjectNameAssociation*)data;
|
RwObjectNameAssociation *assoc = (RwObjectNameAssociation*)data;
|
||||||
|
|
||||||
if(_strcmpi(GetFrameNodeName(frame), assoc->name) != 0){
|
if(CGeneral::faststricmp(GetFrameNodeName(frame), assoc->name)){
|
||||||
RwFrameForAllChildren(frame, FindFrameFromNameCB, assoc);
|
RwFrameForAllChildren(frame, FindFrameFromNameCB, assoc);
|
||||||
return assoc->frame ? nil : frame;
|
return assoc->frame ? nil : frame;
|
||||||
}else{
|
}else{
|
||||||
|
@ -101,7 +102,7 @@ CClumpModelInfo::FindFrameFromNameWithoutIdCB(RwFrame *frame, void *data)
|
||||||
RwObjectNameAssociation *assoc = (RwObjectNameAssociation*)data;
|
RwObjectNameAssociation *assoc = (RwObjectNameAssociation*)data;
|
||||||
|
|
||||||
if(CVisibilityPlugins::GetFrameHierarchyId(frame) ||
|
if(CVisibilityPlugins::GetFrameHierarchyId(frame) ||
|
||||||
_strcmpi(GetFrameNodeName(frame), assoc->name) != 0){
|
CGeneral::faststricmp(GetFrameNodeName(frame), assoc->name)){
|
||||||
RwFrameForAllChildren(frame, FindFrameFromNameWithoutIdCB, assoc);
|
RwFrameForAllChildren(frame, FindFrameFromNameWithoutIdCB, assoc);
|
||||||
return assoc->frame ? nil : frame;
|
return assoc->frame ? nil : frame;
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
|
#include "General.h"
|
||||||
#include "ModelIndices.h"
|
#include "ModelIndices.h"
|
||||||
|
|
||||||
#define X(name, var, addr) int16 &var = *(int16*)addr;
|
#define X(name, var, addr) int16 &var = *(int16*)addr;
|
||||||
|
@ -18,7 +19,7 @@ void
|
||||||
MatchModelString(const char *modelname, int16 id)
|
MatchModelString(const char *modelname, int16 id)
|
||||||
{
|
{
|
||||||
#define X(name, var, addr) \
|
#define X(name, var, addr) \
|
||||||
if(strcmp(name, modelname) == 0){ \
|
if(!CGeneral::faststrcmp(name, modelname)){ \
|
||||||
var = id; \
|
var = id; \
|
||||||
return; \
|
return; \
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
|
#include "General.h"
|
||||||
#include "TempColModels.h"
|
#include "TempColModels.h"
|
||||||
#include "ModelIndices.h"
|
#include "ModelIndices.h"
|
||||||
#include "ModelInfo.h"
|
#include "ModelInfo.h"
|
||||||
|
@ -159,7 +160,7 @@ CModelInfo::GetModelInfo(const char *name, int *id)
|
||||||
CBaseModelInfo *modelinfo;
|
CBaseModelInfo *modelinfo;
|
||||||
for(int i = 0; i < MODELINFOSIZE; i++){
|
for(int i = 0; i < MODELINFOSIZE; i++){
|
||||||
modelinfo = CModelInfo::ms_modelInfoPtrs[i];
|
modelinfo = CModelInfo::ms_modelInfoPtrs[i];
|
||||||
if(modelinfo && _strcmpi(modelinfo->GetName(), name) == 0){
|
if(modelinfo && !CGeneral::faststricmp(modelinfo->GetName(), name)){
|
||||||
if(id)
|
if(id)
|
||||||
*id = i;
|
*id = i;
|
||||||
return modelinfo;
|
return modelinfo;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
|
#include "General.h"
|
||||||
#include "Ped.h"
|
#include "Ped.h"
|
||||||
#include "NodeName.h"
|
#include "NodeName.h"
|
||||||
#include "VisibilityPlugins.h"
|
#include "VisibilityPlugins.h"
|
||||||
|
@ -60,7 +61,7 @@ FindPedFrameFromNameCB(RwFrame *frame, void *data)
|
||||||
{
|
{
|
||||||
RwObjectNameAssociation *assoc = (RwObjectNameAssociation*)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);
|
RwFrameForAllChildren(frame, FindPedFrameFromNameCB, assoc);
|
||||||
return assoc->frame ? nil : frame;
|
return assoc->frame ? nil : frame;
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
|
#include "General.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "ModelInfo.h"
|
#include "ModelInfo.h"
|
||||||
|
|
||||||
|
@ -131,7 +132,7 @@ CSimpleModelInfo::FindRelatedModel(void)
|
||||||
for(i = 0; i < MODELINFOSIZE; i++){
|
for(i = 0; i < MODELINFOSIZE; i++){
|
||||||
mi = CModelInfo::GetModelInfo(i);
|
mi = CModelInfo::GetModelInfo(i);
|
||||||
if(mi && mi != this &&
|
if(mi && mi != this &&
|
||||||
strcmp(GetName()+3, mi->GetName()+3) == 0){
|
!CGeneral::faststrcmp(GetName()+3, mi->GetName()+3)){
|
||||||
assert(mi->IsSimple());
|
assert(mi->IsSimple());
|
||||||
this->SetRelatedModel((CSimpleModelInfo*)mi);
|
this->SetRelatedModel((CSimpleModelInfo*)mi);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
|
#include "General.h"
|
||||||
#include "FileMgr.h"
|
#include "FileMgr.h"
|
||||||
#include "PedStats.h"
|
#include "PedStats.h"
|
||||||
|
|
||||||
|
@ -112,7 +113,7 @@ CPedStats::GetPedStatType(char *name)
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
for(type = 0; type < NUM_PEDSTATS; type++)
|
for(type = 0; type < NUM_PEDSTATS; type++)
|
||||||
if(strcmp(ms_apPedStats[type]->m_name, name) == 0)
|
if(!CGeneral::faststrcmp(ms_apPedStats[type]->m_name, name))
|
||||||
return type;
|
return type;
|
||||||
return NUM_PEDSTATS;
|
return NUM_PEDSTATS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3004,6 +3004,13 @@ BOOL _InputIsExtended(INT flag)
|
||||||
return (flag & 0x1000000) != 0;
|
return (flag & 0x1000000) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (defined(_MSC_VER))
|
||||||
|
int strcasecmp(const char *str1, const char *str2)
|
||||||
|
{
|
||||||
|
return _strcmpi(str1, str2);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
STARTPATCHES
|
STARTPATCHES
|
||||||
//InjectHook(0x580B30, &CJoySticks::CJoySticks, PATCH_JUMP);
|
//InjectHook(0x580B30, &CJoySticks::CJoySticks, PATCH_JUMP);
|
||||||
|
|
Loading…
Reference in a new issue