summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/AnimViewer.cpp2
-rw-r--r--src/core/Cam.cpp4
-rw-r--r--src/core/CdStream.cpp11
-rw-r--r--src/core/ControllerConfig.cpp9
-rw-r--r--src/core/FileLoader.cpp43
-rw-r--r--src/core/Frontend.cpp2
-rw-r--r--src/core/Game.cpp5
-rw-r--r--src/core/General.h2
-rw-r--r--src/core/Leeds.cpp14
-rw-r--r--src/core/Leeds.h36
-rw-r--r--src/core/Placeable.h2
-rw-r--r--src/core/Radar.cpp11
-rw-r--r--src/core/Ropes.cpp4
-rw-r--r--src/core/Stats.h2
-rw-r--r--src/core/common.h68
-rw-r--r--src/core/config.h87
-rw-r--r--src/core/main.cpp24
-rw-r--r--src/core/main.h3
-rw-r--r--src/core/re3.cpp18
19 files changed, 297 insertions, 50 deletions
diff --git a/src/core/AnimViewer.cpp b/src/core/AnimViewer.cpp
index 854ec7d4..1a7facc1 100644
--- a/src/core/AnimViewer.cpp
+++ b/src/core/AnimViewer.cpp
@@ -81,7 +81,7 @@ CAnimViewer::Initialise(void) {
CCollision::Init();
CWorld::Initialise();
mod_HandlingManager.Initialise();
- CTempColModels::Initialise();
+ gpTempColModels->Initialise();
CAnimManager::Initialise();
CModelInfo::Initialise();
CParticle::Initialise();
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index 753254e0..4895ef6e 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -951,7 +951,7 @@ CVector
CCam::DoAverageOnVector(const CVector &vec)
{
int i;
- CVector Average = { 0.0f, 0.0f, 0.0f };
+ CVector Average = CVector(0.0f, 0.0f, 0.0f);
if(ResetStatics){
m_iRunningVectorArrayPos = 0;
@@ -4033,7 +4033,7 @@ CCam::Process_Debug(const CVector&, float, float, float)
if(CPad::GetPad(1)->GetLeftShockJustDown() && gbBigWhiteDebugLightSwitchedOn)
CShadows::StoreShadowToBeRendered(SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &Source,
12.0f, 0.0f, 0.0f, -12.0f,
- 128, 128, 128, 128, 1000.0f, false, 1.0f);
+ 128, 128, 128, 128, 1000.0f, false, 1.0f, nil, 1.0f);
if(CHud::m_Wants_To_Draw_Hud){
char str[256];
diff --git a/src/core/CdStream.cpp b/src/core/CdStream.cpp
index 4bb31ea4..da85a238 100644
--- a/src/core/CdStream.cpp
+++ b/src/core/CdStream.cpp
@@ -7,9 +7,6 @@
#include "RwHelper.h"
#include "MemoryMgr.h"
-#define CDDEBUG(f, ...) debug ("%s: " f "\n", "cdvd_stream", ## __VA_ARGS__)
-#define CDTRACE(f, ...) printf("%s: " f "\n", "cdvd_stream", ## __VA_ARGS__)
-
struct CdReadInfo
{
uint32 nSectorOffset;
@@ -60,7 +57,7 @@ CdStreamInitThread(void)
if ( gpReadInfo[i].hSemaphore == nil )
{
- CDTRACE("failed to create sync semaphore");
+ printf("%s: failed to create sync semaphore\n", "cdvd_stream");
ASSERT(0);
return;
}
@@ -81,7 +78,7 @@ CdStreamInitThread(void)
if ( gCdStreamSema == nil )
{
- CDTRACE("failed to create stream semaphore");
+ printf("%s: failed to create stream semaphore\n", "cdvd_stream");
ASSERT(0);
return;
}
@@ -90,7 +87,7 @@ CdStreamInitThread(void)
if ( _gCdStreamThread == nil )
{
- CDTRACE("failed to create streaming thread");
+ printf("%s: failed to create streaming thread\n", "cdvd_stream");
ASSERT(0);
return;
}
@@ -138,7 +135,7 @@ CdStreamInit(int32 numChannels)
gpReadInfo = (CdReadInfo *)LocalAlloc(LMEM_ZEROINIT, sizeof(CdReadInfo) * numChannels);
ASSERT( gpReadInfo != nil );
- CDDEBUG("read info %p", gpReadInfo);
+ debug("%s: read info %p\n", "cdvd_stream", gpReadInfo);
CdStreamAddImage("MODELS\\GTA3.IMG");
diff --git a/src/core/ControllerConfig.cpp b/src/core/ControllerConfig.cpp
index fcc4503a..23e86a79 100644
--- a/src/core/ControllerConfig.cpp
+++ b/src/core/ControllerConfig.cpp
@@ -541,7 +541,7 @@ void CControllerConfigManager::UpdateJoyInConfigMenus_ButtonDown(int32 button, i
break;
case 12:
#ifndef REGISTER_START_BUTTON
- if (padNumber == 1)
+ if (padnumber == 1)
#endif
pad->PCTempJoyState.Start = 255;
break;
@@ -2755,9 +2755,10 @@ wchar *CControllerConfigManager::GetButtonComboText(e_ControllerAction action)
void CControllerConfigManager::SetControllerKeyAssociatedWithAction(e_ControllerAction action, int32 key, eControllerType type)
{
ResetSettingOrder(action);
+ int numOfSettings = GetNumOfSettingsForAction(action);
m_aSettings[action][type].m_Key = key;
- m_aSettings[action][type].m_ContSetOrder = GetNumOfSettingsForAction(action) + 1;
+ m_aSettings[action][type].m_ContSetOrder = numOfSettings + 1;
}
int32 CControllerConfigManager::GetMouseButtonAssociatedWithAction(e_ControllerAction action)
@@ -2767,8 +2768,10 @@ int32 CControllerConfigManager::GetMouseButtonAssociatedWithAction(e_ControllerA
void CControllerConfigManager::SetMouseButtonAssociatedWithAction(e_ControllerAction action, int32 button)
{
+ int numOfSettings = GetNumOfSettingsForAction(action);
+
m_aSettings[action][MOUSE].m_Key = button;
- m_aSettings[action][MOUSE].m_ContSetOrder = GetNumOfSettingsForAction(action) + 1;
+ m_aSettings[action][MOUSE].m_ContSetOrder = numOfSettings + 1;
}
void CControllerConfigManager::ResetSettingOrder(e_ControllerAction action)
diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp
index c13252f6..2818007b 100644
--- a/src/core/FileLoader.cpp
+++ b/src/core/FileLoader.cpp
@@ -607,11 +607,14 @@ CFileLoader::LoadObjectTypes(const char *filename)
int section;
int pathIndex;
int id, pathType;
- int minID, maxID;
+ //int minID, maxID;
+
+ for(int i = 0; i < ARRAY_SIZE(m_sTempIdeData); i++)
+ m_sTempIdeData[i].id = -1;
section = NONE;
- minID = INT32_MAX;
- maxID = -1;
+ //minID = INT32_MAX;
+ //maxID = -1;
pathIndex = -1;
debug("Loading object types from %s...\n", filename);
@@ -635,13 +638,13 @@ CFileLoader::LoadObjectTypes(const char *filename)
}else switch(section){
case OBJS:
id = LoadObject(line);
- if(id > maxID) maxID = id;
- if(id < minID) minID = id;
+ //if(id > maxID) maxID = id;
+ //if(id < minID) minID = id;
break;
case TOBJ:
id = LoadTimeObject(line);
- if(id > maxID) maxID = id;
- if(id < minID) minID = id;
+ //if(id > maxID) maxID = id;
+ //if(id < minID) minID = id;
break;
case WEAP:
LoadWeaponObject(line);
@@ -678,10 +681,10 @@ CFileLoader::LoadObjectTypes(const char *filename)
}
CFileMgr::CloseFile(fd);
- for(id = minID; id <= maxID; id++){
+ for(id = 0; id < MODELINFOSIZE; id++){
CSimpleModelInfo *mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(id);
if(mi && mi->IsBuilding())
- mi->SetupBigBuilding(minID, maxID);
+ mi->SetupBigBuilding();
}
}
@@ -714,6 +717,13 @@ CFileLoader::LoadObject(const char *line)
if(sscanf(line, "%d %s %s %d", &id, model, txd, &numObjs) != 4)
return 0; // game returns return value
+ for(int i = 0; i < ARRAY_SIZE(m_sTempIdeData); i++)
+ if(m_sTempIdeData[i].id == -1){
+ m_sTempIdeData[i].id = id;
+ strcpy(m_sTempIdeData[i].name, model);
+ break;
+ }
+
switch(numObjs){
case 1:
sscanf(line, "%d %s %s %d %f %d",
@@ -762,6 +772,13 @@ CFileLoader::LoadTimeObject(const char *line)
if(sscanf(line, "%d %s %s %d", &id, model, txd, &numObjs) != 4)
return 0; // game returns return value
+ for(int i = 0; i < ARRAY_SIZE(m_sTempIdeData); i++)
+ if(m_sTempIdeData[i].id < 0){
+ m_sTempIdeData[i].id = id;
+ strcpy(m_sTempIdeData[i].name, model);
+ break;
+ }
+
switch(numObjs){
case 1:
sscanf(line, "%d %s %s %d %f %d %d %d",
@@ -792,7 +809,7 @@ CFileLoader::LoadTimeObject(const char *line)
mi->m_firstDamaged = damaged;
mi->SetTimes(timeOn, timeOff);
mi->SetTexDictionary(txd);
- other = mi->FindOtherTimeModel();
+ other = mi->FindOtherTimeModel(model);
if(other)
other->SetOtherTimeModel(id);
MatchModelString(model, id);
@@ -816,7 +833,7 @@ CFileLoader::LoadWeaponObject(const char *line)
mi->m_lodDistances[0] = dist;
mi->SetTexDictionary(txd);
mi->SetAnimFile(animFile);
- mi->SetColModel(&CTempColModels::ms_colModelWeapon);
+ mi->SetColModel(&gpTempColModels->ms_colModelWeapon);
MatchModelString(model, id);
return id;
}
@@ -832,7 +849,7 @@ CFileLoader::LoadClumpObject(const char *line)
mi = CModelInfo::AddClumpModel(id);
mi->SetModelName(model);
mi->SetTexDictionary(txd);
- mi->SetColModel(&CTempColModels::ms_colModelBBox);
+ mi->SetColModel(&gpTempColModels->ms_colModelBBox);
}
}
@@ -939,7 +956,7 @@ CFileLoader::LoadPedObject(const char *line)
mi->SetModelName(model);
mi->SetTexDictionary(txd);
mi->SetAnimFile(animFile);
- mi->SetColModel(&CTempColModels::ms_colModelPed1);
+ mi->SetColModel(&gpTempColModels->ms_colModelPed1);
mi->m_pedType = CPedType::FindPedType(pedType);
mi->m_pedStatType = CPedStats::GetPedStatType(pedStats);
for(animGroupId = 0; animGroupId < NUM_ANIM_ASSOC_GROUPS; animGroupId++)
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 3a2d3b59..df00efde 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -1000,7 +1000,9 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
}
wchar unicodeTemp[64];
+#ifdef ASPECT_RATIO_SCALE
char asciiTemp[32];
+#endif
bool weHaveLabel = aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL;
uint8 section = 0; // 0: highlight trapezoid 1: texts
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index e0becc43..b5b4b90d 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -316,7 +316,7 @@ bool CGame::InitialiseOnceAfterRW(void)
{
TheText.Load();
CTimer::Initialise();
- CTempColModels::Initialise();
+ gpTempColModels->Initialise();
mod_HandlingManager.Initialise();
CSurfaceTable::Initialise("DATA\\SURFACE.DAT");
CPedStats::Initialise();
@@ -366,6 +366,9 @@ bool CGame::Initialise(const char* datFile)
CPools::Initialise();
+ if(gMakeResources)
+ CVehicleModelInfo::Load(nil);
+
#ifndef GTA_PS2
CIniFile::LoadIniFile();
#endif
diff --git a/src/core/General.h b/src/core/General.h
index 1ea7f2bd..2f205c39 100644
--- a/src/core/General.h
+++ b/src/core/General.h
@@ -133,7 +133,7 @@ public:
static bool faststricmp(const char *str1, const char *str2)
{
for (; *str1; str1++, str2++) {
-#if MUCH_SLOWER || !defined _WIN32 || defined __MINGW32__
+#ifndef ASCII_STRCMP
if (toupper(*str1) != toupper(*str2))
#else
if (__ascii_toupper(*str1) != __ascii_toupper(*str2))
diff --git a/src/core/Leeds.cpp b/src/core/Leeds.cpp
new file mode 100644
index 00000000..cda50605
--- /dev/null
+++ b/src/core/Leeds.cpp
@@ -0,0 +1,14 @@
+#include "common.h"
+#include "Leeds.h"
+
+void LoadResource(RpAtomic *atomic) {}
+void LoadResource(RpClump *clump) {}
+
+
+void SaveResource(RwTexture *tex, base::cRelocatableChunkWriter &writer) {}
+void SaveResource(RwTexDictionary *txd, base::cRelocatableChunkWriter &writer) {}
+void SaveResource(RpMaterial *mat, base::cRelocatableChunkWriter &writer) {}
+void SaveResource(RpMaterialList *matlist, base::cRelocatableChunkWriter &writer) {}
+void SaveResource(RpGeometry *geo, base::cRelocatableChunkWriter &writer) {}
+void SaveResource(RpAtomic *atomic, base::cRelocatableChunkWriter &writer) {}
+void SaveResource(RpClump *clump, base::cRelocatableChunkWriter &writer) {}
diff --git a/src/core/Leeds.h b/src/core/Leeds.h
new file mode 100644
index 00000000..bf71d7e0
--- /dev/null
+++ b/src/core/Leeds.h
@@ -0,0 +1,36 @@
+#pragma once
+
+/*
+PatchElementModelInfo(RslElement *,void *)
+ChunkName(char const*)
+DestroyAndFreeResourceImage(void)
+WriteOrder(char const*)
+UnpatchTextures(void)
+IsChunked(int)
+SaveResourceImage(void)
+LoadResourceImage(void)
+SaveResource(RslNode *,base::cRelocatableChunkWriter &)
+SaveResource(RslTAnimTree *,base::cRelocatableChunkWriter &)
+SaveResource(RslSkin *,base::cRelocatableChunkWriter &)
+SaveResource(CAnimBlendTree *,base::cRelocatableChunkWriter &)
+PatchElementTextures(RslElement *)
+PatchElementGroupTextures(RslElementGroup *)
+*/
+
+void LoadResource(RpAtomic *atomic);
+void LoadResource(RpClump *clump);
+
+/*
+cRelocatableChunkWriterGTA::Save(char const*,uint,uint,bool)
+cRelocatableChunkGTA::cRelocatableChunkGTA(char const*,uint,uint,bool)
+SaveAnimBlock(int)
+SaveModel(int,bool)
+*/
+
+void SaveResource(RwTexture *tex, base::cRelocatableChunkWriter &writer);
+void SaveResource(RwTexDictionary *txd, base::cRelocatableChunkWriter &writer);
+void SaveResource(RpMaterial *mat, base::cRelocatableChunkWriter &writer);
+void SaveResource(RpMaterialList *matlist, base::cRelocatableChunkWriter &writer);
+void SaveResource(RpGeometry *geo, base::cRelocatableChunkWriter &writer);
+void SaveResource(RpAtomic *atomic, base::cRelocatableChunkWriter &writer);
+void SaveResource(RpClump *clump, base::cRelocatableChunkWriter &writer);
diff --git a/src/core/Placeable.h b/src/core/Placeable.h
index 22f7583c..b0f9a15a 100644
--- a/src/core/Placeable.h
+++ b/src/core/Placeable.h
@@ -4,7 +4,7 @@ class CPlaceable
{
public:
// disable allocation
- static void *operator new(size_t) = delete;
+ static void *operator new(size_t);
CMatrix m_matrix;
diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp
index 96095d4f..f1bc1655 100644
--- a/src/core/Radar.cpp
+++ b/src/core/Radar.cpp
@@ -1,3 +1,6 @@
+#if (!defined(GTA_PS2_STUFF) && defined(RWLIBS)) || defined(__MWERKS__)
+#define WITHD3D
+#endif
#include "config.h"
#include "common.h"
@@ -387,10 +390,10 @@ void CRadar::ClearBlipForEntity(eBlipType type, int32 id)
int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect)
{
CVector2D corners[4] = {
- { 1.0f, -1.0f }, // top right
- { 1.0f, 1.0f }, // bottom right
- { -1.0f, 1.0f }, // bottom left
- { -1.0f, -1.0f }, // top left
+ CVector2D( 1.0f, -1.0f ), // top right
+ CVector2D( 1.0f, 1.0f ), // bottom right
+ CVector2D( -1.0f, 1.0f ), // bottom left
+ CVector2D( -1.0f, -1.0f ), // top left
};
CVector2D tmp;
int i, j, n;
diff --git a/src/core/Ropes.cpp b/src/core/Ropes.cpp
index dbae9ee3..ffce36f9 100644
--- a/src/core/Ropes.cpp
+++ b/src/core/Ropes.cpp
@@ -116,7 +116,7 @@ CRopes::RegisterRope(uintptr id, CVector pos, bool setUpdateTimer)
aRopes[i].m_unk = false;
aRopes[i].m_bWasRegistered = true;
aRopes[i].m_updateTimer = setUpdateTimer ? CTimer::GetTimeInMilliseconds() + 20000 : 0;
- for(j = 1; j < ARRAY_SIZE(CRope::m_pos); j++){
+ for(j = 1; j < ARRAY_SIZE(aRopes[0].m_pos); j++){
if(j & 1)
aRopes[i].m_pos[j] = aRopes[i].m_pos[j-1] + CVector(0.0f, 0.0f, 0.625f);
else
@@ -147,7 +147,7 @@ CRopes::FindCoorsAlongRope(uintptr id, float t, CVector *coors)
float f;
for(i = 0; i < ARRAY_SIZE(aRopes); i++)
if(aRopes[i].m_bActive && aRopes[i].m_id == id){
- t = (ARRAY_SIZE(CRope::m_pos)-1)*clamp(t, 0.0f, 0.999f);
+ t = (ARRAY_SIZE(aRopes[0].m_pos)-1)*clamp(t, 0.0f, 0.999f);
j = t;
f = t - j;
*coors = (1.0f-f)*aRopes[i].m_pos[j] + f*aRopes[i].m_pos[j+1];
diff --git a/src/core/Stats.h b/src/core/Stats.h
index 7fa69396..243ff0ec 100644
--- a/src/core/Stats.h
+++ b/src/core/Stats.h
@@ -21,7 +21,7 @@ public:
static int32 NumberKillFrenziesPassed;
static int32 PeopleKilledByOthers;
static int32 HelisDestroyed;
- static int32 PedsKilledOfThisType[ePedType::NUM_PEDTYPES];
+ static int32 PedsKilledOfThisType[NUM_PEDTYPES];
static int32 TimesDied;
static int32 TimesArrested;
static int32 KillsSinceLastCheckpoint;
diff --git a/src/core/common.h b/src/core/common.h
index e1d64523..65f43aae 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -7,10 +7,19 @@
#pragma warning(disable: 4838) // narrowing conversion
#pragma warning(disable: 4996) // POSIX names
+#ifdef __MWERKS__
+#define __STDC_LIMIT_MACROS // so we get UINT32_MAX etc
+#endif
+
#include <stdint.h>
#include <string.h>
#include <math.h>
+#ifdef __MWERKS__
+#define AUDIO_MSS
+#define RWLIBS // codewarrior doesn't support project level defines - so not even this is enough, but still catches most ifdefs
+#endif
+
#if !defined RW_D3D9 && defined LIBRW
#undef WITHD3D
#undef WITHDINPUT
@@ -29,9 +38,9 @@
#define WITH_D3D // librw includes d3d9 itself via this right now
#else
#ifndef USE_D3D9
- #include <d3d8types.h>
+ #include <d3d8.h>
#else
- #include <d3d9types.h>
+ #include <d3d9.h>
#endif
#endif
#endif
@@ -79,8 +88,13 @@ typedef uint8_t uint8;
typedef int8_t int8;
typedef uint16_t uint16;
typedef int16_t int16;
+#ifndef __MWERKS__
typedef uint32_t uint32;
typedef int32_t int32;
+#else
+typedef unsigned int uint32;
+typedef int int32;
+#endif
typedef uintptr_t uintptr;
typedef intptr_t intptr;
typedef uint64_t uint64;
@@ -92,7 +106,7 @@ typedef uint8 bool8;
typedef uint16 bool16;
typedef uint32 bool32;
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined (__MWERKS__)
typedef ptrdiff_t ssize_t;
#endif
@@ -204,11 +218,11 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
#define PSP_DEFAULT_SCREEN_WIDTH (480)
#define PSP_DEFAULT_SCREEN_HEIGHT (272)
-#define PSP_SCALE_TO_PS2_X(a) (a * ((float)DEFAULT_SCREEN_WIDTH / PSP_DEFAULT_SCREEN_WIDTH))
-#define PSP_SCALE_TO_PS2_Y(a) (a * ((float)DEFAULT_SCREEN_HEIGHT / PSP_DEFAULT_SCREEN_HEIGHT))
+#define PSP_SCALE_TO_PS2_X(a) ((float)a * ((float)DEFAULT_SCREEN_WIDTH / (float)PSP_DEFAULT_SCREEN_WIDTH))
+#define PSP_SCALE_TO_PS2_Y(a) ((float)a * ((float)DEFAULT_SCREEN_HEIGHT / (float)PSP_DEFAULT_SCREEN_HEIGHT))
-#define PSP_SCREEN_SCALE_X(a) SCREEN_STRETCH_X(PSP_SCALE_TO_PS2_X(a))
-#define PSP_SCREEN_SCALE_Y(a) SCREEN_STRETCH_Y(PSP_SCALE_TO_PS2_Y(a))
+#define PSP_SCREEN_SCALE_X(a) ((a) * (float) SCREEN_WIDTH / PSP_DEFAULT_SCREEN_WIDTH)
+#define PSP_SCREEN_SCALE_Y(a) ((a) * (float) SCREEN_WIDTH / PSP_DEFAULT_SCREEN_WIDTH)
#define PSP_SCREEN_SCALE_FROM_RIGHT(a) (SCREEN_WIDTH - PSP_SCREEN_SCALE_X(a))
#define PSP_SCREEN_SCALE_FROM_BOTTOM(a) (SCREEN_HEIGHT - PSP_SCREEN_SCALE_Y(a))
@@ -290,6 +304,22 @@ extern wchar *AllocUnicode(const char*src);
inline float sq(float x) { return x*x; }
#define SQR(x) ((x) * (x))
+#ifdef __MWERKS__
+#define M_E 2.71828182845904523536 // e
+#define M_LOG2E 1.44269504088896340736 // log2(e)
+#define M_LOG10E 0.434294481903251827651 // log10(e)
+#define M_LN2 0.693147180559945309417 // ln(2)
+#define M_LN10 2.30258509299404568402 // ln(10)
+#define M_PI 3.14159265358979323846 // pi
+#define M_PI_2 1.57079632679489661923 // pi/2
+#define M_PI_4 0.785398163397448309616 // pi/4
+#define M_1_PI 0.318309886183790671538 // 1/pi
+#define M_2_PI 0.636619772367581343076 // 2/pi
+#define M_2_SQRTPI 1.12837916709551257390 // 2/sqrt(pi)
+#define M_SQRT2 1.41421356237309504880 // sqrt(2)
+#define M_SQRT1_2 0.707106781186547524401 // 1/sqrt(2)
+#endif
+
#define PI (float)M_PI
#define TWOPI (PI*2)
#define HALFPI (PI/2)
@@ -319,14 +349,34 @@ void re3_usererror(const char *format, ...);
#define DEV(f, ...) re3_debug("[DEV]: " f, ## __VA_ARGS__)
#endif
+#ifdef __MWERKS__
+void debug(char *f, ...);
+void Error(char *f, ...);
+__inline__ void TRACE(char *f, ...) { } // this is re3 only, and so the function needs to be inline - this way no call actually gets placed
+// USERERROR only gets used in oal builds ... once
+#else
#define debug(f, ...) re3_debug("[DBG]: " f, ## __VA_ARGS__)
-#define TRACE(f, ...) re3_trace(__FILE__, __LINE__, __FUNCTION__, f, ## __VA_ARGS__)
#define Error(f, ...) re3_debug("[ERROR]: " f, ## __VA_ARGS__)
+#ifndef MASTER
+#define TRACE(f, ...) re3_trace(__FILE__, __LINE__, __FUNCTION__, f, ## __VA_ARGS__)
#define USERERROR(f, ...) re3_usererror(f, ## __VA_ARGS__)
+#else
+#define TRACE(f, ...)
+#define USERERROR(f, ...)
+#endif
+#endif
+#ifndef MASTER
#define assert(_Expression) (void)( (!!(_Expression)) || (re3_assert(#_Expression, __FILE__, __LINE__, __FUNCTION__), 0) )
+#else
+#define assert(_Expression)
+#endif
#define ASSERT assert
+#ifdef __MWERKS__
+#define static_assert(bool_constexpr, message)
+#endif
+
#define _TODO(x)
#define _TODOCONST(x) (x)
@@ -350,6 +400,7 @@ void re3_usererror(const char *format, ...);
#define CONCAT_(x,y) x##y
#define CONCAT(x,y) CONCAT_(x,y)
+#ifdef DEBUGMENU
// Tweaking stuff for debugmenu
#define TWEAKPATH ___tw___TWEAKPATH
#define SETTWEAKPATH(path) static const char *___tw___TWEAKPATH = path;
@@ -463,6 +514,7 @@ _TWEEKCLASS(CTweakUInt32, uint32);
_TWEEKCLASS(CTweakFloat, float);
#undef _TWEEKCLASS
+#endif
#ifdef VALIDATE_SAVE_SIZE
extern int32 _saveBufCount;
diff --git a/src/core/config.h b/src/core/config.h
index 2685c687..c5799817 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -1,5 +1,8 @@
#pragma once
+// disables (most) stuff that wasn't in original gta-vc.exe - check section at the bottom of this file
+//#define VANILLA_DEFINES
+
enum Config {
NUMPLAYERS = 1,
@@ -404,3 +407,87 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
#undef PS2_ALPHA_TEST
#undef NO_ISLAND_LOADING
#endif
+
+#if defined __MWERKS__ || defined VANILLA_DEFINES
+#define FINAL
+#undef CHATTYSPLASH
+#undef TIMEBARS
+
+#define MASTER
+#undef VALIDATE_SAVE_SIZE
+#undef NO_MOVIES
+#undef DEBUGMENU
+
+#undef DRAW_GAME_VERSION_TEXT
+
+//#undef NASTY_GAME
+//#undef NO_CDCHECK
+
+#undef GTA_PS2_STUFF
+#undef USE_PS2_RAND
+#undef RANDOMSPLASH
+#undef PS2_MATFX
+
+#undef FIX_BUGS
+#define THIS_IS_STUPID
+#undef MORE_LANGUAGES
+#undef COMPATIBLE_SAVES
+#undef LOAD_INI_SETTINGS
+#undef FIX_HIGH_FPS_BUGS_ON_FRONTEND
+
+#undef ASPECT_RATIO_SCALE
+#undef PROPER_SCALING
+//#undef DEFAULT_NATIVE_RESOLUTION
+#undef PS2_ALPHA_TEST
+#undef IMPROVED_VIDEOMODE
+#undef DISABLE_LOADING_SCREEN
+#undef DISABLE_VSYNC_ON_TEXTURE_CONVERSION
+
+#undef FIX_SPRITES
+
+#define PC_WATER
+#undef WATER_CHEATS
+
+#undef USE_CUTSCENE_SHADOW_FOR_PED
+#undef DISABLE_CUTSCENE_SHADOWS
+
+#undef XINPUT
+#undef DETECT_PAD_INPUT_SWITCH
+#undef KANGAROO_CHEAT
+#undef RESTORE_ALLCARSHELI_CHEAT
+#undef BETTER_ALLCARSAREDODO_CHEAT
+#undef WALLCLIMB_CHEAT
+#undef REGISTER_START_BUTTON
+#undef BIND_VEHICLE_FIREWEAPON
+#undef BUTTON_ICONS
+
+#undef FIX_RADAR
+
+#undef MAP_ENHANCEMENTS
+#undef MUCH_SHORTER_OUTRO_SCREEN
+#undef CUSTOM_FRONTEND_OPTIONS
+
+#undef GRAPHICS_MENU_OPTIONS
+#undef NO_ISLAND_LOADING
+#undef CUTSCENE_BORDERS_SWITCH
+#undef MULTISAMPLING
+#undef INVERT_LOOK_FOR_PAD
+
+#undef USE_DEBUG_SCRIPT_LOADER
+#undef USE_MEASUREMENTS_IN_METERS
+#undef USE_PRECISE_MEASUREMENT_CONVERTION
+#undef SUPPORT_JAPANESE_SCRIPT
+#undef MISSION_REPLAY
+#undef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
+#undef USE_BASIC_SCRIPT_DEBUG_OUTPUT
+
+#define DONT_FIX_REPLAY_BUGS
+
+#undef EXPLODING_AIRTRAIN
+#undef CPLANE_ROTORS
+#undef CAMERA_PICKUP
+#undef CANCELLABLE_CAR_ENTER
+#undef IMPROVED_CAMERA
+#undef FREE_CAM
+#undef BIG_IMG
+#endif
diff --git a/src/core/main.cpp b/src/core/main.cpp
index dc75daf8..c3286ea9 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -85,6 +85,9 @@ wchar gUString2[256];
// leeds
bool gMakeResources = true;
bool gUseChunkFiles = false;
+bool gSecondExportPass;
+bool gUseModelResources;
+bool gUseResources;
float FramesPerSecond = 30.0f;
@@ -141,6 +144,24 @@ bool gbNewRenderer = true;
bool bDisplayNumOfAtomicsRendered = false;
bool bDisplayPosn = false;
+#ifdef __MWERKS__
+void
+debug(char *fmt, ...)
+{
+#ifndef MASTER
+ // TODO put something here
+#endif
+}
+
+void
+Error(char *fmt, ...)
+{
+#ifndef MASTER
+ // TODO put something here
+#endif
+}
+#endif
+
void
ValidateVersion()
{
@@ -810,6 +831,7 @@ ProcessSlowMode(void)
float FramesPerSecondCounter;
int32 FrameSamples;
+#ifndef MASTER
struct tZonePrint
{
char name[11];
@@ -840,8 +862,6 @@ tZonePrint ZonePrint[] =
{ "WASHINBTM", "AC", CRect(-255.0f, -1200.0f, 500.0f, -1690.0f)}
};
-#ifndef MASTER
-
void
PrintMemoryUsage(void)
{
diff --git a/src/core/main.h b/src/core/main.h
index 38dce115..98813470 100644
--- a/src/core/main.h
+++ b/src/core/main.h
@@ -27,6 +27,9 @@ extern bool gbPrintMemoryUsage;
// leeds
extern bool gMakeResources;
extern bool gUseChunkFiles;
+extern bool gSecondExportPass;
+extern bool gUseModelResources;
+extern bool gUseResources;
class CSprite2d;
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index ace15502..4a2dfe00 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -95,14 +95,14 @@ CustomFrontendOptionsPopulate(void)
if (fd) {
#ifdef GRAPHICS_MENU_OPTIONS
FrontendOptionSetCursor(MENUPAGE_GRAPHICS_SETTINGS, -3, false);
- FrontendOptionAddSelect("FED_VPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "VehiclePipeline");
- FrontendOptionAddSelect("FED_WPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::WorldPipeSwitch, false, nil, "WorldPipeline");
+ FrontendOptionAddSelect("FED_VPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "Graphics", "VehiclePipeline");
+ FrontendOptionAddSelect("FED_WPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::WorldPipeSwitch, false, nil, "Graphics", "WorldPipeline");
FrontendOptionAddSelect("FED_WLM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "Graphics", "NeoLightMaps");
FrontendOptionAddSelect("FED_RGL", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "Graphics", "NeoRoadGloss");
#else
FrontendOptionSetCursor(MENUPAGE_DISPLAY_SETTINGS, -3, false);
- FrontendOptionAddSelect("FED_VPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "VehiclePipeline");
- FrontendOptionAddSelect("FED_WPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::WorldPipeSwitch, false, nil, "WorldPipeline");
+ FrontendOptionAddSelect("FED_VPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "Graphics", "VehiclePipeline");
+ FrontendOptionAddSelect("FED_WPL", 0, 0, MENUALIGN_LEFT, pipelineNames, ARRAY_SIZE(pipelineNames), (int8*)&CustomPipes::WorldPipeSwitch, false, nil, "Graphics", "WorldPipeline");
FrontendOptionAddSelect("FED_WLM", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "Graphics", "NeoLightMaps");
FrontendOptionAddSelect("FED_RGL", 0, 0, MENUALIGN_LEFT, off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "Graphics", "NeoRoadGloss");
#endif
@@ -1025,9 +1025,13 @@ extern bool gbRenderDebugEnvMap;
}
#endif
+#ifndef __MWERKS__
+#ifndef MASTER
const int re3_buffsize = 1024;
static char re3_buff[re3_buffsize];
+#endif
+#ifndef MASTER
void re3_assert(const char *expr, const char *filename, unsigned int lineno, const char *func)
{
#ifdef _WIN32
@@ -1081,9 +1085,11 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
assert(false);
#endif
}
+#endif
void re3_debug(const char *format, ...)
{
+#ifndef MASTER
va_list va;
va_start(va, format);
#ifdef _WIN32
@@ -1095,8 +1101,10 @@ void re3_debug(const char *format, ...)
printf("%s", re3_buff);
CDebug::DebugAddText(re3_buff);
+#endif
}
+#ifndef MASTER
void re3_trace(const char *filename, unsigned int lineno, const char *func, const char *format, ...)
{
char buff[re3_buffsize *2];
@@ -1136,6 +1144,8 @@ void re3_usererror(const char *format, ...)
assert(false);
#endif
}
+#endif
+#endif
#ifdef VALIDATE_SAVE_SIZE
int32 _saveBufCount;