summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/control/SceneEdit.cpp3
-rw-r--r--src/core/Cam.cpp4
-rw-r--r--src/core/Camera.cpp2
-rw-r--r--src/core/Camera.h2
-rw-r--r--src/core/FileLoader.cpp2
-rw-r--r--src/core/Game.cpp4
-rw-r--r--src/core/config.h26
-rw-r--r--src/core/main.cpp2
-rw-r--r--src/core/re3.cpp2
-rw-r--r--src/core/templates.h64
-rw-r--r--src/modelinfo/BaseModelInfo.cpp4
-rw-r--r--src/modelinfo/ModelInfo.cpp42
-rw-r--r--src/render/Hud.cpp11
13 files changed, 88 insertions, 80 deletions
diff --git a/src/control/SceneEdit.cpp b/src/control/SceneEdit.cpp
index 21512290..582f7a12 100644
--- a/src/control/SceneEdit.cpp
+++ b/src/control/SceneEdit.cpp
@@ -1,7 +1,7 @@
#include "common.h"
#include "SceneEdit.h"
-
+#ifdef GTA_SCENE_EDIT
#include "Automobile.h"
#include "Camera.h"
#include "CarCtrl.h"
@@ -1098,3 +1098,4 @@ bool CSceneEdit::SelectWeapon(void)
}
return false;
}
+#endif
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index a63954c1..8aecf577 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -287,9 +287,11 @@ CCam::Process(void)
case MODE_FIGHT_CAM_RUNABOUT:
Process_1rstPersonPedOnPC(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
+#ifdef GTA_SCENE_EDIT
case MODE_EDITOR:
Process_Editor(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
+#endif
default:
Source = CVector(0.0f, 0.0f, 0.0f);
Front = CVector(0.0f, 1.0f, 0.0f);
@@ -4033,6 +4035,7 @@ CCam::Process_Debug(const CVector&, float, float, float)
}
#endif
+#ifdef GTA_SCENE_EDIT
void
CCam::Process_Editor(const CVector&, float, float, float)
{
@@ -4111,6 +4114,7 @@ CCam::Process_Editor(const CVector&, float, float, float)
sprintf(str, "Look@: %f, Look@: %f, Look@: %f ", Front.x + Source.x, Front.y + Source.y, Front.z + Source.z);
}
}
+#endif
void
CCam::Process_ModelView(const CVector &CameraTarget, float, float, float)
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index 5d2768de..531c3417 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -1602,8 +1602,10 @@ CCamera::CamControl(void)
switchByJumpCut = true;
}
}
+#ifdef GTA_SCENE_EDIT
if(CSceneEdit::m_bEditOn)
ReqMode = CCam::MODE_EDITOR;
+#endif
if((m_uiTransitionState == 0 || switchByJumpCut) && ReqMode != Cams[ActiveCam].Mode){
if(switchByJumpCut){
diff --git a/src/core/Camera.h b/src/core/Camera.h
index ff74931c..4da7b499 100644
--- a/src/core/Camera.h
+++ b/src/core/Camera.h
@@ -209,7 +209,9 @@ public:
void PrintMode(void);
void Process_Debug(const CVector&, float, float, float);
+#ifdef GTA_SCENE_EDIT
void Process_Editor(const CVector&, float, float, float);
+#endif
void Process_ModelView(const CVector &CameraTarget, float, float, float);
void Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, float, float);
void Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrientation, float, float);
diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp
index 7dd662e2..3f26a023 100644
--- a/src/core/FileLoader.cpp
+++ b/src/core/FileLoader.cpp
@@ -994,7 +994,7 @@ CFileLoader::Load2dEffect(const char *line)
CTxdStore::SetCurrentTxd(CTxdStore::FindTxdSlot("particle"));
mi = CModelInfo::GetModelInfo(id);
- effect = CModelInfo::Get2dEffectStore().alloc();
+ effect = CModelInfo::Get2dEffectStore().Alloc();
mi->Add2dEffect(effect);
effect->pos = CVector(x, y, z);
effect->col = CRGBA(r, g, b, a);
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index 9fbd94f6..06a7bf35 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -427,7 +427,9 @@ bool CGame::Initialise(const char* datFile)
CAntennas::Init();
CGlass::Init();
gPhoneInfo.Initialise();
+#ifdef GTA_SCENE_EDIT
CSceneEdit::Initialise();
+#endif
LoadingScreen("Loading the Game", "Load scripts", nil);
CTheScripts::Init();
CGangs::Initialise();
@@ -781,7 +783,9 @@ void CGame::Process(void)
CSkidmarks::Update();
CAntennas::Update();
CGlass::Update();
+#ifdef GTA_SCENE_EDIT
CSceneEdit::Update();
+#endif
CSetPieces::Update();
CEventList::Update();
CParticle::Update();
diff --git a/src/core/config.h b/src/core/config.h
index d4ea2a19..4bf1cfc8 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -36,7 +36,7 @@ enum Config {
NUMDUMMIES = 2340,
NUMAUDIOSCRIPTOBJECTS = 192,
NUMCOLMODELS = 4400,
- NUMCUTSCENEOBJECTS = 50, // does not exist in VC
+ NUMCUTSCENEOBJECTS = 50, // not a pool in VC
NUMANIMBLOCKS = 35,
NUMANIMATIONS = 450,
@@ -146,10 +146,6 @@ enum Config {
NUM_SHORTCUT_START_POINTS = 16
};
-// We'll use this once we're ready to become independent of the game
-// Use it to mark bugs in the code that will prevent the game from working then
-//#define STANDALONE
-
// We don't expect to compile for PS2 or Xbox
// but it might be interesting for documentation purposes
#define GTA_PC
@@ -176,6 +172,19 @@ enum Config {
#define FINAL
#endif
+// Version defines
+#define GTAVC_PS2 400
+#define GTAVC_PC_10 410
+#define GTAVC_PC_11 411
+#define GTAVC_PC_JAP 412
+// TODO? maybe something for xbox or android?
+
+#define GTA_VERSION GTAVC_PC_11
+
+// TODO(MIAMI): someone ought to find and check out uses of these defines:
+//#define GTA3_STEAM_PATCH
+//#define GTAVC_JP_PATCH
+
// quality of life fixes that should also be in FINAL
#define NASTY_GAME // nasty game for all languages
#define NO_CDCHECK
@@ -188,14 +197,13 @@ enum Config {
# define RANDOMSPLASH
# define VU_COLLISION
#elif defined GTA_PC
-//# define GTA3_STEAM_PATCH
-//# define GTAVC_JP_PATCH
# ifdef GTA_PS2_STUFF
# define USE_PS2_RAND
# define RANDOMSPLASH // use random splash as on PS2
# define PS2_MATFX
# endif
# define GTA_REPLAY
+# define GTA_SCENE_EDIT
#elif defined GTA_XBOX
#endif
@@ -259,8 +267,6 @@ enum Config {
#endif
// Water & Particle
-#define PC_PARTICLE
-//#define PS2_ALTERNATIVE_CARSPLASH // unused on PS2
// #define PC_WATER
#define WATER_CHEATS
@@ -283,7 +289,6 @@ enum Config {
//#define BIND_VEHICLE_FIREWEAPON // Adds ability to rebind fire key for 'in vehicle' controls
// Hud, frontend and radar
-//#define BETA_SLIDING_TEXT
#define PC_MENU
#ifndef PC_MENU
@@ -362,5 +367,4 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
#ifdef SQUEEZE_PERFORMANCE
#undef PS2_ALPHA_TEST
#undef NO_ISLAND_LOADING
- #define PC_PARTICLE
#endif
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 2c3c83f9..64b763a4 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -1108,9 +1108,11 @@ Render2dStuff(void)
MusicManager.DisplayRadioStationName();
TheConsole.Display();
+#ifdef GTA_SCENE_EDIT
if(CSceneEdit::m_bEditOn)
CSceneEdit::Draw();
else
+#endif
CHud::Draw();
CSpecialFX::Render2DFXs();
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 3a03461a..3129ae97 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -649,7 +649,9 @@ extern bool gbRenderWorld2;
DebugMenuAddVarBool8("Render", "Don't Render Water", &gbDontRenderWater, nil);
DebugMenuAddVarBool8("Debug", "pad 1 -> pad 2", &CPad::m_bMapPadOneToPadTwo, nil);
+#ifdef GTA_SCENE_EDIT
DebugMenuAddVarBool8("Debug", "Edit on", &CSceneEdit::m_bEditOn, nil);
+#endif
#ifdef MAP_ENHANCEMENTS
DebugMenuAddCmd("Debug", "Teleport to map waypoint", TeleportToWaypoint);
#endif
diff --git a/src/core/templates.h b/src/core/templates.h
index 43c8d8fc..4cab7e60 100644
--- a/src/core/templates.h
+++ b/src/core/templates.h
@@ -4,28 +4,28 @@ template<typename T, int n>
class CStore
{
public:
- int allocPtr;
+ int32 allocPtr;
T store[n];
- T *alloc(void){
- if(this->allocPtr >= n){
+ T *Alloc(void){
+ if(allocPtr >= n){
printf("Size of this thing:%d needs increasing\n", n);
assert(0);
}
- return &this->store[this->allocPtr++];
+ return &store[allocPtr++];
}
- void clear(void){
- this->allocPtr = 0;
+ void Clear(void){
+ allocPtr = 0;
}
- int getIndex(T *item){
- assert(item >= &this->store[0]);
- assert(item < &this->store[n]);
- return item - this->store;
+ int32 GetIndex(T *item){
+ assert(item >= &store[0]);
+ assert(item < &store[n]);
+ return item - store;
}
- T *getItem(int index){
+ T *GetItem(int32 index){
assert(index >= 0);
assert(index < n);
- return &this->store[index];
+ return &store[index];
}
};
@@ -40,15 +40,13 @@ class CPool
};
uint8 u;
} *m_flags;
- int m_size;
- int m_allocPtr;
+ int32 m_size;
+ int32 m_allocPtr;
public:
- // TODO(MIAMI): remove ctor without name argument
- CPool(int size, const char *name){
- // TODO: use new here
- m_entries = (U*)malloc(sizeof(U)*size);
- m_flags = (Flags*)malloc(sizeof(Flags)*size);
+ CPool(int32 size, const char *name){
+ m_entries = (U*)new uint8[sizeof(U)*size];
+ m_flags = (Flags*)new uint8[sizeof(Flags)*size];
m_size = size;
m_allocPtr = -1;
for(int i = 0; i < size; i++){
@@ -61,15 +59,15 @@ public:
}
void Flush() {
if (m_size > 0) {
- free(m_entries);
- free(m_flags);
+ delete[] (uint8*)m_entries;
+ delete[] (uint8*)m_flags;
m_entries = nil;
m_flags = nil;
m_size = 0;
m_allocPtr = 0;
}
}
- int GetSize(void) const { return m_size; }
+ int32 GetSize(void) const { return m_size; }
T *New(void){
bool wrapped = false;
do
@@ -93,12 +91,12 @@ public:
m_flags[m_allocPtr].id++;
return (T*)&m_entries[m_allocPtr];
}
- T *New(int handle){
+ T *New(int32 handle){
T *entry = (T*)&m_entries[handle>>8];
SetNotFreeAt(handle);
return entry;
}
- void SetNotFreeAt(int handle){
+ void SetNotFreeAt(int32 handle){
int idx = handle>>8;
m_flags[idx].free = 0;
m_flags[idx].id = handle & 0x7F;
@@ -123,22 +121,22 @@ public:
return m_flags[handle>>8].u == (handle & 0xFF) ?
(T*)&m_entries[handle >> 8] : nil;
}
- int GetIndex(T* entry) {
+ int32 GetIndex(T* entry) {
int i = GetJustIndex_NoFreeAssert(entry);
return m_flags[i].u + (i << 8);
}
- int GetJustIndex(T* entry) {
+ int32 GetJustIndex(T* entry) {
int index = GetJustIndex_NoFreeAssert(entry);
assert((U*)entry == (U*)&m_entries[index]); // cast is unsafe - check required
assert(!IsFreeSlot(index));
return index;
}
- int GetJustIndex_NoFreeAssert(T* entry) {
+ int32 GetJustIndex_NoFreeAssert(T* entry) {
int index = ((U*)entry - m_entries);
// Please don't add unsafe assert here, because at least one func. use this to check if entity is ped or vehicle.
return index;
}
- int GetNoOfUsedSpaces(void) const {
+ int32 GetNoOfUsedSpaces(void) const {
int i;
int n = 0;
for(i = 0; i < m_size; i++)
@@ -148,8 +146,8 @@ public:
}
bool IsFreeSlot(int i) { return !!m_flags[i].free; }
void ClearStorage(uint8 *&flags, U *&entries){
- free(flags);
- free(entries);
+ delete[] (uint8*)flags;
+ delete[] (uint8*)entries;
flags = nil;
entries = nil;
}
@@ -163,8 +161,8 @@ public:
debug("CopyBack:%d (/%d)\n", GetNoOfUsedSpaces(), m_size); /* Assumed inlining */
}
void Store(uint8 *&flags, U *&entries){
- flags = (uint8*)malloc(sizeof(uint8)*m_size);
- entries = (U*)malloc(sizeof(U)*m_size);
+ flags = (uint8*)new uint8[sizeof(uint8)*m_size];
+ entries = (U*)new uint8[sizeof(U)*m_size];
memcpy(flags, m_flags, sizeof(uint8)*m_size);
memcpy(entries, m_entries, sizeof(U)*m_size);
debug("Stored:%d (/%d)\n", GetNoOfUsedSpaces(), m_size); /* Assumed inlining */
@@ -243,7 +241,7 @@ public:
link->Remove(); // remove from list
freeHead.Insert(link); // insert into free list
}
- int Count(void){
+ int32 Count(void){
int n = 0;
CLink<T> *lnk;
for(lnk = head.next; lnk != &tail; lnk = lnk->next)
diff --git a/src/modelinfo/BaseModelInfo.cpp b/src/modelinfo/BaseModelInfo.cpp
index 31bb2500..f05be242 100644
--- a/src/modelinfo/BaseModelInfo.cpp
+++ b/src/modelinfo/BaseModelInfo.cpp
@@ -88,7 +88,7 @@ CBaseModelInfo::Add2dEffect(C2dEffect *fx)
if(m_2dEffectsID >= 0)
m_num2dEffects++;
else{
- m_2dEffectsID = CModelInfo::Get2dEffectStore().getIndex(fx);
+ m_2dEffectsID = CModelInfo::Get2dEffectStore().GetIndex(fx);
m_num2dEffects = 1;
}
}
@@ -97,7 +97,7 @@ C2dEffect*
CBaseModelInfo::Get2dEffect(int n)
{
if(m_2dEffectsID >= 0)
- return CModelInfo::Get2dEffectStore().getItem(m_2dEffectsID+n);
+ return CModelInfo::Get2dEffectStore().GetItem(m_2dEffectsID+n);
else
return nil;
}
diff --git a/src/modelinfo/ModelInfo.cpp b/src/modelinfo/ModelInfo.cpp
index 961efa84..9e5b0470 100644
--- a/src/modelinfo/ModelInfo.cpp
+++ b/src/modelinfo/ModelInfo.cpp
@@ -33,13 +33,13 @@ CModelInfo::Initialise(void)
for(i = 0; i < MODELINFOSIZE; i++)
ms_modelInfoPtrs[i] = nil;
- ms_2dEffectStore.clear();
- ms_simpleModelStore.clear();
- ms_timeModelStore.clear();
- ms_weaponModelStore.clear();
- ms_clumpModelStore.clear();
- ms_pedModelStore.clear();
- ms_vehicleModelStore.clear();
+ ms_2dEffectStore.Clear();
+ ms_simpleModelStore.Clear();
+ ms_timeModelStore.Clear();
+ ms_weaponModelStore.Clear();
+ ms_clumpModelStore.Clear();
+ ms_pedModelStore.Clear();
+ ms_vehicleModelStore.Clear();
m = AddSimpleModel(MI_CAR_DOOR);
m->SetColModel(&CTempColModels::ms_colModelDoor1);
@@ -109,20 +109,20 @@ CModelInfo::ShutDown(void)
for(i = 0; i < ms_2dEffectStore.allocPtr; i++)
ms_2dEffectStore.store[i].Shutdown();
- ms_2dEffectStore.clear();
- ms_simpleModelStore.clear();
- ms_timeModelStore.clear();
- ms_weaponModelStore.clear();
- ms_pedModelStore.clear();
- ms_clumpModelStore.clear();
- ms_vehicleModelStore.clear();
+ ms_2dEffectStore.Clear();
+ ms_simpleModelStore.Clear();
+ ms_timeModelStore.Clear();
+ ms_weaponModelStore.Clear();
+ ms_pedModelStore.Clear();
+ ms_clumpModelStore.Clear();
+ ms_vehicleModelStore.Clear();
}
CSimpleModelInfo*
CModelInfo::AddSimpleModel(int id)
{
CSimpleModelInfo *modelinfo;
- modelinfo = CModelInfo::ms_simpleModelStore.alloc();
+ modelinfo = CModelInfo::ms_simpleModelStore.Alloc();
CModelInfo::ms_modelInfoPtrs[id] = modelinfo;
modelinfo->Init();
return modelinfo;
@@ -132,7 +132,7 @@ CTimeModelInfo*
CModelInfo::AddTimeModel(int id)
{
CTimeModelInfo *modelinfo;
- modelinfo = CModelInfo::ms_timeModelStore.alloc();
+ modelinfo = CModelInfo::ms_timeModelStore.Alloc();
CModelInfo::ms_modelInfoPtrs[id] = modelinfo;
modelinfo->Init();
return modelinfo;
@@ -142,7 +142,7 @@ CWeaponModelInfo*
CModelInfo::AddWeaponModel(int id)
{
CWeaponModelInfo *modelinfo;
- modelinfo = CModelInfo::ms_weaponModelStore.alloc();
+ modelinfo = CModelInfo::ms_weaponModelStore.Alloc();
CModelInfo::ms_modelInfoPtrs[id] = modelinfo;
modelinfo->Init();
return modelinfo;
@@ -152,7 +152,7 @@ CClumpModelInfo*
CModelInfo::AddClumpModel(int id)
{
CClumpModelInfo *modelinfo;
- modelinfo = CModelInfo::ms_clumpModelStore.alloc();
+ modelinfo = CModelInfo::ms_clumpModelStore.Alloc();
CModelInfo::ms_modelInfoPtrs[id] = modelinfo;
modelinfo->m_clump = nil;
return modelinfo;
@@ -162,7 +162,7 @@ CPedModelInfo*
CModelInfo::AddPedModel(int id)
{
CPedModelInfo *modelinfo;
- modelinfo = CModelInfo::ms_pedModelStore.alloc();
+ modelinfo = CModelInfo::ms_pedModelStore.Alloc();
CModelInfo::ms_modelInfoPtrs[id] = modelinfo;
modelinfo->m_clump = nil;
return modelinfo;
@@ -172,7 +172,7 @@ CVehicleModelInfo*
CModelInfo::AddVehicleModel(int id)
{
CVehicleModelInfo *modelinfo;
- modelinfo = CModelInfo::ms_vehicleModelStore.alloc();
+ modelinfo = CModelInfo::ms_vehicleModelStore.Alloc();
CModelInfo::ms_modelInfoPtrs[id] = modelinfo;
modelinfo->m_clump = nil;
modelinfo->m_vehicleType = -1;
@@ -251,7 +251,7 @@ CModelInfo::IsPlaneModel(int32 id)
void
CModelInfo::ReInit2dEffects()
{
- ms_2dEffectStore.clear();
+ ms_2dEffectStore.Clear();
for (int i = 0; i < MODELINFOSIZE; i++) {
if (ms_modelInfoPtrs[i])
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 239d0de4..db952191 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -1558,15 +1558,8 @@ void CHud::DrawAfterFade()
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
-#ifdef BETA_SLIDING_TEXT
-
- CFont::SetColor(ODDJOB2_COLOR);
- CFont::PrintString(SCREEN_WIDTH / 2 - SCREEN_SCALE_X(OddJob2XOffset), SCREEN_SCALE_Y(217.0f), m_BigMessage[5]);
-#else
-
CFont::SetColor(ODDJOB2_COLOR);
CFont::PrintString(SCREEN_WIDTH / 2, SCREEN_SCALE_Y(217.0f), m_BigMessage[5]);
-#endif
}
}
@@ -1615,11 +1608,7 @@ void CHud::DrawAfterFade()
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, BigMessageAlpha[1]));
CFont::SetColor(CRGBA(MISSIONTITLE_COLOR.r, MISSIONTITLE_COLOR.g, MISSIONTITLE_COLOR.b, BigMessageAlpha[1]));
-#ifdef BETA_SLIDING_TEXT
CFont::PrintString(BigMessageX[1], SCREEN_SCALE_FROM_BOTTOM(140.0f), m_BigMessage[1]);
-#else
- CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(140.0f), m_BigMessage[1]);
-#endif
} else {
m_ZoneFadeTimer = 0;
BigMessageX[1] = SCREEN_SCALE_FROM_RIGHT(DEFAULT_SCREEN_WIDTH + 60.0f);