1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 00:30:06 +00:00

Merge pull request #968 from withmorten/cw

make building with Codewarrior 7 possible
This commit is contained in:
withmorten 2021-01-21 21:55:33 +01:00 committed by GitHub
commit ef24783bff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 455 additions and 262 deletions

4
.gitignore vendored
View file

@ -354,3 +354,7 @@ vendor/glfw-3.3.2.bin.WIN32/
vendor/glfw-3.3.2.bin.WIN64/ vendor/glfw-3.3.2.bin.WIN64/
sdk/ sdk/
codewarrior/re3_Data/
codewarrior/Release/
codewarrior/Debug/

View file

View file

BIN
codewarrior/re3.mcp Normal file

Binary file not shown.

View file

@ -1,7 +1,11 @@
#include "common.h" #include "common.h"
#if defined _WIN32 && !defined __MINGW32__ #if defined _WIN32 && !defined __MINGW32__
#if defined __MWERKS__
#include <wctype.h>
#else
#include "ctype.h" #include "ctype.h"
#endif
#else #else
#include <cwctype> #include <cwctype>
#endif #endif
@ -83,18 +87,18 @@ strcmpIgnoringDigits(const char *s1, const char *s2)
if(c1) s1++; if(c1) s1++;
if(c2) s2++; if(c2) s2++;
if(c1 == '\0' && c2 == '\0') return true; if(c1 == '\0' && c2 == '\0') return true;
#if defined _WIN32 && !defined __MINGW32__ #ifndef ASCII_STRCMP
if(__ascii_iswdigit(c1) && __ascii_iswdigit(c2))
#else
if(iswdigit(c1) && iswdigit(c2)) if(iswdigit(c1) && iswdigit(c2))
#else
if(__ascii_iswdigit(c1) && __ascii_iswdigit(c2))
#endif #endif
continue; continue;
#if defined _WIN32 && !defined __MINGW32__ #ifndef ASCII_STRCMP
c1 = __ascii_toupper(c1);
c2 = __ascii_toupper(c2);
#else
c1 = toupper(c1); c1 = toupper(c1);
c2 = toupper(c2); c2 = toupper(c2);
#else
c1 = __ascii_toupper(c1);
c2 = __ascii_toupper(c2);
#endif #endif
if(c1 != c2) if(c1 != c2)

View file

@ -1,4 +1,4 @@
#include "common.h" #include "common.h"
#include "AudioManager.h" #include "AudioManager.h"
#include "audio_enums.h" #include "audio_enums.h"
@ -38,7 +38,7 @@
#include "ZoneCull.h" #include "ZoneCull.h"
#include "sampman.h" #include "sampman.h"
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); const int channels = ARRAY_SIZE(AudioManager.m_asActiveSamples);
const int policeChannel = channels + 1; const int policeChannel = channels + 1;
const int allChannels = channels + 2; const int allChannels = channels + 2;

View file

@ -13,7 +13,7 @@
cAudioManager AudioManager; cAudioManager AudioManager;
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); const int channels = ARRAY_SIZE(AudioManager.m_asActiveSamples);
const int policeChannel = channels + 1; const int policeChannel = channels + 1;
const int allChannels = channels + 2; const int allChannels = channels + 2;
@ -948,7 +948,7 @@ cAudioManager::ClearActiveSamples()
m_asActiveSamples[i].m_nCalculatedVolume = 0; m_asActiveSamples[i].m_nCalculatedVolume = 0;
m_asActiveSamples[i].m_nReleasingVolumeDivider = 0; m_asActiveSamples[i].m_nReleasingVolumeDivider = 0;
m_asActiveSamples[i].m_nVolumeChange = -1; m_asActiveSamples[i].m_nVolumeChange = -1;
m_asActiveSamples[i].m_vecPos = {0.0f, 0.0f, 0.0f}; m_asActiveSamples[i].m_vecPos = CVector(0.0f, 0.0f, 0.0f);
m_asActiveSamples[i].m_bReverbFlag = false; m_asActiveSamples[i].m_bReverbFlag = false;
m_asActiveSamples[i].m_nLoopsRemaining = 0; m_asActiveSamples[i].m_nLoopsRemaining = 0;
m_asActiveSamples[i].m_bRequireReflection = false; m_asActiveSamples[i].m_bRequireReflection = false;

View file

@ -15,7 +15,7 @@
#include "sampman.h" #include "sampman.h"
#include "Wanted.h" #include "Wanted.h"
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); const int channels = ARRAY_SIZE(AudioManager.m_asActiveSamples);
const int policeChannel = channels + 1; const int policeChannel = channels + 1;
struct tPoliceRadioZone { struct tPoliceRadioZone {

View file

@ -1,4 +1,4 @@
#ifdef AUDIO_MSS #if defined(AUDIO_MSS) || defined (__MWERKS__)
#include <shlobj.h> #include <shlobj.h>
#include <shlguid.h> #include <shlguid.h>

View file

@ -120,7 +120,7 @@ public:
class CPacManPickups class CPacManPickups
{ {
friend CPacManPickup; friend class CPacManPickup;
static CPacManPickup aPMPickUps[NUMPACMANPICKUPS]; static CPacManPickup aPMPickUps[NUMPACMANPICKUPS];
static CVector LastPickUpCoors; static CVector LastPickUpCoors;

View file

@ -46,8 +46,8 @@ CRoadBlocks::Init(void)
void void
CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType, int16 roadBlockNode) CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType, int16 roadBlockNode)
{ {
static const CVector vecRoadBlockOffets[6] = { {-1.5, 1.8f, 0.0f}, {-1.5f, -1.8f, 0.0f}, {1.5f, 1.8f, 0.0f}, static const CVector vecRoadBlockOffets[6] = { CVector(-1.5, 1.8f, 0.0f), CVector(-1.5f, -1.8f, 0.0f), CVector(1.5f, 1.8f, 0.0f),
{1.5f, -1.8f, 0.0f}, {-1.5f, 0.0f, 0.0f}, {1.5, 0.0, 0.0} }; CVector(1.5f, -1.8f, 0.0f), CVector(-1.5f, 0.0f, 0.0f), CVector(1.5, 0.0, 0.0) };
CEntity* pEntityToAttack = (CEntity*)FindPlayerVehicle(); CEntity* pEntityToAttack = (CEntity*)FindPlayerVehicle();
if (!pEntityToAttack) if (!pEntityToAttack)
pEntityToAttack = (CEntity*)FindPlayerPed(); pEntityToAttack = (CEntity*)FindPlayerPed();

View file

@ -329,7 +329,7 @@ void CSceneEdit::Draw(void)
#ifdef FIX_BUGS #ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT - SHADOW_OFFSET), SCREEN_SCALE_Y(COMMAND_NAME_Y + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT), wstr); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT - SHADOW_OFFSET), SCREEN_SCALE_Y(COMMAND_NAME_Y + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT), wstr);
#else #else
CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT) + SHADOW_OFFSET, SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT), wstr); CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT) + SHADOW_OFFSET, SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT, wstr);
#endif #endif
if (nCommandDrawn == m_nCurrentCommand) if (nCommandDrawn == m_nCurrentCommand)
CFont::SetColor(CRGBA(156, 91, 40, 255)); CFont::SetColor(CRGBA(156, 91, 40, 255));
@ -338,7 +338,7 @@ void CSceneEdit::Draw(void)
#ifdef FIX_BUGS #ifdef FIX_BUGS
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT), SCREEN_SCALE_Y(COMMAND_NAME_Y + i * COMMAND_NAME_HEIGHT), wstr); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT), SCREEN_SCALE_Y(COMMAND_NAME_Y + i * COMMAND_NAME_HEIGHT), wstr);
#else #else
CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT), SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + i * COMMAND_NAME_HEIGHT), wstr); CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT), SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + i * COMMAND_NAME_HEIGHT, wstr);
#endif #endif
} }
} }

