Merge remote-tracking branch 'Fire-Head/master'

# Conflicts:
#	src/core/Radar.cpp
This commit is contained in:
Sergeanur 2020-04-09 21:40:46 +03:00
commit a5239b554f
20 changed files with 1726 additions and 915 deletions

View File

@ -1129,8 +1129,8 @@ void CReplay::StoreStuffInMem(void)
pEmptyReferences = CReferences::pEmptyList; pEmptyReferences = CReferences::pEmptyList;
pStoredCam = new uint8[sizeof(CCamera)]; pStoredCam = new uint8[sizeof(CCamera)];
memcpy(pStoredCam, &TheCamera, sizeof(CCamera)); memcpy(pStoredCam, &TheCamera, sizeof(CCamera));
pRadarBlips = new uint8[sizeof(CBlip) * NUMRADARBLIPS]; pRadarBlips = new uint8[sizeof(sRadarTrace) * NUMRADARBLIPS];
memcpy(pRadarBlips, CRadar::ms_RadarTrace, NUMRADARBLIPS * sizeof(CBlip)); memcpy(pRadarBlips, CRadar::ms_RadarTrace, NUMRADARBLIPS * sizeof(sRadarTrace));
PlayerWanted = *FindPlayerPed()->m_pWanted; PlayerWanted = *FindPlayerPed()->m_pWanted;
PlayerInfo = CWorld::Players[0]; PlayerInfo = CWorld::Players[0];
Time1 = CTimer::GetTimeInMilliseconds(); Time1 = CTimer::GetTimeInMilliseconds();
@ -1179,7 +1179,7 @@ void CReplay::RestoreStuffFromMem(void)
memcpy(&TheCamera, pStoredCam, sizeof(CCamera)); memcpy(&TheCamera, pStoredCam, sizeof(CCamera));
delete[] pStoredCam; delete[] pStoredCam;
pStoredCam = nil; pStoredCam = nil;
memcpy(CRadar::ms_RadarTrace, pRadarBlips, sizeof(CBlip) * NUMRADARBLIPS); memcpy(CRadar::ms_RadarTrace, pRadarBlips, sizeof(sRadarTrace) * NUMRADARBLIPS);
delete[] pRadarBlips; delete[] pRadarBlips;
pRadarBlips = nil; pRadarBlips = nil;
FindPlayerPed()->m_pWanted = new CWanted(PlayerWanted); FindPlayerPed()->m_pWanted = new CWanted(PlayerWanted);

View File

