mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-02-03 12:31:15 +00:00
Replace a lot of sprintf calls with snprintf.
Quiet other security-related deprecations in macOS, mostly in relation to strcat.
This commit is contained in:
parent
a987595e1e
commit
d9547347b4
@ -101,8 +101,9 @@ bool CMainDialog::OnInitDialog()
|
|||||||
selected = device_i;
|
selected = device_i;
|
||||||
}
|
}
|
||||||
device_i += 1;
|
device_i += 1;
|
||||||
sprintf(
|
snprintf(
|
||||||
device_name,
|
device_name,
|
||||||
|
sizeof(device_name),
|
||||||
"%s ( %s )",
|
"%s ( %s )",
|
||||||
device.m_deviceDesc,
|
device.m_deviceDesc,
|
||||||
driver_i == 0 ? "Primary Device" : "Secondary Device"
|
driver_i == 0 ? "Primary Device" : "Secondary Device"
|
||||||
|
|||||||
@ -280,7 +280,7 @@ void CConfigApp::WriteRegisterSettings() const
|
|||||||
#define SetIniBool(DICT, NAME, VALUE) iniparser_set(DICT, NAME, VALUE ? "true" : "false")
|
#define SetIniBool(DICT, NAME, VALUE) iniparser_set(DICT, NAME, VALUE ? "true" : "false")
|
||||||
#define SetIniInt(DICT, NAME, VALUE) \
|
#define SetIniInt(DICT, NAME, VALUE) \
|
||||||
do { \
|
do { \
|
||||||
sprintf(buffer, "%d", VALUE); \
|
snprintf(buffer, sizeof(buffer), "%d", VALUE); \
|
||||||
iniparser_set(DICT, NAME, buffer); \
|
iniparser_set(DICT, NAME, buffer); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|||||||
@ -76,7 +76,7 @@ MxResult Act3Ammo::Create(Act3* p_world, MxU32 p_isPizza, MxS32 p_index)
|
|||||||
char name[12];
|
char name[12];
|
||||||
|
|
||||||
if (p_isPizza) {
|
if (p_isPizza) {
|
||||||
sprintf(name, "pammo%d", p_index);
|
snprintf(name, sizeof(name), "pammo%d", p_index);
|
||||||
m_roi = CharacterManager()->CreateAutoROI(name, "pizpie", FALSE);
|
m_roi = CharacterManager()->CreateAutoROI(name, "pizpie", FALSE);
|
||||||
m_roi->SetVisibility(TRUE);
|
m_roi->SetVisibility(TRUE);
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ MxResult Act3Ammo::Create(Act3* p_world, MxU32 p_isPizza, MxS32 p_index)
|
|||||||
assert(m_roi);
|
assert(m_roi);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sprintf(name, "dammo%d", p_index);
|
snprintf(name, sizeof(name), "dammo%d", p_index);
|
||||||
m_roi = CharacterManager()->CreateAutoROI(name, "donut", FALSE);
|
m_roi = CharacterManager()->CreateAutoROI(name, "donut", FALSE);
|
||||||
m_roi->SetVisibility(TRUE);
|
m_roi->SetVisibility(TRUE);
|
||||||
|
|
||||||
|
|||||||
@ -94,7 +94,7 @@ void Ambulance::Animate(float p_time)
|
|||||||
float speed = abs(m_worldSpeed);
|
float speed = abs(m_worldSpeed);
|
||||||
float maxLinearVel = NavController()->GetMaxLinearVel();
|
float maxLinearVel = NavController()->GetMaxLinearVel();
|
||||||
|
|
||||||
sprintf(buf, "%g", speed / maxLinearVel);
|
snprintf(buf, sizeof(buf), "%g", speed / maxLinearVel);
|
||||||
VariableTable()->SetVariable(g_varAMBULSPEED, buf);
|
VariableTable()->SetVariable(g_varAMBULSPEED, buf);
|
||||||
|
|
||||||
m_fuel += (p_time - m_time) * -3.333333333e-06f;
|
m_fuel += (p_time - m_time) * -3.333333333e-06f;
|
||||||
@ -104,7 +104,7 @@ void Ambulance::Animate(float p_time)
|
|||||||
|
|
||||||
m_time = p_time;
|
m_time = p_time;
|
||||||
|
|
||||||
sprintf(buf, "%g", m_fuel);
|
snprintf(buf, sizeof(buf), "%g", m_fuel);
|
||||||
VariableTable()->SetVariable(g_varAMBULFUEL, buf);
|
VariableTable()->SetVariable(g_varAMBULFUEL, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,7 +59,7 @@ void DuneBuggy::Animate(float p_time)
|
|||||||
float speed = abs(m_worldSpeed);
|
float speed = abs(m_worldSpeed);
|
||||||
float maxLinearVel = NavController()->GetMaxLinearVel();
|
float maxLinearVel = NavController()->GetMaxLinearVel();
|
||||||
|
|
||||||
sprintf(buf, "%g", speed / maxLinearVel);
|
snprintf(buf, sizeof(buf), "%g", speed / maxLinearVel);
|
||||||
VariableTable()->SetVariable(g_varDUNESPEED, buf);
|
VariableTable()->SetVariable(g_varDUNESPEED, buf);
|
||||||
|
|
||||||
m_fuel += (p_time - m_time) * -3.333333333e-06f;
|
m_fuel += (p_time - m_time) * -3.333333333e-06f;
|
||||||
@ -69,7 +69,7 @@ void DuneBuggy::Animate(float p_time)
|
|||||||
|
|
||||||
m_time = p_time;
|
m_time = p_time;
|
||||||
|
|
||||||
sprintf(buf, "%g", m_fuel);
|
snprintf(buf, sizeof(buf), "%g", m_fuel);
|
||||||
VariableTable()->SetVariable(g_varDUNEFUEL, buf);
|
VariableTable()->SetVariable(g_varDUNEFUEL, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -62,7 +62,7 @@ void Jetski::Animate(float p_time)
|
|||||||
float speed = abs(m_worldSpeed);
|
float speed = abs(m_worldSpeed);
|
||||||
float maxLinearVel = NavController()->GetMaxLinearVel();
|
float maxLinearVel = NavController()->GetMaxLinearVel();
|
||||||
|
|
||||||
sprintf(buf, "%g", speed / maxLinearVel);
|
snprintf(buf, sizeof(buf), "%g", speed / maxLinearVel);
|
||||||
VariableTable()->SetVariable(g_varJETSPEED, buf);
|
VariableTable()->SetVariable(g_varJETSPEED, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -55,7 +55,7 @@ void Motocycle::Animate(float p_time)
|
|||||||
float speed = abs(m_worldSpeed);
|
float speed = abs(m_worldSpeed);
|
||||||
float maxLinearVel = NavController()->GetMaxLinearVel();
|
float maxLinearVel = NavController()->GetMaxLinearVel();
|
||||||
|
|
||||||
sprintf(buf, "%g", speed / maxLinearVel);
|
snprintf(buf, sizeof(buf), "%g", speed / maxLinearVel);
|
||||||
VariableTable()->SetVariable(g_varMOTOSPEED, buf);
|
VariableTable()->SetVariable(g_varMOTOSPEED, buf);
|
||||||
|
|
||||||
m_fuel += (p_time - m_time) * -3.333333333e-06f;
|
m_fuel += (p_time - m_time) * -3.333333333e-06f;
|
||||||
@ -65,7 +65,7 @@ void Motocycle::Animate(float p_time)
|
|||||||
|
|
||||||
m_time = p_time;
|
m_time = p_time;
|
||||||
|
|
||||||
sprintf(buf, "%g", m_fuel);
|
snprintf(buf, sizeof(buf), "%g", m_fuel);
|
||||||
VariableTable()->SetVariable(g_varMOTOFUEL, buf);
|
VariableTable()->SetVariable(g_varMOTOFUEL, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,7 +85,7 @@ void TowTrack::Animate(float p_time)
|
|||||||
float speed = abs(m_worldSpeed);
|
float speed = abs(m_worldSpeed);
|
||||||
float maxLinearVel = NavController()->GetMaxLinearVel();
|
float maxLinearVel = NavController()->GetMaxLinearVel();
|
||||||
|
|
||||||
sprintf(buf, "%g", speed / maxLinearVel);
|
snprintf(buf, sizeof(buf), "%g", speed / maxLinearVel);
|
||||||
VariableTable()->SetVariable(g_varTOWSPEED, buf);
|
VariableTable()->SetVariable(g_varTOWSPEED, buf);
|
||||||
|
|
||||||
m_fuel += (p_time - m_time) * -3.333333333e-06f;
|
m_fuel += (p_time - m_time) * -3.333333333e-06f;
|
||||||
@ -95,7 +95,7 @@ void TowTrack::Animate(float p_time)
|
|||||||
|
|
||||||
m_time = p_time;
|
m_time = p_time;
|
||||||
|
|
||||||
sprintf(buf, "%g", m_fuel);
|
snprintf(buf, sizeof(buf), "%g", m_fuel);
|
||||||
VariableTable()->SetVariable(g_varTOWFUEL, buf);
|
VariableTable()->SetVariable(g_varTOWFUEL, buf);
|
||||||
|
|
||||||
if (p_time - m_state->m_startTime > 100000.0f && m_state->m_unk0x08 == 1 && !m_state->m_unk0x10) {
|
if (p_time - m_state->m_startTime > 100000.0f && m_state->m_unk0x08 == 1 && !m_state->m_unk0x10) {
|
||||||
|
|||||||
@ -1383,7 +1383,7 @@ void LegoCarBuild::FUN_10025350(MxS32 p_objectId)
|
|||||||
m_Paint_Sound->Enable(FALSE);
|
m_Paint_Sound->Enable(FALSE);
|
||||||
m_Paint_Sound->Enable(TRUE);
|
m_Paint_Sound->Enable(TRUE);
|
||||||
m_unk0x110->FUN_100a93b0(color);
|
m_unk0x110->FUN_100a93b0(color);
|
||||||
sprintf(buffer, "c_%s", m_unk0x110->GetName());
|
snprintf(buffer, sizeof(buffer), "c_%s", m_unk0x110->GetName());
|
||||||
VariableTable()->SetVariable(buffer, color);
|
VariableTable()->SetVariable(buffer, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -631,26 +631,26 @@ MxResult LegoAnimationManager::LoadWorldInfo(LegoOmni::World p_worldId)
|
|||||||
|
|
||||||
char filename[128];
|
char filename[128];
|
||||||
char path[1024];
|
char path[1024];
|
||||||
sprintf(filename, "lego\\data\\%sinf.dta", Lego()->GetWorldName(p_worldId));
|
snprintf(filename, sizeof(filename), "lego\\data\\%sinf.dta", Lego()->GetWorldName(p_worldId));
|
||||||
sprintf(path, "%s", MxOmni::GetHD());
|
snprintf(path, sizeof(path), "%s", MxOmni::GetHD());
|
||||||
|
|
||||||
if (path[strlen(path) - 1] != '\\') {
|
if (path[strlen(path) - 1] != '\\') {
|
||||||
strcat(path, "\\");
|
strncat(path, "\\", sizeof(path) - strlen(path) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
strcat(path, filename);
|
strncat(path, filename, sizeof(path) - strlen(path) - 1);
|
||||||
MxString::MapPathToFilesystem(path);
|
MxString::MapPathToFilesystem(path);
|
||||||
|
|
||||||
SDL_PathInfo pathInfo;
|
SDL_PathInfo pathInfo;
|
||||||
|
|
||||||
if (!SDL_GetPathInfo(path, &pathInfo) || pathInfo.type != SDL_PATHTYPE_FILE) {
|
if (!SDL_GetPathInfo(path, &pathInfo) || pathInfo.type != SDL_PATHTYPE_FILE) {
|
||||||
sprintf(path, "%s", MxOmni::GetCD());
|
snprintf(path, sizeof(path), "%s", MxOmni::GetCD());
|
||||||
|
|
||||||
if (path[strlen(path) - 1] != '\\') {
|
if (path[strlen(path) - 1] != '\\') {
|
||||||
strcat(path, "\\");
|
strncat(path, "\\", sizeof(path) - strlen(path) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
strcat(path, filename);
|
strncat(path, filename, sizeof(path) - strlen(path) - 1);
|
||||||
MxString::MapPathToFilesystem(path);
|
MxString::MapPathToFilesystem(path);
|
||||||
|
|
||||||
if (!SDL_GetPathInfo(path, &pathInfo) || pathInfo.type != SDL_PATHTYPE_FILE) {
|
if (!SDL_GetPathInfo(path, &pathInfo) || pathInfo.type != SDL_PATHTYPE_FILE) {
|
||||||
@ -1014,7 +1014,7 @@ MxResult LegoAnimationManager::FUN_100605e0(
|
|||||||
}
|
}
|
||||||
|
|
||||||
char buf[256];
|
char buf[256];
|
||||||
sprintf(buf, "%s:%d", g_strANIMMAN_ID, tranInfo->m_index);
|
snprintf(buf, sizeof(buf), "%s:%d", g_strANIMMAN_ID, tranInfo->m_index);
|
||||||
|
|
||||||
action.SetAtomId(*Lego()->GetWorldAtom(m_worldId));
|
action.SetAtomId(*Lego()->GetWorldAtom(m_worldId));
|
||||||
action.SetObjectId(animInfo.m_objectId);
|
action.SetObjectId(animInfo.m_objectId);
|
||||||
@ -1081,7 +1081,7 @@ MxResult LegoAnimationManager::FUN_100609f0(MxU32 p_objectId, MxMatrix* p_matrix
|
|||||||
}
|
}
|
||||||
|
|
||||||
char buf[256];
|
char buf[256];
|
||||||
sprintf(buf, "%s:%d", g_strANIMMAN_ID, info->m_index);
|
snprintf(buf, sizeof(buf), "%s:%d", g_strANIMMAN_ID, info->m_index);
|
||||||
|
|
||||||
action.SetAtomId(*Lego()->GetWorldAtom(m_worldId));
|
action.SetAtomId(*Lego()->GetWorldAtom(m_worldId));
|
||||||
action.SetObjectId(p_objectId);
|
action.SetObjectId(p_objectId);
|
||||||
|
|||||||
@ -521,7 +521,7 @@ LegoROI* LegoCharacterManager::CreateActorROI(const char* p_key)
|
|||||||
|
|
||||||
ViewLODList* lodList = lodManager->Lookup(parentName);
|
ViewLODList* lodList = lodManager->Lookup(parentName);
|
||||||
MxS32 lodSize = lodList->Size();
|
MxS32 lodSize = lodList->Size();
|
||||||
sprintf(lodName, "%s%d", p_key, i);
|
snprintf(lodName, sizeof(lodName), "%s%d", p_key, i);
|
||||||
ViewLODList* dupLodList = lodManager->Create(lodName, lodSize);
|
ViewLODList* dupLodList = lodManager->Create(lodName, lodSize);
|
||||||
|
|
||||||
for (MxS32 j = 0; j < lodSize; j++) {
|
for (MxS32 j = 0; j < lodSize; j++) {
|
||||||
@ -616,7 +616,7 @@ MxBool LegoCharacterManager::SetHeadTexture(LegoROI* p_roi, LegoTextureInfo* p_t
|
|||||||
assert(lodList);
|
assert(lodList);
|
||||||
|
|
||||||
MxS32 lodSize = lodList->Size();
|
MxS32 lodSize = lodList->Size();
|
||||||
sprintf(lodName, "%s%s%d", p_roi->GetName(), "head", g_headTextureCounter++);
|
snprintf(lodName, sizeof(lodName), "%s%s%d", p_roi->GetName(), "head", g_headTextureCounter++);
|
||||||
ViewLODList* dupLodList = GetViewLODListManager()->Create(lodName, lodSize);
|
ViewLODList* dupLodList = GetViewLODListManager()->Create(lodName, lodSize);
|
||||||
assert(dupLodList);
|
assert(dupLodList);
|
||||||
|
|
||||||
@ -829,7 +829,7 @@ MxBool LegoCharacterManager::SwitchVariant(LegoROI* p_roi)
|
|||||||
|
|
||||||
ViewLODList* lodList = GetViewLODListManager()->Lookup(part.m_partName[partNameIndex]);
|
ViewLODList* lodList = GetViewLODListManager()->Lookup(part.m_partName[partNameIndex]);
|
||||||
MxS32 lodSize = lodList->Size();
|
MxS32 lodSize = lodList->Size();
|
||||||
sprintf(lodName, "%s%d", p_roi->GetName(), g_infohatVariantCounter++);
|
snprintf(lodName, sizeof(lodName), "%s%d", p_roi->GetName(), g_infohatVariantCounter++);
|
||||||
ViewLODList* dupLodList = GetViewLODListManager()->Create(lodName, lodSize);
|
ViewLODList* dupLodList = GetViewLODListManager()->Create(lodName, lodSize);
|
||||||
|
|
||||||
Tgl::Renderer* renderer = VideoManager()->GetRenderer();
|
Tgl::Renderer* renderer = VideoManager()->GetRenderer();
|
||||||
@ -1007,7 +1007,7 @@ LegoROI* LegoCharacterManager::CreateAutoROI(const char* p_name, const char* p_l
|
|||||||
name = p_name;
|
name = p_name;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sprintf(buf, "autoROI_%d", g_autoRoiCounter++);
|
snprintf(buf, sizeof(buf), "autoROI_%d", g_autoRoiCounter++);
|
||||||
name = buf;
|
name = buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -577,12 +577,12 @@ void LegoGameState::GetFileSavePath(MxString* p_outPath, MxS16 p_slotn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Slot: "G0", "G1", ...
|
// Slot: "G0", "G1", ...
|
||||||
strcat(path, "\\G");
|
strncat(path, "\\G", sizeof(path) - strlen(path) - 1);
|
||||||
baseForSlot[0] += p_slotn;
|
baseForSlot[0] += p_slotn;
|
||||||
strcat(path, baseForSlot);
|
strncat(path, baseForSlot, sizeof(path) - strlen(path) - 1);
|
||||||
|
|
||||||
// Extension: ".GS"
|
// Extension: ".GS"
|
||||||
strcat(path, g_fileExtensionGS);
|
strncat(path, g_fileExtensionGS, sizeof(path) - strlen(path) - 1);
|
||||||
*p_outPath = MxString(path);
|
*p_outPath = MxString(path);
|
||||||
p_outPath->MapPathToFilesystem();
|
p_outPath->MapPathToFilesystem();
|
||||||
}
|
}
|
||||||
@ -1088,7 +1088,7 @@ MxBool ROIColorOverride(const char* p_input, char* p_output, MxU32 p_copyLen)
|
|||||||
SDL_strncasecmp(p_input, "INDIR-G-", strlen("INDIR-F-")) == 0)) {
|
SDL_strncasecmp(p_input, "INDIR-G-", strlen("INDIR-F-")) == 0)) {
|
||||||
|
|
||||||
char buf[256];
|
char buf[256];
|
||||||
sprintf(buf, "c_%s", &p_input[strlen("INDIR-F-")]);
|
snprintf(buf, sizeof(buf), "c_%s", &p_input[strlen("INDIR-F-")]);
|
||||||
|
|
||||||
const char* value = VariableTable()->GetVariable(buf);
|
const char* value = VariableTable()->GetVariable(buf);
|
||||||
if (value != NULL) {
|
if (value != NULL) {
|
||||||
@ -1285,7 +1285,7 @@ void LegoBackgroundColor::ToggleDayNight(MxBool p_sun)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(buffer, "set %d %d %d", (MxU32) (m_h * 100.0f), (MxU32) (m_s * 100.0f), (MxU32) (m_v * 100.0f));
|
snprintf(buffer, sizeof(buffer), "set %d %d %d", (MxU32) (m_h * 100.0f), (MxU32) (m_s * 100.0f), (MxU32) (m_v * 100.0f));
|
||||||
m_value = buffer;
|
m_value = buffer;
|
||||||
|
|
||||||
float convertedR, convertedG, convertedB;
|
float convertedR, convertedG, convertedB;
|
||||||
@ -1305,7 +1305,7 @@ void LegoBackgroundColor::ToggleSkyColor()
|
|||||||
m_h -= 1.0;
|
m_h -= 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(buffer, "set %d %d %d", (MxU32) (m_h * 100.0f), (MxU32) (m_s * 100.0f), (MxU32) (m_v * 100.0f));
|
snprintf(buffer, sizeof(buffer), "set %d %d %d", (MxU32) (m_h * 100.0f), (MxU32) (m_s * 100.0f), (MxU32) (m_v * 100.0f));
|
||||||
m_value = buffer;
|
m_value = buffer;
|
||||||
|
|
||||||
float convertedR, convertedG, convertedB;
|
float convertedR, convertedG, convertedB;
|
||||||
|
|||||||
@ -222,8 +222,8 @@ LegoEntity* LegoPlantManager::CreatePlant(MxS32 p_index, LegoWorld* p_world, Leg
|
|||||||
char name[256];
|
char name[256];
|
||||||
char lodName[256];
|
char lodName[256];
|
||||||
|
|
||||||
sprintf(name, "plant%d", p_index);
|
snprintf(name, sizeof(name), "plant%d", p_index);
|
||||||
sprintf(lodName, "%s", g_plantLodNames[g_plantInfo[p_index].m_variant][g_plantInfo[p_index].m_color]);
|
snprintf(lodName, sizeof(lodName), "%s", g_plantLodNames[g_plantInfo[p_index].m_variant][g_plantInfo[p_index].m_color]);
|
||||||
|
|
||||||
LegoROI* roi = CharacterManager()->CreateAutoROI(name, lodName, TRUE);
|
LegoROI* roi = CharacterManager()->CreateAutoROI(name, lodName, TRUE);
|
||||||
assert(roi != NULL);
|
assert(roi != NULL);
|
||||||
|
|||||||
@ -625,7 +625,7 @@ MxS32 UpdateLightPosition(MxS32 p_increase)
|
|||||||
SetLightPosition(lightPosition);
|
SetLightPosition(lightPosition);
|
||||||
|
|
||||||
char lightPositionBuffer[32];
|
char lightPositionBuffer[32];
|
||||||
sprintf(lightPositionBuffer, "%d", lightPosition);
|
snprintf(lightPositionBuffer, sizeof(lightPositionBuffer), "%d", lightPosition);
|
||||||
|
|
||||||
VariableTable()->SetVariable("lightposition", lightPositionBuffer);
|
VariableTable()->SetVariable("lightposition", lightPositionBuffer);
|
||||||
|
|
||||||
|
|||||||
@ -49,7 +49,7 @@ MxResult Act2Brick::Create(MxS32 p_index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char name[12];
|
char name[12];
|
||||||
sprintf(name, "chbrick%d", p_index);
|
snprintf(name, sizeof(name), "chbrick%d", p_index);
|
||||||
|
|
||||||
m_roi = CharacterManager()->CreateAutoROI(name, g_lodNames[p_index], FALSE);
|
m_roi = CharacterManager()->CreateAutoROI(name, g_lodNames[p_index], FALSE);
|
||||||
assert(m_roi);
|
assert(m_roi);
|
||||||
|
|||||||
@ -310,19 +310,19 @@ void LegoEntity::ClickAnimation()
|
|||||||
case e_actor:
|
case e_actor:
|
||||||
objectId = LegoOmni::GetInstance()->GetCharacterManager()->GetAnimationId(m_roi);
|
objectId = LegoOmni::GetInstance()->GetCharacterManager()->GetAnimationId(m_roi);
|
||||||
action.SetAtomId(MxAtomId(LegoCharacterManager::GetCustomizeAnimFile(), e_lowerCase2));
|
action.SetAtomId(MxAtomId(LegoCharacterManager::GetCustomizeAnimFile(), e_lowerCase2));
|
||||||
sprintf(extra, "SUBST:actor_01:%s", name);
|
snprintf(extra, sizeof(extra), "SUBST:actor_01:%s", name);
|
||||||
break;
|
break;
|
||||||
case e_unk1:
|
case e_unk1:
|
||||||
break;
|
break;
|
||||||
case e_plant:
|
case e_plant:
|
||||||
objectId = LegoOmni::GetInstance()->GetPlantManager()->GetAnimationId(this);
|
objectId = LegoOmni::GetInstance()->GetPlantManager()->GetAnimationId(this);
|
||||||
action.SetAtomId(MxAtomId(LegoPlantManager::GetCustomizeAnimFile(), e_lowerCase2));
|
action.SetAtomId(MxAtomId(LegoPlantManager::GetCustomizeAnimFile(), e_lowerCase2));
|
||||||
sprintf(extra, "SUBST:bush:%s:tree:%s:flwrred:%s:palm:%s", name, name, name, name);
|
snprintf(extra, sizeof(extra), "SUBST:bush:%s:tree:%s:flwrred:%s:palm:%s", name, name, name, name);
|
||||||
break;
|
break;
|
||||||
case e_building:
|
case e_building:
|
||||||
objectId = LegoOmni::GetInstance()->GetBuildingManager()->GetAnimationId(this);
|
objectId = LegoOmni::GetInstance()->GetBuildingManager()->GetAnimationId(this);
|
||||||
action.SetAtomId(MxAtomId(BuildingManager()->GetCustomizeAnimFile(), e_lowerCase2));
|
action.SetAtomId(MxAtomId(BuildingManager()->GetCustomizeAnimFile(), e_lowerCase2));
|
||||||
sprintf(extra, "SUBST:haus1:%s", name);
|
snprintf(extra, sizeof(extra), "SUBST:haus1:%s", name);
|
||||||
break;
|
break;
|
||||||
case e_autoROI:
|
case e_autoROI:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -165,25 +165,25 @@ void LegoWorldPresenter::StartingTickle()
|
|||||||
MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world)
|
MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world)
|
||||||
{
|
{
|
||||||
char wdbPath[512];
|
char wdbPath[512];
|
||||||
sprintf(wdbPath, "%s", MxOmni::GetHD());
|
snprintf(wdbPath, sizeof(wdbPath), "%s", MxOmni::GetHD());
|
||||||
|
|
||||||
if (wdbPath[strlen(wdbPath) - 1] != '\\' && wdbPath[strlen(wdbPath) - 1] != '/') {
|
if (wdbPath[strlen(wdbPath) - 1] != '\\' && wdbPath[strlen(wdbPath) - 1] != '/') {
|
||||||
strcat(wdbPath, "\\");
|
strncat(wdbPath, "\\", sizeof(wdbPath) - strlen(wdbPath) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
strcat(wdbPath, "lego\\data\\world.wdb");
|
strncat(wdbPath, "lego\\data\\world.wdb", sizeof(wdbPath) - strlen(wdbPath) - 1);
|
||||||
MxString::MapPathToFilesystem(wdbPath);
|
MxString::MapPathToFilesystem(wdbPath);
|
||||||
|
|
||||||
SDL_IOStream* wdbFile;
|
SDL_IOStream* wdbFile;
|
||||||
|
|
||||||
if ((wdbFile = SDL_IOFromFile(wdbPath, "rb")) == NULL) {
|
if ((wdbFile = SDL_IOFromFile(wdbPath, "rb")) == NULL) {
|
||||||
sprintf(wdbPath, "%s", MxOmni::GetCD());
|
snprintf(wdbPath, sizeof(wdbPath), "%s", MxOmni::GetCD());
|
||||||
|
|
||||||
if (wdbPath[strlen(wdbPath) - 1] != '\\' && wdbPath[strlen(wdbPath) - 1] != '/') {
|
if (wdbPath[strlen(wdbPath) - 1] != '\\' && wdbPath[strlen(wdbPath) - 1] != '/') {
|
||||||
strcat(wdbPath, "\\");
|
strncat(wdbPath, "\\", sizeof(wdbPath) - strlen(wdbPath) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
strcat(wdbPath, "lego\\data\\world.wdb");
|
strncat(wdbPath, "lego\\data\\world.wdb", sizeof(wdbPath) - strlen(wdbPath) - 1);
|
||||||
MxString::MapPathToFilesystem(wdbPath);
|
MxString::MapPathToFilesystem(wdbPath);
|
||||||
|
|
||||||
if ((wdbFile = SDL_IOFromFile(wdbPath, "rb")) == NULL) {
|
if ((wdbFile = SDL_IOFromFile(wdbPath, "rb")) == NULL) {
|
||||||
|
|||||||
@ -193,7 +193,7 @@ MxLong CarRace::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
|||||||
|
|
||||||
m_unk0x104 = paramData;
|
m_unk0x104 = paramData;
|
||||||
LegoChar buffer[20];
|
LegoChar buffer[20];
|
||||||
sprintf(buffer, "%g", 0.036 + 0.928 * (m_unk0xf8 * 20.0 + m_unk0x104) / (g_unk0x100f0c7c * 20.0));
|
snprintf(buffer, sizeof(buffer), "%g", 0.036 + 0.928 * (m_unk0xf8 * 20.0 + m_unk0x104) / (g_unk0x100f0c7c * 20.0));
|
||||||
VariableTable()->SetVariable("DISTANCE", buffer);
|
VariableTable()->SetVariable("DISTANCE", buffer);
|
||||||
|
|
||||||
if (m_unk0x104 == 0x14) {
|
if (m_unk0x104 == 0x14) {
|
||||||
|
|||||||
@ -171,7 +171,7 @@ MxLong JetskiRace::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
|||||||
|
|
||||||
m_unk0x104 = paramData;
|
m_unk0x104 = paramData;
|
||||||
LegoChar buffer[20];
|
LegoChar buffer[20];
|
||||||
sprintf(buffer, "%g", 0.032 + 0.936 * (m_unk0xf8 * 20.0 + m_unk0x104) / (g_unk0x100f0c78 * 20.0));
|
snprintf(buffer, sizeof(buffer), "%g", 0.032 + 0.936 * (m_unk0xf8 * 20.0 + m_unk0x104) / (g_unk0x100f0c78 * 20.0));
|
||||||
VariableTable()->SetVariable("DISTANCE", buffer);
|
VariableTable()->SetVariable("DISTANCE", buffer);
|
||||||
|
|
||||||
if (m_unk0x104 == 0x14) {
|
if (m_unk0x104 == 0x14) {
|
||||||
|
|||||||
@ -425,7 +425,7 @@ void LegoRaceCar::Animate(float p_time)
|
|||||||
float maximumSpeed = NavController()->GetMaxLinearVel();
|
float maximumSpeed = NavController()->GetMaxLinearVel();
|
||||||
char buffer[200];
|
char buffer[200];
|
||||||
|
|
||||||
sprintf(buffer, "%g", absoluteSpeed / maximumSpeed);
|
snprintf(buffer, sizeof(buffer), "%g", absoluteSpeed / maximumSpeed);
|
||||||
|
|
||||||
VariableTable()->SetVariable(g_strSpeed, buffer);
|
VariableTable()->SetVariable(g_strSpeed, buffer);
|
||||||
|
|
||||||
@ -624,7 +624,7 @@ void LegoJetski::Animate(float p_time)
|
|||||||
float speedRatio = absoluteSpeed / NavController()->GetMaxLinearVel();
|
float speedRatio = absoluteSpeed / NavController()->GetMaxLinearVel();
|
||||||
char buffer[200];
|
char buffer[200];
|
||||||
|
|
||||||
sprintf(buffer, "%g", speedRatio);
|
snprintf(buffer, sizeof(buffer), "%g", speedRatio);
|
||||||
|
|
||||||
VariableTable()->SetVariable(g_strJetSpeed, buffer);
|
VariableTable()->SetVariable(g_strJetSpeed, buffer);
|
||||||
|
|
||||||
|
|||||||
@ -201,7 +201,7 @@ LegoChar* LegoAnimPresenter::FUN_10069150(const LegoChar* p_und1)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LegoChar buffer[32];
|
LegoChar buffer[32];
|
||||||
sprintf(buffer, "%d", m_action->GetUnknown24());
|
snprintf(buffer, sizeof(buffer), "%d", m_action->GetUnknown24());
|
||||||
str = new LegoChar[strlen(p_und1) + strlen(buffer) + strlen(GetActionObjectName()) + 1];
|
str = new LegoChar[strlen(p_und1) + strlen(buffer) + strlen(GetActionObjectName()) + 1];
|
||||||
|
|
||||||
if (str != NULL) {
|
if (str != NULL) {
|
||||||
@ -343,11 +343,11 @@ LegoChar* LegoAnimPresenter::GetVariableOrIdentity(const LegoChar* p_varName, co
|
|||||||
*result = '\0';
|
*result = '\0';
|
||||||
|
|
||||||
if (p_prefix) {
|
if (p_prefix) {
|
||||||
strcpy(result, p_prefix);
|
strncpy(result, p_prefix, len);
|
||||||
strcat(result, ":");
|
strncat(result, ":", len - strlen(result) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
strcat(result, str);
|
strncat(result, str, len - strlen(result) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@ -29,8 +29,8 @@ void LegoFlcTexturePresenter::StartingTickle()
|
|||||||
m_action->GetExtra(extraLength, pp);
|
m_action->GetExtra(extraLength, pp);
|
||||||
|
|
||||||
if (pp != NULL) {
|
if (pp != NULL) {
|
||||||
strcpy(extraCopy, pp);
|
strncpy(extraCopy, pp, sizeof(extraCopy));
|
||||||
strcat(extraCopy, ".gif");
|
strncat(extraCopy, ".gif", sizeof(extraCopy) - strlen(extraCopy) - 1);
|
||||||
m_texture = TextureContainer()->Get(extraCopy);
|
m_texture = TextureContainer()->Get(extraCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -447,7 +447,7 @@ void LegoVideoManager::DrawFPS()
|
|||||||
if (Timer()->GetTime() > m_unk0x54c + 5000.f) {
|
if (Timer()->GetTime() > m_unk0x54c + 5000.f) {
|
||||||
char buffer[32];
|
char buffer[32];
|
||||||
MxFloat time = (Timer()->GetTime() - m_unk0x54c) / 1000.0f;
|
MxFloat time = (Timer()->GetTime() - m_unk0x54c) / 1000.0f;
|
||||||
sprintf(buffer, "%.02f", m_unk0x550 / time);
|
snprintf(buffer, sizeof(buffer), "%.02f", m_unk0x550 / time);
|
||||||
m_unk0x54c = Timer()->GetTime();
|
m_unk0x54c = Timer()->GetTime();
|
||||||
|
|
||||||
DDSURFACEDESC surfaceDesc;
|
DDSURFACEDESC surfaceDesc;
|
||||||
|
|||||||
@ -600,7 +600,7 @@ MxLong Act3::Notify(MxParam& p_param)
|
|||||||
char buf[80];
|
char buf[80];
|
||||||
|
|
||||||
do {
|
do {
|
||||||
sprintf(buf, "HelicopterDotOn%d_Bitmap", length + 1);
|
snprintf(buf, sizeof(buf), "HelicopterDotOn%d_Bitmap", length + 1);
|
||||||
m_helicopterDots[length] = (MxPresenter*) Find("MxPresenter", buf);
|
m_helicopterDots[length] = (MxPresenter*) Find("MxPresenter", buf);
|
||||||
|
|
||||||
if (m_unk0x421e > length) {
|
if (m_unk0x421e > length) {
|
||||||
|
|||||||
@ -71,7 +71,7 @@ MxResult MxDSFile::ReadChunks()
|
|||||||
|
|
||||||
m_io.Read(&m_header, 0x0c);
|
m_io.Read(&m_header, 0x0c);
|
||||||
if ((m_header.m_majorVersion != SI_MAJOR_VERSION) || (m_header.m_minorVersion != SI_MINOR_VERSION)) {
|
if ((m_header.m_majorVersion != SI_MAJOR_VERSION) || (m_header.m_minorVersion != SI_MINOR_VERSION)) {
|
||||||
sprintf(tempBuffer, "Wrong SI file version. %d.%d expected.", SI_MAJOR_VERSION, SI_MINOR_VERSION);
|
snprintf(tempBuffer, sizeof(tempBuffer), "Wrong SI file version. %d.%d expected.", SI_MAJOR_VERSION, SI_MINOR_VERSION);
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "LEGO® Island Error", tempBuffer, NULL);
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "LEGO® Island Error", tempBuffer, NULL);
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,7 +84,7 @@ ViewLODList* ViewLODListManager::Create(const ROIName& rROIName, int lodCount)
|
|||||||
list->Release();
|
list->Release();
|
||||||
|
|
||||||
char num[12];
|
char num[12];
|
||||||
sprintf(num, "%d", g_ROINameUID);
|
snprintf(num, sizeof(num), "%d", g_ROINameUID);
|
||||||
pROIName = new char[strlen(rROIName) + strlen(num) + 1];
|
pROIName = new char[strlen(rROIName) + strlen(num) + 1];
|
||||||
strcpy(pROIName, rROIName);
|
strcpy(pROIName, rROIName);
|
||||||
strcat(pROIName, num);
|
strcat(pROIName, num);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user