View file

@ -247,6 +247,156 @@ struct tBuildingSwap
}; };
enum {
#if GTA_VERSION > GTA3_PS2_160
MAX_STACK_DEPTH = 6,
#else
MAX_STACK_DEPTH = 4,
#endif
NUM_LOCAL_VARS = 16,
NUM_TIMERS = 2
};
class CRunningScript
{
enum {
ANDOR_NONE = 0,
ANDS_1 = 1,
ANDS_2,
ANDS_3,
ANDS_4,
ANDS_5,
ANDS_6,
ANDS_7,
ANDS_8,
ORS_1 = 21,
ORS_2,
ORS_3,
ORS_4,
ORS_5,
ORS_6,
ORS_7,
ORS_8
};
public:
CRunningScript* next;
CRunningScript* prev;
char m_abScriptName[8];
uint32 m_nIp;
uint32 m_anStack[MAX_STACK_DEPTH];
uint16 m_nStackPointer;
int32 m_anLocalVariables[NUM_LOCAL_VARS + NUM_TIMERS];
bool m_bCondResult;
bool m_bIsMissionScript;
bool m_bSkipWakeTime;
uint32 m_nWakeTime;
uint16 m_nAndOrState;
bool m_bNotFlag;
bool m_bDeatharrestEnabled;
bool m_bDeatharrestExecuted;
bool m_bMissionFlag;
public:
void SetIP(uint32 ip) { m_nIp = ip; }
CRunningScript* GetNext() const { return next; }
void Save(uint8*& buf);
void Load(uint8*& buf);
void UpdateTimers(float timeStep) {
m_anLocalVariables[NUM_LOCAL_VARS] += timeStep;
m_anLocalVariables[NUM_LOCAL_VARS + 1] += timeStep;
}
void Init();
void Process();
void RemoveScriptFromList(CRunningScript**);
void AddScriptToList(CRunningScript**);
static const uint32 nSaveStructSize;
void CollectParameters(uint32*, int16);
int32 CollectNextParameterWithoutIncreasingPC(uint32);
int32* GetPointerToScriptVariable(uint32*, int16);
void StoreParameters(uint32*, int16);
int8 ProcessOneCommand();
void DoDeatharrestCheck();
void UpdateCompareFlag(bool);
int16 GetPadState(uint16, uint16);
int8 ProcessCommands0To99(int32);
int8 ProcessCommands100To199(int32);
int8 ProcessCommands200To299(int32);
int8 ProcessCommands300To399(int32);
int8 ProcessCommands400To499(int32);
int8 ProcessCommands500To599(int32);
int8 ProcessCommands600To699(int32);
int8 ProcessCommands700To799(int32);
int8 ProcessCommands800To899(int32);
int8 ProcessCommands900To999(int32);
int8 ProcessCommands1000To1099(int32);
#if GTA_VERSION > GTA3_PS2_160
int8 ProcessCommands1100To1199(int32);
#endif
void LocatePlayerCommand(int32, uint32*);
void LocatePlayerCharCommand(int32, uint32*);
void LocatePlayerCarCommand(int32, uint32*);
void LocateCharCommand(int32, uint32*);
void LocateCharCharCommand(int32, uint32*);
void LocateCharCarCommand(int32, uint32*);
void LocateCharObjectCommand(int32, uint32*);
void LocateCarCommand(int32, uint32*);
void LocateSniperBulletCommand(int32, uint32*);
void PlayerInAreaCheckCommand(int32, uint32*);
void PlayerInAngledAreaCheckCommand(int32, uint32*);
void CharInAreaCheckCommand(int32, uint32*);
void CarInAreaCheckCommand(int32, uint32*);
#ifdef GTA_SCRIPT_COLLECTIVE
void LocateCollectiveCommand(int32, uint32*);
void LocateCollectiveCharCommand(int32, uint32*);
void LocateCollectiveCarCommand(int32, uint32*);
void LocateCollectivePlayerCommand(int32, uint32*);
void CollectiveInAreaCheckCommand(int32, uint32*);
#endif
#ifdef MISSION_REPLAY
bool CanAllowMissionReplay();
#endif
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
int CollectParameterForDebug(char* buf, bool& var);
void GetStoredParameterForDebug(char* buf);
#endif
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; }
bool ThisIsAValidRandomPed(uint32 pedtype) {
switch (pedtype) {
case PEDTYPE_CIVMALE:
case PEDTYPE_CIVFEMALE:
case PEDTYPE_GANG1:
case PEDTYPE_GANG2:
case PEDTYPE_GANG3:
case PEDTYPE_GANG4:
case PEDTYPE_GANG5:
case PEDTYPE_GANG6:
case PEDTYPE_GANG7:
case PEDTYPE_GANG8:
case PEDTYPE_GANG9:
case PEDTYPE_CRIMINAL:
case PEDTYPE_PROSTITUTE:
return true;
default:
return false;
}
}
};
enum { enum {
VAR_LOCAL = 1, VAR_LOCAL = 1,
VAR_GLOBAL = 2, VAR_GLOBAL = 2,
@ -428,156 +578,6 @@ public:
#endif #endif
}; };
enum {
#if GTA_VERSION > GTA3_PS2_160
MAX_STACK_DEPTH = 6,
#else
MAX_STACK_DEPTH = 4,
#endif
NUM_LOCAL_VARS = 16,
NUM_TIMERS = 2
};
class CRunningScript
{
enum {
ANDOR_NONE = 0,
ANDS_1 = 1,
ANDS_2,
ANDS_3,
ANDS_4,
ANDS_5,
ANDS_6,
ANDS_7,
ANDS_8,
ORS_1 = 21,
ORS_2,
ORS_3,
ORS_4,
ORS_5,
ORS_6,
ORS_7,
ORS_8
};
public:
CRunningScript* next;
CRunningScript* prev;
char m_abScriptName[8];
uint32 m_nIp;
uint32 m_anStack[MAX_STACK_DEPTH];
uint16 m_nStackPointer;
int32 m_anLocalVariables[NUM_LOCAL_VARS + NUM_TIMERS];
bool m_bCondResult;
bool m_bIsMissionScript;
bool m_bSkipWakeTime;
uint32 m_nWakeTime;
uint16 m_nAndOrState;
bool m_bNotFlag;
bool m_bDeatharrestEnabled;
bool m_bDeatharrestExecuted;
bool m_bMissionFlag;
public:
void SetIP(uint32 ip) { m_nIp = ip; }
CRunningScript* GetNext() const { return next; }
void Save(uint8*& buf);
void Load(uint8*& buf);
void UpdateTimers(float timeStep) {
m_anLocalVariables[NUM_LOCAL_VARS] += timeStep;
m_anLocalVariables[NUM_LOCAL_VARS + 1] += timeStep;
}
void Init();
void Process();
void RemoveScriptFromList(CRunningScript**);
void AddScriptToList(CRunningScript**);
static const uint32 nSaveStructSize;
void CollectParameters(uint32*, int16);
int32 CollectNextParameterWithoutIncreasingPC(uint32);
int32* GetPointerToScriptVariable(uint32*, int16);
void StoreParameters(uint32*, int16);
int8 ProcessOneCommand();
void DoDeatharrestCheck();
void UpdateCompareFlag(bool);
int16 GetPadState(uint16, uint16);
int8 ProcessCommands0To99(int32);
int8 ProcessCommands100To199(int32);
int8 ProcessCommands200To299(int32);
int8 ProcessCommands300To399(int32);
int8 ProcessCommands400To499(int32);
int8 ProcessCommands500To599(int32);
int8 ProcessCommands600To699(int32);
int8 ProcessCommands700To799(int32);
int8 ProcessCommands800To899(int32);
int8 ProcessCommands900To999(int32);
int8 ProcessCommands1000To1099(int32);
#if GTA_VERSION > GTA3_PS2_160
int8 ProcessCommands1100To1199(int32);
#endif
void LocatePlayerCommand(int32, uint32*);
void LocatePlayerCharCommand(int32, uint32*);
void LocatePlayerCarCommand(int32, uint32*);
void LocateCharCommand(int32, uint32*);
void LocateCharCharCommand(int32, uint32*);
void LocateCharCarCommand(int32, uint32*);
void LocateCharObjectCommand(int32, uint32*);
void LocateCarCommand(int32, uint32*);
void LocateSniperBulletCommand(int32, uint32*);
void PlayerInAreaCheckCommand(int32, uint32*);
void PlayerInAngledAreaCheckCommand(int32, uint32*);
void CharInAreaCheckCommand(int32, uint32*);
void CarInAreaCheckCommand(int32, uint32*);
#ifdef GTA_SCRIPT_COLLECTIVE
void LocateCollectiveCommand(int32, uint32*);
void LocateCollectiveCharCommand(int32, uint32*);
void LocateCollectiveCarCommand(int32, uint32*);
void LocateCollectivePlayerCommand(int32, uint32*);
void CollectiveInAreaCheckCommand(int32, uint32*);
#endif
#ifdef MISSION_REPLAY
bool CanAllowMissionReplay();
#endif
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
int CollectParameterForDebug(char* buf, bool& var);
void GetStoredParameterForDebug(char* buf);
#endif
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; }
bool ThisIsAValidRandomPed(uint32 pedtype) {
switch (pedtype) {
case PEDTYPE_CIVMALE:
case PEDTYPE_CIVFEMALE:
case PEDTYPE_GANG1:
case PEDTYPE_GANG2:
case PEDTYPE_GANG3:
case PEDTYPE_GANG4:
case PEDTYPE_GANG5:
case PEDTYPE_GANG6:
case PEDTYPE_GANG7:
case PEDTYPE_GANG8:
case PEDTYPE_GANG9:
case PEDTYPE_CRIMINAL:
case PEDTYPE_PROSTITUTE:
return true;
default:
return false;
}
}
};
#ifdef MISSION_REPLAY #ifdef MISSION_REPLAY
extern int AllowMissionReplay; extern int AllowMissionReplay;
extern uint32 WaitForMissionActivate; extern uint32 WaitForMissionActivate;