@ -91,10 +91,10 @@ uint8 (&CTheScripts::ScriptSpace)[SIZE_SCRIPT_SPACE] = *(uint8(*)[SIZE_SCRIPT_SP
CRunningScript(&CTheScripts::ScriptsArray)[MAX_NUM_SCRIPTS] = *(CRunningScript(*)[MAX_NUM_SCRIPTS])*(uintptr*)0x6F5C08; CRunningScript(&CTheScripts::ScriptsArray)[MAX_NUM_SCRIPTS] = *(CRunningScript(*)[MAX_NUM_SCRIPTS])*(uintptr*)0x6F5C08;
int32(&CTheScripts::BaseBriefIdForContact)[MAX_NUM_CONTACTS] = *(int32(*)[MAX_NUM_CONTACTS])*(uintptr*)0x880200; int32(&CTheScripts::BaseBriefIdForContact)[MAX_NUM_CONTACTS] = *(int32(*)[MAX_NUM_CONTACTS])*(uintptr*)0x880200;
int32(&CTheScripts::OnAMissionForContactFlag)[MAX_NUM_CONTACTS] = *(int32(*)[MAX_NUM_CONTACTS])*(uintptr*)0x8622F0; int32(&CTheScripts::OnAMissionForContactFlag)[MAX_NUM_CONTACTS] = *(int32(*)[MAX_NUM_CONTACTS])*(uintptr*)0x8622F0;
CTextLine (&CTheScripts::IntroTextLines)[MAX_NUM_INTRO_TEXT_LINES] = *(CTextLine (*)[MAX_NUM_INTRO_TEXT_LINES])*(uintptr*)0x70EA68; intro_text_line (&CTheScripts::IntroTextLines)[MAX_NUM_INTRO_TEXT_LINES] = *(intro_text_line (*)[MAX_NUM_INTRO_TEXT_LINES])*(uintptr*)0x70EA68;
CScriptRectangle (&CTheScripts::IntroRectangles)[MAX_NUM_INTRO_RECTANGLES] = *(CScriptRectangle (*)[MAX_NUM_INTRO_RECTANGLES])*(uintptr*)0x72D108; intro_script_rectangle (&CTheScripts::IntroRectangles)[MAX_NUM_INTRO_RECTANGLES] = *(intro_script_rectangle (*)[MAX_NUM_INTRO_RECTANGLES])*(uintptr*)0x72D108;
CSprite2d (&CTheScripts::ScriptSprites)[MAX_NUM_SCRIPT_SRPITES] = *(CSprite2d(*)[MAX_NUM_SCRIPT_SRPITES])*(uintptr*)0x72B090; CSprite2d (&CTheScripts::ScriptSprites)[MAX_NUM_SCRIPT_SRPITES] = *(CSprite2d(*)[MAX_NUM_SCRIPT_SRPITES])*(uintptr*)0x72B090;
CScriptSphere(&CTheScripts::ScriptSphereArray)[MAX_NUM_SCRIPT_SPHERES] = *(CScriptSphere(*)[MAX_NUM_SCRIPT_SPHERES])*(uintptr*)0x727D60; script_sphere_struct(&CTheScripts::ScriptSphereArray)[MAX_NUM_SCRIPT_SPHERES] = *(script_sphere_struct(*)[MAX_NUM_SCRIPT_SPHERES])*(uintptr*)0x727D60;
tCollectiveData(&CTheScripts::CollectiveArray)[MAX_NUM_COLLECTIVES] = *(tCollectiveData(*)[MAX_NUM_COLLECTIVES])*(uintptr*)0x6FA008; tCollectiveData(&CTheScripts::CollectiveArray)[MAX_NUM_COLLECTIVES] = *(tCollectiveData(*)[MAX_NUM_COLLECTIVES])*(uintptr*)0x6FA008;
tUsedObject(&CTheScripts::UsedObjectArray)[MAX_NUM_USED_OBJECTS] = *(tUsedObject(*)[MAX_NUM_USED_OBJECTS])*(uintptr*)0x6E69C8; tUsedObject(&CTheScripts::UsedObjectArray)[MAX_NUM_USED_OBJECTS] = *(tUsedObject(*)[MAX_NUM_USED_OBJECTS])*(uintptr*)0x6E69C8;
int32(&CTheScripts::MultiScriptArray)[MAX_NUM_MISSION_SCRIPTS] = *(int32(*)[MAX_NUM_MISSION_SCRIPTS])*(uintptr*)0x6F0558; int32(&CTheScripts::MultiScriptArray)[MAX_NUM_MISSION_SCRIPTS] = *(int32(*)[MAX_NUM_MISSION_SCRIPTS])*(uintptr*)0x6F0558;
@ -313,7 +313,7 @@ bool CUpsideDownCarCheck::HasCarBeenUpsideDownForAWhile(int32 id)
return false; return false;
} }
void CStuckCarCheckEntry::Reset() void stuck_car_data::Reset()
{ {
m_nVehicleIndex = -1; m_nVehicleIndex = -1;
m_vecPos = CVector(-5000.0f, -5000.0f, -5000.0f); m_vecPos = CVector(-5000.0f, -5000.0f, -5000.0f);

View File

@ -15,22 +15,25 @@ class CRunningScript;
#define KEY_LENGTH_IN_SCRIPT 8 #define KEY_LENGTH_IN_SCRIPT 8
struct CScriptRectangle struct intro_script_rectangle
{ {
bool m_bIsUsed; bool m_bIsUsed;
bool m_bBeforeFade; bool m_bBeforeFade;
int16 m_nTextureId; int16 m_nTextureId;
CRect m_sRect; CRect m_sRect;
CRGBA m_sColor; CRGBA m_sColor;
intro_script_rectangle() { }
~intro_script_rectangle() { }
}; };
static_assert(sizeof(CScriptRectangle) == 0x18, "Script.h: error"); static_assert(sizeof(intro_script_rectangle) == 0x18, "Script.h: error");
enum { enum {
SCRIPT_TEXT_MAX_LENGTH = 500 SCRIPT_TEXT_MAX_LENGTH = 500
}; };
struct CTextLine struct intro_text_line
{ {
float m_fScaleX; float m_fScaleX;
float m_fScaleY; float m_fScaleY;
@ -50,6 +53,9 @@ struct CTextLine
float m_fAtY; float m_fAtY;
wchar m_Text[SCRIPT_TEXT_MAX_LENGTH]; wchar m_Text[SCRIPT_TEXT_MAX_LENGTH];
intro_text_line() { }
~intro_text_line() { }
void Reset() void Reset()
{ {
m_fScaleX = 0.48f; m_fScaleX = 0.48f;
@ -72,15 +78,17 @@ struct CTextLine
} }
}; };
static_assert(sizeof(CTextLine) == 0x414, "Script.h: error"); static_assert(sizeof(intro_text_line) == 0x414, "Script.h: error");
struct CScriptSphere struct script_sphere_struct
{ {
bool m_bInUse; bool m_bInUse;
uint16 m_Index; uint16 m_Index;
uint32 m_Id; uint32 m_Id;
CVector m_vecCenter; CVector m_vecCenter;
float m_fRadius; float m_fRadius;
script_sphere_struct() { }
}; };
struct CStoredLine struct CStoredLine
@ -145,7 +153,7 @@ public:
bool HasCarBeenUpsideDownForAWhile(int32); bool HasCarBeenUpsideDownForAWhile(int32);
}; };
struct CStuckCarCheckEntry struct stuck_car_data
{ {
int32 m_nVehicleIndex; int32 m_nVehicleIndex;
CVector m_vecPos; CVector m_vecPos;
@ -154,12 +162,13 @@ struct CStuckCarCheckEntry
uint32 m_nStuckTime; uint32 m_nStuckTime;
bool m_bStuck; bool m_bStuck;
stuck_car_data() { }
inline void Reset(); inline void Reset();
}; };
class CStuckCarCheck class CStuckCarCheck
{ {
CStuckCarCheckEntry m_sCars[MAX_STUCK_CAR_CHECKS]; stuck_car_data m_sCars[MAX_STUCK_CAR_CHECKS];
public: public:
void Init(); void Init();
@ -235,10 +244,10 @@ class CTheScripts
static CRunningScript(&ScriptsArray)[MAX_NUM_SCRIPTS]; static CRunningScript(&ScriptsArray)[MAX_NUM_SCRIPTS];
static int32(&BaseBriefIdForContact)[MAX_NUM_CONTACTS]; static int32(&BaseBriefIdForContact)[MAX_NUM_CONTACTS];
static int32(&OnAMissionForContactFlag)[MAX_NUM_CONTACTS]; static int32(&OnAMissionForContactFlag)[MAX_NUM_CONTACTS];
static CTextLine(&IntroTextLines)[MAX_NUM_INTRO_TEXT_LINES]; static intro_text_line(&IntroTextLines)[MAX_NUM_INTRO_TEXT_LINES];
static CScriptRectangle(&IntroRectangles)[MAX_NUM_INTRO_RECTANGLES]; static intro_script_rectangle(&IntroRectangles)[MAX_NUM_INTRO_RECTANGLES];
static CSprite2d(&ScriptSprites)[MAX_NUM_SCRIPT_SRPITES]; static CSprite2d(&ScriptSprites)[MAX_NUM_SCRIPT_SRPITES];
static CScriptSphere(&ScriptSphereArray)[MAX_NUM_SCRIPT_SPHERES]; static script_sphere_struct(&ScriptSphereArray)[MAX_NUM_SCRIPT_SPHERES];
static tCollectiveData(&CollectiveArray)[MAX_NUM_COLLECTIVES]; static tCollectiveData(&CollectiveArray)[MAX_NUM_COLLECTIVES];
static tUsedObject(&UsedObjectArray)[MAX_NUM_USED_OBJECTS]; static tUsedObject(&UsedObjectArray)[MAX_NUM_USED_OBJECTS];
static int32(&MultiScriptArray)[MAX_NUM_MISSION_SCRIPTS]; static int32(&MultiScriptArray)[MAX_NUM_MISSION_SCRIPTS];

View File

@ -142,7 +142,7 @@ CCamera::Init(void)
PlayerExhaustion = 1.0f; PlayerExhaustion = 1.0f;
DebugCamMode = CCam::MODE_NONE; DebugCamMode = CCam::MODE_NONE;
m_PedOrientForBehindOrInFront = 0.0f; m_PedOrientForBehindOrInFront = 0.0f;
if(!FrontEndMenuManager.m_bStartGameLoading){ if(!FrontEndMenuManager.m_bWantToRestart){
m_bFading = false; m_bFading = false;
CDraw::FadeValue = 0; CDraw::FadeValue = 0;
m_fFLOATingFade = 0.0f; m_fFLOATingFade = 0.0f;
@ -151,7 +151,7 @@ CCamera::Init(void)
m_fFLOATingFadeMusic = 0.0f; m_fFLOATingFadeMusic = 0.0f;
} }
m_bMoveCamToAvoidGeom = false; m_bMoveCamToAvoidGeom = false;
if(FrontEndMenuManager.m_bStartGameLoading) if(FrontEndMenuManager.m_bWantToRestart)
m_bMoveCamToAvoidGeom = true; m_bMoveCamToAvoidGeom = true;
m_bStartingSpline = false; m_bStartingSpline = false;
m_iTypeOfSwitch = INTERPOLATION; m_iTypeOfSwitch = INTERPOLATION;

View File

@ -555,7 +555,7 @@ void CMenuManager::DoSettingsBeforeStartingAGame()
m_PrefsVsync = m_PrefsVsyncDisp; m_PrefsVsync = m_PrefsVsyncDisp;
DMAudio.Service(); DMAudio.Service();
m_bStartGameLoading = true; m_bWantToRestart = true;
ShutdownJustMenu(); ShutdownJustMenu();
UnloadTextures(); UnloadTextures();
@ -2819,7 +2819,7 @@ void CMenuManager::Process(void)
if (!m_bSaveMenuActive && TheCamera.GetScreenFadeStatus() != FADE_0) if (!m_bSaveMenuActive && TheCamera.GetScreenFadeStatus() != FADE_0)
return; return;
m_bStartGameLoading = false; m_bWantToRestart = false;
InitialiseChangedLanguageSettings(); InitialiseChangedLanguageSettings();
if (CPad::GetPad(0)->GetEscapeJustDown()) if (CPad::GetPad(0)->GetEscapeJustDown())
@ -2861,9 +2861,9 @@ void CMenuManager::Process(void)
if (m_PrefsVsyncDisp != m_PrefsVsync) if (m_PrefsVsyncDisp != m_PrefsVsync)
m_PrefsVsync = m_PrefsVsyncDisp; m_PrefsVsync = m_PrefsVsyncDisp;
DMAudio.Service(); DMAudio.Service();
m_bStartGameLoading = true; m_bWantToRestart = true;
RequestFrontEndShutDown(); RequestFrontEndShutDown();
m_bLoadingSavedGame = true; m_bWantToLoad = true;
b_FoundRecentSavedGameWantToLoad = true; b_FoundRecentSavedGameWantToLoad = true;
DMAudio.SetEffectsFadeVol(0); DMAudio.SetEffectsFadeVol(0);
DMAudio.SetMusicFadeVol(0); DMAudio.SetMusicFadeVol(0);
@ -2960,7 +2960,7 @@ void CMenuManager::Process(void)
m_bWaitingForNewKeyBind = false; m_bWaitingForNewKeyBind = false;
} }
if (!m_bStartGameLoading) { if (!m_bWantToRestart) {
if (m_bGameNotLoaded) if (m_bGameNotLoaded)
DMAudio.Service(); DMAudio.Service();
} }

