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

Merge pull request #977 from withmorten/miami-cw

make building with Codewarrior 7 possible
This commit is contained in:
withmorten 2021-01-25 14:06:53 +01:00 committed by GitHub
commit 9d4053419b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
48 changed files with 492 additions and 300 deletions

6
.gitignore vendored
View file

@ -353,4 +353,8 @@ vendor/glew-2.1.0/
vendor/glfw-3.3.2.bin.WIN32/ vendor/glfw-3.3.2.bin.WIN32/
vendor/glfw-3.3.2.bin.WIN64/ vendor/glfw-3.3.2.bin.WIN64/
sdk/ sdk/
codewarrior/reVC_Data/
codewarrior/Release/
codewarrior/Debug/

View file

View file

BIN
codewarrior/reVC.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
@ -88,18 +92,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 && c1 != c2) if(c1 && c2 && 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"
@ -43,7 +43,7 @@
#include "Script.h" #include "Script.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;
const int allChannels = channels + 2; const int allChannels = channels + 2;
@ -8108,7 +8108,7 @@ cAudioManager::ProcessWaterCannon(int32)
} }
//positon of arcade machines //positon of arcade machines
CVector aVecExtraSoundPosition[] = { {-1042.546f, 88.794f, 11.324f}, {-1004.476f, 181.697f, 11.324f} }; CVector aVecExtraSoundPosition[] = { CVector(-1042.546f, 88.794f, 11.324f), CVector(-1004.476f, 181.697f, 11.324f) };
void void
cAudioManager::ProcessExtraSounds() cAudioManager::ProcessExtraSounds()

View file

@ -14,7 +14,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;

View file

@ -1,4 +1,4 @@
#pragma once #pragma once
#include "audio_enums.h" #include "audio_enums.h"
#include "AudioCollision.h" #include "AudioCollision.h"

View file

@ -1,4 +1,4 @@
#pragma once #pragma once
#include "common.h" #include "common.h"

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,3 +1,5 @@
#include "common.h"
#ifdef AUDIO_MSS #ifdef AUDIO_MSS
#include <shlobj.h> #include <shlobj.h>
#include <shlguid.h> #include <shlguid.h>
@ -8,7 +10,6 @@
#include "eax-util.h" #include "eax-util.h"
#include "mss.h" #include "mss.h"
#include "common.h"
#include "sampman.h" #include "sampman.h"
#include "AudioManager.h" #include "AudioManager.h"
#include "MusicManager.h" #include "MusicManager.h"

View file