View file

@ -2442,7 +2442,7 @@ bool CTheScripts::IsPedStopped(CPed* pPed)
{ {
if (pPed->bInVehicle) if (pPed->bInVehicle)
return IsVehicleStopped(pPed->m_pMyVehicle); return IsVehicleStopped(pPed->m_pMyVehicle);
return pPed->m_nMoveState == eMoveState::PEDMOVE_NONE || pPed->m_nMoveState == eMoveState::PEDMOVE_STILL; return pPed->m_nMoveState == PEDMOVE_NONE || pPed->m_nMoveState == PEDMOVE_STILL;
} }
bool CTheScripts::IsPlayerStopped(CPlayerInfo* pPlayer) bool CTheScripts::IsPlayerStopped(CPlayerInfo* pPlayer)
@ -2455,7 +2455,7 @@ bool CTheScripts::IsPlayerStopped(CPlayerInfo* pPlayer)
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_LAUNCH) || RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_LAUNCH) ||
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_GLIDE)) RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_GLIDE))
return false; return false;
return pPed->m_nMoveState == eMoveState::PEDMOVE_NONE || pPed->m_nMoveState == eMoveState::PEDMOVE_STILL; return pPed->m_nMoveState == PEDMOVE_NONE || pPed->m_nMoveState == PEDMOVE_STILL;
} }
bool CTheScripts::IsVehicleStopped(CVehicle* pVehicle) bool CTheScripts::IsVehicleStopped(CVehicle* pVehicle)

View file

