summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-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
9 files changed, 63 insertions, 45 deletions
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index 05a95950..b2bbdb33 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)