diff options
author | withmorten <morten.with@gmail.com> | 2021-01-21 21:55:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-21 21:55:33 +0100 |
commit | ef24783bff1dc74a846966660005cfefe23d48a2 (patch) | |
tree | b123f26121b59226b05bf87a36dec621890de0b3 /src/core | |
parent | update librw (diff) | |
parent | codewarrior: finishing touches (diff) | |
download | re3-ef24783bff1dc74a846966660005cfefe23d48a2.tar re3-ef24783bff1dc74a846966660005cfefe23d48a2.tar.gz re3-ef24783bff1dc74a846966660005cfefe23d48a2.tar.bz2 re3-ef24783bff1dc74a846966660005cfefe23d48a2.tar.lz re3-ef24783bff1dc74a846966660005cfefe23d48a2.tar.xz re3-ef24783bff1dc74a846966660005cfefe23d48a2.tar.zst re3-ef24783bff1dc74a846966660005cfefe23d48a2.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/Cam.cpp | 2 | ||||
-rw-r--r-- | src/core/CdStream.cpp | 11 | ||||
-rw-r--r-- | src/core/Frontend.cpp | 2 | ||||
-rw-r--r-- | src/core/General.h | 2 | ||||
-rw-r--r-- | src/core/Placeable.cpp | 4 | ||||
-rw-r--r-- | src/core/Placeable.h | 2 | ||||
-rw-r--r-- | src/core/Radar.cpp | 10 | ||||
-rw-r--r-- | src/core/Stats.h | 2 | ||||
-rw-r--r-- | src/core/common.h | 55 | ||||
-rw-r--r-- | src/core/config.h | 96 | ||||
-rw-r--r-- | src/core/main.cpp | 21 | ||||
-rw-r--r-- | src/core/re3.cpp | 12 |
12 files changed, 197 insertions, 22 deletions
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index a11cd6a4..74de0ab7 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -946,7 +946,7 @@ CVector CCam::DoAverageOnVector(const CVector &vec) { int i; - CVector Average = { 0.0f, 0.0f, 0.0f }; + CVector Average(0.0f, 0.0f, 0.0f); if(ResetStatics){ m_iRunningVectorArrayPos = 0; diff --git a/src/core/CdStream.cpp b/src/core/CdStream.cpp index 4bb31ea4..a1843473 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", gpReadInfo, "cdvd_stream"); CdStreamAddImage("MODELS\\GTA3.IMG"); diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 65eab125..707184d5 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -1281,7 +1281,9 @@ CMenuManager::Draw() float smallestSliderBar = lineHeight * 0.1f; bool foundTheHoveringItem = false; wchar unicodeTemp[64]; +#ifdef ASPECT_RATIO_SCALE char asciiTemp[32]; +#endif #ifdef MENU_MAP if (m_nCurrScreen == MENUPAGE_MAP) { diff --git a/src/core/General.h b/src/core/General.h index de803558..478ef027 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/Placeable.cpp b/src/core/Placeable.cpp index 69b3d3ea..162148f7 100644 --- a/src/core/Placeable.cpp +++ b/src/core/Placeable.cpp @@ -7,7 +7,9 @@ CPlaceable::CPlaceable(void) m_matrix.SetScale(1.0f); } -CPlaceable::~CPlaceable(void) = default; +CPlaceable::~CPlaceable(void) +{ +} void CPlaceable::SetHeading(float angle) diff --git a/src/core/Placeable.h b/src/core/Placeable.h index 970c0d48..1d51f306 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 a905522b..116e9e94 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -1,4 +1,4 @@ -#if !defined(GTA_PS2_STUFF) && defined(RWLIBS) +#if (!defined(GTA_PS2_STUFF) && defined(RWLIBS)) || defined(__MWERKS__) #define WITHD3D #endif #include "config.h" @@ -298,10 +298,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/Stats.h b/src/core/Stats.h index 5dfcf803..6abcfb61 100644 --- a/src/core/Stats.h +++ b/src/core/Stats.h @@ -17,7 +17,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 d7facfd1..84440968 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -7,10 +7,18 @@ #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 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 @@ -79,8 +87,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 +105,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 @@ -275,6 +288,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) @@ -304,14 +333,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) @@ -335,6 +384,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; @@ -448,6 +498,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 ce7ee1e3..35130024 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 gta3.exe - check section at the bottom of this file +//#define VANILLA_DEFINES + enum Config { NUMPLAYERS = 1, // 4 on PS2 @@ -8,8 +11,11 @@ enum Config { MAX_CDCHANNELS = 5, MODELINFOSIZE = 5500, // 3150 on PS2 -// TXDSTORESIZE = 850, +#if defined __MWERKS__ || defined VANILLA_DEFINES + TXDSTORESIZE = 850, +#else TXDSTORESIZE = 1024, // for Xbox map +#endif EXTRADIRSIZE = 128, CUTSCENEDIRSIZE = 512, @@ -235,6 +241,12 @@ enum Config { #define FIX_BUGS_64 // Must have fixes to be able to run 64 bit build #endif +#define ASCII_STRCMP // use faster ascii str comparisons + +#if !defined _WIN32 || defined __MWERKS__ || defined __MINGW32__ || defined VANILLA_DEFINES +#undef ASCII_STRCMP +#endif + // Just debug menu entries #ifdef DEBUGMENU #define MISSION_SWITCHER // from debug menu @@ -394,3 +406,85 @@ enum Config { #ifdef LIBRW // these are not supported with librw yet #endif + +#if defined __MWERKS__ || defined VANILLA_DEFINES +#define FINAL +#undef CHATTYSPLASH +#undef TIMEBARS +//#define USE_MY_DOCUMENTS + +#define MASTER +#undef VALIDATE_SAVE_SIZE +#undef NO_MOVIES +#undef DEBUGMENU + +#undef DRAW_GAME_VERSION_TEXT +#undef DRAW_MENU_VERSION_TEXT + +#undef GTA_PS2_STUFF +#undef USE_PS2_RAND +#undef RANDOMSPLASH +#undef PS2_MATFX + +#undef FIX_BUGS +#undef THIS_IS_STUPID +#undef MORE_LANGUAGES +#undef COMPATIBLE_SAVES +#undef LOAD_INI_SETTINGS + +#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 +//#define USE_TEXTURE_POOL // not possible because R* used custom RW33 + +#undef FIX_SPRITES + +#define PC_PARTICLE + +#undef XINPUT +#undef DETECT_PAD_INPUT_SWITCH +#undef KANGAROO_CHEAT +#undef ALLCARSHELI_CHEAT +#undef ALT_DODO_CHEAT +#undef REGISTER_START_BUTTON +#undef BIND_VEHICLE_FIREWEAPON +#undef BUTTON_ICONS + +#undef HUD_ENHANCEMENTS +#undef TRIANGULAR_BLIPS +#undef FIX_RADAR +#undef RADIO_OFF_TEXT + +#undef MENU_MAP +#undef SCROLLABLE_STATS_PAGE +#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 MISSION_REPLAY +#undef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT +#undef USE_BASIC_SCRIPT_DEBUG_OUTPUT + +#define DONT_FIX_REPLAY_BUGS + +#undef EXPLODING_AIRTRAIN +#undef CAMERA_PICKUP +#undef PED_SKIN +#undef ANIMATE_PED_COL_MODEL +#undef CANCELLABLE_CAR_ENTER +#undef IMPROVED_CAMERA +#undef FREE_CAM +#undef RADIO_SCROLL_TO_PREV_STATION +#undef BIG_IMG +#endif diff --git a/src/core/main.cpp b/src/core/main.cpp index d43f4a74..9d8a8e52 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -128,6 +128,24 @@ bool gbNewRenderer; #define CLEARMODE (rwCAMERACLEARZ) #endif +#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() { @@ -857,6 +875,7 @@ ProcessSlowMode(void) float FramesPerSecondCounter; int32 FrameSamples; +#ifndef MASTER struct tZonePrint { char name[12]; @@ -877,8 +896,6 @@ tZonePrint ZonePrint[] = { "no zone", CRect( 0.0f, 0.0f, 0.0f, 0.0f) } }; -#ifndef MASTER - void PrintMemoryUsage(void) { diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 09eafe74..48e8a6bc 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -983,9 +983,13 @@ extern bool gbRenderWorld2; } #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 @@ -1039,9 +1043,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 @@ -1053,8 +1059,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]; @@ -1074,7 +1082,9 @@ void re3_trace(const char *filename, unsigned int lineno, const char *func, cons OutputDebugString(buff); } +#endif +#ifndef MASTER void re3_usererror(const char *format, ...) { va_list va; @@ -1094,6 +1104,8 @@ void re3_usererror(const char *format, ...) assert(false); #endif } +#endif +#endif #ifdef VALIDATE_SAVE_SIZE int32 _saveBufCount; |