@ -946,7 +946,7 @@ CVector
CCam::DoAverageOnVector(const CVector &vec) CCam::DoAverageOnVector(const CVector &vec)
{ {
int i; int i;
CVector Average = { 0.0f, 0.0f, 0.0f }; CVector Average(0.0f, 0.0f, 0.0f);
if(ResetStatics){ if(ResetStatics){
m_iRunningVectorArrayPos = 0; m_iRunningVectorArrayPos = 0;

View file

@ -7,9 +7,6 @@
#include "RwHelper.h" #include "RwHelper.h"
#include "MemoryMgr.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 struct CdReadInfo
{ {
uint32 nSectorOffset; uint32 nSectorOffset;
@ -60,7 +57,7 @@ CdStreamInitThread(void)
if ( gpReadInfo[i].hSemaphore == nil ) if ( gpReadInfo[i].hSemaphore == nil )
{ {
CDTRACE("failed to create sync semaphore"); printf("%s: failed to create sync semaphore\n", "cdvd_stream");
ASSERT(0); ASSERT(0);
return; return;
} }
@ -81,7 +78,7 @@ CdStreamInitThread(void)
if ( gCdStreamSema == nil ) if ( gCdStreamSema == nil )
{ {
CDTRACE("failed to create stream semaphore"); printf("%s: failed to create stream semaphore\n", "cdvd_stream");
ASSERT(0); ASSERT(0);
return; return;
} }
@ -90,7 +87,7 @@ CdStreamInitThread(void)
if ( _gCdStreamThread == nil ) if ( _gCdStreamThread == nil )
{ {
CDTRACE("failed to create streaming thread"); printf("%s: failed to create streaming thread\n", "cdvd_stream");
ASSERT(0); ASSERT(0);
return; return;
} }
@ -138,7 +135,7 @@ CdStreamInit(int32 numChannels)
gpReadInfo = (CdReadInfo *)LocalAlloc(LMEM_ZEROINIT, sizeof(CdReadInfo) * numChannels); gpReadInfo = (CdReadInfo *)LocalAlloc(LMEM_ZEROINIT, sizeof(CdReadInfo) * numChannels);
ASSERT( gpReadInfo != nil ); ASSERT( gpReadInfo != nil );
CDDEBUG("read info %p", gpReadInfo); debug("%s: read info %p\n", gpReadInfo, "cdvd_stream");
CdStreamAddImage("MODELS\\GTA3.IMG"); CdStreamAddImage("MODELS\\GTA3.IMG");

View file

@ -1281,7 +1281,9 @@ CMenuManager::Draw()
float smallestSliderBar = lineHeight * 0.1f; float smallestSliderBar = lineHeight * 0.1f;
bool foundTheHoveringItem = false; bool foundTheHoveringItem = false;
wchar unicodeTemp[64]; wchar unicodeTemp[64];
#ifdef ASPECT_RATIO_SCALE
char asciiTemp[32]; char asciiTemp[32];
#endif
#ifdef MENU_MAP #ifdef MENU_MAP
if (m_nCurrScreen == MENUPAGE_MAP) { if (m_nCurrScreen == MENUPAGE_MAP) {

View file

@ -133,7 +133,7 @@ public:
static bool faststricmp(const char *str1, const char *str2) static bool faststricmp(const char *str1, const char *str2)
{ {
for (; *str1; str1++, str2++) { for (; *str1; str1++, str2++) {
#if MUCH_SLOWER || !defined _WIN32 || defined __MINGW32__ #ifndef ASCII_STRCMP
if (toupper(*str1) != toupper(*str2)) if (toupper(*str1) != toupper(*str2))
#else #else
if (__ascii_toupper(*str1) != __ascii_toupper(*str2)) if (__ascii_toupper(*str1) != __ascii_toupper(*str2))

View file

@ -7,7 +7,9 @@ CPlaceable::CPlaceable(void)
m_matrix.SetScale(1.0f); m_matrix.SetScale(1.0f);
} }
CPlaceable::~CPlaceable(void) = default; CPlaceable::~CPlaceable(void)
{
}
void void
CPlaceable::SetHeading(float angle) CPlaceable::SetHeading(float angle)

View file

@ -4,7 +4,7 @@ class CPlaceable
{ {
public: public:
// disable allocation // disable allocation
static void *operator new(size_t) = delete; static void *operator new(size_t);
CMatrix m_matrix; CMatrix m_matrix;

View file

@ -1,4 +1,4 @@
#if !defined(GTA_PS2_STUFF) && defined(RWLIBS) #if (!defined(GTA_PS2_STUFF) && defined(RWLIBS)) || defined(__MWERKS__)
#define WITHD3D #define WITHD3D
#endif #endif
#include "config.h" #include "config.h"
@ -298,10 +298,10 @@ void CRadar::ClearBlipForEntity(eBlipType type, int32 id)
int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect) int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect)
{ {
CVector2D corners[4] = { CVector2D corners[4] = {
{ 1.0f, -1.0f }, // top right CVector2D( 1.0f, -1.0f ), // top right
{ 1.0f, 1.0f }, // bottom right CVector2D( 1.0f, 1.0f ), // bottom right
{ -1.0f, 1.0f }, // bottom left CVector2D( -1.0f, 1.0f ), // bottom left
{ -1.0f, -1.0f }, // top left CVector2D( -1.0f, -1.0f ), // top left
}; };
CVector2D tmp; CVector2D tmp;
int i, j, n; int i, j, n;

View file

@ -17,7 +17,7 @@ public:
static int32 NumberKillFrenziesPassed; static int32 NumberKillFrenziesPassed;
static int32 PeopleKilledByOthers; static int32 PeopleKilledByOthers;
static int32 HelisDestroyed; static int32 HelisDestroyed;
static int32 PedsKilledOfThisType[ePedType::NUM_PEDTYPES]; static int32 PedsKilledOfThisType[NUM_PEDTYPES];
static int32 TimesDied; static int32 TimesDied;
static int32 TimesArrested; static int32 TimesArrested;
static int32 KillsSinceLastCheckpoint; static int32 KillsSinceLastCheckpoint;

View file

@ -7,10 +7,18 @@
#pragma warning(disable: 4838) // narrowing conversion #pragma warning(disable: 4838) // narrowing conversion
#pragma warning(disable: 4996) // POSIX names #pragma warning(disable: 4996) // POSIX names
#ifdef __MWERKS__
#define __STDC_LIMIT_MACROS // so we get UINT32_MAX etc
#endif
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <math.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 #if !defined RW_D3D9 && defined LIBRW
#undef WITHD3D #undef WITHD3D
#undef WITHDINPUT #undef WITHDINPUT
@ -79,8 +87,13 @@ typedef uint8_t uint8;
typedef int8_t int8; typedef int8_t int8;
typedef uint16_t uint16; typedef uint16_t uint16;
typedef int16_t int16; typedef int16_t int16;
#ifndef __MWERKS__
typedef uint32_t uint32; typedef uint32_t uint32;
typedef int32_t int32; typedef int32_t int32;
#else
typedef unsigned int uint32;
typedef int int32;
#endif
typedef uintptr_t uintptr; typedef uintptr_t uintptr;
typedef intptr_t intptr; typedef intptr_t intptr;
typedef uint64_t uint64; typedef uint64_t uint64;
@ -92,7 +105,7 @@ typedef uint8 bool8;
typedef uint16 bool16; typedef uint16 bool16;
typedef uint32 bool32; typedef uint32 bool32;
#if defined(_MSC_VER) #if defined(_MSC_VER) || defined (__MWERKS__)
typedef ptrdiff_t ssize_t; typedef ptrdiff_t ssize_t;
#endif #endif
@ -275,6 +288,22 @@ extern wchar *AllocUnicode(const char*src);
inline float sq(float x) { return x*x; } inline float sq(float x) { return x*x; }
#define SQR(x) ((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 PI (float)M_PI
#define TWOPI (PI*2) #define TWOPI (PI*2)
#define HALFPI (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__) #define DEV(f, ...) re3_debug("[DEV]: " f, ## __VA_ARGS__)
#endif #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 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__) #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__) #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) ) #define assert(_Expression) (void)( (!!(_Expression)) || (re3_assert(#_Expression, __FILE__, __LINE__, __FUNCTION__), 0) )
#else
#define assert(_Expression)
#endif
#define ASSERT assert #define ASSERT assert
#ifdef __MWERKS__
#define static_assert(bool_constexpr, message)
#endif
#define _TODO(x) #define _TODO(x)
#define _TODOCONST(x) (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) x##y
#define CONCAT(x,y) CONCAT_(x,y) #define CONCAT(x,y) CONCAT_(x,y)
#ifdef DEBUGMENU
// Tweaking stuff for debugmenu // Tweaking stuff for debugmenu
#define TWEAKPATH ___tw___TWEAKPATH #define TWEAKPATH ___tw___TWEAKPATH
#define SETTWEAKPATH(path) static const char *___tw___TWEAKPATH = path; #define SETTWEAKPATH(path) static const char *___tw___TWEAKPATH = path;
@ -448,6 +498,7 @@ _TWEEKCLASS(CTweakUInt32, uint32);
_TWEEKCLASS(CTweakFloat, float); _TWEEKCLASS(CTweakFloat, float);
#undef _TWEEKCLASS #undef _TWEEKCLASS
#endif
#ifdef VALIDATE_SAVE_SIZE #ifdef VALIDATE_SAVE_SIZE
extern int32 _saveBufCount; extern int32 _saveBufCount;

View file

@ -1,5 +1,8 @@
#pragma once #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 { enum Config {
NUMPLAYERS = 1, // 4 on PS2 NUMPLAYERS = 1, // 4 on PS2
@ -8,8 +11,11 @@ enum Config {
MAX_CDCHANNELS = 5, MAX_CDCHANNELS = 5,
MODELINFOSIZE = 5500, // 3150 on PS2 MODELINFOSIZE = 5500, // 3150 on PS2
// TXDSTORESIZE = 850, #if defined __MWERKS__ || defined VANILLA_DEFINES
TXDSTORESIZE = 850,
#else
TXDSTORESIZE = 1024, // for Xbox map TXDSTORESIZE = 1024, // for Xbox map
#endif
EXTRADIRSIZE = 128, EXTRADIRSIZE = 128,
CUTSCENEDIRSIZE = 512, CUTSCENEDIRSIZE = 512,
@ -235,6 +241,12 @@ enum Config {
#define FIX_BUGS_64 // Must have fixes to be able to run 64 bit build #define FIX_BUGS_64 // Must have fixes to be able to run 64 bit build
#endif #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 // Just debug menu entries
#ifdef DEBUGMENU #ifdef DEBUGMENU
#define MISSION_SWITCHER // from debug menu #define MISSION_SWITCHER // from debug menu
@ -394,3 +406,85 @@ enum Config {
#ifdef LIBRW #ifdef LIBRW
// these are not supported with librw yet // these are not supported with librw yet
#endif #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

View file

@ -128,6 +128,24 @@ bool gbNewRenderer;
#define CLEARMODE (rwCAMERACLEARZ) #define CLEARMODE (rwCAMERACLEARZ)
#endif #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 void
ValidateVersion() ValidateVersion()
{ {
@ -857,6 +875,7 @@ ProcessSlowMode(void)
float FramesPerSecondCounter; float FramesPerSecondCounter;
int32 FrameSamples; int32 FrameSamples;
#ifndef MASTER
struct tZonePrint struct tZonePrint
{ {
char name[12]; char name[12];
@ -877,8 +896,6 @@ tZonePrint ZonePrint[] =
{ "no zone", CRect( 0.0f, 0.0f, 0.0f, 0.0f) } { "no zone", CRect( 0.0f, 0.0f, 0.0f, 0.0f) }
}; };
#ifndef MASTER
void void
PrintMemoryUsage(void) PrintMemoryUsage(void)
{ {

View file

@ -983,9 +983,13 @@ extern bool gbRenderWorld2;
} }
#endif #endif
#ifndef __MWERKS__
#ifndef MASTER
const int re3_buffsize = 1024; const int re3_buffsize = 1024;
static char re3_buff[re3_buffsize]; static char re3_buff[re3_buffsize];
#endif
#ifndef MASTER
void re3_assert(const char *expr, const char *filename, unsigned int lineno, const char *func) void re3_assert(const char *expr, const char *filename, unsigned int lineno, const char *func)
{ {
#ifdef _WIN32 #ifdef _WIN32
@ -1039,9 +1043,11 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
assert(false); assert(false);
#endif #endif
} }
#endif
void re3_debug(const char *format, ...) void re3_debug(const char *format, ...)
{ {
#ifndef MASTER
va_list va; va_list va;
va_start(va, format); va_start(va, format);
#ifdef _WIN32 #ifdef _WIN32
@ -1053,8 +1059,10 @@ void re3_debug(const char *format, ...)
printf("%s", re3_buff); printf("%s", re3_buff);
CDebug::DebugAddText(re3_buff); CDebug::DebugAddText(re3_buff);
#endif
} }
#ifndef MASTER
void re3_trace(const char *filename, unsigned int lineno, const char *func, const char *format, ...) void re3_trace(const char *filename, unsigned int lineno, const char *func, const char *format, ...)
{ {
char buff[re3_buffsize *2]; char buff[re3_buffsize *2];
@ -1074,7 +1082,9 @@ void re3_trace(const char *filename, unsigned int lineno, const char *func, cons
OutputDebugString(buff); OutputDebugString(buff);
} }
#endif
#ifndef MASTER
void re3_usererror(const char *format, ...) void re3_usererror(const char *format, ...)
{ {
va_list va; va_list va;
@ -1094,6 +1104,8 @@ void re3_usererror(const char *format, ...)
assert(false); assert(false);
#endif #endif
} }
#endif
#endif
#ifdef VALIDATE_SAVE_SIZE #ifdef VALIDATE_SAVE_SIZE
int32 _saveBufCount; int32 _saveBufCount;

View file

@ -1092,7 +1092,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
int numCollisions; int numCollisions;
int mostColliding; int mostColliding;
CColPoint colpoints[MAX_COLLISION_POINTS]; CColPoint colpoints[MAX_COLLISION_POINTS];
CVector shift = { 0.0f, 0.0f, 0.0f }; CVector shift = CVector(0.0f, 0.0f, 0.0f);
bool doShift = false; bool doShift = false;
CEntity *boat = nil; CEntity *boat = nil;
@ -1539,8 +1539,8 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
if(numCollisions <= 0) if(numCollisions <= 0)
continue; continue;
CVector moveSpeed = { 0.0f, 0.0f, 0.0f }; CVector moveSpeed = CVector(0.0f, 0.0f, 0.0f);
CVector turnSpeed = { 0.0f, 0.0f, 0.0f }; CVector turnSpeed = CVector(0.0f, 0.0f, 0.0f);
numResponses = 0; numResponses = 0;
if(A->bHasContacted){ if(A->bHasContacted){
for(i = 0; i < numCollisions; i++){ for(i = 0; i < numCollisions; i++){
@ -1899,8 +1899,8 @@ CPhysical::ProcessCollision(void)
}else if(IsObject()){ }else if(IsObject()){
int responsecase = ((CObject*)this)->m_nSpecialCollisionResponseCases; int responsecase = ((CObject*)this)->m_nSpecialCollisionResponseCases;
if(responsecase == COLLRESPONSE_LAMPOST){ if(responsecase == COLLRESPONSE_LAMPOST){
CVector speedUp = { 0.0f, 0.0f, 0.0f }; CVector speedUp = CVector(0.0f, 0.0f, 0.0f);
CVector speedDown = { 0.0f, 0.0f, 0.0f }; CVector speedDown = CVector(0.0f, 0.0f, 0.0f);
speedUp.z = GetBoundRadius(); speedUp.z = GetBoundRadius();
speedDown.z = -speedUp.z; speedDown.z = -speedUp.z;
speedUp = Multiply3x3(GetMatrix(), speedUp); speedUp = Multiply3x3(GetMatrix(), speedUp);

View file

@ -229,7 +229,7 @@ CPlayerPed::SetInitialState(void)
m_nAdrenalineTime = 0; m_nAdrenalineTime = 0;
CTimer::SetTimeScale(1.0f); CTimer::SetTimeScale(1.0f);
m_pSeekTarget = nil; m_pSeekTarget = nil;
m_vecSeekPos = { 0.0f, 0.0f, 0.0f }; m_vecSeekPos = CVector(0.0f, 0.0f, 0.0f);
m_fleeFromPosX = 0.0f; m_fleeFromPosX = 0.0f;
m_fleeFromPosY = 0.0f; m_fleeFromPosY = 0.0f;
m_fleeFrom = nil; m_fleeFrom = nil;

View file

@ -32,22 +32,22 @@
// Transition areas between zones // Transition areas between zones
const RegenerationPoint aSafeZones[] = { const RegenerationPoint aSafeZones[] = {
{ LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 400.0f, 814.0f, -954.0f, -903.0f, 30.0f, 100.0f, LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 400.0f, 814.0f, -954.0f, -903.0f, 30.0f, 100.0f,
CVector(790.0f, -917.0f, 39.0f), CVector(775.0f, -921.0f, 39.0f), CVector(424.0f, -942.0f, 38.0f), CVector(439.0f, -938.0f, 38.0f) }, 790.0f, -917.0f, 39.0f, 775.0f, -921.0f, 39.0f, 424.0f, -942.0f, 38.0f, 439.0f, -938.0f, 38.0f,
{ LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 555.0f, 711.0f, 118.0f, 186.0f, -30.0f, -10.0f, LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 555.0f, 711.0f, 118.0f, 186.0f, -30.0f, -10.0f,
CVector(698.0f, 182.0f, -20.0f), CVector(681.0f, 178.0f, -20.0f), CVector(586.0f, 144.0f, -20.0f), CVector(577.0f, 135.0f, -20.0f) }, CVector(698.0f, 182.0f, -20.0f), CVector(681.0f, 178.0f, -20.0f), CVector(586.0f, 144.0f, -20.0f), CVector(577.0f, 135.0f, -20.0f),
{ LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 626.0f, 744.0f, -124.0f, -87.0f, -20.0f, -6.0f, LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 626.0f, 744.0f, -124.0f, -87.0f, -20.0f, -6.0f,
CVector(736.0f, -117.0f, -13.0f), CVector(730.0f, -115.0f, -13.0f), CVector(635.0f, -93.0f, -12.5f), CVector(650.0f, -89.0f, -12.5f) }, CVector(736.0f, -117.0f, -13.0f), CVector(730.0f, -115.0f, -13.0f), CVector(635.0f, -93.0f, -12.5f), CVector(650.0f, -89.0f, -12.5f),
{ LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 645.0f, 734.0f, -780.0f, -750.0f, -25.0f, -6.0f, LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 645.0f, 734.0f, -780.0f, -750.0f, -25.0f, -6.0f,
CVector(729.0f, -764.0f, -18.0f), CVector(720.0f, -769.0f, -17.0f), CVector(652.0f, -774.0f, -10.5f), CVector(659.0f, -770.0f, -10.5f) }, CVector(729.0f, -764.0f, -18.0f), CVector(720.0f, -769.0f, -17.0f), CVector(652.0f, -774.0f, -10.5f), CVector(659.0f, -770.0f, -10.5f),
{ LEVEL_COMMERCIAL, LEVEL_SUBURBAN, -532.0f, -136.0f, -668.0f, -599.0f, 34.0f, 60.0f, LEVEL_COMMERCIAL, LEVEL_SUBURBAN, -532.0f, -136.0f, -668.0f, -599.0f, 34.0f, 60.0f,
CVector(-172.0f, -619.0f, 44.0f), CVector(-183.0f, -623.0f, 44.0f), CVector(-511.0f, -645.0f, 41.0f), CVector(-493.0f, -639.0f, 41.5f) }, CVector(-172.0f, -619.0f, 44.0f), CVector(-183.0f, -623.0f, 44.0f), CVector(-511.0f, -645.0f, 41.0f), CVector(-493.0f, -639.0f, 41.5f),
{ LEVEL_COMMERCIAL, LEVEL_SUBURBAN, -325.0f, -175.0f, 27.0f, 75.0f, -30.0f, -10.0f, LEVEL_COMMERCIAL, LEVEL_SUBURBAN, -325.0f, -175.0f, 27.0f, 75.0f, -30.0f, -10.0f,
CVector(-185.0f, 40.8f, -20.5f), CVector(-202.0f, 37.0f, -20.5f), CVector(-315.0f, 65.5f, -20.5f), CVector(-306.0f, 62.4f, -20.5f) }, CVector(-185.0f, 40.8f, -20.5f), CVector(-202.0f, 37.0f, -20.5f), CVector(-315.0f, 65.5f, -20.5f), CVector(-306.0f, 62.4f, -20.5f),
{ LEVEL_COMMERCIAL, LEVEL_SUBURBAN, -410.0f, -310.0f, -1055.0f, -1030.0f, -20.0f, -6.0f, LEVEL_COMMERCIAL, LEVEL_SUBURBAN, -410.0f, -310.0f, -1055.0f, -1030.0f, -20.0f, -6.0f,
CVector(-321.0f, -1043.0f, -13.2f), CVector(-328.0f, -1045.0f, -13.2f), CVector(-398.0f, -1044.0f, -13.5f), CVector(-390.0f, -1040.5f, -13.5f) }, CVector(-321.0f, -1043.0f, -13.2f), CVector(-328.0f, -1045.0f, -13.2f), CVector(-398.0f, -1044.0f, -13.5f), CVector(-390.0f, -1040.5f, -13.5f),
{ LEVEL_COMMERCIAL, LEVEL_SUBURBAN, -425.0f, -280.0f, -471.0f, -447.0f, -20.0f, -5.0f, LEVEL_COMMERCIAL, LEVEL_SUBURBAN, -425.0f, -280.0f, -471.0f, -447.0f, -20.0f, -5.0f,
CVector(-292.0f, -457.0f, -11.6f), CVector(-310.0f, -461.0f, -11.6f), CVector(-413.0f, -461.0f, -11.5f), CVector(-399.0f, -457.0f, -11.3f) } CVector(-292.0f, -457.0f, -11.6f), CVector(-310.0f, -461.0f, -11.6f), CVector(-413.0f, -461.0f, -11.5f), CVector(-399.0f, -457.0f, -11.3f)
}; };
PedGroup CPopulation::ms_pPedGroups[NUMPEDGROUPS]; PedGroup CPopulation::ms_pPedGroups[NUMPEDGROUPS];
@ -77,7 +77,7 @@ uint32 CPopulation::ms_nNumGang7;
uint32 CPopulation::ms_nNumGang8; uint32 CPopulation::ms_nNumGang8;
CVector CPopulation::RegenerationPoint_a; CVector CPopulation::RegenerationPoint_a;
CVector CPopulation::RegenerationPoint_b; CVector CPopulation::RegenerationPoint_b;
CVector CPopulation::RegenerationForward; CVector CPopulation::RegenerationFront;
void void
CPopulation::Initialise() CPopulation::Initialise()
@ -370,13 +370,13 @@ CPopulation::DealWithZoneChange(eLevelName oldLevel, eLevelName newLevel, bool f
if (aSafeZones[safeZone].srcLevel == newLevel) { if (aSafeZones[safeZone].srcLevel == newLevel) {
CPopulation::RegenerationPoint_a = aSafeZones[safeZone].srcPosA; CPopulation::RegenerationPoint_a = aSafeZones[safeZone].srcPosA;
CPopulation::RegenerationPoint_b = aSafeZones[safeZone].srcPosB; CPopulation::RegenerationPoint_b = aSafeZones[safeZone].srcPosB;
CPopulation::RegenerationForward = aSafeZones[safeZone].destPosA - aSafeZones[safeZone].srcPosA; CPopulation::RegenerationFront = aSafeZones[safeZone].destPosA - aSafeZones[safeZone].srcPosA;
RegenerationForward.Normalise(); RegenerationFront.Normalise();
} else if (aSafeZones[safeZone].destLevel == newLevel) { } else if (aSafeZones[safeZone].destLevel == newLevel) {
CPopulation::RegenerationPoint_a = aSafeZones[safeZone].destPosA; CPopulation::RegenerationPoint_a = aSafeZones[safeZone].destPosA;
CPopulation::RegenerationPoint_b = aSafeZones[safeZone].destPosB; CPopulation::RegenerationPoint_b = aSafeZones[safeZone].destPosB;
CPopulation::RegenerationForward = aSafeZones[safeZone].srcPosA - aSafeZones[safeZone].destPosA; CPopulation::RegenerationFront = aSafeZones[safeZone].srcPosA - aSafeZones[safeZone].destPosA;
RegenerationForward.Normalise(); RegenerationFront.Normalise();
} }
} }
@ -895,7 +895,7 @@ CPopulation::MoveCarsAndPedsOutOfAbandonedZones()
break; break;
} }
veh->GetMatrix().GetPosition().z += (movedVehicleCount / 4) * 7.0f; veh->GetMatrix().GetPosition().z += (movedVehicleCount / 4) * 7.0f;
veh->GetMatrix().GetForward() = RegenerationForward; veh->GetMatrix().GetForward() = RegenerationFront;
((CAutomobile*)veh)->PlaceOnRoadProperly(); ((CAutomobile*)veh)->PlaceOnRoadProperly();
CCarCtrl::JoinCarWithRoadSystem(veh); CCarCtrl::JoinCarWithRoadSystem(veh);
CTheScripts::ClearSpaceForMissionEntity(veh->GetPosition(), veh); CTheScripts::ClearSpaceForMissionEntity(veh->GetPosition(), veh);

View file

@ -24,10 +24,10 @@ struct RegenerationPoint
float y2; float y2;
float z1; float z1;
float z2; float z2;
CVector destPosA; RwV3d destPosA;
CVector destPosB; RwV3d destPosB;
CVector srcPosA; RwV3d srcPosA;
CVector srcPosB; RwV3d srcPosB;
}; };
class CPopulation class CPopulation
@ -60,7 +60,7 @@ public:
static uint32 ms_nNumGang8; static uint32 ms_nNumGang8;
static CVector RegenerationPoint_a; static CVector RegenerationPoint_a;
static CVector RegenerationPoint_b; static CVector RegenerationPoint_b;
static CVector RegenerationForward; static CVector RegenerationFront;
static void Initialise(); static void Initialise();
static void Update(void); static void Update(void);

View file

@ -1,5 +1,7 @@
#pragma once #pragma once
#include "Sprite2d.h"
void AsciiToUnicode(const char *src, wchar *dst); void AsciiToUnicode(const char *src, wchar *dst);
void UnicodeStrcpy(wchar *dst, const wchar *src); void UnicodeStrcpy(wchar *dst, const wchar *src);
void UnicodeStrcat(wchar *dst, wchar *append); void UnicodeStrcat(wchar *dst, wchar *append);

View file

@ -1,4 +1,4 @@
#include "common.h" #include "common.h"
#include "Glass.h" #include "Glass.h"
#include "Timer.h" #include "Timer.h"

View file

@ -1148,20 +1148,20 @@ void CHud::Draw()
// Yeah, top and bottom changed place. R* vision // Yeah, top and bottom changed place. R* vision
if (IntroRect.m_bIsUsed && IntroRect.m_bBeforeFade) { if (IntroRect.m_bIsUsed && IntroRect.m_bBeforeFade) {
if (IntroRect.m_nTextureId >= 0) { if (IntroRect.m_nTextureId >= 0) {
CRect rect = { CRect rect (
IntroRect.m_sRect.left, IntroRect.m_sRect.left,
IntroRect.m_sRect.top, IntroRect.m_sRect.top,
IntroRect.m_sRect.right, IntroRect.m_sRect.right,
IntroRect.m_sRect.bottom }; IntroRect.m_sRect.bottom );
CTheScripts::ScriptSprites[IntroRect.m_nTextureId].Draw(rect, IntroRect.m_sColor); CTheScripts::ScriptSprites[IntroRect.m_nTextureId].Draw(rect, IntroRect.m_sColor);
} }
else { else {
CRect rect = { CRect rect (
IntroRect.m_sRect.left, IntroRect.m_sRect.left,
IntroRect.m_sRect.top, IntroRect.m_sRect.top,
IntroRect.m_sRect.right, IntroRect.m_sRect.right,
IntroRect.m_sRect.bottom }; IntroRect.m_sRect.bottom );
CSprite2d::DrawRect(rect, IntroRect.m_sColor); CSprite2d::DrawRect(rect, IntroRect.m_sColor);
} }

View file

@ -9,6 +9,6 @@ class CInstance : public CPlaceable
public: public:
int m_modelIndex; int m_modelIndex;
public: public:
~CInstance() = default; ~CInstance() { }
void Shutdown(); void Shutdown();
}; };

View file

@ -1119,7 +1119,7 @@ CMoneyMessages::RegisterOne(CVector vecPos, const char *pText, uint8 bRed, uint8
} }
CRGBA FoamColour(255, 255, 255, 255); CRGBA FoamColour(255, 255, 255, 255);
unsigned int CSpecialParticleStuff::BoatFromStart; uint32 CSpecialParticleStuff::BoatFromStart;
void void
CSpecialParticleStuff::CreateFoamAroundObject(CMatrix* pMatrix, float innerFw, float innerRg, float innerUp, int32 particles) CSpecialParticleStuff::CreateFoamAroundObject(CMatrix* pMatrix, float innerFw, float innerRg, float innerUp, int32 particles)

View file

@ -1,5 +1,6 @@
#pragma once #pragma once
#include "Game.h"
#include "PCSave.h" #include "PCSave.h"
#define SLOT_COUNT (8) #define SLOT_COUNT (8)

View file

@ -17,7 +17,11 @@ enum eWinVersion
// As long as WITHWINDOWS isn't defined / <Windows.h> isn't included, we only need type definitions so let's include <IntSafe.h>. // As long as WITHWINDOWS isn't defined / <Windows.h> isn't included, we only need type definitions so let's include <IntSafe.h>.
// NOTE: It's perfectly fine to include <Windows.h> here, but it can increase build size and time in *some* conditions, and maybe substantially in future if we'll use crossplatform.h more. // NOTE: It's perfectly fine to include <Windows.h> here, but it can increase build size and time in *some* conditions, and maybe substantially in future if we'll use crossplatform.h more.
#ifndef _INC_WINDOWS #ifndef _INC_WINDOWS
#ifndef __MWERKS__
#include <IntSafe.h> #include <IntSafe.h>
#else
#include <Windows.h>
#endif
#endif #endif
#if defined RW_D3D9 || defined RWLIBS #if defined RW_D3D9 || defined RWLIBS
#include "win.h" #include "win.h"

View file

@ -1,4 +1,4 @@
#if defined RW_D3D9 || defined RWLIBS #if defined RW_D3D9 || defined RWLIBS || defined __MWERKS__
#define _WIN32_WINDOWS 0x0500 #define _WIN32_WINDOWS 0x0500
#define WINVER 0x0500 #define WINVER 0x0500
@ -19,6 +19,10 @@
#pragma warning( push ) #pragma warning( push )
#pragma warning( disable : 4005) #pragma warning( disable : 4005)
#ifdef __MWERKS__
#define MAPVK_VK_TO_CHAR (2) // this is missing from codewarrior win32 headers - but it gets used ... how?
#endif
#include <ddraw.h> #include <ddraw.h>
#include <DShow.h> #include <DShow.h>
#pragma warning( pop ) #pragma warning( pop )

View file

@ -1,4 +1,4 @@
#include "common.h" #include "common.h"
#include "main.h" #include "main.h"
#include "General.h" #include "General.h"

View file

@ -7,7 +7,7 @@
#include "AnimBlendAssociation.h" #include "AnimBlendAssociation.h"
#include "Weapon.h" #include "Weapon.h"
CWeaponInfo CWeaponInfo::ms_apWeaponInfos[WEAPONTYPE_TOTALWEAPONS]; static CWeaponInfo aWeaponInfo[WEAPONTYPE_TOTALWEAPONS];
static char ms_aWeaponNames[][32] = { static char ms_aWeaponNames[][32] = {
"Unarmed", "Unarmed",
@ -28,7 +28,7 @@ static char ms_aWeaponNames[][32] = {
CWeaponInfo* CWeaponInfo*
CWeaponInfo::GetWeaponInfo(eWeaponType weaponType) { CWeaponInfo::GetWeaponInfo(eWeaponType weaponType) {
return &CWeaponInfo::ms_apWeaponInfos[weaponType]; return &aWeaponInfo[weaponType];
} }
void void
@ -36,10 +36,10 @@ CWeaponInfo::Initialise(void)
{ {
debug("Initialising CWeaponInfo...\n"); debug("Initialising CWeaponInfo...\n");
for (int i = 0; i < WEAPONTYPE_TOTALWEAPONS; i++) { for (int i = 0; i < WEAPONTYPE_TOTALWEAPONS; i++) {
ms_apWeaponInfos[i].m_eWeaponFire = WEAPON_FIRE_INSTANT_HIT; aWeaponInfo[i].m_eWeaponFire = WEAPON_FIRE_INSTANT_HIT;
ms_apWeaponInfos[i].m_AnimToPlay = ANIM_PUNCH_R; aWeaponInfo[i].m_AnimToPlay = ANIM_PUNCH_R;
ms_apWeaponInfos[i].m_Anim2ToPlay = NUM_ANIMS; aWeaponInfo[i].m_Anim2ToPlay = NUM_ANIMS;
ms_apWeaponInfos[i].m_Flags = WEAPONFLAG_USE_GRAVITY | WEAPONFLAG_SLOWS_DOWN | WEAPONFLAG_RAND_SPEED | WEAPONFLAG_EXPANDS | WEAPONFLAG_EXPLODES; aWeaponInfo[i].m_Flags = WEAPONFLAG_USE_GRAVITY | WEAPONFLAG_SLOWS_DOWN | WEAPONFLAG_RAND_SPEED | WEAPONFLAG_EXPANDS | WEAPONFLAG_EXPLODES;
} }
debug("Loading weapon data...\n"); debug("Loading weapon data...\n");
LoadWeaponData(); LoadWeaponData();
@ -133,29 +133,29 @@ CWeaponInfo::LoadWeaponData(void)
if (strcmp(anim2ToPlay, "null") != 0) { if (strcmp(anim2ToPlay, "null") != 0) {
animAssoc = CAnimManager::GetAnimAssociation(ASSOCGRP_STD, anim2ToPlay); animAssoc = CAnimManager::GetAnimAssociation(ASSOCGRP_STD, anim2ToPlay);
ms_apWeaponInfos[weaponType].m_Anim2ToPlay = (AnimationId) animAssoc->animId; aWeaponInfo[weaponType].m_Anim2ToPlay = (AnimationId) animAssoc->animId;
} }
CVector vecFireOffset(fireOffsetX, fireOffsetY, fireOffsetZ); CVector vecFireOffset(fireOffsetX, fireOffsetY, fireOffsetZ);
ms_apWeaponInfos[weaponType].m_eWeaponFire = FindWeaponFireType(fireType); aWeaponInfo[weaponType].m_eWeaponFire = FindWeaponFireType(fireType);
ms_apWeaponInfos[weaponType].m_fRange = range; aWeaponInfo[weaponType].m_fRange = range;
ms_apWeaponInfos[weaponType].m_nFiringRate = firingRate; aWeaponInfo[weaponType].m_nFiringRate = firingRate;
ms_apWeaponInfos[weaponType].m_nReload = reload; aWeaponInfo[weaponType].m_nReload = reload;
ms_apWeaponInfos[weaponType].m_nAmountofAmmunition = ammoAmount; aWeaponInfo[weaponType].m_nAmountofAmmunition = ammoAmount;
ms_apWeaponInfos[weaponType].m_nDamage = damage; aWeaponInfo[weaponType].m_nDamage = damage;
ms_apWeaponInfos[weaponType].m_fSpeed = speed; aWeaponInfo[weaponType].m_fSpeed = speed;
ms_apWeaponInfos[weaponType].m_fRadius = radius; aWeaponInfo[weaponType].m_fRadius = radius;
ms_apWeaponInfos[weaponType].m_fLifespan = lifeSpan; aWeaponInfo[weaponType].m_fLifespan = lifeSpan;
ms_apWeaponInfos[weaponType].m_fSpread = spread; aWeaponInfo[weaponType].m_fSpread = spread;
ms_apWeaponInfos[weaponType].m_vecFireOffset = vecFireOffset; aWeaponInfo[weaponType].m_vecFireOffset = vecFireOffset;
ms_apWeaponInfos[weaponType].m_AnimToPlay = animId; aWeaponInfo[weaponType].m_AnimToPlay = animId;
ms_apWeaponInfos[weaponType].m_fAnimLoopStart = animLoopStart / 30.0f; aWeaponInfo[weaponType].m_fAnimLoopStart = animLoopStart / 30.0f;
ms_apWeaponInfos[weaponType].m_fAnimLoopEnd = animLoopEnd / 30.0f; aWeaponInfo[weaponType].m_fAnimLoopEnd = animLoopEnd / 30.0f;
ms_apWeaponInfos[weaponType].m_fAnimFrameFire = delayBetweenAnimAndFire / 30.0f; aWeaponInfo[weaponType].m_fAnimFrameFire = delayBetweenAnimAndFire / 30.0f;
ms_apWeaponInfos[weaponType].m_fAnim2FrameFire = delayBetweenAnim2AndFire / 30.0f; aWeaponInfo[weaponType].m_fAnim2FrameFire = delayBetweenAnim2AndFire / 30.0f;
ms_apWeaponInfos[weaponType].m_nModelId = modelId; aWeaponInfo[weaponType].m_nModelId = modelId;
ms_apWeaponInfos[weaponType].m_Flags = flags; aWeaponInfo[weaponType].m_Flags = flags;
} }
} }

View file

@ -19,7 +19,6 @@ enum
}; };
class CWeaponInfo { class CWeaponInfo {
static CWeaponInfo ms_apWeaponInfos[WEAPONTYPE_LAST_WEAPONTYPE];
public: public:
eWeaponFire m_eWeaponFire; eWeaponFire m_eWeaponFire;
float m_fRange; float m_fRange;