summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/AnimViewer.cpp4
-rw-r--r--src/core/Cam.cpp2
-rw-r--r--src/core/Camera.cpp16
-rw-r--r--src/core/Camera.h3
-rw-r--r--src/core/Collision.cpp2
-rw-r--r--src/core/ControllerConfig.cpp16
-rw-r--r--src/core/FileLoader.cpp4
-rw-r--r--src/core/Frontend.cpp3
-rw-r--r--src/core/Frontend.h2
-rw-r--r--src/core/Pad.cpp4
-rw-r--r--src/core/Pools.cpp4
-rw-r--r--src/core/Profile.cpp4
-rw-r--r--src/core/Profile.h4
-rw-r--r--src/core/Streaming.cpp4
-rw-r--r--src/core/SurfaceTable.cpp2
-rw-r--r--src/core/SurfaceTable.h2
-rw-r--r--src/core/World.cpp1
-rw-r--r--src/core/Zones.cpp2
-rw-r--r--src/core/Zones.h2
-rw-r--r--src/core/main.cpp10
-rw-r--r--src/core/main.h4
21 files changed, 64 insertions, 31 deletions
diff --git a/src/core/AnimViewer.cpp b/src/core/AnimViewer.cpp
index 40a8b09e..f49f811f 100644
--- a/src/core/AnimViewer.cpp
+++ b/src/core/AnimViewer.cpp
@@ -120,7 +120,7 @@ CAnimViewer::Initialise(void) {
if (!CFileMgr::ReadLine(fd, gString, 255))
break;
- sscanf(gString, "%s %s", &modelName, &animGroup);
+ sscanf(gString, "%s %s", modelName, animGroup);
int groupId;
for (groupId = 0; groupId < NUM_ANIM_ASSOC_GROUPS; groupId++) {
if (!strcmp(animGroup, CAnimManager::GetAnimGroupName((AssocGroupId)groupId)))
@@ -429,4 +429,4 @@ CAnimViewer::Shutdown(void)
CTimer::Shutdown();
CStreaming::Shutdown();
CTxdStore::RemoveTxdSlot(animTxdSlot);
-} \ No newline at end of file
+}
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index 8cd44f6f..6c79604c 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -885,7 +885,7 @@ CCam::PrintMode(void)
sprintf(buf, " ");
sprintf(buf, " ");
- static char *modes[] = { "None",
+ static Const char *modes[] = { "None",
"Top Down", "GTA Classic", "Behind Car", "Follow Ped",
"Aiming", "Debug", "Sniper", "Rocket", "Model Viewer", "Bill",
"Syphon", "Circle", "Cheesy Zoom", "Wheel", "Fixed",
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index 9b178f35..35d230dc 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -80,6 +80,10 @@ CCamera::CCamera(void)
Init();
}
+CCamera::CCamera(float)
+{
+}
+
void
CCamera::Init(void)
{
@@ -87,7 +91,12 @@ CCamera::Init(void)
float fMouseAccelHorzntl = m_fMouseAccelHorzntl;
float fMouseAccelVertical = m_fMouseAccelVertical;
#endif
+#ifdef FIX_BUGS
+ static const CCamera DummyCamera = CCamera(0.f);
+ *this = DummyCamera;
+#else
memset(this, 0, sizeof(CCamera)); // getting rid of vtable, eh?
+#endif
#ifdef GTA3_1_1_PATCH
m_fMouseAccelHorzntl = fMouseAccelHorzntl;
m_fMouseAccelVertical = fMouseAccelVertical;
@@ -740,6 +749,7 @@ CCamera::CamControl(void)
case VEHICLE_TYPE_BOAT:
ReqMode = CCam::MODE_BEHINDBOAT;
break;
+ default: break;
}
// Car zoom value
@@ -2992,7 +3002,7 @@ CCamera::SetZoomValueFollowPedScript(int16 dist)
case 0: m_fPedZoomValueScript = 0.25f; break;
case 1: m_fPedZoomValueScript = 1.5f; break;
case 2: m_fPedZoomValueScript = 2.9f; break;
- default: m_fPedZoomValueScript = m_fPedZoomValueScript; break;
+ default: break;
}
m_bUseScriptZoomValuePed = true;
@@ -3007,7 +3017,7 @@ CCamera::SetZoomValueCamStringScript(int16 dist)
case 0: m_fCarZoomValueScript = ((CVehicle*)Cams[ActiveCam].CamTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_1 : FREE_CAR_ZOOM_VALUE_1; break;
case 1: m_fCarZoomValueScript = ((CVehicle*)Cams[ActiveCam].CamTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_2 : FREE_CAR_ZOOM_VALUE_2; break;
case 2: m_fCarZoomValueScript = ((CVehicle*)Cams[ActiveCam].CamTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_3 : FREE_CAR_ZOOM_VALUE_3; break;
- default: m_fCarZoomValueScript = m_fCarZoomValueScript; break;
+ default: break;
}
} else
#endif
@@ -3016,7 +3026,7 @@ CCamera::SetZoomValueCamStringScript(int16 dist)
case 0: m_fCarZoomValueScript = DEFAULT_CAR_ZOOM_VALUE_1; break;
case 1: m_fCarZoomValueScript = DEFAULT_CAR_ZOOM_VALUE_2; break;
case 2: m_fCarZoomValueScript = DEFAULT_CAR_ZOOM_VALUE_3; break;
- default: m_fCarZoomValueScript = m_fCarZoomValueScript; break;
+ default: break;
}
}
diff --git a/src/core/Camera.h b/src/core/Camera.h
index 94bcbd23..80fc878e 100644
--- a/src/core/Camera.h
+++ b/src/core/Camera.h
@@ -403,7 +403,7 @@ public:
int m_BlurRed;
int m_BlurType;
-uint32 unknown; // some counter having to do with music
+ uint32 unknown; // some counter having to do with music
int m_iWorkOutSpeedThisNumFrames;
int m_iNumFramesSoFar;
@@ -549,6 +549,7 @@ uint32 unknown; // some counter having to do with music
// High level and misc
CCamera(void);
+ CCamera(float);
void Init(void);
void Process(void);
void CamControl(void);
diff --git a/src/core/Collision.cpp b/src/core/Collision.cpp
index 0cdacfdb..01cc323a 100644
--- a/src/core/Collision.cpp
+++ b/src/core/Collision.cpp
@@ -231,7 +231,7 @@ CCollision::SortOutCollisionAfterLoad(void)
void
CCollision::LoadCollisionScreen(eLevelName level)
{
- static char *levelNames[4] = {
+ static Const char *levelNames[4] = {
"",
"IND_ZON",
"COM_ZON",
diff --git a/src/core/ControllerConfig.cpp b/src/core/ControllerConfig.cpp
index dcd9f125..6a5080e5 100644
--- a/src/core/ControllerConfig.cpp
+++ b/src/core/ControllerConfig.cpp
@@ -610,6 +610,7 @@ void CControllerConfigManager::AffectControllerStateOn_ButtonDown(int32 button,
case MOUSE:
state = &CPad::GetPad(PAD1)->PCTempMouseState;
break;
+ default: break;
}
if (pad != NULL)
@@ -1024,7 +1025,7 @@ void CControllerConfigManager::AffectControllerStateOn_ButtonUp(int32 button, eC
case JOYSTICK:
state = &CPad::GetPad(PAD1)->PCTempJoyState;
break;
-
+ default: break;
}
if (process)
@@ -1293,6 +1294,7 @@ bool CControllerConfigManager::GetIsKeyboardKeyDown(RsKeyCodes keycode)
if (CPad::GetPad(PAD1)->GetApps())
return true;
break;
+ default: break;
}
return false;
@@ -1493,6 +1495,7 @@ bool CControllerConfigManager::GetIsKeyboardKeyJustDown(RsKeyCodes keycode)
if (CPad::GetPad(PAD1)->GetAppsJustDown())
return true;
break;
+ default: break;
}
return false;
@@ -1530,6 +1533,7 @@ bool CControllerConfigManager::GetIsMouseButtonDown(RsKeyCodes keycode)
if (CPad::GetPad(PAD1)->GetMouseX2())
return true;
break;
+ default: break;
}
return false;
@@ -1567,6 +1571,7 @@ bool CControllerConfigManager::GetIsMouseButtonUp(RsKeyCodes keycode)
if (CPad::GetPad(PAD1)->GetMouseX2Up())
return true;
break;
+ default: break;
}
return false;
@@ -1747,6 +1752,7 @@ void CControllerConfigManager::DeleteMatchingActionInitiators(e_ControllerAction
DeleteMatchingCommonControls (action, key, type);
DeleteMatching1rst3rdPersonControls (action, key, type);
break;
+ default: break;
}
}
}
@@ -1770,6 +1776,7 @@ bool CControllerConfigManager::GetIsKeyBlank(int32 key, eControllerType type)
if (key != 0)
return false;
break;
+ default: break;
}
return true;
@@ -1836,6 +1843,7 @@ e_ControllerActionType CControllerConfigManager::GetActionType(e_ControllerActio
case PED_SNIPER_ZOOM_OUT:
return ACTIONTYPE_1RSTPERSON;
break;
+ default: break;
}
return ACTIONTYPE_NONE;
@@ -1861,6 +1869,7 @@ void CControllerConfigManager::ClearSettingsAssociatedWithAction(e_ControllerAct
m_aSettings[action][type].m_Key = 0;
m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE;
break;
+ default: break;
}
ResetSettingOrder(action);
@@ -1881,6 +1890,7 @@ wchar *CControllerConfigManager::GetControllerSettingTextWithOrderNumber(e_Contr
return GetControllerSettingTextMouse (action);
case JOYSTICK:
return GetControllerSettingTextJoystick(action);
+ default: break;
}
}
}
@@ -2224,6 +2234,7 @@ wchar *CControllerConfigManager::GetControllerSettingTextKeyBoard(e_ControllerAc
return TheText.Get("FEC_SFT"); // "SHIFT"
break;
}
+ default: break;
}
}
}
@@ -2256,6 +2267,7 @@ wchar *CControllerConfigManager::GetControllerSettingTextMouse(e_ControllerActio
case 7:
return TheText.Get("FEC_MXT"); // MXB2
break;
+ default: break;
}
return NULL;
@@ -2375,6 +2387,7 @@ bool CControllerConfigManager::GetIsActionAButtonCombo(e_ControllerAction action
case PED_CYCLE_TARGET_RIGHT:
return true;
break;
+ default: break;
}
return false;
@@ -2395,6 +2408,7 @@ wchar *CControllerConfigManager::GetButtonComboText(e_ControllerAction action)
case VEHICLE_LOOKBEHIND:
return TheText.Get("FEC_LBC"); // Use Look Left With Look Right.
break;
+ default: break;
}
return NULL;
diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp
index 88afb40c..6e7188c5 100644
--- a/src/core/FileLoader.cpp
+++ b/src/core/FileLoader.cpp
@@ -753,7 +753,7 @@ CFileLoader::LoadClumpObject(const char *line)
char model[24], txd[24];
CClumpModelInfo *mi;
- if(sscanf(line, "%d %s %s", &id, &model, &txd) == 3){
+ if(sscanf(line, "%d %s %s", &id, model, txd) == 3){
mi = CModelInfo::AddClumpModel(id);
mi->SetName(model);
mi->SetTexDictionary(txd);
@@ -1184,7 +1184,7 @@ CFileLoader::LoadMapZones(const char *filename)
float minx, miny, minz;
float maxx, maxy, maxz;
if(sscanf(line, "%s %d %f %f %f %f %f %f %d",
- &name, &type,
+ name, &type,
&minx, &miny, &minz,
&maxx, &maxy, &maxz,
&level) == 9)
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index f0d75d12..d58d0576 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -412,7 +412,7 @@ CMenuManager::ThingsToDoBeforeLeavingPage()
// ------ Functions not in the game/inlined ends
void
-CMenuManager::BuildStatLine(char *text, void *stat, bool itsFloat, void *stat2)
+CMenuManager::BuildStatLine(Const char *text, void *stat, bool itsFloat, void *stat2)
{
if (!text)
return;
@@ -5020,6 +5020,7 @@ CMenuManager::SaveLoadFileError_SetUpErrorScreen()
case SAVESTATUS_DELETEFAILED10:
ChangeScreen(MENUPAGE_DELETE_FAILED, 0, true, false);
break;
+ default: break;
}
}
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index 65c4e178..89517528 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -598,7 +598,7 @@ public:
#endif
public:
- static void BuildStatLine(char *text, void *stat, bool itsFloat, void *stat2);
+ static void BuildStatLine(Const char *text, void *stat, bool itsFloat, void *stat2);
static void CentreMousePointer();
void CheckCodesForControls(int);
bool CheckHover(int x1, int x2, int y1, int y2);
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index da86d15e..924d4724 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -509,7 +509,7 @@ CMouseControllerState CMousePointerStateHelper::GetMouseSetUp()
double xpos = 1.0f, ypos;
glfwGetCursorPos(PSGLOBAL(window), &xpos, &ypos);
- if (xpos != NULL) {
+ if (xpos != 0.f) {
state.MMB = true;
state.RMB = true;
state.LMB = true;
@@ -565,7 +565,7 @@ void CPad::UpdateMouse()
#else
double xpos = 1.0f, ypos;
glfwGetCursorPos(PSGLOBAL(window), &xpos, &ypos);
- if (xpos == NULL)
+ if (xpos == 0.f)
return;
int32 signX = 1;
diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp
index bc65f6b6..b361c36f 100644
--- a/src/core/Pools.cpp
+++ b/src/core/Pools.cpp
@@ -90,7 +90,11 @@ CPools::MakeSureSlotInObjectPoolIsEmpty(int32 slot)
// relocate to another slot??
CObject *newObject = new CObject(object->GetModelIndex(), false);
CWorld::Remove(object);
+#ifdef FIX_BUGS
+ *newObject = *object;
+#else
memcpy(newObject, object, ms_pObjectPool->GetMaxEntrySize());
+#endif
CWorld::Add(newObject);
object->m_rwObject = nil;
delete object;
diff --git a/src/core/Profile.cpp b/src/core/Profile.cpp
index 05d54133..0aa18ab8 100644
--- a/src/core/Profile.cpp
+++ b/src/core/Profile.cpp
@@ -7,7 +7,7 @@ float CProfile::ms_afCumulativeTime[NUM_PROFILES];
float CProfile::ms_afEndTime[NUM_PROFILES];
float CProfile::ms_afMaxEndTime[NUM_PROFILES];
float CProfile::ms_afMaxCumulativeTime[NUM_PROFILES];
-char *CProfile::ms_pProfileString[NUM_PROFILES];
+Const char *CProfile::ms_pProfileString[NUM_PROFILES];
RwRGBA CProfile::ms_aBarColours[NUM_PROFILES];
void CProfile::Initialise()
@@ -68,4 +68,4 @@ void CProfile::ShowResults()
ms_afMaxCumulativeTime[PROFILE_RENDERING_TIME] = Max(ms_afMaxCumulativeTime[PROFILE_RENDERING_TIME], ms_afCumulativeTime[PROFILE_RENDERING_TIME]);
ms_afMaxCumulativeTime[PROFILE_TOTAL] = Max(ms_afMaxCumulativeTime[PROFILE_TOTAL], ms_afCumulativeTime[PROFILE_TOTAL]);
}
-#endif \ No newline at end of file
+#endif
diff --git a/src/core/Profile.h b/src/core/Profile.h
index d2e8054b..4fe693ae 100644
--- a/src/core/Profile.h
+++ b/src/core/Profile.h
@@ -19,10 +19,10 @@ class CProfile
static float ms_afEndTime[NUM_PROFILES];
static float ms_afMaxEndTime[NUM_PROFILES];
static float ms_afMaxCumulativeTime[NUM_PROFILES];
- static char *ms_pProfileString[NUM_PROFILES];
+ static Const char *ms_pProfileString[NUM_PROFILES];
static RwRGBA ms_aBarColours[NUM_PROFILES];
public:
static void Initialise();
static void SuspendProfile(eProfile profile);
static void ShowResults();
-}; \ No newline at end of file
+};
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index a2e6048b..c961f53d 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -710,6 +710,7 @@ CStreaming::RequestSubway(void)
RequestModel(MI_SUBPLATFORM_SUB, STREAMFLAGS_NOFADE);
RequestModel(MI_SUBPLATFORM_SUB2, STREAMFLAGS_NOFADE);
break;
+ default: break;
}
}
@@ -747,6 +748,7 @@ CStreaming::RequestIslands(eLevelName level)
RequestModel(islandLODindust, BIGBUILDINGFLAGS);
RequestModel(islandLODcomSub, BIGBUILDINGFLAGS);
break;
+ default: break;
}
}
@@ -1750,7 +1752,7 @@ CStreaming::ProcessLoadingChannel(int32 ch)
void
CStreaming::RetryLoadFile(int32 ch)
{
- char *key;
+ Const char *key;
CPad::StopPadsShaking();
diff --git a/src/core/SurfaceTable.cpp b/src/core/SurfaceTable.cpp
index 7212fc65..08a84cfd 100644
--- a/src/core/SurfaceTable.cpp
+++ b/src/core/SurfaceTable.cpp
@@ -9,7 +9,7 @@
float CSurfaceTable::ms_aAdhesiveLimitTable[NUMADHESIVEGROUPS][NUMADHESIVEGROUPS];
void
-CSurfaceTable::Initialise(char *filename)
+CSurfaceTable::Initialise(Const char *filename)
{
int lineno, fieldno;
char *line;
diff --git a/src/core/SurfaceTable.h b/src/core/SurfaceTable.h
index 4af6a265..12246dce 100644
--- a/src/core/SurfaceTable.h
+++ b/src/core/SurfaceTable.h
@@ -100,7 +100,7 @@ class CSurfaceTable
{
static float ms_aAdhesiveLimitTable[NUMADHESIVEGROUPS][NUMADHESIVEGROUPS];
public:
- static void Initialise(char *filename);
+ static void Initialise(Const char *filename);
static int GetAdhesionGroup(uint8 surfaceType);
static float GetWetMultiplier(uint8 surfaceType);
static float GetAdhesiveLimit(CColPoint &colpoint);
diff --git a/src/core/World.cpp b/src/core/World.cpp
index c884f1ed..c15c134d 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -2205,6 +2205,7 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa
case ENTITY_TYPE_OBJECT:
pObject->ObjectDamage(300.0f * fDamageMultiplier);
break;
+ default: break;
}
}
}
diff --git a/src/core/Zones.cpp b/src/core/Zones.cpp
index 5b7519dc..4f491a49 100644
--- a/src/core/Zones.cpp
+++ b/src/core/Zones.cpp
@@ -357,7 +357,7 @@ CTheZones::FindSmallestZonePositionILN(const CVector *v)
}
int16
-CTheZones::FindZoneByLabelAndReturnIndex(char *name)
+CTheZones::FindZoneByLabelAndReturnIndex(Const char *name)
{
char str[8];
memset(str, 0, 8);
diff --git a/src/core/Zones.h b/src/core/Zones.h
index 67800569..6549dad5 100644
--- a/src/core/Zones.h
+++ b/src/core/Zones.h
@@ -86,7 +86,7 @@ public:
static CZone *FindSmallestZonePosition(const CVector *v);
static CZone *FindSmallestZonePositionType(const CVector *v, eZoneType type);
static CZone *FindSmallestZonePositionILN(const CVector *v);
- static int16 FindZoneByLabelAndReturnIndex(char *name);
+ static int16 FindZoneByLabelAndReturnIndex(Const char *name);
static CZoneInfo *GetZoneInfo(const CVector *v, uint8 day);
static void GetZoneInfoForTimeOfDay(const CVector *pos, CZoneInfo *info);
static void SetZoneCarInfo(uint16 zoneid, uint8 day, int16 carDensity,
diff --git a/src/core/main.cpp b/src/core/main.cpp
index d6af0b2a..1ea8dc7f 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -401,7 +401,7 @@ DestroySplashScreen(void)
splashTxdId = -1;
}
-char*
+Const char*
GetRandomSplashScreen(void)
{
int index;
@@ -424,10 +424,10 @@ GetRandomSplashScreen(void)
return splashName;
}
-char*
+Const char*
GetLevelSplashScreen(int level)
{
- static char *splashScreens[4] = {
+ static Const char *splashScreens[4] = {
nil,
"splash1",
"splash2",
@@ -1278,7 +1278,7 @@ void TheGame(void)
CGame::Initialise("DATA\\GTA3.DAT");
#endif
- char *splash = GetRandomSplashScreen(); // inlined here
+ Const char *splash = GetRandomSplashScreen(); // inlined here
LoadingScreen("Starting Game", NULL, splash);
@@ -1312,7 +1312,7 @@ void TheGame(void)
if (FrontEndMenuManager.m_bWantToLoad)
#endif
{
- char *splash1 = GetLevelSplashScreen(CGame::currLevel);
+ Const char *splash1 = GetLevelSplashScreen(CGame::currLevel);
LoadSplash(splash1);
}
diff --git a/src/core/main.h b/src/core/main.h
index 90b13fbb..32a880d6 100644
--- a/src/core/main.h
+++ b/src/core/main.h
@@ -22,8 +22,8 @@ void LoadingScreen(const char *str1, const char *str2, const char *splashscreen)
void LoadingIslandScreen(const char *levelName);
CSprite2d *LoadSplash(const char *name);
void DestroySplashScreen(void);
-char *GetLevelSplashScreen(int level);
-char *GetRandomSplashScreen(void);
+Const char *GetLevelSplashScreen(int level);
+Const char *GetRandomSplashScreen(void);
void LittleTest(void);
void ValidateVersion();
void ResetLoadingScreenBar(void);