View File

@ -464,7 +464,7 @@ public:
bool m_bMenuActive; bool m_bMenuActive;
bool m_bMenuStateChanged; bool m_bMenuStateChanged;
bool m_bWaitingForNewKeyBind; bool m_bWaitingForNewKeyBind;
bool m_bStartGameLoading; bool m_bWantToRestart;
bool m_bFirstTime; bool m_bFirstTime;
bool m_bGameNotLoaded; bool m_bGameNotLoaded;
int32 m_nMousePosX; int32 m_nMousePosX;
@ -484,7 +484,7 @@ public:
bool m_bQuitGameNoCD; bool m_bQuitGameNoCD;
bool m_bRenderGameInMenu; bool m_bRenderGameInMenu;
bool m_bSaveMenuActive; bool m_bSaveMenuActive;
bool m_bLoadingSavedGame; bool m_bWantToLoad;
char field_455; char field_455;
bool m_bStartWaitingForKeyBind; bool m_bStartWaitingForKeyBind;
bool m_bSpritesLoaded; bool m_bSpritesLoaded;

View File

@ -89,8 +89,6 @@
#define DEFAULT_VIEWWINDOW (0.7f)
eLevelName &CGame::currLevel = *(eLevelName*)0x941514; eLevelName &CGame::currLevel = *(eLevelName*)0x941514;
bool &CGame::bDemoMode = *(bool*)0x5F4DD0; bool &CGame::bDemoMode = *(bool*)0x5F4DD0;
bool &CGame::nastyGame = *(bool*)0x5F4DD4; bool &CGame::nastyGame = *(bool*)0x5F4DD4;
@ -492,7 +490,7 @@ void CGame::ReInitGameObjectVariables(void)
CParticle::ReloadConfig(); CParticle::ReloadConfig();
CCullZones::ResolveVisibilities(); CCullZones::ResolveVisibilities();
if ( !FrontEndMenuManager.m_bLoadingSavedGame ) if ( !FrontEndMenuManager.m_bWantToLoad )
{ {
CCranes::InitCranes(); CCranes::InitCranes();
CTheScripts::StartTestScript(); CTheScripts::StartTestScript();
@ -566,7 +564,7 @@ void CGame::InitialiseWhenRestarting(void)
TheCamera.Init(); TheCamera.Init();
if ( FrontEndMenuManager.m_bLoadingSavedGame == true ) if ( FrontEndMenuManager.m_bWantToLoad == true )
{ {
RestoreForStartLoad(); RestoreForStartLoad();
CStreaming::LoadScene(TheCamera.GetPosition()); CStreaming::LoadScene(TheCamera.GetPosition());
@ -574,7 +572,7 @@ void CGame::InitialiseWhenRestarting(void)
ReInitGameObjectVariables(); ReInitGameObjectVariables();
if ( FrontEndMenuManager.m_bLoadingSavedGame == true ) if ( FrontEndMenuManager.m_bWantToLoad == true )
{ {
if ( GenericLoad() == true ) if ( GenericLoad() == true )
{ {
@ -593,7 +591,7 @@ void CGame::InitialiseWhenRestarting(void)
ShutDownForRestart(); ShutDownForRestart();
CTimer::Stop(); CTimer::Stop();
CTimer::Initialise(); CTimer::Initialise();
FrontEndMenuManager.m_bLoadingSavedGame = false; FrontEndMenuManager.m_bWantToLoad = false;
ReInitGameObjectVariables(); ReInitGameObjectVariables();
currLevel = LEVEL_INDUSTRIAL; currLevel = LEVEL_INDUSTRIAL;
CCollision::SortOutCollisionAfterLoad(); CCollision::SortOutCollisionAfterLoad();
@ -609,6 +607,9 @@ extern void (*DebugMenuProcess)(void);
void CGame::Process(void) void CGame::Process(void)
{ {
CPad::UpdatePads(); CPad::UpdatePads();
#ifdef GTA_PS2
ProcessTidyUpMemory();
#endif
TheCamera.SetMotionBlurAlpha(0); TheCamera.SetMotionBlurAlpha(0);
if (TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_SNIPER || TheCamera.m_BlurType == MBLUR_NORMAL) if (TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_SNIPER || TheCamera.m_BlurType == MBLUR_NORMAL)
TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE); TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE);
@ -695,6 +696,13 @@ void CGame::TidyUpMemory(bool, bool)
#endif #endif
} }
void CGame::ProcessTidyUpMemory(void)
{
#ifdef PS2
// meow
#endif
}
STARTPATCHES STARTPATCHES
InjectHook(0x48BB80, CGame::InitialiseOnceBeforeRW, PATCH_JUMP); InjectHook(0x48BB80, CGame::InitialiseOnceBeforeRW, PATCH_JUMP);
InjectHook(0x48BBA0, CGame::InitialiseRenderWare, PATCH_JUMP); InjectHook(0x48BBA0, CGame::InitialiseRenderWare, PATCH_JUMP);

View File

@ -39,4 +39,5 @@ public:
// NB: these do something on PS2 // NB: these do something on PS2
static void TidyUpMemory(bool, bool); static void TidyUpMemory(bool, bool);
static void DrasticTidyUpMemory(bool); static void DrasticTidyUpMemory(bool);
static void ProcessTidyUpMemory(void);
}; };

View File

@ -38,6 +38,7 @@ CMousePointerStateHelper &MousePointerStateHelper = *(CMousePointerStateHelper*)
bool &CPad::bDisplayNoControllerMessage = *(bool *)0x95CD52; bool &CPad::bDisplayNoControllerMessage = *(bool *)0x95CD52;
bool &CPad::bObsoleteControllerMessage = *(bool *)0x95CDB8; bool &CPad::bObsoleteControllerMessage = *(bool *)0x95CDB8;
bool CPad::bOldDisplayNoControllerMessage;
bool &CPad::m_bMapPadOneToPadTwo = *(bool *)0x95CD48; bool &CPad::m_bMapPadOneToPadTwo = *(bool *)0x95CD48;
CKeyboardState &CPad::OldKeyState = *(CKeyboardState*)0x6F1E70; CKeyboardState &CPad::OldKeyState = *(CKeyboardState*)0x6F1E70;
@ -329,6 +330,21 @@ void CKeyboardState::Clear()
LWIN = RWIN = APPS = 0; LWIN = RWIN = APPS = 0;
} }
#ifdef GTA_PS2_STUFF
void CPad::Initialise(void)
{
for (int i = 0; i < MAX_PADS; i++)
{
CPad::GetPad(i)->Clear(true);
CPad::GetPad(i)->Mode = 0;
}
bObsoleteControllerMessage = false;
bOldDisplayNoControllerMessage = false;
bDisplayNoControllerMessage = false;
}
#endif
void CPad::Clear(bool bResetPlayerControls) void CPad::Clear(bool bResetPlayerControls)
{ {
NewState.Clear(); NewState.Clear();
@ -356,13 +372,13 @@ void CPad::Clear(bool bResetPlayerControls)
bApplyBrakes = false; bApplyBrakes = false;
for ( int32 i = 0; i < _TODOCONST(5); i++ ) for ( int32 i = 0; i < HORNHISTORY_SIZE; i++ )
bHornHistory[i] = false; bHornHistory[i] = false;
iCurrHornHistory = 0; iCurrHornHistory = 0;
for ( int32 i = 0; i < _TODOCONST(12); i++ ) for ( int32 i = 0; i < ARRAY_SIZE(CheatString); i++ )
_unk[i] = ' '; CheatString[i] = ' ';
LastTimeTouched = CTimer::GetTimeInMilliseconds(); LastTimeTouched = CTimer::GetTimeInMilliseconds();
AverageWeapon = 0; AverageWeapon = 0;
@ -621,6 +637,108 @@ void CPad::StartShake_Train(float fX, float fY)
} }
} }
#ifdef GTA_PS2_STUFF
void CPad::AddToCheatString(char c)
{
for ( int32 i = ARRAY_SIZE(CheatString) - 2; i >= 0; i-- )
CheatString[i + 1] = CheatString[i];
#define _CHEATCMP(str) strncmp(str, CheatString, sizeof(str)-1)
// "4414LDRULDRU" - R2 R2 L1 R2 LEFT DOWN RIGHT UP LEFT DOWN RIGHT UP
if ( !_CHEATCMP("URDLURDL4144") )
WeaponCheat();
// "4411LDRULDRU" - R2 R2 L1 L1 LEFT DOWN RIGHT UP LEFT DOWN RIGHT UP
else if ( !_CHEATCMP("URDLURDL1144") )
MoneyCheat();
// "4412LDRULDRU" - R2 R2 L1 L2 LEFT DOWN RIGHT UP LEFT DOWN RIGHT UP
else if ( !_CHEATCMP("URDLURDL2144") )
ArmourCheat();
// "4413LDRULDRU" - R2 R2 L1 R1 LEFT DOWN RIGHT UP LEFT DOWN RIGHT UP
else if ( !_CHEATCMP("URDLURDL3144") )
HealthCheat();
// "4414LRLRLR" - R2 R2 L1 R2 LEFT RIGHT LEFT RIGHT LEFT RIGHT
else if ( !_CHEATCMP("RLRLRL4144") )
WantedLevelUpCheat();
// "4414UDUDUD" - R2 R2 L1 R2 UP DOWN UP DOWN UP DOWN
else if ( !_CHEATCMP("DUDUDU4144") )
WantedLevelDownCheat();
// "1234432T" - L1 L2 R1 R2 R2 R1 L2 TRIANGLE
else if ( !_CHEATCMP("T2344321") )
SunnyWeatherCheat();
// "1234432S" - L1 L2 R1 R2 R2 R1 L2 SQUARE
else if ( !_CHEATCMP("S2344321") )
CloudyWeatherCheat();
// "1234432C" - L1 L2 R1 R2 R2 R1 L2 CIRCLE
else if ( !_CHEATCMP("C2344321") )
RainyWeatherCheat();
// "1234432X" - L1 L2 R1 R2 R2 R1 L2 CROSS
else if ( !_CHEATCMP("X2344321") )
FoggyWeatherCheat();
// "CCCCCC321TCT" - CIRCLE CIRCLE CIRCLE CIRCLE CIRCLE CIRCLE R1 L2 L1 TRIANGLE CIRCLE TRIANGLE
else if ( !_CHEATCMP("TCT123CCCCCC") )
TankCheat();
// "CCCSSSSS1TCT" - CIRCLE CIRCLE CIRCLE SQUARE SQUARE SQUARE SQUARE SQUARE L1 TRIANGLE CIRCLE TRIANGLE
else if ( !_CHEATCMP("TCT1SSSSSCCC") )
FastWeatherCheat();
// "241324TSCT21" - L2 R2 L1 R1 L2 R2 TRIANGLE SQUARE CIRCLE TRIANGLE L2 L1
else if ( !_CHEATCMP("12TCST423142") )
BlowUpCarsCheat();
// "RDLU12ULDR" - RIGHT DOWN LEFT UP L1 L2 UP LEFT DOWN RIGHT
else if ( !_CHEATCMP("RDLU21ULDR") )
ChangePlayerCheat();
// "DULUX3421" - DOWN UP LEFT UP CROSS R1 R2 L2 L1
else if ( !_CHEATCMP("1243XULUD") )
MayhemCheat();
// "DULUX3412" - DOWN UP LEFT UP CROSS R1 R2 L1 L2
else if ( !_CHEATCMP("2143XULUD") )
EverybodyAttacksPlayerCheat();
// "43TX21UD" - R2 R1 TRIANGLE CROSS L2 L1 UP DOWN
else if ( !_CHEATCMP("DU12XT34") )
WeaponsForAllCheat();
// "TURDS12" - TRIANGLE UP RIGHT DOWN SQUARE L1 L2
else if ( !_CHEATCMP("21SDRUT") )
FastTimeCheat();
// "TURDS34" - TRIANGLE UP RIGHT DOWN SQUARE R1 R2
else if ( !_CHEATCMP("43SDRUT") )
SlowTimeCheat();
// "11S4T1T" - L1 L1 SQUARE R2 TRIANGLE L1 TRIANGLE
else if ( !_CHEATCMP("T1T4S11") )
OnlyRenderWheelsCheat();
// "R4C32D13" - RIGHT R2 CIRCLE R1 L2 DOWN L1 R1
else if ( !_CHEATCMP("31D23C4R") )
ChittyChittyBangBangCheat();
// "3141L33T" - R1 L1 R2 L1 LEFT R1 R1 TRIANGLE
else if ( !_CHEATCMP("T33L1413") )
StrongGripCheat();
// "S1CD13TR1X" - SQUARE L1 CIRCLE DOWN L1 R1 TRIANGLE RIGHT L1 CROSS
else if ( !_CHEATCMP("X1RT31DC1S") )
NastyLimbsCheat();
#undef _CHEATCMP
}
#endif
void CPad::AddToPCCheatString(char c) void CPad::AddToPCCheatString(char c)
{ {
for ( int32 i = ARRAY_SIZE(KeyBoardCheatString) - 2; i >= 0; i-- ) for ( int32 i = ARRAY_SIZE(KeyBoardCheatString) - 2; i >= 0; i-- )
@ -858,7 +976,7 @@ void CPad::Update(int16 unk)
ProcessPCSpecificStuff(); ProcessPCSpecificStuff();
if ( ++iCurrHornHistory >= _TODOCONST(5) ) if ( ++iCurrHornHistory >= HORNHISTORY_SIZE )
iCurrHornHistory = 0; iCurrHornHistory = 0;
bHornHistory[iCurrHornHistory] = GetHorn(); bHornHistory[iCurrHornHistory] = GetHorn();
@ -875,7 +993,7 @@ void CPad::DoCheats(void)
void CPad::DoCheats(int16 unk) void CPad::DoCheats(int16 unk)
{ {
#ifdef PS2 #ifdef GTA_PS2_STUFF
if ( GetTriangleJustDown() ) if ( GetTriangleJustDown() )
AddToCheatString('T'); AddToCheatString('T');

View File

@ -136,6 +136,10 @@ enum
class CPad class CPad
{ {
public: public:
enum
{
HORNHISTORY_SIZE = 5,
};
CControllerState NewState; CControllerState NewState;
CControllerState OldState; CControllerState OldState;
CControllerState PCTempKeyState; CControllerState PCTempKeyState;
@ -146,11 +150,11 @@ public:
int16 Mode; int16 Mode;
int16 ShakeDur; int16 ShakeDur;
uint8 ShakeFreq; uint8 ShakeFreq;
bool bHornHistory[5]; bool bHornHistory[HORNHISTORY_SIZE];
uint8 iCurrHornHistory; uint8 iCurrHornHistory;
uint8 DisablePlayerControls; uint8 DisablePlayerControls;
int8 bApplyBrakes; int8 bApplyBrakes;
char _unk[12]; //int32 unk[3]; char CheatString[12];
char _pad0[3]; char _pad0[3];
int32 LastTimeTouched; int32 LastTimeTouched;
int32 AverageWeapon; int32 AverageWeapon;
@ -161,6 +165,7 @@ public:
static bool &bDisplayNoControllerMessage; static bool &bDisplayNoControllerMessage;
static bool &bObsoleteControllerMessage; static bool &bObsoleteControllerMessage;
static bool bOldDisplayNoControllerMessage;
static bool &m_bMapPadOneToPadTwo; static bool &m_bMapPadOneToPadTwo;
static CKeyboardState &OldKeyState; static CKeyboardState &OldKeyState;
@ -172,8 +177,9 @@ public:
static CMouseControllerState &PCTempMouseControllerState; static CMouseControllerState &PCTempMouseControllerState;
#ifdef GTA_PS2_STUFF
static void Initialise(void);
#endif
void Clear(bool bResetPlayerControls); void Clear(bool bResetPlayerControls);
void ClearMouseHistory(); void ClearMouseHistory();
void UpdateMouse(); void UpdateMouse();
@ -181,6 +187,9 @@ public:
void StartShake(int16 nDur, uint8 nFreq); void StartShake(int16 nDur, uint8 nFreq);
void StartShake_Distance(int16 nDur, uint8 nFreq, float fX, float fY, float fz); void StartShake_Distance(int16 nDur, uint8 nFreq, float fX, float fY, float fz);
void StartShake_Train(float fX, float fY); void StartShake_Train(float fX, float fY);
#ifdef GTA_PS2_STUFF
void AddToCheatString(char c);
#endif
void AddToPCCheatString(char c); void AddToPCCheatString(char c);
static void UpdatePads(void); static void UpdatePads(void);

View File

@ -106,7 +106,9 @@ CPlayerSkin::GetSkinTexture(const char *texName)
tex = RwTextureCreate(raster); tex = RwTextureCreate(raster);
RwTextureSetName(tex, texName); RwTextureSetName(tex, texName);
#ifdef FIX_BUGS
RwTextureSetFilterMode(tex, rwFILTERLINEAR); // filtering bugfix from VC RwTextureSetFilterMode(tex, rwFILTERLINEAR); // filtering bugfix from VC
#endif
RwTexDictionaryAddTexture(CTxdStore::GetSlot(m_txdSlot)->texDict, tex); RwTexDictionaryAddTexture(CTxdStore::GetSlot(m_txdSlot)->texDict, tex);
RwImageDestroy(image); RwImageDestroy(image);

View File

@ -17,7 +17,7 @@
#include "SpecialFX.h" #include "SpecialFX.h"
float &CRadar::m_radarRange = *(float*)0x8E281C; float &CRadar::m_radarRange = *(float*)0x8E281C;
CBlip (&CRadar::ms_RadarTrace)[NUMRADARBLIPS] = *(CBlip(*)[NUMRADARBLIPS]) * (uintptr*)0x6ED5E0; sRadarTrace (&CRadar::ms_RadarTrace)[NUMRADARBLIPS] = *(sRadarTrace(*)[NUMRADARBLIPS]) * (uintptr*)0x6ED5E0;
CVector2D &vec2DRadarOrigin = *(CVector2D*)0x6299B8; CVector2D &vec2DRadarOrigin = *(CVector2D*)0x6299B8;
int32 gRadarTxdIds[64];// = (int*)0x6299C0; int32 gRadarTxdIds[64];// = (int*)0x6299C0;
@ -87,6 +87,134 @@ int CRadar::TargetMarkerId = -1;
float CRadar::cachedCos; float CRadar::cachedCos;
float CRadar::cachedSin; float CRadar::cachedSin;
void ClipRadarTileCoords(int32 &x, int32 &y)
{
if (x < 0)
x = 0;
if (x > RADAR_NUM_TILES-1)
x = RADAR_NUM_TILES-1;
if (y < 0)
y = 0;
if (y > RADAR_NUM_TILES-1)
y = RADAR_NUM_TILES-1;
}
void RequestMapSection(int32 x, int32 y)
{
ClipRadarTileCoords(x, y);
CStreaming::RequestTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y], STREAMFLAGS_DONT_REMOVE | STREAMFLAGS_DEPENDENCY);
}
void RemoveMapSection(int32 x, int32 y)
{
if (x >= 0 && x <= 7 && y >= 0 && y <= 7)
CStreaming::RemoveTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y]);
}
// Transform from section indices to world coordinates
void GetTextureCorners(int32 x, int32 y, CVector2D *out)
{
x = x - RADAR_NUM_TILES/2;
y = -(y - RADAR_NUM_TILES/2);
// bottom left
out[0].x = RADAR_TILE_SIZE * (x);
out[0].y = RADAR_TILE_SIZE * (y - 1);
// bottom right
out[1].x = RADAR_TILE_SIZE * (x + 1);
out[1].y = RADAR_TILE_SIZE * (y - 1);
// top right
out[2].x = RADAR_TILE_SIZE * (x + 1);
out[2].y = RADAR_TILE_SIZE * (y);
// top left
out[3].x = RADAR_TILE_SIZE * (x);
out[3].y = RADAR_TILE_SIZE * (y);
}
bool IsPointInsideRadar(const CVector2D &point)
{
if (point.x < -1.0f || point.x > 1.0f) return false;
if (point.y < -1.0f || point.y > 1.0f) return false;
return true;
}
// clip line p1,p2 against (-1.0, 1.0) in x and y, set out to clipped point closest to p1
int LineRadarBoxCollision(CVector2D &out, const CVector2D &p1, const CVector2D &p2)
{
float d1, d2;
float t;
float x, y;
float shortest = 1.0f;
int edge = -1;
// clip against left edge, x = -1.0
d1 = -1.0f - p1.x;
d2 = -1.0f - p2.x;
if (d1 * d2 < 0.0f) {
// they are on opposite sides, get point of intersection
t = d1 / (d1 - d2);
y = (p2.y - p1.y)*t + p1.y;
if (y >= -1.0f && y <= 1.0f && t <= shortest) {
out.x = -1.0f;
out.y = y;
edge = 3;
shortest = t;
}
}
// clip against right edge, x = 1.0
d1 = p1.x - 1.0f;
d2 = p2.x - 1.0f;
if (d1 * d2 < 0.0f) {
// they are on opposite sides, get point of intersection
t = d1 / (d1 - d2);
y = (p2.y - p1.y)*t + p1.y;
if (y >= -1.0f && y <= 1.0f && t <= shortest) {
out.x = 1.0f;
out.y = y;
edge = 1;
shortest = t;
}
}
// clip against top edge, y = -1.0
d1 = -1.0f - p1.y;
d2 = -1.0f - p2.y;
if (d1 * d2 < 0.0f) {
// they are on opposite sides, get point of intersection
t = d1 / (d1 - d2);
x = (p2.x - p1.x)*t + p1.x;
if (x >= -1.0f && x <= 1.0f && t <= shortest) {
out.y = -1.0f;
out.x = x;
edge = 0;
shortest = t;
}
}
// clip against bottom edge, y = 1.0
d1 = p1.y - 1.0f;
d2 = p2.y - 1.0f;
if (d1 * d2 < 0.0f) {
// they are on opposite sides, get point of intersection
t = d1 / (d1 - d2);
x = (p2.x - p1.x)*t + p1.x;
if (x >= -1.0f && x <= 1.0f && t <= shortest) {
out.y = 1.0f;
out.x = x;
edge = 2;
shortest = t;
}
}
return edge;
}
uint8 CRadar::CalculateBlipAlpha(float dist) uint8 CRadar::CalculateBlipAlpha(float dist)
{ {
#ifdef MENU_MAP #ifdef MENU_MAP
@ -889,7 +1017,7 @@ INITSAVEBUF
CheckSaveHeader(buf, 'R', 'D', 'R', '\0', size - SAVE_HEADER_SIZE); CheckSaveHeader(buf, 'R', 'D', 'R', '\0', size - SAVE_HEADER_SIZE);
for (int i = 0; i < NUMRADARBLIPS; i++) for (int i = 0; i < NUMRADARBLIPS; i++)
ms_RadarTrace[i] = ReadSaveBuf<CBlip>(buf); ms_RadarTrace[i] = ReadSaveBuf<sRadarTrace>(buf);
VALIDATESAVEBUF(size); VALIDATESAVEBUF(size);
} }
@ -922,12 +1050,6 @@ CRadar::LoadTextures()
CTxdStore::PopCurrentTxd(); CTxdStore::PopCurrentTxd();
} }
void RemoveMapSection(int32 x, int32 y)
{
if (x >= 0 && x <= 7 && y >= 0 && y <= 7)
CStreaming::RemoveTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y]);
}
void CRadar::RemoveRadarSections() void CRadar::RemoveRadarSections()
{ {
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
@ -935,12 +1057,6 @@ void CRadar::RemoveRadarSections()
RemoveMapSection(i, j); RemoveMapSection(i, j);
} }
void CRadar::RequestMapSection(int32 x, int32 y)
{
ClipRadarTileCoords(x, y);
CStreaming::RequestTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y], STREAMFLAGS_DONT_REMOVE | STREAMFLAGS_DEPENDENCY);
}
void CRadar::SaveAllRadarBlips(uint8 *buf, uint32 *size) void CRadar::SaveAllRadarBlips(uint8 *buf, uint32 *size)
{ {
*size = SAVE_HEADER_SIZE + sizeof(ms_RadarTrace); *size = SAVE_HEADER_SIZE + sizeof(ms_RadarTrace);
@ -1239,121 +1355,6 @@ void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D
out.y = c * y - s * x; out.y = c * y - s * x;
} }
// Transform from section indices to world coordinates
void CRadar::GetTextureCorners(int32 x, int32 y, CVector2D *out)
{
x = x - RADAR_NUM_TILES/2;
y = -(y - RADAR_NUM_TILES/2);
// bottom left
out[0].x = RADAR_TILE_SIZE * (x);
out[0].y = RADAR_TILE_SIZE * (y - 1);
// bottom right
out[1].x = RADAR_TILE_SIZE * (x + 1);
out[1].y = RADAR_TILE_SIZE * (y - 1);
// top right
out[2].x = RADAR_TILE_SIZE * (x + 1);
out[2].y = RADAR_TILE_SIZE * (y);
// top left
out[3].x = RADAR_TILE_SIZE * (x);
out[3].y = RADAR_TILE_SIZE * (y);
}
void CRadar::ClipRadarTileCoords(int32 &x, int32 &y)
{
if (x < 0)
x = 0;
if (x > RADAR_NUM_TILES-1)
x = RADAR_NUM_TILES-1;
if (y < 0)
y = 0;
if (y > RADAR_NUM_TILES-1)
y = RADAR_NUM_TILES-1;
}
bool CRadar::IsPointInsideRadar(const CVector2D &point)
{
if (point.x < -1.0f || point.x > 1.0f) return false;
if (point.y < -1.0f || point.y > 1.0f) return false;
return true;
}
// clip line p1,p2 against (-1.0, 1.0) in x and y, set out to clipped point closest to p1
int CRadar::LineRadarBoxCollision(CVector2D &out, const CVector2D &p1, const CVector2D &p2)
{
float d1, d2;
float t;
float x, y;
float shortest = 1.0f;
int edge = -1;
// clip against left edge, x = -1.0
d1 = -1.0f - p1.x;
d2 = -1.0f - p2.x;
if (d1 * d2 < 0.0f) {
// they are on opposite sides, get point of intersection
t = d1 / (d1 - d2);
y = (p2.y - p1.y)*t + p1.y;
if (y >= -1.0f && y <= 1.0f && t <= shortest) {
out.x = -1.0f;
out.y = y;
edge = 3;
shortest = t;
}
}
// clip against right edge, x = 1.0
d1 = p1.x - 1.0f;
d2 = p2.x - 1.0f;
if (d1 * d2 < 0.0f) {
// they are on opposite sides, get point of intersection
t = d1 / (d1 - d2);
y = (p2.y - p1.y)*t + p1.y;
if (y >= -1.0f && y <= 1.0f && t <= shortest) {
out.x = 1.0f;
out.y = y;
edge = 1;
shortest = t;
}
}
// clip against top edge, y = -1.0
d1 = -1.0f - p1.y;
d2 = -1.0f - p2.y;
if (d1 * d2 < 0.0f) {
// they are on opposite sides, get point of intersection
t = d1 / (d1 - d2);
x = (p2.x - p1.x)*t + p1.x;
if (x >= -1.0f && x <= 1.0f && t <= shortest) {
out.y = -1.0f;
out.x = x;
edge = 0;
shortest = t;
}
}
// clip against bottom edge, y = 1.0
d1 = p1.y - 1.0f;
d2 = p2.y - 1.0f;
if (d1 * d2 < 0.0f) {
// they are on opposite sides, get point of intersection
t = d1 / (d1 - d2);
x = (p2.x - p1.x)*t + p1.x;
if (x >= -1.0f && x <= 1.0f && t <= shortest) {
out.y = 1.0f;
out.x = x;
edge = 2;
shortest = t;
}
}
return edge;
}
void void
CRadar::CalculateCachedSinCos() CRadar::CalculateCachedSinCos()
{ {
@ -1485,8 +1486,14 @@ STARTPATCHES
InjectHook(0x4A5C60, CRadar::SetRadarMarkerState, PATCH_JUMP); InjectHook(0x4A5C60, CRadar::SetRadarMarkerState, PATCH_JUMP);
InjectHook(0x4A5D10, CRadar::DrawRotatingRadarSprite, PATCH_JUMP); InjectHook(0x4A5D10, CRadar::DrawRotatingRadarSprite, PATCH_JUMP);
InjectHook(0x4A5EF0, CRadar::DrawRadarSprite, PATCH_JUMP); InjectHook(0x4A5EF0, CRadar::DrawRadarSprite, PATCH_JUMP);
InjectHook(0x4A6020, ClipRadarTileCoords, PATCH_JUMP);
InjectHook(0x4A6060, RequestMapSection, PATCH_JUMP);
InjectHook(0x4A60A0, RemoveMapSection, PATCH_JUMP);
InjectHook(0x4A60E0, CRadar::RemoveRadarSections, PATCH_JUMP); InjectHook(0x4A60E0, CRadar::RemoveRadarSections, PATCH_JUMP);
InjectHook(0x4A6100, (void (*)(int32, int32))&CRadar::StreamRadarSections, PATCH_JUMP); InjectHook(0x4A6100, (void (*)(int32, int32))&CRadar::StreamRadarSections, PATCH_JUMP);
InjectHook(0x4A6160, IsPointInsideRadar, PATCH_JUMP);
InjectHook(0x4A61C0, GetTextureCorners, PATCH_JUMP);
InjectHook(0x4A6250, LineRadarBoxCollision, PATCH_JUMP);
InjectHook(0x4A64A0, CRadar::ClipRadarPoly, PATCH_JUMP); InjectHook(0x4A64A0, CRadar::ClipRadarPoly, PATCH_JUMP);
InjectHook(0x4A67E0, CRadar::DrawRadarSection, PATCH_JUMP); InjectHook(0x4A67E0, CRadar::DrawRadarSection, PATCH_JUMP);
InjectHook(0x4A69C0, CRadar::DrawRadarMask, PATCH_JUMP); InjectHook(0x4A69C0, CRadar::DrawRadarMask, PATCH_JUMP);
@ -1494,8 +1501,6 @@ STARTPATCHES
InjectHook(0x4A6C20, CRadar::DrawRadarMap, PATCH_JUMP); InjectHook(0x4A6C20, CRadar::DrawRadarMap, PATCH_JUMP);
InjectHook(0x4A6E30, CRadar::SaveAllRadarBlips, PATCH_JUMP); InjectHook(0x4A6E30, CRadar::SaveAllRadarBlips, PATCH_JUMP);
InjectHook(0x4A6F30, CRadar::LoadAllRadarBlips, PATCH_JUMP); InjectHook(0x4A6F30, CRadar::LoadAllRadarBlips, PATCH_JUMP);
//InjectHook(0x4A7000, `global constructor keyed to'Radar.cpp, PATCH_JUMP);
InjectHook(0x4A61C0, CRadar::GetTextureCorners, PATCH_JUMP); //InjectHook(0x4A7260, sRadarTrace::sRadarTrace, PATCH_JUMP);
InjectHook(0x4A6160, CRadar::IsPointInsideRadar, PATCH_JUMP);
InjectHook(0x4A6250, CRadar::LineRadarBoxCollision, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -56,7 +56,7 @@ enum
BLIP_MODE_SQUARE, BLIP_MODE_SQUARE,
}; };
struct CBlip struct sRadarTrace
{ {
uint32 m_nColor; uint32 m_nColor;
uint32 m_eBlipType; // eBlipType uint32 m_eBlipType; // eBlipType
@ -71,7 +71,7 @@ struct CBlip
uint16 m_eBlipDisplay; // eBlipDisplay uint16 m_eBlipDisplay; // eBlipDisplay
uint16 m_eRadarSprite; // eRadarSprite uint16 m_eRadarSprite; // eRadarSprite
}; };
static_assert(sizeof(CBlip) == 0x30, "CBlip: error"); static_assert(sizeof(sRadarTrace) == 0x30, "sRadarTrace: error");
// Values for screen space // Values for screen space
#define RADAR_LEFT (40.0f) #define RADAR_LEFT (40.0f)
@ -83,7 +83,7 @@ class CRadar
{ {
public: public:
static float &m_radarRange; static float &m_radarRange;
static CBlip (&ms_RadarTrace)[NUMRADARBLIPS]; static sRadarTrace (&ms_RadarTrace)[NUMRADARBLIPS];
static CSprite2d AsukaSprite; static CSprite2d AsukaSprite;
static CSprite2d BombSprite; static CSprite2d BombSprite;
static CSprite2d CatSprite; static CSprite2d CatSprite;
@ -144,7 +144,6 @@ public:
static void LoadAllRadarBlips(uint8 *buf, uint32 size); static void LoadAllRadarBlips(uint8 *buf, uint32 size);
static void LoadTextures(); static void LoadTextures();
static void RemoveRadarSections(); static void RemoveRadarSections();
static void RequestMapSection(int32 x, int32 y);
static void SaveAllRadarBlips(uint8*, uint32*); static void SaveAllRadarBlips(uint8*, uint32*);
static void SetBlipSprite(int32 i, int32 icon); static void SetBlipSprite(int32 i, int32 icon);
static int32 SetCoordBlip(eBlipType type, CVector pos, int32, eBlipDisplay); static int32 SetCoordBlip(eBlipType type, CVector pos, int32, eBlipDisplay);
@ -162,9 +161,5 @@ public:
static void TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D &in); static void TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D &in);
// no in CRadar in the game: // no in CRadar in the game:
static void GetTextureCorners(int32 x, int32 y, CVector2D *out);
static void ClipRadarTileCoords(int32 &x, int32 &y);
static bool IsPointInsideRadar(const CVector2D &);
static int LineRadarBoxCollision(CVector2D &, const CVector2D &, const CVector2D &);
static void CalculateCachedSinCos(); static void CalculateCachedSinCos();
}; };

