mirror of
https://github.com/halpz/re3.git
synced 2025-07-04 14:10:58 +00:00
merge with upstream
This commit is contained in:
@ -1443,39 +1443,36 @@ bool CControllerConfigManager::GetIsMouseButtonDown(RsKeyCodes keycode)
|
||||
|
||||
bool CControllerConfigManager::GetIsMouseButtonUp(RsKeyCodes keycode)
|
||||
{
|
||||
if (keycode > rsMOUSEX2BUTTON)
|
||||
switch (keycode)
|
||||
{
|
||||
switch (keycode)
|
||||
{
|
||||
case rsMOUSELEFTBUTTON:
|
||||
if (CPad::GetPad(PAD1)->GetLeftMouseUp())
|
||||
return true;
|
||||
break;
|
||||
case rsMOUSMIDDLEBUTTON:
|
||||
if (CPad::GetPad(PAD1)->GetMiddleMouseUp())
|
||||
return true;
|
||||
break;
|
||||
case rsMOUSERIGHTBUTTON:
|
||||
if (CPad::GetPad(PAD1)->GetRightMouseUp())
|
||||
return true;
|
||||
break;
|
||||
case rsMOUSEWHEELUPBUTTON:
|
||||
if (CPad::GetPad(PAD1)->GetMouseWheelUpUp())
|
||||
return true;
|
||||
break;
|
||||
case rsMOUSEWHEELDOWNBUTTON:
|
||||
if (CPad::GetPad(PAD1)->GetMouseWheelDownUp())
|
||||
return true;
|
||||
break;
|
||||
case rsMOUSEX1BUTTON:
|
||||
if (CPad::GetPad(PAD1)->GetMouseX1Up())
|
||||
return true;
|
||||
break;
|
||||
case rsMOUSEX2BUTTON:
|
||||
if (CPad::GetPad(PAD1)->GetMouseX2Up())
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
case rsMOUSELEFTBUTTON:
|
||||
if (CPad::GetPad(PAD1)->GetLeftMouseUp())
|
||||
return true;
|
||||
break;
|
||||
case rsMOUSMIDDLEBUTTON:
|
||||
if (CPad::GetPad(PAD1)->GetMiddleMouseUp())
|
||||
return true;
|
||||
break;
|
||||
case rsMOUSERIGHTBUTTON:
|
||||
if (CPad::GetPad(PAD1)->GetRightMouseUp())
|
||||
return true;
|
||||
break;
|
||||
case rsMOUSEWHEELUPBUTTON:
|
||||
if (CPad::GetPad(PAD1)->GetMouseWheelUpUp())
|
||||
return true;
|
||||
break;
|
||||
case rsMOUSEWHEELDOWNBUTTON:
|
||||
if (CPad::GetPad(PAD1)->GetMouseWheelDownUp())
|
||||
return true;
|
||||
break;
|
||||
case rsMOUSEX1BUTTON:
|
||||
if (CPad::GetPad(PAD1)->GetMouseX1Up())
|
||||
return true;
|
||||
break;
|
||||
case rsMOUSEX2BUTTON:
|
||||
if (CPad::GetPad(PAD1)->GetMouseX2Up())
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -1662,9 +1659,6 @@ void CControllerConfigManager::DeleteMatchingActionInitiators(e_ControllerAction
|
||||
|
||||
bool CControllerConfigManager::GetIsKeyBlank(int32 key, eControllerType type)
|
||||
{
|
||||
if (type > JOYSTICK)
|
||||
return true;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case KEYBOARD:
|
||||
@ -1755,27 +1749,24 @@ e_ControllerActionType CControllerConfigManager::GetActionType(e_ControllerActio
|
||||
|
||||
void CControllerConfigManager::ClearSettingsAssociatedWithAction(e_ControllerAction action, eControllerType type)
|
||||
{
|
||||
if (type <= JOYSTICK)
|
||||
switch (type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case KEYBOARD:
|
||||
m_aSettings[action][type].m_Key = rsNULL;
|
||||
m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE;
|
||||
break;
|
||||
case OPTIONAL_EXTRA:
|
||||
m_aSettings[action][type].m_Key = rsNULL;
|
||||
m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE;
|
||||
break;
|
||||
case MOUSE:
|
||||
m_aSettings[action][type].m_Key = 0;
|
||||
m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE;
|
||||
break;
|
||||
case JOYSTICK:
|
||||
m_aSettings[action][type].m_Key = 0;
|
||||
m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE;
|
||||
break;
|
||||
}
|
||||
case KEYBOARD:
|
||||
m_aSettings[action][type].m_Key = rsNULL;
|
||||
m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE;
|
||||
break;
|
||||
case OPTIONAL_EXTRA:
|
||||
m_aSettings[action][type].m_Key = rsNULL;
|
||||
m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE;
|
||||
break;
|
||||
case MOUSE:
|
||||
m_aSettings[action][type].m_Key = 0;
|
||||
m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE;
|
||||
break;
|
||||
case JOYSTICK:
|
||||
m_aSettings[action][type].m_Key = 0;
|
||||
m_aSettings[action][type].m_ContSetOrder = SETORDER_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
ResetSettingOrder(action);
|
||||
@ -2257,6 +2248,7 @@ void CControllerConfigManager::UpdateJoyButtonState(int32 padnumber)
|
||||
for (int32 i = 0; i < MAX_BUTTONS; i++)
|
||||
m_aButtonStates[i] = false;
|
||||
|
||||
#ifdef __DINPUT_INCLUDED__
|
||||
for (int32 i = 0; i < MAX_BUTTONS; i++)
|
||||
{
|
||||
if (m_NewState.rgbButtons[i] & 0x80)
|
||||
@ -2264,6 +2256,7 @@ void CControllerConfigManager::UpdateJoyButtonState(int32 padnumber)
|
||||
else
|
||||
m_aButtonStates[i] = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CControllerConfigManager::GetIsActionAButtonCombo(e_ControllerAction action)
|
||||
@ -2412,4 +2405,4 @@ STARTPATCHES
|
||||
InjectHook(0x58F740, &CControllerConfigManager::GetMouseButtonAssociatedWithAction, PATCH_JUMP);
|
||||
InjectHook(0x58F760, &CControllerConfigManager::SetMouseButtonAssociatedWithAction, PATCH_JUMP);
|
||||
InjectHook(0x58F790, &CControllerConfigManager::ResetSettingOrder, PATCH_JUMP);
|
||||
ENDPATCHES
|
||||
ENDPATCHES
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "General.h"
|
||||
#include "CutsceneMgr.h"
|
||||
#include "Directory.h"
|
||||
#include "Camera.h"
|
||||
@ -107,7 +108,7 @@ int
|
||||
FindCutsceneAudioTrackId(const char *szCutsceneName)
|
||||
{
|
||||
for (int i = 0; musicNameIdAssoc[i].szTrackName; i++) {
|
||||
if (!strcmpi(musicNameIdAssoc[i].szTrackName, szCutsceneName))
|
||||
if (!CGeneral::faststricmp(musicNameIdAssoc[i].szTrackName, szCutsceneName))
|
||||
return musicNameIdAssoc[i].iTrackId;
|
||||
}
|
||||
return -1;
|
||||
@ -171,7 +172,7 @@ CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName)
|
||||
CPlayerPed *pPlayerPed;
|
||||
|
||||
ms_cutsceneProcessing = true;
|
||||
if (!strcmpi(szCutsceneName, "jb"))
|
||||
if (!strcasecmp(szCutsceneName, "jb"))
|
||||
ms_useLodMultiplier = true;
|
||||
CTimer::Stop();
|
||||
|
||||
@ -207,7 +208,7 @@ CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName)
|
||||
|
||||
CFileMgr::CloseFile(file);
|
||||
|
||||
if (strcmpi(ms_cutsceneName, "end")) {
|
||||
if (CGeneral::faststricmp(ms_cutsceneName, "end")) {
|
||||
DMAudio.ChangeMusicMode(MUSICMODE_CUTSCENE);
|
||||
int trackId = FindCutsceneAudioTrackId(szCutsceneName);
|
||||
if (trackId != -1) {
|
||||
@ -364,9 +365,9 @@ CCutsceneMgr::DeleteCutsceneData(void)
|
||||
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_80;
|
||||
CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(false);
|
||||
|
||||
if (strcmpi(ms_cutsceneName, "end")) {
|
||||
if (CGeneral::faststricmp(ms_cutsceneName, "end")) {
|
||||
DMAudio.StopCutSceneMusic();
|
||||
if (strcmpi(ms_cutsceneName, "bet"))
|
||||
if (CGeneral::faststricmp(ms_cutsceneName, "bet"))
|
||||
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
|
||||
}
|
||||
CTimer::Stop();
|
||||
@ -389,7 +390,7 @@ CCutsceneMgr::Update(void)
|
||||
switch (ms_cutsceneLoadStatus) {
|
||||
case CUTSCENE_LOADING_AUDIO:
|
||||
SetupCutsceneToStart();
|
||||
if (strcmpi(ms_cutsceneName, "end"))
|
||||
if (CGeneral::faststricmp(ms_cutsceneName, "end"))
|
||||
DMAudio.PlayPreloadedCutSceneMusic();
|
||||
ms_cutsceneLoadStatus++;
|
||||
break;
|
||||
@ -407,7 +408,7 @@ CCutsceneMgr::Update(void)
|
||||
if (!ms_running) return;
|
||||
|
||||
ms_cutsceneTimer += CTimer::GetTimeStepNonClipped() * 0.02f;
|
||||
if (strcmpi(ms_cutsceneName, "end") && TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FLYBY && ms_cutsceneLoadStatus == CUTSCENE_LOADING_0) {
|
||||
if (CGeneral::faststricmp(ms_cutsceneName, "end") && TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FLYBY && ms_cutsceneLoadStatus == CUTSCENE_LOADING_0) {
|
||||
if (CPad::GetPad(0)->GetCrossJustDown()
|
||||
|| (CGame::playingIntro && CPad::GetPad(0)->GetStartJustDown())
|
||||
|| CPad::GetPad(0)->GetLeftMouseJustDown()
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "General.h"
|
||||
#include "FileMgr.h"
|
||||
#include "Directory.h"
|
||||
|
||||
@ -49,7 +50,7 @@ CDirectory::FindItem(const char *name, uint32 &offset, uint32 &size)
|
||||
int i;
|
||||
|
||||
for(i = 0; i < numEntries; i++)
|
||||
if(strcmpi(entries[i].name, name) == 0){
|
||||
if(!CGeneral::faststricmp(entries[i].name, name)){
|
||||
offset = entries[i].offset;
|
||||
size = entries[i].size;
|
||||
return true;
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "Explosion.h"
|
||||
|
||||
WRAPPER void CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32) { EAXJMP(0x5591C0); }
|
||||
WRAPPER void CExplosion::RemoveAllExplosionsInArea(CVector, float) { EAXJMP(0x55AD40); }
|
||||
|
||||
WRAPPER
|
||||
int8 CExplosion::GetExplosionActiveCounter(uint8 id)
|
||||
|
@ -27,4 +27,5 @@ public:
|
||||
static CVector *GetExplosionPosition(uint8 id);
|
||||
static uint8 GetExplosionType(uint8 id);
|
||||
static void ResetExplosionActiveCounter(uint8 id);
|
||||
static void RemoveAllExplosionsInArea(CVector, float);
|
||||
};
|
||||
|
@ -5,6 +5,9 @@
|
||||
CFireManager &gFireManager = *(CFireManager*)0x8F31D0;
|
||||
|
||||
WRAPPER void CFire::Extinguish(void) { EAXJMP(0x479D40); }
|
||||
WRAPPER void CFireManager::StartFire(CEntity* entityOnFire, CEntity* culprit, float, uint32) { EAXJMP(0x479590); }
|
||||
WRAPPER void CFireManager::Update(void) { EAXJMP(0x479310); }
|
||||
WRAPPER CFire* CFireManager::FindFurthestFire_NeverMindFireMen(CVector coors, float, float) { EAXJMP(0x479430); }
|
||||
|
||||
uint32 CFireManager::GetTotalActiveFires() const
|
||||
{
|
||||
@ -38,12 +41,28 @@ CFire* CFireManager::FindNearestFire(CVector vecPos, float* pDistance)
|
||||
return nil;
|
||||
}
|
||||
|
||||
void
|
||||
CFireManager::ExtinguishPoint(CVector point, float range)
|
||||
{
|
||||
for (int i = 0; i < NUM_FIRES; i++) {
|
||||
if (m_aFires[i].m_bIsOngoing) {
|
||||
if ((point - m_aFires[i].m_vecPos).MagnitudeSqr() < sq(range))
|
||||
m_aFires[i].Extinguish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WRAPPER CFire *CFireManager::FindFurthestFire_NeverMindFireMen(CVector coors, float, float) { EAXJMP(0x479430); }
|
||||
WRAPPER void CFireManager::StartFire(CEntity *entityOnFire, CEntity *culprit, float, uint32) { EAXJMP(0x479590); }
|
||||
WRAPPER void CFireManager::StartFire(CVector, float, uint8) { EAXJMP(0x479500); }
|
||||
WRAPPER void CFireManager::ExtinguishPoint(CVector, float) { EAXJMP(0x479DB0); }
|
||||
WRAPPER int32 CFireManager::StartScriptFire(const CVector& pos, CEntity* culprit, float, uint8) { EAXJMP(0x479E60); }
|
||||
WRAPPER bool CFireManager::IsScriptFireExtinguish(int16) { EAXJMP(0x479FC0); }
|
||||
WRAPPER void CFireManager::RemoveScriptFire(int16) { EAXJMP(0x479FE0); }
|
||||
WRAPPER void CFireManager::RemoveAllScriptFires(void) { EAXJMP(0x47A000); }
|
||||
WRAPPER void CFireManager::SetScriptFireAudio(int16, bool) { EAXJMP(0x47A040); }
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x479DB0, &CFireManager::ExtinguishPoint, PATCH_JUMP);
|
||||
InjectHook(0x479340, &CFireManager::FindNearestFire, PATCH_JUMP);
|
||||
ENDPATCHES
|
||||
|
||||
|
@ -35,12 +35,13 @@ public:
|
||||
void Update(void);
|
||||
CFire *FindFurthestFire_NeverMindFireMen(CVector coors, float, float);
|
||||
CFire *FindNearestFire(CVector, float*);
|
||||
uint32 GetTotalActiveFires() const;
|
||||
uint32 GetTotalActiveFires() const { return m_nTotalFires; }
|
||||
void ExtinguishPoint(CVector, float);
|
||||
int32 StartScriptFire(const CVector& pos, CEntity* culprit, float, uint8);
|
||||
bool IsScriptFireExtinguish(int16);
|
||||
void RemoveScriptFire(int16);
|
||||
void RemoveAllScriptFires(void);
|
||||
void SetScriptFireAudio(int16, bool);
|
||||
void ExtinguishPoint(CVector, float);
|
||||
};
|
||||
extern CFireManager &gFireManager;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -7,10 +7,10 @@
|
||||
#define MENUHEADER_WIDTH 0.84f
|
||||
#define MENUHEADER_HEIGHT 1.6f
|
||||
|
||||
#define MENUACTION_POS_X 20.0f
|
||||
#define MENUACTION_POS_X 40.0f
|
||||
#define MENUACTION_POS_Y 37.5f
|
||||
#define MENUACTION_WIDTH 0.675f
|
||||
#define MENUACTION_HEIGHT 0.81f
|
||||
#define MENUACTION_WIDTH 0.405f
|
||||
#define MENUACTION_HEIGHT 0.63f
|
||||
|
||||
#define MENUCOLUMN_POS_X MENUHEADER_POS_X + 16.0f
|
||||
#define MENUCOLUMN_MAX_Y 149.0f
|
||||
@ -466,9 +466,13 @@ public:
|
||||
static bool &m_bStartUpFrontEndRequested;
|
||||
static bool &m_bShutDownFrontEndRequested;
|
||||
static bool &m_PrefsAllowNastyGame;
|
||||
|
||||
static float &headingYStart;
|
||||
static float &unkX;
|
||||
static float &unkY;
|
||||
|
||||
public:
|
||||
void BuildStatLine(char *text, float *stat, bool aFloat, float* stat2);
|
||||
static void BuildStatLine(char *text, void *stat, uint8 aFloat, void *stat2);
|
||||
static void CentreMousePointer();
|
||||
int CheckCodesForControls(int32);
|
||||
bool CheckHover(int x1, int x2, int y1, int y2);
|
||||
|
@ -104,6 +104,29 @@ public:
|
||||
return (int)floorf(angle / DEGTORAD(45.0f));
|
||||
}
|
||||
|
||||
// Unlike usual string comparison functions, these don't care about greater or lesser
|
||||
static bool faststrcmp(const char *str1, const char *str2)
|
||||
{
|
||||
for (; *str1; str1++, str2++) {
|
||||
if (*str1 != *str2)
|
||||
return true;
|
||||
}
|
||||
return *str2 != '\0';
|
||||
}
|
||||
|
||||
static bool faststricmp(const char *str1, const char *str2)
|
||||
{
|
||||
for (; *str1; str1++, str2++) {
|
||||
#if MUCH_SLOWER
|
||||
if (toupper(*str1) != toupper(*str2))
|
||||
#else
|
||||
if (__ascii_toupper(*str1) != __ascii_toupper(*str2))
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
return *str2 != '\0';
|
||||
}
|
||||
|
||||
// not too sure about all these...
|
||||
static uint16 GetRandomNumber(void)
|
||||
{ return myrand() & MYRAND_MAX; }
|
||||
|
@ -36,7 +36,7 @@ CKeyboardState &CPad::OldKeyState = *(CKeyboardState*)0x6F1E70;
|
||||
CKeyboardState &CPad::NewKeyState = *(CKeyboardState*)0x6E60D0;
|
||||
CKeyboardState &CPad::TempKeyState = *(CKeyboardState*)0x774DE8;
|
||||
|
||||
char CPad::KeyBoardCheatString[18];
|
||||
char CPad::KeyBoardCheatString[20];
|
||||
|
||||
CMouseControllerState &CPad::OldMouseControllerState = *(CMouseControllerState*)0x8472A0;
|
||||
CMouseControllerState &CPad::NewMouseControllerState = *(CMouseControllerState*)0x8809F0;
|
||||
@ -427,7 +427,7 @@ void CPad::StartShake_Train(float fX, float fY)
|
||||
|
||||
void CPad::AddToPCCheatString(char c)
|
||||
{
|
||||
for ( int32 i = ARRAY_SIZE(KeyBoardCheatString); i >= 0; i-- )
|
||||
for ( int32 i = ARRAY_SIZE(KeyBoardCheatString) - 2; i >= 0; i-- )
|
||||
KeyBoardCheatString[i + 1] = KeyBoardCheatString[i];
|
||||
|
||||
KeyBoardCheatString[0] = c;
|
||||
|
@ -7,7 +7,7 @@ enum {
|
||||
PLAYERCONTROL_DISABLED_4 = 4,
|
||||
PLAYERCONTROL_DISABLED_8 = 8,
|
||||
PLAYERCONTROL_DISABLED_10 = 16,
|
||||
PLAYERCONTROL_DISABLED_20 = 32,
|
||||
PLAYERCONTROL_DISABLED_20 = 32, // used on CPlayerInfo::MakePlayerSafe
|
||||
PLAYERCONTROL_DISABLED_40 = 64, // used on phone calls
|
||||
PLAYERCONTROL_DISABLED_80 = 128,
|
||||
};
|
||||
@ -166,7 +166,7 @@ public:
|
||||
static CKeyboardState &OldKeyState;
|
||||
static CKeyboardState &NewKeyState;
|
||||
static CKeyboardState &TempKeyState;
|
||||
static char KeyBoardCheatString[18];
|
||||
static char KeyBoardCheatString[20];
|
||||
static CMouseControllerState &OldMouseControllerState;
|
||||
static CMouseControllerState &NewMouseControllerState;
|
||||
static CMouseControllerState &PCTempMouseControllerState;
|
||||
|
@ -1,18 +1,32 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "main.h"
|
||||
#include "PlayerPed.h"
|
||||
#include "PlayerInfo.h"
|
||||
#include "Frontend.h"
|
||||
#include "Vehicle.h"
|
||||
#include "PlayerSkin.h"
|
||||
#include "Darkel.h"
|
||||
#include "Messages.h"
|
||||
#include "Text.h"
|
||||
#include "Stats.h"
|
||||
|
||||
WRAPPER void CPlayerInfo::MakePlayerSafe(bool) { EAXJMP(0x4A1400); }
|
||||
WRAPPER void CPlayerInfo::AwardMoneyForExplosion(CVehicle *vehicle) { EAXJMP(0x4A15F0); }
|
||||
WRAPPER void CPlayerInfo::Process(void) { EAXJMP(0x49FD30); }
|
||||
#include "Remote.h"
|
||||
#include "World.h"
|
||||
#include "Replay.h"
|
||||
#include "Pad.h"
|
||||
#include "ProjectileInfo.h"
|
||||
#include "Explosion.h"
|
||||
#include "Script.h"
|
||||
#include "Automobile.h"
|
||||
#include "HandlingMgr.h"
|
||||
#include "General.h"
|
||||
#include "SpecialFX.h"
|
||||
#include "Cranes.h"
|
||||
#include "Bridge.h"
|
||||
#include "WaterLevel.h"
|
||||
#include "PathFind.h"
|
||||
#include "ZoneCull.h"
|
||||
#include "Renderer.h"
|
||||
#include "Streaming.h"
|
||||
|
||||
void
|
||||
CPlayerInfo::SetPlayerSkin(char *skin)
|
||||
@ -24,7 +38,7 @@ CPlayerInfo::SetPlayerSkin(char *skin)
|
||||
CVector&
|
||||
CPlayerInfo::GetPos()
|
||||
{
|
||||
if (m_pPed->bInVehicle && m_pPed->m_pMyVehicle)
|
||||
if (m_pPed->InVehicle())
|
||||
return m_pPed->m_pMyVehicle->GetPosition();
|
||||
return m_pPed->GetPosition();
|
||||
}
|
||||
@ -44,7 +58,7 @@ CPlayerInfo::DeletePlayerSkin()
|
||||
{
|
||||
if (m_pSkinTexture) {
|
||||
RwTextureDestroy(m_pSkinTexture);
|
||||
m_pSkinTexture = NULL;
|
||||
m_pSkinTexture = nil;
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,9 +102,473 @@ CPlayerInfo::PlayerFailedCriticalMission()
|
||||
CDarkel::ResetOnPlayerDeath();
|
||||
}
|
||||
|
||||
void
|
||||
CPlayerInfo::Clear(void)
|
||||
{
|
||||
m_pPed = nil;
|
||||
m_pRemoteVehicle = nil;
|
||||
if (m_pVehicleEx) {
|
||||
m_pVehicleEx->bUsingSpecialColModel = false;
|
||||
m_pVehicleEx = nil;
|
||||
}
|
||||
m_nVisibleMoney = 0;
|
||||
m_nMoney = m_nVisibleMoney;
|
||||
m_WBState = WBSTATE_PLAYING;
|
||||
m_nWBTime = 0;
|
||||
m_nTrafficMultiplier = 0;
|
||||
m_fRoadDensity = 1.0f;
|
||||
m_bInRemoteMode = false;
|
||||
m_bUnusedTaxiThing = false;
|
||||
m_nUnusedTaxiTimer = 0;
|
||||
m_nCollectedPackages = 0;
|
||||
m_nTotalPackages = 3;
|
||||
m_nTimeLastHealthLoss = 0;
|
||||
m_nTimeLastArmourLoss = 0;
|
||||
m_nNextSexFrequencyUpdateTime = 0;
|
||||
m_nNextSexMoneyUpdateTime = 0;
|
||||
m_nSexFrequency = 0;
|
||||
m_pHooker = nil;
|
||||
m_nTimeTankShotGun = 0;
|
||||
field_248 = 0;
|
||||
m_nUpsideDownCounter = 0;
|
||||
m_bInfiniteSprint = false;
|
||||
m_bFastReload = false;
|
||||
m_bGetOutOfJailFree = false;
|
||||
m_bGetOutOfHospitalFree = false;
|
||||
m_nPreviousTimeRewardedForExplosion = 0;
|
||||
m_nExplosionsSinceLastReward = 0;
|
||||
}
|
||||
|
||||
void
|
||||
CPlayerInfo::BlowUpRCBuggy(void)
|
||||
{
|
||||
if (!m_pRemoteVehicle || m_pRemoteVehicle->bRemoveFromWorld)
|
||||
return;
|
||||
|
||||
CRemote::TakeRemoteControlledCarFromPlayer();
|
||||
m_pRemoteVehicle->BlowUpCar(FindPlayerPed());
|
||||
}
|
||||
|
||||
void
|
||||
CPlayerInfo::CancelPlayerEnteringCars(CVehicle *car)
|
||||
{
|
||||
if (!car || car == m_pPed->m_pMyVehicle) {
|
||||
if (m_pPed->m_nPedState == PED_CARJACK || m_pPed->m_nPedState == PED_ENTER_CAR)
|
||||
m_pPed->QuitEnteringCar();
|
||||
}
|
||||
if (m_pPed->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER || m_pPed->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER)
|
||||
m_pPed->ClearObjective();
|
||||
}
|
||||
|
||||
void
|
||||
CPlayerInfo::MakePlayerSafe(bool toggle)
|
||||
{
|
||||
if (toggle) {
|
||||
CTheScripts::CountdownToMakePlayerUnsafe = 0;
|
||||
m_pPed->m_pWanted->m_bIgnoredByEveryone = true;
|
||||
CWorld::StopAllLawEnforcersInTheirTracks();
|
||||
CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_20;
|
||||
CPad::StopPadsShaking();
|
||||
m_pPed->bBulletProof = true;
|
||||
m_pPed->bFireProof = true;
|
||||
m_pPed->bCollisionProof = true;
|
||||
m_pPed->bMeleeProof = true;
|
||||
m_pPed->bOnlyDamagedByPlayer = true;
|
||||
m_pPed->bExplosionProof = true;
|
||||
m_pPed->m_bCanBeDamaged = false;
|
||||
((CPlayerPed*)m_pPed)->ClearAdrenaline();
|
||||
CancelPlayerEnteringCars(false);
|
||||
gFireManager.ExtinguishPoint(GetPos(), 4000.0f);
|
||||
CExplosion::RemoveAllExplosionsInArea(GetPos(), 4000.0f);
|
||||
CProjectileInfo::RemoveAllProjectiles();
|
||||
CWorld::SetAllCarsCanBeDamaged(false);
|
||||
CWorld::ExtinguishAllCarFiresInArea(GetPos(), 4000.0f);
|
||||
CReplay::DisableReplays();
|
||||
|
||||
} else if (!CGame::playingIntro && !CTheScripts::CountdownToMakePlayerUnsafe) {
|
||||
m_pPed->m_pWanted->m_bIgnoredByEveryone = false;
|
||||
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_20;
|
||||
m_pPed->bBulletProof = false;
|
||||
m_pPed->bFireProof = false;
|
||||
m_pPed->bCollisionProof = false;
|
||||
m_pPed->bMeleeProof = false;
|
||||
m_pPed->bOnlyDamagedByPlayer = false;
|
||||
m_pPed->bExplosionProof = false;
|
||||
m_pPed->m_bCanBeDamaged = true;
|
||||
CWorld::SetAllCarsCanBeDamaged(true);
|
||||
CReplay::EnableReplays();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
CPlayerInfo::IsRestartingAfterDeath()
|
||||
{
|
||||
return m_WBState == WBSTATE_WASTED;
|
||||
}
|
||||
|
||||
bool
|
||||
CPlayerInfo::IsRestartingAfterArrest()
|
||||
{
|
||||
return m_WBState == WBSTATE_BUSTED;
|
||||
}
|
||||
|
||||
// lastClosestness is passed to other calls of this function
|
||||
void
|
||||
CPlayerInfo::EvaluateCarPosition(CEntity *carToTest, CPed *player, float carBoundCentrePedDist, float *lastClosestness, CVehicle **closestCarOutput)
|
||||
{
|
||||
// This dist used for determining the angle to face
|
||||
CVector2D dist(carToTest->GetPosition() - player->GetPosition());
|
||||
float neededTurn = CGeneral::GetATanOfXY(player->GetForward().x, player->GetForward().y) - CGeneral::GetATanOfXY(dist.x, dist.y);
|
||||
while (neededTurn >= PI) {
|
||||
neededTurn -= 2 * PI;
|
||||
}
|
||||
|
||||
while (neededTurn < -PI) {
|
||||
neededTurn += 2 * PI;
|
||||
}
|
||||
|
||||
// This dist used for evaluating cars' distances, weird...
|
||||
// Accounts inverted needed turn (or needed turn in long way) and car dist.
|
||||
float closestness = (1.0f - Abs(neededTurn) / TWOPI) * (10.0f - carBoundCentrePedDist);
|
||||
if (closestness > *lastClosestness) {
|
||||
*lastClosestness = closestness;
|
||||
*closestCarOutput = (CVehicle*)carToTest;
|
||||
}
|
||||
}
|
||||
|
||||
// There is something unfinished in here... Sadly all IDBs we have have it unfinished.
|
||||
void
|
||||
CPlayerInfo::AwardMoneyForExplosion(CVehicle *wreckedCar)
|
||||
{
|
||||
if (CTimer::GetTimeInMilliseconds() - m_nPreviousTimeRewardedForExplosion < 6000)
|
||||
++m_nExplosionsSinceLastReward;
|
||||
else
|
||||
m_nExplosionsSinceLastReward = 1;
|
||||
|
||||
m_nPreviousTimeRewardedForExplosion = CTimer::GetTimeInMilliseconds();
|
||||
int award = wreckedCar->pHandling->nMonetaryValue * 0.002f;
|
||||
sprintf(gString, "$%d", award);
|
||||
#ifdef MONEY_MESSAGES
|
||||
// This line is a leftover from PS2, I don't know what it was meant to be.
|
||||
// CVector sth(TheCamera.GetPosition() * 4.0f);
|
||||
|
||||
CMoneyMessages::RegisterOne(wreckedCar->GetPosition() + CVector(0.0f, 0.0f, 2.0f), gString, 0, 255, 0, 2.0f, 0.5f);
|
||||
#endif
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += award;
|
||||
|
||||
for (int i = m_nExplosionsSinceLastReward; i > 1; --i) {
|
||||
CGeneral::GetRandomNumber();
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += award;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CPlayerInfo::SavePlayerInfo(uint8 *buf, uint32 *size)
|
||||
{
|
||||
// Interesting
|
||||
*size = sizeof(CPlayerInfo);
|
||||
|
||||
INITSAVEBUF
|
||||
WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMoney);
|
||||
WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_WBState);
|
||||
WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nWBTime);
|
||||
WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTrafficMultiplier);
|
||||
WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_fRoadDensity);
|
||||
WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney);
|
||||
WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages);
|
||||
WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages);
|
||||
WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bInfiniteSprint);
|
||||
WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFastReload);
|
||||
WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfJailFree);
|
||||
WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfHospitalFree);
|
||||
for (int i = 0; i < sizeof(CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName); i++) {
|
||||
WriteSaveBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName[i]);
|
||||
}
|
||||
// Save struct is different
|
||||
// VALIDATESAVEBUF(*size)
|
||||
}
|
||||
|
||||
void
|
||||
CPlayerInfo::LoadPlayerInfo(uint8 *buf, uint32 size)
|
||||
{
|
||||
INITSAVEBUF
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_nMoney = ReadSaveBuf<uint32>(buf);
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_WBState = ReadSaveBuf<int8>(buf);
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_nWBTime = ReadSaveBuf<uint32>(buf);
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_nTrafficMultiplier = ReadSaveBuf<int16>(buf);
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_fRoadDensity = ReadSaveBuf<float>(buf);
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney = ReadSaveBuf<int32>(buf);
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages = ReadSaveBuf<int32>(buf);
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages = ReadSaveBuf<int32>(buf);
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_bInfiniteSprint = ReadSaveBuf<bool>(buf);
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_bFastReload = ReadSaveBuf<bool>(buf);
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfJailFree = ReadSaveBuf<bool>(buf);
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfHospitalFree = ReadSaveBuf<bool>(buf);
|
||||
for (int i = 0; i < sizeof(CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName); i++) {
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName[i] = ReadSaveBuf<char>(buf);
|
||||
}
|
||||
// Save struct is different
|
||||
// VALIDATESAVEBUF(size)
|
||||
}
|
||||
|
||||
void
|
||||
CPlayerInfo::FindClosestCarSectorList(CPtrList& carList, CPed* ped, float unk1, float unk2, float unk3, float unk4, float* lastClosestness, CVehicle** closestCarOutput)
|
||||
{
|
||||
for (CPtrNode* node = carList.first; node; node = node->next) {
|
||||
CVehicle *car = (CVehicle*)node->item;
|
||||
if(car->m_scanCode != CWorld::GetCurrentScanCode()) {
|
||||
if (!car->bUsesCollision || !car->IsVehicle())
|
||||
continue;
|
||||
|
||||
car->m_scanCode = CWorld::GetCurrentScanCode();
|
||||
if (car->m_status != STATUS_WRECKED && car->m_status != STATUS_TRAIN_MOVING
|
||||
&& (car->GetUp().z > 0.3f || (car->IsVehicle() && ((CVehicle*)car)->m_vehType == VEHICLE_TYPE_BIKE))) {
|
||||
CVector carCentre = car->GetBoundCentre();
|
||||
|
||||
if (Abs(ped->GetPosition().z - carCentre.z) < 2.0f) {
|
||||
float dist = (ped->GetPosition() - carCentre).Magnitude2D();
|
||||
if (dist <= 10.0f && !CCranes::IsThisCarBeingCarriedByAnyCrane(car)) {
|
||||
EvaluateCarPosition(car, ped, dist, lastClosestness, closestCarOutput);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CPlayerInfo::Process(void)
|
||||
{
|
||||
// Unused taxi feature. Gives you a dollar for every second with a passenger. Can be toggled via 0x29A opcode.
|
||||
bool startTaxiTimer = true;
|
||||
if (m_bUnusedTaxiThing && m_pPed->bInVehicle) {
|
||||
CVehicle *veh = m_pPed->m_pMyVehicle;
|
||||
if ((veh->m_modelIndex == MI_TAXI || veh->m_modelIndex == MI_CABBIE || veh->m_modelIndex == MI_BORGNINE)
|
||||
&& veh->pDriver == m_pPed && veh->m_nNumPassengers != 0) {
|
||||
for (uint32 timePassed = CTimer::GetTimeInMilliseconds() - m_nUnusedTaxiTimer; timePassed >= 1000; m_nUnusedTaxiTimer += 1000) {
|
||||
timePassed -= 1000;
|
||||
++m_nMoney;
|
||||
}
|
||||
startTaxiTimer = false;
|
||||
}
|
||||
}
|
||||
if (startTaxiTimer)
|
||||
m_nUnusedTaxiTimer = CTimer::GetTimeInMilliseconds();
|
||||
|
||||
// The effect that makes money counter does while earning/losing money
|
||||
if (m_nVisibleMoney != m_nMoney) {
|
||||
int diff = m_nMoney - m_nVisibleMoney;
|
||||
int diffAbs = Abs(diff);
|
||||
int changeBy;
|
||||
|
||||
if (diffAbs > 100000)
|
||||
changeBy = 12345;
|
||||
else if (diffAbs > 10000)
|
||||
changeBy = 1234;
|
||||
else if (diffAbs > 1000)
|
||||
changeBy = 123;
|
||||
else if (diffAbs > 50)
|
||||
changeBy = 42;
|
||||
else
|
||||
changeBy = 1;
|
||||
|
||||
if (diff < 0)
|
||||
m_nVisibleMoney -= changeBy;
|
||||
else
|
||||
m_nVisibleMoney += changeBy;
|
||||
}
|
||||
|
||||
if (!(CTimer::GetFrameCounter() & 15)) {
|
||||
CVector2D playerPos = m_pPed->bInVehicle ? m_pPed->m_pMyVehicle->GetPosition() : m_pPed->GetPosition();
|
||||
m_fRoadDensity = ThePaths.CalcRoadDensity(playerPos.x, playerPos.y);
|
||||
}
|
||||
|
||||
m_fRoadDensity = clamp(m_fRoadDensity, 0.4f, 1.45f);
|
||||
|
||||
// Because vehicle enter/exit use same key binding.
|
||||
bool enterOrExitVeh;
|
||||
if (m_pPed->m_ped_flagI4 && m_pPed->bInVehicle)
|
||||
enterOrExitVeh = CPad::GetPad(0)->ExitVehicleJustDown();
|
||||
else
|
||||
enterOrExitVeh = CPad::GetPad(0)->GetExitVehicle();
|
||||
|
||||
if (enterOrExitVeh && m_pPed->m_nPedState != PED_SNIPER_MODE && m_pPed->m_nPedState != PED_ROCKET_ODE) {
|
||||
if (m_pPed->bInVehicle) {
|
||||
if (!m_pRemoteVehicle) {
|
||||
CEntity *surfaceBelowVeh = m_pPed->m_pMyVehicle->m_pCurGroundEntity;
|
||||
if (!surfaceBelowVeh || !CBridge::ThisIsABridgeObjectMovingUp(surfaceBelowVeh->m_modelIndex)) {
|
||||
CVehicle *veh = m_pPed->m_pMyVehicle;
|
||||
if (!veh->IsBoat() || veh->m_nDoorLock == CARLOCK_LOCKED_PLAYER_INSIDE) {
|
||||
|
||||
// This condition will always return true, else block was probably WIP Miami code.
|
||||
if (veh->m_vehType != VEHICLE_TYPE_BIKE || veh->m_nDoorLock == CARLOCK_LOCKED_PLAYER_INSIDE) {
|
||||
if (veh->m_status != STATUS_WRECKED && veh->m_status != STATUS_TRAIN_MOVING && veh->m_nDoorLock != CARLOCK_LOCKED_PLAYER_INSIDE) {
|
||||
if (veh->m_vecMoveSpeed.Magnitude() < 0.17f && CTimer::GetTimeScale() >= 0.5f && !veh->bIsInWater) {
|
||||
m_pPed->SetObjective(OBJECTIVE_LEAVE_VEHICLE, veh);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CVector sth = 0.7f * veh->GetRight() + veh->GetPosition();
|
||||
bool found = false;
|
||||
float groundZ = CWorld::FindGroundZFor3DCoord(sth.x, sth.y, 2.0f + sth.z, &found);
|
||||
|
||||
if (found)
|
||||
sth.z = 1.0f + groundZ;
|
||||
m_pPed->m_nPedState = PED_IDLE;
|
||||
m_pPed->SetMoveState(PEDMOVE_STILL);
|
||||
CPed::PedSetOutCarCB(0, m_pPed);
|
||||
CAnimManager::BlendAnimation(m_pPed->GetClump(), m_pPed->m_animGroup, ANIM_IDLE_STANCE, 100.0f);
|
||||
CAnimManager::BlendAnimation(m_pPed->GetClump(), ASSOCGRP_STD, ANIM_FALL_LAND, 100.0f);
|
||||
m_pPed->GetPosition() = sth;
|
||||
m_pPed->SetMoveState(PEDMOVE_STILL);
|
||||
m_pPed->m_vecMoveSpeed = veh->m_vecMoveSpeed;
|
||||
}
|
||||
} else {
|
||||
// The code in here was under CPed::SetExitBoat in VC, did the same for here.
|
||||
m_pPed->SetExitBoat(veh);
|
||||
m_pPed->bTryingToReachDryLand = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Enter vehicle
|
||||
if (CPad::GetPad(0)->ExitVehicleJustDown()) {
|
||||
bool weAreOnBoat = false;
|
||||
float lastClosestness = 0.0f;
|
||||
CVehicle *carBelow;
|
||||
CEntity *surfaceBelow = m_pPed->m_pCurrentPhysSurface;
|
||||
if (surfaceBelow && surfaceBelow->IsVehicle()) {
|
||||
carBelow = (CVehicle*)surfaceBelow;
|
||||
if (carBelow->IsBoat()) {
|
||||
weAreOnBoat = true;
|
||||
m_pPed->bOnBoat = true;
|
||||
#ifdef VC_PED_PORTS
|
||||
if (carBelow->m_status != STATUS_WRECKED && carBelow->GetUp().z > 0.3f)
|
||||
#else
|
||||
if (carBelow->m_status != STATUS_WRECKED)
|
||||
#endif
|
||||
m_pPed->SetSeekBoatPosition(carBelow);
|
||||
}
|
||||
}
|
||||
// Find closest car
|
||||
if (!weAreOnBoat) {
|
||||
float minX = m_pPed->GetPosition().x - 10.0f;
|
||||
float maxX = 10.0f + m_pPed->GetPosition().x;
|
||||
float minY = m_pPed->GetPosition().y - 10.0f;
|
||||
float maxY = 10.0f + m_pPed->GetPosition().y;
|
||||
|
||||
int minXSector = CWorld::GetSectorIndexX(minX);
|
||||
if (minXSector < 0) minXSector = 0;
|
||||
int minYSector = CWorld::GetSectorIndexY(minY);
|
||||
if (minYSector < 0) minYSector = 0;
|
||||
int maxXSector = CWorld::GetSectorIndexX(maxX);
|
||||
if (maxXSector > NUMSECTORS_X - 1) maxXSector = NUMSECTORS_X - 1;
|
||||
int maxYSector = CWorld::GetSectorIndexY(maxY);
|
||||
if (maxYSector > NUMSECTORS_Y - 1) maxYSector = NUMSECTORS_Y - 1;
|
||||
|
||||
CWorld::AdvanceCurrentScanCode();
|
||||
|
||||
for (int curY = minYSector; curY <= maxYSector; curY++) {
|
||||
for (int curX = minXSector; curX <= maxXSector; curX++) {
|
||||
CSector *sector = CWorld::GetSector(curX, curY);
|
||||
FindClosestCarSectorList(sector->m_lists[ENTITYLIST_VEHICLES], m_pPed,
|
||||
minX, minY, maxX, maxY, &lastClosestness, &carBelow);
|
||||
FindClosestCarSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], m_pPed,
|
||||
minX, minY, maxX, maxY, &lastClosestness, &carBelow);
|
||||
}
|
||||
}
|
||||
}
|
||||
// carBelow is now closest vehicle
|
||||
if (carBelow && !weAreOnBoat) {
|
||||
if (carBelow->m_status == STATUS_TRAIN_NOT_MOVING) {
|
||||
m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, carBelow);
|
||||
} else if (carBelow->IsBoat()) {
|
||||
if (!carBelow->pDriver) {
|
||||
m_pPed->m_vehEnterType = 0;
|
||||
m_pPed->SetEnterCar(carBelow, m_pPed->m_vehEnterType);
|
||||
}
|
||||
} else {
|
||||
m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, carBelow);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_bInRemoteMode) {
|
||||
uint32 timeWithoutRemoteCar = CTimer::GetTimeInMilliseconds() - m_nTimeLostRemoteCar;
|
||||
if (CTimer::GetPreviousTimeInMilliseconds() - m_nTimeLostRemoteCar < 1000 && timeWithoutRemoteCar >= 1000 && m_WBState == WBSTATE_PLAYING) {
|
||||
TheCamera.SetFadeColour(0, 0, 0);
|
||||
TheCamera.Fade(1.0f, 0);
|
||||
}
|
||||
if (timeWithoutRemoteCar > 2000) {
|
||||
if (m_WBState == WBSTATE_PLAYING) {
|
||||
TheCamera.RestoreWithJumpCut();
|
||||
TheCamera.SetFadeColour(0, 0, 0);
|
||||
TheCamera.Fade(1.0f, 1);
|
||||
TheCamera.Process();
|
||||
CTimer::Stop();
|
||||
CCullZones::ForceCullZoneCoors(TheCamera.GetPosition());
|
||||
CRenderer::RequestObjectsInFrustum();
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
CTimer::Update();
|
||||
}
|
||||
m_bInRemoteMode = false;
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle = nil;
|
||||
if (FindPlayerVehicle()) {
|
||||
FindPlayerVehicle()->m_status = STATUS_PLAYER;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!(CTimer::GetFrameCounter() & 31)) {
|
||||
CVehicle *veh = FindPlayerVehicle();
|
||||
if (veh && m_pPed->bInVehicle && veh->GetUp().z < 0.0f
|
||||
&& veh->m_vecMoveSpeed.Magnitude() < 0.05f && veh->IsCar() && !veh->bIsInWater) {
|
||||
|
||||
if (veh->GetUp().z < -0.5f) {
|
||||
m_nUpsideDownCounter += 2;
|
||||
|
||||
} else {
|
||||
m_nUpsideDownCounter++;
|
||||
}
|
||||
} else {
|
||||
m_nUpsideDownCounter = 0;
|
||||
}
|
||||
|
||||
if (m_nUpsideDownCounter > 6 && veh->bCanBeDamaged) {
|
||||
veh->m_fHealth = 249.0f < veh->m_fHealth ? 249.0f : veh->m_fHealth;
|
||||
if (veh->IsCar()) {
|
||||
CAutomobile* car = (CAutomobile*)veh;
|
||||
car->Damage.SetEngineStatus(225);
|
||||
car->m_pSetOnFireEntity = nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (FindPlayerVehicle()) {
|
||||
CVehicle *veh = FindPlayerVehicle();
|
||||
veh->m_nZoneLevel = -1;
|
||||
for (int i = 0; i < ARRAY_SIZE(veh->pPassengers); i++) {
|
||||
if (veh->pPassengers[i])
|
||||
veh->pPassengers[i]->m_nZoneLevel = 0;
|
||||
}
|
||||
CStats::DistanceTravelledInVehicle += veh->m_fDistanceTravelled;
|
||||
} else {
|
||||
CStats::DistanceTravelledOnFoot += FindPlayerPed()->m_fDistanceTravelled;
|
||||
}
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x4A1700, &CPlayerInfo::LoadPlayerSkin, PATCH_JUMP);
|
||||
InjectHook(0x4A1750, &CPlayerInfo::DeletePlayerSkin, PATCH_JUMP);
|
||||
InjectHook(0x4A12E0, &CPlayerInfo::KillPlayer, PATCH_JUMP);
|
||||
InjectHook(0x4A1330, &CPlayerInfo::ArrestPlayer, PATCH_JUMP);
|
||||
InjectHook(0x4B5DC0, &CPlayerInfo::dtor, PATCH_JUMP);
|
||||
InjectHook(0x4A1700, &CPlayerInfo::LoadPlayerSkin, PATCH_JUMP);
|
||||
InjectHook(0x4A1750, &CPlayerInfo::DeletePlayerSkin, PATCH_JUMP);
|
||||
InjectHook(0x4A12E0, &CPlayerInfo::KillPlayer, PATCH_JUMP);
|
||||
InjectHook(0x4A1330, &CPlayerInfo::ArrestPlayer, PATCH_JUMP);
|
||||
InjectHook(0x49FC10, &CPlayerInfo::Clear, PATCH_JUMP);
|
||||
InjectHook(0x4A15C0, &CPlayerInfo::BlowUpRCBuggy, PATCH_JUMP);
|
||||
InjectHook(0x4A13B0, &CPlayerInfo::CancelPlayerEnteringCars, PATCH_JUMP);
|
||||
InjectHook(0x4A1400, &CPlayerInfo::MakePlayerSafe, PATCH_JUMP);
|
||||
InjectHook(0x4A0EC0, &CPlayerInfo::EvaluateCarPosition, PATCH_JUMP);
|
||||
InjectHook(0x4A15F0, &CPlayerInfo::AwardMoneyForExplosion, PATCH_JUMP);
|
||||
InjectHook(0x4A0B20, &CPlayerInfo::LoadPlayerInfo, PATCH_JUMP);
|
||||
InjectHook(0x4A0960, &CPlayerInfo::SavePlayerInfo, PATCH_JUMP);
|
||||
InjectHook(0x49FD30, &CPlayerInfo::Process, PATCH_JUMP);
|
||||
ENDPATCHES
|
||||
|
@ -10,6 +10,8 @@ enum eWastedBustedState
|
||||
WBSTATE_FAILED_CRITICAL_MISSION,
|
||||
};
|
||||
|
||||
class CEntity;
|
||||
class CPed;
|
||||
class CVehicle;
|
||||
class CPlayerPed;
|
||||
class CCivilianPed;
|
||||
@ -27,20 +29,20 @@ public:
|
||||
int32 m_nCollectedPackages;
|
||||
int32 m_nTotalPackages;
|
||||
uint32 m_nLastBumpPlayerCarTimer;
|
||||
int32 m_nSwitchTaxiTime;
|
||||
bool m_bSwitchTaxi;
|
||||
uint32 m_nUnusedTaxiTimer;
|
||||
bool m_bUnusedTaxiThing;
|
||||
int8 field_197;
|
||||
int8 field_198;
|
||||
int8 field_199;
|
||||
int32 m_nNextSexFrequencyUpdateTime;
|
||||
int32 m_nNextSexMoneyUpdateTime;
|
||||
uint32 m_nNextSexFrequencyUpdateTime;
|
||||
uint32 m_nNextSexMoneyUpdateTime;
|
||||
int32 m_nSexFrequency;
|
||||
CCivilianPed *m_pHooker;
|
||||
int8 m_WBState; // eWastedBustedState
|
||||
int8 field_217;
|
||||
int8 field_218;
|
||||
int8 field_219;
|
||||
int32 m_nWBTime;
|
||||
uint32 m_nWBTime;
|
||||
bool m_bInRemoteMode;
|
||||
int8 field_225;
|
||||
int8 field_226;
|
||||
@ -55,7 +57,7 @@ public:
|
||||
int8 field_254;
|
||||
int8 field_255;
|
||||
float m_fRoadDensity;
|
||||
int32 m_nPreviousTimeRewardedForExplosion;
|
||||
uint32 m_nPreviousTimeRewardedForExplosion;
|
||||
int32 m_nExplosionsSinceLastReward;
|
||||
int32 field_268;
|
||||
int32 field_272;
|
||||
@ -77,6 +79,18 @@ public:
|
||||
void ArrestPlayer(void);
|
||||
bool IsPlayerInRemoteMode(void);
|
||||
void PlayerFailedCriticalMission(void);
|
||||
void Clear(void);
|
||||
void BlowUpRCBuggy(void);
|
||||
void CancelPlayerEnteringCars(CVehicle*);
|
||||
bool IsRestartingAfterDeath(void);
|
||||
bool IsRestartingAfterArrest(void);
|
||||
void EvaluateCarPosition(CEntity*, CPed*, float, float*, CVehicle**);
|
||||
void LoadPlayerInfo(uint8 *buf, uint32 size);
|
||||
void SavePlayerInfo(uint8 *buf, uint32* size);
|
||||
void FindClosestCarSectorList(CPtrList&, CPed*, float, float, float, float, float*, CVehicle**);
|
||||
|
||||
~CPlayerInfo() { };
|
||||
void dtor(void) { this->CPlayerInfo::~CPlayerInfo(); }
|
||||
};
|
||||
|
||||
static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerInfo: error");
|
||||
|
@ -28,7 +28,7 @@ FindPlayerDff(uint32 &offset, uint32 &size)
|
||||
do {
|
||||
if (!CFileMgr::Read(file, (char*)&info, sizeof(CDirectory::DirectoryInfo)))
|
||||
return;
|
||||
} while (strcmpi("player.dff", info.name));
|
||||
} while (strcasecmp("player.dff", info.name) != 0);
|
||||
|
||||
offset = info.offset;
|
||||
size = info.size;
|
||||
@ -94,7 +94,7 @@ CPlayerSkin::GetSkinTexture(const char *texName)
|
||||
CTxdStore::PopCurrentTxd();
|
||||
if (tex) return tex;
|
||||
|
||||
if (!strcmp(DEFAULT_SKIN_NAME, texName))
|
||||
if (strcmp(DEFAULT_SKIN_NAME, texName) == 0)
|
||||
sprintf(gString, "models\\generic\\player.bmp");
|
||||
else
|
||||
sprintf(gString, "skins\\%s.bmp", texName);
|
||||
|
@ -312,7 +312,7 @@ void CRadar::DrawBlips()
|
||||
break;
|
||||
case BLIP_CHAR:
|
||||
blipEntity = CPools::GetPedPool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
|
||||
if (blipEntity && ((CPed*)blipEntity)->bInVehicle && ((CPed*)blipEntity)->m_pMyVehicle) {
|
||||
if (blipEntity && ((CPed*)blipEntity)->InVehicle()) {
|
||||
blipEntity = ((CPed*)blipEntity)->m_pMyVehicle;
|
||||
}
|
||||
break;
|
||||
@ -415,7 +415,7 @@ void CRadar::DrawBlips()
|
||||
break;
|
||||
case BLIP_CHAR:
|
||||
blipEntity = CPools::GetPedPool()->GetAt(ms_RadarTrace[blipId].m_nEntityHandle);
|
||||
if (blipEntity && ((CPed*)blipEntity)->bInVehicle && ((CPed*)blipEntity)->m_pMyVehicle) {
|
||||
if (blipEntity && ((CPed*)blipEntity)->InVehicle()) {
|
||||
blipEntity = ((CPed*)blipEntity)->m_pMyVehicle;
|
||||
}
|
||||
break;
|
||||
|
@ -12,6 +12,8 @@ int32 *CStats::PedsKilledOfThisType = (int32*)0x880DBC;
|
||||
int32 &CStats::TimesDied = *(int32*)0x8E2BDC;
|
||||
int32 &CStats::TimesArrested = *(int32*)0x8E2BEC;
|
||||
int32 &CStats::KillsSinceLastCheckpoint = *(int32*)0x8F2C8C;
|
||||
int32& CStats::DistanceTravelledInVehicle = *(int32*)0x940574;
|
||||
int32& CStats::DistanceTravelledOnFoot = *(int32*)0x941518;
|
||||
int32 &CStats::ProgressMade = *(int32*)0x8F6224;
|
||||
int32 &CStats::TotalProgressInGame = *(int32*)0x885B2C;
|
||||
float &CStats::MaximumJumpDistance = *(float*)0x8F2BDC;
|
||||
|
@ -14,6 +14,8 @@ public:
|
||||
static int32 &TimesDied;
|
||||
static int32 &TimesArrested;
|
||||
static int32 &KillsSinceLastCheckpoint;
|
||||
static int32 &DistanceTravelledInVehicle;
|
||||
static int32 &DistanceTravelledOnFoot;
|
||||
static int32 &ProgressMade;
|
||||
static int32 &TotalProgressInGame;
|
||||
static float &MaximumJumpDistance;
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "General.h"
|
||||
#include "Pad.h"
|
||||
#include "Hud.h"
|
||||
#include "Text.h"
|
||||
@ -347,7 +348,7 @@ CStreaming::LoadCdDirectory(const char *dirname, int n)
|
||||
if(direntry.size > (uint32)ms_streamingBufferSize)
|
||||
ms_streamingBufferSize = direntry.size;
|
||||
|
||||
if(strcmp(dot+1, "DFF") == 0 || strcmp(dot+1, "dff") == 0){
|
||||
if(!CGeneral::faststrcmp(dot+1, "DFF") || !CGeneral::faststrcmp(dot+1, "dff")){
|
||||
if(CModelInfo::GetModelInfo(direntry.name, &modelId)){
|
||||
if(ms_aInfoForModel[modelId].GetCdPosnAndSize(posn, size)){
|
||||
debug("%s appears more than once in %s\n", direntry.name, dirname);
|
||||
@ -364,20 +365,20 @@ CStreaming::LoadCdDirectory(const char *dirname, int n)
|
||||
ms_pExtraObjectsDir->AddItem(direntry);
|
||||
lastID = -1;
|
||||
}
|
||||
}else if(strcmp(dot+1, "TXD") == 0 || strcmp(dot+1, "txd") == 0){
|
||||
}else if(!CGeneral::faststrcmp(dot+1, "TXD") || !CGeneral::faststrcmp(dot+1, "txd")){
|
||||
txdId = CTxdStore::FindTxdSlot(direntry.name);
|
||||
if(txdId == -1)
|
||||
txdId = CTxdStore::AddTxdSlot(direntry.name);
|
||||
if(ms_aInfoForModel[txdId + STREAM_OFFSET_TXD].GetCdPosnAndSize(posn, size)){
|
||||
debug("%s appears more than once in %s\n", direntry.name, dirname);
|
||||
lastID = -1;
|
||||
}else{
|
||||
direntry.offset |= imgSelector;
|
||||
ms_aInfoForModel[txdId + STREAM_OFFSET_TXD].SetCdPosnAndSize(direntry.offset, direntry.size);
|
||||
if(lastID != -1)
|
||||
ms_aInfoForModel[lastID].m_nextID = txdId + STREAM_OFFSET_TXD;
|
||||
lastID = txdId + STREAM_OFFSET_TXD;
|
||||
}
|
||||
if(ms_aInfoForModel[txdId + STREAM_OFFSET_TXD].GetCdPosnAndSize(posn, size)){
|
||||
debug("%s appears more than once in %s\n", direntry.name, dirname);
|
||||
lastID = -1;
|
||||
}else{
|
||||
direntry.offset |= imgSelector;
|
||||
ms_aInfoForModel[txdId + STREAM_OFFSET_TXD].SetCdPosnAndSize(direntry.offset, direntry.size);
|
||||
if(lastID != -1)
|
||||
ms_aInfoForModel[lastID].m_nextID = txdId + STREAM_OFFSET_TXD;
|
||||
lastID = txdId + STREAM_OFFSET_TXD;
|
||||
}
|
||||
}else
|
||||
lastID = -1;
|
||||
}
|
||||
@ -720,7 +721,7 @@ CStreaming::RequestSpecialModel(int32 modelId, const char *modelName, int32 flag
|
||||
uint32 pos, size;
|
||||
|
||||
mi = CModelInfo::GetModelInfo(modelId);
|
||||
if(strcmp(mi->GetName(), modelName) == 0){
|
||||
if(!CGeneral::faststrcmp(mi->GetName(), modelName)){
|
||||
// Already have the correct name, just request it
|
||||
RequestModel(modelId, flags);
|
||||
return;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "TempColModels.h"
|
||||
#include "SurfaceTable.h"
|
||||
|
||||
CColModel &CTempColModels::ms_colModelPed1 = *(CColModel*)0x726CB0;
|
||||
CColModel &CTempColModels::ms_colModelPed2 = *(CColModel*)0x726D08;
|
||||
@ -16,4 +17,277 @@ CColModel &CTempColModels::ms_colModelBoot1 = *(CColModel*)0x880670;
|
||||
CColModel &CTempColModels::ms_colModelDoor1 = *(CColModel*)0x880850;
|
||||
CColModel &CTempColModels::ms_colModelBonnet1 = *(CColModel*)0x8808A8;
|
||||
|
||||
WRAPPER void CTempColModels::Initialise(void) { EAXJMP(0x412160); }
|
||||
|
||||
CColSphere s_aPedSpheres[3];
|
||||
CColSphere s_aPed2Spheres[3];
|
||||
CColSphere s_aPedGSpheres[4];
|
||||
CColSphere s_aDoorSpheres[4];
|
||||
CColSphere s_aBumperSpheres[4];
|
||||
CColSphere s_aPanelSpheres[4];
|
||||
CColSphere s_aBonnetSpheres[4];
|
||||
CColSphere s_aBootSpheres[4];
|
||||
CColSphere s_aWheelSpheres[2];
|
||||
CColSphere s_aBodyPartSpheres1[2];
|
||||
CColSphere s_aBodyPartSpheres2[2];
|
||||
|
||||
void
|
||||
CTempColModels::Initialise(void)
|
||||
{
|
||||
#define SET_COLMODEL_SPHERES(colmodel, sphrs)\
|
||||
colmodel.numSpheres = ARRAYSIZE(sphrs);\
|
||||
colmodel.spheres = sphrs;\
|
||||
colmodel.level = LEVEL_NONE;\
|
||||
colmodel.ownsCollisionVolumes = false;\
|
||||
|
||||
int i;
|
||||
|
||||
ms_colModelBBox.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0);
|
||||
ms_colModelBBox.boundingBox.Set(CVector(-2.0f, -2.0f, -2.0f), CVector(2.0f, 2.0f, 2.0f), SURFACE_DEFAULT, 0);
|
||||
ms_colModelBBox.level = LEVEL_NONE;
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(ms_colModelCutObj); i++) {
|
||||
ms_colModelCutObj[i].boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0);
|
||||
ms_colModelCutObj[i].boundingBox.Set(CVector(-2.0f, -2.0f, -2.0f), CVector(2.0f, 2.0f, 2.0f), SURFACE_DEFAULT, 0);
|
||||
ms_colModelCutObj[i].level = LEVEL_NONE;
|
||||
}
|
||||
|
||||
// Ped Spheres
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(s_aPedSpheres); i++)
|
||||
s_aPedSpheres[i].radius = 0.35f;
|
||||
|
||||
s_aPedSpheres[0].center = CVector(0.0f, 0.0f, -0.25f);
|
||||
s_aPedSpheres[1].center = CVector(0.0f, 0.0f, 0.15f);
|
||||
s_aPedSpheres[2].center = CVector(0.0f, 0.0f, 0.55f);
|
||||
|
||||
#ifdef FIX_BUGS
|
||||
for (i = 0; i < ARRAYSIZE(s_aPedSpheres); i++) {
|
||||
#else
|
||||
for (i = 0; i < ARRAYSIZE(s_aPedGSpheres); i++) {
|
||||
#endif
|
||||
s_aPedSpheres[i].surface = SURFACE_FLESH;
|
||||
s_aPedSpheres[i].piece = 0;
|
||||
}
|
||||
|
||||
ms_colModelPed1.boundingSphere.Set(1.25f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0);
|
||||
ms_colModelPed1.boundingBox.Set(CVector(-0.35f, -0.35f, -1.0f), CVector(0.35f, 0.35f, 0.9f), SURFACE_DEFAULT, 0);
|
||||
SET_COLMODEL_SPHERES(ms_colModelPed1, s_aPedSpheres);
|
||||
|
||||
// Ped 2 Spheres
|
||||
|
||||
s_aPed2Spheres[0].radius = 0.3f;
|
||||
s_aPed2Spheres[1].radius = 0.4f;
|
||||
s_aPed2Spheres[2].radius = 0.3f;
|
||||
|
||||
s_aPed2Spheres[0].center = CVector(0.0f, 0.35f, -0.9f);
|
||||
s_aPed2Spheres[1].center = CVector(0.0f, 0.0f, -0.9f);
|
||||
s_aPed2Spheres[2].center = CVector(0.0f, -0.35f, -0.9f);
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(s_aPed2Spheres); i++) {
|
||||
s_aPed2Spheres[i].surface = SURFACE_FLESH;
|
||||
s_aPed2Spheres[i].piece = 0;
|
||||
}
|
||||
|
||||
ms_colModelPed2.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0);
|
||||
ms_colModelPed2.boundingBox.Set(CVector(-0.7f, -0.7f, -1.2f), CVector(0.7f, 0.7f, 0.0f), SURFACE_DEFAULT, 0);
|
||||
|
||||
SET_COLMODEL_SPHERES(ms_colModelPed2, s_aPed2Spheres);
|
||||
|
||||
// Ped ground collision
|
||||
|
||||
s_aPedGSpheres[0].radius = 0.35f;
|
||||
s_aPedGSpheres[1].radius = 0.35f;
|
||||
s_aPedGSpheres[2].radius = 0.35f;
|
||||
s_aPedGSpheres[3].radius = 0.3f;
|
||||
|
||||
s_aPedGSpheres[0].center = CVector(0.0f, -0.4f, -0.9f);
|
||||
s_aPedGSpheres[1].center = CVector(0.0f, -0.1f, -0.9f);
|
||||
s_aPedGSpheres[2].center = CVector(0.0f, 0.25f, -0.9f);
|
||||
s_aPedGSpheres[3].center = CVector(0.0f, 0.65f, -0.9f);
|
||||
|
||||
s_aPedGSpheres[0].surface = SURFACE_FLESH;
|
||||
s_aPedGSpheres[1].surface = SURFACE_FLESH;
|
||||
s_aPedGSpheres[2].surface = SURFACE_FLESH;
|
||||
s_aPedGSpheres[3].surface = SURFACE_FLESH;
|
||||
s_aPedGSpheres[0].piece = 4;
|
||||
s_aPedGSpheres[1].piece = 1;
|
||||
s_aPedGSpheres[2].piece = 0;
|
||||
s_aPedGSpheres[3].piece = 6;
|
||||
|
||||
ms_colModelPedGroundHit.boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0);
|
||||
ms_colModelPedGroundHit.boundingBox.Set(CVector(-0.4f, -1.0f, -1.25f), CVector(0.4f, 1.2f, -0.5f), SURFACE_DEFAULT, 0);
|
||||
|
||||
SET_COLMODEL_SPHERES(ms_colModelPedGroundHit, s_aPedGSpheres);
|
||||
|
||||
// Door Spheres
|
||||
|
||||
s_aDoorSpheres[0].radius = 0.15f;
|
||||
s_aDoorSpheres[1].radius = 0.15f;
|
||||
s_aDoorSpheres[2].radius = 0.25f;
|
||||
|
||||
s_aDoorSpheres[0].center = CVector(0.0f, -0.25f, -0.35f);
|
||||
s_aDoorSpheres[1].center = CVector(0.0f, -0.95f, -0.35f);
|
||||
s_aDoorSpheres[2].center = CVector(0.0f, -0.6f, 0.25f);
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(s_aDoorSpheres); i++) {
|
||||
s_aDoorSpheres[i].surface = SURFACE_BILLBOARD;
|
||||
s_aDoorSpheres[i].piece = 0;
|
||||
}
|
||||
|
||||
ms_colModelDoor1.boundingSphere.Set(1.5f, CVector(0.0f, -0.6f, 0.0f), SURFACE_DEFAULT, 0);
|
||||
ms_colModelDoor1.boundingBox.Set(CVector(-0.3f, 0.0f, -0.6f), CVector(0.3f, -1.2f, 0.6f), SURFACE_DEFAULT, 0);
|
||||
|
||||
SET_COLMODEL_SPHERES(ms_colModelDoor1, s_aDoorSpheres);
|
||||
|
||||
// Bumper Spheres
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(s_aBumperSpheres); i++)
|
||||
s_aBumperSpheres[i].radius = 0.15f;
|
||||
|
||||
s_aBumperSpheres[0].center = CVector(0.85f, -0.05f, 0.0f);
|
||||
s_aBumperSpheres[1].center = CVector(0.4f, 0.05f, 0.0f);
|
||||
s_aBumperSpheres[2].center = CVector(-0.4f, 0.05f, 0.0f);
|
||||
s_aBumperSpheres[3].center = CVector(-0.85f, -0.05f, 0.0f);
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(s_aBumperSpheres); i++) {
|
||||
s_aBumperSpheres[i].surface = SURFACE_BILLBOARD;
|
||||
s_aBumperSpheres[i].piece = 0;
|
||||
}
|
||||
|
||||
ms_colModelBumper1.boundingSphere.Set(2.2f, CVector(0.0f, -0.6f, 0.0f), SURFACE_DEFAULT, 0);
|
||||
ms_colModelBumper1.boundingBox.Set(CVector(-1.2f, -0.3f, -0.2f), CVector(1.2f, 0.3f, -0.2f), SURFACE_DEFAULT, 0);
|
||||
|
||||
SET_COLMODEL_SPHERES(ms_colModelBumper1, s_aBumperSpheres);
|
||||
|
||||
// Panel Spheres
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(s_aPanelSpheres); i++)
|
||||
s_aPanelSpheres[i].radius = 0.15f;
|
||||
|
||||
s_aPanelSpheres[0].center = CVector(0.15f, 0.45f, 0.0f);
|
||||
s_aPanelSpheres[1].center = CVector(0.15f, -0.45f, 0.0f);
|
||||
s_aPanelSpheres[2].center = CVector(-0.15f, -0.45f, 0.0f);
|
||||
s_aPanelSpheres[3].center = CVector(-0.15f, 0.45f, 0.0f);
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(s_aPanelSpheres); i++) {
|
||||
s_aPanelSpheres[i].surface = SURFACE_BILLBOARD;
|
||||
s_aPanelSpheres[i].piece = 0;
|
||||
}
|
||||
|
||||
ms_colModelPanel1.boundingSphere.Set(1.4f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0);
|
||||
ms_colModelPanel1.boundingBox.Set(CVector(-0.3f, -0.6f, -0.15f), CVector(0.3f, 0.6f, 0.15f), SURFACE_DEFAULT, 0);
|
||||
|
||||
SET_COLMODEL_SPHERES(ms_colModelPanel1, s_aPanelSpheres);
|
||||
|
||||
// Bonnet Spheres
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(s_aBonnetSpheres); i++)
|
||||
s_aBonnetSpheres[i].radius = 0.2f;
|
||||
|
||||
s_aBonnetSpheres[0].center = CVector(-0.4f, 0.1f, 0.0f);
|
||||
s_aBonnetSpheres[1].center = CVector(-0.4f, 0.9f, 0.0f);
|
||||
s_aBonnetSpheres[2].center = CVector(0.4f, 0.1f, 0.0f);
|
||||
s_aBonnetSpheres[3].center = CVector(0.4f, 0.9f, 0.0f);
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(s_aBonnetSpheres); i++) {
|
||||
s_aBonnetSpheres[i].surface = SURFACE_BILLBOARD;
|
||||
s_aBonnetSpheres[i].piece = 0;
|
||||
}
|
||||
|
||||
ms_colModelBonnet1.boundingSphere.Set(1.7f, CVector(0.0f, 0.5f, 0.0f), SURFACE_DEFAULT, 0);
|
||||
ms_colModelBonnet1.boundingBox.Set(CVector(-0.7f, -0.2f, -0.3f), CVector(0.7f, 1.2f, 0.3f), SURFACE_DEFAULT, 0);
|
||||
|
||||
SET_COLMODEL_SPHERES(ms_colModelBonnet1, s_aBonnetSpheres);
|
||||
|
||||
// Boot Spheres
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(s_aBootSpheres); i++)
|
||||
s_aBootSpheres[i].radius = 0.2f;
|
||||
|
||||
s_aBootSpheres[0].center = CVector(-0.4f, -0.1f, 0.0f);
|
||||
s_aBootSpheres[1].center = CVector(-0.4f, -0.6f, 0.0f);
|
||||
s_aBootSpheres[2].center = CVector(0.4f, -0.1f, 0.0f);
|
||||
s_aBootSpheres[3].center = CVector(0.4f, -0.6f, 0.0f);
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(s_aBootSpheres); i++) {
|
||||
s_aBootSpheres[i].surface = SURFACE_BILLBOARD;
|
||||
s_aBootSpheres[i].piece = 0;
|
||||
}
|
||||
|
||||
ms_colModelBoot1.boundingSphere.Set(1.4f, CVector(0.0f, -0.4f, 0.0f), SURFACE_DEFAULT, 0);
|
||||
ms_colModelBoot1.boundingBox.Set(CVector(-0.7f, -0.9f, -0.3f), CVector(0.7f, 0.2f, 0.3f), SURFACE_DEFAULT, 0);
|
||||
|
||||
SET_COLMODEL_SPHERES(ms_colModelBoot1, s_aBootSpheres);
|
||||
|
||||
// Wheel Spheres
|
||||
|
||||
s_aWheelSpheres[0].radius = 0.35f;
|
||||
s_aWheelSpheres[1].radius = 0.35f;
|
||||
|
||||
s_aWheelSpheres[0].center = CVector(-0.3f, 0.0f, 0.0f);
|
||||
s_aWheelSpheres[1].center = CVector(0.3f, 0.0f, 0.0f);
|
||||
|
||||
#ifdef FIX_BUGS
|
||||
for (i = 0; i < ARRAYSIZE(s_aWheelSpheres); i++) {
|
||||
#else
|
||||
for (i = 0; i < ARRAYSIZE(s_aBootSpheres); i++) {
|
||||
#endif
|
||||
s_aWheelSpheres[i].surface = SURFACE_RUBBER29;
|
||||
s_aWheelSpheres[i].piece = 0;
|
||||
}
|
||||
|
||||
ms_colModelWheel1.boundingSphere.Set(1.4f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0);
|
||||
ms_colModelWheel1.boundingBox.Set(CVector(-0.7f, -0.4f, -0.4f), CVector(0.7f, 0.4f, 0.4f), SURFACE_DEFAULT, 0);
|
||||
|
||||
SET_COLMODEL_SPHERES(ms_colModelWheel1, s_aWheelSpheres);
|
||||
|
||||
// Body Part Spheres 1
|
||||
|
||||
s_aBodyPartSpheres1[0].radius = 0.2f;
|
||||
s_aBodyPartSpheres1[1].radius = 0.2f;
|
||||
|
||||
s_aBodyPartSpheres1[0].center = CVector(0.0f, 0.0f, 0.0f);
|
||||
s_aBodyPartSpheres1[1].center = CVector(0.8f, 0.0f, 0.0f);
|
||||
|
||||
#ifdef FIX_BUGS
|
||||
for (i = 0; i < ARRAYSIZE(s_aBodyPartSpheres1); i++) {
|
||||
#else
|
||||
for (i = 0; i < ARRAYSIZE(s_aBootSpheres); i++) {
|
||||
#endif
|
||||
s_aBodyPartSpheres1[i].surface = SURFACE_FLESH;
|
||||
s_aBodyPartSpheres1[i].piece = 0;
|
||||
}
|
||||
|
||||
ms_colModelBodyPart1.boundingSphere.Set(0.7f, CVector(0.4f, 0.0f, 0.0f), SURFACE_DEFAULT, 0);
|
||||
ms_colModelBodyPart1.boundingBox.Set(CVector(-0.3f, -0.3f, -0.3f), CVector(1.1f, 0.3f, 0.3f), SURFACE_DEFAULT, 0);
|
||||
|
||||
SET_COLMODEL_SPHERES(ms_colModelBodyPart1, s_aBodyPartSpheres1);
|
||||
|
||||
// Body Part Spheres 2
|
||||
|
||||
s_aBodyPartSpheres2[0].radius = 0.15f;
|
||||
s_aBodyPartSpheres2[1].radius = 0.15f;
|
||||
|
||||
s_aBodyPartSpheres2[0].center = CVector(0.0f, 0.0f, 0.0f);
|
||||
s_aBodyPartSpheres2[1].center = CVector(0.5f, 0.0f, 0.0f);
|
||||
|
||||
#ifdef FIX_BUGS
|
||||
for (i = 0; i < ARRAYSIZE(s_aBodyPartSpheres2); i++) {
|
||||
#else
|
||||
for (i = 0; i < ARRAYSIZE(s_aBootSpheres); i++) {
|
||||
#endif
|
||||
s_aBodyPartSpheres2[i].surface = SURFACE_FLESH;
|
||||
s_aBodyPartSpheres2[i].piece = 0;
|
||||
}
|
||||
|
||||
ms_colModelBodyPart2.boundingSphere.Set(0.5f, CVector(0.25f, 0.0f, 0.0f), SURFACE_DEFAULT, 0);
|
||||
ms_colModelBodyPart2.boundingBox.Set(CVector(-0.2f, -0.2f, -0.2f), CVector(0.7f, 0.2f, 0.2f), SURFACE_DEFAULT, 0);
|
||||
|
||||
SET_COLMODEL_SPHERES(ms_colModelBodyPart2, s_aBodyPartSpheres2);
|
||||
|
||||
#undef SET_COLMODEL_SPHERES
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x412160, CTempColModels::Initialise, PATCH_JUMP);
|
||||
ENDPATCHES
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "templates.h"
|
||||
#include "General.h"
|
||||
#include "Streaming.h"
|
||||
#include "RwHelper.h"
|
||||
#include "TxdStore.h"
|
||||
@ -61,7 +62,7 @@ CTxdStore::FindTxdSlot(const char *name)
|
||||
int size = ms_pTxdPool->GetSize();
|
||||
for(int i = 0; i < size; i++){
|
||||
defname = GetTxdName(i);
|
||||
if(defname && _strcmpi(defname, name) == 0)
|
||||
if(defname && !CGeneral::faststricmp(defname, name))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
|
@ -140,7 +140,7 @@ bool COnscreenTimerEntry::ProcessForDisplay() {
|
||||
|
||||
if(m_nTimerOffset != 0) {
|
||||
m_bTimerProcessed = true;
|
||||
ProcessForDisplayTimer();
|
||||
ProcessForDisplayClock();
|
||||
}
|
||||
|
||||
if(m_nCounterOffset != 0) {
|
||||
@ -150,21 +150,21 @@ bool COnscreenTimerEntry::ProcessForDisplay() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int COnscreenTimerEntry::ProcessForDisplayTimer() {
|
||||
void COnscreenTimerEntry::ProcessForDisplayClock() {
|
||||
uint32 time = *(uint32*)&CTheScripts::ScriptSpace[m_nTimerOffset];
|
||||
return sprintf(m_bTimerBuffer, "%02d:%02d", time / 1000 / 60,
|
||||
sprintf(m_bTimerBuffer, "%02d:%02d", time / 1000 / 60,
|
||||
time / 1000 % 60);
|
||||
}
|
||||
|
||||
int COnscreenTimerEntry::ProcessForDisplayCounter() {
|
||||
void COnscreenTimerEntry::ProcessForDisplayCounter() {
|
||||
uint32 counter = *(uint32*)&CTheScripts::ScriptSpace[m_nCounterOffset];
|
||||
return sprintf(m_bCounterBuffer, "%d", counter);
|
||||
sprintf(m_bCounterBuffer, "%d", counter);
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x429160, &COnscreenTimerEntry::Process, PATCH_JUMP);
|
||||
InjectHook(0x429110, &COnscreenTimerEntry::ProcessForDisplay, PATCH_JUMP);
|
||||
InjectHook(0x429080, &COnscreenTimerEntry::ProcessForDisplayTimer, PATCH_JUMP);
|
||||
InjectHook(0x429080, &COnscreenTimerEntry::ProcessForDisplayClock, PATCH_JUMP);
|
||||
InjectHook(0x4290F0, &COnscreenTimerEntry::ProcessForDisplayCounter, PATCH_JUMP);
|
||||
|
||||
InjectHook(0x429220, &COnscreenTimer::Init, PATCH_JUMP);
|
||||
|
@ -18,8 +18,8 @@ public:
|
||||
void Process();
|
||||
bool ProcessForDisplay();
|
||||
|
||||
int ProcessForDisplayTimer();
|
||||
int ProcessForDisplayCounter();
|
||||
void ProcessForDisplayClock();
|
||||
void ProcessForDisplayCounter();
|
||||
};
|
||||
|
||||
static_assert(sizeof(COnscreenTimerEntry) == 0x74, "COnscreenTimerEntry: error");
|
||||
|
@ -859,8 +859,8 @@ FindPlayerPed(void)
|
||||
CVehicle*
|
||||
FindPlayerVehicle(void)
|
||||
{
|
||||
CPlayerPed *ped = CWorld::Players[CWorld::PlayerInFocus].m_pPed;
|
||||
if(ped->bInVehicle && ped->m_pMyVehicle)
|
||||
CPlayerPed *ped = FindPlayerPed();
|
||||
if(ped->InVehicle())
|
||||
return ped->m_pMyVehicle;
|
||||
else
|
||||
return nil;
|
||||
@ -878,8 +878,8 @@ FindPlayerTrain(void)
|
||||
CEntity*
|
||||
FindPlayerEntity(void)
|
||||
{
|
||||
CPlayerPed *ped = CWorld::Players[CWorld::PlayerInFocus].m_pPed;
|
||||
if(ped->bInVehicle && ped->m_pMyVehicle)
|
||||
CPlayerPed *ped = FindPlayerPed();
|
||||
if(ped->InVehicle())
|
||||
return ped->m_pMyVehicle;
|
||||
else
|
||||
return ped;
|
||||
@ -888,8 +888,8 @@ FindPlayerEntity(void)
|
||||
CVector
|
||||
FindPlayerCoors(void)
|
||||
{
|
||||
CPlayerPed *ped = CWorld::Players[CWorld::PlayerInFocus].m_pPed;
|
||||
if(ped->bInVehicle && ped->m_pMyVehicle)
|
||||
CPlayerPed *ped = FindPlayerPed();
|
||||
if(ped->InVehicle())
|
||||
return ped->m_pMyVehicle->GetPosition();
|
||||
else
|
||||
return ped->GetPosition();
|
||||
@ -898,8 +898,8 @@ FindPlayerCoors(void)
|
||||
CVector&
|
||||
FindPlayerSpeed(void)
|
||||
{
|
||||
CPlayerPed *ped = CWorld::Players[CWorld::PlayerInFocus].m_pPed;
|
||||
if(ped->bInVehicle && ped->m_pMyVehicle)
|
||||
CPlayerPed *ped = FindPlayerPed();
|
||||
if(ped->InVehicle())
|
||||
return ped->m_pMyVehicle->m_vecMoveSpeed;
|
||||
else
|
||||
return ped->m_vecMoveSpeed;
|
||||
@ -926,7 +926,7 @@ FindPlayerCentreOfWorld_NoSniperShift(void)
|
||||
return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetPosition();
|
||||
if(FindPlayerVehicle())
|
||||
return FindPlayerVehicle()->GetPosition();
|
||||
return CWorld::Players[CWorld::PlayerInFocus].m_pPed->GetPosition();
|
||||
return FindPlayerPed()->GetPosition();
|
||||
}
|
||||
|
||||
float
|
||||
@ -936,7 +936,7 @@ FindPlayerHeading(void)
|
||||
return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetForward().Heading();
|
||||
if(FindPlayerVehicle())
|
||||
return FindPlayerVehicle()->GetForward().Heading();
|
||||
return CWorld::Players[CWorld::PlayerInFocus].m_pPed->GetForward().Heading();
|
||||
return FindPlayerPed()->GetForward().Heading();
|
||||
}
|
||||
|
||||
void
|
||||
@ -1011,6 +1011,30 @@ CWorld::StopAllLawEnforcersInTheirTracks(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CWorld::SetAllCarsCanBeDamaged(bool toggle)
|
||||
{
|
||||
int poolSize = CPools::GetVehiclePool()->GetSize();
|
||||
for (int poolIndex = 0; poolIndex < poolSize; poolIndex++) {
|
||||
CVehicle *veh = CPools::GetVehiclePool()->GetSlot(poolIndex);
|
||||
if (veh)
|
||||
veh->bCanBeDamaged = toggle;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CWorld::ExtinguishAllCarFiresInArea(CVector point, float range)
|
||||
{
|
||||
int poolSize = CPools::GetVehiclePool()->GetSize();
|
||||
for (int poolIndex = 0; poolIndex < poolSize; poolIndex++) {
|
||||
CVehicle* veh = CPools::GetVehiclePool()->GetSlot(poolIndex);
|
||||
if (veh) {
|
||||
if ((point - veh->GetPosition()).MagnitudeSqr() < sq(range))
|
||||
veh->ExtinguishCarFire();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CWorld::Process(void)
|
||||
{
|
||||
@ -1212,5 +1236,9 @@ STARTPATCHES
|
||||
InjectHook(0x4B3AE0, CWorld::FindGroundZFor3DCoord, PATCH_JUMP);
|
||||
InjectHook(0x4B3B50, CWorld::FindRoofZFor3DCoord, PATCH_JUMP);
|
||||
|
||||
InjectHook(0x4B5BC0, CWorld::StopAllLawEnforcersInTheirTracks, PATCH_JUMP);
|
||||
InjectHook(0x4B53F0, CWorld::SetAllCarsCanBeDamaged, PATCH_JUMP);
|
||||
InjectHook(0x4B5460, CWorld::ExtinguishAllCarFiresInArea, PATCH_JUMP);
|
||||
|
||||
InjectHook(0x4B1A60, CWorld::Process, PATCH_JUMP);
|
||||
ENDPATCHES
|
||||
|
@ -121,6 +121,8 @@ public:
|
||||
static void RemoveFallenCars();
|
||||
|
||||
static void StopAllLawEnforcersInTheirTracks();
|
||||
static void SetAllCarsCanBeDamaged(bool);
|
||||
static void ExtinguishAllCarFiresInArea(CVector, float);
|
||||
|
||||
static void Initialise();
|
||||
static void ShutDown();
|
||||
|
@ -153,6 +153,10 @@ public:
|
||||
#endif
|
||||
};
|
||||
|
||||
#if (defined(_MSC_VER))
|
||||
extern int strcasecmp(const char *str1, const char *str2);
|
||||
#endif
|
||||
|
||||
#define clamp(v, low, high) ((v)<(low) ? (low) : (v)>(high) ? (high) : (v))
|
||||
|
||||
inline float sq(float x) { return x*x; }
|
||||
|
@ -87,6 +87,7 @@ enum Config {
|
||||
NUM_FIRES = 40,
|
||||
|
||||
NUMPEDROUTES = 200,
|
||||
NUMPHONES = 50,
|
||||
|
||||
NUMVISIBLEENTITIES = 2000,
|
||||
NUMINVISIBLEENTITIES = 150,
|
||||
@ -145,6 +146,7 @@ enum Config {
|
||||
#endif
|
||||
|
||||
#define FIX_BUGS // fixes bugs that we've came across during reversing, TODO: use this more
|
||||
#define TOGGLEABLE_BETA_FEATURES // toggleable from debug menu. doesn't have too many things
|
||||
|
||||
// Pad
|
||||
#define KANGAROO_CHEAT
|
||||
|
@ -29,12 +29,10 @@ void **rwengine = *(void***)0x5A10E1;
|
||||
|
||||
DebugMenuAPI gDebugMenuAPI;
|
||||
|
||||
WRAPPER void *gtanew(uint32 sz) { EAXJMP(0x5A0690); }
|
||||
WRAPPER void gtadelete(void *p) { EAXJMP(0x5A07E0); }
|
||||
|
||||
// overload our own new/delete with GTA's functions
|
||||
void *operator new(size_t sz) { return gtanew(sz); }
|
||||
void operator delete(void *ptr) noexcept { gtadelete(ptr); }
|
||||
STARTPATCHES
|
||||
InjectHook(0x5A07E0, (void (*)(void*)) &operator delete, PATCH_JUMP);
|
||||
InjectHook(0x5A0690, (void* (*)(size_t)) &operator new, PATCH_JUMP);
|
||||
ENDPATCHES
|
||||
|
||||
#ifdef USE_PS2_RAND
|
||||
unsigned __int64 myrand_seed = 1;
|
||||
@ -351,10 +349,11 @@ DebugMenuPopulate(void)
|
||||
DebugMenuAddVarBool8("Debug", "Don't render Objects", (int8*)&gbDontRenderObjects, nil);
|
||||
|
||||
DebugMenuAddCmd("Debug", "Make peds follow you in formation", LetThemFollowYou);
|
||||
#ifndef MASTER
|
||||
#ifdef TOGGLEABLE_BETA_FEATURES
|
||||
DebugMenuAddVarBool8("Debug", "Toggle unused fight feature", (int8*)&CPed::bUnusedFightThingOnPlayer, nil);
|
||||
DebugMenuAddVarBool8("Debug", "Toggle banned particles", (int8*)&CParticle::bEnableBannedParticles, nil);
|
||||
DebugMenuAddVarBool8("Debug", "Toggle popping heads on headshot", (int8*)&CPed::bPopHeadsOnHeadshot, nil);
|
||||
DebugMenuAddVarBool8("Debug", "Toggle peds running to phones to report crimes", (int8*)&CPed::bMakePedsRunToPhonesToReportCrimes, nil);
|
||||
#endif
|
||||
|
||||
DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start);
|
||||
|
Reference in New Issue
Block a user