Merge branch 'master' of git://github.com/GTAmodding/re3 into erorcun
This commit is contained in:
commit
2ef5e4cd66
@ -19,7 +19,7 @@ WRAPPER void cDMAudio::ChangeMusicMode(uint8 mode) { EAXJMP(0x57CCF0); }
|
|||||||
WRAPPER void cDMAudio::PlayFrontEndSound(uint32, uint32) { EAXJMP(0x57CC20); }
|
WRAPPER void cDMAudio::PlayFrontEndSound(uint32, uint32) { EAXJMP(0x57CC20); }
|
||||||
WRAPPER void cDMAudio::PlayFrontEndTrack(uint32, uint32) { EAXJMP(0x57CC80); }
|
WRAPPER void cDMAudio::PlayFrontEndTrack(uint32, uint32) { EAXJMP(0x57CC80); }
|
||||||
WRAPPER void cDMAudio::StopFrontEndTrack() { EAXJMP(0x57CCB0); }
|
WRAPPER void cDMAudio::StopFrontEndTrack() { EAXJMP(0x57CCB0); }
|
||||||
WRAPPER void cDMAudio::PlayOneShot(int32, uint16, float) { EAXJMP(0x57C840); }
|
WRAPPER void cDMAudio::PlayOneShot(int32 audioentity, uint16 sound/*eSound*/, float) { EAXJMP(0x57C840); }
|
||||||
WRAPPER void cDMAudio::SetMusicMasterVolume(int8) { EAXJMP(0x57C8C0); }
|
WRAPPER void cDMAudio::SetMusicMasterVolume(int8) { EAXJMP(0x57C8C0); }
|
||||||
WRAPPER void cDMAudio::SetEffectsMasterVolume(int8) { EAXJMP(0x57C890); }
|
WRAPPER void cDMAudio::SetEffectsMasterVolume(int8) { EAXJMP(0x57C890); }
|
||||||
WRAPPER int8 cDMAudio::SetCurrent3DProvider(int8) { EAXJMP(0x57C9B0); }
|
WRAPPER int8 cDMAudio::SetCurrent3DProvider(int8) { EAXJMP(0x57C9B0); }
|
||||||
|
@ -190,7 +190,7 @@ public:
|
|||||||
void PlayFrontEndSound(uint32, uint32);
|
void PlayFrontEndSound(uint32, uint32);
|
||||||
void PlayFrontEndTrack(uint32, uint32);
|
void PlayFrontEndTrack(uint32, uint32);
|
||||||
void StopFrontEndTrack();
|
void StopFrontEndTrack();
|
||||||
void PlayOneShot(int32, uint16, float);
|
void PlayOneShot(int32 audioentity, uint16 sound/*eSound*/, float);
|
||||||
void SetMusicMasterVolume(int8);
|
void SetMusicMasterVolume(int8);
|
||||||
void SetEffectsMasterVolume(int8);
|
void SetEffectsMasterVolume(int8);
|
||||||
int8 SetCurrent3DProvider(int8);
|
int8 SetCurrent3DProvider(int8);
|
||||||
|
@ -59,9 +59,9 @@ enum eCarDrivingStyle : uint8
|
|||||||
|
|
||||||
class CAutoPilot {
|
class CAutoPilot {
|
||||||
public:
|
public:
|
||||||
void *m_currentAddress;
|
uint32 m_nCurrentRouteNode;
|
||||||
void *m_startingRouteNode;
|
uint32 m_nNextRouteNode;
|
||||||
void *m_PreviousRouteNode;
|
uint32 m_nPrevRouteNode;
|
||||||
uint32 m_nTotalSpeedScaleFactor;
|
uint32 m_nTotalSpeedScaleFactor;
|
||||||
uint32 m_nSpeedScaleFactor;
|
uint32 m_nSpeedScaleFactor;
|
||||||
uint32 m_nCurrentPathNodeInfo;
|
uint32 m_nCurrentPathNodeInfo;
|
||||||
@ -80,10 +80,41 @@ public:
|
|||||||
uint8 m_nAnimationTime;
|
uint8 m_nAnimationTime;
|
||||||
float m_fMaxTrafficSpeed;
|
float m_fMaxTrafficSpeed;
|
||||||
uint8 m_nCruiseSpeed;
|
uint8 m_nCruiseSpeed;
|
||||||
uint8 m_nCarCtrlFlags;
|
uint8 m_flag1 : 1;
|
||||||
|
uint8 m_flag2 : 1;
|
||||||
|
uint8 m_flag4 : 1;
|
||||||
|
uint8 m_flag8 : 1;
|
||||||
|
uint8 m_flag10 : 1;
|
||||||
CVector m_vecDestinationCoors;
|
CVector m_vecDestinationCoors;
|
||||||
void *m_aPathFindNodesInfo[8];
|
void *m_aPathFindNodesInfo[8];
|
||||||
uint16 m_nPathFindNodesCount;
|
uint16 m_nPathFindNodesCount;
|
||||||
CVehicle *m_pTargetCar;
|
CVehicle *m_pTargetCar;
|
||||||
|
|
||||||
|
CAutoPilot(void) {
|
||||||
|
m_nPrevRouteNode = 0;
|
||||||
|
m_nNextRouteNode = m_nPrevRouteNode;
|
||||||
|
m_nCurrentRouteNode = m_nNextRouteNode;
|
||||||
|
m_nTotalSpeedScaleFactor = 0;
|
||||||
|
m_nSpeedScaleFactor = 1000;
|
||||||
|
m_nPreviousPathNodeInfo = 0;
|
||||||
|
m_nNextPathNodeInfo = m_nPreviousPathNodeInfo;
|
||||||
|
m_nCurrentPathNodeInfo = m_nNextPathNodeInfo;
|
||||||
|
m_nNextDirection = 1;
|
||||||
|
m_nCurrentDirecton = m_nNextDirection;
|
||||||
|
m_nCurrentPathDirection = 0;
|
||||||
|
m_nPreviousPathDirection = m_nCurrentPathDirection;
|
||||||
|
m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
||||||
|
m_nCarMission = MISSION_NONE;
|
||||||
|
m_nAnimationId = TEMPACT_NONE;
|
||||||
|
m_nCruiseSpeed = 10;
|
||||||
|
m_fMaxTrafficSpeed = 10.0f;
|
||||||
|
m_flag2 = false;
|
||||||
|
m_flag1 = false;
|
||||||
|
m_nPathFindNodesCount = 0;
|
||||||
|
m_pTargetCar = 0;
|
||||||
|
m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
|
||||||
|
m_nTimeSwitchedToRealPhysics = m_nTimeToStartMission;
|
||||||
|
m_flag8 = false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
static_assert(sizeof(CAutoPilot) == 0x70, "CAutoPilot: error");
|
static_assert(sizeof(CAutoPilot) == 0x70, "CAutoPilot: error");
|
||||||
|
@ -123,18 +123,18 @@ eKillFrenzyStatus CDarkel::ReadStatus()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
WRAPPER int32 CDarkel::RegisterCarBlownUpByPlayer(eKillFrenzyStatus status) { EAXJMP(0x421070); }
|
WRAPPER void CDarkel::RegisterCarBlownUpByPlayer(CVehicle *vehicle) { EAXJMP(0x421070); }
|
||||||
#else
|
#else
|
||||||
int32 CDarkel::RegisterCarBlownUpByPlayer(eKillFrenzyStatus status)
|
int32 CDarkel::RegisterCarBlownUpByPlayer(CVehicle *vehicle)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
WRAPPER void CDarkel::RegisterKillByPlayer(int32 modelid, eWeaponType weapontype, bool flag) { EAXJMP(0x420F60); }
|
WRAPPER void CDarkel::RegisterKillByPlayer(CPed *victim, eWeaponType weapontype, bool headshot) { EAXJMP(0x420F60); }
|
||||||
#else
|
#else
|
||||||
void CDarkel::RegisterKillByPlayer(int32 modelid, eWeaponType weapontype, bool flag)
|
void CDarkel::RegisterKillByPlayer(CPed *victim, eWeaponType weapontype, bool headshot)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Weapon.h"
|
#include "Weapon.h"
|
||||||
|
|
||||||
|
class CVehicle;
|
||||||
|
class CPed;
|
||||||
|
|
||||||
enum eKillFrenzyStatus
|
enum eKillFrenzyStatus
|
||||||
{
|
{
|
||||||
KILLFRENZY_NONE,
|
KILLFRENZY_NONE,
|
||||||
@ -37,8 +40,8 @@ public:
|
|||||||
static void Init();
|
static void Init();
|
||||||
static int16 QueryModelsKilledByPlayer(int32 modelId);
|
static int16 QueryModelsKilledByPlayer(int32 modelId);
|
||||||
static eKillFrenzyStatus ReadStatus();
|
static eKillFrenzyStatus ReadStatus();
|
||||||
static int32 RegisterCarBlownUpByPlayer(eKillFrenzyStatus status);
|
static void RegisterCarBlownUpByPlayer(CVehicle *vehicle);
|
||||||
static void RegisterKillByPlayer(int32 modelid, eWeaponType weapontype, bool flag);
|
static void RegisterKillByPlayer(CPed *victim, eWeaponType weapontype, bool headshot = false);
|
||||||
static void RegisterKillNotByPlayer();
|
static void RegisterKillNotByPlayer();
|
||||||
static void ResetModelsKilledByPlayer();
|
static void ResetModelsKilledByPlayer();
|
||||||
static void ResetOnPlayerDeath();
|
static void ResetOnPlayerDeath();
|
||||||
|
@ -290,14 +290,14 @@ void CReplay::RecordThisFrame(void)
|
|||||||
CPed* p = peds->GetSlot(i);
|
CPed* p = peds->GetSlot(i);
|
||||||
if (!p || !p->m_rwObject)
|
if (!p || !p->m_rwObject)
|
||||||
continue;
|
continue;
|
||||||
if (!p->bRecordedForReplay){
|
if (!p->bHasAlreadyBeenRecorded){
|
||||||
tPedHeaderPacket* ph = (tPedHeaderPacket*)&Record.m_pBase[Record.m_nOffset];
|
tPedHeaderPacket* ph = (tPedHeaderPacket*)&Record.m_pBase[Record.m_nOffset];
|
||||||
ph->type = REPLAYPACKET_PED_HEADER;
|
ph->type = REPLAYPACKET_PED_HEADER;
|
||||||
ph->index = i;
|
ph->index = i;
|
||||||
ph->mi = p->GetModelIndex();
|
ph->mi = p->GetModelIndex();
|
||||||
ph->pedtype = p->m_nPedType;
|
ph->pedtype = p->m_nPedType;
|
||||||
Record.m_nOffset += sizeof(*ph);
|
Record.m_nOffset += sizeof(*ph);
|
||||||
p->bRecordedForReplay = true;
|
p->bHasAlreadyBeenRecorded = true;
|
||||||
}
|
}
|
||||||
StorePedUpdate(p, i);
|
StorePedUpdate(p, i);
|
||||||
}
|
}
|
||||||
@ -1012,7 +1012,7 @@ void CReplay::ProcessReplayCamera(void)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
TheCamera.m_vecGameCamPos = *TheCamera.GetMatrix().GetPosition();
|
TheCamera.m_vecGameCamPos = TheCamera.GetMatrix().GetPosition();
|
||||||
TheCamera.CalculateDerivedValues();
|
TheCamera.CalculateDerivedValues();
|
||||||
RwMatrixUpdate(RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera)));
|
RwMatrixUpdate(RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera)));
|
||||||
RwFrameUpdateObjects(RwCameraGetFrame(TheCamera.m_pRwCamera));
|
RwFrameUpdateObjects(RwCameraGetFrame(TheCamera.m_pRwCamera));
|
||||||
@ -1346,14 +1346,14 @@ void CReplay::MarkEverythingAsNew(void)
|
|||||||
CVehicle* v = CPools::GetVehiclePool()->GetSlot(i);
|
CVehicle* v = CPools::GetVehiclePool()->GetSlot(i);
|
||||||
if (!v)
|
if (!v)
|
||||||
continue;
|
continue;
|
||||||
v->bRecordedForReplay = false;
|
v->bHasAlreadyBeenRecorded = false;
|
||||||
}
|
}
|
||||||
i = CPools::GetPedPool()->GetSize();
|
i = CPools::GetPedPool()->GetSize();
|
||||||
while (i--) {
|
while (i--) {
|
||||||
CPed* p = CPools::GetPedPool()->GetSlot(i);
|
CPed* p = CPools::GetPedPool()->GetSlot(i);
|
||||||
if (!p)
|
if (!p)
|
||||||
continue;
|
continue;
|
||||||
p->bRecordedForReplay = false;
|
p->bHasAlreadyBeenRecorded = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,17 +2,21 @@
|
|||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
|
|
||||||
#include "Script.h"
|
#include "Script.h"
|
||||||
|
#include "ScriptCommands.h"
|
||||||
|
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "CarCtrl.h"
|
#include "CarCtrl.h"
|
||||||
#include "DMAudio.h"
|
#include "DMAudio.h"
|
||||||
#include "FileMgr.h"
|
#include "FileMgr.h"
|
||||||
#include "Hud.h"
|
#include "Hud.h"
|
||||||
|
#include "Messages.h"
|
||||||
#include "ModelIndices.h"
|
#include "ModelIndices.h"
|
||||||
|
#include "Pad.h"
|
||||||
#include "PlayerInfo.h"
|
#include "PlayerInfo.h"
|
||||||
#include "PlayerPed.h"
|
#include "PlayerPed.h"
|
||||||
#include "Pools.h"
|
#include "Pools.h"
|
||||||
#include "Population.h"
|
#include "Population.h"
|
||||||
|
#include "Replay.h"
|
||||||
#include "Streaming.h"
|
#include "Streaming.h"
|
||||||
#include "User.h"
|
#include "User.h"
|
||||||
#include "Weather.h"
|
#include "Weather.h"
|
||||||
@ -32,7 +36,7 @@ int32(&CTheScripts::MultiScriptArray)[MAX_NUM_MISSION_SCRIPTS] = *(int32(*)[MAX_
|
|||||||
tBuildingSwap(&CTheScripts::BuildingSwapArray)[MAX_NUM_BUILDING_SWAPS] = *(tBuildingSwap(*)[MAX_NUM_BUILDING_SWAPS])*(uintptr*)0x880E30;
|
tBuildingSwap(&CTheScripts::BuildingSwapArray)[MAX_NUM_BUILDING_SWAPS] = *(tBuildingSwap(*)[MAX_NUM_BUILDING_SWAPS])*(uintptr*)0x880E30;
|
||||||
CEntity*(&CTheScripts::InvisibilitySettingArray)[MAX_NUM_INVISIBILITY_SETTINGS] = *(CEntity*(*)[MAX_NUM_INVISIBILITY_SETTINGS])*(uintptr*)0x8620F0;
|
CEntity*(&CTheScripts::InvisibilitySettingArray)[MAX_NUM_INVISIBILITY_SETTINGS] = *(CEntity*(*)[MAX_NUM_INVISIBILITY_SETTINGS])*(uintptr*)0x8620F0;
|
||||||
bool &CTheScripts::DbgFlag = *(bool*)0x95CD87;
|
bool &CTheScripts::DbgFlag = *(bool*)0x95CD87;
|
||||||
uint32 &CTheScripts::OnAMissionFlag = *(uint32*)0x8F2A24;
|
uint32 &CTheScripts::OnAMissionFlag = *(uint32*)0x8F1B64;
|
||||||
int32 &CTheScripts::StoreVehicleIndex = *(int32*)0x8F5F3C;
|
int32 &CTheScripts::StoreVehicleIndex = *(int32*)0x8F5F3C;
|
||||||
bool &CTheScripts::StoreVehicleWasRandom = *(bool*)0x95CDBC;
|
bool &CTheScripts::StoreVehicleWasRandom = *(bool*)0x95CDBC;
|
||||||
CRunningScript *&CTheScripts::pIdleScripts = *(CRunningScript**)0x9430D4;
|
CRunningScript *&CTheScripts::pIdleScripts = *(CRunningScript**)0x9430D4;
|
||||||
@ -55,6 +59,8 @@ bool &CTheScripts::UseTextCommands = *(bool*)0x95CD57;
|
|||||||
CMissionCleanup (&CTheScripts::MissionCleanup) = *(CMissionCleanup*)0x8F2A24;
|
CMissionCleanup (&CTheScripts::MissionCleanup) = *(CMissionCleanup*)0x8F2A24;
|
||||||
CUpsideDownCarCheck (&CTheScripts::UpsideDownCars) = *(CUpsideDownCarCheck*)0x6EE450;
|
CUpsideDownCarCheck (&CTheScripts::UpsideDownCars) = *(CUpsideDownCarCheck*)0x6EE450;
|
||||||
CStuckCarCheck (&CTheScripts::StuckCars) = *(CStuckCarCheck*)0x87C588;
|
CStuckCarCheck (&CTheScripts::StuckCars) = *(CStuckCarCheck*)0x87C588;
|
||||||
|
uint16 &CTheScripts::CommandsExecuted = *(uint16*)0x95CCA6;
|
||||||
|
uint16 &CTheScripts::ScriptsUpdated = *(uint16*)0x95CC5E;
|
||||||
int32(&ScriptParams)[32] = *(int32(*)[32])*(uintptr*)0x6ED460;
|
int32(&ScriptParams)[32] = *(int32(*)[32])*(uintptr*)0x6ED460;
|
||||||
|
|
||||||
CMissionCleanup::CMissionCleanup()
|
CMissionCleanup::CMissionCleanup()
|
||||||
@ -93,7 +99,7 @@ void CMissionCleanup::AddEntityToList(int32 id, uint8 type)
|
|||||||
void CMissionCleanup::RemoveEntityFromList(int32 id, uint8 type)
|
void CMissionCleanup::RemoveEntityFromList(int32 id, uint8 type)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_CLEANUP; i++){
|
for (int i = 0; i < MAX_CLEANUP; i++){
|
||||||
if (m_sEntities[i].type == type && m_sEntities[i].id == 0){
|
if (m_sEntities[i].type == type && m_sEntities[i].id == id){
|
||||||
m_sEntities[i].id = 0;
|
m_sEntities[i].id = 0;
|
||||||
m_sEntities[i].type = CLEANUP_UNUSED;
|
m_sEntities[i].type = CLEANUP_UNUSED;
|
||||||
}
|
}
|
||||||
@ -403,7 +409,7 @@ void CRunningScript::Init()
|
|||||||
m_nStackPointer = 0;
|
m_nStackPointer = 0;
|
||||||
m_nWakeTime = 0;
|
m_nWakeTime = 0;
|
||||||
m_bCondResult = false;
|
m_bCondResult = false;
|
||||||
m_bIsMissionThread = false;
|
m_bIsMissionScript = false;
|
||||||
m_bSkipWakeTime = false;
|
m_bSkipWakeTime = false;
|
||||||
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
|
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
|
||||||
m_anLocalVariables[i] = 0;
|
m_anLocalVariables[i] = 0;
|
||||||
@ -435,6 +441,27 @@ int open_script()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void CTextLine::Reset()
|
||||||
|
{
|
||||||
|
m_fScaleX = 0.48f;
|
||||||
|
m_fScaleY = 1.12f;
|
||||||
|
m_sColor = CRGBA(225, 225, 225, 255);
|
||||||
|
m_bJustify = false;
|
||||||
|
m_bRightJustify = false;
|
||||||
|
m_bCentered = false;
|
||||||
|
m_bBackground = false;
|
||||||
|
m_bBackgroundOnly = false;
|
||||||
|
m_fWrapX = 182.0f; /* TODO: scaling as bugfix */
|
||||||
|
m_fCenterSize = 640.0f; /* --||-- */
|
||||||
|
m_sBackgroundColor = CRGBA(128, 128, 128, 128);
|
||||||
|
m_bTextProportional = true;
|
||||||
|
m_bTextBeforeFade = false;
|
||||||
|
m_nFont = 2; /* enum? */
|
||||||
|
m_fAtX = 0.0f;
|
||||||
|
m_fAtY = 0.0f;
|
||||||
|
memset(&m_Text, 0, sizeof(m_Text));
|
||||||
|
}
|
||||||
|
|
||||||
void CTheScripts::Init()
|
void CTheScripts::Init()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < SIZE_SCRIPT_SPACE; i++)
|
for (int i = 0; i < SIZE_SCRIPT_SPACE; i++)
|
||||||
@ -497,29 +524,13 @@ void CTheScripts::Init()
|
|||||||
ScriptSphereArray[i].m_fRadius = 0.0f;
|
ScriptSphereArray[i].m_fRadius = 0.0f;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < MAX_NUM_INTRO_TEXT_LINES; i++){
|
for (int i = 0; i < MAX_NUM_INTRO_TEXT_LINES; i++){
|
||||||
IntroTextLines[i].m_fScaleX = 0.48f;
|
IntroTextLines[i].Reset();
|
||||||
IntroTextLines[i].m_fScaleY = 1.12f;
|
|
||||||
IntroTextLines[i].m_sColor = CRGBA(225, 225, 225, 255);
|
|
||||||
IntroTextLines[i].m_bJustify = false;
|
|
||||||
IntroTextLines[i].m_bRightJustify = false;
|
|
||||||
IntroTextLines[i].m_bCentered = false;
|
|
||||||
IntroTextLines[i].m_bBackground = false;
|
|
||||||
IntroTextLines[i].m_bBackgroundOnly = false;
|
|
||||||
IntroTextLines[i].m_fWrapX = 182.0f; /* TODO: scaling as bugfix */
|
|
||||||
IntroTextLines[i].m_fCenterSize = 640.0f; /* --||-- */
|
|
||||||
IntroTextLines[i].m_sBackgroundColor = CRGBA(128, 128, 128, 128);
|
|
||||||
IntroTextLines[i].m_bTextProportional = true;
|
|
||||||
IntroTextLines[i].m_bTextBeforeFade = false;
|
|
||||||
IntroTextLines[i].m_nFont = 2; /* enum? */
|
|
||||||
IntroTextLines[i].m_fAtX = 0.0f;
|
|
||||||
IntroTextLines[i].m_fAtY = 0.0f;
|
|
||||||
memset(&IntroTextLines[i].m_Text, 0, sizeof(IntroTextLines[i].m_Text));
|
|
||||||
}
|
}
|
||||||
NumberOfIntroTextLinesThisFrame = 0;
|
NumberOfIntroTextLinesThisFrame = 0;
|
||||||
UseTextCommands = false;
|
UseTextCommands = false;
|
||||||
for (int i = 0; i < MAX_NUM_INTRO_RECTANGLES; i++){
|
for (int i = 0; i < MAX_NUM_INTRO_RECTANGLES; i++){
|
||||||
IntroRectangles[i].m_bIsUsed = false;
|
IntroRectangles[i].m_bIsUsed = false;
|
||||||
IntroRectangles[i].m_bIsAntialiased = false;
|
IntroRectangles[i].m_bBeforeFade = false;
|
||||||
IntroRectangles[i].m_nTextureId = -1;
|
IntroRectangles[i].m_nTextureId = -1;
|
||||||
IntroRectangles[i].m_sRect = CRect(0.0f, 0.0f, 0.0f, 0.0f);
|
IntroRectangles[i].m_sRect = CRect(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
IntroRectangles[i].m_sColor = CRGBA(255, 255, 255, 255);
|
IntroRectangles[i].m_sColor = CRGBA(255, 255, 255, 255);
|
||||||
@ -553,8 +564,835 @@ void CRunningScript::AddScriptToList(CRunningScript** ppScript)
|
|||||||
*ppScript = this;
|
*ppScript = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
WRAPPER bool CTheScripts::IsPlayerOnAMission() { EAXJMP(0x439410); }
|
CRunningScript* CTheScripts::StartNewScript(uint32 ip)
|
||||||
|
{
|
||||||
|
CRunningScript* pNew = pIdleScripts;
|
||||||
|
assert(pNew);
|
||||||
|
pNew->RemoveScriptFromList(&pIdleScripts);
|
||||||
|
pNew->Init();
|
||||||
|
pNew->SetIP(ip);
|
||||||
|
pNew->AddScriptToList(&pActiveScripts);
|
||||||
|
return pNew;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTheScripts::Process()
|
||||||
|
{
|
||||||
|
if (CReplay::IsPlayingBack())
|
||||||
|
return;
|
||||||
|
CommandsExecuted = 0;
|
||||||
|
ScriptsUpdated = 0;
|
||||||
|
float timeStep = CTimer::GetTimeStepInMilliseconds();
|
||||||
|
UpsideDownCars.UpdateTimers();
|
||||||
|
StuckCars.Process();
|
||||||
|
DrawScriptSpheres();
|
||||||
|
if (FailCurrentMission)
|
||||||
|
--FailCurrentMission;
|
||||||
|
if (CountdownToMakePlayerUnsafe){
|
||||||
|
if (--CountdownToMakePlayerUnsafe == 0)
|
||||||
|
CWorld::Players[0].MakePlayerSafe(false);
|
||||||
|
}
|
||||||
|
if (UseTextCommands){
|
||||||
|
for (int i = 0; i < MAX_NUM_INTRO_TEXT_LINES; i++)
|
||||||
|
IntroTextLines[i].Reset();
|
||||||
|
NumberOfIntroRectanglesThisFrame = 0;
|
||||||
|
for (int i = 0; i < MAX_NUM_INTRO_RECTANGLES; i++){
|
||||||
|
IntroRectangles[i].m_bIsUsed = false;
|
||||||
|
IntroRectangles[i].m_bBeforeFade = false;
|
||||||
|
}
|
||||||
|
NumberOfIntroRectanglesThisFrame = 0;
|
||||||
|
if (UseTextCommands == 1)
|
||||||
|
UseTextCommands = 0;
|
||||||
|
}
|
||||||
|
CRunningScript* script = pActiveScripts;
|
||||||
|
while (script != nil){
|
||||||
|
CRunningScript* next = script->GetNext();
|
||||||
|
++ScriptsUpdated;
|
||||||
|
script->UpdateTimers(timeStep);
|
||||||
|
script->Process();
|
||||||
|
script = next;
|
||||||
|
}
|
||||||
|
DbgFlag = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CRunningScript* CTheScripts::StartTestScript()
|
||||||
|
{
|
||||||
|
return StartNewScript(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CTheScripts::IsPlayerOnAMission()
|
||||||
|
{
|
||||||
|
return OnAMissionFlag && *(int32*)&ScriptSpace[OnAMissionFlag] == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRunningScript::Process()
|
||||||
|
{
|
||||||
|
if (m_bIsMissionScript)
|
||||||
|
DoDeatharrestCheck();
|
||||||
|
if (m_bMissionFlag && CTheScripts::FailCurrentMission == 1 && m_nStackPointer == 1)
|
||||||
|
m_nIp = m_anStack[--m_nStackPointer];
|
||||||
|
if (CTimer::GetTimeInMilliseconds() >= m_nWakeTime){
|
||||||
|
while (!ProcessOneCommand())
|
||||||
|
;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!m_bSkipWakeTime)
|
||||||
|
return;
|
||||||
|
if (!CPad::GetPad(0)->GetCrossJustDown())
|
||||||
|
return;
|
||||||
|
m_nWakeTime = 0;
|
||||||
|
for (int i = 0; i < 6; i++){ /* TODO: add constant for number of messages */
|
||||||
|
if (CMessages::BIGMessages[i].m_Current.m_pText)
|
||||||
|
CMessages::BIGMessages[i].m_Current.m_nStartTime = 0;
|
||||||
|
if (CMessages::BriefMessages[0].m_pText)
|
||||||
|
CMessages::BriefMessages[0].m_nStartTime = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int8 CRunningScript::ProcessOneCommand()
|
||||||
|
{
|
||||||
|
++CTheScripts::CommandsExecuted;
|
||||||
|
int32 command = CTheScripts::Read2BytesFromScript(&m_nIp);
|
||||||
|
m_bNotFlag = (command & 0x8000);
|
||||||
|
command &= 0x7FFF;
|
||||||
|
if (command < 100)
|
||||||
|
return ProcessCommandsFrom0To99(command);
|
||||||
|
if (command < 200)
|
||||||
|
return ProcessCommandsFrom100To199(command);
|
||||||
|
if (command < 300)
|
||||||
|
return ProcessCommandsFrom200To299(command);
|
||||||
|
if (command < 400)
|
||||||
|
return ProcessCommandsFrom300To399(command);
|
||||||
|
if (command < 500)
|
||||||
|
return ProcessCommandsFrom400To499(command);
|
||||||
|
if (command < 600)
|
||||||
|
return ProcessCommandsFrom500To599(command);
|
||||||
|
if (command < 700)
|
||||||
|
return ProcessCommandsFrom600To699(command);
|
||||||
|
if (command < 800)
|
||||||
|
return ProcessCommandsFrom700To799(command);
|
||||||
|
if (command < 900)
|
||||||
|
return ProcessCommandsFrom800To899(command);
|
||||||
|
if (command < 1000)
|
||||||
|
return ProcessCommandsFrom900To999(command);
|
||||||
|
if (command < 1100)
|
||||||
|
return ProcessCommandsFrom1000To1099(command);
|
||||||
|
if (command < 1200)
|
||||||
|
return ProcessCommandsFrom1100To1199(command);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int8 CRunningScript::ProcessCommandsFrom0To99(int32 command)
|
||||||
|
{
|
||||||
|
switch (command) {
|
||||||
|
case COMMAND_NOP:
|
||||||
|
return 0;
|
||||||
|
case COMMAND_WAIT:
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
m_nWakeTime = CTimer::GetTimeInMilliseconds() + ScriptParams[0];
|
||||||
|
return 1;
|
||||||
|
case COMMAND_GOTO:
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
SetIP(ScriptParams[0] >= 0 ? ScriptParams[0] : SIZE_MAIN_SCRIPT - ScriptParams[0]);
|
||||||
|
/* Known issue: GOTO to 0. It might have been "better" to use > instead of >= */
|
||||||
|
/* simply because it never makes sense to jump to start of the script */
|
||||||
|
/* but jumping to start of a custom mission is an issue for simple mission-like scripts */
|
||||||
|
/* However, it's not an issue for actual mission scripts, because they follow a structure */
|
||||||
|
/* and never start with a loop. */
|
||||||
|
return 0;
|
||||||
|
case COMMAND_SHAKE_CAM:
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
TheCamera.CamShake(ScriptParams[0] / 1000.0f);
|
||||||
|
return 0;
|
||||||
|
case COMMAND_SET_VAR_INT:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
*ptr = ScriptParams[0];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_SET_VAR_FLOAT:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
*(float*)ptr = *(float*)&ScriptParams[0];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_SET_LVAR_INT:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
*ptr = ScriptParams[0];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_SET_LVAR_FLOAT:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
*(float*)ptr = *(float*)&ScriptParams[0];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_ADD_VAL_TO_INT_VAR:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
*ptr += ScriptParams[0];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_ADD_VAL_TO_FLOAT_VAR:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
*(float*)ptr += *(float*)&ScriptParams[0];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_ADD_VAL_TO_INT_LVAR:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
*ptr += ScriptParams[0];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_ADD_VAL_TO_FLOAT_LVAR:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
*(float*)ptr += *(float*)&ScriptParams[0];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_SUB_VAL_FROM_INT_VAR:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
*ptr -= ScriptParams[0];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_SUB_VAL_FROM_FLOAT_VAR:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
*(float*)ptr -= *(float*)&ScriptParams[0];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_SUB_VAL_FROM_INT_LVAR:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
*ptr -= ScriptParams[0];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_SUB_VAL_FROM_FLOAT_LVAR:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
*(float*)ptr -= *(float*)&ScriptParams[0];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_MULT_INT_VAR_BY_VAL:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
*ptr *= ScriptParams[0];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_MULT_FLOAT_VAR_BY_VAL:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
*(float*)ptr *= *(float*)&ScriptParams[0];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_MULT_INT_LVAR_BY_VAL:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
*ptr *= ScriptParams[0];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_MULT_FLOAT_LVAR_BY_VAL:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
*(float*)ptr *= *(float*)&ScriptParams[0];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_DIV_INT_VAR_BY_VAL:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
*ptr /= ScriptParams[0];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_DIV_FLOAT_VAR_BY_VAL:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
*(float*)ptr /= *(float*)&ScriptParams[0];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_DIV_INT_LVAR_BY_VAL:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
*ptr /= ScriptParams[0];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_DIV_FLOAT_LVAR_BY_VAL:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
*(float*)ptr /= *(float*)&ScriptParams[0];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_INT_VAR_GREATER_THAN_NUMBER:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
UpdateCompareFlag(*ptr > ScriptParams[0]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_INT_LVAR_GREATER_THAN_NUMBER:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
UpdateCompareFlag(*ptr > ScriptParams[0]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_NUMBER_GREATER_THAN_INT_VAR:
|
||||||
|
{
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
UpdateCompareFlag(ScriptParams[0] > *ptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_NUMBER_GREATER_THAN_INT_LVAR:
|
||||||
|
{
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
UpdateCompareFlag(ScriptParams[0] > *ptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_INT_VAR_GREATER_THAN_INT_VAR:
|
||||||
|
{
|
||||||
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
UpdateCompareFlag(*ptr1 > *ptr2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_INT_LVAR_GREATER_THAN_INT_VAR:
|
||||||
|
{
|
||||||
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
UpdateCompareFlag(*ptr1 > *ptr2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_INT_VAR_GREATER_THAN_INT_LVAR:
|
||||||
|
{
|
||||||
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
UpdateCompareFlag(*ptr1 > *ptr2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_INT_LVAR_GREATER_THAN_INT_LVAR:
|
||||||
|
{
|
||||||
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
UpdateCompareFlag(*ptr1 > *ptr2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_FLOAT_VAR_GREATER_THAN_NUMBER:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
UpdateCompareFlag(*(float*)ptr > *(float*)&ScriptParams[0]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_FLOAT_LVAR_GREATER_THAN_NUMBER:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
UpdateCompareFlag(*(float*)ptr > *(float*)&ScriptParams[0]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_NUMBER_GREATER_THAN_FLOAT_VAR:
|
||||||
|
{
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
UpdateCompareFlag(*(float*)&ScriptParams[0] > *(float*)ptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_NUMBER_GREATER_THAN_FLOAT_LVAR:
|
||||||
|
{
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
UpdateCompareFlag(*(float*)&ScriptParams[0] > *(float*)ptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_FLOAT_VAR_GREATER_THAN_FLOAT_VAR:
|
||||||
|
{
|
||||||
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
UpdateCompareFlag(*(float*)ptr1 > *(float*)ptr2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_FLOAT_LVAR_GREATER_THAN_FLOAT_VAR:
|
||||||
|
{
|
||||||
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
UpdateCompareFlag(*(float*)ptr1 > *(float*)ptr2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_FLOAT_VAR_GREATER_THAN_FLOAT_LVAR:
|
||||||
|
{
|
||||||
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
UpdateCompareFlag(*(float*)ptr1 > *(float*)ptr2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_FLOAT_LVAR_GREATER_THAN_FLOAT_LVAR:
|
||||||
|
{
|
||||||
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
UpdateCompareFlag(*(float*)ptr1 > *(float*)ptr2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_INT_VAR_GREATER_OR_EQUAL_TO_NUMBER:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
UpdateCompareFlag(*ptr >= ScriptParams[0]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_INT_LVAR_GREATER_OR_EQUAL_TO_NUMBER:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
UpdateCompareFlag(*ptr >= ScriptParams[0]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_NUMBER_GREATER_OR_EQUAL_TO_INT_VAR:
|
||||||
|
{
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
UpdateCompareFlag(ScriptParams[0] >= *ptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_NUMBER_GREATER_OR_EQUAL_TO_INT_LVAR:
|
||||||
|
{
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
UpdateCompareFlag(ScriptParams[0] >= *ptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_INT_VAR_GREATER_OR_EQUAL_TO_INT_VAR:
|
||||||
|
{
|
||||||
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
UpdateCompareFlag(*ptr1 >= *ptr2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_INT_LVAR_GREATER_OR_EQUAL_TO_INT_VAR:
|
||||||
|
{
|
||||||
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
UpdateCompareFlag(*ptr1 >= *ptr2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_INT_VAR_GREATER_OR_EQUAL_TO_INT_LVAR:
|
||||||
|
{
|
||||||
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
UpdateCompareFlag(*ptr1 >= *ptr2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_INT_LVAR_GREATER_OR_EQUAL_TO_INT_LVAR:
|
||||||
|
{
|
||||||
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
UpdateCompareFlag(*ptr1 >= *ptr2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_NUMBER:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
UpdateCompareFlag(*(float*)ptr >= *(float*)&ScriptParams[0]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_NUMBER:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
UpdateCompareFlag(*(float*)ptr >= *(float*)&ScriptParams[0]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_NUMBER_GREATER_OR_EQUAL_TO_FLOAT_VAR:
|
||||||
|
{
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
UpdateCompareFlag(*(float*)&ScriptParams[0] >= *(float*)ptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_NUMBER_GREATER_OR_EQUAL_TO_FLOAT_LVAR:
|
||||||
|
{
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
UpdateCompareFlag(*(float*)&ScriptParams[0] >= *(float*)ptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_FLOAT_VAR:
|
||||||
|
{
|
||||||
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
UpdateCompareFlag(*(float*)ptr1 >= *(float*)ptr2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_FLOAT_VAR:
|
||||||
|
{
|
||||||
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
UpdateCompareFlag(*(float*)ptr1 >= *(float*)ptr2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_FLOAT_LVAR:
|
||||||
|
{
|
||||||
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
UpdateCompareFlag(*(float*)ptr1 >= *(float*)ptr2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_FLOAT_LVAR:
|
||||||
|
{
|
||||||
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
UpdateCompareFlag(*(float*)ptr1 >= *(float*)ptr2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_INT_VAR_EQUAL_TO_NUMBER:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
UpdateCompareFlag(*ptr == ScriptParams[0]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_INT_LVAR_EQUAL_TO_NUMBER:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
UpdateCompareFlag(*ptr == ScriptParams[0]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_INT_VAR_EQUAL_TO_INT_VAR:
|
||||||
|
{
|
||||||
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
UpdateCompareFlag(*ptr1 == *ptr2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_INT_VAR_EQUAL_TO_INT_LVAR:
|
||||||
|
{
|
||||||
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
UpdateCompareFlag(*ptr1 == *ptr2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_INT_LVAR_EQUAL_TO_INT_LVAR:
|
||||||
|
{
|
||||||
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
UpdateCompareFlag(*ptr1 == *ptr2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_FLOAT_VAR_EQUAL_TO_NUMBER:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
UpdateCompareFlag(*(float*)ptr == *(float*)&ScriptParams[0]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_FLOAT_LVAR_EQUAL_TO_NUMBER:
|
||||||
|
{
|
||||||
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
UpdateCompareFlag(*(float*)ptr == *(float*)&ScriptParams[0]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_FLOAT_VAR_EQUAL_TO_FLOAT_VAR:
|
||||||
|
{
|
||||||
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
UpdateCompareFlag(*(float*)ptr1 == *(float*)ptr2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_FLOAT_VAR_EQUAL_TO_FLOAT_LVAR:
|
||||||
|
{
|
||||||
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
UpdateCompareFlag(*(float*)ptr1 == *(float*)ptr2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_FLOAT_LVAR_EQUAL_TO_FLOAT_LVAR:
|
||||||
|
{
|
||||||
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
UpdateCompareFlag(*(float*)ptr1 == *(float*)ptr2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_GOTO_IF_TRUE:
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
if (m_bCondResult)
|
||||||
|
SetIP(ScriptParams[0] >= 0 ? ScriptParams[0] : SIZE_MAIN_SCRIPT - ScriptParams[0]);
|
||||||
|
/* Check COMMAND_GOTO note. */
|
||||||
|
return 0;
|
||||||
|
case COMMAND_GOTO_IF_FALSE:
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
if (!m_bCondResult)
|
||||||
|
SetIP(ScriptParams[0] >= 0 ? ScriptParams[0] : SIZE_MAIN_SCRIPT - ScriptParams[0]);
|
||||||
|
/* Check COMMAND_GOTO note. */
|
||||||
|
return 0;
|
||||||
|
case COMMAND_TERMINATE_THIS_SCRIPT:
|
||||||
|
if (m_bMissionFlag)
|
||||||
|
CTheScripts::bAlreadyRunningAMissionScript = false;
|
||||||
|
RemoveScriptFromList(&CTheScripts::pActiveScripts);
|
||||||
|
AddScriptToList(&CTheScripts::pIdleScripts);
|
||||||
|
return 1;
|
||||||
|
case COMMAND_START_NEW_SCRIPT:
|
||||||
|
{
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
assert(ScriptParams[0] >= 0);
|
||||||
|
CRunningScript* pNew = CTheScripts::StartNewScript(ScriptParams[0]);
|
||||||
|
int8 type = CTheScripts::Read1ByteFromScript(&m_nIp);
|
||||||
|
float tmp;
|
||||||
|
for (int i = 0; type != ARGUMENT_END; type = CTheScripts::Read1ByteFromScript(&m_nIp), i++) {
|
||||||
|
switch (type) {
|
||||||
|
case ARGUMENT_INT32:
|
||||||
|
pNew->m_anLocalVariables[i] = CTheScripts::Read4BytesFromScript(&m_nIp);
|
||||||
|
break;
|
||||||
|
case ARGUMENT_GLOBALVAR:
|
||||||
|
pNew->m_anLocalVariables[i] = *(int32*)&CTheScripts::ScriptSpace[CTheScripts::Read2BytesFromScript(&m_nIp)];
|
||||||
|
break;
|
||||||
|
case ARGUMENT_LOCALVAR:
|
||||||
|
pNew->m_anLocalVariables[i] = m_anLocalVariables[CTheScripts::Read2BytesFromScript(&m_nIp)];
|
||||||
|
break;
|
||||||
|
case ARGUMENT_INT8:
|
||||||
|
pNew->m_anLocalVariables[i] = CTheScripts::Read1ByteFromScript(&m_nIp);
|
||||||
|
break;
|
||||||
|
case ARGUMENT_INT16:
|
||||||
|
pNew->m_anLocalVariables[i] = CTheScripts::Read2BytesFromScript(&m_nIp);
|
||||||
|
break;
|
||||||
|
case ARGUMENT_FLOAT:
|
||||||
|
tmp = CTheScripts::ReadFloatFromScript(&m_nIp);
|
||||||
|
pNew->m_anLocalVariables[i] = *(int32*)&tmp;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_GOSUB:
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
assert(m_nStackPointer < MAX_STACK_DEPTH);
|
||||||
|
m_anStack[m_nStackPointer++] = m_nIp;
|
||||||
|
SetIP(ScriptParams[0] >= 0 ? ScriptParams[0] : SIZE_MAIN_SCRIPT - ScriptParams[0]);
|
||||||
|
return 0;
|
||||||
|
case COMMAND_RETURN:
|
||||||
|
assert(m_nStackPointer > 0); /* No more SSU */
|
||||||
|
SetIP(m_anStack[--m_nStackPointer]);
|
||||||
|
return 0;
|
||||||
|
case COMMAND_LINE:
|
||||||
|
CollectParameters(&m_nIp, 6);
|
||||||
|
/* Something must have been here */
|
||||||
|
return 0;
|
||||||
|
case COMMAND_CREATE_PLAYER:
|
||||||
|
{
|
||||||
|
CollectParameters(&m_nIp, 4);
|
||||||
|
int32 index = ScriptParams[0];
|
||||||
|
assert(index < 1); /* Constant? Also no more double player glitch */
|
||||||
|
debug("&&&&&&&&&&&&&Creating player: %d\n", index);
|
||||||
|
if (!CStreaming::HasModelLoaded(MI_PLAYER)) {
|
||||||
|
CStreaming::RequestSpecialModel(MI_PLAYER, "player", STREAMFLAGS_DONT_REMOVE | STREAMFLAGS_DEPENDENCY);
|
||||||
|
CStreaming::LoadAllRequestedModels(false);
|
||||||
|
}
|
||||||
|
CPlayerPed::SetupPlayerPed(index);
|
||||||
|
CWorld::Players[index].m_pPed->CharCreatedBy = MISSION_CHAR;
|
||||||
|
CPlayerPed::DeactivatePlayerPed(index);
|
||||||
|
CVector pos = *(CVector*)&ScriptParams[1];
|
||||||
|
if (pos.z <= -100.0f)
|
||||||
|
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||||
|
pos.z += CWorld::Players[index].m_pPed->GetDistanceFromCentreOfMassToBaseOfModel();
|
||||||
|
CWorld::Players[index].m_pPed->GetPosition() = pos;
|
||||||
|
CTheScripts::ClearSpaceForMissionEntity(pos, CWorld::Players[index].m_pPed);
|
||||||
|
CPlayerPed::ReactivatePlayerPed(index);
|
||||||
|
ScriptParams[0] = index;
|
||||||
|
StoreParameters(&m_nIp, 1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_GET_PLAYER_COORDINATES:
|
||||||
|
{
|
||||||
|
CVector pos;
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
if (CWorld::Players[ScriptParams[0]].m_pPed->bInVehicle)
|
||||||
|
pos = CWorld::Players[ScriptParams[0]].m_pPed->m_pMyVehicle->GetPosition();
|
||||||
|
else
|
||||||
|
pos = CWorld::Players[ScriptParams[0]].m_pPed->GetPosition();
|
||||||
|
*(CVector*)&ScriptParams[0] = pos;
|
||||||
|
StoreParameters(&m_nIp, 3);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_SET_PLAYER_COORDINATES:
|
||||||
|
{
|
||||||
|
CollectParameters(&m_nIp, 4);
|
||||||
|
CVector pos = *(CVector*)&ScriptParams[1];
|
||||||
|
int index = ScriptParams[0];
|
||||||
|
if (pos.z <= -100.0f)
|
||||||
|
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||||
|
CPlayerPed* ped = CWorld::Players[index].m_pPed;
|
||||||
|
if (!ped->bInVehicle) {
|
||||||
|
pos.z += ped->GetDistanceFromCentreOfMassToBaseOfModel();
|
||||||
|
ped->Teleport(pos);
|
||||||
|
CTheScripts::ClearSpaceForMissionEntity(pos, ped);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
pos.z += ped->m_pMyVehicle->GetDistanceFromCentreOfMassToBaseOfModel();
|
||||||
|
if (ped->m_pMyVehicle->IsBoat())
|
||||||
|
ped->m_pMyVehicle->Teleport(pos);
|
||||||
|
else
|
||||||
|
ped->m_pMyVehicle->Teleport(pos);
|
||||||
|
/* I'll keep this condition here but obviously it is absolutely pointless */
|
||||||
|
/* It's clearly present in disassembly so it had to be in original code */
|
||||||
|
CTheScripts::ClearSpaceForMissionEntity(pos, ped->m_pMyVehicle);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_PLAYER_IN_AREA_2D:
|
||||||
|
{
|
||||||
|
CollectParameters(&m_nIp, 6);
|
||||||
|
CPlayerPed* ped = CWorld::Players[ScriptParams[0]].m_pPed;
|
||||||
|
float x1, y1, x2, y2;
|
||||||
|
x1 = *(float*)&ScriptParams[1];
|
||||||
|
y1 = *(float*)&ScriptParams[2];
|
||||||
|
x2 = *(float*)&ScriptParams[3];
|
||||||
|
y2 = *(float*)&ScriptParams[4];
|
||||||
|
if (!ped->bInVehicle)
|
||||||
|
UpdateCompareFlag(ped->IsWithinArea(x1, y1, x2, y2));
|
||||||
|
else
|
||||||
|
UpdateCompareFlag(ped->m_pMyVehicle->IsWithinArea(x1, y1, x2, y2));
|
||||||
|
if (!ScriptParams[5])
|
||||||
|
return 0;
|
||||||
|
CTheScripts::HighlightImportantArea((uint32)this + m_nIp, x1, y1, x2, y2, -100.0f);
|
||||||
|
if (CTheScripts::DbgFlag)
|
||||||
|
CTheScripts::DrawDebugSquare(x1, y1, x2, y2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_IS_PLAYER_IN_AREA_3D:
|
||||||
|
{
|
||||||
|
CollectParameters(&m_nIp, 8);
|
||||||
|
CPlayerPed* ped = CWorld::Players[ScriptParams[0]].m_pPed;
|
||||||
|
float x1, y1, z1, x2, y2, z2;
|
||||||
|
x1 = *(float*)&ScriptParams[1];
|
||||||
|
y1 = *(float*)&ScriptParams[2];
|
||||||
|
z1 = *(float*)&ScriptParams[3];
|
||||||
|
x2 = *(float*)&ScriptParams[4];
|
||||||
|
y2 = *(float*)&ScriptParams[5];
|
||||||
|
z2 = *(float*)&ScriptParams[6];
|
||||||
|
if (ped->bInVehicle)
|
||||||
|
UpdateCompareFlag(ped->m_pMyVehicle->IsWithinArea(x1, y1, z1, x2, y2, z2));
|
||||||
|
else
|
||||||
|
UpdateCompareFlag(ped->IsWithinArea(x1, y1, z1, x2, y2, z2));
|
||||||
|
if (!ScriptParams[7])
|
||||||
|
return 0;
|
||||||
|
CTheScripts::HighlightImportantArea((uint32)this + m_nIp, x1, y1, x2, y2, -100.0f);
|
||||||
|
if (CTheScripts::DbgFlag)
|
||||||
|
CTheScripts::DrawDebugCube(x1, y1, z1, x2, y2, z2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
case COMMAND_ADD_INT_VAR_TO_INT_VAR:
|
||||||
|
*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) += *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
return 0;
|
||||||
|
case COMMAND_ADD_INT_LVAR_TO_INT_VAR:
|
||||||
|
*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) += *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
return 0;
|
||||||
|
case COMMAND_ADD_INT_VAR_TO_INT_LVAR:
|
||||||
|
*GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) += *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
return 0;
|
||||||
|
case COMMAND_ADD_INT_LVAR_TO_INT_LVAR:
|
||||||
|
*GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) += *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
return 0;
|
||||||
|
case COMMAND_ADD_FLOAT_VAR_TO_FLOAT_VAR:
|
||||||
|
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) += *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
return 0;
|
||||||
|
case COMMAND_ADD_FLOAT_LVAR_TO_FLOAT_VAR:
|
||||||
|
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) += *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
return 0;
|
||||||
|
case COMMAND_ADD_FLOAT_VAR_TO_FLOAT_LVAR:
|
||||||
|
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) += *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
return 0;
|
||||||
|
case COMMAND_ADD_FLOAT_LVAR_TO_FLOAT_LVAR:
|
||||||
|
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) += *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
return 0;
|
||||||
|
case COMMAND_SUB_INT_VAR_FROM_INT_VAR:
|
||||||
|
*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) -= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
return 0;
|
||||||
|
case COMMAND_SUB_INT_LVAR_FROM_INT_LVAR:
|
||||||
|
*GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) -= *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
return 0;
|
||||||
|
case COMMAND_SUB_FLOAT_VAR_FROM_FLOAT_VAR:
|
||||||
|
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) -= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||||
|
return 0;
|
||||||
|
case COMMAND_SUB_FLOAT_LVAR_FROM_FLOAT_LVAR:
|
||||||
|
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) -= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||||
|
return 0;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRunningScript::UpdateCompareFlag(bool flag)
|
||||||
|
{
|
||||||
|
if (m_bNotFlag)
|
||||||
|
flag = !flag;
|
||||||
|
if (m_nAndOrState == 0){
|
||||||
|
m_bCondResult = flag;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (m_nAndOrState >= 1 && m_nAndOrState <= 8) { /* Maybe enums?*/
|
||||||
|
m_bCondResult &= flag;
|
||||||
|
if (m_nAndOrState == 1){
|
||||||
|
m_nAndOrState = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}else if (m_nAndOrState >= 21 && m_nAndOrState <= 28){
|
||||||
|
m_bCondResult |= flag;
|
||||||
|
if (m_nAndOrState == 21) {
|
||||||
|
m_nAndOrState = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_nAndOrState--;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
WRAPPER int8 CRunningScript::ProcessCommandsFrom100To199(int32 command) { EAXJMP(0x43AEA0); }
|
||||||
|
WRAPPER int8 CRunningScript::ProcessCommandsFrom200To299(int32 command) { EAXJMP(0x43D530); }
|
||||||
|
WRAPPER int8 CRunningScript::ProcessCommandsFrom300To399(int32 command) { EAXJMP(0x43ED30); }
|
||||||
|
WRAPPER int8 CRunningScript::ProcessCommandsFrom400To499(int32 command) { EAXJMP(0x440CB0); }
|
||||||
|
WRAPPER int8 CRunningScript::ProcessCommandsFrom500To599(int32 command) { EAXJMP(0x4429C0); }
|
||||||
|
WRAPPER int8 CRunningScript::ProcessCommandsFrom600To699(int32 command) { EAXJMP(0x444B20); }
|
||||||
|
WRAPPER int8 CRunningScript::ProcessCommandsFrom700To799(int32 command) { EAXJMP(0x4458A0); }
|
||||||
|
WRAPPER int8 CRunningScript::ProcessCommandsFrom800To899(int32 command) { EAXJMP(0x448240); }
|
||||||
|
WRAPPER int8 CRunningScript::ProcessCommandsFrom900To999(int32 command) { EAXJMP(0x44CB80); }
|
||||||
|
WRAPPER int8 CRunningScript::ProcessCommandsFrom1000To1099(int32 command) { EAXJMP(0x588490); }
|
||||||
|
WRAPPER int8 CRunningScript::ProcessCommandsFrom1100To1199(int32 command) { EAXJMP(0x589D00); }
|
||||||
|
|
||||||
|
WRAPPER void CTheScripts::DrawScriptSpheres() { EAXJMP(0x44FAC0); }
|
||||||
|
WRAPPER void CRunningScript::DoDeatharrestCheck() { EAXJMP(0x452A30); }
|
||||||
|
WRAPPER void CTheScripts::DrawDebugSquare(float, float, float, float) { EAXJMP(0x452D00); }
|
||||||
|
WRAPPER void CTheScripts::DrawDebugCube(float, float, float, float, float, float) { EAXJMP(0x453100); }
|
||||||
WRAPPER void CTheScripts::ScriptDebugLine3D(float x1, float y1, float z1, float x2, float y2, float z2, int col, int col2) { EAXJMP(0x4534E0); }
|
WRAPPER void CTheScripts::ScriptDebugLine3D(float x1, float y1, float z1, float x2, float y2, float z2, int col, int col2) { EAXJMP(0x4534E0); }
|
||||||
|
WRAPPER void CTheScripts::ClearSpaceForMissionEntity(const CVector&, CEntity*) { EAXJMP(0x454060); }
|
||||||
|
WRAPPER void CTheScripts::HighlightImportantArea(uint32, float, float, float, float, float) { EAXJMP(0x454320); }
|
||||||
WRAPPER void CTheScripts::CleanUpThisVehicle(CVehicle*) { EAXJMP(0x4548D0); }
|
WRAPPER void CTheScripts::CleanUpThisVehicle(CVehicle*) { EAXJMP(0x4548D0); }
|
||||||
WRAPPER void CTheScripts::CleanUpThisPed(CPed*) { EAXJMP(0x4547A0); }
|
WRAPPER void CTheScripts::CleanUpThisPed(CPed*) { EAXJMP(0x4547A0); }
|
||||||
WRAPPER void CTheScripts::CleanUpThisObject(CObject*) { EAXJMP(0x454910); }
|
WRAPPER void CTheScripts::CleanUpThisObject(CObject*) { EAXJMP(0x454910); }
|
||||||
@ -582,6 +1420,9 @@ InjectHook(0x4382E0, &CRunningScript::CollectParameters, PATCH_JUMP);
|
|||||||
InjectHook(0x438460, &CRunningScript::CollectNextParameterWithoutIncreasingPC, PATCH_JUMP);
|
InjectHook(0x438460, &CRunningScript::CollectNextParameterWithoutIncreasingPC, PATCH_JUMP);
|
||||||
InjectHook(0x4385A0, &CRunningScript::StoreParameters, PATCH_JUMP);
|
InjectHook(0x4385A0, &CRunningScript::StoreParameters, PATCH_JUMP);
|
||||||
InjectHook(0x438640, &CRunningScript::GetPointerToScriptVariable, PATCH_JUMP);
|
InjectHook(0x438640, &CRunningScript::GetPointerToScriptVariable, PATCH_JUMP);
|
||||||
InjectHook(0x4386C0, &CRunningScript::Init, PATCH_JUMP);
|
|
||||||
InjectHook(0x438790, &CTheScripts::Init, PATCH_JUMP);
|
InjectHook(0x438790, &CTheScripts::Init, PATCH_JUMP);
|
||||||
|
InjectHook(0x439000, &CTheScripts::StartNewScript, PATCH_JUMP);
|
||||||
|
InjectHook(0x439040, &CTheScripts::Process, PATCH_JUMP);
|
||||||
|
InjectHook(0x439400, &CTheScripts::StartTestScript, PATCH_JUMP);
|
||||||
|
InjectHook(0x439410, &CTheScripts::IsPlayerOnAMission, PATCH_JUMP);
|
||||||
ENDPATCHES
|
ENDPATCHES
|
@ -10,8 +10,8 @@ class CObject;
|
|||||||
|
|
||||||
struct CScriptRectangle
|
struct CScriptRectangle
|
||||||
{
|
{
|
||||||
bool m_bIsUsed;
|
int8 m_bIsUsed;
|
||||||
bool m_bIsAntialiased;
|
bool m_bBeforeFade;
|
||||||
int16 m_nTextureId;
|
int16 m_nTextureId;
|
||||||
CRect m_sRect;
|
CRect m_sRect;
|
||||||
CRGBA m_sColor;
|
CRGBA m_sColor;
|
||||||
@ -42,6 +42,8 @@ struct CTextLine
|
|||||||
float m_fAtX;
|
float m_fAtX;
|
||||||
float m_fAtY;
|
float m_fAtY;
|
||||||
wchar m_Text[SCRIPT_TEXT_MAX_LENGTH];
|
wchar m_Text[SCRIPT_TEXT_MAX_LENGTH];
|
||||||
|
|
||||||
|
void Reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(CTextLine) == 0x414, "Script.h: error");
|
static_assert(sizeof(CTextLine) == 0x414, "Script.h: error");
|
||||||
@ -71,7 +73,7 @@ class CRunningScript
|
|||||||
uint16 m_nStackPointer;
|
uint16 m_nStackPointer;
|
||||||
int32 m_anLocalVariables[NUM_LOCAL_VARS + NUM_TIMERS];
|
int32 m_anLocalVariables[NUM_LOCAL_VARS + NUM_TIMERS];
|
||||||
bool m_bCondResult;
|
bool m_bCondResult;
|
||||||
bool m_bIsMissionThread;
|
bool m_bIsMissionScript;
|
||||||
bool m_bSkipWakeTime;
|
bool m_bSkipWakeTime;
|
||||||
uint32 m_nWakeTime;
|
uint32 m_nWakeTime;
|
||||||
uint16 m_nAndOrState;
|
uint16 m_nAndOrState;
|
||||||
@ -81,6 +83,13 @@ class CRunningScript
|
|||||||
bool m_bMissionFlag;
|
bool m_bMissionFlag;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
void SetIP(uint32 ip) { m_nIp = ip; }
|
||||||
|
CRunningScript* GetNext() { return next; }
|
||||||
|
void UpdateTimers(float timeStep){
|
||||||
|
m_anLocalVariables[NUM_LOCAL_VARS] += timeStep;
|
||||||
|
m_anLocalVariables[NUM_LOCAL_VARS + 1] += timeStep;
|
||||||
|
}
|
||||||
|
|
||||||
void CollectParameters(uint32*, int16);
|
void CollectParameters(uint32*, int16);
|
||||||
int32 CollectNextParameterWithoutIncreasingPC(uint32);
|
int32 CollectNextParameterWithoutIncreasingPC(uint32);
|
||||||
int32* GetPointerToScriptVariable(uint32*, int16);
|
int32* GetPointerToScriptVariable(uint32*, int16);
|
||||||
@ -88,6 +97,22 @@ public:
|
|||||||
void Init();
|
void Init();
|
||||||
void RemoveScriptFromList(CRunningScript**);
|
void RemoveScriptFromList(CRunningScript**);
|
||||||
void AddScriptToList(CRunningScript**);
|
void AddScriptToList(CRunningScript**);
|
||||||
|
void Process();
|
||||||
|
int8 ProcessOneCommand();
|
||||||
|
void DoDeatharrestCheck();
|
||||||
|
int8 ProcessCommandsFrom0To99(int32);
|
||||||
|
int8 ProcessCommandsFrom100To199(int32);
|
||||||
|
int8 ProcessCommandsFrom200To299(int32);
|
||||||
|
int8 ProcessCommandsFrom300To399(int32);
|
||||||
|
int8 ProcessCommandsFrom400To499(int32);
|
||||||
|
int8 ProcessCommandsFrom500To599(int32);
|
||||||
|
int8 ProcessCommandsFrom600To699(int32);
|
||||||
|
int8 ProcessCommandsFrom700To799(int32);
|
||||||
|
int8 ProcessCommandsFrom800To899(int32);
|
||||||
|
int8 ProcessCommandsFrom900To999(int32);
|
||||||
|
int8 ProcessCommandsFrom1000To1099(int32);
|
||||||
|
int8 ProcessCommandsFrom1100To1199(int32);
|
||||||
|
void UpdateCompareFlag(bool);
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -169,7 +194,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
ARGUMENT_INT32 = 1,
|
ARGUMENT_END = 0,
|
||||||
|
ARGUMENT_INT32,
|
||||||
ARGUMENT_GLOBALVAR,
|
ARGUMENT_GLOBALVAR,
|
||||||
ARGUMENT_LOCALVAR,
|
ARGUMENT_LOCALVAR,
|
||||||
ARGUMENT_INT8,
|
ARGUMENT_INT8,
|
||||||
@ -266,17 +292,27 @@ public:
|
|||||||
static uint16 &NumberOfIntroRectanglesThisFrame;
|
static uint16 &NumberOfIntroRectanglesThisFrame;
|
||||||
static uint16 &NumberOfIntroTextLinesThisFrame;
|
static uint16 &NumberOfIntroTextLinesThisFrame;
|
||||||
static bool &UseTextCommands;
|
static bool &UseTextCommands;
|
||||||
|
static uint16 &CommandsExecuted;
|
||||||
|
static uint16 &ScriptsUpdated;
|
||||||
public:
|
public:
|
||||||
static bool IsPlayerOnAMission();
|
|
||||||
static void ScriptDebugLine3D(float x1, float y1, float z1, float x2, float y2, float z2, int col, int col2);
|
static void ScriptDebugLine3D(float x1, float y1, float z1, float x2, float y2, float z2, int col, int col2);
|
||||||
static void CleanUpThisVehicle(CVehicle*);
|
static void CleanUpThisVehicle(CVehicle*);
|
||||||
static void CleanUpThisPed(CPed*);
|
static void CleanUpThisPed(CPed*);
|
||||||
static void CleanUpThisObject(CObject*);
|
static void CleanUpThisObject(CObject*);
|
||||||
static void Init();
|
static void Init();
|
||||||
|
static CRunningScript* StartNewScript(uint32);
|
||||||
|
static void Process();
|
||||||
|
static CRunningScript* StartTestScript();
|
||||||
|
static bool IsPlayerOnAMission();
|
||||||
|
|
||||||
static void ReadObjectNamesFromScript();
|
static void ReadObjectNamesFromScript();
|
||||||
static void UpdateObjectIndices();
|
static void UpdateObjectIndices();
|
||||||
static void ReadMultiScriptFileOffsetsFromScript();
|
static void ReadMultiScriptFileOffsetsFromScript();
|
||||||
|
static void DrawScriptSpheres();
|
||||||
|
static void ClearSpaceForMissionEntity(const CVector&, CEntity*);
|
||||||
|
static void HighlightImportantArea(uint32, float, float, float, float, float);
|
||||||
|
static void DrawDebugSquare(float, float, float, float);
|
||||||
|
static void DrawDebugCube(float, float, float, float, float, float);
|
||||||
|
|
||||||
static int32 Read4BytesFromScript(uint32* pIp){
|
static int32 Read4BytesFromScript(uint32* pIp){
|
||||||
int32 retval = 0;
|
int32 retval = 0;
|
||||||
|
1158
src/control/ScriptCommands.h
Normal file
1158
src/control/ScriptCommands.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -18,10 +18,12 @@ const float DefaultFOV = 70.0f; // beta: 80.0f
|
|||||||
CCamera &TheCamera = *(CCamera*)0x6FACF8;
|
CCamera &TheCamera = *(CCamera*)0x6FACF8;
|
||||||
bool &CCamera::m_bUseMouse3rdPerson = *(bool *)0x5F03D8;
|
bool &CCamera::m_bUseMouse3rdPerson = *(bool *)0x5F03D8;
|
||||||
|
|
||||||
|
WRAPPER void CCamera::CamShake(float strength, float x, float y, float z) { EAXJMP(0x46B200); }
|
||||||
WRAPPER void CCamera::DrawBordersForWideScreen(void) { EAXJMP(0x46B430); }
|
WRAPPER void CCamera::DrawBordersForWideScreen(void) { EAXJMP(0x46B430); }
|
||||||
WRAPPER void CCamera::CalculateDerivedValues(void) { EAXJMP(0x46EEA0); }
|
WRAPPER void CCamera::CalculateDerivedValues(void) { EAXJMP(0x46EEA0); }
|
||||||
WRAPPER void CCamera::Restore(void) { EAXJMP(0x46F990); }
|
WRAPPER void CCamera::Restore(void) { EAXJMP(0x46F990); }
|
||||||
WRAPPER void CCamera::SetWidescreenOff(void) { EAXJMP(0x46FF10); }
|
WRAPPER void CCamera::SetWidescreenOff(void) { EAXJMP(0x46FF10); }
|
||||||
|
WRAPPER void CCamera::CamShake(float) { EAXJMP(0x46B100); }
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CCamera::IsSphereVisible(const CVector ¢er, float radius, const CMatrix *mat)
|
CCamera::IsSphereVisible(const CVector ¢er, float radius, const CMatrix *mat)
|
||||||
@ -678,9 +680,13 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
|
|||||||
else if(TargetZOffSet == m_fUnknownZOffSet && TargetZOffSet > m_fCamBufferedHeight){
|
else if(TargetZOffSet == m_fUnknownZOffSet && TargetZOffSet > m_fCamBufferedHeight){
|
||||||
// TODO: figure this out
|
// TODO: figure this out
|
||||||
bool foo = false;
|
bool foo = false;
|
||||||
switch(((CPhysical*)CamTargetEntity)->m_nLastCollType)
|
switch(((CPhysical*)CamTargetEntity)->m_nSurfaceTouched)
|
||||||
case 2: case 3: case 5:
|
case SURFACE_GRASS:
|
||||||
case 11: case 23: case 26:
|
case SURFACE_DIRT:
|
||||||
|
case SURFACE_PAVEMENT:
|
||||||
|
case SURFACE_STEEL:
|
||||||
|
case SURFACE_TIRE:
|
||||||
|
case SURFACE_STONE:
|
||||||
foo = true;
|
foo = true;
|
||||||
if(foo)
|
if(foo)
|
||||||
WellBufferMe(TargetHeight, &m_fCamBufferedHeight, &m_fCamBufferedHeightSpeed, 0.4f, 0.05f, false);
|
WellBufferMe(TargetHeight, &m_fCamBufferedHeight, &m_fCamBufferedHeightSpeed, 0.4f, 0.05f, false);
|
||||||
|
@ -454,6 +454,8 @@ int m_iModeObbeCamIsInForCar;
|
|||||||
void ProcessMusicFade(void);
|
void ProcessMusicFade(void);
|
||||||
void SetFadeColour(uint8 r, uint8 g, uint8 b);
|
void SetFadeColour(uint8 r, uint8 g, uint8 b);
|
||||||
|
|
||||||
|
void CamShake(float strength, float x, float y, float z);
|
||||||
|
|
||||||
void SetMotionBlur(int r, int g, int b, int a, int type);
|
void SetMotionBlur(int r, int g, int b, int a, int type);
|
||||||
void SetMotionBlurAlpha(int a);
|
void SetMotionBlurAlpha(int a);
|
||||||
void RenderMotionBlur(void);
|
void RenderMotionBlur(void);
|
||||||
@ -463,6 +465,7 @@ int m_iModeObbeCamIsInForCar;
|
|||||||
void DrawBordersForWideScreen(void);
|
void DrawBordersForWideScreen(void);
|
||||||
void Restore(void);
|
void Restore(void);
|
||||||
void SetWidescreenOff(void);
|
void SetWidescreenOff(void);
|
||||||
|
void CamShake(float);
|
||||||
|
|
||||||
void dtor(void) { this->CCamera::~CCamera(); }
|
void dtor(void) { this->CCamera::~CCamera(); }
|
||||||
};
|
};
|
||||||
|
@ -1173,7 +1173,7 @@ enum {
|
|||||||
// This checks model A's spheres and lines against model B's spheres, boxes and triangles.
|
// This checks model A's spheres and lines against model B's spheres, boxes and triangles.
|
||||||
// Returns the number of A's spheres that collide.
|
// Returns the number of A's spheres that collide.
|
||||||
// Returned ColPoints are in world space.
|
// Returned ColPoints are in world space.
|
||||||
// NB: lines do not seem to be supported very well, use with caution
|
// NB: only vehicles can have col models with lines, exactly 4, one for each wheel
|
||||||
int32
|
int32
|
||||||
CCollision::ProcessColModels(const CMatrix &matrixA, CColModel &modelA,
|
CCollision::ProcessColModels(const CMatrix &matrixA, CColModel &modelA,
|
||||||
const CMatrix &matrixB, CColModel &modelB,
|
const CMatrix &matrixB, CColModel &modelB,
|
||||||
|
@ -147,7 +147,7 @@ public:
|
|||||||
static bool ProcessSphereTriangle(const CColSphere &sph, const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane, CColPoint &point, float &mindistsq);
|
static bool ProcessSphereTriangle(const CColSphere &sph, const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane, CColPoint &point, float &mindistsq);
|
||||||
static bool ProcessLineOfSight(const CColLine &line, const CMatrix &matrix, CColModel &model, CColPoint &point, float &mindist, bool ignoreSeeThrough);
|
static bool ProcessLineOfSight(const CColLine &line, const CMatrix &matrix, CColModel &model, CColPoint &point, float &mindist, bool ignoreSeeThrough);
|
||||||
static bool ProcessVerticalLine(const CColLine &line, const CMatrix &matrix, CColModel &model, CColPoint &point, float &mindist, bool ignoreSeeThrough, CStoredCollPoly *poly);
|
static bool ProcessVerticalLine(const CColLine &line, const CMatrix &matrix, CColModel &model, CColPoint &point, float &mindist, bool ignoreSeeThrough, CStoredCollPoly *poly);
|
||||||
static int32 ProcessColModels(const CMatrix &matrix1, CColModel &model1, const CMatrix &matrix2, CColModel &model2, CColPoint *point1, CColPoint *point2, float *linedists);
|
static int32 ProcessColModels(const CMatrix &matrixA, CColModel &modelA, const CMatrix &matrixB, CColModel &modelB, CColPoint *spherepoints, CColPoint *linepoints, float *linedists);
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// CCollision::IsStoredPolyStillValidVerticalLine
|
// CCollision::IsStoredPolyStillValidVerticalLine
|
||||||
|
@ -21,6 +21,7 @@ WRAPPER void CControllerConfigManager::InitDefaultControlConfigJoyPad(unsigned i
|
|||||||
WRAPPER void CControllerConfigManager::ClearSimButtonPressCheckers() { EAXJMP(0x58D220); }
|
WRAPPER void CControllerConfigManager::ClearSimButtonPressCheckers() { EAXJMP(0x58D220); }
|
||||||
WRAPPER void CControllerConfigManager::AffectPadFromKeyBoard() { EAXJMP(0x58D0C0); }
|
WRAPPER void CControllerConfigManager::AffectPadFromKeyBoard() { EAXJMP(0x58D0C0); }
|
||||||
WRAPPER void CControllerConfigManager::AffectPadFromMouse() { EAXJMP(0x58D1A0); }
|
WRAPPER void CControllerConfigManager::AffectPadFromMouse() { EAXJMP(0x58D1A0); }
|
||||||
|
WRAPPER void CControllerConfigManager::ClearSettingsAssociatedWithAction(int, int) { EAXJMP(0x58EB40); }
|
||||||
|
|
||||||
void CControllerConfigManager::LoadSettings(int32 file)
|
void CControllerConfigManager::LoadSettings(int32 file)
|
||||||
{
|
{
|
||||||
|
@ -50,6 +50,7 @@ public:
|
|||||||
void ClearSimButtonPressCheckers();
|
void ClearSimButtonPressCheckers();
|
||||||
void AffectPadFromKeyBoard();
|
void AffectPadFromKeyBoard();
|
||||||
void AffectPadFromMouse();
|
void AffectPadFromMouse();
|
||||||
|
void ClearSettingsAssociatedWithAction(int, int);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
5
src/core/Explosion.cpp
Normal file
5
src/core/Explosion.cpp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#include "common.h"
|
||||||
|
#include "patcher.h"
|
||||||
|
#include "Explosion.h"
|
||||||
|
|
||||||
|
WRAPPER void CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32) { EAXJMP(0x5591C0); }
|
15
src/core/Explosion.h
Normal file
15
src/core/Explosion.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
class CEntity;
|
||||||
|
|
||||||
|
enum eExplosionType
|
||||||
|
{
|
||||||
|
EXPLOSION_3 = 3,
|
||||||
|
EXPLOSION_4
|
||||||
|
};
|
||||||
|
|
||||||
|
class CExplosion
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32);
|
||||||
|
};
|
@ -2,4 +2,8 @@
|
|||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
#include "Fire.h"
|
#include "Fire.h"
|
||||||
|
|
||||||
|
CFireManager &gFireManager = *(CFireManager*)0x8F31D0;
|
||||||
|
|
||||||
WRAPPER void CFire::Extinguish(void) { EAXJMP(0x479D40); }
|
WRAPPER void CFire::Extinguish(void) { EAXJMP(0x479D40); }
|
||||||
|
|
||||||
|
WRAPPER void CFireManager::StartFire(CEntity *entityOnFire, CEntity *culprit, float, uint32) { EAXJMP(0x479590); }
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "common.h"
|
|
||||||
#include "Entity.h"
|
class CEntity;
|
||||||
|
|
||||||
class CFire
|
class CFire
|
||||||
{
|
{
|
||||||
char m_bIsOngoing;
|
bool m_bIsOngoing;
|
||||||
char m_bExists;
|
bool m_bExists;
|
||||||
char m_bPropogationFlag;
|
bool m_bPropogationFlag;
|
||||||
char m_bAudioSet;
|
bool m_bAudioSet;
|
||||||
CVector m_vecPos;
|
CVector m_vecPos;
|
||||||
CEntity *m_pEntity;
|
CEntity *m_pEntity;
|
||||||
CEntity *m_pSource;
|
CEntity *m_pSource;
|
||||||
@ -21,3 +21,10 @@ class CFire
|
|||||||
public:
|
public:
|
||||||
void Extinguish(void);
|
void Extinguish(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CFireManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void StartFire(CEntity *entityOnFire, CEntity *culprit, float, uint32);
|
||||||
|
};
|
||||||
|
extern CFireManager &gFireManager;
|
||||||
|
@ -24,6 +24,10 @@
|
|||||||
#include "Vehicle.h"
|
#include "Vehicle.h"
|
||||||
#include "MBlur.h"
|
#include "MBlur.h"
|
||||||
#include "PlayerSkin.h"
|
#include "PlayerSkin.h"
|
||||||
|
#include "PlayerInfo.h"
|
||||||
|
#include "World.h"
|
||||||
|
|
||||||
|
#define ALL_ORIGINAL_FRONTEND 1
|
||||||
|
|
||||||
int32 &CMenuManager::OS_Language = *(int32*)0x5F2F78;
|
int32 &CMenuManager::OS_Language = *(int32*)0x5F2F78;
|
||||||
int8 &CMenuManager::m_PrefsUseVibration = *(int8*)0x95CD92;
|
int8 &CMenuManager::m_PrefsUseVibration = *(int8*)0x95CD92;
|
||||||
@ -50,7 +54,9 @@ int8 &CMenuManager::m_bFrontEnd_ReloadObrTxtGxt = *(int8*)0x628CFC;
|
|||||||
int32 &CMenuManager::m_PrefsMusicVolume = *(int32*)0x5F2E4C;
|
int32 &CMenuManager::m_PrefsMusicVolume = *(int32*)0x5F2E4C;
|
||||||
int32 &CMenuManager::m_PrefsSfxVolume = *(int32*)0x5F2E48;
|
int32 &CMenuManager::m_PrefsSfxVolume = *(int32*)0x5F2E48;
|
||||||
|
|
||||||
uint8 *CMenuManager::m_PrefsSkinFile = (uint8*)0x5F2E74;
|
char *CMenuManager::m_PrefsSkinFile = (char*)0x5F2E74;
|
||||||
|
|
||||||
|
int32 &CMenuManager::m_KeyPressedCode = *(int32*)0x5F2E70;
|
||||||
|
|
||||||
CMenuManager &FrontEndMenuManager = *(CMenuManager*)0x8F59D8;
|
CMenuManager &FrontEndMenuManager = *(CMenuManager*)0x8F59D8;
|
||||||
|
|
||||||
@ -58,14 +64,18 @@ CMenuManager &FrontEndMenuManager = *(CMenuManager*)0x8F59D8;
|
|||||||
float lodMultiplier = *(float*)0x5F726C;
|
float lodMultiplier = *(float*)0x5F726C;
|
||||||
|
|
||||||
// Stuff not in CMenuManager:
|
// Stuff not in CMenuManager:
|
||||||
int VibrationTime;
|
uint32 VibrationTime;
|
||||||
char* pEditString;
|
char* pEditString = (char*)0x628D00;
|
||||||
int32 pControlEdit;
|
int32 *&pControlEdit = *(int32**)0x628D08;
|
||||||
int8 DisplayComboButtonErrMsg;
|
int8 DisplayComboButtonErrMsg;
|
||||||
bool MouseButtonJustClicked;
|
int8 MouseButtonJustClicked;
|
||||||
bool JoyButtonJustClicked;
|
int8 JoyButtonJustClicked;
|
||||||
|
int32 &nTimeForSomething = *(int32*)0x628D54;
|
||||||
|
int32 TypeOfControl = 0;
|
||||||
|
int32 *pControlTemp = 0;
|
||||||
|
|
||||||
// Frontend inputs.
|
// Frontend inputs.
|
||||||
|
|
||||||
bool GetPadBack();
|
bool GetPadBack();
|
||||||
bool GetPadExitEnter();
|
bool GetPadExitEnter();
|
||||||
bool GetPadForward();
|
bool GetPadForward();
|
||||||
@ -73,6 +83,11 @@ bool GetPadMoveUp();
|
|||||||
bool GetPadMoveDown();
|
bool GetPadMoveDown();
|
||||||
bool GetPadMoveLeft();
|
bool GetPadMoveLeft();
|
||||||
bool GetPadMoveRight();
|
bool GetPadMoveRight();
|
||||||
|
bool GetMouseClickLeft();
|
||||||
|
bool GetMouseClickRight();
|
||||||
|
bool GetMouseClickMiddle();
|
||||||
|
bool GetMouseWheelUp();
|
||||||
|
bool GetMouseWheelDown();
|
||||||
bool GetMouseForward();
|
bool GetMouseForward();
|
||||||
bool GetMouseBack();
|
bool GetMouseBack();
|
||||||
bool GetMousePos();
|
bool GetMousePos();
|
||||||
@ -135,16 +150,35 @@ char *MenuFilenames[] = {
|
|||||||
nil, nil
|
nil, nil
|
||||||
};
|
};
|
||||||
|
|
||||||
#if 1
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::BuildStatLine(char *, void *, uint16, void *) { EAXJMP(0x483870); }
|
WRAPPER void CMenuManager::BuildStatLine(char *text, float *stat, bool aFloat, float* stat2) { EAXJMP(0x483870); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::BuildStatLine(char *, void *, uint16, void *)
|
void CMenuManager::BuildStatLine(char *text, float *stat, bool aFloat, float* stat2)
|
||||||
{
|
{
|
||||||
|
if (!text)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (stat2) {
|
||||||
|
if (aFloat)
|
||||||
|
sprintf(gString2, " %.2f %s %.2f", *stat, UnicodeToAscii(TheText.Get("FEST_OO")), *stat2);
|
||||||
|
else
|
||||||
|
sprintf(gString2, " %d %s %d", *(int*)stat, UnicodeToAscii(TheText.Get("FEST_OO")), *(int*)stat2);
|
||||||
|
}
|
||||||
|
else if (stat2) {
|
||||||
|
if (aFloat)
|
||||||
|
sprintf(gString2, " %.2f", *stat);
|
||||||
|
else
|
||||||
|
sprintf(gString2, " %d", *(int*)stat);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
gString2[0] = '\0';
|
||||||
|
|
||||||
|
UnicodeStrcpy(gUString, TheText.Get(text));
|
||||||
|
AsciiToUnicode(gString2, gUString2);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::CentreMousePointer() { EAXJMP(0x48ACE0); }
|
WRAPPER void CMenuManager::CentreMousePointer() { EAXJMP(0x48ACE0); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::CentreMousePointer()
|
void CMenuManager::CentreMousePointer()
|
||||||
@ -164,15 +198,15 @@ void CMenuManager::CentreMousePointer()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
WRAPPER void CMenuManager::CheckCodesForControls(int, int) { EAXJMP(0x48A950); }
|
WRAPPER int CMenuManager::CheckCodesForControls(int32) { EAXJMP(0x48A950); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::CheckCodesForControls()
|
void CMenuManager::CheckCodesForControls(int, int)
|
||||||
{
|
{
|
||||||
|
DisplayComboButtonErrMsg = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER bool CMenuManager::CheckHover(int, int, int, int) { EAXJMP(0x48ACA0); }
|
WRAPPER bool CMenuManager::CheckHover(int, int, int, int) { EAXJMP(0x48ACA0); }
|
||||||
#else
|
#else
|
||||||
bool CMenuManager::CheckHover(int x1, int x2, int y1, int y2)
|
bool CMenuManager::CheckHover(int x1, int x2, int y1, int y2)
|
||||||
@ -251,7 +285,7 @@ void CMenuManager::CheckSliderMovement(int value)
|
|||||||
TheCamera.m_fMouseAccelVertical = fMouseSens;
|
TheCamera.m_fMouseAccelVertical = fMouseSens;
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
@ -263,7 +297,7 @@ int CMenuManager::CostructStatLine(int)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::DisplayHelperText() { EAXJMP(0x48B490); }
|
WRAPPER void CMenuManager::DisplayHelperText() { EAXJMP(0x48B490); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::DisplayHelperText()
|
void CMenuManager::DisplayHelperText()
|
||||||
@ -303,7 +337,7 @@ void CMenuManager::DisplayHelperText()
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
|
|
||||||
CFont::SetAlignment(ALIGN_CENTER);
|
CFont::SetAlignment(ALIGN_CENTER);
|
||||||
CFont::SetScale(SCREEN_SCALE_X(0.4f), SCREEN_SCALE_Y(0.6f));
|
CFont::SetScale(SCREEN_SCALE_X(0.4f), SCREEN_SCALE_Y(0.6f));
|
||||||
@ -316,7 +350,7 @@ void CMenuManager::DisplayHelperText()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER float CMenuManager::DisplaySlider(float, float, float, float, float, float) { EAXJMP(0x488420); }
|
WRAPPER float CMenuManager::DisplaySlider(float, float, float, float, float, float) { EAXJMP(0x488420); }
|
||||||
#else
|
#else
|
||||||
float CMenuManager::DisplaySlider(float x, float y, float leftSize, float rightSize, float rectSize, float progress)
|
float CMenuManager::DisplaySlider(float x, float y, float leftSize, float rightSize, float rectSize, float progress)
|
||||||
@ -342,12 +376,12 @@ float CMenuManager::DisplaySlider(float x, float y, float leftSize, float rightS
|
|||||||
float _s = SCREEN_SCALE_X(2.0f);
|
float _s = SCREEN_SCALE_X(2.0f);
|
||||||
CSprite2d::DrawRect(CRect(_x + _s, _y + _s, _w + _s, _h + _s), CRGBA(0, 0, 0, FadeIn(255))); // Shadow
|
CSprite2d::DrawRect(CRect(_x + _s, _y + _s, _w + _s, _h + _s), CRGBA(0, 0, 0, FadeIn(255))); // Shadow
|
||||||
CSprite2d::DrawRect(CRect(i * rectSize/16.0f + x, y + sizeRange - ((16 - i) * leftSize + i * rightSize)/16.0f, SCREEN_SCALE_X(10.0f) + i * rectSize/16.0f + x, y + sizeRange), color);
|
CSprite2d::DrawRect(CRect(i * rectSize/16.0f + x, y + sizeRange - ((16 - i) * leftSize + i * rightSize)/16.0f, SCREEN_SCALE_X(10.0f) + i * rectSize/16.0f + x, y + sizeRange), color);
|
||||||
};
|
}
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::DoSettingsBeforeStartingAGame() { EAXJMP(0x48AB40); }
|
WRAPPER void CMenuManager::DoSettingsBeforeStartingAGame() { EAXJMP(0x48AB40); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::DoSettingsBeforeStartingAGame()
|
void CMenuManager::DoSettingsBeforeStartingAGame()
|
||||||
@ -366,7 +400,7 @@ void CMenuManager::DoSettingsBeforeStartingAGame()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::Draw() { EAXJMP(0x47AE00); }
|
WRAPPER void CMenuManager::Draw() { EAXJMP(0x47AE00); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::Draw()
|
void CMenuManager::Draw()
|
||||||
@ -427,7 +461,7 @@ void CMenuManager::Draw()
|
|||||||
default:
|
default:
|
||||||
str = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[0].m_EntryName);
|
str = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[0].m_EntryName);
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
|
|
||||||
CFont::SetDropShadowPosition(MENUDROP_COLOR_SIZE);
|
CFont::SetDropShadowPosition(MENUDROP_COLOR_SIZE);
|
||||||
CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(MENUDROP_COLOR_A)));
|
CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(MENUDROP_COLOR_A)));
|
||||||
@ -480,7 +514,7 @@ void CMenuManager::Draw()
|
|||||||
case 3:
|
case 3:
|
||||||
textToPrint[MENUCOLUMN_RIGHT] = TheText.Get("FEC_CF4");
|
textToPrint[MENUCOLUMN_RIGHT] = TheText.Get("FEC_CF4");
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
break;
|
break;
|
||||||
case MENUACTION_CTRLDISPLAY:
|
case MENUACTION_CTRLDISPLAY:
|
||||||
break;
|
break;
|
||||||
@ -510,7 +544,7 @@ void CMenuManager::Draw()
|
|||||||
case AR_16_9:
|
case AR_16_9:
|
||||||
textToPrint[MENUCOLUMN_RIGHT] = (wchar*)L"16:9";
|
textToPrint[MENUCOLUMN_RIGHT] = (wchar*)L"16:9";
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case MENUACTION_RADIO:
|
case MENUACTION_RADIO:
|
||||||
@ -560,7 +594,7 @@ void CMenuManager::Draw()
|
|||||||
case 2:
|
case 2:
|
||||||
textToPrint[MENUCOLUMN_RIGHT] = TheText.Get("FEA_4SP");
|
textToPrint[MENUCOLUMN_RIGHT] = TheText.Get("FEA_4SP");
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MENUACTION_CTRLMETHOD:
|
case MENUACTION_CTRLMETHOD:
|
||||||
@ -571,7 +605,7 @@ void CMenuManager::Draw()
|
|||||||
case 1:
|
case 1:
|
||||||
textToPrint[MENUCOLUMN_LEFT] = TheText.Get("FET_CCN");
|
textToPrint[MENUCOLUMN_LEFT] = TheText.Get("FET_CCN");
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
break;
|
break;
|
||||||
case MENUACTION_DYNAMICACOUSTIC:
|
case MENUACTION_DYNAMICACOUSTIC:
|
||||||
textToPrint[MENUCOLUMN_RIGHT] = TheText.Get(m_PrefsDMA ? "FEM_ON" : "FEM_OFF");
|
textToPrint[MENUCOLUMN_RIGHT] = TheText.Get(m_PrefsDMA ? "FEM_ON" : "FEM_OFF");
|
||||||
@ -579,7 +613,7 @@ void CMenuManager::Draw()
|
|||||||
case MENUACTION_MOUSESTEER:
|
case MENUACTION_MOUSESTEER:
|
||||||
textToPrint[MENUCOLUMN_RIGHT] = TheText.Get(m_bDisableMouseSteering ? "FEM_ON" : "FEM_OFF");
|
textToPrint[MENUCOLUMN_RIGHT] = TheText.Get(m_bDisableMouseSteering ? "FEM_ON" : "FEM_OFF");
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
|
|
||||||
CFont::SetDropShadowPosition(MENUDROP_COLOR_SIZE);
|
CFont::SetDropShadowPosition(MENUDROP_COLOR_SIZE);
|
||||||
CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(MENUDROP_COLOR_A)));
|
CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(MENUDROP_COLOR_A)));
|
||||||
@ -667,7 +701,7 @@ void CMenuManager::Draw()
|
|||||||
default:
|
default:
|
||||||
vecPositions.y = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(MENUCOLUMN_MID_Y);
|
vecPositions.y = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(MENUCOLUMN_MID_Y);
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
@ -719,9 +753,9 @@ void CMenuManager::Draw()
|
|||||||
m_nPrevOption = m_nCurrOption;
|
m_nPrevOption = m_nCurrOption;
|
||||||
|
|
||||||
if (GetMouseForward())
|
if (GetMouseForward())
|
||||||
m_nHoverOption = IGNORE_OPTION;
|
m_nHoverOption = HOVEROPTION_NULL;
|
||||||
else
|
else
|
||||||
m_nHoverOption = ACTIVATE_OPTION;
|
m_nHoverOption = HOVEROPTION_DEFAULT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -744,7 +778,7 @@ void CMenuManager::Draw()
|
|||||||
case MENUACTION_MOUSESENS:
|
case MENUACTION_MOUSESENS:
|
||||||
DisplaySlider(SCREEN_SCALE_FROM_RIGHT(MENUSLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), TheCamera.m_fMouseAccelHorzntl * 200.0f);
|
DisplaySlider(SCREEN_SCALE_FROM_RIGHT(MENUSLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), TheCamera.m_fMouseAccelHorzntl * 200.0f);
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
|
|
||||||
// Radio icons.
|
// Radio icons.
|
||||||
float fIconSpacing = 59.52f;
|
float fIconSpacing = 59.52f;
|
||||||
@ -793,9 +827,9 @@ void CMenuManager::Draw()
|
|||||||
case MENUPAGE_MOUSE_CONTROLS:
|
case MENUPAGE_MOUSE_CONTROLS:
|
||||||
DisplayHelperText();
|
DisplayHelperText();
|
||||||
break;
|
break;
|
||||||
};
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -826,7 +860,7 @@ void CMenuManager::DrawControllerSetupScreen()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::DrawFrontEnd(void) { EAXJMP(0x47A540); }
|
WRAPPER void CMenuManager::DrawFrontEnd(void) { EAXJMP(0x47A540); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::DrawFrontEnd()
|
void CMenuManager::DrawFrontEnd()
|
||||||
@ -850,7 +884,7 @@ void CMenuManager::DrawFrontEnd()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::DrawFrontEndNormal(void) { EAXJMP(0x47A5B0); }
|
WRAPPER void CMenuManager::DrawFrontEndNormal(void) { EAXJMP(0x47A5B0); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::DrawFrontEndNormal()
|
void CMenuManager::DrawFrontEndNormal()
|
||||||
@ -904,7 +938,7 @@ void CMenuManager::DrawFrontEndNormal()
|
|||||||
case MENUPAGE_OPTIONS:
|
case MENUPAGE_OPTIONS:
|
||||||
previousSprite = MENUSPRITE_PLAYERSET;
|
previousSprite = MENUSPRITE_PLAYERSET;
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
|
|
||||||
if (m_nPrevScreen == MENUPAGE_NONE)
|
if (m_nPrevScreen == MENUPAGE_NONE)
|
||||||
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(0, 0, 0, 255));
|
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(0, 0, 0, 255));
|
||||||
@ -949,7 +983,7 @@ void CMenuManager::DrawFrontEndNormal()
|
|||||||
case MENUPAGE_OPTIONS:
|
case MENUPAGE_OPTIONS:
|
||||||
currentSprite = MENUSPRITE_PLAYERSET;
|
currentSprite = MENUSPRITE_PLAYERSET;
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
|
|
||||||
uint32 savedShade;
|
uint32 savedShade;
|
||||||
uint32 savedAlpha;
|
uint32 savedAlpha;
|
||||||
@ -993,7 +1027,7 @@ void CMenuManager::DrawFrontEndNormal()
|
|||||||
default:
|
default:
|
||||||
CMenuManager::Draw();
|
CMenuManager::Draw();
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
|
|
||||||
CFont::DrawFonts();
|
CFont::DrawFonts();
|
||||||
|
|
||||||
@ -1012,7 +1046,7 @@ void CMenuManager::DrawPlayerSetupScreen()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER int CMenuManager::FadeIn(int alpha) { EAXJMP(0x48AC60); }
|
WRAPPER int CMenuManager::FadeIn(int alpha) { EAXJMP(0x48AC60); }
|
||||||
#else
|
#else
|
||||||
int CMenuManager::FadeIn(int alpha)
|
int CMenuManager::FadeIn(int alpha)
|
||||||
@ -1047,7 +1081,7 @@ int CMenuManager::GetStartOptionsCntrlConfigScreens()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::InitialiseChangedLanguageSettings() { EAXJMP(0x47A4D0); }
|
WRAPPER void CMenuManager::InitialiseChangedLanguageSettings() { EAXJMP(0x47A4D0); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::InitialiseChangedLanguageSettings()
|
void CMenuManager::InitialiseChangedLanguageSettings()
|
||||||
@ -1069,12 +1103,12 @@ void CMenuManager::InitialiseChangedLanguageSettings()
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::LoadAllTextures() { EAXJMP(0x47A230); }
|
WRAPPER void CMenuManager::LoadAllTextures() { EAXJMP(0x47A230); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::LoadAllTextures()
|
void CMenuManager::LoadAllTextures()
|
||||||
@ -1110,7 +1144,7 @@ void CMenuManager::LoadAllTextures()
|
|||||||
for (int i = 0; i < ARRAY_SIZE(FrontendFilenames); i++) {
|
for (int i = 0; i < ARRAY_SIZE(FrontendFilenames); i++) {
|
||||||
m_aFrontEndSprites[i].SetTexture(FrontendFilenames[i]);
|
m_aFrontEndSprites[i].SetTexture(FrontendFilenames[i]);
|
||||||
m_aFrontEndSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER);
|
m_aFrontEndSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER);
|
||||||
};
|
}
|
||||||
|
|
||||||
CTxdStore::PopCurrentTxd();
|
CTxdStore::PopCurrentTxd();
|
||||||
|
|
||||||
@ -1123,7 +1157,7 @@ void CMenuManager::LoadAllTextures()
|
|||||||
for (int i = 0; i < ARRAY_SIZE(MenuFilenames)/2; i++) {
|
for (int i = 0; i < ARRAY_SIZE(MenuFilenames)/2; i++) {
|
||||||
m_aMenuSprites[i].SetTexture(MenuFilenames[i*2], MenuFilenames[i*2+1]);
|
m_aMenuSprites[i].SetTexture(MenuFilenames[i*2], MenuFilenames[i*2+1]);
|
||||||
m_aMenuSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER);
|
m_aMenuSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER);
|
||||||
};
|
}
|
||||||
|
|
||||||
CTxdStore::PopCurrentTxd();
|
CTxdStore::PopCurrentTxd();
|
||||||
|
|
||||||
@ -1132,7 +1166,7 @@ void CMenuManager::LoadAllTextures()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::LoadSettings() { EAXJMP(0x488EE0); }
|
WRAPPER void CMenuManager::LoadSettings() { EAXJMP(0x488EE0); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::LoadSettings()
|
void CMenuManager::LoadSettings()
|
||||||
@ -1151,13 +1185,13 @@ void CMenuManager::LoadSettings()
|
|||||||
if (strncmp(&Ver, "THIS FILE IS NOT VALID YET", 26)) {
|
if (strncmp(&Ver, "THIS FILE IS NOT VALID YET", 26)) {
|
||||||
CFileMgr::Seek(fileHandle, 0, 0);
|
CFileMgr::Seek(fileHandle, 0, 0);
|
||||||
ControlsManager.LoadSettings(fileHandle);
|
ControlsManager.LoadSettings(fileHandle);
|
||||||
CFileMgr::Read(fileHandle, buf(&gString), 20);
|
CFileMgr::Read(fileHandle, buf(gString), 20);
|
||||||
CFileMgr::Read(fileHandle, buf(&gString), 20);
|
CFileMgr::Read(fileHandle, buf(gString), 20);
|
||||||
CFileMgr::Read(fileHandle, buf(&gString), 4);
|
CFileMgr::Read(fileHandle, buf(gString), 4);
|
||||||
CFileMgr::Read(fileHandle, buf(&gString), 4);
|
CFileMgr::Read(fileHandle, buf(gString), 4);
|
||||||
CFileMgr::Read(fileHandle, buf(&gString), 1);
|
CFileMgr::Read(fileHandle, buf(gString), 1);
|
||||||
CFileMgr::Read(fileHandle, buf(&gString), 1);
|
CFileMgr::Read(fileHandle, buf(gString), 1);
|
||||||
CFileMgr::Read(fileHandle, buf(&gString), 1);
|
CFileMgr::Read(fileHandle, buf(gString), 1);
|
||||||
CFileMgr::Read(fileHandle, buf(&TheCamera.m_bHeadBob), 1);
|
CFileMgr::Read(fileHandle, buf(&TheCamera.m_bHeadBob), 1);
|
||||||
CFileMgr::Read(fileHandle, buf(&TheCamera.m_fMouseAccelHorzntl), 4);
|
CFileMgr::Read(fileHandle, buf(&TheCamera.m_fMouseAccelHorzntl), 4);
|
||||||
CFileMgr::Read(fileHandle, buf(&TheCamera.m_fMouseAccelVertical), 4);
|
CFileMgr::Read(fileHandle, buf(&TheCamera.m_fMouseAccelVertical), 4);
|
||||||
@ -1253,7 +1287,7 @@ void CMenuManager::PrintBriefs()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::PrintErrorMessage() { EAXJMP(0x484F70); }
|
WRAPPER void CMenuManager::PrintErrorMessage() { EAXJMP(0x484F70); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::PrintErrorMessage()
|
void CMenuManager::PrintErrorMessage()
|
||||||
@ -1286,22 +1320,32 @@ void CMenuManager::PrintStats()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::Process(void) { EAXJMP(0x485100); }
|
WRAPPER void CMenuManager::Process(void) { EAXJMP(0x485100); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::Process(void)
|
void CMenuManager::Process(void)
|
||||||
{
|
{
|
||||||
if (m_bSaveMenuActive && TheCamera.GetScreenFadeStatus())
|
field_112 = 0;
|
||||||
|
|
||||||
|
if (!m_bSaveMenuActive && TheCamera.GetScreenFadeStatus() != FADE_0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
field_113 = 0;
|
//m_bLanguageLoaded = false; //XXX
|
||||||
|
m_bStartGameLoading = false;
|
||||||
InitialiseChangedLanguageSettings();
|
InitialiseChangedLanguageSettings();
|
||||||
|
|
||||||
|
if (GetPadExitEnter()) //XXX only escape
|
||||||
|
RequestFrontEndStartUp();
|
||||||
|
|
||||||
SwitchMenuOnAndOff();
|
SwitchMenuOnAndOff();
|
||||||
|
|
||||||
|
// Be able to re-open menu correctly.
|
||||||
if (m_bMenuActive) {
|
if (m_bMenuActive) {
|
||||||
|
|
||||||
|
// Load frontend textures.
|
||||||
LoadAllTextures();
|
LoadAllTextures();
|
||||||
|
|
||||||
|
// Set save/delete game pages.
|
||||||
if (m_nCurrScreen == MENUPAGE_DELETING) {
|
if (m_nCurrScreen == MENUPAGE_DELETING) {
|
||||||
bool SlotPopulated = false;
|
bool SlotPopulated = false;
|
||||||
|
|
||||||
@ -1350,25 +1394,107 @@ void CMenuManager::Process(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ProcessButtonPresses();
|
ProcessButtonPresses();
|
||||||
|
|
||||||
|
// Set binding keys.
|
||||||
|
if (pEditString && CPad::EditString(pEditString, 0) == nil) {
|
||||||
|
if (*pEditString == 0)
|
||||||
|
strcpy(pEditString, "NoName");
|
||||||
|
pEditString = nil;
|
||||||
|
SaveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (field_113 && !field_456) {
|
||||||
|
pControlEdit = CPad::EditCodesForControls(pControlEdit, 1);
|
||||||
|
JoyButtonJustClicked = 0;
|
||||||
|
MouseButtonJustClicked = 0;
|
||||||
|
|
||||||
|
if (GetMouseClickLeft())
|
||||||
|
MouseButtonJustClicked = 1;
|
||||||
|
else if (GetMouseClickRight())
|
||||||
|
MouseButtonJustClicked = 3;
|
||||||
|
else if (GetMouseClickMiddle())
|
||||||
|
MouseButtonJustClicked = 2;
|
||||||
|
else if (GetMouseWheelUp())
|
||||||
|
MouseButtonJustClicked = 4;
|
||||||
|
else if (GetMouseWheelDown())
|
||||||
|
MouseButtonJustClicked = 5;
|
||||||
|
//XXX two more buttons
|
||||||
|
|
||||||
|
JoyButtonJustClicked = ControlsManager.GetJoyButtonJustDown();
|
||||||
|
|
||||||
|
if (JoyButtonJustClicked)
|
||||||
|
TypeOfControl = 3;
|
||||||
|
if (MouseButtonJustClicked)
|
||||||
|
TypeOfControl = 2;
|
||||||
|
if (*pControlEdit != rsNULL)
|
||||||
|
TypeOfControl = 0;
|
||||||
|
|
||||||
|
if (!field_534) {
|
||||||
|
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0);
|
||||||
|
pControlEdit = nil;
|
||||||
|
field_113 = 0;
|
||||||
|
m_KeyPressedCode = -1;
|
||||||
|
field_456 = 0;
|
||||||
|
}
|
||||||
|
else if (!m_bKeyChangeNotProcessed) {
|
||||||
|
if (*pControlEdit != rsNULL || MouseButtonJustClicked || JoyButtonJustClicked)
|
||||||
|
CheckCodesForControls(TypeOfControl);
|
||||||
|
|
||||||
|
field_535 = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (GetPadExitEnter())
|
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
|
||||||
RequestFrontEndStartUp();
|
for (int i = 0; i < 4; i++)
|
||||||
|
ControlsManager.ClearSettingsAssociatedWithAction(m_CurrCntrlAction, i);
|
||||||
|
field_534 = false;
|
||||||
|
m_bKeyChangeNotProcessed = false;
|
||||||
|
pControlEdit = nil;
|
||||||
|
field_113 = 0;
|
||||||
|
m_KeyPressedCode = -1;
|
||||||
|
field_456 = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UnloadTextures();
|
if ((m_nCurrScreen == MENUPAGE_13 || m_nCurrScreen == MENUPAGE_16) && CTimer::GetTimeInMillisecondsPauseMode() > field_558) {
|
||||||
m_nPrevScreen = MENUPAGE_NONE;
|
|
||||||
m_nCurrScreen = m_nPrevScreen;
|
m_nCurrScreen = m_nPrevScreen;
|
||||||
m_nCurrOption = MENUROW_0;
|
m_nCurrOption = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset pad shaking.
|
||||||
|
if (VibrationTime && CTimer::GetTimeInMillisecondsPauseMode() > VibrationTime) {
|
||||||
|
CPad::StopPadsShaking();
|
||||||
|
VibrationTime = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
UnloadTextures();
|
||||||
|
field_452 = 0;
|
||||||
|
// byte_5F33E4 = 1; // unused
|
||||||
|
m_nPrevScreen = 0;
|
||||||
|
m_nCurrScreen = m_nPrevScreen;
|
||||||
|
m_nCurrOption = 0;
|
||||||
|
pEditString = nil;
|
||||||
|
field_113 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_bStartGameLoading) {
|
||||||
|
if (m_bGameNotLoaded)
|
||||||
|
DMAudio.Service();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::ProcessButtonPresses() { EAXJMP(0x4856F0); }
|
WRAPPER void CMenuManager::ProcessButtonPresses() { EAXJMP(0x4856F0); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::ProcessButtonPresses()
|
void CMenuManager::ProcessButtonPresses()
|
||||||
{
|
{
|
||||||
// Update Mouse Position
|
if(pEditString)
|
||||||
|
return;
|
||||||
|
if(pControlEdit)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Update mouse position
|
||||||
m_nMouseOldPosX = m_nMousePosX;
|
m_nMouseOldPosX = m_nMousePosX;
|
||||||
m_nMouseOldPosY = m_nMousePosY;
|
m_nMouseOldPosY = m_nMousePosY;
|
||||||
|
|
||||||
@ -1390,6 +1516,70 @@ void CMenuManager::ProcessButtonPresses()
|
|||||||
else if (GetPadInput())
|
else if (GetPadInput())
|
||||||
m_bShowMouse = false;
|
m_bShowMouse = false;
|
||||||
|
|
||||||
|
if (m_nCurrScreen == MENUPAGE_MULTIPLAYER_FIND_GAME || m_nCurrScreen == MENUPAGE_SKIN_SELECT || m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
|
||||||
|
if (m_nCurrScreen == MENUPAGE_SKIN_SELECT)
|
||||||
|
field_440 = m_nSkinsTotal;
|
||||||
|
|
||||||
|
if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
|
||||||
|
field_440 = m_ControlMethod ? 30 : 25;
|
||||||
|
|
||||||
|
if (field_44C > field_440)
|
||||||
|
field_44C = field_440 - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!GetPadBack() || m_nCurrScreen != MENUPAGE_KEYBOARD_CONTROLS || field_535)
|
||||||
|
field_535 = 0;
|
||||||
|
else if (field_536 == 19) {
|
||||||
|
m_nHoverOption = 42;
|
||||||
|
field_113 = 1;
|
||||||
|
field_456 = 1;
|
||||||
|
m_bKeyChangeNotProcessed = 1;
|
||||||
|
pControlEdit = &m_KeyPressedCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetPadForward()) {
|
||||||
|
switch (field_536) {
|
||||||
|
case 19:
|
||||||
|
if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
|
||||||
|
field_113 = 1;
|
||||||
|
field_456 = 1;
|
||||||
|
pControlEdit = &m_KeyPressedCode;
|
||||||
|
}
|
||||||
|
if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) {
|
||||||
|
strcpy(m_PrefsSkinFile, m_aSkinName);
|
||||||
|
CWorld::Players->SetPlayerSkin(m_PrefsSkinFile);
|
||||||
|
field_536 = 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_nHoverOption = HOVEROPTION_NULL;
|
||||||
|
SaveSettings();
|
||||||
|
break;
|
||||||
|
case 21:
|
||||||
|
strcpy(m_PrefsSkinFile, m_aSkinName);
|
||||||
|
CWorld::Players->SetPlayerSkin(m_PrefsSkinFile);
|
||||||
|
field_536 = 9;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool once = false;
|
||||||
|
if (!once) {
|
||||||
|
once = true;
|
||||||
|
nTimeForSomething = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((CTimer::GetTimeInMillisecondsPauseMode() - nTimeForSomething) > 200) {
|
||||||
|
field_520 = 0;
|
||||||
|
field_521 = 0;
|
||||||
|
field_522 = 0;
|
||||||
|
field_523 = 0;
|
||||||
|
field_524 = 0;
|
||||||
|
nTimeForSomething = CTimer::GetTimeInMillisecondsPauseMode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Get number of menu options.
|
// Get number of menu options.
|
||||||
uint8 NumberOfMenuOptions = GetNumberOfMenuOptions();
|
uint8 NumberOfMenuOptions = GetNumberOfMenuOptions();
|
||||||
|
|
||||||
@ -1436,29 +1626,54 @@ void CMenuManager::ProcessButtonPresses()
|
|||||||
RequestFrontEndShutdown();
|
RequestFrontEndShutdown();
|
||||||
PlayEscSound = true;
|
PlayEscSound = true;
|
||||||
break;
|
break;
|
||||||
|
case MENUPAGE_KEYBOARD_CONTROLS:
|
||||||
|
if (!m_bKeyChangeNotProcessed) {
|
||||||
|
m_bKeyChangeNotProcessed = true;
|
||||||
|
field_534 = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
SwitchToNewScreen(aScreens[m_nCurrScreen].m_PreviousPage[0]);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
SwitchToNewScreen(aScreens[m_nCurrScreen].m_PreviousPage[0]);
|
SwitchToNewScreen(aScreens[m_nCurrScreen].m_PreviousPage[0]);
|
||||||
PlayEscSound = true;
|
PlayEscSound = true;
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
|
|
||||||
if (PlayEscSound)
|
if (PlayEscSound)
|
||||||
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_EXIT, 0);
|
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_EXIT, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: finish hover options.
|
// Set hover options, how it is supposed to be used isn't really clear yet.
|
||||||
// Set mouse buttons.
|
|
||||||
if (GetMouseForward()) {
|
if (GetMouseForward()) {
|
||||||
switch (m_nHoverOption) {
|
switch (m_nHoverOption) {
|
||||||
case ACTIVATE_OPTION:
|
case HOVEROPTION_DEFAULT:
|
||||||
if (m_nCurrOption || m_nCurrScreen != MENUPAGE_PAUSE_MENU)
|
if (m_nCurrOption || m_nCurrScreen != MENUPAGE_PAUSE_MENU)
|
||||||
m_nCurrOption = m_nPrevOption;
|
m_nCurrOption = m_nPrevOption;
|
||||||
|
|
||||||
m_nHoverOption = ACTIVATE_OPTION;
|
m_nHoverOption = HOVEROPTION_DEFAULT;
|
||||||
|
break;
|
||||||
|
case HOVEROPTION_12:
|
||||||
|
m_nHoverOption = HOVEROPTION_14;
|
||||||
|
break;
|
||||||
|
case HOVEROPTION_13:
|
||||||
|
m_nHoverOption = HOVEROPTION_15;
|
||||||
|
break;
|
||||||
|
case HOVEROPTION_19:
|
||||||
|
m_nHoverOption = HOVEROPTION_20;
|
||||||
|
break;
|
||||||
|
case HOVEROPTION_CHANGESKIN:
|
||||||
|
if (m_nSkinsTotal > 0) {
|
||||||
|
m_pSelectedSkin = m_sSkin.field_304;
|
||||||
|
strcpy(m_PrefsSkinFile, m_aSkinName);
|
||||||
|
CWorld::Players->SetPlayerSkin(m_PrefsSkinFile);
|
||||||
|
SaveSettings();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
m_nHoverOption = HOVEROPTION_NULL;
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process all menu options here, but first check if it's an option or a redirect.
|
// Process all menu options here, but first check if it's an option or a redirect.
|
||||||
@ -1494,19 +1709,11 @@ void CMenuManager::ProcessButtonPresses()
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
};
|
|
||||||
|
|
||||||
// Reset pad shaking.
|
|
||||||
if (VibrationTime != 0) {
|
|
||||||
if (CTimer::GetTimeInMillisecondsPauseMode() > VibrationTime) {
|
|
||||||
CPad::GetPad(0)->StopShaking(0);
|
|
||||||
VibrationTime = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::ProcessOnOffMenuOptions() { EAXJMP(0x48AE60); }
|
WRAPPER void CMenuManager::ProcessOnOffMenuOptions() { EAXJMP(0x48AE60); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::ProcessOnOffMenuOptions()
|
void CMenuManager::ProcessOnOffMenuOptions()
|
||||||
@ -1567,7 +1774,7 @@ void CMenuManager::ProcessOnOffMenuOptions()
|
|||||||
case AR_16_9:
|
case AR_16_9:
|
||||||
m_PrefsUseWideScreen = AR_AUTO;
|
m_PrefsUseWideScreen = AR_AUTO;
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
switch (m_PrefsUseWideScreen) {
|
switch (m_PrefsUseWideScreen) {
|
||||||
@ -1580,7 +1787,7 @@ void CMenuManager::ProcessOnOffMenuOptions()
|
|||||||
case AR_16_9:
|
case AR_16_9:
|
||||||
m_PrefsUseWideScreen = AR_4_3;
|
m_PrefsUseWideScreen = AR_4_3;
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
@ -1683,6 +1890,9 @@ void CMenuManager::ProcessOnOffMenuOptions()
|
|||||||
case MENUACTION_UPDATEMEMCARDSAVE:
|
case MENUACTION_UPDATEMEMCARDSAVE:
|
||||||
RequestFrontEndShutdown();
|
RequestFrontEndShutdown();
|
||||||
break;
|
break;
|
||||||
|
case MENUACTION_GETKEY:
|
||||||
|
//*pControlEdit = m_KeyPressedCode;
|
||||||
|
break;
|
||||||
case MENUACTION_INVVERT:
|
case MENUACTION_INVVERT:
|
||||||
MousePointerStateHelper.bInvertVertically = MousePointerStateHelper.bInvertVertically == false;
|
MousePointerStateHelper.bInvertVertically = MousePointerStateHelper.bInvertVertically == false;
|
||||||
return;
|
return;
|
||||||
@ -1823,7 +2033,7 @@ void CMenuManager::ProcessOnOffMenuOptions()
|
|||||||
case 2:
|
case 2:
|
||||||
m_PrefsSpeakers = 0;
|
m_PrefsSpeakers = 0;
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
switch (m_PrefsSpeakers) {
|
switch (m_PrefsSpeakers) {
|
||||||
@ -1836,7 +2046,7 @@ void CMenuManager::ProcessOnOffMenuOptions()
|
|||||||
case 2:
|
case 2:
|
||||||
m_PrefsSpeakers = 1;
|
m_PrefsSpeakers = 1;
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DMAudio.SetSpeakerConfig(m_PrefsSpeakers);
|
DMAudio.SetSpeakerConfig(m_PrefsSpeakers);
|
||||||
@ -1864,11 +2074,11 @@ void CMenuManager::ProcessOnOffMenuOptions()
|
|||||||
case MENUACTION_MOUSESTEER:
|
case MENUACTION_MOUSESTEER:
|
||||||
m_bDisableMouseSteering = m_bDisableMouseSteering == false;
|
m_bDisableMouseSteering = m_bDisableMouseSteering == false;
|
||||||
return;
|
return;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::RequestFrontEndShutdown() { EAXJMP(0x488750); }
|
WRAPPER void CMenuManager::RequestFrontEndShutdown() { EAXJMP(0x488750); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::RequestFrontEndShutdown()
|
void CMenuManager::RequestFrontEndShutdown()
|
||||||
@ -1878,7 +2088,7 @@ void CMenuManager::RequestFrontEndShutdown()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::RequestFrontEndStartUp() { EAXJMP(0x488770); }
|
WRAPPER void CMenuManager::RequestFrontEndStartUp() { EAXJMP(0x488770); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::RequestFrontEndStartUp()
|
void CMenuManager::RequestFrontEndStartUp()
|
||||||
@ -1887,7 +2097,7 @@ void CMenuManager::RequestFrontEndStartUp()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::ResetHelperText() { EAXJMP(0x48B470); }
|
WRAPPER void CMenuManager::ResetHelperText() { EAXJMP(0x48B470); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::ResetHelperText()
|
void CMenuManager::ResetHelperText()
|
||||||
@ -1897,7 +2107,7 @@ void CMenuManager::ResetHelperText()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::SaveLoadFileError_SetUpErrorScreen() { EAXJMP(0x488930); }
|
WRAPPER void CMenuManager::SaveLoadFileError_SetUpErrorScreen() { EAXJMP(0x488930); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::SaveLoadFileError_SetUpErrorScreen()
|
void CMenuManager::SaveLoadFileError_SetUpErrorScreen()
|
||||||
@ -1940,8 +2150,8 @@ void CMenuManager::SaveLoadFileError_SetUpErrorScreen()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::SetHelperText() { EAXJMP(0x48B450); }
|
WRAPPER void CMenuManager::SetHelperText(int text) { EAXJMP(0x48B450); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::SetHelperText(int text)
|
void CMenuManager::SetHelperText(int text)
|
||||||
{
|
{
|
||||||
@ -1950,7 +2160,7 @@ void CMenuManager::SetHelperText(int text)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::SaveSettings() { EAXJMP(0x488CC0); }
|
WRAPPER void CMenuManager::SaveSettings() { EAXJMP(0x488CC0); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::SaveSettings()
|
void CMenuManager::SaveSettings()
|
||||||
@ -1997,7 +2207,7 @@ void CMenuManager::SaveSettings()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::ShutdownJustMenu() { EAXJMP(0x488920); }
|
WRAPPER void CMenuManager::ShutdownJustMenu() { EAXJMP(0x488920); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::ShutdownJustMenu()
|
void CMenuManager::ShutdownJustMenu()
|
||||||
@ -2008,7 +2218,7 @@ void CMenuManager::ShutdownJustMenu()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// We won't ever use this again.
|
// We won't ever use this again.
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER float CMenuManager::StretchX(float) { EAXJMP(0x48ABE0); }
|
WRAPPER float CMenuManager::StretchX(float) { EAXJMP(0x48ABE0); }
|
||||||
#else
|
#else
|
||||||
float CMenuManager::StretchX(float x)
|
float CMenuManager::StretchX(float x)
|
||||||
@ -2020,7 +2230,7 @@ float CMenuManager::StretchX(float x)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER float CMenuManager::StretchY(float) { EAXJMP(0x48AC20); }
|
WRAPPER float CMenuManager::StretchY(float) { EAXJMP(0x48AC20); }
|
||||||
#else
|
#else
|
||||||
float CMenuManager::StretchY(float y)
|
float CMenuManager::StretchY(float y)
|
||||||
@ -2032,7 +2242,7 @@ float CMenuManager::StretchY(float y)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::SwitchMenuOnAndOff() { EAXJMP(0x488790); }
|
WRAPPER void CMenuManager::SwitchMenuOnAndOff() { EAXJMP(0x488790); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::SwitchMenuOnAndOff()
|
void CMenuManager::SwitchMenuOnAndOff()
|
||||||
@ -2054,7 +2264,7 @@ void CMenuManager::SwitchMenuOnAndOff()
|
|||||||
ShutdownJustMenu();
|
ShutdownJustMenu();
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
m_bStartUpFrontEndRequested = false;
|
m_bStartUpFrontEndRequested = false;
|
||||||
pControlEdit = 0;
|
pControlEdit = nil;
|
||||||
m_bShutDownFrontEndRequested = false;
|
m_bShutDownFrontEndRequested = false;
|
||||||
DisplayComboButtonErrMsg = 0;
|
DisplayComboButtonErrMsg = 0;
|
||||||
CPad::GetPad(0)->Clear(0);
|
CPad::GetPad(0)->Clear(0);
|
||||||
@ -2078,7 +2288,7 @@ void CMenuManager::SwitchMenuOnAndOff()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::UnloadTextures() { EAXJMP(0x47A440); }
|
WRAPPER void CMenuManager::UnloadTextures() { EAXJMP(0x47A440); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::UnloadTextures()
|
void CMenuManager::UnloadTextures()
|
||||||
@ -2103,7 +2313,7 @@ void CMenuManager::UnloadTextures()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if ALL_ORIGINAL_FRONTEND
|
||||||
WRAPPER void CMenuManager::WaitForUserCD(void) { EAXJMP(0x48ADD0); }
|
WRAPPER void CMenuManager::WaitForUserCD(void) { EAXJMP(0x48ADD0); }
|
||||||
#else
|
#else
|
||||||
void CMenuManager::WaitForUserCD()
|
void CMenuManager::WaitForUserCD()
|
||||||
@ -2131,7 +2341,7 @@ uint8 CMenuManager::GetNumberOfMenuOptions()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
++Rows;
|
++Rows;
|
||||||
};
|
}
|
||||||
return Rows;
|
return Rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2204,7 +2414,7 @@ void CMenuManager::SetDefaultPreferences(int8 screen)
|
|||||||
m_PrefsVsync = true;
|
m_PrefsVsync = true;
|
||||||
m_PrefsLOD = 1.2f;
|
m_PrefsLOD = 1.2f;
|
||||||
m_PrefsVsyncDisp = true;
|
m_PrefsVsyncDisp = true;
|
||||||
lodMultiplier = 1.2;
|
lodMultiplier = 1.2f;
|
||||||
CMBlur::BlurOn = true;
|
CMBlur::BlurOn = true;
|
||||||
CMBlur::MotionBlurOpen(Scene.camera);
|
CMBlur::MotionBlurOpen(Scene.camera);
|
||||||
m_PrefsUseVibration = false;
|
m_PrefsUseVibration = false;
|
||||||
@ -2230,7 +2440,7 @@ void CMenuManager::SetDefaultPreferences(int8 screen)
|
|||||||
CVehicle::m_bDisableMouseSteering = true;
|
CVehicle::m_bDisableMouseSteering = true;
|
||||||
TheCamera.m_bHeadBob = false;
|
TheCamera.m_bHeadBob = false;
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Frontend inputs.
|
// Frontend inputs.
|
||||||
@ -2261,7 +2471,7 @@ bool GetPadMoveUp()
|
|||||||
return
|
return
|
||||||
(CPad::GetPad(0)->NewState.DPadUp && !CPad::GetPad(0)->OldState.DPadUp) ||
|
(CPad::GetPad(0)->NewState.DPadUp && !CPad::GetPad(0)->OldState.DPadUp) ||
|
||||||
(CPad::GetPad(0)->NewKeyState.UP && !CPad::GetPad(0)->OldKeyState.UP) ||
|
(CPad::GetPad(0)->NewKeyState.UP && !CPad::GetPad(0)->OldKeyState.UP) ||
|
||||||
(CPad::GetPad(0)->NewState.LeftStickY < 0 && !CPad::GetPad(0)->OldState.LeftStickY < 0);
|
(CPad::GetPad(0)->NewState.LeftStickY < 0 && !(CPad::GetPad(0)->OldState.LeftStickY < 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetPadMoveDown()
|
bool GetPadMoveDown()
|
||||||
@ -2269,7 +2479,7 @@ bool GetPadMoveDown()
|
|||||||
return
|
return
|
||||||
(CPad::GetPad(0)->NewState.DPadDown && !CPad::GetPad(0)->OldState.DPadDown) ||
|
(CPad::GetPad(0)->NewState.DPadDown && !CPad::GetPad(0)->OldState.DPadDown) ||
|
||||||
(CPad::GetPad(0)->NewKeyState.DOWN && !CPad::GetPad(0)->OldKeyState.DOWN) ||
|
(CPad::GetPad(0)->NewKeyState.DOWN && !CPad::GetPad(0)->OldKeyState.DOWN) ||
|
||||||
(CPad::GetPad(0)->NewState.LeftStickY > 0 && !CPad::GetPad(0)->OldState.LeftStickY > 0);
|
(CPad::GetPad(0)->NewState.LeftStickY > 0 && !(CPad::GetPad(0)->OldState.LeftStickY > 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetPadMoveLeft()
|
bool GetPadMoveLeft()
|
||||||
@ -2277,7 +2487,7 @@ bool GetPadMoveLeft()
|
|||||||
return
|
return
|
||||||
(CPad::GetPad(0)->NewState.DPadLeft && !CPad::GetPad(0)->OldState.DPadLeft) ||
|
(CPad::GetPad(0)->NewState.DPadLeft && !CPad::GetPad(0)->OldState.DPadLeft) ||
|
||||||
(CPad::GetPad(0)->NewKeyState.LEFT && !CPad::GetPad(0)->OldKeyState.LEFT) ||
|
(CPad::GetPad(0)->NewKeyState.LEFT && !CPad::GetPad(0)->OldKeyState.LEFT) ||
|
||||||
(CPad::GetPad(0)->NewState.LeftStickX < 0 && !CPad::GetPad(0)->OldState.LeftStickX < 0);
|
(CPad::GetPad(0)->NewState.LeftStickX < 0 && !(CPad::GetPad(0)->OldState.LeftStickX < 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetPadMoveRight()
|
bool GetPadMoveRight()
|
||||||
@ -2285,21 +2495,50 @@ bool GetPadMoveRight()
|
|||||||
return
|
return
|
||||||
(CPad::GetPad(0)->NewState.DPadRight && !CPad::GetPad(0)->OldState.DPadRight) ||
|
(CPad::GetPad(0)->NewState.DPadRight && !CPad::GetPad(0)->OldState.DPadRight) ||
|
||||||
(CPad::GetPad(0)->NewKeyState.RIGHT && !CPad::GetPad(0)->OldKeyState.RIGHT) ||
|
(CPad::GetPad(0)->NewKeyState.RIGHT && !CPad::GetPad(0)->OldKeyState.RIGHT) ||
|
||||||
(CPad::GetPad(0)->NewState.LeftStickX > 0 && !CPad::GetPad(0)->OldState.LeftStickX > 0);
|
(CPad::GetPad(0)->NewState.LeftStickX > 0 && !(CPad::GetPad(0)->OldState.LeftStickX > 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetMouseForward()
|
bool GetMouseClickLeft()
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
(CPad::GetPad(0)->NewMouseControllerState.LMB && !CPad::GetPad(0)->OldMouseControllerState.LMB);
|
(CPad::GetPad(0)->NewMouseControllerState.LMB && !CPad::GetPad(0)->OldMouseControllerState.LMB);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetMouseBack()
|
bool GetMouseClickRight()
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
(CPad::GetPad(0)->NewMouseControllerState.RMB && !CPad::GetPad(0)->OldMouseControllerState.RMB);
|
(CPad::GetPad(0)->NewMouseControllerState.RMB && !CPad::GetPad(0)->OldMouseControllerState.RMB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GetMouseClickMiddle()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(CPad::GetPad(0)->NewMouseControllerState.MMB && !CPad::GetPad(0)->OldMouseControllerState.MMB);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GetMouseWheelUp()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(CPad::GetPad(0)->NewMouseControllerState.WHEELUP && !CPad::GetPad(0)->OldMouseControllerState.WHEELUP);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GetMouseWheelDown()
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(CPad::GetPad(0)->NewMouseControllerState.WHEELDN && !CPad::GetPad(0)->OldMouseControllerState.WHEELDN);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool GetMouseForward()
|
||||||
|
{
|
||||||
|
return GetMouseClickLeft();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GetMouseBack()
|
||||||
|
{
|
||||||
|
return GetMouseClickRight;
|
||||||
|
}
|
||||||
|
|
||||||
bool GetMousePos()
|
bool GetMousePos()
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
@ -2308,14 +2547,12 @@ bool GetMousePos()
|
|||||||
|
|
||||||
bool GetMouseMoveLeft()
|
bool GetMouseMoveLeft()
|
||||||
{
|
{
|
||||||
return
|
return GetMouseWheelDown();
|
||||||
(CPad::GetPad(0)->NewMouseControllerState.WHEELDN && !CPad::GetPad(0)->OldMouseControllerState.WHEELDN != 0.0f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetMouseMoveRight()
|
bool GetMouseMoveRight()
|
||||||
{
|
{
|
||||||
return
|
return GetMouseWheelUp();
|
||||||
(CPad::GetPad(0)->NewMouseControllerState.WHEELUP && !CPad::GetPad(0)->OldMouseControllerState.WHEELUP != 0.0f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetPadInput()
|
bool GetPadInput()
|
||||||
@ -2340,6 +2577,7 @@ bool GetMouseInput()
|
|||||||
}
|
}
|
||||||
|
|
||||||
STARTPATCHES
|
STARTPATCHES
|
||||||
|
#ifndef ALL_ORIGINAL_FRONTEND
|
||||||
InjectHook(0x47A230, &CMenuManager::LoadAllTextures, PATCH_JUMP);
|
InjectHook(0x47A230, &CMenuManager::LoadAllTextures, PATCH_JUMP);
|
||||||
InjectHook(0x47A440, &CMenuManager::UnloadTextures, PATCH_JUMP);
|
InjectHook(0x47A440, &CMenuManager::UnloadTextures, PATCH_JUMP);
|
||||||
InjectHook(0x485100, &CMenuManager::Process, PATCH_JUMP);
|
InjectHook(0x485100, &CMenuManager::Process, PATCH_JUMP);
|
||||||
@ -2350,4 +2588,5 @@ STARTPATCHES
|
|||||||
|
|
||||||
for (int i = 1; i < ARRAY_SIZE(aScreens); i++)
|
for (int i = 1; i < ARRAY_SIZE(aScreens); i++)
|
||||||
Patch(0x611930 + sizeof(CMenuScreen) * i, aScreens[i]);
|
Patch(0x611930 + sizeof(CMenuScreen) * i, aScreens[i]);
|
||||||
|
#endif
|
||||||
ENDPATCHES
|
ENDPATCHES
|
@ -306,8 +306,29 @@ enum eMenuAction
|
|||||||
|
|
||||||
enum eCheckHover
|
enum eCheckHover
|
||||||
{
|
{
|
||||||
ACTIVATE_OPTION = 2,
|
HOVEROPTION_0,
|
||||||
IGNORE_OPTION = 42,
|
HOVEROPTION_1,
|
||||||
|
HOVEROPTION_DEFAULT,
|
||||||
|
HOVEROPTION_3,
|
||||||
|
HOVEROPTION_4,
|
||||||
|
HOVEROPTION_5,
|
||||||
|
HOVEROPTION_6,
|
||||||
|
HOVEROPTION_7,
|
||||||
|
HOVEROPTION_8,
|
||||||
|
HOVEROPTION_9,
|
||||||
|
HOVEROPTION_10,
|
||||||
|
HOVEROPTION_11,
|
||||||
|
HOVEROPTION_12,
|
||||||
|
HOVEROPTION_13,
|
||||||
|
HOVEROPTION_14,
|
||||||
|
HOVEROPTION_15,
|
||||||
|
HOVEROPTION_16,
|
||||||
|
HOVEROPTION_17,
|
||||||
|
HOVEROPTION_18,
|
||||||
|
HOVEROPTION_19,
|
||||||
|
HOVEROPTION_20,
|
||||||
|
HOVEROPTION_CHANGESKIN,
|
||||||
|
HOVEROPTION_NULL = 42,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eMenuColumns
|
enum eMenuColumns
|
||||||
@ -348,7 +369,7 @@ struct tSkinInfo
|
|||||||
char skinName[256];
|
char skinName[256];
|
||||||
char currSkinName[256];
|
char currSkinName[256];
|
||||||
char date[256];
|
char date[256];
|
||||||
int field_304;
|
tSkinInfo *field_304;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CMenuScreen
|
struct CMenuScreen
|
||||||
@ -388,7 +409,7 @@ public:
|
|||||||
int32 m_nMouseTempPosX;
|
int32 m_nMouseTempPosX;
|
||||||
int32 m_nMouseTempPosY;
|
int32 m_nMouseTempPosY;
|
||||||
bool m_bShowMouse;
|
bool m_bShowMouse;
|
||||||
tSkinInfo field_12C;
|
tSkinInfo m_sSkin;
|
||||||
tSkinInfo *m_pSelectedSkin;
|
tSkinInfo *m_pSelectedSkin;
|
||||||
tSkinInfo *field_438;
|
tSkinInfo *field_438;
|
||||||
float field_43C;
|
float field_43C;
|
||||||
@ -427,7 +448,7 @@ public:
|
|||||||
int m_nCurrOption;
|
int m_nCurrOption;
|
||||||
int m_nPrevOption;
|
int m_nPrevOption;
|
||||||
int m_nPrevScreen;
|
int m_nPrevScreen;
|
||||||
int field_558;
|
uint32 field_558;
|
||||||
int m_nCurrSaveSlot;
|
int m_nCurrSaveSlot;
|
||||||
int m_nScreenChangeDelayTimer;
|
int m_nScreenChangeDelayTimer;
|
||||||
|
|
||||||
@ -450,16 +471,17 @@ public:
|
|||||||
static int8 &m_bFrontEnd_ReloadObrTxtGxt;
|
static int8 &m_bFrontEnd_ReloadObrTxtGxt;
|
||||||
static int32 &m_PrefsMusicVolume;
|
static int32 &m_PrefsMusicVolume;
|
||||||
static int32 &m_PrefsSfxVolume;
|
static int32 &m_PrefsSfxVolume;
|
||||||
static uint8 *m_PrefsSkinFile;
|
static char *m_PrefsSkinFile;
|
||||||
|
static int32 &m_KeyPressedCode;
|
||||||
|
|
||||||
static bool &m_bStartUpFrontEndRequested;
|
static bool &m_bStartUpFrontEndRequested;
|
||||||
static bool &m_bShutDownFrontEndRequested;
|
static bool &m_bShutDownFrontEndRequested;
|
||||||
static bool &m_PrefsAllowNastyGame;
|
static bool &m_PrefsAllowNastyGame;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void BuildStatLine(char *, void *, uint16, void *);
|
void BuildStatLine(char *text, float *stat, bool aFloat, float* stat2);
|
||||||
static void CentreMousePointer();
|
static void CentreMousePointer();
|
||||||
void CheckCodesForControls(int, int);
|
int CheckCodesForControls(int32);
|
||||||
bool CheckHover(int x1, int x2, int y1, int y2);
|
bool CheckHover(int x1, int x2, int y1, int y2);
|
||||||
void CheckSliderMovement(int);
|
void CheckSliderMovement(int);
|
||||||
int CostructStatLine(int);
|
int CostructStatLine(int);
|
||||||
|
@ -43,7 +43,7 @@ const CMenuScreen aScreens[] = {
|
|||||||
{ "FET_DIS", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUROW_2, MENUROW_2,
|
{ "FET_DIS", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUROW_2, MENUROW_2,
|
||||||
MENUACTION_BRIGHTNESS, "FED_BRI", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
|
MENUACTION_BRIGHTNESS, "FED_BRI", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
|
||||||
MENUACTION_DRAWDIST, "FEM_LOD", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
|
MENUACTION_DRAWDIST, "FEM_LOD", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
|
||||||
//MENUACTION_FRAMESYNC, "FEM_VSC", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
|
MENUACTION_FRAMESYNC, "FEM_VSC", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
|
||||||
MENUACTION_FRAMELIMIT, "FEM_FRM", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
|
MENUACTION_FRAMELIMIT, "FEM_FRM", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
|
||||||
MENUACTION_TRAILS, "FED_TRA", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
|
MENUACTION_TRAILS, "FED_TRA", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
|
||||||
MENUACTION_SUBTITLES, "FED_SUB", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
|
MENUACTION_SUBTITLES, "FED_SUB", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
|
||||||
@ -273,7 +273,7 @@ const CMenuScreen aScreens[] = {
|
|||||||
MENUACTION_CHANGEMENU, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
|
MENUACTION_CHANGEMENU, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
|
||||||
MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
|
MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
|
||||||
MENUACTION_CHANGEMENU, "FET_LAN", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
|
MENUACTION_CHANGEMENU, "FET_LAN", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
|
||||||
//MENUACTION_CHANGEMENU, "FET_PSU", SAVESLOT_NONE, MENUPAGE_SKIN_SELECT,
|
MENUACTION_CHANGEMENU, "FET_PSU", SAVESLOT_NONE, MENUPAGE_SKIN_SELECT,
|
||||||
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
|
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -17,6 +17,11 @@ public:
|
|||||||
CMatrix &GetMatrix(void) { return m_matrix; }
|
CMatrix &GetMatrix(void) { return m_matrix; }
|
||||||
void SetTransform(RwMatrix *m) { m_matrix = CMatrix(m, false); }
|
void SetTransform(RwMatrix *m) { m_matrix = CMatrix(m, false); }
|
||||||
void SetHeading(float angle);
|
void SetHeading(float angle);
|
||||||
|
void SetOrientation(float x, float y, float z){
|
||||||
|
CVector pos = m_matrix.GetPosition();
|
||||||
|
m_matrix.SetRotate(x, y, z);
|
||||||
|
m_matrix.Translate(pos);
|
||||||
|
}
|
||||||
bool IsWithinArea(float x1, float y1, float x2, float y2);
|
bool IsWithinArea(float x1, float y1, float x2, float y2);
|
||||||
bool IsWithinArea(float x1, float y1, float z1, float x2, float y2, float z2);
|
bool IsWithinArea(float x1, float y1, float z1, float x2, float y2, float z2);
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
#include "PlayerInfo.h"
|
#include "PlayerInfo.h"
|
||||||
|
#include "Frontend.h"
|
||||||
|
|
||||||
WRAPPER void CPlayerInfo::MakePlayerSafe(bool) { EAXJMP(0x4A1400); }
|
WRAPPER void CPlayerInfo::MakePlayerSafe(bool) { EAXJMP(0x4A1400); }
|
||||||
|
WRAPPER void CPlayerInfo::LoadPlayerSkin() { EAXJMP(0x4A1700); }
|
||||||
|
WRAPPER void CPlayerInfo::AwardMoneyForExplosion(CVehicle *vehicle) { EAXJMP(0x4A15F0); }
|
||||||
|
|
||||||
|
void CPlayerInfo::SetPlayerSkin(char *skin)
|
||||||
|
{
|
||||||
|
strncpy(m_aSkinName, skin, 32);
|
||||||
|
LoadPlayerSkin();
|
||||||
|
}
|
||||||
|
@ -63,10 +63,13 @@ public:
|
|||||||
bool m_bFastReload;
|
bool m_bFastReload;
|
||||||
bool m_bGetOutOfJailFree;
|
bool m_bGetOutOfJailFree;
|
||||||
bool m_bGetOutOfHospitalFree;
|
bool m_bGetOutOfHospitalFree;
|
||||||
uint8 m_aSkinName[32];
|
char m_aSkinName[32];
|
||||||
RwTexture *m_pSkinTexture;
|
RwTexture *m_pSkinTexture;
|
||||||
|
|
||||||
void MakePlayerSafe(bool);
|
void MakePlayerSafe(bool);
|
||||||
|
void LoadPlayerSkin();
|
||||||
|
void AwardMoneyForExplosion(CVehicle *vehicle);
|
||||||
|
void SetPlayerSkin(char* skin);
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerInfo: error");
|
static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerInfo: error");
|
||||||
|
@ -210,12 +210,56 @@ AsciiToUnicode(const char *src, uint16 *dst)
|
|||||||
while((*dst++ = *src++) != '\0');
|
while((*dst++ = *src++) != '\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char*
|
||||||
|
UnicodeToAscii(wchar *src)
|
||||||
|
{
|
||||||
|
static char aStr[256];
|
||||||
|
int len;
|
||||||
|
for(len = 0; src && *src != 0 && len < 256-1; len++, src++)
|
||||||
|
if(*src < 256)
|
||||||
|
aStr[len] = *src;
|
||||||
|
else
|
||||||
|
aStr[len] = '#';
|
||||||
|
aStr[len] = '\0';
|
||||||
|
return aStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
char*
|
||||||
|
UnicodeToAsciiForSaveLoad(wchar *src)
|
||||||
|
{
|
||||||
|
// exact same code as above
|
||||||
|
static char aStr[256];
|
||||||
|
int len;
|
||||||
|
for(len = 0; src && *src != 0 && len < 256-1; len++, src++)
|
||||||
|
if(*src < 256)
|
||||||
|
aStr[len] = *src;
|
||||||
|
else
|
||||||
|
aStr[len] = '#';
|
||||||
|
aStr[len] = '\0';
|
||||||
|
return aStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
UnicodeStrcpy(wchar *dst, const wchar *src)
|
||||||
|
{
|
||||||
|
while((*dst++ = *src++) != '\0');
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
UnicodeStrlen(const wchar *str)
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
for(len = 0; *str != 0; len++, str++);
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TextCopy(wchar *dst, const wchar *src)
|
TextCopy(wchar *dst, const wchar *src)
|
||||||
{
|
{
|
||||||
while((*dst++ = *src++) != '\0');
|
while((*dst++ = *src++) != '\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
STARTPATCHES
|
STARTPATCHES
|
||||||
InjectHook(0x52C3C0, &CText::Load, PATCH_JUMP);
|
InjectHook(0x52C3C0, &CText::Load, PATCH_JUMP);
|
||||||
InjectHook(0x52C580, &CText::Unload, PATCH_JUMP);
|
InjectHook(0x52C580, &CText::Unload, PATCH_JUMP);
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
void AsciiToUnicode(const char *src, wchar *dst);
|
void AsciiToUnicode(const char *src, wchar *dst);
|
||||||
|
char *UnicodeToAscii(wchar *src);
|
||||||
|
char *UnicodeToAsciiForSaveLoad(wchar *src);
|
||||||
|
void UnicodeStrcpy(wchar *dst, const wchar *src);
|
||||||
|
int UnicodeStrlen(const wchar *str);
|
||||||
void TextCopy(wchar *dst, const wchar *src);
|
void TextCopy(wchar *dst, const wchar *src);
|
||||||
|
|
||||||
struct CKeyEntry
|
struct CKeyEntry
|
||||||
|
@ -34,7 +34,7 @@ int CWanted::NumOfHelisRequired()
|
|||||||
return 2;
|
return 2;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWanted::SetWantedLevel(int32 level)
|
void CWanted::SetWantedLevel(int32 level)
|
||||||
@ -70,11 +70,17 @@ void CWanted::SetWantedLevel(int32 level)
|
|||||||
UpdateWantedLevel();
|
UpdateWantedLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CWanted::SetWantedLevelNoDrop(int32 level)
|
||||||
|
{
|
||||||
|
if (level > m_nWantedLevel)
|
||||||
|
SetWantedLevel(level);
|
||||||
|
}
|
||||||
|
|
||||||
void CWanted::ClearQdCrimes()
|
void CWanted::ClearQdCrimes()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
m_sCrimes[i].m_eCrimeType = CRIME_NONE;
|
m_sCrimes[i].m_eCrimeType = CRIME_NONE;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWanted::UpdateWantedLevel()
|
void CWanted::UpdateWantedLevel()
|
||||||
|
@ -42,6 +42,7 @@ public:
|
|||||||
bool AreArmyRequired();
|
bool AreArmyRequired();
|
||||||
int NumOfHelisRequired();
|
int NumOfHelisRequired();
|
||||||
void SetWantedLevel(int32);
|
void SetWantedLevel(int32);
|
||||||
|
void SetWantedLevelNoDrop(int32 level);
|
||||||
void ClearQdCrimes();
|
void ClearQdCrimes();
|
||||||
void UpdateWantedLevel();
|
void UpdateWantedLevel();
|
||||||
};
|
};
|
||||||
|
@ -30,6 +30,8 @@ enum Config {
|
|||||||
NUMDUMMIES = 2802, // 2368 on PS2
|
NUMDUMMIES = 2802, // 2368 on PS2
|
||||||
NUMAUDIOSCRIPTOBJECTS = 256,
|
NUMAUDIOSCRIPTOBJECTS = 256,
|
||||||
|
|
||||||
|
NUMTEMPOBJECTS = 30,
|
||||||
|
|
||||||
// Link list lengths
|
// Link list lengths
|
||||||
// TODO: alpha list
|
// TODO: alpha list
|
||||||
NUMCOLCACHELINKS = 200,
|
NUMCOLCACHELINKS = 200,
|
||||||
|
@ -54,8 +54,14 @@
|
|||||||
GlobalScene &Scene = *(GlobalScene*)0x726768;
|
GlobalScene &Scene = *(GlobalScene*)0x726768;
|
||||||
|
|
||||||
uint8 work_buff[55000];
|
uint8 work_buff[55000];
|
||||||
char gString[256];
|
//char gString[256];
|
||||||
|
//char gString2[512];
|
||||||
|
//wchar gUString[256];
|
||||||
|
//wchar gUString2[256];
|
||||||
|
char *gString = (char*)0x711B40;
|
||||||
|
char *gString2 = (char*)0x878A40;
|
||||||
wchar *gUString = (wchar*)0x74B018;
|
wchar *gUString = (wchar*)0x74B018;
|
||||||
|
wchar *gUString2 = (wchar*)0x6EDD70;
|
||||||
|
|
||||||
bool &b_FoundRecentSavedGameWantToLoad = *(bool*)0x95CDA8;
|
bool &b_FoundRecentSavedGameWantToLoad = *(bool*)0x95CDA8;
|
||||||
|
|
||||||
|
@ -8,8 +8,14 @@ struct GlobalScene
|
|||||||
extern GlobalScene &Scene;
|
extern GlobalScene &Scene;
|
||||||
|
|
||||||
extern uint8 work_buff[55000];
|
extern uint8 work_buff[55000];
|
||||||
extern char gString[256];
|
//extern char gString[256];
|
||||||
|
//extern char gString2[512];
|
||||||
|
//extern wchar gUString[256];
|
||||||
|
//extern wchar gUString2[256];
|
||||||
|
extern char *gString;
|
||||||
|
extern char *gString2;
|
||||||
extern wchar *gUString;
|
extern wchar *gUString;
|
||||||
|
extern wchar *gUString2;
|
||||||
extern bool &b_FoundRecentSavedGameWantToLoad;
|
extern bool &b_FoundRecentSavedGameWantToLoad;
|
||||||
|
|
||||||
class CSprite2d;
|
class CSprite2d;
|
||||||
|
@ -154,6 +154,19 @@ spawnCar(int id)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void
|
||||||
|
FixCar(void)
|
||||||
|
{
|
||||||
|
CVehicle *veh = FindPlayerVehicle();
|
||||||
|
if(veh == nil)
|
||||||
|
return;
|
||||||
|
veh->m_fHealth = 1000.0f;
|
||||||
|
if(!veh->IsCar())
|
||||||
|
return;
|
||||||
|
((CAutomobile*)veh)->Damage.SetEngineStatus(0);
|
||||||
|
((CAutomobile*)veh)->Fix();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DebugMenuPopulate(void)
|
DebugMenuPopulate(void)
|
||||||
{
|
{
|
||||||
@ -198,6 +211,7 @@ DebugMenuPopulate(void)
|
|||||||
DebugMenuAddCmd("Cheats", "Strong grip", StrongGripCheat);
|
DebugMenuAddCmd("Cheats", "Strong grip", StrongGripCheat);
|
||||||
DebugMenuAddCmd("Cheats", "Nasty limbs", NastyLimbsCheat);
|
DebugMenuAddCmd("Cheats", "Nasty limbs", NastyLimbsCheat);
|
||||||
|
|
||||||
|
DebugMenuAddCmd("Debug", "Fix Car", FixCar);
|
||||||
DebugMenuAddVarBool8("Debug", "Show Ped Road Groups", (int8*)&gbShowPedRoadGroups, nil);
|
DebugMenuAddVarBool8("Debug", "Show Ped Road Groups", (int8*)&gbShowPedRoadGroups, nil);
|
||||||
DebugMenuAddVarBool8("Debug", "Show Car Road Groups", (int8*)&gbShowCarRoadGroups, nil);
|
DebugMenuAddVarBool8("Debug", "Show Car Road Groups", (int8*)&gbShowCarRoadGroups, nil);
|
||||||
DebugMenuAddVarBool8("Debug", "Show Collision Polys", (int8*)&gbShowCollisionPolys, nil);
|
DebugMenuAddVarBool8("Debug", "Show Collision Polys", (int8*)&gbShowCollisionPolys, nil);
|
||||||
|
@ -94,6 +94,8 @@ public:
|
|||||||
uint16 m_level; // int16
|
uint16 m_level; // int16
|
||||||
CReference *m_pFirstReference;
|
CReference *m_pFirstReference;
|
||||||
|
|
||||||
|
CColModel *GetColModel(void) { return CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(); }
|
||||||
|
|
||||||
CEntity(void);
|
CEntity(void);
|
||||||
~CEntity(void);
|
~CEntity(void);
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ CPhysical::CPhysical(void)
|
|||||||
m_phy_flagA10 = false;
|
m_phy_flagA10 = false;
|
||||||
m_phy_flagA20 = false;
|
m_phy_flagA20 = false;
|
||||||
|
|
||||||
m_nLastCollType = 0;
|
m_nSurfaceTouched = SURFACE_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
CPhysical::~CPhysical(void)
|
CPhysical::~CPhysical(void)
|
||||||
@ -457,7 +457,7 @@ CPhysical::ApplySpringCollision(float springConst, CVector &springDir, CVector &
|
|||||||
float compression = 1.0f - springRatio;
|
float compression = 1.0f - springRatio;
|
||||||
if(compression > 0.0f){
|
if(compression > 0.0f){
|
||||||
float step = min(CTimer::GetTimeStep(), 3.0f);
|
float step = min(CTimer::GetTimeStep(), 3.0f);
|
||||||
float impulse = -0.008f*m_fMass*step * springConst * compression * bias*2.0f;
|
float impulse = -GRAVITY*m_fMass*step * springConst * compression * bias*2.0f;
|
||||||
ApplyMoveForce(springDir*impulse);
|
ApplyMoveForce(springDir*impulse);
|
||||||
ApplyTurnForce(springDir*impulse, point);
|
ApplyTurnForce(springDir*impulse, point);
|
||||||
}
|
}
|
||||||
@ -489,7 +489,7 @@ void
|
|||||||
CPhysical::ApplyGravity(void)
|
CPhysical::ApplyGravity(void)
|
||||||
{
|
{
|
||||||
if(bAffectedByGravity)
|
if(bAffectedByGravity)
|
||||||
m_vecMoveSpeed.z -= 0.008f * CTimer::GetTimeStep();
|
m_vecMoveSpeed.z -= GRAVITY * CTimer::GetTimeStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1783,7 +1783,7 @@ CPhysical::ProcessShift(void)
|
|||||||
}
|
}
|
||||||
bIsStuck = false;
|
bIsStuck = false;
|
||||||
bIsInSafePosition = true;
|
bIsInSafePosition = true;
|
||||||
m_fDistanceTravelled = (GetPosition() - *matrix.GetPosition()).Magnitude();
|
m_fDistanceTravelled = (GetPosition() - matrix.GetPosition()).Magnitude();
|
||||||
RemoveAndAdd();
|
RemoveAndAdd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1918,14 +1918,14 @@ CPhysical::ProcessCollision(void)
|
|||||||
bHitByTrain ||
|
bHitByTrain ||
|
||||||
m_status == STATUS_PLAYER || IsPed() && ped->IsPlayer()){
|
m_status == STATUS_PLAYER || IsPed() && ped->IsPlayer()){
|
||||||
if(IsVehicle())
|
if(IsVehicle())
|
||||||
((CVehicle*)this)->m_veh_flagD4 = true;
|
((CVehicle*)this)->bVehicleColProcessed = true;
|
||||||
if(CheckCollision()){
|
if(CheckCollision()){
|
||||||
GetMatrix() = savedMatrix;
|
GetMatrix() = savedMatrix;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bHitByTrain = false;
|
bHitByTrain = false;
|
||||||
m_fDistanceTravelled = (GetPosition() - *savedMatrix.GetPosition()).Magnitude();
|
m_fDistanceTravelled = (GetPosition() - savedMatrix.GetPosition()).Magnitude();
|
||||||
m_phy_flagA80 = false;
|
m_phy_flagA80 = false;
|
||||||
|
|
||||||
bIsStuck = false;
|
bIsStuck = false;
|
||||||
|
@ -8,6 +8,8 @@ enum {
|
|||||||
PHYSICAL_MAX_COLLISIONRECORDS = 6
|
PHYSICAL_MAX_COLLISIONRECORDS = 6
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define GRAVITY (0.008f)
|
||||||
|
|
||||||
class CTreadable;
|
class CTreadable;
|
||||||
|
|
||||||
class CPhysical : public CEntity
|
class CPhysical : public CEntity
|
||||||
@ -59,7 +61,7 @@ public:
|
|||||||
uint8 bHitByTrain : 1; // from nick
|
uint8 bHitByTrain : 1; // from nick
|
||||||
uint8 m_phy_flagA80 : 1;
|
uint8 m_phy_flagA80 : 1;
|
||||||
|
|
||||||
uint8 m_nLastCollType;
|
uint8 m_nSurfaceTouched;
|
||||||
uint8 m_nZoneLevel;
|
uint8 m_nZoneLevel;
|
||||||
|
|
||||||
CPhysical(void);
|
CPhysical(void);
|
||||||
@ -73,7 +75,7 @@ public:
|
|||||||
void ProcessShift(void);
|
void ProcessShift(void);
|
||||||
void ProcessCollision(void);
|
void ProcessCollision(void);
|
||||||
|
|
||||||
virtual int32 ProcessEntityCollision(CEntity *ent, CColPoint *point);
|
virtual int32 ProcessEntityCollision(CEntity *ent, CColPoint *colpoints);
|
||||||
|
|
||||||
void RemoveAndAdd(void);
|
void RemoveAndAdd(void);
|
||||||
void AddToMovingList(void);
|
void AddToMovingList(void);
|
||||||
@ -108,7 +110,23 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
const CVector &GetMoveSpeed() { return m_vecMoveSpeed; }
|
const CVector &GetMoveSpeed() { return m_vecMoveSpeed; }
|
||||||
|
void SetMoveSpeed(float x, float y, float z) {
|
||||||
|
m_vecMoveSpeed.x = x;
|
||||||
|
m_vecMoveSpeed.y = y;
|
||||||
|
m_vecMoveSpeed.z = z;
|
||||||
|
}
|
||||||
const CVector &GetTurnSpeed() { return m_vecTurnSpeed; }
|
const CVector &GetTurnSpeed() { return m_vecTurnSpeed; }
|
||||||
|
void SetTurnSpeed(float x, float y, float z) {
|
||||||
|
m_vecTurnSpeed.x = x;
|
||||||
|
m_vecTurnSpeed.y = y;
|
||||||
|
m_vecTurnSpeed.z = z;
|
||||||
|
}
|
||||||
|
const CVector &GetCenterOfMass() { return m_vecCentreOfMass; }
|
||||||
|
void SetCenterOfMass(float x, float y, float z) {
|
||||||
|
m_vecCentreOfMass.x = x;
|
||||||
|
m_vecCentreOfMass.y = y;
|
||||||
|
m_vecCentreOfMass.z = z;
|
||||||
|
}
|
||||||
|
|
||||||
void ApplyMoveSpeed(void);
|
void ApplyMoveSpeed(void);
|
||||||
void ApplyTurnSpeed(void);
|
void ApplyTurnSpeed(void);
|
||||||
|
@ -82,6 +82,32 @@ public:
|
|||||||
CVector &GetRight(void) { return *(CVector*)&m_matrix.right; }
|
CVector &GetRight(void) { return *(CVector*)&m_matrix.right; }
|
||||||
CVector &GetForward(void) { return *(CVector*)&m_matrix.up; }
|
CVector &GetForward(void) { return *(CVector*)&m_matrix.up; }
|
||||||
CVector &GetUp(void) { return *(CVector*)&m_matrix.at; }
|
CVector &GetUp(void) { return *(CVector*)&m_matrix.at; }
|
||||||
|
|
||||||
|
void SetTranslate(float x, float y, float z){
|
||||||
|
m_matrix.right.x = 1.0f;
|
||||||
|
m_matrix.right.y = 0.0f;
|
||||||
|
m_matrix.right.z = 0.0f;
|
||||||
|
|
||||||
|
m_matrix.up.x = 0.0f;
|
||||||
|
m_matrix.up.y = 1.0f;
|
||||||
|
m_matrix.up.z = 0.0f;
|
||||||
|
|
||||||
|
m_matrix.at.x = 0.0f;
|
||||||
|
m_matrix.at.y = 0.0f;
|
||||||
|
m_matrix.at.z = 1.0f;
|
||||||
|
|
||||||
|
m_matrix.pos.x = x;
|
||||||
|
m_matrix.pos.y = y;
|
||||||
|
m_matrix.pos.z = z;
|
||||||
|
}
|
||||||
|
void SetTranslate(const CVector &trans){ SetTranslate(trans.x, trans.y, trans.z); }
|
||||||
|
void Translate(float x, float y, float z){
|
||||||
|
m_matrix.pos.x += x;
|
||||||
|
m_matrix.pos.y += y;
|
||||||
|
m_matrix.pos.z += z;
|
||||||
|
}
|
||||||
|
void Translate(const CVector &trans){ Translate(trans.x, trans.y, trans.z); }
|
||||||
|
|
||||||
void SetScale(float s){
|
void SetScale(float s){
|
||||||
m_matrix.right.x = s;
|
m_matrix.right.x = s;
|
||||||
m_matrix.right.y = 0.0f;
|
m_matrix.right.y = 0.0f;
|
||||||
@ -99,6 +125,7 @@ public:
|
|||||||
m_matrix.pos.y = 0.0f;
|
m_matrix.pos.y = 0.0f;
|
||||||
m_matrix.pos.z = 0.0f;
|
m_matrix.pos.z = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetRotateXOnly(float angle){
|
void SetRotateXOnly(float angle){
|
||||||
float c = cos(angle);
|
float c = cos(angle);
|
||||||
float s = sin(angle);
|
float s = sin(angle);
|
||||||
|
@ -164,7 +164,8 @@
|
|||||||
// expand as needed
|
// expand as needed
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MI_COP = 1,
|
MI_PLAYER = 0,
|
||||||
|
MI_COP,
|
||||||
MI_SWAT,
|
MI_SWAT,
|
||||||
MI_FBI,
|
MI_FBI,
|
||||||
MI_ARMY,
|
MI_ARMY,
|
||||||
|
@ -414,11 +414,13 @@ CVehicleModelInfo::SetAtomicFlagCB(RwObject *object, void *data)
|
|||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
RpAtomic*
|
RwObject*
|
||||||
CVehicleModelInfo::ClearAtomicFlagCB(RpAtomic *atomic, void *data)
|
CVehicleModelInfo::ClearAtomicFlagCB(RwObject *object, void *data)
|
||||||
{
|
{
|
||||||
|
RpAtomic *atomic = (RpAtomic*)object;
|
||||||
|
assert(RwObjectGetType(object) == rpATOMIC);
|
||||||
CVisibilityPlugins::ClearAtomicFlag(atomic, (int)data);
|
CVisibilityPlugins::ClearAtomicFlag(atomic, (int)data);
|
||||||
return atomic;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
RwObject*
|
RwObject*
|
||||||
|
@ -107,7 +107,7 @@ public:
|
|||||||
void SetAtomicRenderCallbacks(void);
|
void SetAtomicRenderCallbacks(void);
|
||||||
|
|
||||||
static RwObject *SetAtomicFlagCB(RwObject *object, void *data);
|
static RwObject *SetAtomicFlagCB(RwObject *object, void *data);
|
||||||
static RpAtomic *ClearAtomicFlagCB(RpAtomic *atomic, void *data);
|
static RwObject *ClearAtomicFlagCB(RwObject *atomic, void *data);
|
||||||
void SetVehicleComponentFlags(RwFrame *frame, uint32 flags);
|
void SetVehicleComponentFlags(RwFrame *frame, uint32 flags);
|
||||||
void PreprocessHierarchy(void);
|
void PreprocessHierarchy(void);
|
||||||
void GetWheelPosn(int32 n, CVector &pos);
|
void GetWheelPosn(int32 n, CVector &pos);
|
||||||
|
@ -7,8 +7,10 @@
|
|||||||
#include "Object.h"
|
#include "Object.h"
|
||||||
|
|
||||||
WRAPPER void CObject::ObjectDamage(float amount) { EAXJMP(0x4BB240); }
|
WRAPPER void CObject::ObjectDamage(float amount) { EAXJMP(0x4BB240); }
|
||||||
|
WRAPPER void CObject::DeleteAllTempObjectInArea(CVector, float) { EAXJMP(0x4BBED0); }
|
||||||
|
|
||||||
int16 &CObject::nNoTempObjects = *(int16*)0x95CCA2;
|
int16 &CObject::nNoTempObjects = *(int16*)0x95CCA2;
|
||||||
|
int16 &CObject::nBodyCastHealth = *(int16*)0x5F7D4C; // 1000
|
||||||
|
|
||||||
void *CObject::operator new(size_t sz) { return CPools::GetObjectPool()->New(); }
|
void *CObject::operator new(size_t sz) { return CPools::GetObjectPool()->New(); }
|
||||||
void CObject::operator delete(void *p, size_t sz) { CPools::GetObjectPool()->Delete((CObject*)p); }
|
void CObject::operator delete(void *p, size_t sz) { CPools::GetObjectPool()->Delete((CObject*)p); }
|
||||||
@ -85,7 +87,13 @@ CObject::RemoveLighting(bool reset)
|
|||||||
WorldReplaceScorchedLightsWithNormal(Scene.world);
|
WorldReplaceScorchedLightsWithNormal(Scene.world);
|
||||||
}
|
}
|
||||||
|
|
||||||
WRAPPER void CObject::DeleteAllTempObjectInArea(CVector, float) { EAXJMP(0x4BBED0); }
|
|
||||||
|
void
|
||||||
|
CObject::RefModelInfo(int32 modelId)
|
||||||
|
{
|
||||||
|
m_nRefModelIndex = modelId;
|
||||||
|
CModelInfo::GetModelInfo(modelId)->AddRef();
|
||||||
|
}
|
||||||
|
|
||||||
class CObject_ : public CObject
|
class CObject_ : public CObject
|
||||||
{
|
{
|
||||||
|
@ -60,6 +60,7 @@ public:
|
|||||||
int8 m_colour1, m_colour2;
|
int8 m_colour1, m_colour2;
|
||||||
|
|
||||||
static int16 &nNoTempObjects;
|
static int16 &nNoTempObjects;
|
||||||
|
static int16 &nBodyCastHealth;
|
||||||
|
|
||||||
static void *operator new(size_t);
|
static void *operator new(size_t);
|
||||||
static void operator delete(void*, size_t);
|
static void operator delete(void*, size_t);
|
||||||
@ -72,6 +73,7 @@ public:
|
|||||||
void RemoveLighting(bool reset);
|
void RemoveLighting(bool reset);
|
||||||
|
|
||||||
void ObjectDamage(float amount);
|
void ObjectDamage(float amount);
|
||||||
|
void RefModelInfo(int32 modelId);
|
||||||
|
|
||||||
static void DeleteAllTempObjectInArea(CVector, float);
|
static void DeleteAllTempObjectInArea(CVector, float);
|
||||||
};
|
};
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "Ped.h"
|
#include "Ped.h"
|
||||||
#include "PlayerPed.h"
|
#include "PlayerPed.h"
|
||||||
#include "General.h"
|
#include "General.h"
|
||||||
|
#include "SurfaceTable.h"
|
||||||
#include "VisibilityPlugins.h"
|
#include "VisibilityPlugins.h"
|
||||||
#include "AudioManager.h"
|
#include "AudioManager.h"
|
||||||
#include "HandlingMgr.h"
|
#include "HandlingMgr.h"
|
||||||
@ -28,6 +29,7 @@
|
|||||||
WRAPPER void CPed::KillPedWithCar(CVehicle *veh, float impulse) { EAXJMP(0x4EC430); }
|
WRAPPER void CPed::KillPedWithCar(CVehicle *veh, float impulse) { EAXJMP(0x4EC430); }
|
||||||
WRAPPER void CPed::Say(uint16 audio) { EAXJMP(0x4E5A10); }
|
WRAPPER void CPed::Say(uint16 audio) { EAXJMP(0x4E5A10); }
|
||||||
WRAPPER void CPed::SetDie(AnimationId anim, float arg1, float arg2) { EAXJMP(0x4D37D0); }
|
WRAPPER void CPed::SetDie(AnimationId anim, float arg1, float arg2) { EAXJMP(0x4D37D0); }
|
||||||
|
WRAPPER void CPed::SetDead(void) { EAXJMP(0x4D3970); }
|
||||||
WRAPPER void CPed::SpawnFlyingComponent(int, int8) { EAXJMP(0x4EB060); }
|
WRAPPER void CPed::SpawnFlyingComponent(int, int8) { EAXJMP(0x4EB060); }
|
||||||
WRAPPER void CPed::RestorePreviousState(void) { EAXJMP(0x4C5E30); }
|
WRAPPER void CPed::RestorePreviousState(void) { EAXJMP(0x4C5E30); }
|
||||||
WRAPPER void CPed::ClearAttack(void) { EAXJMP(0x4E6790); }
|
WRAPPER void CPed::ClearAttack(void) { EAXJMP(0x4E6790); }
|
||||||
@ -432,7 +434,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
|
|||||||
m_ped_flagI1 = false;
|
m_ped_flagI1 = false;
|
||||||
m_ped_flagI2 = false;
|
m_ped_flagI2 = false;
|
||||||
m_ped_flagI4 = false;
|
m_ped_flagI4 = false;
|
||||||
bRecordedForReplay = false;
|
bHasAlreadyBeenRecorded = false;
|
||||||
m_ped_flagI10 = false;
|
m_ped_flagI10 = false;
|
||||||
#ifdef KANGAROO_CHEAT
|
#ifdef KANGAROO_CHEAT
|
||||||
m_ped_flagI80 = false;
|
m_ped_flagI80 = false;
|
||||||
@ -671,7 +673,7 @@ CPed::AimGun(void)
|
|||||||
vector.y = pos.y;
|
vector.y = pos.y;
|
||||||
vector.z = pos.z;
|
vector.z = pos.z;
|
||||||
} else {
|
} else {
|
||||||
vector = *(m_pSeekTarget->GetPosition());
|
vector = m_pSeekTarget->GetPosition();
|
||||||
}
|
}
|
||||||
Say(SOUND_PED_ATTACK);
|
Say(SOUND_PED_ATTACK);
|
||||||
|
|
||||||
@ -1542,7 +1544,7 @@ CPed::GetPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType,
|
|||||||
GetLocalPositionToOpenCarDoor(output, veh, enterType, offset);
|
GetLocalPositionToOpenCarDoor(output, veh, enterType, offset);
|
||||||
doorPos = Multiply3x3(vehMat, *output);
|
doorPos = Multiply3x3(vehMat, *output);
|
||||||
|
|
||||||
*output = *veh->GetPosition() + doorPos;
|
*output = veh->GetPosition() + doorPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1661,7 +1663,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
|
|||||||
CVector neededPos;
|
CVector neededPos;
|
||||||
|
|
||||||
if (phase == LINE_UP_TO_CAR_2) {
|
if (phase == LINE_UP_TO_CAR_2) {
|
||||||
neededPos = *GetPosition();
|
neededPos = GetPosition();
|
||||||
} else {
|
} else {
|
||||||
GetPositionToOpenCarDoor(&neededPos, veh, m_vehEnterType, seatPosMult);
|
GetPositionToOpenCarDoor(&neededPos, veh, m_vehEnterType, seatPosMult);
|
||||||
}
|
}
|
||||||
@ -1774,12 +1776,12 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
|
|||||||
static void
|
static void
|
||||||
particleProduceFootDust(CPed *ped, CVector *pos, float size, int times)
|
particleProduceFootDust(CPed *ped, CVector *pos, float size, int times)
|
||||||
{
|
{
|
||||||
switch (ped->m_nLastCollType)
|
switch (ped->m_nSurfaceTouched)
|
||||||
{
|
{
|
||||||
case 1: // somewhere hard
|
case SURFACE_TARMAC:
|
||||||
case 3: // soft dirt
|
case SURFACE_DIRT:
|
||||||
case 5: // pavement
|
case SURFACE_PAVEMENT:
|
||||||
case 18:// sand
|
case SURFACE_SAND:
|
||||||
for (int i = 0; i < times; ++i) {
|
for (int i = 0; i < times; ++i) {
|
||||||
CVector adjustedPos = *pos;
|
CVector adjustedPos = *pos;
|
||||||
adjustedPos.x += CGeneral::GetRandomNumberInRange(-0.1f, 0.1f);
|
adjustedPos.x += CGeneral::GetRandomNumberInRange(-0.1f, 0.1f);
|
||||||
@ -1881,7 +1883,7 @@ CPed::PlayFootSteps(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_nLastCollType == 19) { // Water
|
if (m_nSurfaceTouched == SURFACE_PUDDLE) {
|
||||||
float pedSpeed = CVector2D(m_vecMoveSpeed).Magnitude();
|
float pedSpeed = CVector2D(m_vecMoveSpeed).Magnitude();
|
||||||
if (pedSpeed > 0.03f && CTimer::GetFrameCounter() % 2 == 0 && pedSpeed > 0.13f) {
|
if (pedSpeed > 0.03f && CTimer::GetFrameCounter() % 2 == 0 && pedSpeed > 0.13f) {
|
||||||
float particleSize = pedSpeed * 2.0f;
|
float particleSize = pedSpeed * 2.0f;
|
||||||
@ -2090,7 +2092,7 @@ CPed::CalculateNewOrientation(void)
|
|||||||
if (CReplay::IsPlayingBack() || !IsPedInControl())
|
if (CReplay::IsPlayingBack() || !IsPedInControl())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CVector pos = *GetPosition();
|
CVector pos = GetPosition();
|
||||||
|
|
||||||
GetMatrix().SetRotate(0.0f, 0.0f, m_fRotationCur);
|
GetMatrix().SetRotate(0.0f, 0.0f, m_fRotationCur);
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ public:
|
|||||||
uint8 m_ped_flagI1 : 1;
|
uint8 m_ped_flagI1 : 1;
|
||||||
uint8 m_ped_flagI2 : 1;
|
uint8 m_ped_flagI2 : 1;
|
||||||
uint8 m_ped_flagI4 : 1;
|
uint8 m_ped_flagI4 : 1;
|
||||||
uint8 bRecordedForReplay : 1;
|
uint8 bHasAlreadyBeenRecorded : 1;
|
||||||
uint8 m_ped_flagI10 : 1;
|
uint8 m_ped_flagI10 : 1;
|
||||||
uint8 m_ped_flagI20 : 1;
|
uint8 m_ped_flagI20 : 1;
|
||||||
uint8 m_ped_flagI40 : 1;
|
uint8 m_ped_flagI40 : 1;
|
||||||
@ -414,6 +414,7 @@ public:
|
|||||||
void SetLookFlag(float direction, bool unknown);
|
void SetLookFlag(float direction, bool unknown);
|
||||||
void SetLookTimer(int time);
|
void SetLookTimer(int time);
|
||||||
void SetDie(AnimationId anim, float arg1, float arg2);
|
void SetDie(AnimationId anim, float arg1, float arg2);
|
||||||
|
void SetDead(void);
|
||||||
void ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer);
|
void ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer);
|
||||||
void RemoveBodyPart(PedNode nodeId, int8 unknown);
|
void RemoveBodyPart(PedNode nodeId, int8 unknown);
|
||||||
void SpawnFlyingComponent(int, int8 unknown);
|
void SpawnFlyingComponent(int, int8 unknown);
|
||||||
|
@ -10,6 +10,9 @@ CPlayerPed::~CPlayerPed()
|
|||||||
}
|
}
|
||||||
|
|
||||||
WRAPPER void CPlayerPed::ReApplyMoveAnims(void) { EAXJMP(0x4F07C0); }
|
WRAPPER void CPlayerPed::ReApplyMoveAnims(void) { EAXJMP(0x4F07C0); }
|
||||||
|
WRAPPER void CPlayerPed::SetupPlayerPed(int32) { EAXJMP(0x4EFB60); }
|
||||||
|
WRAPPER void CPlayerPed::DeactivatePlayerPed(int32) { EAXJMP(0x4EFC00); }
|
||||||
|
WRAPPER void CPlayerPed::ReactivatePlayerPed(int32) { EAXJMP(0x4EFC20); }
|
||||||
|
|
||||||
void CPlayerPed::ClearWeaponTarget()
|
void CPlayerPed::ClearWeaponTarget()
|
||||||
{
|
{
|
||||||
@ -21,6 +24,19 @@ void CPlayerPed::ClearWeaponTarget()
|
|||||||
ClearPointGunAt();
|
ClearPointGunAt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlayerPed::SetWantedLevel(int32 level)
|
||||||
|
{
|
||||||
|
m_pWanted->SetWantedLevel(level);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlayerPed::SetWantedLevelNoDrop(int32 level)
|
||||||
|
{
|
||||||
|
m_pWanted->SetWantedLevelNoDrop(level);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class CPlayerPed_ : public CPlayerPed
|
class CPlayerPed_ : public CPlayerPed
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -43,6 +43,12 @@ public:
|
|||||||
|
|
||||||
void ReApplyMoveAnims(void);
|
void ReApplyMoveAnims(void);
|
||||||
void ClearWeaponTarget();
|
void ClearWeaponTarget();
|
||||||
|
void SetWantedLevel(int32 level);
|
||||||
|
void SetWantedLevelNoDrop(int32 level);
|
||||||
|
|
||||||
|
static void SetupPlayerPed(int32);
|
||||||
|
static void DeactivatePlayerPed(int32);
|
||||||
|
static void ReactivatePlayerPed(int32);
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(CPlayerPed) == 0x5F0, "CPlayerPed: error");
|
static_assert(sizeof(CPlayerPed) == 0x5F0, "CPlayerPed: error");
|
||||||
|
@ -862,7 +862,7 @@ void CHud::Draw()
|
|||||||
CScriptRectangle* IntroRect = CTheScripts::IntroRectangles;
|
CScriptRectangle* 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_bIsAntialiased) {
|
if (CTheScripts::IntroRectangles[i].m_bIsUsed && CTheScripts::IntroRectangles[i].m_bBeforeFade) {
|
||||||
if (CTheScripts::IntroRectangles[i].m_nTextureId >= 0) {
|
if (CTheScripts::IntroRectangles[i].m_nTextureId >= 0) {
|
||||||
CRect rect = {
|
CRect rect = {
|
||||||
CTheScripts::IntroRectangles[i].m_sRect.left,
|
CTheScripts::IntroRectangles[i].m_sRect.left,
|
||||||
|
@ -1160,7 +1160,7 @@ CRenderer::IsVehicleCullZoneVisible(CEntity *ent)
|
|||||||
case STATUS_PHYSICS:
|
case STATUS_PHYSICS:
|
||||||
case STATUS_ABANDONED:
|
case STATUS_ABANDONED:
|
||||||
case STATUS_WRECKED:
|
case STATUS_WRECKED:
|
||||||
return !(v->m_pCurSurface && v->m_pCurSurface->bZoneCulled2);
|
return !(v->m_pCurGroundEntity && v->m_pCurGroundEntity->bZoneCulled2);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,17 +1,32 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
|
#include "General.h"
|
||||||
|
#include "ModelIndices.h"
|
||||||
#include "VisibilityPlugins.h"
|
#include "VisibilityPlugins.h"
|
||||||
|
#include "DMAudio.h"
|
||||||
|
#include "Camera.h"
|
||||||
|
#include "Darkel.h"
|
||||||
|
#include "Fire.h"
|
||||||
|
#include "Explosion.h"
|
||||||
|
#include "World.h"
|
||||||
#include "SurfaceTable.h"
|
#include "SurfaceTable.h"
|
||||||
#include "HandlingMgr.h"
|
#include "HandlingMgr.h"
|
||||||
|
#include "CarCtrl.h"
|
||||||
|
#include "PathFind.h"
|
||||||
|
#include "Ped.h"
|
||||||
|
#include "PlayerPed.h"
|
||||||
|
#include "Object.h"
|
||||||
#include "Automobile.h"
|
#include "Automobile.h"
|
||||||
|
|
||||||
|
RwObject *GetCurrentAtomicObjectCB(RwObject *object, void *data);
|
||||||
|
|
||||||
bool &CAutomobile::m_sAllTaxiLights = *(bool*)0x95CD21;
|
bool &CAutomobile::m_sAllTaxiLights = *(bool*)0x95CD21;
|
||||||
|
|
||||||
WRAPPER CAutomobile* CAutomobile::ctor(int, uint8) { EAXJMP(0x52C6B0); }
|
WRAPPER CAutomobile* CAutomobile::ctor(int, uint8) { EAXJMP(0x52C6B0); }
|
||||||
|
|
||||||
CAutomobile::CAutomobile(int mi, uint8 owner)
|
CAutomobile::CAutomobile(int mi, uint8 CreatedBy)
|
||||||
{
|
{
|
||||||
ctor(mi, owner);
|
ctor(mi, CreatedBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -23,11 +38,110 @@ CAutomobile::SetModelIndex(uint32 id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
WRAPPER void CAutomobile::ProcessControl(void) { EAXJMP(0x531470); }
|
WRAPPER void CAutomobile::ProcessControl(void) { EAXJMP(0x531470); }
|
||||||
WRAPPER void CAutomobile::Teleport(CVector v) { EAXJMP(0x535180); }
|
|
||||||
|
void
|
||||||
|
CAutomobile::Teleport(CVector pos)
|
||||||
|
{
|
||||||
|
CWorld::Remove(this);
|
||||||
|
|
||||||
|
GetPosition() = pos;
|
||||||
|
SetOrientation(0.0f, 0.0f, 0.0f);
|
||||||
|
SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
||||||
|
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
|
ResetSuspension();
|
||||||
|
|
||||||
|
CWorld::Add(this);
|
||||||
|
}
|
||||||
|
|
||||||
WRAPPER void CAutomobile::PreRender(void) { EAXJMP(0x535B40); }
|
WRAPPER void CAutomobile::PreRender(void) { EAXJMP(0x535B40); }
|
||||||
WRAPPER void CAutomobile::Render(void) { EAXJMP(0x539EA0); }
|
WRAPPER void CAutomobile::Render(void) { EAXJMP(0x539EA0); }
|
||||||
|
|
||||||
|
|
||||||
|
int32
|
||||||
|
CAutomobile::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
CColModel *colModel;
|
||||||
|
|
||||||
|
if(m_status != STATUS_SIMPLE)
|
||||||
|
bVehicleColProcessed = true;
|
||||||
|
|
||||||
|
if(m_veh_flagC80)
|
||||||
|
colModel = &CWorld::Players[CWorld::PlayerInFocus].m_ColModel;
|
||||||
|
else
|
||||||
|
colModel = GetColModel();
|
||||||
|
|
||||||
|
int numWheelCollisions = 0;
|
||||||
|
float prevRatios[4] = { 0.0f, 0.0f, 0.0f, 0.0f};
|
||||||
|
for(i = 0; i < 4; i++)
|
||||||
|
prevRatios[i] = m_aSuspensionSpringRatio[i];
|
||||||
|
|
||||||
|
int numCollisions = CCollision::ProcessColModels(GetMatrix(), *colModel,
|
||||||
|
ent->GetMatrix(), *ent->GetColModel(),
|
||||||
|
colpoints,
|
||||||
|
m_aWheelColPoints, m_aSuspensionSpringRatio);
|
||||||
|
|
||||||
|
// m_aSuspensionSpringRatio are now set to the point where the tyre touches ground.
|
||||||
|
// In ProcessControl these will be re-normalized to ignore the tyre radius.
|
||||||
|
|
||||||
|
if(field_EF || m_phy_flagA80 ||
|
||||||
|
GetModelIndex() == MI_DODO && (ent->m_status == STATUS_PHYSICS || ent->m_status == STATUS_SIMPLE)){
|
||||||
|
// don't do line collision
|
||||||
|
for(i = 0; i < 4; i++)
|
||||||
|
m_aSuspensionSpringRatio[i] = prevRatios[i];
|
||||||
|
}else{
|
||||||
|
for(i = 0; i < 4; i++)
|
||||||
|
if(m_aSuspensionSpringRatio[i] < 1.0f && m_aSuspensionSpringRatio[i] < prevRatios[i]){
|
||||||
|
numWheelCollisions++;
|
||||||
|
|
||||||
|
// wheel is touching a physical
|
||||||
|
if(ent->IsVehicle() || ent->IsObject()){
|
||||||
|
CPhysical *phys = (CPhysical*)ent;
|
||||||
|
|
||||||
|
m_aGroundPhysical[i] = phys;
|
||||||
|
phys->RegisterReference((CEntity**)&m_aGroundPhysical[i]);
|
||||||
|
m_aGroundOffset[i] = m_aWheelColPoints[i].point - phys->GetPosition();
|
||||||
|
|
||||||
|
if(phys->GetModelIndex() == MI_BODYCAST && m_status == STATUS_PLAYER){
|
||||||
|
// damage body cast
|
||||||
|
float speed = m_vecMoveSpeed.MagnitudeSqr();
|
||||||
|
if(speed > 0.1f){
|
||||||
|
CObject::nBodyCastHealth -= 0.1f*m_fMass*speed;
|
||||||
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_PED_BODYCAST_HIT, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
// move body cast
|
||||||
|
if(phys->bIsStatic){
|
||||||
|
phys->bIsStatic = false;
|
||||||
|
phys->m_nStaticFrames = 0;
|
||||||
|
phys->ApplyMoveForce(m_vecMoveSpeed / speed);
|
||||||
|
phys->AddToMovingList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_nSurfaceTouched = m_aWheelColPoints[i].surfaceB;
|
||||||
|
if(ent->IsBuilding())
|
||||||
|
m_pCurGroundEntity = ent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(numCollisions > 0 || numWheelCollisions > 0){
|
||||||
|
AddCollisionRecord(ent);
|
||||||
|
if(!ent->IsBuilding())
|
||||||
|
((CPhysical*)ent)->AddCollisionRecord(this);
|
||||||
|
|
||||||
|
if(numCollisions > 0)
|
||||||
|
if(ent->IsBuilding() ||
|
||||||
|
ent->IsObject() && ((CPhysical*)ent)->bInfiniteMass)
|
||||||
|
bHasHitWall = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return numCollisions;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
WRAPPER void CAutomobile::ProcessControlInputs(uint8) { EAXJMP(0x53B660); }
|
WRAPPER void CAutomobile::ProcessControlInputs(uint8) { EAXJMP(0x53B660); }
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -51,17 +165,161 @@ void
|
|||||||
CAutomobile::SetComponentRotation(int32 component, CVector rotation)
|
CAutomobile::SetComponentRotation(int32 component, CVector rotation)
|
||||||
{
|
{
|
||||||
CMatrix mat(RwFrameGetMatrix(m_aCarNodes[component]));
|
CMatrix mat(RwFrameGetMatrix(m_aCarNodes[component]));
|
||||||
CVector pos = *mat.GetPosition();
|
CVector pos = mat.GetPosition();
|
||||||
// BUG: all these set the whole matrix
|
// BUG: all these set the whole matrix
|
||||||
mat.SetRotateX(DEGTORAD(rotation.x));
|
mat.SetRotateX(DEGTORAD(rotation.x));
|
||||||
mat.SetRotateY(DEGTORAD(rotation.y));
|
mat.SetRotateY(DEGTORAD(rotation.y));
|
||||||
mat.SetRotateZ(DEGTORAD(rotation.z));
|
mat.SetRotateZ(DEGTORAD(rotation.z));
|
||||||
mat.GetPosition() += pos;
|
mat.Translate(pos);
|
||||||
mat.UpdateRW();
|
mat.UpdateRW();
|
||||||
}
|
}
|
||||||
|
|
||||||
WRAPPER void CAutomobile::OpenDoor(int32, eDoors door, float) { EAXJMP(0x52E750); }
|
void
|
||||||
WRAPPER void CAutomobile::ProcessOpenDoor(uint32, uint32, float) { EAXJMP(0x52E910); }
|
CAutomobile::OpenDoor(int32 component, eDoors door, float openRatio)
|
||||||
|
{
|
||||||
|
CMatrix mat(RwFrameGetMatrix(m_aCarNodes[component]));
|
||||||
|
CVector pos = mat.GetPosition();
|
||||||
|
float axes[3] = { 0.0f, 0.0f, 0.0f };
|
||||||
|
float wasClosed = false;
|
||||||
|
|
||||||
|
if(Doors[door].IsClosed()){
|
||||||
|
// enable angle cull for closed doors
|
||||||
|
RwFrameForAllObjects(m_aCarNodes[component], CVehicleModelInfo::ClearAtomicFlagCB, (void*)ATOMIC_FLAG_NOCULL);
|
||||||
|
wasClosed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Doors[door].Open(openRatio);
|
||||||
|
|
||||||
|
if(wasClosed && Doors[door].RetAngleWhenClosed() != Doors[door].m_fAngle){
|
||||||
|
// door opened
|
||||||
|
HideAllComps();
|
||||||
|
// turn off angle cull for swinging door
|
||||||
|
RwFrameForAllObjects(m_aCarNodes[component], CVehicleModelInfo::SetAtomicFlagCB, (void*)ATOMIC_FLAG_NOCULL);
|
||||||
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_CAR_DOOR_OPEN_BONNET + door, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!wasClosed && openRatio == 0.0f){
|
||||||
|
// door closed
|
||||||
|
if(Damage.GetDoorStatus(door) == DOOR_STATUS_SWINGING)
|
||||||
|
Damage.SetDoorStatus(door, DOOR_STATUS_OK); // huh?
|
||||||
|
ShowAllComps();
|
||||||
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_CAR_DOOR_CLOSE_BONNET + door, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
axes[Doors[door].m_nAxis] = Doors[door].m_fAngle;
|
||||||
|
mat.SetRotate(axes[0], axes[1], axes[2]);
|
||||||
|
mat.Translate(pos);
|
||||||
|
mat.UpdateRW();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void ProcessDoorOpenAnimation(CAutomobile *car, uint32 component, eDoors door, float time, float start, float end)
|
||||||
|
{
|
||||||
|
if(time > start && time < end){
|
||||||
|
float ratio = (time - start)/(end - start);
|
||||||
|
if(car->Doors[door].GetAngleOpenRatio() < ratio)
|
||||||
|
car->OpenDoor(component, door, ratio);
|
||||||
|
}else if(time > end){
|
||||||
|
car->OpenDoor(component, door, 1.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void ProcessDoorCloseAnimation(CAutomobile *car, uint32 component, eDoors door, float time, float start, float end)
|
||||||
|
{
|
||||||
|
if(time > start && time < end){
|
||||||
|
float ratio = 1.0f - (time - start)/(end - start);
|
||||||
|
if(car->Doors[door].GetAngleOpenRatio() > ratio)
|
||||||
|
car->OpenDoor(component, door, ratio);
|
||||||
|
}else if(time > end){
|
||||||
|
car->OpenDoor(component, door, 0.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void ProcessDoorOpenCloseAnimation(CAutomobile *car, uint32 component, eDoors door, float time, float start, float mid, float end)
|
||||||
|
{
|
||||||
|
if(time > start && time < mid){
|
||||||
|
// open
|
||||||
|
float ratio = (time - start)/(mid - start);
|
||||||
|
if(car->Doors[door].GetAngleOpenRatio() < ratio)
|
||||||
|
car->OpenDoor(component, door, ratio);
|
||||||
|
}else if(time > mid && time < end){
|
||||||
|
// close
|
||||||
|
float ratio = 1.0f - (time - mid)/(end - mid);
|
||||||
|
if(car->Doors[door].GetAngleOpenRatio() > ratio)
|
||||||
|
car->OpenDoor(component, door, ratio);
|
||||||
|
}else if(time > end){
|
||||||
|
car->OpenDoor(component, door, 0.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void
|
||||||
|
CAutomobile::ProcessOpenDoor(uint32 component, uint32 anim, float time)
|
||||||
|
{
|
||||||
|
eDoors door;
|
||||||
|
|
||||||
|
switch(component){
|
||||||
|
case CAR_DOOR_RF: door = DOOR_FRONT_RIGHT; break;
|
||||||
|
case CAR_DOOR_RR: door = DOOR_REAR_RIGHT; break;
|
||||||
|
case CAR_DOOR_LF: door = DOOR_FRONT_LEFT; break;
|
||||||
|
case CAR_DOOR_LR: door = DOOR_REAR_LEFT; break;
|
||||||
|
default: assert(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(IsDoorMissing(door))
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch(anim){
|
||||||
|
case ANIM_CAR_QJACK:
|
||||||
|
case ANIM_CAR_OPEN_LHS:
|
||||||
|
case ANIM_CAR_OPEN_RHS:
|
||||||
|
ProcessDoorOpenAnimation(this, component, door, time, 0.66f, 0.8f);
|
||||||
|
break;
|
||||||
|
case ANIM_CAR_CLOSEDOOR_LHS:
|
||||||
|
case ANIM_CAR_CLOSEDOOR_LOW_LHS:
|
||||||
|
case ANIM_CAR_CLOSEDOOR_RHS:
|
||||||
|
case ANIM_CAR_CLOSEDOOR_LOW_RHS:
|
||||||
|
ProcessDoorCloseAnimation(this, component, door, time, 0.2f, 0.63f);
|
||||||
|
break;
|
||||||
|
case ANIM_CAR_ROLLDOOR:
|
||||||
|
case ANIM_CAR_ROLLDOOR_LOW:
|
||||||
|
ProcessDoorOpenCloseAnimation(this, component, door, time, 0.1f, 0.6f, 0.95f);
|
||||||
|
break;
|
||||||
|
break;
|
||||||
|
case ANIM_CAR_GETOUT_LHS:
|
||||||
|
case ANIM_CAR_GETOUT_LOW_LHS:
|
||||||
|
case ANIM_CAR_GETOUT_RHS:
|
||||||
|
case ANIM_CAR_GETOUT_LOW_RHS:
|
||||||
|
ProcessDoorOpenAnimation(this, component, door, time, 0.06f, 0.43f);
|
||||||
|
break;
|
||||||
|
case ANIM_CAR_CLOSE_LHS:
|
||||||
|
case ANIM_CAR_CLOSE_RHS:
|
||||||
|
ProcessDoorCloseAnimation(this, component, door, time, 0.1f, 0.23f);
|
||||||
|
break;
|
||||||
|
case ANIM_CAR_PULLOUT_RHS:
|
||||||
|
case ANIM_CAR_PULLOUT_LOW_RHS:
|
||||||
|
OpenDoor(component, door, 1.0f);
|
||||||
|
case ANIM_COACH_OPEN_L:
|
||||||
|
case ANIM_COACH_OPEN_R:
|
||||||
|
ProcessDoorOpenAnimation(this, component, door, time, 0.66f, 0.8f);
|
||||||
|
break;
|
||||||
|
case ANIM_COACH_OUT_L:
|
||||||
|
ProcessDoorOpenAnimation(this, component, door, time, 0.0f, 0.3f);
|
||||||
|
break;
|
||||||
|
case ANIM_VAN_OPEN_L:
|
||||||
|
case ANIM_VAN_OPEN:
|
||||||
|
ProcessDoorOpenAnimation(this, component, door, time, 0.37f, 0.55f);
|
||||||
|
break;
|
||||||
|
case ANIM_VAN_CLOSE_L:
|
||||||
|
case ANIM_VAN_CLOSE:
|
||||||
|
ProcessDoorCloseAnimation(this, component, door, time, 0.5f, 0.8f);
|
||||||
|
break;
|
||||||
|
case ANIM_VAN_GETOUT_L:
|
||||||
|
case ANIM_VAN_GETOUT:
|
||||||
|
ProcessDoorOpenAnimation(this, component, door, time, 0.5f, 0.6f);
|
||||||
|
break;
|
||||||
|
case NUM_ANIMS:
|
||||||
|
OpenDoor(component, door, time);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CAutomobile::IsDoorReady(eDoors door)
|
CAutomobile::IsDoorReady(eDoors door)
|
||||||
@ -106,7 +364,86 @@ CAutomobile::RemoveRefsToVehicle(CEntity *ent)
|
|||||||
m_aGroundPhysical[i] = nil;
|
m_aGroundPhysical[i] = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
WRAPPER void CAutomobile::BlowUpCar(CEntity *ent) { EAXJMP(0x53BC60); }
|
void
|
||||||
|
CAutomobile::BlowUpCar(CEntity *culprit)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
RpAtomic *atomic;
|
||||||
|
|
||||||
|
if(!bCanBeDamaged)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// explosion pushes vehicle up
|
||||||
|
m_vecMoveSpeed.z += 0.13f;
|
||||||
|
m_status = STATUS_WRECKED;
|
||||||
|
bRenderScorched = true;
|
||||||
|
m_nTimeOfDeath = CTimer::GetTimeInMilliseconds();
|
||||||
|
Damage.FuckCarCompletely();
|
||||||
|
|
||||||
|
if(GetModelIndex() != MI_RCBANDIT){
|
||||||
|
SetBumperDamage(CAR_BUMP_FRONT, VEHBUMPER_FRONT);
|
||||||
|
SetBumperDamage(CAR_BUMP_REAR, VEHBUMPER_REAR);
|
||||||
|
SetDoorDamage(CAR_BONNET, DOOR_BONNET);
|
||||||
|
SetDoorDamage(CAR_BOOT, DOOR_BOOT);
|
||||||
|
SetDoorDamage(CAR_DOOR_LF, DOOR_FRONT_LEFT);
|
||||||
|
SetDoorDamage(CAR_DOOR_RF, DOOR_FRONT_RIGHT);
|
||||||
|
SetDoorDamage(CAR_DOOR_LR, DOOR_REAR_LEFT);
|
||||||
|
SetDoorDamage(CAR_DOOR_RR, DOOR_REAR_RIGHT);
|
||||||
|
SpawnFlyingComponent(CAR_WHEEL_LF, COMPGROUP_WHEEL);
|
||||||
|
RwFrameForAllObjects(m_aCarNodes[CAR_WHEEL_LF], GetCurrentAtomicObjectCB, &atomic);
|
||||||
|
if(atomic)
|
||||||
|
RpAtomicSetFlags(atomic, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_fHealth = 0.0f;
|
||||||
|
m_nBombTimer = 0;
|
||||||
|
m_auto_flagA7 = 0;
|
||||||
|
|
||||||
|
TheCamera.CamShake(0.7f, GetPosition().x, GetPosition().y, GetPosition().z);
|
||||||
|
|
||||||
|
// kill driver and passengers
|
||||||
|
if(pDriver){
|
||||||
|
CDarkel::RegisterKillByPlayer(pDriver, WEAPONTYPE_EXPLOSION);
|
||||||
|
if(pDriver->GetPedState() == PED_DRIVING){
|
||||||
|
pDriver->SetDead();
|
||||||
|
if(!pDriver->IsPlayer())
|
||||||
|
pDriver->FlagToDestroyWhenNextProcessed();
|
||||||
|
}else
|
||||||
|
pDriver->SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f);
|
||||||
|
}
|
||||||
|
for(i = 0; i < m_nNumMaxPassengers; i++){
|
||||||
|
if(pPassengers[i]){
|
||||||
|
CDarkel::RegisterKillByPlayer(pPassengers[i], WEAPONTYPE_EXPLOSION);
|
||||||
|
if(pPassengers[i]->GetPedState() == PED_DRIVING){
|
||||||
|
pPassengers[i]->SetDead();
|
||||||
|
if(!pPassengers[i]->IsPlayer())
|
||||||
|
pPassengers[i]->FlagToDestroyWhenNextProcessed();
|
||||||
|
}else
|
||||||
|
pPassengers[i]->SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bEngineOn = false;
|
||||||
|
bLightsOn = false;
|
||||||
|
m_bSirenOrAlarm = false;
|
||||||
|
bTaxiLight = false;
|
||||||
|
if(bIsAmbulanceOnDuty){
|
||||||
|
bIsAmbulanceOnDuty = false;
|
||||||
|
CCarCtrl::NumAmbulancesOnDuty--;
|
||||||
|
}
|
||||||
|
if(bIsFireTruckOnDuty){
|
||||||
|
bIsFireTruckOnDuty = false;
|
||||||
|
CCarCtrl::NumFiretrucksOnDuty--;
|
||||||
|
}
|
||||||
|
ChangeLawEnforcerState(false);
|
||||||
|
|
||||||
|
gFireManager.StartFire(this, culprit, 0.8f, 1); // TODO
|
||||||
|
CDarkel::RegisterCarBlownUpByPlayer(this);
|
||||||
|
if(GetModelIndex() == MI_RCBANDIT)
|
||||||
|
CExplosion::AddExplosion(this, culprit, EXPLOSION_4, GetPosition(), 0); // TODO
|
||||||
|
else
|
||||||
|
CExplosion::AddExplosion(this, culprit, EXPLOSION_3, GetPosition(), 0); // TODO
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CAutomobile::SetUpWheelColModel(CColModel *colModel)
|
CAutomobile::SetUpWheelColModel(CColModel *colModel)
|
||||||
@ -139,7 +476,31 @@ CAutomobile::SetUpWheelColModel(CColModel *colModel)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
WRAPPER void CAutomobile::BurstTyre(uint8 tyre) { EAXJMP(0x53C0E0); }
|
// this probably isn't used in III yet
|
||||||
|
void
|
||||||
|
CAutomobile::BurstTyre(uint8 wheel)
|
||||||
|
{
|
||||||
|
switch(wheel){
|
||||||
|
case CAR_PIECE_WHEEL_LF: wheel = VEHWHEEL_FRONT_LEFT; break;
|
||||||
|
case CAR_PIECE_WHEEL_LR: wheel = VEHWHEEL_REAR_LEFT; break;
|
||||||
|
case CAR_PIECE_WHEEL_RF: wheel = VEHWHEEL_FRONT_RIGHT; break;
|
||||||
|
case CAR_PIECE_WHEEL_RR: wheel = VEHWHEEL_REAR_RIGHT; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
int status = Damage.GetWheelStatus(wheel);
|
||||||
|
if(status == WHEEL_STATUS_OK){
|
||||||
|
Damage.SetWheelStatus(wheel, WHEEL_STATUS_BURST);
|
||||||
|
|
||||||
|
if(m_status == STATUS_SIMPLE){
|
||||||
|
m_status = STATUS_PHYSICS;
|
||||||
|
CCarCtrl::SwitchVehicleToRealPhysics(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
ApplyMoveForce(GetRight() * CGeneral::GetRandomNumberInRange(-0.3f, 0.3f));
|
||||||
|
ApplyTurnForce(GetRight() * CGeneral::GetRandomNumberInRange(-0.3f, 0.3f), GetForward());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WRAPPER bool CAutomobile::IsRoomForPedToLeaveCar(uint32, CVector *) { EAXJMP(0x53C5B0); }
|
WRAPPER bool CAutomobile::IsRoomForPedToLeaveCar(uint32, CVector *) { EAXJMP(0x53C5B0); }
|
||||||
|
|
||||||
float
|
float
|
||||||
@ -148,13 +509,436 @@ CAutomobile::GetHeightAboveRoad(void)
|
|||||||
return m_fHeightAboveRoad;
|
return m_fHeightAboveRoad;
|
||||||
}
|
}
|
||||||
|
|
||||||
WRAPPER void CAutomobile::PlayCarHorn(void) { EAXJMP(0x53C450); }
|
void
|
||||||
|
CAutomobile::PlayCarHorn(void)
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
|
||||||
|
if(m_nCarHornTimer != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
r = CGeneral::GetRandomNumber() & 7;
|
||||||
|
if(r < 2){
|
||||||
|
m_nCarHornTimer = 45;
|
||||||
|
}else if(r < 4){
|
||||||
|
if(pDriver)
|
||||||
|
pDriver->Say(SOUND_PED_CAR_COLLISION);
|
||||||
|
m_nCarHornTimer = 45;
|
||||||
|
}else{
|
||||||
|
if(pDriver)
|
||||||
|
pDriver->Say(SOUND_PED_CAR_COLLISION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CAutomobile::PlayHornIfNecessary(void)
|
||||||
|
{
|
||||||
|
if(m_autoPilot.m_flag2 ||
|
||||||
|
m_autoPilot.m_flag1)
|
||||||
|
if(!HasCarStoppedBecauseOfLight())
|
||||||
|
PlayCarHorn();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
CAutomobile::ResetSuspension(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < 4; i++){
|
||||||
|
m_aSuspensionSpringRatio[i] = 1.0f;
|
||||||
|
m_aWheelSkidThing[i] = 0.0f;
|
||||||
|
m_aWheelRotation[i] = 0.0f;
|
||||||
|
m_aWheelState[i] = 0; // TODO: enum?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CAutomobile::SetupSuspensionLines(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
CVector posn;
|
||||||
|
CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex());
|
||||||
|
CColModel *colModel = mi->GetColModel();
|
||||||
|
|
||||||
|
// Each suspension line starts at the uppermost wheel position
|
||||||
|
// and extends down to the lowermost point on the tyre
|
||||||
|
for(i = 0; i < 4; i++){
|
||||||
|
mi->GetWheelPosn(i, posn);
|
||||||
|
m_aWheelPosition[i] = posn.z;
|
||||||
|
|
||||||
WRAPPER void CAutomobile::SpawnFlyingComponent(int32 component, uint32 type) { EAXJMP(0x530300); }
|
// uppermost wheel position
|
||||||
|
posn.z += m_handling->fSuspensionUpperLimit;
|
||||||
|
colModel->lines[i].p0 = posn;
|
||||||
|
|
||||||
|
// lowermost wheel position
|
||||||
|
posn.z += m_handling->fSuspensionLowerLimit - m_handling->fSuspensionUpperLimit;
|
||||||
|
// lowest point on tyre
|
||||||
|
posn.z -= mi->m_wheelScale*0.5f;
|
||||||
|
colModel->lines[i].p1 = posn;
|
||||||
|
|
||||||
|
// this is length of the spring at rest
|
||||||
|
m_aSuspensionSpringLength[i] = m_handling->fSuspensionUpperLimit - m_handling->fSuspensionLowerLimit;
|
||||||
|
m_aSuspensionLineLength[i] = colModel->lines[i].p0.z - colModel->lines[i].p1.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compress spring somewhat to get normal height on road
|
||||||
|
m_fHeightAboveRoad = -(colModel->lines[0].p0.z + (colModel->lines[0].p1.z - colModel->lines[0].p0.z)*
|
||||||
|
(1.0f - 1.0f/(8.0f*m_handling->fSuspensionForceLevel)));
|
||||||
|
for(i = 0; i < 4; i++)
|
||||||
|
m_aWheelPosition[i] = mi->m_wheelScale*0.5f - m_fHeightAboveRoad;
|
||||||
|
|
||||||
|
// adjust col model to include suspension lines
|
||||||
|
if(colModel->boundingBox.min.z > colModel->lines[0].p1.z)
|
||||||
|
colModel->boundingBox.min.z = colModel->lines[0].p1.z;
|
||||||
|
float radius = max(colModel->boundingBox.min.Magnitude(), colModel->boundingBox.max.Magnitude());
|
||||||
|
if(colModel->boundingSphere.radius < radius)
|
||||||
|
colModel->boundingSphere.radius = radius;
|
||||||
|
|
||||||
|
if(GetModelIndex() == MI_RCBANDIT){
|
||||||
|
colModel->boundingSphere.radius = 2.0f;
|
||||||
|
for(i = 0; i < colModel->numSpheres; i++)
|
||||||
|
colModel->spheres[i].radius = 0.3f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// called on police cars
|
||||||
|
void
|
||||||
|
CAutomobile::ScanForCrimes(void)
|
||||||
|
{
|
||||||
|
if(FindPlayerVehicle() && FindPlayerVehicle()->IsCar())
|
||||||
|
if(FindPlayerVehicle()->m_nAlarmState != -1)
|
||||||
|
// if player's alarm is on, increase wanted level
|
||||||
|
if((FindPlayerVehicle()->GetPosition() - GetPosition()).MagnitudeSqr() < sq(20.0f))
|
||||||
|
CWorld::Players[CWorld::PlayerInFocus].m_pPed->SetWantedLevelNoDrop(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CAutomobile::BlowUpCarsInPath(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if(m_vecMoveSpeed.Magnitude() > 0.1f)
|
||||||
|
for(i = 0; i < m_nCollisionRecords; i++)
|
||||||
|
if(m_aCollisionRecords[i] &&
|
||||||
|
m_aCollisionRecords[i]->IsVehicle() &&
|
||||||
|
m_aCollisionRecords[i]->GetModelIndex() != MI_RHINO &&
|
||||||
|
!m_aCollisionRecords[i]->bRenderScorched)
|
||||||
|
((CVehicle*)m_aCollisionRecords[i])->BlowUpCar(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CAutomobile::HasCarStoppedBecauseOfLight(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if(m_status != STATUS_SIMPLE && m_status != STATUS_PHYSICS)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(m_autoPilot.m_nCurrentRouteNode && m_autoPilot.m_nNextRouteNode){
|
||||||
|
CPathNode *curnode = &ThePaths.m_pathNodes[m_autoPilot.m_nCurrentRouteNode];
|
||||||
|
for(i = 0; i < curnode->numLinks; i++)
|
||||||
|
if(ThePaths.m_connections[curnode->firstLink + i] == m_autoPilot.m_nNextRouteNode)
|
||||||
|
break;
|
||||||
|
if(i < curnode->numLinks &&
|
||||||
|
ThePaths.m_carPathLinks[ThePaths.m_carPathConnections[curnode->firstLink + i]].trafficLightType & 3) // TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_autoPilot.m_nCurrentRouteNode && m_autoPilot.m_nPrevRouteNode){
|
||||||
|
CPathNode *curnode = &ThePaths.m_pathNodes[m_autoPilot.m_nCurrentRouteNode];
|
||||||
|
for(i = 0; i < curnode->numLinks; i++)
|
||||||
|
if(ThePaths.m_connections[curnode->firstLink + i] == m_autoPilot.m_nPrevRouteNode)
|
||||||
|
break;
|
||||||
|
if(i < curnode->numLinks &&
|
||||||
|
ThePaths.m_carPathLinks[ThePaths.m_carPathConnections[curnode->firstLink + i]].trafficLightType & 3) // TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CAutomobile::SetBusDoorTimer(uint32 timer, uint8 type)
|
||||||
|
{
|
||||||
|
if(timer < 1000)
|
||||||
|
timer = 1000;
|
||||||
|
if(type == 0)
|
||||||
|
// open and close
|
||||||
|
m_nBusDoorTimerStart = CTimer::GetTimeInMilliseconds();
|
||||||
|
else
|
||||||
|
// only close
|
||||||
|
m_nBusDoorTimerStart = CTimer::GetTimeInMilliseconds() - 500;
|
||||||
|
m_nBusDoorTimerEnd = m_nBusDoorTimerStart + timer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CAutomobile::ProcessAutoBusDoors(void)
|
||||||
|
{
|
||||||
|
if(CTimer::GetTimeInMilliseconds() < m_nBusDoorTimerEnd){
|
||||||
|
if(m_nBusDoorTimerEnd != 0 && CTimer::GetTimeInMilliseconds() > m_nBusDoorTimerEnd-500){
|
||||||
|
// close door
|
||||||
|
if(!IsDoorMissing(DOOR_FRONT_LEFT) && (m_nGettingInFlags & 1) == 0){
|
||||||
|
if(IsDoorClosed(DOOR_FRONT_LEFT)){
|
||||||
|
m_nBusDoorTimerEnd = CTimer::GetTimeInMilliseconds();
|
||||||
|
OpenDoor(CAR_DOOR_LF, DOOR_FRONT_LEFT, 0.0f);
|
||||||
|
}else{
|
||||||
|
OpenDoor(CAR_DOOR_LF, DOOR_FRONT_LEFT,
|
||||||
|
1.0f - (CTimer::GetTimeInMilliseconds() - (m_nBusDoorTimerEnd-500))/500.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!IsDoorMissing(DOOR_FRONT_RIGHT) && (m_nGettingInFlags & 4) == 0){
|
||||||
|
if(IsDoorClosed(DOOR_FRONT_RIGHT)){
|
||||||
|
m_nBusDoorTimerEnd = CTimer::GetTimeInMilliseconds();
|
||||||
|
OpenDoor(CAR_DOOR_RF, DOOR_FRONT_RIGHT, 0.0f);
|
||||||
|
}else{
|
||||||
|
OpenDoor(CAR_DOOR_RF, DOOR_FRONT_RIGHT,
|
||||||
|
1.0f - (CTimer::GetTimeInMilliseconds() - (m_nBusDoorTimerEnd-500))/500.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
// ended
|
||||||
|
if(m_nBusDoorTimerStart){
|
||||||
|
if(!IsDoorMissing(DOOR_FRONT_LEFT) && (m_nGettingInFlags & 1) == 0)
|
||||||
|
OpenDoor(CAR_DOOR_LF, DOOR_FRONT_LEFT, 0.0f);
|
||||||
|
if(!IsDoorMissing(DOOR_FRONT_RIGHT) && (m_nGettingInFlags & 4) == 0)
|
||||||
|
OpenDoor(CAR_DOOR_RF, DOOR_FRONT_RIGHT, 0.0f);
|
||||||
|
m_nBusDoorTimerStart = 0;
|
||||||
|
m_nBusDoorTimerEnd = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CAutomobile::ProcessSwingingDoor(int32 component, eDoors door)
|
||||||
|
{
|
||||||
|
if(Damage.GetDoorStatus(door) != DOOR_STATUS_SWINGING)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CMatrix mat(RwFrameGetMatrix(m_aCarNodes[component]));
|
||||||
|
CVector pos = mat.GetPosition();
|
||||||
|
float axes[3] = { 0.0f, 0.0f, 0.0f };
|
||||||
|
|
||||||
|
Doors[door].Process(this);
|
||||||
|
axes[Doors[door].m_nAxis] = Doors[door].m_fAngle;
|
||||||
|
mat.SetRotate(axes[0], axes[1], axes[2]);
|
||||||
|
mat.Translate(pos);
|
||||||
|
mat.UpdateRW();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CAutomobile::Fix(void)
|
||||||
|
{
|
||||||
|
int component;
|
||||||
|
|
||||||
|
Damage.ResetDamageStatus();
|
||||||
|
|
||||||
|
if(m_handling->Flags & HANDLING_NO_DOORS){
|
||||||
|
Damage.SetDoorStatus(DOOR_FRONT_LEFT, DOOR_STATUS_MISSING);
|
||||||
|
Damage.SetDoorStatus(DOOR_FRONT_RIGHT, DOOR_STATUS_MISSING);
|
||||||
|
Damage.SetDoorStatus(DOOR_REAR_LEFT, DOOR_STATUS_MISSING);
|
||||||
|
Damage.SetDoorStatus(DOOR_REAR_RIGHT, DOOR_STATUS_MISSING);
|
||||||
|
}
|
||||||
|
|
||||||
|
bIsDamaged = false;
|
||||||
|
RpClumpForAllAtomics((RpClump*)m_rwObject, CVehicleModelInfo::HideAllComponentsAtomicCB, (void*)ATOMIC_FLAG_DAM);
|
||||||
|
|
||||||
|
for(component = CAR_BUMP_FRONT; component < NUM_CAR_NODES; component++){
|
||||||
|
if(m_aCarNodes[component]){
|
||||||
|
CMatrix mat(RwFrameGetMatrix(m_aCarNodes[component]));
|
||||||
|
mat.SetTranslate(mat.GetPosition());
|
||||||
|
mat.UpdateRW();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CAutomobile::SetupDamageAfterLoad(void)
|
||||||
|
{
|
||||||
|
if(m_aCarNodes[CAR_BUMP_FRONT])
|
||||||
|
SetBumperDamage(CAR_BUMP_FRONT, VEHBUMPER_FRONT);
|
||||||
|
if(m_aCarNodes[CAR_BONNET])
|
||||||
|
SetDoorDamage(CAR_BONNET, DOOR_BONNET);
|
||||||
|
if(m_aCarNodes[CAR_BUMP_REAR])
|
||||||
|
SetBumperDamage(CAR_BUMP_REAR, VEHBUMPER_REAR);
|
||||||
|
if(m_aCarNodes[CAR_BOOT])
|
||||||
|
SetDoorDamage(CAR_BOOT, DOOR_BOOT);
|
||||||
|
if(m_aCarNodes[CAR_DOOR_LF])
|
||||||
|
SetDoorDamage(CAR_DOOR_LF, DOOR_FRONT_LEFT);
|
||||||
|
if(m_aCarNodes[CAR_DOOR_RF])
|
||||||
|
SetDoorDamage(CAR_DOOR_RF, DOOR_FRONT_RIGHT);
|
||||||
|
if(m_aCarNodes[CAR_DOOR_LR])
|
||||||
|
SetDoorDamage(CAR_DOOR_LR, DOOR_REAR_LEFT);
|
||||||
|
if(m_aCarNodes[CAR_DOOR_RR])
|
||||||
|
SetDoorDamage(CAR_DOOR_RR, DOOR_REAR_RIGHT);
|
||||||
|
if(m_aCarNodes[CAR_WING_LF])
|
||||||
|
SetPanelDamage(CAR_WING_LF, VEHPANEL_FRONT_LEFT);
|
||||||
|
if(m_aCarNodes[CAR_WING_RF])
|
||||||
|
SetPanelDamage(CAR_WING_RF, VEHPANEL_FRONT_RIGHT);
|
||||||
|
if(m_aCarNodes[CAR_WING_LR])
|
||||||
|
SetPanelDamage(CAR_WING_LR, VEHPANEL_REAR_LEFT);
|
||||||
|
if(m_aCarNodes[CAR_WING_RR])
|
||||||
|
SetPanelDamage(CAR_WING_RR, VEHPANEL_REAR_RIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
RwObject*
|
||||||
|
GetCurrentAtomicObjectCB(RwObject *object, void *data)
|
||||||
|
{
|
||||||
|
RpAtomic *atomic = (RpAtomic*)object;
|
||||||
|
assert(RwObjectGetType(object) == rpATOMIC);
|
||||||
|
if(RpAtomicGetFlags(atomic) & rpATOMICRENDER)
|
||||||
|
*(RpAtomic**)data = atomic;
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
|
||||||
|
CColPoint aTempPedColPts[32]; // this name doesn't make any sense
|
||||||
|
|
||||||
|
CObject*
|
||||||
|
CAutomobile::SpawnFlyingComponent(int32 component, uint32 type)
|
||||||
|
{
|
||||||
|
RpAtomic *atomic;
|
||||||
|
RwFrame *frame;
|
||||||
|
RwMatrix *matrix;
|
||||||
|
CObject *obj;
|
||||||
|
|
||||||
|
if(CObject::nNoTempObjects >= NUMTEMPOBJECTS)
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
atomic = nil;
|
||||||
|
RwFrameForAllObjects(m_aCarNodes[component], GetCurrentAtomicObjectCB, &atomic);
|
||||||
|
if(atomic == nil)
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
obj = new CObject;
|
||||||
|
if(obj == nil)
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
if(component == CAR_WINDSCREEN){
|
||||||
|
obj->SetModelIndexNoCreate(MI_CAR_BONNET);
|
||||||
|
}else switch(type){
|
||||||
|
case COMPGROUP_BUMPER:
|
||||||
|
obj->SetModelIndexNoCreate(MI_CAR_BUMPER);
|
||||||
|
break;
|
||||||
|
case COMPGROUP_WHEEL:
|
||||||
|
obj->SetModelIndexNoCreate(MI_CAR_WHEEL);
|
||||||
|
break;
|
||||||
|
case COMPGROUP_DOOR:
|
||||||
|
obj->SetModelIndexNoCreate(MI_CAR_DOOR);
|
||||||
|
obj->SetCenterOfMass(0.0f, -0.5f, 0.0f);
|
||||||
|
break;
|
||||||
|
case COMPGROUP_BONNET:
|
||||||
|
obj->SetModelIndexNoCreate(MI_CAR_BONNET);
|
||||||
|
obj->SetCenterOfMass(0.0f, 0.4f, 0.0f);
|
||||||
|
break;
|
||||||
|
case COMPGROUP_BOOT:
|
||||||
|
obj->SetModelIndexNoCreate(MI_CAR_BOOT);
|
||||||
|
obj->SetCenterOfMass(0.0f, -0.3f, 0.0f);
|
||||||
|
break;
|
||||||
|
case COMPGROUP_PANEL:
|
||||||
|
default:
|
||||||
|
obj->SetModelIndexNoCreate(MI_CAR_PANEL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// object needs base model
|
||||||
|
obj->RefModelInfo(GetModelIndex());
|
||||||
|
|
||||||
|
// create new atomic
|
||||||
|
matrix = RwFrameGetLTM(m_aCarNodes[component]);
|
||||||
|
frame = RwFrameCreate();
|
||||||
|
atomic = RpAtomicClone(atomic);
|
||||||
|
*RwFrameGetMatrix(frame) = *matrix;
|
||||||
|
RpAtomicSetFrame(atomic, frame);
|
||||||
|
CVisibilityPlugins::SetAtomicRenderCallback(atomic, nil);
|
||||||
|
obj->AttachToRwObject((RwObject*)atomic);
|
||||||
|
|
||||||
|
// init object
|
||||||
|
obj->m_fMass = 10.0f;
|
||||||
|
obj->m_fTurnMass = 25.0f;
|
||||||
|
obj->m_fAirResistance = 0.97f;
|
||||||
|
obj->m_fElasticity = 0.1f;
|
||||||
|
obj->m_fBuoyancy = obj->m_fMass*GRAVITY/0.75f;
|
||||||
|
obj->ObjectCreatedBy = TEMP_OBJECT;
|
||||||
|
obj->bIsStatic = true;
|
||||||
|
obj->bIsPickup = false;
|
||||||
|
obj->bUseVehicleColours = true;
|
||||||
|
obj->m_colour1 = m_currentColour1;
|
||||||
|
obj->m_colour2 = m_currentColour2;
|
||||||
|
|
||||||
|
// life time - the more objects the are, the shorter this one will live
|
||||||
|
CObject::nNoTempObjects++;
|
||||||
|
if(CObject::nNoTempObjects > 20)
|
||||||
|
obj->m_nEndOfLifeTime = CTimer::GetTimeInMilliseconds() + 20000/5.0f;
|
||||||
|
else if(CObject::nNoTempObjects > 10)
|
||||||
|
obj->m_nEndOfLifeTime = CTimer::GetTimeInMilliseconds() + 20000/2.0f;
|
||||||
|
else
|
||||||
|
obj->m_nEndOfLifeTime = CTimer::GetTimeInMilliseconds() + 20000;
|
||||||
|
|
||||||
|
obj->m_vecMoveSpeed = m_vecMoveSpeed;
|
||||||
|
if(obj->m_vecMoveSpeed.z > 0.0f){
|
||||||
|
obj->m_vecMoveSpeed.z *= 1.5f;
|
||||||
|
}else if(GetUp().z > 0.0f &&
|
||||||
|
(component == COMPGROUP_BONNET || component == COMPGROUP_BOOT || component == CAR_WINDSCREEN)){
|
||||||
|
obj->m_vecMoveSpeed.z *= -1.5f;
|
||||||
|
obj->m_vecMoveSpeed.z += 0.04f;
|
||||||
|
}else{
|
||||||
|
obj->m_vecMoveSpeed.z *= 0.25f;
|
||||||
|
}
|
||||||
|
obj->m_vecMoveSpeed.x *= 0.75f;
|
||||||
|
obj->m_vecMoveSpeed.y *= 0.75f;
|
||||||
|
|
||||||
|
obj->m_vecTurnSpeed = m_vecTurnSpeed*2.0f;
|
||||||
|
|
||||||
|
// push component away from car
|
||||||
|
CVector dist = obj->GetPosition() - GetPosition();
|
||||||
|
dist.Normalise();
|
||||||
|
if(component == COMPGROUP_BONNET || component == COMPGROUP_BOOT || component == CAR_WINDSCREEN){
|
||||||
|
// push these up some
|
||||||
|
dist += GetUp();
|
||||||
|
if(GetUp().z > 0.0f){
|
||||||
|
// simulate fast upward movement if going fast
|
||||||
|
float speed = CVector2D(m_vecMoveSpeed).MagnitudeSqr();
|
||||||
|
obj->GetPosition() += GetUp()*speed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
obj->ApplyMoveForce(dist);
|
||||||
|
|
||||||
|
if(type == COMPGROUP_WHEEL){
|
||||||
|
obj->m_fTurnMass = 5.0f;
|
||||||
|
obj->m_vecTurnSpeed.x = 0.5f;
|
||||||
|
obj->m_fAirResistance = 0.99f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(CCollision::ProcessColModels(obj->GetMatrix(), *obj->GetColModel(),
|
||||||
|
this->GetMatrix(), *this->GetColModel(),
|
||||||
|
aTempPedColPts, nil, nil) > 0)
|
||||||
|
obj->m_pCollidingEntity = this;
|
||||||
|
|
||||||
|
if(bRenderScorched)
|
||||||
|
obj->bRenderScorched = true;
|
||||||
|
|
||||||
|
CWorld::Add(obj);
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
CObject*
|
||||||
|
CAutomobile::RemoveBonnetInPedCollision(void)
|
||||||
|
{
|
||||||
|
CObject *obj;
|
||||||
|
|
||||||
|
if(Damage.GetDoorStatus(DOOR_BONNET) != DOOR_STATUS_SWINGING &&
|
||||||
|
Doors[DOOR_BONNET].RetAngleWhenOpen()*0.4f < Doors[DOOR_BONNET].m_fAngle){
|
||||||
|
// BUG? why not COMPGROUP_BONNET?
|
||||||
|
obj = SpawnFlyingComponent(CAR_BONNET, COMPGROUP_DOOR);
|
||||||
|
// make both doors invisible on car
|
||||||
|
SetComponentVisibility(m_aCarNodes[CAR_BONNET], ATOMIC_FLAG_NONE);
|
||||||
|
Damage.SetDoorStatus(DOOR_BONNET, DOOR_STATUS_MISSING);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CAutomobile::SetPanelDamage(int32 component, ePanels panel, bool noFlyingComponents)
|
CAutomobile::SetPanelDamage(int32 component, ePanels panel, bool noFlyingComponents)
|
||||||
@ -245,7 +1029,7 @@ void
|
|||||||
CAutomobile::SetComponentVisibility(RwFrame *frame, uint32 flags)
|
CAutomobile::SetComponentVisibility(RwFrame *frame, uint32 flags)
|
||||||
{
|
{
|
||||||
HideAllComps();
|
HideAllComps();
|
||||||
m_veh_flagC2 = true;
|
bIsDamaged = true;
|
||||||
RwFrameForAllObjects(frame, SetVehicleAtomicVisibilityCB, (void*)flags);
|
RwFrameForAllObjects(frame, SetVehicleAtomicVisibilityCB, (void*)flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,6 +1089,8 @@ public:
|
|||||||
void PreRender_(void) { CAutomobile::PreRender(); }
|
void PreRender_(void) { CAutomobile::PreRender(); }
|
||||||
void Render_(void) { CAutomobile::Render(); }
|
void Render_(void) { CAutomobile::Render(); }
|
||||||
|
|
||||||
|
int32 ProcessEntityCollision_(CEntity *ent, CColPoint *colpoints){ return CAutomobile::ProcessEntityCollision(ent, colpoints); }
|
||||||
|
|
||||||
void ProcessControlInputs_(uint8 x) { CAutomobile::ProcessControlInputs(x); }
|
void ProcessControlInputs_(uint8 x) { CAutomobile::ProcessControlInputs(x); }
|
||||||
void GetComponentWorldPosition_(int32 component, CVector &pos) { CAutomobile::GetComponentWorldPosition(component, pos); }
|
void GetComponentWorldPosition_(int32 component, CVector &pos) { CAutomobile::GetComponentWorldPosition(component, pos); }
|
||||||
bool IsComponentPresent_(int32 component) { return CAutomobile::IsComponentPresent(component); }
|
bool IsComponentPresent_(int32 component) { return CAutomobile::IsComponentPresent(component); }
|
||||||
@ -327,16 +1113,33 @@ public:
|
|||||||
STARTPATCHES
|
STARTPATCHES
|
||||||
InjectHook(0x52D170, &CAutomobile_::dtor, PATCH_JUMP);
|
InjectHook(0x52D170, &CAutomobile_::dtor, PATCH_JUMP);
|
||||||
InjectHook(0x52D190, &CAutomobile_::SetModelIndex_, PATCH_JUMP);
|
InjectHook(0x52D190, &CAutomobile_::SetModelIndex_, PATCH_JUMP);
|
||||||
|
InjectHook(0x535180, &CAutomobile_::Teleport_, PATCH_JUMP);
|
||||||
|
InjectHook(0x53B270, &CAutomobile_::ProcessEntityCollision_, PATCH_JUMP);
|
||||||
InjectHook(0x52E5F0, &CAutomobile_::GetComponentWorldPosition_, PATCH_JUMP);
|
InjectHook(0x52E5F0, &CAutomobile_::GetComponentWorldPosition_, PATCH_JUMP);
|
||||||
InjectHook(0x52E660, &CAutomobile_::IsComponentPresent_, PATCH_JUMP);
|
InjectHook(0x52E660, &CAutomobile_::IsComponentPresent_, PATCH_JUMP);
|
||||||
InjectHook(0x52E680, &CAutomobile_::SetComponentRotation_, PATCH_JUMP);
|
InjectHook(0x52E680, &CAutomobile_::SetComponentRotation_, PATCH_JUMP);
|
||||||
|
InjectHook(0x52E750, &CAutomobile_::OpenDoor_, PATCH_JUMP);
|
||||||
InjectHook(0x52EF10, &CAutomobile_::IsDoorReady_, PATCH_JUMP);
|
InjectHook(0x52EF10, &CAutomobile_::IsDoorReady_, PATCH_JUMP);
|
||||||
InjectHook(0x52EF90, &CAutomobile_::IsDoorFullyOpen_, PATCH_JUMP);
|
InjectHook(0x52EF90, &CAutomobile_::IsDoorFullyOpen_, PATCH_JUMP);
|
||||||
InjectHook(0x52EFD0, &CAutomobile_::IsDoorClosed_, PATCH_JUMP);
|
InjectHook(0x52EFD0, &CAutomobile_::IsDoorClosed_, PATCH_JUMP);
|
||||||
InjectHook(0x52F000, &CAutomobile_::IsDoorMissing_, PATCH_JUMP);
|
InjectHook(0x52F000, &CAutomobile_::IsDoorMissing_, PATCH_JUMP);
|
||||||
InjectHook(0x53BF40, &CAutomobile_::RemoveRefsToVehicle_, PATCH_JUMP);
|
InjectHook(0x53BF40, &CAutomobile_::RemoveRefsToVehicle_, PATCH_JUMP);
|
||||||
|
InjectHook(0x53BC60, &CAutomobile_::BlowUpCar_, PATCH_JUMP);
|
||||||
InjectHook(0x53BF70, &CAutomobile_::SetUpWheelColModel_, PATCH_JUMP);
|
InjectHook(0x53BF70, &CAutomobile_::SetUpWheelColModel_, PATCH_JUMP);
|
||||||
|
InjectHook(0x53C0E0, &CAutomobile_::BurstTyre_, PATCH_JUMP);
|
||||||
InjectHook(0x437690, &CAutomobile_::GetHeightAboveRoad_, PATCH_JUMP);
|
InjectHook(0x437690, &CAutomobile_::GetHeightAboveRoad_, PATCH_JUMP);
|
||||||
|
InjectHook(0x53C450, &CAutomobile_::PlayCarHorn_, PATCH_JUMP);
|
||||||
|
InjectHook(0x5353A0, &CAutomobile::ResetSuspension, PATCH_JUMP);
|
||||||
|
InjectHook(0x52D210, &CAutomobile::SetupSuspensionLines, PATCH_JUMP);
|
||||||
|
InjectHook(0x53E000, &CAutomobile::BlowUpCarsInPath, PATCH_JUMP);
|
||||||
|
InjectHook(0x42E220, &CAutomobile::HasCarStoppedBecauseOfLight, PATCH_JUMP);
|
||||||
|
InjectHook(0x53D320, &CAutomobile::SetBusDoorTimer, PATCH_JUMP);
|
||||||
|
InjectHook(0x53D370, &CAutomobile::ProcessAutoBusDoors, PATCH_JUMP);
|
||||||
|
InjectHook(0x535250, &CAutomobile::ProcessSwingingDoor, PATCH_JUMP);
|
||||||
|
InjectHook(0x53C240, &CAutomobile::Fix, PATCH_JUMP);
|
||||||
|
InjectHook(0x53C310, &CAutomobile::SetupDamageAfterLoad, PATCH_JUMP);
|
||||||
|
InjectHook(0x530300, &CAutomobile::SpawnFlyingComponent, PATCH_JUMP);
|
||||||
|
InjectHook(0x535320, &CAutomobile::RemoveBonnetInPedCollision, PATCH_JUMP);
|
||||||
InjectHook(0x5301A0, &CAutomobile::SetPanelDamage, PATCH_JUMP);
|
InjectHook(0x5301A0, &CAutomobile::SetPanelDamage, PATCH_JUMP);
|
||||||
InjectHook(0x530120, &CAutomobile::SetBumperDamage, PATCH_JUMP);
|
InjectHook(0x530120, &CAutomobile::SetBumperDamage, PATCH_JUMP);
|
||||||
InjectHook(0x530200, &CAutomobile::SetDoorDamage, PATCH_JUMP);
|
InjectHook(0x530200, &CAutomobile::SetDoorDamage, PATCH_JUMP);
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
#include "DamageManager.h"
|
#include "DamageManager.h"
|
||||||
#include "Door.h"
|
#include "Door.h"
|
||||||
|
|
||||||
|
class CObject;
|
||||||
|
|
||||||
class CAutomobile : public CVehicle
|
class CAutomobile : public CVehicle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -22,9 +24,7 @@ public:
|
|||||||
float m_aWheelPosition[4];
|
float m_aWheelPosition[4];
|
||||||
float m_aWheelSpeed[4];
|
float m_aWheelSpeed[4];
|
||||||
uint8 field_4D8;
|
uint8 field_4D8;
|
||||||
uint8 m_auto_flagA1 : 1;
|
uint8 m_auto_flagA7 : 1;
|
||||||
uint8 m_auto_flagA2 : 1;
|
|
||||||
uint8 m_auto_flagA4 : 1;
|
|
||||||
uint8 bTaxiLight : 1;
|
uint8 bTaxiLight : 1;
|
||||||
uint8 m_auto_flagA10 : 1;
|
uint8 m_auto_flagA10 : 1;
|
||||||
uint8 m_auto_flagA20 : 1;
|
uint8 m_auto_flagA20 : 1;
|
||||||
@ -37,7 +37,8 @@ public:
|
|||||||
float m_aSuspensionLineLength[4];
|
float m_aSuspensionLineLength[4];
|
||||||
float m_fHeightAboveRoad;
|
float m_fHeightAboveRoad;
|
||||||
float m_fImprovedHandling;
|
float m_fImprovedHandling;
|
||||||
uint8 stuff6[32];
|
uint8 stuff6[28];
|
||||||
|
float field_530;
|
||||||
CPhysical *m_aGroundPhysical[4]; // physicals touching wheels
|
CPhysical *m_aGroundPhysical[4]; // physicals touching wheels
|
||||||
CVector m_aGroundOffset[4]; // from ground object to colpoint
|
CVector m_aGroundOffset[4]; // from ground object to colpoint
|
||||||
CEntity *m_pBlowUpEntity;
|
CEntity *m_pBlowUpEntity;
|
||||||
@ -64,12 +65,15 @@ public:
|
|||||||
void PreRender(void);
|
void PreRender(void);
|
||||||
void Render(void);
|
void Render(void);
|
||||||
|
|
||||||
|
// from CPhysical
|
||||||
|
int32 ProcessEntityCollision(CEntity *ent, CColPoint *colpoints);
|
||||||
|
|
||||||
// from CVehicle
|
// from CVehicle
|
||||||
void ProcessControlInputs(uint8);
|
void ProcessControlInputs(uint8);
|
||||||
void GetComponentWorldPosition(int32 component, CVector &pos);
|
void GetComponentWorldPosition(int32 component, CVector &pos);
|
||||||
bool IsComponentPresent(int32 component);
|
bool IsComponentPresent(int32 component);
|
||||||
void SetComponentRotation(int32 component, CVector rotation);
|
void SetComponentRotation(int32 component, CVector rotation);
|
||||||
void OpenDoor(int32, eDoors door, float);
|
void OpenDoor(int32 component, eDoors door, float openRatio);
|
||||||
void ProcessOpenDoor(uint32, uint32, float);
|
void ProcessOpenDoor(uint32, uint32, float);
|
||||||
bool IsDoorReady(eDoors door);
|
bool IsDoorReady(eDoors door);
|
||||||
bool IsDoorFullyOpen(eDoors door);
|
bool IsDoorFullyOpen(eDoors door);
|
||||||
@ -83,12 +87,23 @@ public:
|
|||||||
float GetHeightAboveRoad(void);
|
float GetHeightAboveRoad(void);
|
||||||
void PlayCarHorn(void);
|
void PlayCarHorn(void);
|
||||||
|
|
||||||
void SpawnFlyingComponent(int32 component, uint32 type);
|
void PlayHornIfNecessary(void);
|
||||||
|
void ResetSuspension(void);
|
||||||
void SetPanelDamage(int32 component, ePanels panel, bool noFlyingComponents);
|
void SetupSuspensionLines(void);
|
||||||
void SetBumperDamage(int32 component, ePanels panel, bool noFlyingComponents);
|
void ScanForCrimes(void);
|
||||||
void SetDoorDamage(int32 component, eDoors door, bool noFlyingComponents);
|
void BlowUpCarsInPath(void);
|
||||||
|
bool HasCarStoppedBecauseOfLight(void);
|
||||||
|
void SetBusDoorTimer(uint32 timer, uint8 type);
|
||||||
|
void ProcessAutoBusDoors(void);
|
||||||
|
void ProcessSwingingDoor(int32 component, eDoors door);
|
||||||
|
void SetupDamageAfterLoad(void);
|
||||||
|
CObject *SpawnFlyingComponent(int32 component, uint32 type);
|
||||||
|
CObject *RemoveBonnetInPedCollision(void);
|
||||||
|
void SetPanelDamage(int32 component, ePanels panel, bool noFlyingComponents = false);
|
||||||
|
void SetBumperDamage(int32 component, ePanels panel, bool noFlyingComponents = false);
|
||||||
|
void SetDoorDamage(int32 component, eDoors door, bool noFlyingComponents = false);
|
||||||
|
|
||||||
|
void Fix(void);
|
||||||
void SetComponentVisibility(RwFrame *frame, uint32 flags);
|
void SetComponentVisibility(RwFrame *frame, uint32 flags);
|
||||||
void SetupModelNodes(void);
|
void SetupModelNodes(void);
|
||||||
void SetTaxiLight(bool light);
|
void SetTaxiLight(bool light);
|
||||||
|
@ -20,6 +20,12 @@ enum ePanelStatus
|
|||||||
PANEL_STATUS_MISSING,
|
PANEL_STATUS_MISSING,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum eWheelStatus
|
||||||
|
{
|
||||||
|
WHEEL_STATUS_OK,
|
||||||
|
WHEEL_STATUS_BURST
|
||||||
|
};
|
||||||
|
|
||||||
enum tComponent
|
enum tComponent
|
||||||
{
|
{
|
||||||
COMPONENT_DEFAULT,
|
COMPONENT_DEFAULT,
|
||||||
|
@ -119,7 +119,9 @@ VALIDATE_SIZE(tHandlingData, 0xD8);
|
|||||||
class cHandlingDataMgr
|
class cHandlingDataMgr
|
||||||
{
|
{
|
||||||
float field_0; // unused it seems
|
float field_0; // unused it seems
|
||||||
|
public:
|
||||||
float field_4; // wheel related
|
float field_4; // wheel related
|
||||||
|
private:
|
||||||
float field_8; //
|
float field_8; //
|
||||||
float field_C; // unused it seems
|
float field_C; // unused it seems
|
||||||
float field_10; //
|
float field_10; //
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "patcher.h"
|
#include "patcher.h"
|
||||||
|
#include "General.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
#include "Pad.h"
|
||||||
#include "Vehicle.h"
|
#include "Vehicle.h"
|
||||||
#include "Pools.h"
|
#include "Pools.h"
|
||||||
#include "HandlingMgr.h"
|
#include "HandlingMgr.h"
|
||||||
@ -13,6 +15,7 @@
|
|||||||
#include "PointLights.h"
|
#include "PointLights.h"
|
||||||
#include "Renderer.h"
|
#include "Renderer.h"
|
||||||
#include "DMAudio.h"
|
#include "DMAudio.h"
|
||||||
|
#include "MusicManager.h"
|
||||||
#include "Radar.h"
|
#include "Radar.h"
|
||||||
|
|
||||||
bool &CVehicle::bWheelsOnlyCheat = *(bool *)0x95CD78;
|
bool &CVehicle::bWheelsOnlyCheat = *(bool *)0x95CD78;
|
||||||
@ -27,6 +30,79 @@ void *CVehicle::operator new(size_t sz, int handle) { return CPools::GetVehicleP
|
|||||||
void CVehicle::operator delete(void *p, size_t sz) { CPools::GetVehiclePool()->Delete((CVehicle*)p); }
|
void CVehicle::operator delete(void *p, size_t sz) { CPools::GetVehiclePool()->Delete((CVehicle*)p); }
|
||||||
void CVehicle::operator delete(void *p, int handle) { CPools::GetVehiclePool()->Delete((CVehicle*)p); }
|
void CVehicle::operator delete(void *p, int handle) { CPools::GetVehiclePool()->Delete((CVehicle*)p); }
|
||||||
|
|
||||||
|
CVehicle::CVehicle(uint8 CreatedBy)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
m_nCurrentGear = 0;
|
||||||
|
field_208 = 0;
|
||||||
|
m_fSteerRatio = 0.0f;
|
||||||
|
m_type = ENTITY_TYPE_VEHICLE;
|
||||||
|
VehicleCreatedBy = CreatedBy;
|
||||||
|
bIsLocked = false;
|
||||||
|
bIsLawEnforcer = false;
|
||||||
|
bIsAmbulanceOnDuty = false;
|
||||||
|
bIsFireTruckOnDuty = false;
|
||||||
|
CCarCtrl::UpdateCarCount(this, false);
|
||||||
|
m_fHealth = 1000.0f;
|
||||||
|
bEngineOn = true;
|
||||||
|
bFreebies = true;
|
||||||
|
pDriver = nil;
|
||||||
|
m_nNumPassengers = 0;
|
||||||
|
m_nNumGettingIn = 0;
|
||||||
|
m_nGettingInFlags = 0;
|
||||||
|
m_nGettingOutFlags = 0;
|
||||||
|
m_nNumMaxPassengers = 8;
|
||||||
|
for(i = 0; i < m_nNumMaxPassengers; i++)
|
||||||
|
pPassengers[i] = nil;
|
||||||
|
m_nBombTimer = 0;
|
||||||
|
m_pWhoSetMeOnFire = nil;
|
||||||
|
field_1FB = 0;
|
||||||
|
m_veh_flagB10 = false;
|
||||||
|
m_veh_flagB40 = false;
|
||||||
|
m_veh_flagB80 = false;
|
||||||
|
m_veh_flagC1 = false;
|
||||||
|
bIsDamaged = false;
|
||||||
|
m_veh_flagC8 = false;
|
||||||
|
m_veh_flagC10 = false;
|
||||||
|
m_veh_flagC4 = false;
|
||||||
|
m_veh_flagC20 = false;
|
||||||
|
bCanBeDamaged = true;
|
||||||
|
m_veh_flagC80 = false;
|
||||||
|
m_veh_flagD1 = false;
|
||||||
|
m_veh_flagD2 = false;
|
||||||
|
m_nGunFiringTime = 0;
|
||||||
|
field_214 = 0;
|
||||||
|
bLightsOn = false;
|
||||||
|
bVehicleColProcessed = false;
|
||||||
|
field_1F9 = 0;
|
||||||
|
bIsCarParkVehicle = false;
|
||||||
|
bHasAlreadyBeenRecorded = false;
|
||||||
|
m_bSirenOrAlarm = 0;
|
||||||
|
m_nCarHornTimer = 0;
|
||||||
|
field_22D = 0;
|
||||||
|
m_nAlarmState = 0;
|
||||||
|
m_nDoorLock = CARLOCK_UNLOCKED;
|
||||||
|
m_nLastWeaponDamage = -1;
|
||||||
|
field_220 = 0.0;
|
||||||
|
field_21C = field_220;
|
||||||
|
m_audioEntityId = DMAudio.CreateEntity(0, this);
|
||||||
|
if(m_audioEntityId)
|
||||||
|
DMAudio.SetEntityStatus(m_audioEntityId, true);
|
||||||
|
m_nRadioStation = CGeneral::GetRandomNumber() % USERTRACK;
|
||||||
|
m_pCurGroundEntity = nil;
|
||||||
|
field_22A = 0;
|
||||||
|
field_22B = 0;
|
||||||
|
field_22F = 0;
|
||||||
|
m_aCollPolys[0].valid = false;
|
||||||
|
m_aCollPolys[1].valid = false;
|
||||||
|
m_autoPilot.m_nCarMission = MISSION_NONE;
|
||||||
|
m_autoPilot.m_nAnimationId = TEMPACT_NONE;
|
||||||
|
m_autoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
|
||||||
|
m_autoPilot.m_flag4 = false;
|
||||||
|
m_autoPilot.m_flag10 = false;
|
||||||
|
}
|
||||||
|
|
||||||
CVehicle::~CVehicle()
|
CVehicle::~CVehicle()
|
||||||
{
|
{
|
||||||
m_nAlarmState = 0;
|
m_nAlarmState = 0;
|
||||||
@ -92,9 +168,227 @@ CVehicle::RemoveLighting(bool reset)
|
|||||||
float
|
float
|
||||||
CVehicle::GetHeightAboveRoad(void)
|
CVehicle::GetHeightAboveRoad(void)
|
||||||
{
|
{
|
||||||
return -1.0f * CModelInfo::GetModelInfo(GetModelIndex())->GetColModel()->boundingBox.min.z;
|
return -1.0f * GetColModel()->boundingBox.min.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CVehicle::FlyingControl(eFlightModel flightModel)
|
||||||
|
{
|
||||||
|
switch(flightModel){
|
||||||
|
case FLIGHT_MODEL_DODO:
|
||||||
|
{
|
||||||
|
// This seems pretty magic
|
||||||
|
|
||||||
|
// Move Left/Right
|
||||||
|
float moveSpeed = m_vecMoveSpeed.Magnitude();
|
||||||
|
float sideSpeed = DotProduct(m_vecMoveSpeed, GetRight());
|
||||||
|
float sideImpulse = -1.0f * sideSpeed / moveSpeed;
|
||||||
|
float fwdSpeed = DotProduct(m_vecMoveSpeed, GetForward());
|
||||||
|
float magic = m_vecMoveSpeed.MagnitudeSqr() * sq(fwdSpeed);
|
||||||
|
float turnImpulse = (sideImpulse*0.003f + m_fSteerAngle*0.001f) *
|
||||||
|
magic*m_fTurnMass*CTimer::GetTimeStep();
|
||||||
|
ApplyTurnForce(turnImpulse*GetRight(), -4.0f*GetForward());
|
||||||
|
|
||||||
|
float impulse = sideImpulse*0.2f *
|
||||||
|
magic*m_fMass*CTimer::GetTimeStep();
|
||||||
|
ApplyMoveForce(impulse*GetRight());
|
||||||
|
ApplyTurnForce(impulse*GetRight(), 2.0f*GetUp());
|
||||||
|
|
||||||
|
|
||||||
|
// Move Up/Down
|
||||||
|
moveSpeed = m_vecMoveSpeed.Magnitude();
|
||||||
|
float upSpeed = DotProduct(m_vecMoveSpeed, GetUp());
|
||||||
|
float upImpulse = -1.0f * upSpeed / moveSpeed;
|
||||||
|
turnImpulse = (upImpulse*0.002f + -CPad::GetPad(0)->GetSteeringUpDown()/128.0f*0.001f) *
|
||||||
|
magic*m_fTurnMass*CTimer::GetTimeStep();
|
||||||
|
ApplyTurnForce(turnImpulse*GetUp(), -4.0f*GetForward());
|
||||||
|
|
||||||
|
impulse = (upImpulse*3.5f + 0.5f)*0.05f *
|
||||||
|
magic*m_fMass*CTimer::GetTimeStep();
|
||||||
|
if(GRAVITY*m_fMass*CTimer::GetTimeStep() < impulse &&
|
||||||
|
GetPosition().z > 100.0f)
|
||||||
|
impulse = 0.9f*GRAVITY*m_fMass*CTimer::GetTimeStep();
|
||||||
|
CVector com = Multiply3x3(GetMatrix(), m_vecCentreOfMass);
|
||||||
|
ApplyMoveForce(impulse*GetUp());
|
||||||
|
ApplyTurnForce(impulse*GetUp(), 2.0f*GetUp() + com);
|
||||||
|
|
||||||
|
|
||||||
|
m_vecTurnSpeed.y *= powf(0.9f, CTimer::GetTimeStep());
|
||||||
|
moveSpeed = m_vecMoveSpeed.MagnitudeSqr();
|
||||||
|
if(moveSpeed > 2.25f)
|
||||||
|
m_vecMoveSpeed *= 1.5f/sqrt(moveSpeed);
|
||||||
|
|
||||||
|
float turnSpeed = m_vecTurnSpeed.MagnitudeSqr();
|
||||||
|
if(turnSpeed > 0.04f)
|
||||||
|
m_vecTurnSpeed *= 0.2f/sqrt(turnSpeed);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FLIGHT_MODEL_RCPLANE:
|
||||||
|
case FLIGHT_MODEL_SEAPLANE:
|
||||||
|
assert(0 && "Plane flight model not implemented");
|
||||||
|
case FLIGHT_MODEL_HELI:
|
||||||
|
assert(0 && "Heli flight model not implemented");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelContactSpeed, CVector &wheelContactPoint,
|
||||||
|
int32 wheelsOnGround, float thrust, float brake, float adhesion, int8 wheelId, float *wheelSpeed, tWheelState *wheelState, uint16 wheelStatus)
|
||||||
|
{
|
||||||
|
// BUG: using statics here is probably a bad idea
|
||||||
|
static bool bAlreadySkidding = false; // this is never reset
|
||||||
|
static bool bBraking;
|
||||||
|
static bool bDriving;
|
||||||
|
|
||||||
|
// how much force we want to apply in these axes
|
||||||
|
float fwd = 0.0f;
|
||||||
|
float right = 0.0f;
|
||||||
|
|
||||||
|
bBraking = brake != 0.0f;
|
||||||
|
if(bBraking)
|
||||||
|
thrust = 0.0f;
|
||||||
|
bDriving = thrust != 0.0f;
|
||||||
|
|
||||||
|
float contactSpeedFwd = DotProduct(wheelContactSpeed, wheelFwd);
|
||||||
|
float contactSpeedRight = DotProduct(wheelContactSpeed, wheelRight);
|
||||||
|
|
||||||
|
if(*wheelState != WHEEL_STATE_0)
|
||||||
|
bAlreadySkidding = true;
|
||||||
|
*wheelState = WHEEL_STATE_0;
|
||||||
|
|
||||||
|
adhesion *= CTimer::GetTimeStep();
|
||||||
|
if(bAlreadySkidding)
|
||||||
|
adhesion *= m_handling->fTractionLoss;
|
||||||
|
|
||||||
|
// moving sideways
|
||||||
|
if(contactSpeedRight != 0.0f){
|
||||||
|
// exert opposing force
|
||||||
|
right = -contactSpeedRight/wheelsOnGround;
|
||||||
|
|
||||||
|
if(wheelStatus == WHEEL_STATUS_BURST){
|
||||||
|
float fwdspeed = min(contactSpeedFwd, 0.3f);
|
||||||
|
right += fwdspeed * CGeneral::GetRandomNumberInRange(-0.1f, 0.1f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(bDriving){
|
||||||
|
fwd = thrust;
|
||||||
|
|
||||||
|
// limit sideways force (why?)
|
||||||
|
if(right > 0.0f){
|
||||||
|
if(right > adhesion)
|
||||||
|
right = adhesion;
|
||||||
|
}else{
|
||||||
|
if(right < -adhesion)
|
||||||
|
right = -adhesion;
|
||||||
|
}
|
||||||
|
}else if(contactSpeedFwd != 0.0f){
|
||||||
|
fwd = -contactSpeedFwd/wheelsOnGround;
|
||||||
|
|
||||||
|
if(!bBraking){
|
||||||
|
if(m_fGasPedal < 0.01f){
|
||||||
|
if(GetModelIndex() == MI_RCBANDIT)
|
||||||
|
brake = 0.2f * mod_HandlingManager.field_4 / m_fMass;
|
||||||
|
else
|
||||||
|
brake = mod_HandlingManager.field_4 / m_fMass;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(brake > adhesion){
|
||||||
|
if(fabs(contactSpeedFwd) > 0.005f)
|
||||||
|
*wheelState = WHEEL_STATE_STATIC;
|
||||||
|
}else {
|
||||||
|
if(fwd > 0.0f){
|
||||||
|
if(fwd > brake)
|
||||||
|
fwd = brake;
|
||||||
|
}else{
|
||||||
|
if(fwd < -brake)
|
||||||
|
fwd = -brake;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sq(adhesion) < sq(right) + sq(fwd)){
|
||||||
|
if(*wheelState != WHEEL_STATE_STATIC){
|
||||||
|
if(bDriving && contactSpeedFwd < 0.2f)
|
||||||
|
*wheelState = WHEEL_STATE_1;
|
||||||
|
else
|
||||||
|
*wheelState = WHEEL_STATE_2;
|
||||||
|
}
|
||||||
|
|
||||||
|
float l = sqrt(sq(right) + sq(fwd));
|
||||||
|
float tractionLoss = bAlreadySkidding ? 1.0f : m_handling->fTractionLoss;
|
||||||
|
right *= adhesion * tractionLoss / l;
|
||||||
|
fwd *= adhesion * tractionLoss / l;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(fwd != 0.0f || right != 0.0f){
|
||||||
|
CVector direction = fwd*wheelFwd + right*wheelRight;
|
||||||
|
float speed = direction.Magnitude();
|
||||||
|
direction.Normalise();
|
||||||
|
|
||||||
|
float impulse = speed*m_fMass;
|
||||||
|
float turnImpulse = speed*GetMass(wheelContactPoint, direction);
|
||||||
|
|
||||||
|
ApplyMoveForce(impulse * direction);
|
||||||
|
ApplyTurnForce(turnImpulse * direction, wheelContactPoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float
|
||||||
|
CVehicle::ProcessWheelRotation(tWheelState state, const CVector &fwd, const CVector &speed, float radius)
|
||||||
|
{
|
||||||
|
float angularVelocity;
|
||||||
|
switch(state){
|
||||||
|
case WHEEL_STATE_1:
|
||||||
|
angularVelocity = -1.1f; // constant speed forward
|
||||||
|
break;
|
||||||
|
case WHEEL_STATE_STATIC:
|
||||||
|
angularVelocity = 0.0f; // not moving
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
angularVelocity = -DotProduct(fwd, speed) / radius; // forward speed
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return angularVelocity * CTimer::GetTimeStep();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CVehicle::ExtinguishCarFire(void)
|
||||||
|
{
|
||||||
|
m_fHealth = max(m_fHealth, 300.0f);
|
||||||
|
if(m_pCarFire)
|
||||||
|
m_pCarFire->Extinguish();
|
||||||
|
if(IsCar()){
|
||||||
|
CAutomobile *car = (CAutomobile*)this;
|
||||||
|
if(car->Damage.GetEngineStatus() >= 225)
|
||||||
|
car->Damage.SetEngineStatus(215);
|
||||||
|
car->field_530 = 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CVehicle::ProcessDelayedExplosion(void)
|
||||||
|
{
|
||||||
|
if(m_nBombTimer == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(m_nBombTimer == 0){
|
||||||
|
int tick = CTimer::GetTimeStep()/60.0f*1000.0f;
|
||||||
|
if(tick > m_nBombTimer)
|
||||||
|
m_nBombTimer = 0;
|
||||||
|
else
|
||||||
|
m_nBombTimer -= tick;
|
||||||
|
|
||||||
|
if(IsCar() && ((CAutomobile*)this)->m_auto_flagA7 == 4 && (m_nBombTimer & 0xFE00) != 0xFE00)
|
||||||
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_CAR_BOMB_TICK, 0.0f);
|
||||||
|
|
||||||
|
if(FindPlayerVehicle() != this && m_pWhoSetMeOnFire == FindPlayerPed())
|
||||||
|
CWorld::Players[CWorld::PlayerInFocus].AwardMoneyForExplosion(this);
|
||||||
|
BlowUpCar(m_pWhoSetMeOnFire);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CVehicle::IsLawEnforcementVehicle(void)
|
CVehicle::IsLawEnforcementVehicle(void)
|
||||||
@ -442,7 +736,7 @@ CVehicle::IsSphereTouchingVehicle(float sx, float sy, float sz, float radius)
|
|||||||
float x, y, z;
|
float x, y, z;
|
||||||
// sphere relative to vehicle
|
// sphere relative to vehicle
|
||||||
CVector sph = CVector(sx, sy, sz) - GetPosition();
|
CVector sph = CVector(sx, sy, sz) - GetPosition();
|
||||||
CColModel *colmodel = CModelInfo::GetModelInfo(GetModelIndex())->GetColModel();
|
CColModel *colmodel = GetColModel();
|
||||||
|
|
||||||
x = DotProduct(sph, GetRight());
|
x = DotProduct(sph, GetRight());
|
||||||
if(colmodel->boundingBox.min.x - radius > x ||
|
if(colmodel->boundingBox.min.x - radius > x ||
|
||||||
@ -477,6 +771,11 @@ STARTPATCHES
|
|||||||
InjectHook(0x4A7E60, &CVehicle_::RemoveLighting_, PATCH_JUMP);
|
InjectHook(0x4A7E60, &CVehicle_::RemoveLighting_, PATCH_JUMP);
|
||||||
InjectHook(0x417E60, &CVehicle_::GetHeightAboveRoad_, PATCH_JUMP);
|
InjectHook(0x417E60, &CVehicle_::GetHeightAboveRoad_, PATCH_JUMP);
|
||||||
|
|
||||||
|
InjectHook(0x552BB0, &CVehicle::FlyingControl, PATCH_JUMP);
|
||||||
|
InjectHook(0x5512E0, &CVehicle::ProcessWheel, PATCH_JUMP);
|
||||||
|
InjectHook(0x551280, &CVehicle::ProcessWheelRotation, PATCH_JUMP);
|
||||||
|
InjectHook(0x552AF0, &CVehicle::ExtinguishCarFire, PATCH_JUMP);
|
||||||
|
InjectHook(0x551C90, &CVehicle::ProcessDelayedExplosion, PATCH_JUMP);
|
||||||
InjectHook(0x552880, &CVehicle::IsLawEnforcementVehicle, PATCH_JUMP);
|
InjectHook(0x552880, &CVehicle::IsLawEnforcementVehicle, PATCH_JUMP);
|
||||||
InjectHook(0x552820, &CVehicle::ChangeLawEnforcerState, PATCH_JUMP);
|
InjectHook(0x552820, &CVehicle::ChangeLawEnforcerState, PATCH_JUMP);
|
||||||
InjectHook(0x552200, &CVehicle::UsesSiren, PATCH_JUMP);
|
InjectHook(0x552200, &CVehicle::UsesSiren, PATCH_JUMP);
|
||||||
|
@ -88,6 +88,14 @@ enum eLights
|
|||||||
VEHLIGHT_REAR_RIGHT,
|
VEHLIGHT_REAR_RIGHT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum eWheels
|
||||||
|
{
|
||||||
|
VEHWHEEL_FRONT_LEFT,
|
||||||
|
VEHWHEEL_FRONT_RIGHT,
|
||||||
|
VEHWHEEL_REAR_LEFT,
|
||||||
|
VEHWHEEL_REAR_RIGHT,
|
||||||
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
CAR_PIECE_WHEEL_LF = 13,
|
CAR_PIECE_WHEEL_LF = 13,
|
||||||
@ -96,6 +104,23 @@ enum
|
|||||||
CAR_PIECE_WHEEL_RR,
|
CAR_PIECE_WHEEL_RR,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum tWheelState
|
||||||
|
{
|
||||||
|
WHEEL_STATE_0 = 0,
|
||||||
|
WHEEL_STATE_1 = 1, // constant velocity
|
||||||
|
WHEEL_STATE_2 = 2, // normal
|
||||||
|
WHEEL_STATE_STATIC = 3, // not moving
|
||||||
|
};
|
||||||
|
|
||||||
|
enum eFlightModel
|
||||||
|
{
|
||||||
|
FLIGHT_MODEL_DODO,
|
||||||
|
// not used in III
|
||||||
|
FLIGHT_MODEL_RCPLANE,
|
||||||
|
FLIGHT_MODEL_HELI,
|
||||||
|
FLIGHT_MODEL_SEAPLANE
|
||||||
|
};
|
||||||
|
|
||||||
class CVehicle : public CPhysical
|
class CVehicle : public CPhysical
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -115,7 +140,7 @@ public:
|
|||||||
int8 m_nGettingOutFlags;
|
int8 m_nGettingOutFlags;
|
||||||
uint8 m_nNumMaxPassengers;
|
uint8 m_nNumMaxPassengers;
|
||||||
char field_1CD[19];
|
char field_1CD[19];
|
||||||
CEntity *m_pCurSurface;
|
CEntity *m_pCurGroundEntity;
|
||||||
CFire *m_pCarFire;
|
CFire *m_pCarFire;
|
||||||
float m_fSteerAngle;
|
float m_fSteerAngle;
|
||||||
float m_fGasPedal;
|
float m_fGasPedal;
|
||||||
@ -142,19 +167,19 @@ public:
|
|||||||
uint8 m_veh_flagB80 : 1;
|
uint8 m_veh_flagB80 : 1;
|
||||||
|
|
||||||
uint8 m_veh_flagC1 : 1;
|
uint8 m_veh_flagC1 : 1;
|
||||||
uint8 m_veh_flagC2 : 1; // bIsDamaged
|
uint8 bIsDamaged : 1; // This vehicle has been damaged and is displaying all its components
|
||||||
uint8 m_veh_flagC4 : 1;
|
uint8 m_veh_flagC4 : 1;
|
||||||
uint8 m_veh_flagC8 : 1;
|
uint8 m_veh_flagC8 : 1;
|
||||||
uint8 m_veh_flagC10 : 1;
|
uint8 m_veh_flagC10 : 1;
|
||||||
uint8 m_veh_flagC20 : 1;
|
uint8 m_veh_flagC20 : 1;
|
||||||
uint8 m_veh_flagC40 : 1;
|
uint8 bCanBeDamaged : 1; // Set to FALSE during cut scenes to avoid explosions
|
||||||
uint8 m_veh_flagC80 : 1;
|
uint8 m_veh_flagC80 : 1;
|
||||||
|
|
||||||
uint8 m_veh_flagD1 : 1;
|
uint8 m_veh_flagD1 : 1;
|
||||||
uint8 m_veh_flagD2 : 1;
|
uint8 m_veh_flagD2 : 1;
|
||||||
uint8 m_veh_flagD4 : 1;
|
uint8 bVehicleColProcessed : 1;// Has ProcessEntityCollision been processed for this car?
|
||||||
uint8 m_veh_flagD8 : 1;
|
uint8 bIsCarParkVehicle : 1; // Car has been created using the special CAR_PARK script command
|
||||||
uint8 bRecordedForReplay : 1;
|
uint8 bHasAlreadyBeenRecorded : 1; // Used for replays
|
||||||
uint8 m_veh_flagD20 : 1;
|
uint8 m_veh_flagD20 : 1;
|
||||||
uint8 m_veh_flagD40 : 1;
|
uint8 m_veh_flagD40 : 1;
|
||||||
uint8 m_veh_flagD80 : 1;
|
uint8 m_veh_flagD80 : 1;
|
||||||
@ -171,7 +196,7 @@ public:
|
|||||||
uint32 m_nTimeOfDeath;
|
uint32 m_nTimeOfDeath;
|
||||||
int16 field_214;
|
int16 field_214;
|
||||||
int16 m_nBombTimer; // goes down with each frame
|
int16 m_nBombTimer; // goes down with each frame
|
||||||
CPed *m_pWhoDetonatedMe;
|
CPed *m_pWhoSetMeOnFire;
|
||||||
float field_21C;
|
float field_21C;
|
||||||
float field_220;
|
float field_220;
|
||||||
eCarLock m_nDoorLock;
|
eCarLock m_nDoorLock;
|
||||||
@ -181,11 +206,9 @@ public:
|
|||||||
int8 field_22B;
|
int8 field_22B;
|
||||||
uint8 m_nCarHornTimer;
|
uint8 m_nCarHornTimer;
|
||||||
int8 field_22D;
|
int8 field_22D;
|
||||||
uint8 m_nSirenOrAlarm;
|
bool m_bSirenOrAlarm;
|
||||||
int8 field_22F;
|
int8 field_22F;
|
||||||
// TODO: this is an array
|
CStoredCollPoly m_aCollPolys[2]; // poly which is under front/rear part of car
|
||||||
CStoredCollPoly m_frontCollPoly; // poly which is under front part of car
|
|
||||||
CStoredCollPoly m_rearCollPoly; // poly which is under rear part of car
|
|
||||||
float m_fSteerRatio;
|
float m_fSteerRatio;
|
||||||
eVehicleType m_vehType;
|
eVehicleType m_vehType;
|
||||||
|
|
||||||
@ -194,6 +217,8 @@ public:
|
|||||||
static void operator delete(void*, size_t);
|
static void operator delete(void*, size_t);
|
||||||
static void operator delete(void*, int);
|
static void operator delete(void*, int);
|
||||||
|
|
||||||
|
CVehicle(void) {} // FAKE
|
||||||
|
CVehicle(uint8 CreatedBy);
|
||||||
~CVehicle(void);
|
~CVehicle(void);
|
||||||
// from CEntity
|
// from CEntity
|
||||||
void SetModelIndex(uint32 id);
|
void SetModelIndex(uint32 id);
|
||||||
@ -224,6 +249,13 @@ public:
|
|||||||
bool IsTrain(void) { return m_vehType == VEHICLE_TYPE_TRAIN; }
|
bool IsTrain(void) { return m_vehType == VEHICLE_TYPE_TRAIN; }
|
||||||
bool IsHeli(void) { return m_vehType == VEHICLE_TYPE_HELI; }
|
bool IsHeli(void) { return m_vehType == VEHICLE_TYPE_HELI; }
|
||||||
bool IsPlane(void) { return m_vehType == VEHICLE_TYPE_PLANE; }
|
bool IsPlane(void) { return m_vehType == VEHICLE_TYPE_PLANE; }
|
||||||
|
|
||||||
|
void FlyingControl(eFlightModel flightModel);
|
||||||
|
void ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelContactSpeed, CVector &wheelContactPoint,
|
||||||
|
int32 wheelsOnGround, float thrust, float brake, float adhesion, int8 wheelId, float *wheelSpeed, tWheelState *wheelState, uint16 wheelStatus);
|
||||||
|
void ExtinguishCarFire(void);
|
||||||
|
void ProcessDelayedExplosion(void);
|
||||||
|
float ProcessWheelRotation(tWheelState state, const CVector &fwd, const CVector &speed, float radius);
|
||||||
bool IsLawEnforcementVehicle(void);
|
bool IsLawEnforcementVehicle(void);
|
||||||
void ChangeLawEnforcerState(uint8 enable);
|
void ChangeLawEnforcerState(uint8 enable);
|
||||||
bool UsesSiren(uint32 id);
|
bool UsesSiren(uint32 id);
|
||||||
@ -255,7 +287,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(CVehicle) == 0x288, "CVehicle: error");
|
static_assert(sizeof(CVehicle) == 0x288, "CVehicle: error");
|
||||||
static_assert(offsetof(CVehicle, m_pCurSurface) == 0x1E0, "CVehicle: error");
|
static_assert(offsetof(CVehicle, m_pCurGroundEntity) == 0x1E0, "CVehicle: error");
|
||||||
static_assert(offsetof(CVehicle, m_nAlarmState) == 0x1A0, "CVehicle: error");
|
static_assert(offsetof(CVehicle, m_nAlarmState) == 0x1A0, "CVehicle: error");
|
||||||
static_assert(offsetof(CVehicle, m_nLastWeaponDamage) == 0x228, "CVehicle: error");
|
static_assert(offsetof(CVehicle, m_nLastWeaponDamage) == 0x228, "CVehicle: error");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user