View File

@ -84,12 +84,14 @@ extern void **rwengine;
#define DEFAULT_SCREEN_WIDTH (640) #define DEFAULT_SCREEN_WIDTH (640)
#define DEFAULT_SCREEN_HEIGHT (448) #define DEFAULT_SCREEN_HEIGHT (448)
#define DEFAULT_ASPECT_RATIO (4.0f/3.0f) #define DEFAULT_ASPECT_RATIO (4.0f/3.0f)
#define DEFAULT_VIEWWINDOW (0.7f)
// game uses maximumWidth/Height, but this probably won't work // game uses maximumWidth/Height, but this probably won't work
// with RW windowed mode // with RW windowed mode
#define SCREEN_WIDTH ((float)RsGlobal.width) #define SCREEN_WIDTH ((float)RsGlobal.width)
#define SCREEN_HEIGHT ((float)RsGlobal.height) #define SCREEN_HEIGHT ((float)RsGlobal.height)
#define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio()) #define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio())
#define SCREEN_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetFOV() * 0.5f)))
// This scales from PS2 pixel coordinates to the real resolution // This scales from PS2 pixel coordinates to the real resolution
#define SCREEN_STRETCH_X(a) ((a) * (float) SCREEN_WIDTH / DEFAULT_SCREEN_WIDTH) #define SCREEN_STRETCH_X(a) ((a) * (float) SCREEN_WIDTH / DEFAULT_SCREEN_WIDTH)

