mirror of
https://github.com/GTAmodding/re3.git
synced 2021-02-19 17:49:54 +01:00
Fix use of strncmp
This commit is contained in:
parent
687ff4bdbb
commit
b12eef1d56
@ -810,11 +810,11 @@ CAnimManager::LoadAnimFile(int fd, bool compress)
|
|||||||
float *fbuf = (float*)buf;
|
float *fbuf = (float*)buf;
|
||||||
|
|
||||||
CFileMgr::Read(fd, (char*)&anpk, sizeof(IfpHeader));
|
CFileMgr::Read(fd, (char*)&anpk, sizeof(IfpHeader));
|
||||||
if(strncmp(anpk.ident, "ANLF", 4) == 0){
|
if(!CGeneral::faststrncmp(anpk.ident, "ANLF", 4)) {
|
||||||
ROUNDSIZE(anpk.size);
|
ROUNDSIZE(anpk.size);
|
||||||
CFileMgr::Read(fd, buf, anpk.size);
|
CFileMgr::Read(fd, buf, anpk.size);
|
||||||
numANPK = *(int*)buf;
|
numANPK = *(int*)buf;
|
||||||
}else if(strncmp(anpk.ident, "ANPK", 4) == 0){
|
} else if(!CGeneral::faststrncmp(anpk.ident, "ANPK", 4)) {
|
||||||
CFileMgr::Seek(fd, -8, 1);
|
CFileMgr::Seek(fd, -8, 1);
|
||||||
numANPK = 1;
|
numANPK = 1;
|
||||||
}
|
}
|
||||||
@ -870,13 +870,13 @@ CAnimManager::LoadAnimFile(int fd, bool compress)
|
|||||||
bool hasScale = false;
|
bool hasScale = false;
|
||||||
bool hasTranslation = false;
|
bool hasTranslation = false;
|
||||||
CFileMgr::Read(fd, (char*)&info, sizeof(info));
|
CFileMgr::Read(fd, (char*)&info, sizeof(info));
|
||||||
if(strncmp(info.ident, "KRTS", 4) == 0){
|
if(!CGeneral::faststrncmp(info.ident, "KRTS", 4)) {
|
||||||
hasScale = true;
|
hasScale = true;
|
||||||
seq->SetNumFrames(numFrames, true);
|
seq->SetNumFrames(numFrames, true);
|
||||||
}else if(strncmp(info.ident, "KRT0", 4) == 0){
|
}else if(!CGeneral::faststrncmp(info.ident, "KRT0", 4)) {
|
||||||
hasTranslation = true;
|
hasTranslation = true;
|
||||||
seq->SetNumFrames(numFrames, true);
|
seq->SetNumFrames(numFrames, true);
|
||||||
}else if(strncmp(info.ident, "KR00", 4) == 0){
|
}else if(!CGeneral::faststrncmp(info.ident, "KR00", 4)){
|
||||||
seq->SetNumFrames(numFrames, false);
|
seq->SetNumFrames(numFrames, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2012,10 +2012,10 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
|||||||
case COMMAND_PRINT_HELP:
|
case COMMAND_PRINT_HELP:
|
||||||
{
|
{
|
||||||
if (CCamera::m_bUseMouse3rdPerson && (
|
if (CCamera::m_bUseMouse3rdPerson && (
|
||||||
strncmp((char*)&CTheScripts::ScriptSpace[m_nIp], "HELP15", 7) == 0 ||
|
strcmp((char*)&CTheScripts::ScriptSpace[m_nIp], "HELP15") == 0 ||
|
||||||
strncmp((char*)&CTheScripts::ScriptSpace[m_nIp], "GUN_2A", 7) == 0 ||
|
strcmp((char*)&CTheScripts::ScriptSpace[m_nIp], "GUN_2A") == 0 ||
|
||||||
strncmp((char*)&CTheScripts::ScriptSpace[m_nIp], "GUN_3A", 7) == 0 ||
|
strcmp((char*)&CTheScripts::ScriptSpace[m_nIp], "GUN_3A") == 0 ||
|
||||||
strncmp((char*)&CTheScripts::ScriptSpace[m_nIp], "GUN_4A", 7) == 0)) {
|
strcmp((char*)&CTheScripts::ScriptSpace[m_nIp], "GUN_4A") == 0)) {
|
||||||
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,11 @@ CFileLoader::LoadLevel(const char *filename)
|
|||||||
if(*line == '#')
|
if(*line == '#')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(strncmp(line, "EXIT", 9) == 0) // BUG: 9?
|
#ifdef FIX_BUGS
|
||||||
|
if(strncmp(line, "EXIT", 4) == 0)
|
||||||
|
#else
|
||||||
|
if(strncmp(line, "EXIT", 9) == 0)
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if(strncmp(line, "IMAGEPATH", 9) == 0){
|
if(strncmp(line, "IMAGEPATH", 9) == 0){
|
||||||
@ -191,7 +195,7 @@ CFileLoader::LoadTexDictionary(const char *filename)
|
|||||||
|
|
||||||
struct ColHeader
|
struct ColHeader
|
||||||
{
|
{
|
||||||
char ident[4];
|
uint32 ident;
|
||||||
uint32 size;
|
uint32 size;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -209,7 +213,7 @@ CFileLoader::LoadCollisionFile(const char *filename)
|
|||||||
fd = CFileMgr::OpenFile(filename, "rb");
|
fd = CFileMgr::OpenFile(filename, "rb");
|
||||||
|
|
||||||
while(CFileMgr::Read(fd, (char*)&header, sizeof(header))){
|
while(CFileMgr::Read(fd, (char*)&header, sizeof(header))){
|
||||||
assert(strncmp(header.ident, "COLL", 4) == 0);
|
assert(header.ident == 'LLOC');
|
||||||
CFileMgr::Read(fd, (char*)work_buff, header.size);
|
CFileMgr::Read(fd, (char*)work_buff, header.size);
|
||||||
memcpy(modelname, work_buff, 24);
|
memcpy(modelname, work_buff, 24);
|
||||||
|
|
||||||
@ -863,6 +867,9 @@ CFileLoader::AddTexDictionaries(RwTexDictionary *dst, RwTexDictionary *src)
|
|||||||
RwTexDictionaryForAllTextures(src, MoveTexturesCB, dst);
|
RwTexDictionaryForAllTextures(src, MoveTexturesCB, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define isLine3(l, a, b, c) ((l[0] == a) && (l[1] == b) && (l[2] == c))
|
||||||
|
#define isLine4(l, a, b, c, d) ((l[0] == a) && (l[1] == b) && (l[2] == c) && (l[3] == d))
|
||||||
|
|
||||||
void
|
void
|
||||||
CFileLoader::LoadObjectTypes(const char *filename)
|
CFileLoader::LoadObjectTypes(const char *filename)
|
||||||
{
|
{
|
||||||
@ -896,18 +903,18 @@ CFileLoader::LoadObjectTypes(const char *filename)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(section == NONE){
|
if(section == NONE){
|
||||||
if(strncmp(line, "objs", 4) == 0) section = OBJS;
|
if(isLine4(line, 'o','b','j','s')) section = OBJS;
|
||||||
else if(strncmp(line, "tobj", 4) == 0) section = TOBJ;
|
else if(isLine4(line, 't','o','b','j')) section = TOBJ;
|
||||||
else if(strncmp(line, "hier", 4) == 0) section = HIER;
|
else if(isLine4(line, 'h','i','e','r')) section = HIER;
|
||||||
else if(strncmp(line, "cars", 4) == 0) section = CARS;
|
else if(isLine4(line, 'c','a','r','s')) section = CARS;
|
||||||
else if(strncmp(line, "peds", 4) == 0) section = PEDS;
|
else if(isLine4(line, 'p','e','d','s')) section = PEDS;
|
||||||
else if(strncmp(line, "path", 4) == 0) section = PATH;
|
else if(isLine4(line, 'p','a','t','h')) section = PATH;
|
||||||
else if(strncmp(line, "2dfx", 4) == 0) section = TWODFX;
|
else if(isLine4(line, '2','d','f','x')) section = TWODFX;
|
||||||
}else if(strncmp(line, "end", 3) == 0){
|
}else if(isLine3(line, 'e','n','d')){
|
||||||
section = section == MLO ? OBJS : NONE;
|
section = section == MLO ? OBJS : NONE;
|
||||||
}else switch(section){
|
}else switch(section){
|
||||||
case OBJS:
|
case OBJS:
|
||||||
if(strncmp(line, "sta", 3) == 0)
|
if(isLine3(line, 's','t','a'))
|
||||||
mlo = LoadMLO(line);
|
mlo = LoadMLO(line);
|
||||||
else
|
else
|
||||||
LoadObject(line);
|
LoadObject(line);
|
||||||
@ -930,9 +937,9 @@ CFileLoader::LoadObjectTypes(const char *filename)
|
|||||||
case PATH:
|
case PATH:
|
||||||
if(pathIndex == -1){
|
if(pathIndex == -1){
|
||||||
id = LoadPathHeader(line, pathTypeStr);
|
id = LoadPathHeader(line, pathTypeStr);
|
||||||
if(strncmp(pathTypeStr, "ped", 4) == 0)
|
if(strcmp(pathTypeStr, "ped") == 0)
|
||||||
pathType = 1;
|
pathType = 1;
|
||||||
else if(strncmp(pathTypeStr, "car", 4) == 0)
|
else if(strcmp(pathTypeStr, "car") == 0)
|
||||||
pathType = 0;
|
pathType = 0;
|
||||||
pathIndex = 0;
|
pathIndex = 0;
|
||||||
}else{
|
}else{
|
||||||
@ -1173,21 +1180,21 @@ CFileLoader::LoadVehicleObject(const char *line)
|
|||||||
mi->m_level = level;
|
mi->m_level = level;
|
||||||
mi->m_compRules = comprules;
|
mi->m_compRules = comprules;
|
||||||
|
|
||||||
if(strncmp(type, "car", 4) == 0){
|
if(strcmp(type, "car") == 0){
|
||||||
mi->m_wheelId = misc;
|
mi->m_wheelId = misc;
|
||||||
mi->m_wheelScale = wheelScale;
|
mi->m_wheelScale = wheelScale;
|
||||||
mi->m_vehicleType = VEHICLE_TYPE_CAR;
|
mi->m_vehicleType = VEHICLE_TYPE_CAR;
|
||||||
}else if(strncmp(type, "boat", 5) == 0){
|
}else if(strcmp(type, "boat") == 0){
|
||||||
mi->m_vehicleType = VEHICLE_TYPE_BOAT;
|
mi->m_vehicleType = VEHICLE_TYPE_BOAT;
|
||||||
}else if(strncmp(type, "train", 6) == 0){
|
}else if(strcmp(type, "train") == 0){
|
||||||
mi->m_vehicleType = VEHICLE_TYPE_TRAIN;
|
mi->m_vehicleType = VEHICLE_TYPE_TRAIN;
|
||||||
}else if(strncmp(type, "heli", 5) == 0){
|
}else if(strcmp(type, "heli") == 0){
|
||||||
mi->m_vehicleType = VEHICLE_TYPE_HELI;
|
mi->m_vehicleType = VEHICLE_TYPE_HELI;
|
||||||
}else if(strncmp(type, "plane", 6) == 0){
|
}else if(strcmp(type, "plane") == 0){
|
||||||
mi->m_planeLodId = misc;
|
mi->m_planeLodId = misc;
|
||||||
mi->m_wheelScale = 1.0f;
|
mi->m_wheelScale = 1.0f;
|
||||||
mi->m_vehicleType = VEHICLE_TYPE_PLANE;
|
mi->m_vehicleType = VEHICLE_TYPE_PLANE;
|
||||||
}else if(strncmp(type, "bike", 5) == 0){
|
}else if(strcmp(type, "bike") == 0){
|
||||||
mi->m_bikeSteerAngle = misc;
|
mi->m_bikeSteerAngle = misc;
|
||||||
mi->m_wheelScale = wheelScale;
|
mi->m_wheelScale = wheelScale;
|
||||||
mi->m_vehicleType = VEHICLE_TYPE_BIKE;
|
mi->m_vehicleType = VEHICLE_TYPE_BIKE;
|
||||||
@ -1197,31 +1204,31 @@ CFileLoader::LoadVehicleObject(const char *line)
|
|||||||
mi->m_handlingId = mod_HandlingManager.GetHandlingId(handlingId);
|
mi->m_handlingId = mod_HandlingManager.GetHandlingId(handlingId);
|
||||||
|
|
||||||
// Well this is kinda dumb....
|
// Well this is kinda dumb....
|
||||||
if(strncmp(vehclass, "poorfamily", 11) == 0){
|
if(strcmp(vehclass, "poorfamily") == 0){
|
||||||
mi->m_vehicleClass = CCarCtrl::POOR;
|
mi->m_vehicleClass = CCarCtrl::POOR;
|
||||||
while(frequency-- > 0)
|
while(frequency-- > 0)
|
||||||
CCarCtrl::AddToCarArray(id, CCarCtrl::POOR);
|
CCarCtrl::AddToCarArray(id, CCarCtrl::POOR);
|
||||||
}else if(strncmp(vehclass, "richfamily", 11) == 0){
|
}else if(strcmp(vehclass, "richfamily") == 0){
|
||||||
mi->m_vehicleClass = CCarCtrl::RICH;
|
mi->m_vehicleClass = CCarCtrl::RICH;
|
||||||
while(frequency-- > 0)
|
while(frequency-- > 0)
|
||||||
CCarCtrl::AddToCarArray(id, CCarCtrl::RICH);
|
CCarCtrl::AddToCarArray(id, CCarCtrl::RICH);
|
||||||
}else if(strncmp(vehclass, "executive", 10) == 0){
|
}else if(strcmp(vehclass, "executive") == 0){
|
||||||
mi->m_vehicleClass = CCarCtrl::EXEC;
|
mi->m_vehicleClass = CCarCtrl::EXEC;
|
||||||
while(frequency-- > 0)
|
while(frequency-- > 0)
|
||||||
CCarCtrl::AddToCarArray(id, CCarCtrl::EXEC);
|
CCarCtrl::AddToCarArray(id, CCarCtrl::EXEC);
|
||||||
}else if(strncmp(vehclass, "worker", 7) == 0){
|
}else if(strcmp(vehclass, "worker") == 0){
|
||||||
mi->m_vehicleClass = CCarCtrl::WORKER;
|
mi->m_vehicleClass = CCarCtrl::WORKER;
|
||||||
while(frequency-- > 0)
|
while(frequency-- > 0)
|
||||||
CCarCtrl::AddToCarArray(id, CCarCtrl::WORKER);
|
CCarCtrl::AddToCarArray(id, CCarCtrl::WORKER);
|
||||||
}else if(strncmp(vehclass, "special", 8) == 0){
|
}else if(strcmp(vehclass, "special") == 0){
|
||||||
mi->m_vehicleClass = CCarCtrl::SPECIAL;
|
mi->m_vehicleClass = CCarCtrl::SPECIAL;
|
||||||
while(frequency-- > 0)
|
while(frequency-- > 0)
|
||||||
CCarCtrl::AddToCarArray(id, CCarCtrl::SPECIAL);
|
CCarCtrl::AddToCarArray(id, CCarCtrl::SPECIAL);
|
||||||
}else if(strncmp(vehclass, "big", 4) == 0){
|
}else if(strcmp(vehclass, "big") == 0){
|
||||||
mi->m_vehicleClass = CCarCtrl::BIG;
|
mi->m_vehicleClass = CCarCtrl::BIG;
|
||||||
while(frequency-- > 0)
|
while(frequency-- > 0)
|
||||||
CCarCtrl::AddToCarArray(id, CCarCtrl::BIG);
|
CCarCtrl::AddToCarArray(id, CCarCtrl::BIG);
|
||||||
}else if(strncmp(vehclass, "taxi", 5) == 0){
|
}else if(strcmp(vehclass, "taxi") == 0){
|
||||||
mi->m_vehicleClass = CCarCtrl::TAXI;
|
mi->m_vehicleClass = CCarCtrl::TAXI;
|
||||||
while(frequency-- > 0)
|
while(frequency-- > 0)
|
||||||
CCarCtrl::AddToCarArray(id, CCarCtrl::TAXI);
|
CCarCtrl::AddToCarArray(id, CCarCtrl::TAXI);
|
||||||
@ -1402,12 +1409,12 @@ CFileLoader::LoadScene(const char *filename)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(section == NONE){
|
if(section == NONE){
|
||||||
if(strncmp(line, "inst", 4) == 0) section = INST;
|
if(isLine4(line, 'i','n','s','t')) section = INST;
|
||||||
else if(strncmp(line, "zone", 4) == 0) section = ZONE;
|
else if(isLine4(line, 'z','o','n','e')) section = ZONE;
|
||||||
else if(strncmp(line, "cull", 4) == 0) section = CULL;
|
else if(isLine4(line, 'c','u','l','l')) section = CULL;
|
||||||
else if(strncmp(line, "pick", 4) == 0) section = PICK;
|
else if(isLine4(line, 'p','i','c','k')) section = PICK;
|
||||||
else if(strncmp(line, "path", 4) == 0) section = PATH;
|
else if(isLine4(line, 'p','a','t','h')) section = PATH;
|
||||||
}else if(strncmp(line, "end", 3) == 0){
|
}else if(isLine3(line, 'e','n','d')){
|
||||||
section = NONE;
|
section = NONE;
|
||||||
}else switch(section){
|
}else switch(section){
|
||||||
case INST:
|
case INST:
|
||||||
@ -1427,6 +1434,7 @@ CFileLoader::LoadScene(const char *filename)
|
|||||||
// unfinished in the game
|
// unfinished in the game
|
||||||
if(pathIndex == -1){
|
if(pathIndex == -1){
|
||||||
LoadPathHeader(line, pathTypeStr);
|
LoadPathHeader(line, pathTypeStr);
|
||||||
|
strcmp(pathTypeStr, "ped");
|
||||||
// type not set
|
// type not set
|
||||||
pathIndex = 0;
|
pathIndex = 0;
|
||||||
}else{
|
}else{
|
||||||
@ -1564,8 +1572,8 @@ CFileLoader::LoadMapZones(const char *filename)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(section == NONE){
|
if(section == NONE){
|
||||||
if(strncmp(line, "zone", 4) == 0) section = ZONE;
|
if(isLine4(line, 'z','o','n','e')) section = ZONE;
|
||||||
}else if(strncmp(line, "end", 3) == 0){
|
}else if(isLine3(line, 'e','n','d')){
|
||||||
section = NONE;
|
section = NONE;
|
||||||
}else switch(section){
|
}else switch(section){
|
||||||
case ZONE: {
|
case ZONE: {
|
||||||
@ -1607,20 +1615,20 @@ CFileLoader::ReloadPaths(const char *filename)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (section == NONE) {
|
if (section == NONE) {
|
||||||
if (strncmp(line, "path", 4) == 0) {
|
if (isLine4(line, 'p','a','t','h')) {
|
||||||
section = PATH;
|
section = PATH;
|
||||||
ThePaths.AllocatePathFindInfoMem(4500);
|
ThePaths.AllocatePathFindInfoMem(4500);
|
||||||
}
|
}
|
||||||
} else if (strncmp(line, "end", 3) == 0) {
|
} else if (isLine3(line, 'e','n','d')) {
|
||||||
section = NONE;
|
section = NONE;
|
||||||
} else {
|
} else {
|
||||||
switch (section) {
|
switch (section) {
|
||||||
case PATH:
|
case PATH:
|
||||||
if (pathIndex == -1) {
|
if (pathIndex == -1) {
|
||||||
id = LoadPathHeader(line, pathTypeStr);
|
id = LoadPathHeader(line, pathTypeStr);
|
||||||
if (strncmp(pathTypeStr, "ped", 4) == 0)
|
if (strcmp(pathTypeStr, "ped") == 0)
|
||||||
pathType = 1;
|
pathType = 1;
|
||||||
else if (strncmp(pathTypeStr, "car", 4) == 0)
|
else if (strcmp(pathTypeStr, "car") == 0)
|
||||||
pathType = 0;
|
pathType = 0;
|
||||||
pathIndex = 0;
|
pathIndex = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -1663,10 +1671,10 @@ CFileLoader::ReloadObjectTypes(const char *filename)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (section == NONE) {
|
if (section == NONE) {
|
||||||
if (strncmp(line, "objs", 4) == 0) section = OBJS;
|
if (isLine4(line, 'o','b','j','s')) section = OBJS;
|
||||||
else if (strncmp(line, "tobj", 4) == 0) section = TOBJ;
|
else if (isLine4(line, 't','o','b','j')) section = TOBJ;
|
||||||
else if (strncmp(line, "2dfx", 4) == 0) section = TWODFX;
|
else if (isLine4(line, '2','d','f','x')) section = TWODFX;
|
||||||
} else if (strncmp(line, "end", 3) == 0) {
|
} else if (isLine3(line, 'e','n','d')) {
|
||||||
section = NONE;
|
section = NONE;
|
||||||
} else {
|
} else {
|
||||||
switch (section) {
|
switch (section) {
|
||||||
@ -1738,7 +1746,11 @@ CFileLoader::ReLoadScene(const char *filename)
|
|||||||
if (*line == '#')
|
if (*line == '#')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (strncmp(line, "EXIT", 9) == 0) // BUG: 9?
|
#ifdef FIX_BUGS
|
||||||
|
if (strncmp(line, "EXIT", 4) == 0)
|
||||||
|
#else
|
||||||
|
if (strncmp(line, "EXIT", 9) == 0)
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (strncmp(line, "IDE", 3) == 0) {
|
if (strncmp(line, "IDE", 3) == 0) {
|
||||||
|
@ -1314,7 +1314,7 @@ CMenuManager::Draw()
|
|||||||
#endif
|
#endif
|
||||||
// Hide back button
|
// Hide back button
|
||||||
#ifdef PS2_LIKE_MENU
|
#ifdef PS2_LIKE_MENU
|
||||||
if ((i == NUM_MENUROWS - 1 || aScreens[m_nCurrScreen].m_aEntries[i+1].m_EntryName[0] == '\0') && strncmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FEDS_TB", 8) == 0)
|
if ((i == NUM_MENUROWS - 1 || aScreens[m_nCurrScreen].m_aEntries[i+1].m_EntryName[0] == '\0') && strcmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FEDS_TB") == 0)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action != MENUACTION_LABEL && aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName[0] != '\0') {
|
if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action != MENUACTION_LABEL && aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName[0] != '\0') {
|
||||||
@ -1611,7 +1611,7 @@ CMenuManager::Draw()
|
|||||||
// Hide back button
|
// Hide back button
|
||||||
#ifdef PS2_LIKE_MENU
|
#ifdef PS2_LIKE_MENU
|
||||||
if ((rowToCheck == NUM_MENUROWS - 1 || aScreens[m_nCurrScreen].m_aEntries[rowToCheck+1].m_EntryName[0] == '\0') &&
|
if ((rowToCheck == NUM_MENUROWS - 1 || aScreens[m_nCurrScreen].m_aEntries[rowToCheck+1].m_EntryName[0] == '\0') &&
|
||||||
strncmp(aScreens[m_nCurrScreen].m_aEntries[rowToCheck].m_EntryName, "FEDS_TB", 8) == 0)
|
strcmp(aScreens[m_nCurrScreen].m_aEntries[rowToCheck].m_EntryName, "FEDS_TB") == 0)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -3061,7 +3061,7 @@ CMenuManager::DrawPlayerSetupScreen()
|
|||||||
SYSTEMTIME SystemTime;
|
SYSTEMTIME SystemTime;
|
||||||
HANDLE handle = FindFirstFile("skins\\*.bmp", &FindFileData);
|
HANDLE handle = FindFirstFile("skins\\*.bmp", &FindFileData);
|
||||||
for (int i = 1; handle != INVALID_HANDLE_VALUE && i; i = FindNextFile(handle, &FindFileData)) {
|
for (int i = 1; handle != INVALID_HANDLE_VALUE && i; i = FindNextFile(handle, &FindFileData)) {
|
||||||
if (strncmp(FindFileData.cFileName, DEFAULT_SKIN_NAME, 5) != 0) {
|
if (strcmp(FindFileData.cFileName, DEFAULT_SKIN_NAME) != 0) {
|
||||||
m_pSelectedSkin->nextSkin = new tSkinInfo;
|
m_pSelectedSkin->nextSkin = new tSkinInfo;
|
||||||
m_pSelectedSkin = m_pSelectedSkin->nextSkin;
|
m_pSelectedSkin = m_pSelectedSkin->nextSkin;
|
||||||
m_pSelectedSkin->skinId = nextSkinId;
|
m_pSelectedSkin->skinId = nextSkinId;
|
||||||
@ -4645,15 +4645,15 @@ CMenuManager::ProcessButtonPresses(void)
|
|||||||
|
|
||||||
// Hide back button
|
// Hide back button
|
||||||
#ifdef PS2_LIKE_MENU
|
#ifdef PS2_LIKE_MENU
|
||||||
if ((goUp || goDown) && m_nCurrScreen != MENUPAGE_MULTIPLAYER_FIND_GAME && strncmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB", 8) == 0)
|
if ((goUp || goDown) && m_nCurrScreen != MENUPAGE_MULTIPLAYER_FIND_GAME && strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB") == 0)
|
||||||
m_nCurrOption = goUp ? m_nCurrOption - 1 : (aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL);
|
m_nCurrOption = goUp ? m_nCurrOption - 1 : (aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (optionSelected) {
|
if (optionSelected) {
|
||||||
int option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action;
|
int option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action;
|
||||||
if ((option == MENUACTION_CHANGEMENU) || (option == MENUACTION_POPULATESLOTS_CHANGEMENU)) {
|
if ((option == MENUACTION_CHANGEMENU) || (option == MENUACTION_POPULATESLOTS_CHANGEMENU)) {
|
||||||
if (strncmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB", 8) != 0 &&
|
if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB") != 0 &&
|
||||||
strncmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FESZ_CA", 8) != 0) {
|
strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FESZ_CA") != 0) {
|
||||||
|
|
||||||
if (m_nCurrScreen == MENUPAGE_CHOOSE_DELETE_SLOT) {
|
if (m_nCurrScreen == MENUPAGE_CHOOSE_DELETE_SLOT) {
|
||||||
if (Slots[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_SaveSlot - 1] == SLOT_EMPTY)
|
if (Slots[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_SaveSlot - 1] == SLOT_EMPTY)
|
||||||
@ -4810,7 +4810,7 @@ CMenuManager::ProcessButtonPresses(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (changeMenu) {
|
if (changeMenu) {
|
||||||
if (strncmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB", 8) == 0) {
|
if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEDS_TB") == 0) {
|
||||||
#ifndef TIDY_UP_PBP
|
#ifndef TIDY_UP_PBP
|
||||||
ResetHelperText();
|
ResetHelperText();
|
||||||
ChangeScreen(!m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage[1] : aScreens[m_nCurrScreen].m_PreviousPage[0],
|
ChangeScreen(!m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage[1] : aScreens[m_nCurrScreen].m_PreviousPage[0],
|
||||||
|
@ -121,6 +121,15 @@ public:
|
|||||||
return *str2 != '\0';
|
return *str2 != '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool faststrncmp(const char *str1, const char *str2, uint32 count)
|
||||||
|
{
|
||||||
|
for(uint32 i = 0; *str1 && i < count; str1++, str2++, i++) {
|
||||||
|
if (*str1 != *str2)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static bool faststricmp(const char *str1, const char *str2)
|
static bool faststricmp(const char *str1, const char *str2)
|
||||||
{
|
{
|
||||||
for (; *str1; str1++, str2++) {
|
for (; *str1; str1++, str2++) {
|
||||||
|
@ -112,7 +112,7 @@ CClumpModelInfo::SetClump(RpClump *clump)
|
|||||||
}
|
}
|
||||||
RpHAnimHierarchySetFlags(hier, (RpHAnimHierarchyFlag)(rpHANIMHIERARCHYUPDATEMODELLINGMATRICES|rpHANIMHIERARCHYUPDATELTMS));
|
RpHAnimHierarchySetFlags(hier, (RpHAnimHierarchyFlag)(rpHANIMHIERARCHYUPDATEMODELLINGMATRICES|rpHANIMHIERARCHYUPDATELTMS));
|
||||||
}
|
}
|
||||||
if(strncmp(GetName(), "playerh", 8) == 0){
|
if(strcmp(GetName(), "playerh") == 0){
|
||||||
// playerh is incompatible with the xbox player skin
|
// 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
|
// so check if player model is skinned and only apply skin to head if it isn't
|
||||||
CPedModelInfo *body = (CPedModelInfo*)CModelInfo::GetModelInfo(MI_PLAYER);
|
CPedModelInfo *body = (CPedModelInfo*)CModelInfo::GetModelInfo(MI_PLAYER);
|
||||||
@ -120,7 +120,7 @@ CClumpModelInfo::SetClump(RpClump *clump)
|
|||||||
RpClumpForAllAtomics(clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
|
RpClumpForAllAtomics(clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if(strncmp(GetName(), "playerh", 8) == 0){
|
if(strcmp(GetName(), "playerh") == 0){
|
||||||
RpClumpForAllAtomics(clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
|
RpClumpForAllAtomics(clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ CPedModelInfo::SetClump(RpClump *clump)
|
|||||||
#endif
|
#endif
|
||||||
#ifdef PED_SKIN
|
#ifdef PED_SKIN
|
||||||
// CB has to be set here before atomics are detached from clump
|
// 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);
|
RpClumpForAllAtomics(clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
|
||||||
if(IsClumpSkinned(clump)){
|
if(IsClumpSkinned(clump)){
|
||||||
LimbCBarg limbs = { this, clump, { 0, 0, 0 } };
|
LimbCBarg limbs = { this, clump, { 0, 0, 0 } };
|
||||||
@ -108,7 +108,7 @@ CPedModelInfo::SetClump(RpClump *clump)
|
|||||||
if(m_hitColModel == nil && !IsClumpSkinned(clump))
|
if(m_hitColModel == nil && !IsClumpSkinned(clump))
|
||||||
CreateHitColModel();
|
CreateHitColModel();
|
||||||
// And again because CClumpModelInfo resets it
|
// And again because CClumpModelInfo resets it
|
||||||
if(strncmp(GetName(), "player", 7) == 0)
|
if(strcmp(GetName(), "player") == 0)
|
||||||
RpClumpForAllAtomics(m_clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
|
RpClumpForAllAtomics(m_clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
|
||||||
else if(IsClumpSkinned(clump))
|
else if(IsClumpSkinned(clump))
|
||||||
// skinned peds have no low detail version, so they don't have the right render Cb
|
// 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);
|
SetFrameIds(m_pPedIds);
|
||||||
if(m_hitColModel == nil)
|
if(m_hitColModel == nil)
|
||||||
CreateHitColModel();
|
CreateHitColModel();
|
||||||
if(strncmp(GetName(), "player", 7) == 0)
|
if(strcmp(GetName(), "player") == 0)
|
||||||
RpClumpForAllAtomics(m_clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
|
RpClumpForAllAtomics(m_clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "ModelInfo.h"
|
#include "ModelInfo.h"
|
||||||
|
#include "General.h"
|
||||||
|
|
||||||
CTimeModelInfo*
|
CTimeModelInfo*
|
||||||
CTimeModelInfo::FindOtherTimeModel(void)
|
CTimeModelInfo::FindOtherTimeModel(void)
|
||||||
@ -23,7 +24,7 @@ CTimeModelInfo::FindOtherTimeModel(void)
|
|||||||
for(i = 0; i < MODELINFOSIZE; i++){
|
for(i = 0; i < MODELINFOSIZE; i++){
|
||||||
CBaseModelInfo *mi = CModelInfo::GetModelInfo(i);
|
CBaseModelInfo *mi = CModelInfo::GetModelInfo(i);
|
||||||
if (mi && mi->GetModelType() == MITYPE_TIME &&
|
if (mi && mi->GetModelType() == MITYPE_TIME &&
|
||||||
strncmp(name, mi->GetName(), 24) == 0){
|
!CGeneral::faststrncmp(name, mi->GetName(), MAX_MODEL_NAME)){
|
||||||
m_otherTimeModelID = i;
|
m_otherTimeModelID = i;
|
||||||
return (CTimeModelInfo*)mi;
|
return (CTimeModelInfo*)mi;
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,7 @@ CVehicleModelInfo::SetAtomicRendererCB(RpAtomic *atomic, void *data)
|
|||||||
name = GetFrameNodeName(RpAtomicGetFrame(atomic));
|
name = GetFrameNodeName(RpAtomicGetFrame(atomic));
|
||||||
alpha = false;
|
alpha = false;
|
||||||
RpGeometryForAllMaterials(RpAtomicGetGeometry(atomic), HasAlphaMaterialCB, &alpha);
|
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)
|
if(alpha || strncmp(name, "windscreen", 10) == 0)
|
||||||
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailAlphaCB);
|
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailAlphaCB);
|
||||||
else
|
else
|
||||||
@ -319,7 +319,7 @@ CVehicleModelInfo::SetAtomicRendererCB_BigVehicle(RpAtomic *atomic, void *data)
|
|||||||
name = GetFrameNodeName(RpAtomicGetFrame(atomic));
|
name = GetFrameNodeName(RpAtomicGetFrame(atomic));
|
||||||
alpha = false;
|
alpha = false;
|
||||||
RpGeometryForAllMaterials(RpAtomicGetGeometry(atomic), HasAlphaMaterialCB, &alpha);
|
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)
|
if(alpha)
|
||||||
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailAlphaCB_BigVehicle);
|
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailAlphaCB_BigVehicle);
|
||||||
else
|
else
|
||||||
@ -367,7 +367,7 @@ CVehicleModelInfo::SetAtomicRendererCB_Boat(RpAtomic *atomic, void *data)
|
|||||||
|
|
||||||
clump = (RpClump*)data;
|
clump = (RpClump*)data;
|
||||||
name = GetFrameNodeName(RpAtomicGetFrame(atomic));
|
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);
|
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailCB_Boat);
|
||||||
else if(strstr(name, "_hi"))
|
else if(strstr(name, "_hi"))
|
||||||
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailCB);
|
CVisibilityPlugins::SetAtomicRenderCallback(atomic, CVisibilityPlugins::RenderVehicleHiDetailCB);
|
||||||
@ -914,11 +914,11 @@ CVehicleModelInfo::LoadVehicleColours(void)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(section == NONE){
|
if(section == NONE){
|
||||||
if(strncmp(&line[start], "col", 3) == 0)
|
if(line[start] == 'c' && line[start + 1] == 'o' && line[start + 2] == 'l')
|
||||||
section = COLOURS;
|
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;
|
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;
|
section = NONE;
|
||||||
}else if(section == COLOURS){
|
}else if(section == COLOURS){
|
||||||
sscanf(&line[start], // BUG: games doesn't add start
|
sscanf(&line[start], // BUG: games doesn't add start
|
||||||
|
@ -1778,7 +1778,7 @@ CPed::LoadFightData(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp(animName, "null", 4) != 0) {
|
if (strcmp(animName, "null") != 0) {
|
||||||
animAssoc = CAnimManager::GetAnimAssociation(ASSOCGRP_STD, animName);
|
animAssoc = CAnimManager::GetAnimAssociation(ASSOCGRP_STD, animName);
|
||||||
tFightMoves[moveId].animId = (AnimationId)animAssoc->animId;
|
tFightMoves[moveId].animId = (AnimationId)animAssoc->animId;
|
||||||
} else {
|
} else {
|
||||||
|
@ -79,7 +79,7 @@ CPedType::LoadPedData(void)
|
|||||||
// Game uses just "line" here since sscanf already trims whitespace, but this is safer
|
// Game uses just "line" here since sscanf already trims whitespace, but this is safer
|
||||||
sscanf(&line[lp], "%s", word);
|
sscanf(&line[lp], "%s", word);
|
||||||
|
|
||||||
if(strncmp(word, "Threat", 7) == 0){
|
if(strcmp(word, "Threat") == 0){
|
||||||
flags = 0;
|
flags = 0;
|
||||||
lp += 7;
|
lp += 7;
|
||||||
while(sscanf(&line[lp], "%s", word) == 1 && lp <= linelen){
|
while(sscanf(&line[lp], "%s", word) == 1 && lp <= linelen){
|
||||||
@ -92,7 +92,7 @@ CPedType::LoadPedData(void)
|
|||||||
lp++;
|
lp++;
|
||||||
}
|
}
|
||||||
ms_apPedType[type]->m_threats = flags;
|
ms_apPedType[type]->m_threats = flags;
|
||||||
}else if(strncmp(word, "Avoid", 6) == 0){
|
}else if(strcmp(word, "Avoid") == 0){
|
||||||
flags = 0;
|
flags = 0;
|
||||||
lp += 6;
|
lp += 6;
|
||||||
while(sscanf(&line[lp], "%s", word) == 1 && lp <= linelen){
|
while(sscanf(&line[lp], "%s", word) == 1 && lp <= linelen){
|
||||||
|
@ -115,7 +115,7 @@ cHandlingDataMgr::LoadHandlingData(void)
|
|||||||
end = start+1;
|
end = start+1;
|
||||||
|
|
||||||
// yeah, this is kinda crappy
|
// yeah, this is kinda crappy
|
||||||
if(strncmp(line, ";the end", 9) == 0)
|
if(strcmp(line, ";the end") == 0)
|
||||||
keepGoing = 0;
|
keepGoing = 0;
|
||||||
else if(line[0] != ';'){
|
else if(line[0] != ';'){
|
||||||
field = 0;
|
field = 0;
|
||||||
|
@ -136,7 +136,7 @@ CWeaponInfo::LoadWeaponData(void)
|
|||||||
animAssoc = CAnimManager::GetAnimAssociation(ASSOCGRP_STD, animToPlay);
|
animAssoc = CAnimManager::GetAnimAssociation(ASSOCGRP_STD, animToPlay);
|
||||||
animId = static_cast<AnimationId>(animAssoc->animId);
|
animId = static_cast<AnimationId>(animAssoc->animId);
|
||||||
|
|
||||||
if (strncmp(anim2ToPlay, "null", 4) != 0) {
|
if (strcmp(anim2ToPlay, "null") != 0) {
|
||||||
animAssoc = CAnimManager::GetAnimAssociation(ASSOCGRP_STD, anim2ToPlay);
|
animAssoc = CAnimManager::GetAnimAssociation(ASSOCGRP_STD, anim2ToPlay);
|
||||||
ms_apWeaponInfos[weaponType].m_Anim2ToPlay = (AnimationId) animAssoc->animId;
|
ms_apWeaponInfos[weaponType].m_Anim2ToPlay = (AnimationId) animAssoc->animId;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user