@ -1,4 +1,4 @@
#pragma once #pragma once
enum eSound enum eSound
{ {

View file

@ -14,7 +14,7 @@ void COnscreenTimer::Init() {
for(uint32 i = 0; i < NUMONSCREENCOUNTERS; i++) { for(uint32 i = 0; i < NUMONSCREENCOUNTERS; i++) {
m_sCounters[i].m_nCounterOffset = 0; m_sCounters[i].m_nCounterOffset = 0;
for(uint32 j = 0; j < ARRAY_SIZE(COnscreenCounterEntry::m_aCounterText); j++) { for(uint32 j = 0; j < ARRAY_SIZE(m_sCounters[0].m_aCounterText); j++) {
m_sCounters[i].m_aCounterText[j] = 0; m_sCounters[i].m_aCounterText[j] = 0;
} }
@ -24,7 +24,7 @@ void COnscreenTimer::Init() {
for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) { for(uint32 i = 0; i < NUMONSCREENCLOCKS; i++) {
m_sClocks[i].m_nClockOffset = 0; m_sClocks[i].m_nClockOffset = 0;
for(uint32 j = 0; j < ARRAY_SIZE(COnscreenTimerEntry::m_aClockText); j++) { for(uint32 j = 0; j < ARRAY_SIZE(m_sClocks[0].m_aClockText); j++) {
m_sClocks[i].m_aClockText[j] = 0; m_sClocks[i].m_aClockText[j] = 0;
} }
@ -92,7 +92,7 @@ void COnscreenTimer::AddCounter(uint32 offset, uint16 type, char* text, uint16 p
m_sCounters[pos].m_nCounterOffset = offset; m_sCounters[pos].m_nCounterOffset = offset;
if(text) { if(text) {
strncpy(m_sCounters[pos].m_aCounterText, text, ARRAY_SIZE(COnscreenCounterEntry::m_aCounterText)); strncpy(m_sCounters[pos].m_aCounterText, text, ARRAY_SIZE(m_sCounters[0].m_aCounterText));
} else { } else {
m_sCounters[pos].m_aCounterText[0] = 0; m_sCounters[pos].m_aCounterText[0] = 0;
} }
@ -114,7 +114,7 @@ void COnscreenTimer::AddClock(uint32 offset, char* text, bool bGoingDown) {
m_sClocks[i].m_nClockOffset = offset; m_sClocks[i].m_nClockOffset = offset;
m_sClocks[i].m_bClockGoingDown = bGoingDown; m_sClocks[i].m_bClockGoingDown = bGoingDown;
if(text) { if(text) {
strncpy(m_sClocks[i].m_aClockText, text, ARRAY_SIZE(COnscreenTimerEntry::m_aClockText)); strncpy(m_sClocks[i].m_aClockText, text, ARRAY_SIZE(m_sClocks[0].m_aClockText));
} else { } else {
m_sClocks[i].m_aClockText[0] = 0; m_sClocks[i].m_aClockText[0] = 0;
} }

View file

@ -144,7 +144,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

@ -55,8 +55,8 @@ CRoadBlocks::Init(void)
void void
CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType) CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType)
{ {
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

@ -248,6 +248,142 @@ struct tBuildingSwap
}; };
enum {
MAX_STACK_DEPTH = 6,
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_bIsActive;
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);
int8 ProcessCommands1100To1199(int32);
int8 ProcessCommands1200To1299(int32);
int8 ProcessCommands1300To1399(int32);
int8 ProcessCommands1400To1499(int32);
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*);
void LocateObjectCommand(int32, uint32*);
void ObjectInAreaCheckCommand(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 ThisIsAValidRandomCop(uint32 mi, int cop, int swat, int fbi, int army, int miami);
bool ThisIsAValidRandomPed(uint32 pedtype, int civ, int gang, int criminal);
bool CheckDamagedWeaponType(int32 actual, int32 type);
};
enum { enum {
VAR_LOCAL = 1, VAR_LOCAL = 1,
VAR_GLOBAL = 2, VAR_GLOBAL = 2,
@ -441,142 +577,6 @@ public:
}; };
enum {
MAX_STACK_DEPTH = 6,
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_bIsActive;
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);
int8 ProcessCommands1100To1199(int32);
int8 ProcessCommands1200To1299(int32);
int8 ProcessCommands1300To1399(int32);
int8 ProcessCommands1400To1499(int32);
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*);
void LocateObjectCommand(int32, uint32*);
void ObjectInAreaCheckCommand(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 ThisIsAValidRandomCop(uint32 mi, int cop, int swat, int fbi, int army, int miami);
bool ThisIsAValidRandomPed(uint32 pedtype, int civ, int gang, int criminal);
bool CheckDamagedWeaponType(int32 actual, int32 type);
};
#ifdef USE_DEBUG_SCRIPT_LOADER #ifdef USE_DEBUG_SCRIPT_LOADER
extern int scriptToLoad; extern int scriptToLoad;
#endif #endif

View file

@ -2618,7 +2618,7 @@ bool CTheScripts::IsPedStopped(CPed* pPed)
{ {
if (pPed->InVehicle()) if (pPed->InVehicle())
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) &&
!pPed->bIsInTheAir && !pPed->bIsLanding && pPed->bIsStanding && pPed->m_vecAnimMoveDelta.x == 0.0f && pPed->m_vecAnimMoveDelta.y == 0.0f; !pPed->bIsInTheAir && !pPed->bIsLanding && pPed->bIsStanding && pPed->m_vecAnimMoveDelta.x == 0.0f && pPed->m_vecAnimMoveDelta.y == 0.0f;
} }
@ -2632,7 +2632,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) &&
!pPed->bIsInTheAir && !pPed->bIsLanding && pPed->bIsStanding && pPed->m_vecAnimMoveDelta.x == 0.0f && pPed->m_vecAnimMoveDelta.y == 0.0f; !pPed->bIsInTheAir && !pPed->bIsLanding && pPed->bIsStanding && pPed->m_vecAnimMoveDelta.x == 0.0f && pPed->m_vecAnimMoveDelta.y == 0.0f;
} }

View file

@ -947,7 +947,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 = CVector(0.0f, 0.0f, 0.0f);
if(ResetStatics){ if(ResetStatics){
m_iRunningVectorArrayPos = 0; m_iRunningVectorArrayPos = 0;
@ -4029,7 +4029,7 @@ CCam::Process_Debug(const CVector&, float, float, float)
if(CPad::GetPad(1)->GetLeftShockJustDown() && gbBigWhiteDebugLightSwitchedOn) if(CPad::GetPad(1)->GetLeftShockJustDown() && gbBigWhiteDebugLightSwitchedOn)
CShadows::StoreShadowToBeRendered(SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &Source, CShadows::StoreShadowToBeRendered(SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &Source,
12.0f, 0.0f, 0.0f, -12.0f, 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){ if(CHud::m_Wants_To_Draw_Hud){
char str[256]; char str[256];

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", "cdvd_stream", gpReadInfo);
CdStreamAddImage("MODELS\\GTA3.IMG"); CdStreamAddImage("MODELS\\GTA3.IMG");

View file

@ -541,7 +541,7 @@ void CControllerConfigManager::UpdateJoyInConfigMenus_ButtonDown(int32 button, i
break; break;
case 12: case 12:
#ifndef REGISTER_START_BUTTON #ifndef REGISTER_START_BUTTON
if (padNumber == 1) if (padnumber == 1)
#endif #endif
pad->PCTempJoyState.Start = 255; pad->PCTempJoyState.Start = 255;
break; break;

View file

@ -986,7 +986,9 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
} }
wchar unicodeTemp[64]; wchar unicodeTemp[64];
#ifdef ASPECT_RATIO_SCALE
char asciiTemp[32]; char asciiTemp[32];
#endif
bool weHaveLabel = aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL; bool weHaveLabel = aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL;
uint8 section = 0; // 0: highlight trapezoid 1: texts uint8 section = 0; // 0: highlight trapezoid 1: texts

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

@ -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,3 +1,6 @@
#if (!defined(GTA_PS2_STUFF) && defined(RWLIBS)) || defined(__MWERKS__)
#define WITHD3D
#endif
#include "config.h" #include "config.h"
#include "common.h" #include "common.h"
@ -332,10 +335,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

@ -116,7 +116,7 @@ CRopes::RegisterRope(uintptr id, CVector pos, bool setUpdateTimer)
aRopes[i].m_unk = false; aRopes[i].m_unk = false;
aRopes[i].m_bWasRegistered = true; aRopes[i].m_bWasRegistered = true;
aRopes[i].m_updateTimer = setUpdateTimer ? CTimer::GetTimeInMilliseconds() + 20000 : 0; 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) if(j & 1)
aRopes[i].m_pos[j] = aRopes[i].m_pos[j-1] + CVector(0.0f, 0.0f, 0.625f); aRopes[i].m_pos[j] = aRopes[i].m_pos[j-1] + CVector(0.0f, 0.0f, 0.625f);
else else
@ -147,7 +147,7 @@ CRopes::FindCoorsAlongRope(uintptr id, float t, CVector *coors)
float f; float f;
for(i = 0; i < ARRAY_SIZE(aRopes); i++) for(i = 0; i < ARRAY_SIZE(aRopes); i++)
if(aRopes[i].m_bActive && aRopes[i].m_id == id){ 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; j = t;
f = t - j; f = t - j;
*coors = (1.0f-f)*aRopes[i].m_pos[j] + f*aRopes[i].m_pos[j+1]; *coors = (1.0f-f)*aRopes[i].m_pos[j] + f*aRopes[i].m_pos[j+1];

View file

@ -21,7 +21,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,19 @@
#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 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 #if !defined RW_D3D9 && defined LIBRW
#undef WITHD3D #undef WITHD3D
#undef WITHDINPUT #undef WITHDINPUT
@ -29,9 +38,9 @@
#define WITH_D3D // librw includes d3d9 itself via this right now #define WITH_D3D // librw includes d3d9 itself via this right now
#else #else
#ifndef USE_D3D9 #ifndef USE_D3D9
#include <d3d8types.h> #include <d3d8.h>
#else #else
#include <d3d9types.h> #include <d3d9.h>
#endif #endif
#endif #endif
#endif #endif
@ -79,8 +88,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 +106,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
@ -276,6 +290,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)
@ -305,14 +335,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)
@ -336,6 +386,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;
@ -449,6 +500,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 gta-vc.exe - check section at the bottom of this file
//#define VANILLA_DEFINES
enum Config { enum Config {
NUMPLAYERS = 1, NUMPLAYERS = 1,
@ -401,3 +404,87 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
#undef PS2_ALPHA_TEST #undef PS2_ALPHA_TEST
#undef NO_ISLAND_LOADING #undef NO_ISLAND_LOADING
#endif #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

View file

@ -137,6 +137,24 @@ bool gbNewRenderer;
bool bDisplayNumOfAtomicsRendered = false; bool bDisplayNumOfAtomicsRendered = false;
bool bDisplayPosn = 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 void
ValidateVersion() ValidateVersion()
{ {
@ -800,6 +818,7 @@ ProcessSlowMode(void)
float FramesPerSecondCounter; float FramesPerSecondCounter;
int32 FrameSamples; int32 FrameSamples;
#ifndef MASTER
struct tZonePrint struct tZonePrint
{ {
char name[11]; char name[11];
@ -830,8 +849,6 @@ tZonePrint ZonePrint[] =
{ "WASHINBTM", "AC", CRect(-255.0f, -1200.0f, 500.0f, -1690.0f)} { "WASHINBTM", "AC", CRect(-255.0f, -1200.0f, 500.0f, -1690.0f)}
}; };
#ifndef MASTER
void void
PrintMemoryUsage(void) PrintMemoryUsage(void)
{ {

View file

@ -1020,9 +1020,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
@ -1076,9 +1080,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
@ -1090,8 +1096,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];
@ -1131,6 +1139,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

@ -1265,7 +1265,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;
@ -1724,8 +1724,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);
float maxImpulseA = 0.0f; float maxImpulseA = 0.0f;
numResponses = 0; numResponses = 0;
if(A->bHasContacted){ if(A->bHasContacted){
@ -2209,8 +2209,8 @@ CPhysical::ProcessCollision(void)
}else if(IsObject() && ((CObject*)this)->ObjectCreatedBy != TEMP_OBJECT){ }else if(IsObject() && ((CObject*)this)->ObjectCreatedBy != TEMP_OBJECT){
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);
CColModel *colModel = GetColModel(); CColModel *colModel = GetColModel();
speedUp.z = colModel->boundingBox.max.z; speedUp.z = colModel->boundingBox.max.z;
speedDown.z = colModel->boundingBox.min.z; speedDown.z = colModel->boundingBox.min.z;

View file

@ -4093,7 +4093,7 @@ CPed::SetExitBoat(CVehicle *boat)
RemoveInCarAnims(); RemoveInCarAnims();
CColModel* boatCol = boat->GetColModel(); CColModel* boatCol = boat->GetColModel();
if (boat->IsUpsideDown()) { if (boat->IsUpsideDown()) {
newPos = { 0.0f, 0.0f, boatCol->boundingBox.min.z }; newPos = CVector(0.0f, 0.0f, boatCol->boundingBox.min.z);
newPos = boat->GetMatrix() * newPos; newPos = boat->GetMatrix() * newPos;
newPos.z += 1.0f; newPos.z += 1.0f;
m_vehDoor = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;

View file

@ -104,7 +104,7 @@ bool CVehicleToEffect::HasThisEffect(C2dEffect* pEffect) const
const C2dEffect* CPedAttractorManager::GetEffectForIceCreamVan(CVehicle* pVehicle, const CVector& pos) const C2dEffect* CPedAttractorManager::GetEffectForIceCreamVan(CVehicle* pVehicle, const CVector& pos)
{ {
if (!vVehicleToEffect.empty()) { if (!vVehicleToEffect.empty()) {
for (std::vector<CVehicleToEffect>::const_iterator assoc = vVehicleToEffect.cbegin(); assoc != vVehicleToEffect.cend(); ++assoc) { for (std::vector<CVehicleToEffect>::const_iterator assoc = vVehicleToEffect.begin(); assoc != vVehicleToEffect.end(); ++assoc) {
if (assoc->GetVehicle() == pVehicle) if (assoc->GetVehicle() == pVehicle)
return assoc->ChooseEffect(pos); return assoc->ChooseEffect(pos);
} }
@ -120,7 +120,7 @@ CVehicle* CPedAttractorManager::GetIceCreamVanForEffect(C2dEffect* pEffect)
{ {
if (vVehicleToEffect.empty()) if (vVehicleToEffect.empty())
return nil; return nil;
for (std::vector<CVehicleToEffect>::const_iterator assoc = vVehicleToEffect.cbegin(); assoc != vVehicleToEffect.cend(); ++assoc) { for (std::vector<CVehicleToEffect>::const_iterator assoc = vVehicleToEffect.begin(); assoc != vVehicleToEffect.end(); ++assoc) {
if (assoc->HasThisEffect(pEffect)) if (assoc->HasThisEffect(pEffect))
return assoc->GetVehicle(); return assoc->GetVehicle();
} }
@ -131,7 +131,7 @@ const CPedAttractor* CPedAttractorManager::FindAssociatedAttractor(const C2dEffe
{ {
if (vecAttractors.empty()) if (vecAttractors.empty())
return nil; return nil;
for (std::vector<CPedAttractor*>::const_iterator attractor = vecAttractors.cbegin(); attractor != vecAttractors.cend(); ++attractor) { for (std::vector<CPedAttractor*>::const_iterator attractor = vecAttractors.begin(); attractor != vecAttractors.end(); ++attractor) {
if ((*attractor)->GetEffect() == pEffect) if ((*attractor)->GetEffect() == pEffect)
return *attractor; return *attractor;
} }
@ -145,7 +145,7 @@ void CPedAttractorManager::RemoveIceCreamVanEffects(C2dEffect* pEffect)
return; return;
if (vVehicleToEffect.empty()) if (vVehicleToEffect.empty())
return; return;
for (std::vector<CVehicleToEffect>::const_iterator assoc = vVehicleToEffect.cbegin(); assoc != vVehicleToEffect.cend();) { for (std::vector<CVehicleToEffect>::iterator assoc = vVehicleToEffect.begin(); assoc != vVehicleToEffect.end();) {
if (assoc->GetVehicle() != pVehicle) { if (assoc->GetVehicle() != pVehicle) {
++assoc; ++assoc;
continue; continue;
@ -229,7 +229,7 @@ CVector CPedShelterAttractor::GetDisplacement(int32 qid) const
float fRandomOffset = CGeneral::GetRandomNumberInRange(0.0f, 2.0f); float fRandomOffset = CGeneral::GetRandomNumberInRange(0.0f, 2.0f);
CVector vecDisplacement(fRandomOffset * Sin(fRandomAngle), fRandomOffset * Cos(fRandomAngle), 0.0f); CVector vecDisplacement(fRandomOffset * Sin(fRandomAngle), fRandomOffset * Cos(fRandomAngle), 0.0f);
bool close = false; bool close = false;
for (std::vector<CVector>::const_iterator v = ms_displacements.cbegin(); v != ms_displacements.cend(); ++v) { for (std::vector<CVector>::const_iterator v = ms_displacements.begin(); v != ms_displacements.end(); ++v) {
if ((*v - vecDisplacement).Magnitude() < 1.0f) { if ((*v - vecDisplacement).Magnitude() < 1.0f) {
close = true; close = true;
break; break;
@ -265,7 +265,7 @@ void CPedShelterAttractor::ComputeAttractHeading(int32 qid, float& heading) cons
bool CPedAttractor::RegisterPed(CPed* pPed) bool CPedAttractor::RegisterPed(CPed* pPed)
{ {
for (std::vector<CPed*>::const_iterator pPedIt = vApproachingQueue.cbegin(); pPedIt != vApproachingQueue.cend(); ++pPedIt) { for (std::vector<CPed*>::iterator pPedIt = vApproachingQueue.begin(); pPedIt != vApproachingQueue.end(); ++pPedIt) {
if (*pPedIt == pPed) { if (*pPedIt == pPed) {
vApproachingQueue.erase(pPedIt); vApproachingQueue.erase(pPedIt);
return false; return false;
@ -318,7 +318,7 @@ static bool IsPedUsingAttractorOfThisType(int8 type, CPed* pPed)
bool CPedAttractor::DeRegisterPed(CPed* pPed) bool CPedAttractor::DeRegisterPed(CPed* pPed)
{ {
for (std::vector<CPed*>::const_iterator pPedIt = vApproachingQueue.cbegin(); pPedIt != vApproachingQueue.cend(); ++pPedIt) { for (std::vector<CPed*>::iterator pPedIt = vApproachingQueue.begin(); pPedIt != vApproachingQueue.end(); ++pPedIt) {
if (*pPedIt != pPed) if (*pPedIt != pPed)
continue; continue;
pPed->m_attractor = nil; pPed->m_attractor = nil;
@ -340,12 +340,12 @@ bool CPedAttractor::DeRegisterPed(CPed* pPed)
bool CPedAttractor::BroadcastArrival(CPed* pPed) bool CPedAttractor::BroadcastArrival(CPed* pPed)
{ {
for (std::vector<CPed*>::const_iterator pPedIt = vWaitingQueue.cbegin(); pPedIt != vWaitingQueue.cend(); ++pPedIt) { for (std::vector<CPed*>::const_iterator pPedIt = vWaitingQueue.begin(); pPedIt != vWaitingQueue.end(); ++pPedIt) {
if (*pPedIt == pPed) if (*pPedIt == pPed)
return false; return false;
} }
vWaitingQueue.push_back(pPed); vWaitingQueue.push_back(pPed);
for (std::vector<CPed*>::const_iterator pPedIt = vApproachingQueue.cbegin(); pPedIt != vApproachingQueue.cend(); ++pPedIt) { for (std::vector<CPed*>::iterator pPedIt = vApproachingQueue.begin(); pPedIt != vApproachingQueue.end(); ++pPedIt) {
if (*pPedIt == pPed) { if (*pPedIt == pPed) {
vApproachingQueue.erase(pPedIt); vApproachingQueue.erase(pPedIt);
break; break;
@ -400,7 +400,7 @@ bool CPedAttractor::BroadcastDeparture(CPed* pPed)
pPed->SetWanderPath(CGeneral::GetNodeHeadingFromVector(-vecQueueDir.y, -vecQueueDir.x)); pPed->SetWanderPath(CGeneral::GetNodeHeadingFromVector(-vecQueueDir.y, -vecQueueDir.x));
UpdatePedStateOnDeparture(pPed); UpdatePedStateOnDeparture(pPed);
} }
vWaitingQueue.erase(vWaitingQueue.cbegin() + qid); vWaitingQueue.erase(vWaitingQueue.begin() + qid);
for (std::vector<CPed*>::iterator pPedIt = vApproachingQueue.begin(); pPedIt != vApproachingQueue.end(); ++pPedIt) { for (std::vector<CPed*>::iterator pPedIt = vApproachingQueue.begin(); pPedIt != vApproachingQueue.end(); ++pPedIt) {
CPed* pPed = *pPedIt; CPed* pPed = *pPedIt;
CVector pos; CVector pos;
@ -441,7 +441,7 @@ bool CPedShelterAttractor::BroadcastDeparture(CPed* pPed)
pPed->SetWanderPath(CGeneral::GetNodeHeadingFromVector(-vecQueueDir.y, -vecQueueDir.x)); pPed->SetWanderPath(CGeneral::GetNodeHeadingFromVector(-vecQueueDir.y, -vecQueueDir.x));
UpdatePedStateOnDeparture(pPed); UpdatePedStateOnDeparture(pPed);
} }
vWaitingQueue.erase(vWaitingQueue.cbegin() + qid); vWaitingQueue.erase(vWaitingQueue.begin() + qid);
for (std::vector<CPed*>::iterator pPedIt = vApproachingQueue.begin(); pPedIt != vApproachingQueue.end(); ++pPedIt) { for (std::vector<CPed*>::iterator pPedIt = vApproachingQueue.begin(); pPedIt != vApproachingQueue.end(); ++pPedIt) {
CPed* pPed = *pPedIt; CPed* pPed = *pPedIt;
CVector pos; CVector pos;
@ -458,11 +458,11 @@ bool CPedShelterAttractor::BroadcastDeparture(CPed* pPed)
bool CPedAttractor::IsRegisteredWithPed(CPed* pPed) const bool CPedAttractor::IsRegisteredWithPed(CPed* pPed) const
{ {
for (std::vector<CPed*>::const_iterator pPedIt = vWaitingQueue.cbegin(); pPedIt != vWaitingQueue.cend(); ++pPedIt) { for (std::vector<CPed*>::const_iterator pPedIt = vWaitingQueue.begin(); pPedIt != vWaitingQueue.end(); ++pPedIt) {
if (*pPedIt == pPed) if (*pPedIt == pPed)
return true; return true;
} }
for (std::vector<CPed*>::const_iterator pPedIt = vApproachingQueue.cbegin(); pPedIt != vApproachingQueue.cend(); ++pPedIt) { for (std::vector<CPed*>::const_iterator pPedIt = vApproachingQueue.begin(); pPedIt != vApproachingQueue.end(); ++pPedIt) {
if (*pPedIt == pPed) { if (*pPedIt == pPed) {
return true; return true;
} }
@ -472,7 +472,7 @@ bool CPedAttractor::IsRegisteredWithPed(CPed* pPed) const
bool CPedAttractor::IsInQueue(CPed* pPed) const bool CPedAttractor::IsInQueue(CPed* pPed) const
{ {
for (std::vector<CPed*>::const_iterator pPedIt = vWaitingQueue.cbegin(); pPedIt != vWaitingQueue.cend(); ++pPedIt) { for (std::vector<CPed*>::const_iterator pPedIt = vWaitingQueue.begin(); pPedIt != vWaitingQueue.end(); ++pPedIt) {
if (*pPedIt == pPed) if (*pPedIt == pPed)
return true; return true;
} }
@ -640,7 +640,7 @@ void CPedAttractorManager::ComputeEffectUseDir(const C2dEffect* pEffect, const C
CPedAttractor* CPedAttractorManager::RegisterPed(CPed* pPed, C2dEffect* pEffect, const CMatrix& matrix, std::vector<CPedAttractor*>& vecAttractors) CPedAttractor* CPedAttractorManager::RegisterPed(CPed* pPed, C2dEffect* pEffect, const CMatrix& matrix, std::vector<CPedAttractor*>& vecAttractors)
{ {
CPedAttractor* pRegisteredAttractor = nil; CPedAttractor* pRegisteredAttractor = nil;
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.cbegin(); pAttractorIt != vecAttractors.cend(); ++pAttractorIt) { for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.begin(); pAttractorIt != vecAttractors.end(); ++pAttractorIt) {
CPedAttractor* pAttractor = *pAttractorIt; CPedAttractor* pAttractor = *pAttractorIt;
CVector vEffectPos; CVector vEffectPos;
ComputeEffectPos(pAttractor->GetEffect(), matrix, vEffectPos); ComputeEffectPos(pAttractor->GetEffect(), matrix, vEffectPos);
@ -676,7 +676,7 @@ bool CPedAttractorManager::DeRegisterPed(CPed* pPed, CPedAttractor* pAttractor,
if (!pAttractor) if (!pAttractor)
return false; return false;
CPedAttractor* pFound = nil; CPedAttractor* pFound = nil;
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.cbegin(); pAttractorIt != vecAttractors.cend(); ++pAttractorIt) { for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.begin(); pAttractorIt != vecAttractors.end(); ++pAttractorIt) {
if (*pAttractorIt == pAttractor) { if (*pAttractorIt == pAttractor) {
pFound = *pAttractorIt; pFound = *pAttractorIt;
break; break;
@ -687,7 +687,7 @@ bool CPedAttractorManager::DeRegisterPed(CPed* pPed, CPedAttractor* pAttractor,
pFound->DeRegisterPed(pPed); pFound->DeRegisterPed(pPed);
if (pFound->GetNoOfRegisteredPeds() != 0) if (pFound->GetNoOfRegisteredPeds() != 0)
return true; return true;
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.cbegin(); pAttractorIt != vecAttractors.cend(); ++pAttractorIt) { for (std::vector<CPedAttractor*>::iterator pAttractorIt = vecAttractors.begin(); pAttractorIt != vecAttractors.end(); ++pAttractorIt) {
if (*pAttractorIt == pAttractor) { if (*pAttractorIt == pAttractor) {
vecAttractors.erase(pAttractorIt); vecAttractors.erase(pAttractorIt);
break; break;
@ -702,7 +702,7 @@ bool CPedAttractorManager::BroadcastArrival(CPed* pPed, CPedAttractor* pAttracto
if (!pAttractor) if (!pAttractor)
return false; return false;
CPedAttractor* pFound = nil; CPedAttractor* pFound = nil;
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.cbegin(); pAttractorIt != vecAttractors.cend(); ++pAttractorIt) { for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.begin(); pAttractorIt != vecAttractors.end(); ++pAttractorIt) {
if (*pAttractorIt == pAttractor) { if (*pAttractorIt == pAttractor) {
pFound = *pAttractorIt; pFound = *pAttractorIt;
break; break;
@ -719,7 +719,7 @@ bool CPedAttractorManager::BroadcastDeparture(CPed* pPed, CPedAttractor* pAttrac
if (!pAttractor) if (!pAttractor)
return false; return false;
CPedAttractor* pFound = nil; CPedAttractor* pFound = nil;
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.cbegin(); pAttractorIt != vecAttractors.cend(); ++pAttractorIt) { for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.begin(); pAttractorIt != vecAttractors.end(); ++pAttractorIt) {
if (*pAttractorIt == pAttractor) { if (*pAttractorIt == pAttractor) {
pFound = *pAttractorIt; pFound = *pAttractorIt;
break; break;
@ -730,7 +730,7 @@ bool CPedAttractorManager::BroadcastDeparture(CPed* pPed, CPedAttractor* pAttrac
pFound->DeRegisterPed(pPed); pFound->DeRegisterPed(pPed);
if (pFound->GetNoOfRegisteredPeds() != 0) if (pFound->GetNoOfRegisteredPeds() != 0)
return true; return true;
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.cbegin(); pAttractorIt != vecAttractors.cend(); ++pAttractorIt) { for (std::vector<CPedAttractor*>::iterator pAttractorIt = vecAttractors.begin(); pAttractorIt != vecAttractors.end(); ++pAttractorIt) {
if (*pAttractorIt == pAttractor) { if (*pAttractorIt == pAttractor) {
vecAttractors.erase(pAttractorIt); vecAttractors.erase(pAttractorIt);
break; break;
@ -744,7 +744,7 @@ bool CPedAttractorManager::IsInQueue(CPed* pPed, CPedAttractor* pAttractor, std:
{ {
if (!pAttractor) if (!pAttractor)
return false; return false;
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.cbegin(); pAttractorIt != vecAttractors.cend(); ++pAttractorIt) { for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.begin(); pAttractorIt != vecAttractors.end(); ++pAttractorIt) {
if (*pAttractorIt == pAttractor) { if (*pAttractorIt == pAttractor) {
return (*pAttractorIt)->IsInQueue(pPed); return (*pAttractorIt)->IsInQueue(pPed);
} }
@ -756,7 +756,7 @@ bool CPedAttractorManager::IsAtHeadOfQueue(CPed* pPed, CPedAttractor* pAttractor
{ {
if (!pAttractor) if (!pAttractor)
return false; return false;
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.cbegin(); pAttractorIt != vecAttractors.cend(); ++pAttractorIt) { for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.begin(); pAttractorIt != vecAttractors.end(); ++pAttractorIt) {
if (*pAttractorIt == pAttractor) { if (*pAttractorIt == pAttractor) {
return (*pAttractorIt)->IsAtHeadOfQueue(pPed); return (*pAttractorIt)->IsAtHeadOfQueue(pPed);
} }
@ -766,7 +766,7 @@ bool CPedAttractorManager::IsAtHeadOfQueue(CPed* pPed, CPedAttractor* pAttractor
bool CPedAttractorManager::IsPedRegistered(CPed* pPed, std::vector<CPedAttractor*>& vecAttractors) bool CPedAttractorManager::IsPedRegistered(CPed* pPed, std::vector<CPedAttractor*>& vecAttractors)
{ {
for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.cbegin(); pAttractorIt != vecAttractors.cend(); ++pAttractorIt) { for (std::vector<CPedAttractor*>::const_iterator pAttractorIt = vecAttractors.begin(); pAttractorIt != vecAttractors.end(); ++pAttractorIt) {
if ((*pAttractorIt)->IsRegisteredWithPed(pPed)) if ((*pAttractorIt)->IsRegisteredWithPed(pPed))
return true; return true;
} }

View file

@ -126,8 +126,8 @@ public:
class CPedAtmAttractor : public CPedAttractor class CPedAtmAttractor : public CPedAttractor
{ {
public: public:
virtual ePedAttractorType GetType() const override { return ATTRACTOR_ATM; }; virtual ePedAttractorType GetType() const { return ATTRACTOR_ATM; };
virtual void UpdatePedStateOnDeparture(CPed* pPed) const override; virtual void UpdatePedStateOnDeparture(CPed* pPed) const;
CPedAtmAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) : CPedAtmAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) :
CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp) CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp)
{}; {};
@ -136,9 +136,9 @@ public:
class CPedIceCreamAttractor : public CPedAttractor class CPedIceCreamAttractor : public CPedAttractor
{ {
public: public:
virtual ~CPedIceCreamAttractor() override { GetPedAttractorManager()->RemoveIceCreamVanEffects(p2dEffect); } virtual ~CPedIceCreamAttractor() { GetPedAttractorManager()->RemoveIceCreamVanEffects(p2dEffect); }
virtual ePedAttractorType GetType() const override { return ATTRACTOR_ICECREAM; } virtual ePedAttractorType GetType() const { return ATTRACTOR_ICECREAM; }
virtual void UpdatePedStateOnDeparture(CPed* pPed) const override {}; virtual void UpdatePedStateOnDeparture(CPed* pPed) const {};
CPedIceCreamAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) : CPedIceCreamAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) :
CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp) CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp)
{}; {};
@ -147,9 +147,9 @@ public:
class CPedPizzaAttractor : public CPedAttractor class CPedPizzaAttractor : public CPedAttractor
{ {
public: public:
virtual float GetHeadOfQueueWaitTime() override { return 2000.0f; } virtual float GetHeadOfQueueWaitTime() { return 2000.0f; }
virtual ePedAttractorType GetType() const override { return ATTRACTOR_PIZZA; } virtual ePedAttractorType GetType() const { return ATTRACTOR_PIZZA; }
virtual void UpdatePedStateOnDeparture(CPed* pPed) const override; virtual void UpdatePedStateOnDeparture(CPed* pPed) const;
CPedPizzaAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) : CPedPizzaAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) :
CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp) CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp)
{}; {};
@ -158,8 +158,8 @@ public:
class CPedSeatAttractor : public CPedAttractor class CPedSeatAttractor : public CPedAttractor
{ {
public: public:
virtual ePedAttractorType GetType() const override { return ATTRACTOR_SEAT; } virtual ePedAttractorType GetType() const { return ATTRACTOR_SEAT; }
virtual void UpdatePedStateOnDeparture(CPed* pPed) const override {}; virtual void UpdatePedStateOnDeparture(CPed* pPed) const {};
CPedSeatAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) : CPedSeatAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) :
CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp) CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp)
{}; {};
@ -169,12 +169,12 @@ class CPedShelterAttractor : public CPedAttractor
{ {
static std::vector<CVector> ms_displacements; static std::vector<CVector> ms_displacements;
public: public:
virtual ePedAttractorType GetType() const override { return ATTRACTOR_SHELTER; } virtual ePedAttractorType GetType() const { return ATTRACTOR_SHELTER; }
virtual bool BroadcastDeparture(CPed*) override; virtual bool BroadcastDeparture(CPed*);
virtual void UpdatePedStateOnDeparture(CPed* pPed) const override {}; virtual void UpdatePedStateOnDeparture(CPed* pPed) const {};
virtual bool IsAtHeadOfQueue(CPed* pPed) const override { return true; } virtual bool IsAtHeadOfQueue(CPed* pPed) const { return true; }
virtual void ComputeAttractPos(int qid, CVector& pos) const override; virtual void ComputeAttractPos(int qid, CVector& pos) const;
virtual void ComputeAttractHeading(int qid, float& heading) const override; virtual void ComputeAttractHeading(int qid, float& heading) const;
CPedShelterAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) : CPedShelterAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) :
CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp) CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp)
@ -187,8 +187,8 @@ public:
class CPedStopAttractor : public CPedAttractor class CPedStopAttractor : public CPedAttractor
{ {
public: public:
virtual ePedAttractorType GetType() const override { return ATTRACTOR_STOP; } virtual ePedAttractorType GetType() const { return ATTRACTOR_STOP; }
virtual void UpdatePedStateOnDeparture(CPed* pPed) const override {}; virtual void UpdatePedStateOnDeparture(CPed* pPed) const {};
CPedStopAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) : CPedStopAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) :
CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp) CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp)

View file

@ -5,8 +5,8 @@
#include "Camera.h" #include "Camera.h"
#include "CutsceneMgr.h" #include "CutsceneMgr.h"
#ifdef ASPECT_RATIO_SCALE
float CDraw::ms_fAspectRatio = DEFAULT_ASPECT_RATIO; float CDraw::ms_fAspectRatio = DEFAULT_ASPECT_RATIO;
#ifdef ASPECT_RATIO_SCALE
float CDraw::ms_fScaledFOV = 45.0f; float CDraw::ms_fScaledFOV = 45.0f;
#endif #endif

View file

@ -16,10 +16,10 @@ private:
static float ms_fNearClipZ; static float ms_fNearClipZ;
static float ms_fFarClipZ; static float ms_fFarClipZ;
static float ms_fFOV; static float ms_fFOV;
#ifdef ASPECT_RATIO_SCALE
// we use this variable to scale a lot of 2D elements // we use this variable to scale a lot of 2D elements
// so better cache it // so better cache it
static float ms_fAspectRatio; static float ms_fAspectRatio;
#ifdef ASPECT_RATIO_SCALE
// similar thing for 3D rendering // similar thing for 3D rendering
static float ms_fScaledFOV; static float ms_fScaledFOV;
#endif #endif

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

@ -1138,20 +1138,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

@ -1419,7 +1419,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

@ -21,7 +21,11 @@ char *_strdate(char *buf);
// 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
#include <IntSafe.h> #ifndef __MWERKS__
#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 )
@ -573,6 +577,9 @@ _RETEX:
} }
} }
#ifdef __MWERKS__
#pragma dont_inline on
#endif
void _psPrintCpuInfo() void _psPrintCpuInfo()
{ {
RwUInt32 features = _psGetCpuFeatures(); RwUInt32 features = _psGetCpuFeatures();
@ -587,6 +594,9 @@ void _psPrintCpuInfo()
if ( FeaturesEx & 0x80000000 ) if ( FeaturesEx & 0x80000000 )
debug("with 3DNow"); debug("with 3DNow");
} }
#ifdef __MWERKS__
#pragma dont_inline off
#endif
#endif #endif
/* /*

View file

@ -203,7 +203,7 @@ CText::GetNameOfLoadedMissionText(char *outName)
void void
CText::ReadChunkHeader(ChunkHeader *buf, int32 file, size_t *offset) CText::ReadChunkHeader(ChunkHeader *buf, int32 file, size_t *offset)
{ {
#if THIS_IS_STUPID #ifdef THIS_IS_STUPID
char *_buf = (char*)buf; char *_buf = (char*)buf;
for (int i = 0; i < sizeof(ChunkHeader); i++) { for (int i = 0; i < sizeof(ChunkHeader); i++) {
CFileMgr::Read(file, &_buf[i], 1); CFileMgr::Read(file, &_buf[i], 1);
@ -316,7 +316,7 @@ CKeyArray::Load(size_t length, int file, size_t* offset)
entries = new CKeyEntry[numEntries]; entries = new CKeyEntry[numEntries];
rawbytes = (char*)entries; rawbytes = (char*)entries;
#if THIS_IS_STUPID #ifdef THIS_IS_STUPID
for (uint32 i = 0; i < length; i++) { for (uint32 i = 0; i < length; i++) {
CFileMgr::Read(file, &rawbytes[i], 1); CFileMgr::Read(file, &rawbytes[i], 1);
(*offset)++; (*offset)++;
@ -391,7 +391,7 @@ CKeyArray::Search(const char *key, uint8 *result)
#endif #endif
*result = false; *result = false;
#ifdef MASTER #ifdef MASTER
sprintf(errstr, "%"); sprintf(errstr, "");
#else #else
sprintf(errstr, "%s missing", key); sprintf(errstr, "%s missing", key);
#endif // MASTER #endif // MASTER
@ -410,7 +410,7 @@ CData::Load(size_t length, int file, size_t * offset)
chars = new wchar[numChars]; chars = new wchar[numChars];
rawbytes = (char*)chars; rawbytes = (char*)chars;
#if THIS_IS_STUPID #ifdef THIS_IS_STUPID
for(uint32 i = 0; i < length; i++){ for(uint32 i = 0; i < length; i++){
CFileMgr::Read(file, &rawbytes[i], 1); CFileMgr::Read(file, &rawbytes[i], 1);
(*offset)++; (*offset)++;
@ -432,7 +432,7 @@ CData::Unload(void)
void void
CMissionTextOffsets::Load(size_t table_size, int file, size_t *offset, int) CMissionTextOffsets::Load(size_t table_size, int file, size_t *offset, int)
{ {
#if THIS_IS_STUPID #ifdef THIS_IS_STUPID
size_t num_of_entries = table_size / sizeof(CMissionTextOffsets::Entry); size_t num_of_entries = table_size / sizeof(CMissionTextOffsets::Entry);
for (size_t mi = 0; mi < num_of_entries; mi++) { for (size_t mi = 0; mi < num_of_entries; mi++) {
for (uint32 i = 0; i < sizeof(data[mi].szMissionName); i++) { for (uint32 i = 0; i < sizeof(data[mi].szMissionName); i++) {

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

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

View file

@ -57,7 +57,7 @@ int32 CWeaponInfo::ms_aMaxAmmoForWeapon[WEAPONTYPE_TOTALWEAPONS] =
-1, -1, -1, -1, -1, -1, -1, -1, -1 -1, -1, -1, -1, -1, -1, -1, -1, -1
}; };
CWeaponInfo CWeaponInfo::ms_apWeaponInfos[WEAPONTYPE_TOTALWEAPONS]; CWeaponInfo aWeaponInfo[WEAPONTYPE_TOTALWEAPONS];
char CWeaponInfo::ms_aWeaponNames[WEAPONTYPE_TOTALWEAPONS][32] = char CWeaponInfo::ms_aWeaponNames[WEAPONTYPE_TOTALWEAPONS][32] =
{ {
"Unarmed", "Unarmed",
@ -102,7 +102,7 @@ char CWeaponInfo::ms_aWeaponNames[WEAPONTYPE_TOTALWEAPONS][32] =
CWeaponInfo* CWeaponInfo*
CWeaponInfo::GetWeaponInfo(eWeaponType weaponType) CWeaponInfo::GetWeaponInfo(eWeaponType weaponType)
{ {
return &ms_apWeaponInfos[weaponType]; return &aWeaponInfo[weaponType];
} }
void void
@ -110,27 +110,27 @@ 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_fRange = 0.0f; aWeaponInfo[i].m_fRange = 0.0f;
ms_apWeaponInfos[i].m_nFiringRate = 0; aWeaponInfo[i].m_nFiringRate = 0;
ms_apWeaponInfos[i].m_nReload = 0; aWeaponInfo[i].m_nReload = 0;
ms_apWeaponInfos[i].m_nAmountofAmmunition = 0; aWeaponInfo[i].m_nAmountofAmmunition = 0;
ms_apWeaponInfos[i].m_nDamage = 0; aWeaponInfo[i].m_nDamage = 0;
ms_apWeaponInfos[i].m_fSpeed = 0.0f; aWeaponInfo[i].m_fSpeed = 0.0f;
ms_apWeaponInfos[i].m_fRadius = 0.0f; aWeaponInfo[i].m_fRadius = 0.0f;
ms_apWeaponInfos[i].m_fLifespan = 0.0f; aWeaponInfo[i].m_fLifespan = 0.0f;
ms_apWeaponInfos[i].m_fSpread = 0.0f; aWeaponInfo[i].m_fSpread = 0.0f;
ms_apWeaponInfos[i].m_vecFireOffset = CVector(0.0f, 0.0f, 0.0f); aWeaponInfo[i].m_vecFireOffset = CVector(0.0f, 0.0f, 0.0f);
ms_apWeaponInfos[i].m_AnimToPlay = ASSOCGRP_UNARMED; aWeaponInfo[i].m_AnimToPlay = ASSOCGRP_UNARMED;
ms_apWeaponInfos[i].m_fAnimLoopStart = 0.0f; aWeaponInfo[i].m_fAnimLoopStart = 0.0f;
ms_apWeaponInfos[i].m_fAnimLoopEnd = 0.0f; aWeaponInfo[i].m_fAnimLoopEnd = 0.0f;
ms_apWeaponInfos[i].m_fAnimFrameFire = 0.0f; aWeaponInfo[i].m_fAnimFrameFire = 0.0f;
ms_apWeaponInfos[i].m_fAnim2LoopStart = 0.0f; aWeaponInfo[i].m_fAnim2LoopStart = 0.0f;
ms_apWeaponInfos[i].m_fAnim2LoopEnd = 0.0f; aWeaponInfo[i].m_fAnim2LoopEnd = 0.0f;
ms_apWeaponInfos[i].m_fAnim2FrameFire = 0.0f; aWeaponInfo[i].m_fAnim2FrameFire = 0.0f;
ms_apWeaponInfos[i].m_fAnimBreakout = 0.0f; aWeaponInfo[i].m_fAnimBreakout = 0.0f;
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;
ms_apWeaponInfos[i].m_nWeaponSlot = WEAPONSLOT_UNARMED; aWeaponInfo[i].m_nWeaponSlot = WEAPONSLOT_UNARMED;
} }
debug("Loading weapon data...\n"); debug("Loading weapon data...\n");
LoadWeaponData(); LoadWeaponData();
@ -221,31 +221,31 @@ CWeaponInfo::LoadWeaponData(void)
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_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_fAnim2LoopStart = anim2LoopStart / 30.0f; aWeaponInfo[weaponType].m_fAnim2LoopStart = anim2LoopStart / 30.0f;
ms_apWeaponInfos[weaponType].m_fAnim2LoopEnd = anim2LoopEnd / 30.0f; aWeaponInfo[weaponType].m_fAnim2LoopEnd = anim2LoopEnd / 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_fAnimBreakout = animBreakout / 30.0f; aWeaponInfo[weaponType].m_fAnimBreakout = animBreakout / 30.0f;
ms_apWeaponInfos[weaponType].m_nModelId = modelId; aWeaponInfo[weaponType].m_nModelId = modelId;
ms_apWeaponInfos[weaponType].m_nModel2Id = modelId2; aWeaponInfo[weaponType].m_nModel2Id = modelId2;
ms_apWeaponInfos[weaponType].m_Flags = flags; aWeaponInfo[weaponType].m_Flags = flags;
ms_apWeaponInfos[weaponType].m_nWeaponSlot = weaponSlot; aWeaponInfo[weaponType].m_nWeaponSlot = weaponSlot;
if (animLoopEnd < 98.0f && weaponType != WEAPONTYPE_FLAMETHROWER && !CWeapon::IsShotgun(weaponType)) if (animLoopEnd < 98.0f && weaponType != WEAPONTYPE_FLAMETHROWER && !CWeapon::IsShotgun(weaponType))
ms_apWeaponInfos[weaponType].m_nFiringRate = ((ms_apWeaponInfos[weaponType].m_fAnimLoopEnd - ms_apWeaponInfos[weaponType].m_fAnimLoopStart) * 900.0f); aWeaponInfo[weaponType].m_nFiringRate = ((aWeaponInfo[weaponType].m_fAnimLoopEnd - aWeaponInfo[weaponType].m_fAnimLoopStart) * 900.0f);
if (weaponType == WEAPONTYPE_DETONATOR || weaponType == WEAPONTYPE_HELICANNON) if (weaponType == WEAPONTYPE_DETONATOR || weaponType == WEAPONTYPE_HELICANNON)
modelId = -1; modelId = -1;
@ -257,7 +257,7 @@ CWeaponInfo::LoadWeaponData(void)
for (int i = 0; i < NUM_ANIM_ASSOC_GROUPS; i++) { for (int i = 0; i < NUM_ANIM_ASSOC_GROUPS; i++) {
if (!strcmp(animToPlay, CAnimManager::GetAnimGroupName((AssocGroupId)i))) { if (!strcmp(animToPlay, CAnimManager::GetAnimGroupName((AssocGroupId)i))) {
ms_apWeaponInfos[weaponType].m_AnimToPlay = (AssocGroupId)i; aWeaponInfo[weaponType].m_AnimToPlay = (AssocGroupId)i;
break; break;
} }
} }

View file

@ -31,7 +31,6 @@ enum
}; };
class CWeaponInfo { class CWeaponInfo {
static CWeaponInfo ms_apWeaponInfos[WEAPONTYPE_TOTALWEAPONS];
static char ms_aWeaponNames[WEAPONTYPE_TOTALWEAPONS][32]; static char ms_aWeaponNames[WEAPONTYPE_TOTALWEAPONS][32];
public: public:
static uint16 ms_aReloadSampleTime[WEAPONTYPE_TOTALWEAPONS]; static uint16 ms_aReloadSampleTime[WEAPONTYPE_TOTALWEAPONS];