View File

@ -153,6 +153,7 @@ enum Config {
//#define MASTER //#define MASTER
#if defined GTA_PS2 #if defined GTA_PS2
# define GTA_PS2_STUFF
# define RANDOMSPLASH # define RANDOMSPLASH
#elif defined GTA_PC #elif defined GTA_PC
# define GTA3_1_1_PATCH # define GTA3_1_1_PATCH

File diff suppressed because it is too large Load Diff

View File

@ -815,7 +815,7 @@ void CHud::Draw()
DrawScriptText DrawScriptText
*/ */
if (!CTimer::GetIsUserPaused()) { if (!CTimer::GetIsUserPaused()) {
CTextLine* IntroText = CTheScripts::IntroTextLines; intro_text_line* IntroText = CTheScripts::IntroTextLines;
for (int i = 0; i < MAX_NUM_INTRO_TEXT_LINES; i++) { for (int i = 0; i < MAX_NUM_INTRO_TEXT_LINES; i++) {
if (CTheScripts::IntroTextLines[i].m_Text[0] && CTheScripts::IntroTextLines[i].m_bTextBeforeFade) { if (CTheScripts::IntroTextLines[i].m_Text[0] && CTheScripts::IntroTextLines[i].m_bTextBeforeFade) {
@ -862,7 +862,7 @@ void CHud::Draw()
} }
} }
CScriptRectangle* IntroRect = CTheScripts::IntroRectangles; intro_script_rectangle* IntroRect = CTheScripts::IntroRectangles;
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
if (CTheScripts::IntroRectangles[i].m_bIsUsed && CTheScripts::IntroRectangles[i].m_bBeforeFade) { if (CTheScripts::IntroRectangles[i].m_bIsUsed && CTheScripts::IntroRectangles[i].m_bBeforeFade) {

View File

@ -48,6 +48,13 @@ char SaveFileNameJustSaved[260];
int (&Slots)[SLOT_COUNT+1] = *(int(*)[SLOT_COUNT+1])*(uintptr*)0x72803C; int (&Slots)[SLOT_COUNT+1] = *(int(*)[SLOT_COUNT+1])*(uintptr*)0x72803C;
CDate &CompileDateAndTime = *(CDate*)0x72BCB8; CDate &CompileDateAndTime = *(CDate*)0x72BCB8;
bool &b_FoundRecentSavedGameWantToLoad = *(bool*)0x95CDA8;
bool &JustLoadedDontFadeInYet = *(bool*)0x95CDB4;
bool &StillToFadeOut = *(bool*)0x95CD99;
uint32 &TimeStartedCountingForFade = *(uint32*)0x9430EC;
uint32 &TimeToStayFadedBeforeFadeOut = *(uint32*)0x611564;
#define ReadDataFromBufferPointer(buf, to) memcpy(&to, buf, sizeof(to)); buf += align4bytes(sizeof(to)); #define ReadDataFromBufferPointer(buf, to) memcpy(&to, buf, sizeof(to)); buf += align4bytes(sizeof(to));
#define WriteDataToBufferPointer(buf, from) memcpy(buf, &from, sizeof(from)); buf += align4bytes(sizeof(from)); #define WriteDataToBufferPointer(buf, from) memcpy(buf, &from, sizeof(from)); buf += align4bytes(sizeof(from));

View File

@ -32,6 +32,12 @@ extern int &CheckSum;
extern enum eLevelName &m_LevelToLoad; extern enum eLevelName &m_LevelToLoad;
extern int (&Slots)[SLOT_COUNT+1]; extern int (&Slots)[SLOT_COUNT+1];
extern bool &b_FoundRecentSavedGameWantToLoad;
extern bool &JustLoadedDontFadeInYet;
extern bool &StillToFadeOut;
extern uint32 &TimeStartedCountingForFade;
extern uint32 &TimeToStayFadedBeforeFadeOut;
extern char SaveFileNameJustSaved[260]; // 8F2570 extern char SaveFileNameJustSaved[260]; // 8F2570
const char TopLineEmptyFile[] = "THIS FILE IS NOT VALID YET"; const char TopLineEmptyFile[] = "THIS FILE IS NOT VALID YET";

View File

@ -1927,7 +1927,7 @@ _WinMain(HINSTANCE instance,
* Enter the message processing loop... * Enter the message processing loop...
*/ */
while( !RsGlobal.quit && !FrontEndMenuManager.m_bStartGameLoading ) while( !RsGlobal.quit && !FrontEndMenuManager.m_bWantToRestart )
{ {
if( PeekMessage(&message, nil, 0U, 0U, PM_REMOVE|PM_NOYIELD) ) if( PeekMessage(&message, nil, 0U, 0U, PM_REMOVE|PM_NOYIELD) )
{ {
@ -2059,13 +2059,13 @@ _WinMain(HINSTANCE instance,
if (wp.showCmd != SW_SHOWMINIMIZED) if (wp.showCmd != SW_SHOWMINIMIZED)
RsEventHandler(rsFRONTENDIDLE, nil); RsEventHandler(rsFRONTENDIDLE, nil);
if ( !FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bLoadingSavedGame ) if ( !FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bWantToLoad )
{ {
gGameState = GS_INIT_PLAYING_GAME; gGameState = GS_INIT_PLAYING_GAME;
TRACE("gGameState = GS_INIT_PLAYING_GAME;"); TRACE("gGameState = GS_INIT_PLAYING_GAME;");
} }
if ( FrontEndMenuManager.m_bLoadingSavedGame ) if ( FrontEndMenuManager.m_bWantToLoad )
{ {
InitialiseGame(); InitialiseGame();
FrontEndMenuManager.m_bGameNotLoaded = false; FrontEndMenuManager.m_bGameNotLoaded = false;
@ -2128,7 +2128,7 @@ _WinMain(HINSTANCE instance,
RwInitialised = FALSE; RwInitialised = FALSE;
FrontEndMenuManager.UnloadTextures(); FrontEndMenuManager.UnloadTextures();
if ( !FrontEndMenuManager.m_bStartGameLoading ) if ( !FrontEndMenuManager.m_bWantToRestart )
break; break;
CPad::ResetCheats(); CPad::ResetCheats();
@ -2138,13 +2138,13 @@ _WinMain(HINSTANCE instance,
CTimer::Stop(); CTimer::Stop();
if ( FrontEndMenuManager.m_bLoadingSavedGame ) if ( FrontEndMenuManager.m_bWantToLoad )
{ {
CGame::ShutDownForRestart(); CGame::ShutDownForRestart();
CGame::InitialiseWhenRestarting(); CGame::InitialiseWhenRestarting();
DMAudio.ChangeMusicMode(MUSICMODE_GAME); DMAudio.ChangeMusicMode(MUSICMODE_GAME);
LoadSplash(GetLevelSplashScreen(CGame::currLevel)); LoadSplash(GetLevelSplashScreen(CGame::currLevel));
FrontEndMenuManager.m_bLoadingSavedGame = false; FrontEndMenuManager.m_bWantToLoad = false;
} }
else else
{ {
@ -2168,7 +2168,7 @@ _WinMain(HINSTANCE instance,
} }
FrontEndMenuManager.m_bFirstTime = false; FrontEndMenuManager.m_bFirstTime = false;
FrontEndMenuManager.m_bStartGameLoading = false; FrontEndMenuManager.m_bWantToRestart = false;
} }