merge with upstream

This commit is contained in:
Nikolay Korolev 2020-03-29 18:51:18 +03:00
commit 24b8c7819c
46 changed files with 847 additions and 589 deletions

View File

@ -6,9 +6,6 @@
#include "Curves.h" #include "Curves.h"
#include "PathFind.h" #include "PathFind.h"
#if 0
WRAPPER void CAutoPilot::ModifySpeed(float) { EAXJMP(0x4137B0); }
#else
void CAutoPilot::ModifySpeed(float speed) void CAutoPilot::ModifySpeed(float speed)
{ {
m_fMaxTrafficSpeed = max(0.01f, speed); m_fMaxTrafficSpeed = max(0.01f, speed);
@ -41,7 +38,6 @@ void CAutoPilot::ModifySpeed(float speed)
m_nTimeEnteredCurve = CTimer::GetTimeInMilliseconds() - positionBetweenNodes * m_nSpeedScaleFactor; m_nTimeEnteredCurve = CTimer::GetTimeInMilliseconds() - positionBetweenNodes * m_nSpeedScaleFactor;
#endif #endif
} }
#endif
void CAutoPilot::RemoveOnePathNode() void CAutoPilot::RemoveOnePathNode()
{ {

View File

@ -881,9 +881,7 @@ CCarCtrl::SlowCarOnRailsDownForTrafficAndLights(CVehicle* pVehicle)
pVehicle->AutoPilot.ModifySpeed(max(maxSpeed, curSpeed - 0.5f * CTimer::GetTimeStep())); pVehicle->AutoPilot.ModifySpeed(max(maxSpeed, curSpeed - 0.5f * CTimer::GetTimeStep()));
} }
} }
#if 0
WRAPPER void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList&, CVehicle*, float, float, float, float, float*, float) { EAXJMP(0x419300); }
#else
void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList& lst, CVehicle* pVehicle, float x_inf, float y_inf, float x_sup, float y_sup, float* pSpeed, float curSpeed) void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList& lst, CVehicle* pVehicle, float x_inf, float y_inf, float x_sup, float y_sup, float* pSpeed, float curSpeed)
{ {
float frontOffset = pVehicle->GetModelInfo()->GetColModel()->boundingBox.max.y; float frontOffset = pVehicle->GetModelInfo()->GetColModel()->boundingBox.max.y;
@ -991,7 +989,6 @@ void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList& lst, CVehicle* pVehicle, f
} }
} }
} }
#endif
void CCarCtrl::SlowCarDownForCarsSectorList(CPtrList& lst, CVehicle* pVehicle, float x_inf, float y_inf, float x_sup, float y_sup, float* pSpeed, float curSpeed) void CCarCtrl::SlowCarDownForCarsSectorList(CPtrList& lst, CVehicle* pVehicle, float x_inf, float y_inf, float x_sup, float y_sup, float* pSpeed, float curSpeed)
{ {
@ -1055,9 +1052,6 @@ void CCarCtrl::SlowCarDownForOtherCar(CEntity* pOtherEntity, CVehicle* pVehicle,
} }
} }
#if 0
WRAPPER float CCarCtrl::TestCollisionBetween2MovingRects(CVehicle* pVehicleA, CVehicle* pVehicleB, float projectionX, float projectionY, CVector* pForwardA, CVector* pForwardB, uint8 id) { EAXJMP(0x41A020); }
#else
float CCarCtrl::TestCollisionBetween2MovingRects(CVehicle* pVehicleA, CVehicle* pVehicleB, float projectionX, float projectionY, CVector* pForwardA, CVector* pForwardB, uint8 id) float CCarCtrl::TestCollisionBetween2MovingRects(CVehicle* pVehicleA, CVehicle* pVehicleB, float projectionX, float projectionY, CVector* pForwardA, CVector* pForwardB, uint8 id)
{ {
CVector2D vecBToA = pVehicleA->GetPosition() - pVehicleB->GetPosition(); CVector2D vecBToA = pVehicleA->GetPosition() - pVehicleB->GetPosition();
@ -1180,7 +1174,6 @@ float CCarCtrl::TestCollisionBetween2MovingRects(CVehicle* pVehicleA, CVehicle*
} }
return proximity; return proximity;
} }
#endif
float CCarCtrl::FindAngleToWeaveThroughTraffic(CVehicle* pVehicle, CPhysical* pTarget, float angleToTarget, float angleForward) float CCarCtrl::FindAngleToWeaveThroughTraffic(CVehicle* pVehicle, CPhysical* pTarget, float angleToTarget, float angleForward)
{ {

View File

@ -2,9 +2,6 @@
#include "patcher.h" #include "patcher.h"
#include "Curves.h" #include "Curves.h"
#if 0
WRAPPER float CCurves::CalcSpeedScaleFactor(CVector*, CVector*, float, float, float, float) { EAXJMP(0x420410); }
#else
float CCurves::CalcSpeedScaleFactor(CVector* pPoint1, CVector* pPoint2, float dir1X, float dir1Y, float dir2X, float dir2Y) float CCurves::CalcSpeedScaleFactor(CVector* pPoint1, CVector* pPoint2, float dir1X, float dir1Y, float dir2X, float dir2Y)
{ {
CVector2D dir1(dir1X, dir1Y); CVector2D dir1(dir1X, dir1Y);
@ -16,11 +13,7 @@ float CCurves::CalcSpeedScaleFactor(CVector* pPoint1, CVector* pPoint2, float di
else else
return ((1.0f - dp) * 0.2f + 1.0f) * distance; return ((1.0f - dp) * 0.2f + 1.0f) * distance;
} }
#endif
#if 0
WRAPPER void CCurves::CalcCurvePoint(CVector*, CVector*, CVector*, CVector*, float, int32, CVector*, CVector*) { EAXJMP(0x4204D0); }
#else
void CCurves::CalcCurvePoint(CVector* pPos1, CVector* pPos2, CVector* pDir1, CVector* pDir2, float between, int32 timeOnCurve, CVector* pOutPos, CVector* pOutDir) void CCurves::CalcCurvePoint(CVector* pPos1, CVector* pPos2, CVector* pDir1, CVector* pDir2, float between, int32 timeOnCurve, CVector* pOutPos, CVector* pOutDir)
{ {
float actualFactor = CalcSpeedScaleFactor(pPos1, pPos2, pDir1->x, pDir1->y, pDir2->x, pDir2->y); float actualFactor = CalcSpeedScaleFactor(pPos1, pPos2, pDir1->x, pDir1->y, pDir2->x, pDir2->y);
@ -36,4 +29,3 @@ void CCurves::CalcCurvePoint(CVector* pPos1, CVector* pPos2, CVector* pDir1, CVe
(dir1.y * (1.0f - curveCoef) + dir2.y * curveCoef) / (timeOnCurve * 0.001f), (dir1.y * (1.0f - curveCoef) + dir2.y * curveCoef) / (timeOnCurve * 0.001f),
0.0f); 0.0f);
} }
#endif

View File

@ -162,9 +162,6 @@ CDarkel::ReadStatus()
return Status; return Status;
} }
#if 0
WRAPPER void CDarkel::RegisterCarBlownUpByPlayer(CVehicle *vehicle) { EAXJMP(0x421070); }
#else
void void
CDarkel::RegisterCarBlownUpByPlayer(CVehicle *vehicle) CDarkel::RegisterCarBlownUpByPlayer(CVehicle *vehicle)
{ {
@ -178,11 +175,7 @@ CDarkel::RegisterCarBlownUpByPlayer(CVehicle *vehicle)
RegisteredKills[vehicle->GetModelIndex()]++; RegisteredKills[vehicle->GetModelIndex()]++;
CStats::CarsExploded++; CStats::CarsExploded++;
} }
#endif
#if 0
WRAPPER void CDarkel::RegisterKillByPlayer(CPed *victim, eWeaponType weapontype, bool headshot) { EAXJMP(0x420F60); }
#else
void void
CDarkel::RegisterKillByPlayer(CPed *victim, eWeaponType weapon, bool headshot) CDarkel::RegisterKillByPlayer(CPed *victim, eWeaponType weapon, bool headshot)
{ {
@ -207,7 +200,6 @@ CDarkel::RegisterKillByPlayer(CPed *victim, eWeaponType weapon, bool headshot)
CStats::HeadsPopped++; CStats::HeadsPopped++;
CStats::KillsSinceLastCheckpoint++; CStats::KillsSinceLastCheckpoint++;
} }
#endif
void void
CDarkel::RegisterKillNotByPlayer(CPed* victim, eWeaponType weapontype) CDarkel::RegisterKillNotByPlayer(CPed* victim, eWeaponType weapontype)
@ -222,9 +214,6 @@ CDarkel::ResetModelsKilledByPlayer()
RegisteredKills[i] = 0; RegisteredKills[i] = 0;
} }
#if 0
WRAPPER void CDarkel::ResetOnPlayerDeath() { EAXJMP(0x420E70); }
#else
void void
CDarkel::ResetOnPlayerDeath() CDarkel::ResetOnPlayerDeath()
{ {
@ -253,11 +242,7 @@ CDarkel::ResetOnPlayerDeath()
player->MakeChangesForNewWeapon(player->m_currentWeapon); player->MakeChangesForNewWeapon(player->m_currentWeapon);
} }
} }
#endif
#if 0
WRAPPER void CDarkel::StartFrenzy(eWeaponType weaponType, int32 time, uint16 kill, int32 modelId0, wchar *text, int32 modelId2, int32 modelId3, int32 modelId4, bool standardSound, bool needHeadShot) { EAXJMP(0x4210E0); }
#else
void void
CDarkel::StartFrenzy(eWeaponType weaponType, int32 time, uint16 kill, int32 modelId0, wchar *text, int32 modelId2, int32 modelId3, int32 modelId4, bool standardSound, bool needHeadShot) CDarkel::StartFrenzy(eWeaponType weaponType, int32 time, uint16 kill, int32 modelId0, wchar *text, int32 modelId2, int32 modelId3, int32 modelId4, bool standardSound, bool needHeadShot)
{ {
@ -306,7 +291,6 @@ CDarkel::StartFrenzy(eWeaponType weaponType, int32 time, uint16 kill, int32 mode
if (CDarkel::bStandardSoundAndMessages) if (CDarkel::bStandardSoundAndMessages)
DMAudio.PlayFrontEndSound(SOUND_RAMPAGE_START, 0); DMAudio.PlayFrontEndSound(SOUND_RAMPAGE_START, 0);
} }
#endif
void void
CDarkel::Update() CDarkel::Update()

View File

@ -57,7 +57,7 @@ CGameLogic::SortOutStreamingAndMemory(const CVector &pos)
CStreaming::FlushRequestList(); CStreaming::FlushRequestList();
CStreaming::DeleteRwObjectsAfterDeath(pos); CStreaming::DeleteRwObjectsAfterDeath(pos);
CStreaming::RemoveUnusedModelsInLoadedList(); CStreaming::RemoveUnusedModelsInLoadedList();
CGame::DrasticTidyUpMemory(); CGame::DrasticTidyUpMemory(true);
CStreaming::LoadScene(pos); CStreaming::LoadScene(pos);
CTimer::Update(); CTimer::Update();
} }

View File

@ -14,7 +14,7 @@ CGangInfo::CGangInfo() :
m_Weapon2(WEAPONTYPE_UNARMED) m_Weapon2(WEAPONTYPE_UNARMED)
{} {}
void CGangs::Initialize(void) void CGangs::Initialise(void)
{ {
Gang[GANG_MAFIA].m_nVehicleMI = MI_MAFIA; Gang[GANG_MAFIA].m_nVehicleMI = MI_MAFIA;
Gang[GANG_TRIAD].m_nVehicleMI = MI_BELLYUP; Gang[GANG_TRIAD].m_nVehicleMI = MI_BELLYUP;
@ -67,7 +67,7 @@ VALIDATESAVEBUF(*size);
void CGangs::LoadAllGangData(uint8 *buf, uint32 size) void CGangs::LoadAllGangData(uint8 *buf, uint32 size)
{ {
Initialize(); Initialise();
INITSAVEBUF INITSAVEBUF
// original: SkipSaveBuf(buf, SAVE_HEADER_SIZE); // original: SkipSaveBuf(buf, SAVE_HEADER_SIZE);
@ -79,7 +79,7 @@ VALIDATESAVEBUF(size);
} }
STARTPATCHES STARTPATCHES
InjectHook(0x4C3FB0, CGangs::Initialize, PATCH_JUMP); InjectHook(0x4C3FB0, CGangs::Initialise, PATCH_JUMP);
InjectHook(0x4C4010, CGangs::SetGangVehicleModel, PATCH_JUMP); InjectHook(0x4C4010, CGangs::SetGangVehicleModel, PATCH_JUMP);
InjectHook(0x4C4030, CGangs::SetGangWeapons, PATCH_JUMP); InjectHook(0x4C4030, CGangs::SetGangWeapons, PATCH_JUMP);
InjectHook(0x4C4050, CGangs::SetGangPedModelOverride, PATCH_JUMP); InjectHook(0x4C4050, CGangs::SetGangPedModelOverride, PATCH_JUMP);

View File

@ -28,7 +28,7 @@ enum {
class CGangs class CGangs
{ {
public: public:
static void Initialize(void); static void Initialise(void);
static void SetGangVehicleModel(int16, int32); static void SetGangVehicleModel(int16, int32);
static void SetGangWeapons(int16, int32, int32); static void SetGangWeapons(int16, int32, int32);
static void SetGangPedModelOverride(int16, int8); static void SetGangPedModelOverride(int16, int8);

View File

@ -113,9 +113,6 @@ static void(*CBArray_RE3[])(CAnimBlendAssociation*, void*) =
&CPed::PedLandCB, &FinishFuckUCB, &CPed::RestoreHeadingRateCB, &CPed::PedSetQuickDraggedOutCarPositionCB, &CPed::PedSetDraggedOutCarPositionCB &CPed::PedLandCB, &FinishFuckUCB, &CPed::RestoreHeadingRateCB, &CPed::PedSetQuickDraggedOutCarPositionCB, &CPed::PedSetDraggedOutCarPositionCB
}; };
#if 0
WRAPPER uint8 FindCBFunctionID(void(*f)(CAnimBlendAssociation*, void*)) { EAXJMP(0x584E70); }
#else
static uint8 FindCBFunctionID(void(*f)(CAnimBlendAssociation*, void*)) static uint8 FindCBFunctionID(void(*f)(CAnimBlendAssociation*, void*))
{ {
for (int i = 0; i < sizeof(CBArray) / sizeof(*CBArray); i++){ for (int i = 0; i < sizeof(CBArray) / sizeof(*CBArray); i++){
@ -128,16 +125,12 @@ static uint8 FindCBFunctionID(void(*f)(CAnimBlendAssociation*, void*))
} }
return 0; return 0;
} }
#endif
static void(*FindCBFunction(uint8 id))(CAnimBlendAssociation*, void*) static void(*FindCBFunction(uint8 id))(CAnimBlendAssociation*, void*)
{ {
return CBArray_RE3[id]; return CBArray_RE3[id];
} }
#if 0
WRAPPER static void ApplyPanelDamageToCar(uint32, CAutomobile*, bool) { EAXJMP(0x584EA0); }
#else
static void ApplyPanelDamageToCar(uint32 panels, CAutomobile* vehicle, bool flying) static void ApplyPanelDamageToCar(uint32 panels, CAutomobile* vehicle, bool flying)
{ {
if(vehicle->Damage.GetPanelStatus(VEHPANEL_FRONT_LEFT) != CDamageManager::GetPanelStatus(panels, VEHPANEL_FRONT_LEFT)){ if(vehicle->Damage.GetPanelStatus(VEHPANEL_FRONT_LEFT) != CDamageManager::GetPanelStatus(panels, VEHPANEL_FRONT_LEFT)){
@ -169,7 +162,6 @@ static void ApplyPanelDamageToCar(uint32 panels, CAutomobile* vehicle, bool flyi
vehicle->SetPanelDamage(CAR_BUMP_REAR, VEHBUMPER_REAR, flying); vehicle->SetPanelDamage(CAR_BUMP_REAR, VEHBUMPER_REAR, flying);
} }
} }
#endif
void PrintElementsInPtrList(void) void PrintElementsInPtrList(void)
{ {
@ -262,9 +254,6 @@ void CReplay::Update(void)
} }
} }
#if 0
WRAPPER void CReplay::RecordThisFrame(void) { EAXJMP(0x5932B0); }
#else
void CReplay::RecordThisFrame(void) void CReplay::RecordThisFrame(void)
{ {
#ifdef FIX_REPLAY_BUGS #ifdef FIX_REPLAY_BUGS
@ -377,11 +366,7 @@ void CReplay::RecordThisFrame(void)
MarkEverythingAsNew(); MarkEverythingAsNew();
#endif #endif
} }
#endif
#if 0
WRAPPER void CReplay::StorePedUpdate(CPed *ped, int id) { EAXJMP(0x5935B0); }
#else
void CReplay::StorePedUpdate(CPed *ped, int id) void CReplay::StorePedUpdate(CPed *ped, int id)
{ {
tPedUpdatePacket* pp = (tPedUpdatePacket*)&Record.m_pBase[Record.m_nOffset]; tPedUpdatePacket* pp = (tPedUpdatePacket*)&Record.m_pBase[Record.m_nOffset];
@ -399,11 +384,7 @@ void CReplay::StorePedUpdate(CPed *ped, int id)
StorePedAnimation(ped, &pp->anim_state); StorePedAnimation(ped, &pp->anim_state);
Record.m_nOffset += sizeof(tPedUpdatePacket); Record.m_nOffset += sizeof(tPedUpdatePacket);
} }
#endif
#if 0
WRAPPER void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state) { EAXJMP(0x593670); }
#else
void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state) void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
{ {
CAnimBlendAssociation* second; CAnimBlendAssociation* second;
@ -442,11 +423,7 @@ void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
state->partBlendAmount = 0; state->partBlendAmount = 0;
} }
} }
#endif
#if 0
WRAPPER void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state) { EAXJMP(0x593BB0); }
#else
void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state) void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state)
{ {
for (int i = 0; i < NUM_MAIN_ANIMS_IN_REPLAY; i++){ for (int i = 0; i < NUM_MAIN_ANIMS_IN_REPLAY; i++){
@ -503,10 +480,7 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
} }
} }
} }
#endif
#if 0
WRAPPER void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayBuffer *buffer) { EAXJMP(0x594050); }
#else
void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayBuffer *buffer) void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayBuffer *buffer)
{ {
tPedUpdatePacket *pp = (tPedUpdatePacket*)&buffer->m_pBase[buffer->m_nOffset]; tPedUpdatePacket *pp = (tPedUpdatePacket*)&buffer->m_pBase[buffer->m_nOffset];
@ -543,11 +517,7 @@ void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayB
CWorld::Add(ped); CWorld::Add(ped);
buffer->m_nOffset += sizeof(tPedUpdatePacket); buffer->m_nOffset += sizeof(tPedUpdatePacket);
} }
#endif
#if 0
WRAPPER void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state) { EAXJMP(0x5942A0); }
#else
void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state) void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state)
{ {
CAnimBlendAssociation* anim1 = CAnimManager::BlendAnimation( CAnimBlendAssociation* anim1 = CAnimManager::BlendAnimation(
@ -585,11 +555,7 @@ void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state)
} }
} }
} }
#endif
#if 0
WRAPPER void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state) { EAXJMP(0x5944B0); }
#else
void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state) void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state)
{ {
#ifdef FIX_REPLAY_BUGS #ifdef FIX_REPLAY_BUGS
@ -658,11 +624,7 @@ void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationSt
anim->SetDeleteCallback(FindCBFunction(callback & 0x7F), ped); anim->SetDeleteCallback(FindCBFunction(callback & 0x7F), ped);
} }
} }
#endif
#if 0
WRAPPER void CReplay::PlaybackThisFrame(void) { EAXJMP(0x5946B0); }
#else
void CReplay::PlaybackThisFrame(void) void CReplay::PlaybackThisFrame(void)
{ {
static int FrameSloMo = 0; static int FrameSloMo = 0;
@ -687,7 +649,6 @@ void CReplay::PlaybackThisFrame(void)
DMAudio.SetEffectsFadeVol(0); DMAudio.SetEffectsFadeVol(0);
DMAudio.SetMusicFadeVol(0); DMAudio.SetMusicFadeVol(0);
} }
#endif
// next two functions are only found in mobile version // next two functions are only found in mobile version
// most likely they were optimized out for being unused // most likely they were optimized out for being unused
@ -712,9 +673,6 @@ bool CReplay::FastForwardToTime(uint32 start)
return true; return true;
} }
#if 0
WRAPPER void CReplay::StoreCarUpdate(CVehicle *vehicle, int id) { EAXJMP(0x5947F0); }
#else
void CReplay::StoreCarUpdate(CVehicle *vehicle, int id) void CReplay::StoreCarUpdate(CVehicle *vehicle, int id)
{ {
tVehicleUpdatePacket* vp = (tVehicleUpdatePacket*)&Record.m_pBase[Record.m_nOffset]; tVehicleUpdatePacket* vp = (tVehicleUpdatePacket*)&Record.m_pBase[Record.m_nOffset];
@ -750,11 +708,7 @@ void CReplay::StoreCarUpdate(CVehicle *vehicle, int id)
} }
Record.m_nOffset += sizeof(tVehicleUpdatePacket); Record.m_nOffset += sizeof(tVehicleUpdatePacket);
} }
#endif
#if 0
WRAPPER void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressInReplayBuffer *buffer) { EAXJMP(0x594D10); }
#else
void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressInReplayBuffer *buffer) void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressInReplayBuffer *buffer)
{ {
tVehicleUpdatePacket* vp = (tVehicleUpdatePacket*)&buffer->m_pBase[buffer->m_nOffset]; tVehicleUpdatePacket* vp = (tVehicleUpdatePacket*)&buffer->m_pBase[buffer->m_nOffset];
@ -824,11 +778,7 @@ void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressI
((CBoat*)vehicle)->m_bIsAnchored = false; ((CBoat*)vehicle)->m_bIsAnchored = false;
} }
} }
#endif
#if 0
WRAPPER bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, float interpolation, uint32 *pTimer) { EAXJMP(0x595240); }
#else
bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, float interpolation, uint32 *pTimer){ bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, float interpolation, uint32 *pTimer){
/* Mistake. Not even sure what this is even doing here... /* Mistake. Not even sure what this is even doing here...
* PlayerWanted is a backup to restore at the end of replay. * PlayerWanted is a backup to restore at the end of replay.
@ -1028,10 +978,7 @@ bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, flo
ProcessReplayCamera(); ProcessReplayCamera();
return false; return false;
} }
#endif
#if 0
WRAPPER void CReplay::FinishPlayback(void) { EAXJMP(0x595B20); }
#else
void CReplay::FinishPlayback(void) void CReplay::FinishPlayback(void)
{ {
if (Mode != MODE_PLAYBACK) if (Mode != MODE_PLAYBACK)
@ -1053,11 +1000,7 @@ void CReplay::FinishPlayback(void)
DMAudio.SetEffectsFadeVol(127); DMAudio.SetEffectsFadeVol(127);
DMAudio.SetMusicFadeVol(127); DMAudio.SetMusicFadeVol(127);
} }
#endif
#if 0
WRAPPER void CReplay::EmptyReplayBuffer(void) { EAXJMP(0x595BD0); }
#else
void CReplay::EmptyReplayBuffer(void) void CReplay::EmptyReplayBuffer(void)
{ {
if (Mode == MODE_PLAYBACK) if (Mode == MODE_PLAYBACK)
@ -1072,11 +1015,7 @@ void CReplay::EmptyReplayBuffer(void)
Record.m_pBase[Record.m_nOffset] = 0; Record.m_pBase[Record.m_nOffset] = 0;
MarkEverythingAsNew(); MarkEverythingAsNew();
} }
#endif
#if 0
WRAPPER void CReplay::ProcessReplayCamera(void) { EAXJMP(0x595C40); }
#else
void CReplay::ProcessReplayCamera(void) void CReplay::ProcessReplayCamera(void)
{ {
switch (CameraMode) { switch (CameraMode) {
@ -1120,11 +1059,7 @@ void CReplay::ProcessReplayCamera(void)
RwMatrixUpdate(RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera))); RwMatrixUpdate(RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera)));
RwFrameUpdateObjects(RwCameraGetFrame(TheCamera.m_pRwCamera)); RwFrameUpdateObjects(RwCameraGetFrame(TheCamera.m_pRwCamera));
} }
#endif
#if 0
WRAPPER void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float cam_z, bool load_scene) { EAXJMP(0x596030); }
#else
void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float cam_z, bool load_scene) void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float cam_z, bool load_scene)
{ {
if (Mode != MODE_RECORD) if (Mode != MODE_RECORD)
@ -1174,11 +1109,7 @@ void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float ca
if (cam_mode == REPLAYCAMMODE_ASSTORED) if (cam_mode == REPLAYCAMMODE_ASSTORED)
TheCamera.CarZoomIndicator = 5.0f; TheCamera.CarZoomIndicator = 5.0f;
} }
#endif
#if 0
WRAPPER void CReplay::StoreStuffInMem(void) { EAXJMP(0x5961F0); }
#else
void CReplay::StoreStuffInMem(void) void CReplay::StoreStuffInMem(void)
{ {
CPools::GetVehiclePool()->Store(pBuf0, pBuf1); CPools::GetVehiclePool()->Store(pBuf0, pBuf1);
@ -1223,11 +1154,7 @@ void CReplay::StoreStuffInMem(void)
StoreDetailedPedAnimation(ped, &pPedAnims[i]); StoreDetailedPedAnimation(ped, &pPedAnims[i]);
} }
} }
#endif
#if 0
WRAPPER void CReplay::RestoreStuffFromMem(void) { EAXJMP(0x5966E0); }
#else
void CReplay::RestoreStuffFromMem(void) void CReplay::RestoreStuffFromMem(void)
{ {
CPools::GetVehiclePool()->CopyBack(pBuf0, pBuf1); CPools::GetVehiclePool()->CopyBack(pBuf0, pBuf1);
@ -1388,11 +1315,7 @@ void CReplay::RestoreStuffFromMem(void)
DMAudio.SetRadioInCar(OldRadioStation); DMAudio.SetRadioInCar(OldRadioStation);
DMAudio.ChangeMusicMode(MUSICMODE_GAME); DMAudio.ChangeMusicMode(MUSICMODE_GAME);
} }
#endif
#if 0
WRAPPER void CReplay::EmptyPedsAndVehiclePools(void) { EAXJMP(0x5970E0); }
#else
void CReplay::EmptyPedsAndVehiclePools(void) void CReplay::EmptyPedsAndVehiclePools(void)
{ {
int i = CPools::GetVehiclePool()->GetSize(); int i = CPools::GetVehiclePool()->GetSize();
@ -1412,11 +1335,7 @@ void CReplay::EmptyPedsAndVehiclePools(void)
delete p; delete p;
} }
} }
#endif
#if 0
WRAPPER void CReplay::EmptyAllPools(void) { EAXJMP(0x5971B0); }
#else
void CReplay::EmptyAllPools(void) void CReplay::EmptyAllPools(void)
{ {
EmptyPedsAndVehiclePools(); EmptyPedsAndVehiclePools();
@ -1437,11 +1356,7 @@ void CReplay::EmptyAllPools(void)
delete d; delete d;
} }
} }
#endif
#if 0
WRAPPER void CReplay::MarkEverythingAsNew(void) { EAXJMP(0x597280); }
#else
void CReplay::MarkEverythingAsNew(void) void CReplay::MarkEverythingAsNew(void)
{ {
int i = CPools::GetVehiclePool()->GetSize(); int i = CPools::GetVehiclePool()->GetSize();
@ -1459,11 +1374,7 @@ void CReplay::MarkEverythingAsNew(void)
p->bHasAlreadyBeenRecorded = false; p->bHasAlreadyBeenRecorded = false;
} }
} }
#endif
#if 0
WRAPPER void CReplay::SaveReplayToHD(void) { EAXJMP(0x597330); }
#else
void CReplay::SaveReplayToHD(void) void CReplay::SaveReplayToHD(void)
{ {
CFileMgr::SetDirMyDocuments(); CFileMgr::SetDirMyDocuments();
@ -1494,11 +1405,7 @@ void CReplay::SaveReplayToHD(void)
CFileMgr::CloseFile(fw); CFileMgr::CloseFile(fw);
CFileMgr::SetDir(""); CFileMgr::SetDir("");
} }
#endif
#if 0
WRAPPER void PlayReplayFromHD(void) { EAXJMP(0x597420); }
#else
void PlayReplayFromHD(void) void PlayReplayFromHD(void)
{ {
CFileMgr::SetDirMyDocuments(); CFileMgr::SetDirMyDocuments();
@ -1530,11 +1437,7 @@ void PlayReplayFromHD(void)
CReplay::bAllowLookAroundCam = true; CReplay::bAllowLookAroundCam = true;
CReplay::StreamAllNecessaryCarsAndPeds(); CReplay::StreamAllNecessaryCarsAndPeds();
} }
#endif
#if 0
WRAPPER void CReplay::StreamAllNecessaryCarsAndPeds(void) { EAXJMP(0x597560); }
#else
void CReplay::StreamAllNecessaryCarsAndPeds(void) void CReplay::StreamAllNecessaryCarsAndPeds(void)
{ {
for (int slot = 0; slot < NUM_REPLAYBUFFERS; slot++) { for (int slot = 0; slot < NUM_REPLAYBUFFERS; slot++) {
@ -1555,11 +1458,7 @@ void CReplay::StreamAllNecessaryCarsAndPeds(void)
} }
CStreaming::LoadAllRequestedModels(false); CStreaming::LoadAllRequestedModels(false);
} }
#endif
#if 0
WRAPPER void CReplay::FindFirstFocusCoordinate(CVector *coord) { EAXJMP(0x5975E0); }
#else
void CReplay::FindFirstFocusCoordinate(CVector *coord) void CReplay::FindFirstFocusCoordinate(CVector *coord)
{ {
*coord = CVector(0.0f, 0.0f, 0.0f); *coord = CVector(0.0f, 0.0f, 0.0f);
@ -1574,11 +1473,7 @@ void CReplay::FindFirstFocusCoordinate(CVector *coord)
} }
} }
} }
#endif
#if 0
WRAPPER bool CReplay::ShouldStandardCameraBeProcessed(void) { EAXJMP(0x597680); }
#else
bool CReplay::ShouldStandardCameraBeProcessed(void) bool CReplay::ShouldStandardCameraBeProcessed(void)
{ {
if (Mode != MODE_PLAYBACK) if (Mode != MODE_PLAYBACK)
@ -1587,11 +1482,7 @@ bool CReplay::ShouldStandardCameraBeProcessed(void)
return false; return false;
return FindPlayerVehicle() != nil; return FindPlayerVehicle() != nil;
} }
#endif
#if 0
WRAPPER void CReplay::ProcessLookAroundCam(void) { EAXJMP(0x5976C0); }
#else
void CReplay::ProcessLookAroundCam(void) void CReplay::ProcessLookAroundCam(void)
{ {
if (!bAllowLookAroundCam) if (!bAllowLookAroundCam)
@ -1647,11 +1538,7 @@ void CReplay::ProcessLookAroundCam(void)
RwMatrixUpdate(RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera))); RwMatrixUpdate(RwFrameGetMatrix(RwCameraGetFrame(TheCamera.m_pRwCamera)));
RwFrameUpdateObjects(RwCameraGetFrame(TheCamera.m_pRwCamera)); RwFrameUpdateObjects(RwCameraGetFrame(TheCamera.m_pRwCamera));
} }
#endif
#if 0
WRAPPER size_t CReplay::FindSizeOfPacket(uint8 type) { EAXJMP(0x597CC0); }
#else
size_t CReplay::FindSizeOfPacket(uint8 type) size_t CReplay::FindSizeOfPacket(uint8 type)
{ {
switch (type) { switch (type) {
@ -1669,11 +1556,7 @@ size_t CReplay::FindSizeOfPacket(uint8 type)
} }
return 0; return 0;
} }
#endif
#if 0
WRAPPER void CReplay::Display(void) { EAXJMP(0x595EE0); }
#else
void CReplay::Display() void CReplay::Display()
{ {
static int TimeCount = 0; static int TimeCount = 0;
@ -1691,7 +1574,6 @@ void CReplay::Display()
if (Mode == MODE_PLAYBACK) if (Mode == MODE_PLAYBACK)
CFont::PrintString(SCREEN_SCALE_X(63.5f), SCREEN_SCALE_Y(30.0f), TheText.Get("REPLAY")); CFont::PrintString(SCREEN_SCALE_X(63.5f), SCREEN_SCALE_Y(30.0f), TheText.Get("REPLAY"));
} }
#endif
STARTPATCHES STARTPATCHES
InjectHook(0x592FE0, &CReplay::Init, PATCH_JUMP); InjectHook(0x592FE0, &CReplay::Init, PATCH_JUMP);

View File

@ -2842,9 +2842,6 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
return -1; return -1;
} }
#if 0
WRAPPER int8 CRunningScript::ProcessCommand300To399(int32 command) { EAXJMP(0x43ED30); }
#else
int8 CRunningScript::ProcessCommands300To399(int32 command) int8 CRunningScript::ProcessCommands300To399(int32 command)
{ {
switch (command) { switch (command) {
@ -3576,11 +3573,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
} }
return -1; return -1;
} }
#endif
#if 0
WRAPPER int8 CRunningScript::ProcessCommands400To499(int32 command) { EAXJMP(0x440CB0); }
#else
int8 CRunningScript::ProcessCommands400To499(int32 command) int8 CRunningScript::ProcessCommands400To499(int32 command)
{ {
switch (command) { switch (command) {
@ -4370,11 +4363,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
} }
return -1; return -1;
} }
#endif
#if 0
WRAPPER int8 CRunningScript::ProcessCommands500To599(int32 command) { EAXJMP(0x4429C0); }
#else
int8 CRunningScript::ProcessCommands500To599(int32 command) int8 CRunningScript::ProcessCommands500To599(int32 command)
{ {
switch (command) { switch (command) {
@ -5201,11 +5190,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
} }
return -1; return -1;
} }
#endif
#if 0
WRAPPER int8 CRunningScript::ProcessCommands600To699(int32 command) { EAXJMP(0x444B20); }
#else
int8 CRunningScript::ProcessCommands600To699(int32 command) int8 CRunningScript::ProcessCommands600To699(int32 command)
{ {
switch (command){ switch (command){
@ -5559,11 +5544,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
} }
return -1; return -1;
} }
#endif
#if 0
WRAPPER int8 CRunningScript::ProcessCommands700To799(int32 command) { EAXJMP(0x4458A0); }
#else
int8 CRunningScript::ProcessCommands700To799(int32 command) int8 CRunningScript::ProcessCommands700To799(int32 command)
{ {
switch (command){ switch (command){
@ -6429,11 +6410,6 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
} }
return -1; return -1;
} }
#endif
#if 0
WRAPPER int8 CRunningScript::ProcessCommands800To899(int32 command) { EAXJMP(0x448240); }
#else
int8 CRunningScript::ProcessCommands800To899(int32 command) int8 CRunningScript::ProcessCommands800To899(int32 command)
{ {
CMatrix tmp_matrix; CMatrix tmp_matrix;
@ -7515,11 +7491,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
} }
return -1; return -1;
} }
#endif
#if 0
WRAPPER int8 CRunningScript::ProcessCommands900To999(int32 command) { EAXJMP(0x44CB80); }
#else
int8 CRunningScript::ProcessCommands900To999(int32 command) int8 CRunningScript::ProcessCommands900To999(int32 command)
{ {
char str[52]; char str[52];
@ -8420,7 +8392,6 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
} }
return -1; return -1;
} }
#endif
int8 CRunningScript::ProcessCommands1000To1099(int32 command) int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{ {
@ -9819,7 +9790,7 @@ void CTheScripts::UndoBuildingSwaps()
} }
} }
void CTheScripts::UndoEntityVisibilitySettings() void CTheScripts::UndoEntityInvisibilitySettings()
{ {
for (int i = 0; i < MAX_NUM_INVISIBILITY_SETTINGS; i++) { for (int i = 0; i < MAX_NUM_INVISIBILITY_SETTINGS; i++) {
if (InvisibilitySettingArray[i]) { if (InvisibilitySettingArray[i]) {
@ -11657,7 +11628,7 @@ InjectHook(0x439040, &CTheScripts::Process, PATCH_JUMP);
InjectHook(0x439400, &CTheScripts::StartTestScript, PATCH_JUMP); InjectHook(0x439400, &CTheScripts::StartTestScript, PATCH_JUMP);
InjectHook(0x439410, &CTheScripts::IsPlayerOnAMission, PATCH_JUMP); InjectHook(0x439410, &CTheScripts::IsPlayerOnAMission, PATCH_JUMP);
InjectHook(0x44FD10, &CTheScripts::UndoBuildingSwaps, PATCH_JUMP); InjectHook(0x44FD10, &CTheScripts::UndoBuildingSwaps, PATCH_JUMP);
InjectHook(0x44FD60, &CTheScripts::UndoEntityVisibilitySettings, PATCH_JUMP); InjectHook(0x44FD60, &CTheScripts::UndoEntityInvisibilitySettings, PATCH_JUMP);
InjectHook(0x4534E0, &CTheScripts::ScriptDebugLine3D, PATCH_JUMP); InjectHook(0x4534E0, &CTheScripts::ScriptDebugLine3D, PATCH_JUMP);
InjectHook(0x453550, &CTheScripts::RenderTheScriptDebugLines, PATCH_JUMP); InjectHook(0x453550, &CTheScripts::RenderTheScriptDebugLines, PATCH_JUMP);
InjectHook(0x4535E0, &CTheScripts::SaveAllScripts, PATCH_JUMP); InjectHook(0x4535E0, &CTheScripts::SaveAllScripts, PATCH_JUMP);

View File

@ -281,7 +281,7 @@ public:
static void ClearSpaceForMissionEntity(const CVector&, CEntity*); static void ClearSpaceForMissionEntity(const CVector&, CEntity*);
static void UndoBuildingSwaps(); static void UndoBuildingSwaps();
static void UndoEntityVisibilitySettings(); static void UndoEntityInvisibilitySettings();
static void ScriptDebugLine3D(float x1, float y1, float z1, float x2, float y2, float z2, uint32 col, uint32 col2); static void ScriptDebugLine3D(float x1, float y1, float z1, float x2, float y2, float z2, uint32 col, uint32 col2);
static void RenderTheScriptDebugLines(); static void RenderTheScriptDebugLines();

View File

@ -28,6 +28,7 @@ const float DefaultFOV = 70.0f; // beta: 80.0f
bool PrintDebugCode = false; bool PrintDebugCode = false;
int16 &DebugCamMode = *(int16*)0x95CCF2; int16 &DebugCamMode = *(int16*)0x95CCF2;
bool bFreeCam = false;
void void
CCam::Init(void) CCam::Init(void)
@ -138,6 +139,11 @@ CCam::Process(void)
if(CCamera::m_bUseMouse3rdPerson) if(CCamera::m_bUseMouse3rdPerson)
Process_FollowPedWithMouse(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar); Process_FollowPedWithMouse(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
else else
#ifdef FREE_CAM
if(bFreeCam)
Process_FollowPed_Rotation(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
else
#endif
Process_FollowPed(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar); Process_FollowPed(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break; break;
// case MODE_AIMING: // case MODE_AIMING:
@ -4369,7 +4375,209 @@ CCam::Process_FollowPed_WithBinding(const CVector &CameraTarget, float TargetOri
GetVectorsReadyForRW(); GetVectorsReadyForRW();
} }
#ifdef FREE_CAM
void
CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float)
{
FOV = DefaultFOV;
const float MinDist = 2.0f;
const float MaxDist = 2.0f + TheCamera.m_fPedZoomValueSmooth;
const float BaseOffset = 0.75f; // base height of camera above target
CVector TargetCoors = CameraTarget;
TargetCoors.z += m_fSyphonModeTargetZOffSet;
TargetCoors = DoAverageOnVector(TargetCoors);
TargetCoors.z += BaseOffset; // add offset so alpha evens out to 0
// TargetCoors.z += m_fRoadOffSet;
CVector Dist = Source - TargetCoors;
CVector ToCam;
bool Shooting = false;
if(((CPed*)CamTargetEntity)->GetWeapon()->m_eWeaponType != WEAPONTYPE_UNARMED)
if(CPad::GetPad(0)->GetWeapon())
Shooting = true;
if(((CPed*)CamTargetEntity)->GetWeapon()->m_eWeaponType == WEAPONTYPE_DETONATOR ||
((CPed*)CamTargetEntity)->GetWeapon()->m_eWeaponType == WEAPONTYPE_BASEBALLBAT)
Shooting = false;
if(ResetStatics){
// Coming out of top down here probably
// so keep Beta, reset alpha and calculate vectors
Beta = CGeneral::GetATanOfXY(Dist.x, Dist.y);
Alpha = 0.0f;
Dist = MaxDist*CVector(Cos(Alpha) * Cos(Beta), Cos(Alpha) * Sin(Beta), Sin(Alpha));
Source = TargetCoors + Dist;
ResetStatics = false;
}
// Drag the camera along at the look-down offset
float CamDist = Dist.Magnitude();
if(CamDist == 0.0f)
Dist = CVector(1.0f, 1.0f, 0.0f);
else if(CamDist < MinDist)
Dist *= MinDist/CamDist;
else if(CamDist > MaxDist)
Dist *= MaxDist/CamDist;
CamDist = Dist.Magnitude();
// Beta = 0 is looking east, HALFPI is north, &c.
// Alpha positive is looking up
float GroundDist = Dist.Magnitude2D();
Beta = CGeneral::GetATanOfXY(-Dist.x, -Dist.y);
Alpha = CGeneral::GetATanOfXY(GroundDist, -Dist.z);
while(Beta >= PI) Beta -= 2.0f*PI;
while(Beta < -PI) Beta += 2.0f*PI;
while(Alpha >= PI) Alpha -= 2.0f*PI;
while(Alpha < -PI) Alpha += 2.0f*PI;
// Look around
bool UseMouse = false;
float MouseX = CPad::GetPad(0)->GetMouseX();
float MouseY = CPad::GetPad(0)->GetMouseY();
float LookLeftRight, LookUpDown;
if((MouseX != 0.0f || MouseY != 0.0f) && !CPad::GetPad(0)->ArePlayerControlsDisabled()){
UseMouse = true;
LookLeftRight = -2.5f*MouseX;
LookUpDown = 4.0f*MouseY;
}else{
LookLeftRight = -CPad::GetPad(0)->LookAroundLeftRight();
LookUpDown = CPad::GetPad(0)->LookAroundUpDown();
}
float AlphaOffset, BetaOffset;
if(UseMouse){
BetaOffset = LookLeftRight * TheCamera.m_fMouseAccelHorzntl * FOV/80.0f;
AlphaOffset = LookUpDown * TheCamera.m_fMouseAccelVertical * FOV/80.0f;
}else{
BetaOffset = LookLeftRight * fStickSens * (0.5f/10.0f) * FOV/80.0f * CTimer::GetTimeStep();
AlphaOffset = LookUpDown * fStickSens * (0.3f/10.0f) * FOV/80.0f * CTimer::GetTimeStep();
}
// Stop centering once stick has been touched
if(BetaOffset)
Rotating = false;
Beta += BetaOffset;
Alpha += AlphaOffset;
while(Beta >= PI) Beta -= 2.0f*PI;
while(Beta < -PI) Beta += 2.0f*PI;
if(Alpha > DEGTORAD(45.0f)) Alpha = DEGTORAD(45.0f);
if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
float BetaDiff = TargetOrientation+PI - Beta;
while(BetaDiff >= PI) BetaDiff -= 2.0f*PI;
while(BetaDiff < -PI) BetaDiff += 2.0f*PI;
float TargetAlpha = Alpha;
// 12deg to account for our little height offset. we're not working on the true alpha here
const float AlphaLimitUp = DEGTORAD(15.0f) + DEGTORAD(12.0f);
const float AlphaLimitDown = -DEGTORAD(15.0f) + DEGTORAD(12.0f);
if(Abs(BetaDiff) < DEGTORAD(25.0f) && ((CPed*)CamTargetEntity)->GetMoveSpeed().Magnitude2D() > 0.01f){
// Limit alpha when player is walking towards camera
if(TargetAlpha > AlphaLimitUp) TargetAlpha = AlphaLimitUp;
if(TargetAlpha < AlphaLimitDown) TargetAlpha = AlphaLimitDown;
}
WellBufferMe(TargetAlpha, &Alpha, &AlphaSpeed, 0.2f, 0.1f, true);
if(CPad::GetPad(0)->ForceCameraBehindPlayer() || Shooting){
m_fTargetBeta = TargetOrientation;
Rotating = true;
}
if(Rotating){
WellBufferMe(m_fTargetBeta, &Beta, &BetaSpeed, 0.1f, 0.06f, true);
float DeltaBeta = m_fTargetBeta - Beta;
while(DeltaBeta >= PI) DeltaBeta -= 2*PI;
while(DeltaBeta < -PI) DeltaBeta += 2*PI;
if(Abs(DeltaBeta) < 0.06f)
Rotating = false;
}
Front = CVector(Cos(Alpha) * Cos(Beta), Cos(Alpha) * Sin(Beta), Sin(Alpha));
Source = TargetCoors - Front*CamDist;
TargetCoors.z -= BaseOffset; // now get back to the real target coors again
m_cvecTargetCoorsForFudgeInter = TargetCoors;
Front = TargetCoors - Source;
Front.Normalise();
/*
* Handle collisions - taken from FollowPedWithMouse
*/
CEntity *entity;
CColPoint colPoint;
// Clip Source and fix near clip
CWorld::pIgnoreEntity = CamTargetEntity;
entity = nil;
if(CWorld::ProcessLineOfSight(TargetCoors, Source, colPoint, entity, true, true, true, true, false, false, true)){
float PedColDist = (TargetCoors - colPoint.point).Magnitude();
float ColCamDist = CamDist - PedColDist;
if(entity->IsPed() && ColCamDist > 1.0f){
// Ped in the way but not clipping through
if(CWorld::ProcessLineOfSight(colPoint.point, Source, colPoint, entity, true, true, true, true, false, false, true)){
PedColDist = (TargetCoors - colPoint.point).Magnitude();
Source = colPoint.point;
if(PedColDist < 0.9f + 0.3f)
RwCameraSetNearClipPlane(Scene.camera, max(PedColDist-0.3f, 0.05f));
}else{
RwCameraSetNearClipPlane(Scene.camera, min(ColCamDist-0.35f, 0.9f));
}
}else{
Source = colPoint.point;
if(PedColDist < 0.9f + 0.3f)
RwCameraSetNearClipPlane(Scene.camera, max(PedColDist-0.3f, 0.05f));
}
}
CWorld::pIgnoreEntity = nil;
float ViewPlaneHeight = Tan(DEGTORAD(FOV) / 2.0f);
float ViewPlaneWidth = ViewPlaneHeight * CDraw::FindAspectRatio() * fTweakFOV;
float Near = RwCameraGetNearClipPlane(Scene.camera);
float radius = ViewPlaneWidth*Near;
entity = CWorld::TestSphereAgainstWorld(Source + Front*Near, radius, nil, true, true, false, true, false, false);
int i = 0;
while(entity){
CVector CamToCol = gaTempSphereColPoints[0].point - Source;
float frontDist = DotProduct(CamToCol, Front);
float dist = (CamToCol - Front*frontDist).Magnitude() / ViewPlaneWidth;
// Try to decrease near clip
dist = max(min(Near, dist), 0.1f);
if(dist < Near)
RwCameraSetNearClipPlane(Scene.camera, dist);
// Move forward a bit
if(dist == 0.1f)
Source += (TargetCoors - Source)*0.3f;
// Keep testing
entity = CWorld::TestSphereAgainstWorld(Source + Front*Near, radius, nil, true, true, false, true, false, false);
i++;
if(i > 5)
entity = nil;
}
GetVectorsReadyForRW();
}
#endif
STARTPATCHES STARTPATCHES
#ifdef FREE_CAM
Nop(0x468E7B, 0x468E90-0x468E7B); // disable first person
#endif
InjectHook(0x456F40, WellBufferMe, PATCH_JUMP); InjectHook(0x456F40, WellBufferMe, PATCH_JUMP);
InjectHook(0x458410, &CCam::Init, PATCH_JUMP); InjectHook(0x458410, &CCam::Init, PATCH_JUMP);
InjectHook(0x4582F0, &CCam::GetVectorsReadyForRW, PATCH_JUMP); InjectHook(0x4582F0, &CCam::GetVectorsReadyForRW, PATCH_JUMP);

View File

@ -221,6 +221,9 @@ struct CCam
// CCam::Process_Blood_On_The_Tracks // CCam::Process_Blood_On_The_Tracks
// CCam::Process_Cam_Running_Side_Train // CCam::Process_Cam_Running_Side_Train
// CCam::Process_Cam_On_Train_Roof // CCam::Process_Cam_On_Train_Roof
// custom stuff
void Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float);
}; };
static_assert(sizeof(CCam) == 0x1A4, "CCam: wrong size"); static_assert(sizeof(CCam) == 0x1A4, "CCam: wrong size");
static_assert(offsetof(CCam, Alpha) == 0xA8, "CCam: error"); static_assert(offsetof(CCam, Alpha) == 0xA8, "CCam: error");

View File

@ -183,7 +183,7 @@ CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName)
ms_pCutsceneDir->ReadDirFile("ANIM\\CUTS.DIR"); ms_pCutsceneDir->ReadDirFile("ANIM\\CUTS.DIR");
CStreaming::RemoveUnusedModelsInLoadedList(); CStreaming::RemoveUnusedModelsInLoadedList();
CGame::DrasticTidyUpMemory(); CGame::DrasticTidyUpMemory(true);
strcpy(ms_cutsceneName, szCutsceneName); strcpy(ms_cutsceneName, szCutsceneName);
file = CFileMgr::OpenFile("ANIM\\CUTS.IMG", "rb"); file = CFileMgr::OpenFile("ANIM\\CUTS.IMG", "rb");
@ -374,8 +374,7 @@ CCutsceneMgr::DeleteCutsceneData(void)
DMAudio.ChangeMusicMode(MUSICMODE_GAME); DMAudio.ChangeMusicMode(MUSICMODE_GAME);
} }
CTimer::Stop(); CTimer::Stop();
//TheCamera.GetScreenFadeStatus() == 2; // what for?? CGame::DrasticTidyUpMemory(TheCamera.GetScreenFadeStatus() == 2);
CGame::DrasticTidyUpMemory();
CTimer::Update(); CTimer::Update();
} }

View File

@ -113,7 +113,7 @@ CFire::ProcessFire(void)
CVector(0.0f, 0.0f, CGeneral::GetRandomNumberInRange(0.0125f, 0.1f) * m_fStrength), CVector(0.0f, 0.0f, CGeneral::GetRandomNumberInRange(0.0125f, 0.1f) * m_fStrength),
0, m_fStrength, 0, 0, 0, 0); 0, m_fStrength, 0, 0, 0, 0);
rand(); rand(); rand(); /* unsure why these three rands are called */ CGeneral::GetRandomNumber(); CGeneral::GetRandomNumber(); CGeneral::GetRandomNumber(); /* unsure why these three rands are called */
CParticle::AddParticle(PARTICLE_CARFLAME_SMOKE, firePos, CParticle::AddParticle(PARTICLE_CARFLAME_SMOKE, firePos,
CVector(0.0f, 0.0f, 0.0f), 0, 0.0f, 0, 0, 0, 0); CVector(0.0f, 0.0f, 0.0f), 0, 0.0f, 0, 0, 0, 0);
@ -129,8 +129,10 @@ CFire::ProcessFire(void)
if (!m_pEntity) { if (!m_pEntity) {
CShadows::StoreStaticShadow((uint32)this, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &lightpos, CShadows::StoreStaticShadow((uint32)this, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &lightpos,
7.0f, 0.0f, 0.0f, -7.0f, 0, nRandNumber / 2, nRandNumber / 2, 7.0f, 0.0f, 0.0f, -7.0f,
0, 10.0f, 1.0f, 40.0f, 0, 0.0f); 255, // this is 0 on PC which results in no shadow
nRandNumber / 2, nRandNumber / 2, 0,
10.0f, 1.0f, 40.0f, 0, 0.0f);
} }
fGreen = nRandNumber / 128; fGreen = nRandNumber / 128;
fRed = nRandNumber / 128; fRed = nRandNumber / 128;

View File

@ -1694,9 +1694,6 @@ int CMenuManager::GetStartOptionsCntrlConfigScreens()
} }
#endif #endif
#if DONT_USE_SUSPICIOUS_FUNCS
WRAPPER void CMenuManager::InitialiseChangedLanguageSettings() { EAXJMP(0x47A4D0); }
#else
void CMenuManager::InitialiseChangedLanguageSettings() void CMenuManager::InitialiseChangedLanguageSettings()
{ {
if (m_bFrontEnd_ReloadObrTxtGxt) { if (m_bFrontEnd_ReloadObrTxtGxt) {
@ -1719,7 +1716,6 @@ void CMenuManager::InitialiseChangedLanguageSettings()
} }
} }
} }
#endif
void CMenuManager::LoadAllTextures() void CMenuManager::LoadAllTextures()
{ {

View File

@ -1,7 +1,14 @@
#pragma warning( push )
#pragma warning( disable : 4005)
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#pragma warning( pop )
#include "common.h" #include "common.h"
#include "win.h"
#include "patcher.h" #include "patcher.h"
#include "Game.h" #include "Game.h"
#include "main.h" #include "main.h"
#include "RwHelper.h"
#include "Accident.h" #include "Accident.h"
#include "Antennas.h" #include "Antennas.h"
#include "Bridge.h" #include "Bridge.h"
@ -17,6 +24,7 @@
#include "Cranes.h" #include "Cranes.h"
#include "Credits.h" #include "Credits.h"
#include "CutsceneMgr.h" #include "CutsceneMgr.h"
#include "DMAudio.h"
#include "Darkel.h" #include "Darkel.h"
#include "Debug.h" #include "Debug.h"
#include "EventList.h" #include "EventList.h"
@ -28,26 +36,32 @@
#include "Frontend.h" #include "Frontend.h"
#include "GameLogic.h" #include "GameLogic.h"
#include "Garages.h" #include "Garages.h"
#include "GenericGameStorage.h"
#include "Glass.h" #include "Glass.h"
#include "HandlingMgr.h"
#include "Heli.h" #include "Heli.h"
#include "Hud.h"
#include "IniFile.h" #include "IniFile.h"
#include "Lights.h"
#include "MBlur.h"
#include "Messages.h" #include "Messages.h"
#include "Pad.h" #include "Pad.h"
#include "Particle.h" #include "Particle.h"
#include "ParticleObject.h"
#include "PedRoutes.h"
#include "Phones.h" #include "Phones.h"
#include "Pickups.h" #include "Pickups.h"
#include "Plane.h" #include "Plane.h"
#include "PlayerSkin.h"
#include "Population.h" #include "Population.h"
#include "Radar.h"
#include "Record.h" #include "Record.h"
#include "References.h"
#include "Renderer.h" #include "Renderer.h"
#include "Replay.h" #include "Replay.h"
#include "References.h"
#include "Radar.h"
#include "Restart.h" #include "Restart.h"
#include "RoadBlocks.h" #include "RoadBlocks.h"
#include "PedRoutes.h"
#include "Rubbish.h" #include "Rubbish.h"
#include "RwHelper.h"
#include "SceneEdit.h" #include "SceneEdit.h"
#include "Script.h" #include "Script.h"
#include "Shadows.h" #include "Shadows.h"
@ -56,11 +70,14 @@
#include "Sprite2d.h" #include "Sprite2d.h"
#include "Stats.h" #include "Stats.h"
#include "Streaming.h" #include "Streaming.h"
#include "SurfaceTable.h"
#include "TempColModels.h"
#include "TimeCycle.h" #include "TimeCycle.h"
#include "TrafficLights.h" #include "TrafficLights.h"
#include "Train.h" #include "Train.h"
#include "TxdStore.h" #include "TxdStore.h"
#include "User.h" #include "User.h"
#include "VisibilityPlugins.h"
#include "WaterCannon.h" #include "WaterCannon.h"
#include "WaterLevel.h" #include "WaterLevel.h"
#include "Weapon.h" #include "Weapon.h"
@ -70,6 +87,10 @@
#include "ZoneCull.h" #include "ZoneCull.h"
#include "Zones.h" #include "Zones.h"
#define DEFAULT_VIEWWINDOW (0.7f)
eLevelName &CGame::currLevel = *(eLevelName*)0x941514; eLevelName &CGame::currLevel = *(eLevelName*)0x941514;
bool &CGame::bDemoMode = *(bool*)0x5F4DD0; bool &CGame::bDemoMode = *(bool*)0x5F4DD0;
bool &CGame::nastyGame = *(bool*)0x5F4DD4; bool &CGame::nastyGame = *(bool*)0x5F4DD4;
@ -79,6 +100,7 @@ bool &CGame::noProstitutes = *(bool*)0x95CDCF;
bool &CGame::playingIntro = *(bool*)0x95CDC2; bool &CGame::playingIntro = *(bool*)0x95CDC2;
char *CGame::aDatFile = (char*)0x773A48; char *CGame::aDatFile = (char*)0x773A48;
int &gameTxdSlot = *(int*)0x628D88;
bool bool
CGame::InitialiseOnceBeforeRW(void) CGame::InitialiseOnceBeforeRW(void)
@ -89,7 +111,139 @@ CGame::InitialiseOnceBeforeRW(void)
return true; return true;
} }
int &gameTxdSlot = *(int*)0x628D88; bool
CGame::InitialiseRenderWare(void)
{
_TexturePoolsInitialise();
CTxdStore::Initialise();
CVisibilityPlugins::Initialise();
/* Create camera */
Scene.camera = CameraCreate(RsGlobal.width, RsGlobal.height, TRUE);
ASSERT(Scene.camera != nil);
if (!Scene.camera)
{
return (false);
}
RwCameraSetFarClipPlane(Scene.camera, 2000.0f);
RwCameraSetNearClipPlane(Scene.camera, 0.9f);
CameraSize(Scene.camera, nil, DEFAULT_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
/* Create a world */
RwBBox bbox;
bbox.sup.x = bbox.sup.y = bbox.sup.z = 10000.0f;
bbox.inf.x = bbox.inf.y = bbox.inf.z = -10000.0f;
Scene.world = RpWorldCreate(&bbox);
ASSERT(Scene.world != nil);
if (!Scene.world)
{
CameraDestroy(Scene.camera);
Scene.camera = nil;
return (false);
}
/* Add the camera to the world */
RpWorldAddCamera(Scene.world, Scene.camera);
LightsCreate(Scene.world);
CreateDebugFont();
CFont::Initialise();
CHud::Initialise();
CPlayerSkin::Initialise();
return (true);
}
void CGame::ShutdownRenderWare(void)
{
CMBlur::MotionBlurClose();
DestroySplashScreen();
CHud::Shutdown();
CFont::Shutdown();
for ( int32 i = 0; i < NUMPLAYERS; i++ )
CWorld::Players[i].DeletePlayerSkin();
CPlayerSkin::Shutdown();
DestroyDebugFont();
/* Destroy world */
LightsDestroy(Scene.world);
RpWorldRemoveCamera(Scene.world, Scene.camera);
RpWorldDestroy(Scene.world);
/* destroy camera */
CameraDestroy(Scene.camera);
Scene.world = nil;
Scene.camera = nil;
CVisibilityPlugins::Shutdown();
_TexturePoolsShutdown();
}
bool CGame::InitialiseOnceAfterRW(void)
{
TheText.Load();
DMAudio.Initialise();
CTimer::Initialise();
CTempColModels::Initialise();
mod_HandlingManager.Initialise();
CSurfaceTable::Initialise("DATA\\SURFACE.DAT");
CPedStats::Initialise();
CTimeCycle::Initialise();
if ( DMAudio.GetNum3DProvidersAvailable() == 0 )
FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = -1;
if ( FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -99 || FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -2 )
{
CMenuManager::m_PrefsSpeakers = 0;
for ( int32 i = 0; i < DMAudio.GetNum3DProvidersAvailable(); i++ )
{
wchar buff[64];
char *name = DMAudio.Get3DProviderName(i);
AsciiToUnicode(name, buff);
char *providername = UnicodeToAscii(buff);
strupr(providername);
if ( !strcmp(providername, "MILES FAST 2D POSITIONAL AUDIO") )
{
FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = i;
break;
}
}
}
DMAudio.SetCurrent3DProvider(FrontEndMenuManager.m_nPrefsAudio3DProviderIndex);
DMAudio.SetSpeakerConfig(CMenuManager::m_PrefsSpeakers);
DMAudio.SetDynamicAcousticModelingStatus(CMenuManager::m_PrefsDMA);
DMAudio.SetMusicMasterVolume(CMenuManager::m_PrefsMusicVolume);
DMAudio.SetEffectsMasterVolume(CMenuManager::m_PrefsSfxVolume);
DMAudio.SetEffectsFadeVol(127);
DMAudio.SetMusicFadeVol(127);
CWorld::Players[0].SetPlayerSkin(CMenuManager::m_PrefsSkinFile);
return true;
}
void
CGame::FinalShutdown(void)
{
CTxdStore::Shutdown();
CPedStats::Shutdown();
CdStreamShutdown();
}
bool CGame::Initialise(const char* datFile) bool CGame::Initialise(const char* datFile)
{ {
@ -160,7 +314,7 @@ bool CGame::Initialise(const char* datFile)
CStreaming::Init(); CStreaming::Init();
} else { } else {
CStreaming::Init(); CStreaming::Init();
if (ConvertTextures()) { if (CreateTxdImageForVideoCard()) {
CStreaming::Shutdown(); CStreaming::Shutdown();
CdStreamAddImage("MODELS\\TXD.IMG"); CdStreamAddImage("MODELS\\TXD.IMG");
CStreaming::Init(); CStreaming::Init();
@ -198,7 +352,7 @@ bool CGame::Initialise(const char* datFile)
CSceneEdit::Init(); CSceneEdit::Init();
LoadingScreen("Loading the Game", "Load scripts", nil); LoadingScreen("Loading the Game", "Load scripts", nil);
CTheScripts::Init(); CTheScripts::Init();
CGangs::Initialize(); CGangs::Initialise();
LoadingScreen("Loading the Game", "Setup game variables", nil); LoadingScreen("Loading the Game", "Setup game variables", nil);
CClock::Initialise(1000); CClock::Initialise(1000);
CHeli::InitHelis(); CHeli::InitHelis();
@ -227,16 +381,225 @@ bool CGame::Initialise(const char* datFile)
CTheScripts::Process(); CTheScripts::Process();
TheCamera.Process(); TheCamera.Process();
LoadingScreen("Loading the Game", "Load scene", nil); LoadingScreen("Loading the Game", "Load scene", nil);
CModelInfo::RemoveColModelsFromOtherLevels(CGame::currLevel); CModelInfo::RemoveColModelsFromOtherLevels(currLevel);
CCollision::ms_collisionInMemory = CGame::currLevel; CCollision::ms_collisionInMemory = currLevel;
for (int i = 0; i < MAX_PADS; i++) for (int i = 0; i < MAX_PADS; i++)
CPad::GetPad(i)->Clear(true); CPad::GetPad(i)->Clear(true);
return true; return true;
} }
#if 0 bool CGame::ShutDown(void)
WRAPPER void CGame::Process(void) { EAXJMP(0x48C850); } {
#else CReplay::FinishPlayback();
CPlane::Shutdown();
CTrain::Shutdown();
CSpecialFX::Shutdown();
CGarages::Shutdown();
CMovingThings::Shutdown();
gPhoneInfo.Shutdown();
CWeapon::ShutdownWeapons();
CPedType::Shutdown();
CMBlur::MotionBlurClose();
for (int32 i = 0; i < NUMPLAYERS; i++)
{
if ( CWorld::Players[i].m_pPed )
{
CWorld::Remove(CWorld::Players[i].m_pPed);
delete CWorld::Players[i].m_pPed;
CWorld::Players[i].m_pPed = nil;
}
CWorld::Players[i].Clear();
}
CRenderer::Shutdown();
CWorld::ShutDown();
DMAudio.DestroyAllGameCreatedEntities();
CModelInfo::ShutDown();
CAnimManager::Shutdown();
CCutsceneMgr::Shutdown();
CVehicleModelInfo::DeleteVehicleColourTextures();
CVehicleModelInfo::ShutdownEnvironmentMaps();
CRadar::Shutdown();
CStreaming::Shutdown();
CTxdStore::GameShutdown();
CCollision::Shutdown();
CWaterLevel::Shutdown();
CRubbish::Shutdown();
CClouds::Shutdown();
CShadows::Shutdown();
CCoronas::Shutdown();
CSkidmarks::Shutdown();
CWeaponEffects::Shutdown();
CParticle::Shutdown();
CPools::ShutDown();
CTxdStore::RemoveTxdSlot(gameTxdSlot);
CdStreamRemoveImages();
return true;
}
void CGame::ReInitGameObjectVariables(void)
{
CGameLogic::InitAtStartOfGame();
TheCamera.CCamera::Init();
TheCamera.SetRwCamera(Scene.camera);
CDebug::DebugInitTextBuffer();
CWeather::Init();
CUserDisplay::Init();
CMessages::Init();
CRestart::Initialise();
CWorld::bDoingCarCollisions = false;
CHud::ReInitialise();
CRadar::Initialise();
CCarCtrl::ReInit();
CTimeCycle::Initialise();
CDraw::SetFOV(120.0f);
CDraw::ms_fLODDistance = 500.0f;
CStreaming::RequestBigBuildings(LEVEL_NONE);
CStreaming::LoadAllRequestedModels(false);
CPed::Initialise();
CEventList::Initialise();
CWeapon::InitialiseWeapons();
CPopulation::Initialise();
for (int i = 0; i < NUMPLAYERS; i++)
CWorld::Players[i].Clear();
CWorld::PlayerInFocus = 0;
CAntennas::Init();
CGlass::Init();
gPhoneInfo.Initialise();
CTheScripts::Init();
CGangs::Initialise();
CTimer::Initialise();
CClock::Initialise(1000);
CTheCarGenerators::Init();
CHeli::InitHelis();
CMovingThings::Init();
CDarkel::Init();
CStats::Init();
CPickups::Init();
CPacManPickups::Init();
CGarages::Init();
CSpecialFX::Init();
CWaterCannons::Init();
CParticle::ReloadConfig();
CCullZones::ResolveVisibilities();
if ( !FrontEndMenuManager.m_bLoadingSavedGame )
{
CCranes::InitCranes();
CTheScripts::StartTestScript();
CTheScripts::Process();
TheCamera.Process();
CTrain::InitTrains();
CPlane::InitPlanes();
}
for (int32 i = 0; i < MAX_PADS; i++)
CPad::GetPad(i)->Clear(true);
}
void CGame::ReloadIPLs(void)
{
CTimer::Stop();
CWorld::RemoveStaticObjects();
ThePaths.Init();
CCullZones::Init();
CFileLoader::ReloadPaths("GTA3.IDE");
CFileLoader::LoadScene("INDUST.IPL");
CFileLoader::LoadScene("COMMER.IPL");
CFileLoader::LoadScene("SUBURBAN.IPL");
CFileLoader::LoadScene("CULL.IPL");
ThePaths.PreparePathData();
CTrafficLights::ScanForLightsOnMap();
CRoadBlocks::Init();
CCranes::InitCranes();
CGarages::Init();
CWorld::RepositionCertainDynamicObjects();
CCullZones::ResolveVisibilities();
CRenderer::SortBIGBuildings();
CTimer::Update();
}
void CGame::ShutDownForRestart(void)
{
CReplay::FinishPlayback();
CReplay::EmptyReplayBuffer();
DMAudio.DestroyAllGameCreatedEntities();
for (int i = 0; i < NUMPLAYERS; i++)
CWorld::Players[i].Clear();
CGarages::SetAllDoorsBackToOriginalHeight();
CTheScripts::UndoBuildingSwaps();
CTheScripts::UndoEntityInvisibilitySettings();
CWorld::ClearForRestart();
CTimer::Shutdown();
CStreaming::FlushRequestList();
CStreaming::DeleteAllRwObjects();
CStreaming::RemoveAllUnusedModels();
CStreaming::ms_disableStreaming = false;
CRadar::RemoveRadarSections();
FrontEndMenuManager.UnloadTextures();
CParticleObject::RemoveAllParticleObjects();
CPedType::Shutdown();
CSpecialFX::Shutdown();
TidyUpMemory(true, false);
}
void CGame::InitialiseWhenRestarting(void)
{
CRect rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
CRGBA color(255, 255, 255, 255);
CTimer::Initialise();
CSprite2d::SetRecipNearClip();
b_FoundRecentSavedGameWantToLoad = false;
TheCamera.Init();
if ( FrontEndMenuManager.m_bLoadingSavedGame == true )
{
RestoreForStartLoad();
CStreaming::LoadScene(TheCamera.GetPosition());
}
ReInitGameObjectVariables();
if ( FrontEndMenuManager.m_bLoadingSavedGame == true )
{
if ( GenericLoad() == true )
{
DMAudio.ResetTimers(CTimer::GetTimeInMilliseconds());
CTrain::InitTrains();
CPlane::InitPlanes();
}
else
{
for ( int32 i = 0; i < 50; i++ )
{
HandleExit();
FrontEndMenuManager.MessageScreen("FED_LFL"); // Loading save game has failed. The game will restart now.
}
ShutDownForRestart();
CTimer::Stop();
CTimer::Initialise();
FrontEndMenuManager.m_bLoadingSavedGame = false;
ReInitGameObjectVariables();
currLevel = LEVEL_INDUSTRIAL;
CCollision::SortOutCollisionAfterLoad();
}
}
CTimer::Update();
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
}
extern void (*DebugMenuProcess)(void); extern void (*DebugMenuProcess)(void);
void CGame::Process(void) void CGame::Process(void)
{ {
@ -312,50 +675,34 @@ void CGame::Process(void)
} }
} }
} }
#endif
void CGame::ReloadIPLs(void) void CGame::DrasticTidyUpMemory(bool)
{ {
CTimer::Stop(); #ifdef PS2
CWorld::RemoveStaticObjects(); // meow
ThePaths.Init(); #endif
CCullZones::Init();
CFileLoader::ReloadPaths("GTA3.IDE");
CFileLoader::LoadScene("INDUST.IPL");
CFileLoader::LoadScene("COMMER.IPL");
CFileLoader::LoadScene("SUBURBAN.IPL");
CFileLoader::LoadScene("CULL.IPL");
ThePaths.PreparePathData();
CTrafficLights::ScanForLightsOnMap();
CRoadBlocks::Init();
CCranes::InitCranes();
CGarages::Init();
CWorld::RepositionCertainDynamicObjects();
CCullZones::ResolveVisibilities();
CRenderer::SortBIGBuildings();
CTimer::Update();
} }
#if 0 void CGame::TidyUpMemory(bool, bool)
WRAPPER void CGame::FinalShutdown(void) { EAXJMP(0x48BEC0); }
#else
void
CGame::FinalShutdown(void)
{ {
CTxdStore::Shutdown(); #ifdef PS2
CPedStats::Shutdown(); // meow
CdStreamShutdown();
}
#endif #endif
}
WRAPPER bool CGame::InitialiseRenderWare(void) { EAXJMP(0x48BBA0); }
WRAPPER void CGame::ShutdownRenderWare(void) { EAXJMP(0x48BCB0); }
WRAPPER void CGame::ShutDown(void) { EAXJMP(0x48C3A0); }
WRAPPER void CGame::ShutDownForRestart(void) { EAXJMP(0x48C6B0); }
WRAPPER void CGame::InitialiseWhenRestarting(void) { EAXJMP(0x48C740); }
WRAPPER bool CGame::InitialiseOnceAfterRW(void) { EAXJMP(0x48BD50); }
STARTPATCHES STARTPATCHES
InjectHook(0x48C850, CGame::Process, PATCH_JUMP); InjectHook(0x48BB80, CGame::InitialiseOnceBeforeRW, PATCH_JUMP);
InjectHook(0x48BBA0, CGame::InitialiseRenderWare, PATCH_JUMP);
InjectHook(0x48BCB0, CGame::ShutdownRenderWare, PATCH_JUMP);
InjectHook(0x48BD50, CGame::InitialiseOnceAfterRW, PATCH_JUMP);
InjectHook(0x48BEC0, CGame::FinalShutdown, PATCH_JUMP); InjectHook(0x48BEC0, CGame::FinalShutdown, PATCH_JUMP);
InjectHook(0x48BED0, CGame::Initialise, PATCH_JUMP);
InjectHook(0x48C3A0, CGame::ShutDown, PATCH_JUMP);
InjectHook(0x48C4B0, CGame::ReInitGameObjectVariables, PATCH_JUMP);
InjectHook(0x48C620, CGame::ReloadIPLs, PATCH_JUMP);
InjectHook(0x48C6B0, CGame::ShutDownForRestart, PATCH_JUMP);
InjectHook(0x48C740, CGame::InitialiseWhenRestarting, PATCH_JUMP);
InjectHook(0x48C850, CGame::Process, PATCH_JUMP);
InjectHook(0x48CA10, CGame::DrasticTidyUpMemory, PATCH_JUMP);
InjectHook(0x48CA20, CGame::TidyUpMemory, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -20,19 +20,20 @@ public:
static bool &playingIntro; static bool &playingIntro;
static char *aDatFile; //[32]; static char *aDatFile; //[32];
static bool Initialise(const char *datFile);
static bool InitialiseOnceBeforeRW(void); static bool InitialiseOnceBeforeRW(void);
static bool InitialiseRenderWare(void); static bool InitialiseRenderWare(void);
static bool InitialiseOnceAfterRW(void);
static void InitialiseWhenRestarting(void);
static void ShutDown(void);
static void ShutdownRenderWare(void); static void ShutdownRenderWare(void);
static bool InitialiseOnceAfterRW(void);
static void FinalShutdown(void); static void FinalShutdown(void);
static void ShutDownForRestart(void); static bool Initialise(const char *datFile);
static void Process(void); static bool ShutDown(void);
static void ReInitGameObjectVariables(void);
static void ReloadIPLs(void); static void ReloadIPLs(void);
static void ShutDownForRestart(void);
static void InitialiseWhenRestarting(void);
static void Process(void);
// NB: these do something on PS2 // NB: these do something on PS2
static void TidyUpMemory(bool, bool) {} static void TidyUpMemory(bool, bool);
static void DrasticTidyUpMemory(void) {} static void DrasticTidyUpMemory(bool);
}; };

View File

@ -75,9 +75,6 @@ static_assert(RADAR_TILE_SIZE == (WORLD_SIZE_Y / RADAR_NUM_TILES), "CRadar: not
#define RADAR_MIN_SPEED (0.3f) #define RADAR_MIN_SPEED (0.3f)
#define RADAR_MAX_SPEED (0.9f) #define RADAR_MAX_SPEED (0.9f)
#if 0
WRAPPER void CRadar::CalculateBlipAlpha(float) { EAXJMP(0x4A4F90); }
#else
uint8 CRadar::CalculateBlipAlpha(float dist) uint8 CRadar::CalculateBlipAlpha(float dist)
{ {
if (dist <= 1.0f) if (dist <= 1.0f)
@ -88,55 +85,35 @@ uint8 CRadar::CalculateBlipAlpha(float dist)
return 128; return 128;
} }
#endif
#if 0
WRAPPER void CRadar::ChangeBlipBrightness(int32, int32) { EAXJMP(0x4A57A0); }
#else
void CRadar::ChangeBlipBrightness(int32 i, int32 bright) void CRadar::ChangeBlipBrightness(int32 i, int32 bright)
{ {
int index = GetActualBlipArrayIndex(i); int index = GetActualBlipArrayIndex(i);
if (index != -1) if (index != -1)
ms_RadarTrace[index].m_bDim = bright != 1; ms_RadarTrace[index].m_bDim = bright != 1;
} }
#endif
#if 0
WRAPPER void CRadar::ChangeBlipColour(int32, int32) { EAXJMP(0x4A5770); }
#else
void CRadar::ChangeBlipColour(int32 i, int32 color) void CRadar::ChangeBlipColour(int32 i, int32 color)
{ {
int index = GetActualBlipArrayIndex(i); int index = GetActualBlipArrayIndex(i);
if (index != -1) if (index != -1)
ms_RadarTrace[index].m_nColor = color; ms_RadarTrace[index].m_nColor = color;
} }
#endif
#if 0
WRAPPER void CRadar::ChangeBlipDisplay(int32, eBlipDisplay) { EAXJMP(0x4A5810); }
#else
void CRadar::ChangeBlipDisplay(int32 i, eBlipDisplay display) void CRadar::ChangeBlipDisplay(int32 i, eBlipDisplay display)
{ {
int index = GetActualBlipArrayIndex(i); int index = GetActualBlipArrayIndex(i);
if (index != -1) if (index != -1)
ms_RadarTrace[index].m_eBlipDisplay = display; ms_RadarTrace[index].m_eBlipDisplay = display;
} }
#endif
#if 0
WRAPPER void CRadar::ChangeBlipScale(int32, int32) { EAXJMP(0x4A57E0); }
#else
void CRadar::ChangeBlipScale(int32 i, int32 scale) void CRadar::ChangeBlipScale(int32 i, int32 scale)
{ {
int index = GetActualBlipArrayIndex(i); int index = GetActualBlipArrayIndex(i);
if (index != -1) if (index != -1)
ms_RadarTrace[index].m_wScale = scale; ms_RadarTrace[index].m_wScale = scale;
} }
#endif
#if 0
WRAPPER void CRadar::ClearBlip(int32) { EAXJMP(0x4A5720); }
#else
void CRadar::ClearBlip(int32 i) void CRadar::ClearBlip(int32 i)
{ {
int index = GetActualBlipArrayIndex(i); int index = GetActualBlipArrayIndex(i);
@ -148,11 +125,7 @@ void CRadar::ClearBlip(int32 i)
ms_RadarTrace[index].m_IconID = RADAR_SPRITE_NONE; ms_RadarTrace[index].m_IconID = RADAR_SPRITE_NONE;
} }
} }
#endif
#if 0
WRAPPER void CRadar::ClearBlipForEntity(eBlipType, int32) { EAXJMP(0x4A56C0); }
#else
void CRadar::ClearBlipForEntity(eBlipType type, int32 id) void CRadar::ClearBlipForEntity(eBlipType type, int32 id)
{ {
for (int i = 0; i < NUMRADARBLIPS; i++) { for (int i = 0; i < NUMRADARBLIPS; i++) {
@ -165,11 +138,7 @@ void CRadar::ClearBlipForEntity(eBlipType type, int32 id)
} }
}; };
} }
#endif
#if 0
WRAPPER int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *in) { EAXJMP(0x4A64A0); }
#else
// Why not a proper clipping algorithm? // Why not a proper clipping algorithm?
int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect) int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect)
{ {
@ -249,7 +218,6 @@ int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect)
return n; return n;
} }
#endif
bool CRadar::DisplayThisBlip(int32 counter) bool CRadar::DisplayThisBlip(int32 counter)
{ {
@ -263,9 +231,6 @@ bool CRadar::DisplayThisBlip(int32 counter)
} }
} }
#if 0
WRAPPER void CRadar::Draw3dMarkers() { EAXJMP(0x4A4C70); }
#else
void CRadar::Draw3dMarkers() void CRadar::Draw3dMarkers()
{ {
for (int i = 0; i < NUMRADARBLIPS; i++) { for (int i = 0; i < NUMRADARBLIPS; i++) {
@ -317,12 +282,7 @@ void CRadar::Draw3dMarkers()
} }
} }
} }
#endif
#if 0
WRAPPER void CRadar::DrawBlips() { EAXJMP(0x4A42F0); }
#else
void CRadar::DrawBlips() void CRadar::DrawBlips()
{ {
if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) { if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) {
@ -580,12 +540,7 @@ void CRadar::DrawBlips()
} }
} }
} }
#endif
#if 0
WRAPPER void CRadar::DrawMap () { EAXJMP(0x4A4200); }
#else
void CRadar::DrawMap() void CRadar::DrawMap()
{ {
if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) { if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) {
@ -605,11 +560,7 @@ void CRadar::DrawMap()
DrawRadarMap(); DrawRadarMap();
} }
} }
#endif
#if 0
WRAPPER void CRadar::DrawRadarMap() { EAXJMP(0x4A6C20); }
#else
void CRadar::DrawRadarMap() void CRadar::DrawRadarMap()
{ {
// Game calculates an unused CRect here // Game calculates an unused CRect here
@ -642,11 +593,7 @@ void CRadar::DrawRadarMap()
DrawRadarSection(x, y + 1); DrawRadarSection(x, y + 1);
DrawRadarSection(x + 1, y + 1); DrawRadarSection(x + 1, y + 1);
} }
#endif
#if 0
WRAPPER void CRadar::DrawRadarMask() { EAXJMP(0x4A69C0); }
#else
void CRadar::DrawRadarMask() void CRadar::DrawRadarMask()
{ {
CVector2D corners[4] = { CVector2D corners[4] = {
@ -690,11 +637,7 @@ void CRadar::DrawRadarMask()
RwD3D8SetRenderState(rwRENDERSTATESTENCILFUNCTION, rwSTENCILFUNCTIONGREATER); RwD3D8SetRenderState(rwRENDERSTATESTENCILFUNCTION, rwSTENCILFUNCTIONGREATER);
} }
#endif
#if 0
WRAPPER void CRadar::DrawRadarSection(int32, int32) { EAXJMP(0x4A67E0); }
#else
void CRadar::DrawRadarSection(int32 x, int32 y) void CRadar::DrawRadarSection(int32 x, int32 y)
{ {
int i; int i;
@ -738,20 +681,12 @@ void CRadar::DrawRadarSection(int32 x, int32 y)
// if(numVertices > 2) // if(numVertices > 2)
RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::GetVertices(), numVertices); RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::GetVertices(), numVertices);
} }
#endif
#if 0
WRAPPER void CRadar::DrawRadarSprite(uint16 sprite, float x, float y, uint8 alpha) { EAXJMP(0x4A5EF0); }
#else
void CRadar::DrawRadarSprite(uint16 sprite, float x, float y, uint8 alpha) void CRadar::DrawRadarSprite(uint16 sprite, float x, float y, uint8 alpha)
{ {
RadarSprites[sprite]->Draw(CRect(x - SCREEN_SCALE_X(8.0f), y - SCREEN_SCALE_Y(8.0f), x + SCREEN_SCALE_X(8.0f), y + SCREEN_SCALE_Y(8.0f)), CRGBA(255, 255, 255, alpha)); RadarSprites[sprite]->Draw(CRect(x - SCREEN_SCALE_X(8.0f), y - SCREEN_SCALE_Y(8.0f), x + SCREEN_SCALE_X(8.0f), y + SCREEN_SCALE_Y(8.0f)), CRGBA(255, 255, 255, alpha));
} }
#endif
#if 0
WRAPPER void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int32 alpha) { EAXJMP(0x4A5D10); }
#else
void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int32 alpha) void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int32 alpha)
{ {
CVector curPosn[4]; CVector curPosn[4];
@ -778,11 +713,7 @@ void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float
sprite->Draw(curPosn[2].x, curPosn[2].y, curPosn[3].x, curPosn[3].y, curPosn[0].x, curPosn[0].y, curPosn[1].x, curPosn[1].y, CRGBA(255, 255, 255, alpha)); sprite->Draw(curPosn[2].x, curPosn[2].y, curPosn[3].x, curPosn[3].y, curPosn[0].x, curPosn[0].y, curPosn[1].x, curPosn[1].y, CRGBA(255, 255, 255, alpha));
} }
#endif
#if 0
WRAPPER int32 CRadar::GetActualBlipArrayIndex(int32) { EAXJMP(0x4A41C0); }
#else
int32 CRadar::GetActualBlipArrayIndex(int32 i) int32 CRadar::GetActualBlipArrayIndex(int32 i)
{ {
if (i == -1) if (i == -1)
@ -792,11 +723,7 @@ int32 CRadar::GetActualBlipArrayIndex(int32 i)
else else
return (uint16)i; return (uint16)i;
} }
#endif
#if 0
WRAPPER int32 CRadar::GetNewUniqueBlipIndex(int32) { EAXJMP(0x4A4180); }
#else
int32 CRadar::GetNewUniqueBlipIndex(int32 i) int32 CRadar::GetNewUniqueBlipIndex(int32 i)
{ {
if (ms_RadarTrace[i].m_BlipIndex >= UINT16_MAX - 1) if (ms_RadarTrace[i].m_BlipIndex >= UINT16_MAX - 1)
@ -805,11 +732,7 @@ int32 CRadar::GetNewUniqueBlipIndex(int32 i)
ms_RadarTrace[i].m_BlipIndex++; ms_RadarTrace[i].m_BlipIndex++;
return i | (ms_RadarTrace[i].m_BlipIndex << 16); return i | (ms_RadarTrace[i].m_BlipIndex << 16);
} }
#endif
#if 0
WRAPPER uint32 CRadar::GetRadarTraceColour(uint32 color, bool bright) { EAXJMP(0x4A5BB0); }
#else
uint32 CRadar::GetRadarTraceColour(uint32 color, bool bright) uint32 CRadar::GetRadarTraceColour(uint32 color, bool bright)
{ {
int32 c; int32 c;
@ -862,7 +785,6 @@ uint32 CRadar::GetRadarTraceColour(uint32 color, bool bright)
}; };
return c; return c;
} }
#endif
const char* gRadarTexNames[] = { const char* gRadarTexNames[] = {
"radar00", "radar01", "radar02", "radar03", "radar04", "radar05", "radar06", "radar07", "radar00", "radar01", "radar02", "radar03", "radar04", "radar05", "radar06", "radar07",
@ -875,9 +797,6 @@ const char* gRadarTexNames[] = {
"radar56", "radar57", "radar58", "radar59", "radar60", "radar61", "radar62", "radar63", "radar56", "radar57", "radar58", "radar59", "radar60", "radar61", "radar62", "radar63",
}; };
#if 0
WRAPPER void CRadar::Initialise() { EAXJMP(0x4A3EF0); }
#else
void void
CRadar::Initialise() CRadar::Initialise()
{ {
@ -894,11 +813,7 @@ CRadar::Initialise()
for (int i = 0; i < 64; i++) for (int i = 0; i < 64; i++)
gRadarTxdIds[i] = CTxdStore::FindTxdSlot(gRadarTexNames[i]); gRadarTxdIds[i] = CTxdStore::FindTxdSlot(gRadarTexNames[i]);
} }
#endif
#if 0
WRAPPER float CRadar::LimitRadarPoint(CVector2D &point) { EAXJMP(0x4A4F30); }
#else
float CRadar::LimitRadarPoint(CVector2D &point) float CRadar::LimitRadarPoint(CVector2D &point)
{ {
float dist, invdist; float dist, invdist;
@ -911,11 +826,7 @@ float CRadar::LimitRadarPoint(CVector2D &point)
} }
return dist; return dist;
} }
#endif
#if 0
WRAPPER void CRadar::LoadAllRadarBlips(int32) { EAXJMP(0x4A6F30); }
#else
void CRadar::LoadAllRadarBlips(uint8 *buf, uint32 size) void CRadar::LoadAllRadarBlips(uint8 *buf, uint32 size)
{ {
Initialise(); Initialise();
@ -927,11 +838,7 @@ INITSAVEBUF
VALIDATESAVEBUF(size); VALIDATESAVEBUF(size);
} }
#endif
#if 0
WRAPPER void CRadar::LoadTextures() { EAXJMP(0x4A4030); }
#else
void void
CRadar::LoadTextures() CRadar::LoadTextures()
{ {
@ -959,42 +866,26 @@ CRadar::LoadTextures()
WeaponSprite.SetTexture("radar_weapon"); WeaponSprite.SetTexture("radar_weapon");
CTxdStore::PopCurrentTxd(); CTxdStore::PopCurrentTxd();
} }
#endif
#if 0
WRAPPER void RemoveMapSection(int32, int32) { EAXJMP(0x00); }
#else
void RemoveMapSection(int32 x, int32 y) void RemoveMapSection(int32 x, int32 y)
{ {
if (x >= 0 && x <= 7 && y >= 0 && y <= 7) if (x >= 0 && x <= 7 && y >= 0 && y <= 7)
CStreaming::RemoveTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y]); CStreaming::RemoveTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y]);
} }
#endif
#if 0
WRAPPER void CRadar::RemoveRadarSections() { EAXJMP(0x4A60E0); }
#else
void CRadar::RemoveRadarSections() void CRadar::RemoveRadarSections()
{ {
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
for (int j = 0; j < 8; j++) for (int j = 0; j < 8; j++)
RemoveMapSection(i, j); RemoveMapSection(i, j);
} }
#endif
#if 0
WRAPPER void CRadar::RequestMapSection(int32, int32) { EAXJMP(0x00); }
#else
void CRadar::RequestMapSection(int32 x, int32 y) void CRadar::RequestMapSection(int32 x, int32 y)
{ {
ClipRadarTileCoords(x, y); ClipRadarTileCoords(x, y);
CStreaming::RequestTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y], STREAMFLAGS_DONT_REMOVE | STREAMFLAGS_DEPENDENCY); CStreaming::RequestTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y], STREAMFLAGS_DONT_REMOVE | STREAMFLAGS_DEPENDENCY);
} }
#endif
#if 0
WRAPPER void CRadar::SaveAllRadarBlips(uint8 *buf, uint32 *size) { EAXJMP(0x4A6E30); }
#else
void CRadar::SaveAllRadarBlips(uint8 *buf, uint32 *size) void CRadar::SaveAllRadarBlips(uint8 *buf, uint32 *size)
{ {
*size = SAVE_HEADER_SIZE + sizeof(ms_RadarTrace); *size = SAVE_HEADER_SIZE + sizeof(ms_RadarTrace);
@ -1006,11 +897,7 @@ INITSAVEBUF
VALIDATESAVEBUF(*size); VALIDATESAVEBUF(*size);
} }
#endif
#if 0
WRAPPER void CRadar::SetBlipSprite(int32, int32) { EAXJMP(0x4A5840); }
#else
void CRadar::SetBlipSprite(int32 i, int32 icon) void CRadar::SetBlipSprite(int32 i, int32 icon)
{ {
int index = CRadar::GetActualBlipArrayIndex(i); int index = CRadar::GetActualBlipArrayIndex(i);
@ -1018,11 +905,7 @@ void CRadar::SetBlipSprite(int32 i, int32 icon)
ms_RadarTrace[index].m_IconID = icon; ms_RadarTrace[index].m_IconID = icon;
} }
} }
#endif
#if 0
WRAPPER int32 CRadar::SetCoordBlip(eBlipType, CVector, int32, eBlipDisplay display) { EAXJMP(0x4A5590); }
#else
int CRadar::SetCoordBlip(eBlipType type, CVector pos, int32 color, eBlipDisplay display) int CRadar::SetCoordBlip(eBlipType type, CVector pos, int32 color, eBlipDisplay display)
{ {
int nextBlip; int nextBlip;
@ -1043,11 +926,7 @@ int CRadar::SetCoordBlip(eBlipType type, CVector pos, int32 color, eBlipDisplay
ms_RadarTrace[nextBlip].m_IconID = RADAR_SPRITE_NONE; ms_RadarTrace[nextBlip].m_IconID = RADAR_SPRITE_NONE;
return CRadar::GetNewUniqueBlipIndex(nextBlip); return CRadar::GetNewUniqueBlipIndex(nextBlip);
} }
#endif
#if 0
WRAPPER int CRadar::SetEntityBlip(eBlipType type, int32, int32, eBlipDisplay) { EAXJMP(0x4A5640); }
#else
int CRadar::SetEntityBlip(eBlipType type, int32 handle, int32 color, eBlipDisplay display) int CRadar::SetEntityBlip(eBlipType type, int32 handle, int32 color, eBlipDisplay display)
{ {
int nextBlip; int nextBlip;
@ -1066,11 +945,7 @@ int CRadar::SetEntityBlip(eBlipType type, int32 handle, int32 color, eBlipDispla
ms_RadarTrace[nextBlip].m_IconID = RADAR_SPRITE_NONE; ms_RadarTrace[nextBlip].m_IconID = RADAR_SPRITE_NONE;
return GetNewUniqueBlipIndex(nextBlip); return GetNewUniqueBlipIndex(nextBlip);
} }
#endif
#if 0
WRAPPER void CRadar::SetRadarMarkerState(int32, bool) { EAXJMP(0x4A5C60); }
#else
void CRadar::SetRadarMarkerState(int32 counter, bool flag) void CRadar::SetRadarMarkerState(int32 counter, bool flag)
{ {
CEntity *e; CEntity *e;
@ -1091,11 +966,7 @@ void CRadar::SetRadarMarkerState(int32 counter, bool flag)
if (e) if (e)
e->bHasBlip = flag; e->bHasBlip = flag;
} }
#endif
#if 0
WRAPPER void CRadar::ShowRadarMarker(CVector pos, uint32 color, float radius) { EAXJMP(0x4A59C0); }
#else
void CRadar::ShowRadarMarker(CVector pos, uint32 color, float radius) { void CRadar::ShowRadarMarker(CVector pos, uint32 color, float radius) {
float f1 = radius * 1.4f; float f1 = radius * 1.4f;
float f2 = radius * 0.5f; float f2 = radius * 0.5f;
@ -1117,11 +988,7 @@ void CRadar::ShowRadarMarker(CVector pos, uint32 color, float radius) {
p2 = pos - TheCamera.GetRight()*f2; p2 = pos - TheCamera.GetRight()*f2;
CTheScripts::ScriptDebugLine3D(p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, color, color); CTheScripts::ScriptDebugLine3D(p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, color, color);
} }
#endif
#if 0
WRAPPER void CRadar::ShowRadarTrace(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha) { EAXJMP(0x4A5870); }
#else
void CRadar::ShowRadarTrace(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha) void CRadar::ShowRadarTrace(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha)
{ {
if (!CHud::m_Wants_To_Draw_Hud || TheCamera.m_WideScreenOn) if (!CHud::m_Wants_To_Draw_Hud || TheCamera.m_WideScreenOn)
@ -1130,7 +997,6 @@ void CRadar::ShowRadarTrace(float x, float y, uint32 size, uint8 red, uint8 gree
CSprite2d::DrawRect(CRect(x - SCREEN_SCALE_X(size + 1.0f), y - SCREEN_SCALE_Y(size + 1.0f), SCREEN_SCALE_X(size + 1.0f) + x, SCREEN_SCALE_Y(size + 1.0f) + y), CRGBA(0, 0, 0, alpha)); CSprite2d::DrawRect(CRect(x - SCREEN_SCALE_X(size + 1.0f), y - SCREEN_SCALE_Y(size + 1.0f), SCREEN_SCALE_X(size + 1.0f) + x, SCREEN_SCALE_Y(size + 1.0f) + y), CRGBA(0, 0, 0, alpha));
CSprite2d::DrawRect(CRect(x - SCREEN_SCALE_X(size), y - SCREEN_SCALE_Y(size), SCREEN_SCALE_X(size) + x, SCREEN_SCALE_Y(size) + y), CRGBA(red, green, blue, alpha)); CSprite2d::DrawRect(CRect(x - SCREEN_SCALE_X(size), y - SCREEN_SCALE_Y(size), SCREEN_SCALE_X(size) + x, SCREEN_SCALE_Y(size) + y), CRGBA(red, green, blue, alpha));
} }
#endif
void CRadar::ShowRadarTraceWithHeight(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha, uint8 mode) void CRadar::ShowRadarTraceWithHeight(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha, uint8 mode)
{ {
@ -1156,9 +1022,6 @@ void CRadar::ShowRadarTraceWithHeight(float x, float y, uint32 size, uint8 red,
} }
} }
#if 0
WRAPPER void CRadar::Shutdown() { EAXJMP(0x4A3F60); }
#else
void CRadar::Shutdown() void CRadar::Shutdown()
{ {
AsukaSprite.Delete(); AsukaSprite.Delete();
@ -1183,20 +1046,12 @@ void CRadar::Shutdown()
WeaponSprite.Delete(); WeaponSprite.Delete();
RemoveRadarSections(); RemoveRadarSections();
} }
#endif
#if 0
WRAPPER void CRadar::StreamRadarSections(const CVector &posn) { EAXJMP(0x4A6B60); }
#else
void CRadar::StreamRadarSections(const CVector &posn) void CRadar::StreamRadarSections(const CVector &posn)
{ {
StreamRadarSections(floorf((2000.0f + posn.x) / 500.0f), ceilf(7.0f - (2000.0f + posn.y) / 500.0f)); StreamRadarSections(floorf((2000.0f + posn.x) / 500.0f), ceilf(7.0f - (2000.0f + posn.y) / 500.0f));
} }
#endif
#if 0
WRAPPER void CRadar::StreamRadarSections(int32 x, int32 y) { EAXJMP(0x4A6100); }
#else
void CRadar::StreamRadarSections(int32 x, int32 y) void CRadar::StreamRadarSections(int32 x, int32 y)
{ {
for (int i = 0; i < RADAR_NUM_TILES; ++i) { for (int i = 0; i < RADAR_NUM_TILES; ++i) {
@ -1208,11 +1063,7 @@ void CRadar::StreamRadarSections(int32 x, int32 y)
}; };
}; };
} }
#endif
#if 0
WRAPPER void CRadar::TransformRealWorldToTexCoordSpace(CVector2D &out, const CVector2D &in, int32 x, int32 y) { EAXJMP(0x4A5530); }
#else
void CRadar::TransformRealWorldToTexCoordSpace(CVector2D &out, const CVector2D &in, int32 x, int32 y) void CRadar::TransformRealWorldToTexCoordSpace(CVector2D &out, const CVector2D &in, int32 x, int32 y)
{ {
out.x = in.x - (x * RADAR_TILE_SIZE + WORLD_MIN_X); out.x = in.x - (x * RADAR_TILE_SIZE + WORLD_MIN_X);
@ -1220,11 +1071,7 @@ void CRadar::TransformRealWorldToTexCoordSpace(CVector2D &out, const CVector2D &
out.x /= RADAR_TILE_SIZE; out.x /= RADAR_TILE_SIZE;
out.y /= RADAR_TILE_SIZE; out.y /= RADAR_TILE_SIZE;
} }
#endif
#if 0
WRAPPER void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D &in) { EAXJMP(0x4A5300); }
#else
void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D &in) void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D &in)
{ {
float s, c; float s, c;
@ -1255,7 +1102,6 @@ void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D
out = out * m_radarRange + vec2DRadarOrigin; out = out * m_radarRange + vec2DRadarOrigin;
} }
#endif
// Radar space goes from -1.0 to 1.0 in x and y, top right is (1.0, 1.0) // Radar space goes from -1.0 to 1.0 in x and y, top right is (1.0, 1.0)
void CRadar::TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &in) void CRadar::TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &in)
@ -1265,9 +1111,6 @@ void CRadar::TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &i
out.y = (1.0f - in.y)*0.5f*SCREEN_SCALE_Y(RADAR_HEIGHT) + SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT); out.y = (1.0f - in.y)*0.5f*SCREEN_SCALE_Y(RADAR_HEIGHT) + SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT);
} }
#if 0
WRAPPER void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D &in) { EAXJMP(0x4A50D0); }
#else
void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D &in) void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D &in)
{ {
float s, c; float s, c;
@ -1299,11 +1142,7 @@ void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D
out.x = s * y + c * x; out.x = s * y + c * x;
out.y = c * y - s * x; out.y = c * y - s * x;
} }
#endif
#if 0
WRAPPER void CRadar::GetTextureCorners(int32 x, int32 y, CVector2D *out) { EAXJMP(0x4A61C0); };
#else
// Transform from section indices to world coordinates // Transform from section indices to world coordinates
void CRadar::GetTextureCorners(int32 x, int32 y, CVector2D *out) void CRadar::GetTextureCorners(int32 x, int32 y, CVector2D *out)
{ {
@ -1326,11 +1165,7 @@ void CRadar::GetTextureCorners(int32 x, int32 y, CVector2D *out)
out[3].x = RADAR_TILE_SIZE * (x); out[3].x = RADAR_TILE_SIZE * (x);
out[3].y = RADAR_TILE_SIZE * (y); out[3].y = RADAR_TILE_SIZE * (y);
} }
#endif
#if 0
WRAPPER void CRadar::ClipRadarTileCoords(int32 &, int32 &) { EAXJMP(0x00); };
#else
void CRadar::ClipRadarTileCoords(int32 &x, int32 &y) void CRadar::ClipRadarTileCoords(int32 &x, int32 &y)
{ {
if (x < 0) if (x < 0)
@ -1342,24 +1177,16 @@ void CRadar::ClipRadarTileCoords(int32 &x, int32 &y)
if (y > RADAR_NUM_TILES-1) if (y > RADAR_NUM_TILES-1)
y = RADAR_NUM_TILES-1; y = RADAR_NUM_TILES-1;
} }
#endif
#if 0
WRAPPER bool CRadar::IsPointInsideRadar(const CVector2D &) { EAXJMP(0x4A6160); }
#else
bool CRadar::IsPointInsideRadar(const CVector2D &point) bool CRadar::IsPointInsideRadar(const CVector2D &point)
{ {
if (point.x < -1.0f || point.x > 1.0f) return false; if (point.x < -1.0f || point.x > 1.0f) return false;
if (point.y < -1.0f || point.y > 1.0f) return false; if (point.y < -1.0f || point.y > 1.0f) return false;
return true; return true;
} }
#endif
// clip line p1,p2 against (-1.0, 1.0) in x and y, set out to clipped point closest to p1 // clip line p1,p2 against (-1.0, 1.0) in x and y, set out to clipped point closest to p1
#if 0
WRAPPER int CRadar::LineRadarBoxCollision(CVector2D &, const CVector2D &, const CVector2D &) { EAXJMP(0x4A6250); }
#else
int CRadar::LineRadarBoxCollision(CVector2D &out, const CVector2D &p1, const CVector2D &p2) int CRadar::LineRadarBoxCollision(CVector2D &out, const CVector2D &p1, const CVector2D &p2)
{ {
float d1, d2; float d1, d2;
@ -1430,7 +1257,6 @@ int CRadar::LineRadarBoxCollision(CVector2D &out, const CVector2D &p1, const CVe
return edge; return edge;
} }
#endif
STARTPATCHES STARTPATCHES
InjectHook(0x4A3EF0, CRadar::Initialise, PATCH_JUMP); InjectHook(0x4A3EF0, CRadar::Initialise, PATCH_JUMP);

View File

@ -352,7 +352,25 @@ WRAPPER bool CheckVideoCardCaps(void) { EAXJMP(0x592740); }
WRAPPER void WriteVideoCardCapsFile(void) { EAXJMP(0x5927D0); } WRAPPER void WriteVideoCardCapsFile(void) { EAXJMP(0x5927D0); }
WRAPPER void ConvertingTexturesScreen(uint32, uint32, const char*) { EAXJMP(0x592880); } WRAPPER void ConvertingTexturesScreen(uint32, uint32, const char*) { EAXJMP(0x592880); }
WRAPPER void DealWithTxdWriteError(uint32, uint32, const char*) { EAXJMP(0x592BF0); } WRAPPER void DealWithTxdWriteError(uint32, uint32, const char*) { EAXJMP(0x592BF0); }
WRAPPER bool ConvertTextures() { EAXJMP(0x592C70); } WRAPPER bool CreateTxdImageForVideoCard() { EAXJMP(0x592C70); }
void CreateDebugFont()
{
;
}
void DestroyDebugFont()
{
;
}
void FlushObrsPrintfs()
{
;
}
WRAPPER void _TexturePoolsInitialise() { EAXJMP(0x598B10); }
WRAPPER void _TexturePoolsShutdown() { EAXJMP(0x598B30); }
STARTPATCHES STARTPATCHES
//InjectHook(0x526450, GetFirstObjectCallback, PATCH_JUMP); //InjectHook(0x526450, GetFirstObjectCallback, PATCH_JUMP);

View File

@ -3,6 +3,9 @@
void *RwMallocAlign(RwUInt32 size, RwUInt32 align); void *RwMallocAlign(RwUInt32 size, RwUInt32 align);
void RwFreeAlign(void *mem); void RwFreeAlign(void *mem);
void CreateDebugFont();
void DestroyDebugFont();
void FlushObrsPrintfs();
void DefinedState(void); void DefinedState(void);
RwFrame *GetFirstChild(RwFrame *frame); RwFrame *GetFirstChild(RwFrame *frame);
RwObject *GetFirstObject(RwFrame *frame); RwObject *GetFirstObject(RwFrame *frame);
@ -17,7 +20,7 @@ bool CheckVideoCardCaps(void);
void WriteVideoCardCapsFile(void); void WriteVideoCardCapsFile(void);
void ConvertingTexturesScreen(uint32, uint32, const char*); void ConvertingTexturesScreen(uint32, uint32, const char*);
void DealWithTxdWriteError(uint32, uint32, const char*); void DealWithTxdWriteError(uint32, uint32, const char*);
bool ConvertTextures(); // not a real name bool CreateTxdImageForVideoCard();
bool RpClumpGtaStreamRead1(RwStream *stream); bool RpClumpGtaStreamRead1(RwStream *stream);
RpClump *RpClumpGtaStreamRead2(RwStream *stream); RpClump *RpClumpGtaStreamRead2(RwStream *stream);
@ -31,3 +34,7 @@ void CameraDestroy(RwCamera *camera);
RwCamera *CameraCreate(RwInt32 width, RwCamera *CameraCreate(RwInt32 width,
RwInt32 height, RwInt32 height,
RwBool zBuffer); RwBool zBuffer);
void _TexturePoolsInitialise();
void _TexturePoolsShutdown();

View File

@ -75,9 +75,6 @@ void CTimer::Shutdown(void)
; ;
} }
#if 0
WRAPPER void CTimer::Update(void) { EAXJMP(0x4ACF70); }
#else
void CTimer::Update(void) void CTimer::Update(void)
{ {
m_snPreviousTimeInMilliseconds = m_snTimeInMilliseconds; m_snPreviousTimeInMilliseconds = m_snTimeInMilliseconds;
@ -149,7 +146,6 @@ void CTimer::Update(void)
m_FrameCounter++; m_FrameCounter++;
} }
#endif
void CTimer::Suspend(void) void CTimer::Suspend(void)
{ {

View File

@ -10,7 +10,7 @@ CPool<TxdDef,TxdDef> *&CTxdStore::ms_pTxdPool = *(CPool<TxdDef,TxdDef>**)0x8F5FB
RwTexDictionary *&CTxdStore::ms_pStoredTxd = *(RwTexDictionary**)0x9405BC; RwTexDictionary *&CTxdStore::ms_pStoredTxd = *(RwTexDictionary**)0x9405BC;
void void
CTxdStore::Initialize(void) CTxdStore::Initialise(void)
{ {
if(ms_pTxdPool == nil) if(ms_pTxdPool == nil)
ms_pTxdPool = new CPool<TxdDef,TxdDef>(TXDSTORESIZE); ms_pTxdPool = new CPool<TxdDef,TxdDef>(TXDSTORESIZE);
@ -187,7 +187,7 @@ CTxdStore::RemoveTxd(int slot)
} }
STARTPATCHES STARTPATCHES
InjectHook(0x527440, CTxdStore::Initialize, PATCH_JUMP); InjectHook(0x527440, CTxdStore::Initialise, PATCH_JUMP);
InjectHook(0x527470, CTxdStore::Shutdown, PATCH_JUMP); InjectHook(0x527470, CTxdStore::Shutdown, PATCH_JUMP);
InjectHook(0x527490, CTxdStore::GameShutdown, PATCH_JUMP); InjectHook(0x527490, CTxdStore::GameShutdown, PATCH_JUMP);
InjectHook(0x5274E0, CTxdStore::AddTxdSlot, PATCH_JUMP); InjectHook(0x5274E0, CTxdStore::AddTxdSlot, PATCH_JUMP);

View File

@ -13,7 +13,7 @@ class CTxdStore
static CPool<TxdDef,TxdDef> *&ms_pTxdPool; static CPool<TxdDef,TxdDef> *&ms_pTxdPool;
static RwTexDictionary *&ms_pStoredTxd; static RwTexDictionary *&ms_pStoredTxd;
public: public:
static void Initialize(void); static void Initialise(void);
static void Shutdown(void); static void Shutdown(void);
static void GameShutdown(void); static void GameShutdown(void);
static int AddTxdSlot(const char *name); static int AddTxdSlot(const char *name);

View File

@ -39,6 +39,7 @@ bool &CWorld::bProcessCutsceneOnly = *(bool*)0x95CD8B;
bool &CWorld::bDoingCarCollisions = *(bool*)0x95CD8C; bool &CWorld::bDoingCarCollisions = *(bool*)0x95CD8C;
bool &CWorld::bIncludeCarTyres = *(bool*)0x95CDAA; bool &CWorld::bIncludeCarTyres = *(bool*)0x95CDAA;
WRAPPER void CWorld::ClearForRestart(void) { EAXJMP(0x4AE850); }
WRAPPER void CWorld::AddParticles(void) { EAXJMP(0x4B4010); } WRAPPER void CWorld::AddParticles(void) { EAXJMP(0x4B4010); }
WRAPPER void CWorld::ShutDown(void) { EAXJMP(0x4AE450); } WRAPPER void CWorld::ShutDown(void) { EAXJMP(0x4AE450); }
WRAPPER void CWorld::RepositionCertainDynamicObjects() { EAXJMP(0x4B42B0); } WRAPPER void CWorld::RepositionCertainDynamicObjects() { EAXJMP(0x4B42B0); }

View File

@ -135,6 +135,7 @@ public:
static void Initialise(); static void Initialise();
static void AddParticles(); static void AddParticles();
static void ShutDown(); static void ShutDown();
static void ClearForRestart(void);
static void RepositionCertainDynamicObjects(); static void RepositionCertainDynamicObjects();
static void RemoveStaticObjects(); static void RemoveStaticObjects();
static void Process(); static void Process();

View File

@ -208,4 +208,6 @@ enum Config {
// #define NEW_WALK_AROUND_ALGORITHM // to make walking around vehicles/objects less awkward // #define NEW_WALK_AROUND_ALGORITHM // to make walking around vehicles/objects less awkward
#define CANCELLABLE_CAR_ENTER #define CANCELLABLE_CAR_ENTER
// Camera
#define IMPROVED_CAMERA // Better Debug cam, and maybe more in the future #define IMPROVED_CAMERA // Better Debug cam, and maybe more in the future
//#define FREE_CAM // Rotating cam

View File

@ -90,7 +90,6 @@ void DoFade(void);
void Render2dStuffAfterFade(void); void Render2dStuffAfterFade(void);
CSprite2d *LoadSplash(const char *name); CSprite2d *LoadSplash(const char *name);
void DestroySplashScreen(void);
extern void (*DebugMenuProcess)(void); extern void (*DebugMenuProcess)(void);
@ -327,7 +326,7 @@ DoRWStuffEndOfFrame(void)
{ {
CDebug::DisplayScreenStrings(); // custom CDebug::DisplayScreenStrings(); // custom
CDebug::DebugDisplayTextBuffer(); CDebug::DebugDisplayTextBuffer();
// FlushObrsPrintfs(); FlushObrsPrintfs();
RwCameraEndUpdate(Scene.camera); RwCameraEndUpdate(Scene.camera);
RsCameraShowRaster(Scene.camera); RsCameraShowRaster(Scene.camera);
} }

View File

@ -28,6 +28,7 @@ void InitialiseGame(void);
void LoadingScreen(const char *str1, const char *str2, const char *splashscreen); void LoadingScreen(const char *str1, const char *str2, const char *splashscreen);
void LoadingIslandScreen(const char *levelName); void LoadingIslandScreen(const char *levelName);
CSprite2d *LoadSplash(const char *name); CSprite2d *LoadSplash(const char *name);
void DestroySplashScreen(void);
char *GetLevelSplashScreen(int level); char *GetLevelSplashScreen(int level);
char *GetRandomSplashScreen(void); char *GetRandomSplashScreen(void);
void LittleTest(void); void LittleTest(void);

View File

@ -372,6 +372,10 @@ DebugMenuPopulate(void)
extern bool PrintDebugCode; extern bool PrintDebugCode;
extern int16 &DebugCamMode; extern int16 &DebugCamMode;
#ifdef FREE_CAM
extern bool bFreeCam;
DebugMenuAddVarBool8("Cam", "Free Cam", (int8*)&bFreeCam, nil);
#endif
DebugMenuAddVarBool8("Cam", "Print Debug Code", (int8*)&PrintDebugCode, nil); DebugMenuAddVarBool8("Cam", "Print Debug Code", (int8*)&PrintDebugCode, nil);
DebugMenuAddVar("Cam", "Cam Mode", &DebugCamMode, nil, 1, 0, CCam::MODE_EDITOR, nil); DebugMenuAddVar("Cam", "Cam Mode", &DebugCamMode, nil, 1, 0, CCam::MODE_EDITOR, nil);
DebugMenuAddCmd("Cam", "Normal", []() { DebugCamMode = 0; }); DebugMenuAddCmd("Cam", "Normal", []() { DebugCamMode = 0; });

View File

@ -3619,11 +3619,11 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
if (DyingOrDead()) if (DyingOrDead())
return false; return false;
if (!bUsesCollision && method != WEAPONTYPE_WATER) if (!bUsesCollision && method != WEAPONTYPE_DROWNING)
return false; return false;
if (bOnlyDamagedByPlayer && damagedBy != player && damagedBy != FindPlayerVehicle() && if (bOnlyDamagedByPlayer && damagedBy != player && damagedBy != FindPlayerVehicle() &&
method != WEAPONTYPE_WATER && method != WEAPONTYPE_EXPLOSION) method != WEAPONTYPE_DROWNING && method != WEAPONTYPE_EXPLOSION)
return false; return false;
float healthImpact; float healthImpact;
@ -3969,10 +3969,10 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
} }
} }
break; break;
case WEAPONTYPE_WATER: case WEAPONTYPE_DROWNING:
dieAnim = ANIM_DROWN; dieAnim = ANIM_DROWN;
break; break;
case WEAPONTYPE_FALL_DAMAGE: case WEAPONTYPE_FALL:
if (bCollisionProof) if (bCollisionProof)
return false; return false;
@ -3998,7 +3998,7 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
} }
} }
if (m_fArmour != 0.0f && method != WEAPONTYPE_WATER) { if (m_fArmour != 0.0f && method != WEAPONTYPE_DROWNING) {
if (player == this) if (player == this)
CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss = CTimer::GetTimeInMilliseconds(); CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss = CTimer::GetTimeInMilliseconds();
@ -4024,7 +4024,7 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
} }
if (bInVehicle) { if (bInVehicle) {
if (method != WEAPONTYPE_WATER) { if (method != WEAPONTYPE_DROWNING) {
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
if (m_pMyVehicle) { if (m_pMyVehicle) {
if (m_pMyVehicle->IsCar() && m_pMyVehicle->pDriver == this) { if (m_pMyVehicle->IsCar() && m_pMyVehicle->pDriver == this) {
@ -4091,7 +4091,7 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
} else { } else {
CDarkel::RegisterKillNotByPlayer(this, method); CDarkel::RegisterKillNotByPlayer(this, method);
} }
if (method == WEAPONTYPE_WATER) if (method == WEAPONTYPE_DROWNING)
bIsInTheAir = false; bIsInTheAir = false;
return true; return true;
@ -14575,7 +14575,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
|| m_pCollidingEntity == collidingEnt) { || m_pCollidingEntity == collidingEnt) {
if (RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FALL_FALL) && -0.016f * CTimer::GetTimeStep() > m_vecMoveSpeed.z) { if (RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FALL_FALL) && -0.016f * CTimer::GetTimeStep() > m_vecMoveSpeed.z) {
InflictDamage(collidingEnt, WEAPONTYPE_FALL_DAMAGE, 15.0f, PEDPIECE_TORSO, 2); InflictDamage(collidingEnt, WEAPONTYPE_FALL, 15.0f, PEDPIECE_TORSO, 2);
} }
} else { } else {
float damage = 100.0f * max(speed - 0.25f, 0.0f); float damage = 100.0f * max(speed - 0.25f, 0.0f);
@ -14588,7 +14588,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
CVector2D offset = -m_vecMoveSpeed; CVector2D offset = -m_vecMoveSpeed;
dir = GetLocalDirection(offset); dir = GetLocalDirection(offset);
} }
InflictDamage(collidingEnt, WEAPONTYPE_FALL_DAMAGE, damage, PEDPIECE_TORSO, dir); InflictDamage(collidingEnt, WEAPONTYPE_FALL, damage, PEDPIECE_TORSO, dir);
if (IsPlayer() && damage2 > 5.0f) if (IsPlayer() && damage2 > 5.0f)
Say(SOUND_PED_LAND); Say(SOUND_PED_LAND);
} }
@ -14599,7 +14599,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
if (m_vecMoveSpeed.z >= -0.25f && (speedSqr = m_vecMoveSpeed.MagnitudeSqr()) <= sq(0.5f)) { if (m_vecMoveSpeed.z >= -0.25f && (speedSqr = m_vecMoveSpeed.MagnitudeSqr()) <= sq(0.5f)) {
if (RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FALL_FALL) && -0.016f * CTimer::GetTimeStep() > m_vecMoveSpeed.z) { if (RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FALL_FALL) && -0.016f * CTimer::GetTimeStep() > m_vecMoveSpeed.z) {
InflictDamage(collidingEnt, WEAPONTYPE_FALL_DAMAGE, 15.0f, PEDPIECE_TORSO, 2); InflictDamage(collidingEnt, WEAPONTYPE_FALL, 15.0f, PEDPIECE_TORSO, 2);
} }
} else { } else {
if (speedSqr == 0.0f) if (speedSqr == 0.0f)
@ -14610,7 +14610,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
CVector2D offset = -m_vecMoveSpeed; CVector2D offset = -m_vecMoveSpeed;
dir = GetLocalDirection(offset); dir = GetLocalDirection(offset);
} }
InflictDamage(collidingEnt, WEAPONTYPE_FALL_DAMAGE, 350.0f * sq(speedSqr), PEDPIECE_TORSO, dir); InflictDamage(collidingEnt, WEAPONTYPE_FALL, 350.0f * sq(speedSqr), PEDPIECE_TORSO, dir);
} }
} }
#endif #endif
@ -15036,7 +15036,7 @@ CPed::ProcessBuoyancy(void)
CVector pos = GetPosition(); CVector pos = GetPosition();
if (PlacePedOnDryLand()) { if (PlacePedOnDryLand()) {
if (m_fHealth > 20.0f) if (m_fHealth > 20.0f)
InflictDamage(nil, WEAPONTYPE_WATER, 15.0f, PEDPIECE_TORSO, false); InflictDamage(nil, WEAPONTYPE_DROWNING, 15.0f, PEDPIECE_TORSO, false);
if (bIsInTheAir) { if (bIsInTheAir) {
RpAnimBlendClumpSetBlendDeltas(GetClump(), ASSOC_PARTIAL, -1000.0f); RpAnimBlendClumpSetBlendDeltas(GetClump(), ASSOC_PARTIAL, -1000.0f);
@ -15058,7 +15058,7 @@ CPed::ProcessBuoyancy(void)
m_vecMoveSpeed.y *= speedMult; m_vecMoveSpeed.y *= speedMult;
m_vecMoveSpeed.z *= speedMult; m_vecMoveSpeed.z *= speedMult;
bIsStanding = false; bIsStanding = false;
InflictDamage(nil, WEAPONTYPE_WATER, 3.0f * CTimer::GetTimeStep(), PEDPIECE_TORSO, 0); InflictDamage(nil, WEAPONTYPE_DROWNING, 3.0f * CTimer::GetTimeStep(), PEDPIECE_TORSO, 0);
} }
if (buoyancyImpulse.z / m_fMass > 0.002f * CTimer::GetTimeStep()) { if (buoyancyImpulse.z / m_fMass > 0.002f * CTimer::GetTimeStep()) {
if (speedMult == 0.0f) { if (speedMult == 0.0f) {

View File

@ -59,9 +59,6 @@ int &CCoronas::bChangeBrightnessImmediately = *(int*)0x8E2C30;
CRegisteredCorona *CCoronas::aCoronas = (CRegisteredCorona*)0x72E518; CRegisteredCorona *CCoronas::aCoronas = (CRegisteredCorona*)0x72E518;
//WRAPPER void CCoronas::Render(void) { EAXJMP(0x4F8FB0); }
//WRAPPER void CCoronas::RenderReflections(void) { EAXJMP(0x4F9B40); }
const char aCoronaSpriteNames[][32] = { const char aCoronaSpriteNames[][32] = {
"coronastar", "coronastar",
"corona", "corona",

View File

@ -103,9 +103,6 @@ struct
RwTexture *&gpSniperSightTex = *(RwTexture**)0x8F5834; RwTexture *&gpSniperSightTex = *(RwTexture**)0x8F5834;
RwTexture *&gpRocketSightTex = *(RwTexture**)0x8E2C20; RwTexture *&gpRocketSightTex = *(RwTexture**)0x8E2C20;
#if 0
WRAPPER void CHud::Draw(void) { EAXJMP(0x5052A0); }
#else
void CHud::Draw() void CHud::Draw()
{ {
// disable hud via second controller // disable hud via second controller
@ -1004,12 +1001,7 @@ void CHud::Draw()
} }
} }
} }
#endif
#if 0
WRAPPER void CHud::DrawAfterFade(void) { EAXJMP(0x509030); }
#else
void CHud::DrawAfterFade() void CHud::DrawAfterFade()
{ {
if (CTimer::GetIsUserPaused() || CReplay::IsPlayingBack()) if (CTimer::GetIsUserPaused() || CReplay::IsPlayingBack())
@ -1261,11 +1253,7 @@ void CHud::DrawAfterFade()
BigMessageInUse[1] = 0.0f; BigMessageInUse[1] = 0.0f;
} }
} }
#endif
#if 0
WRAPPER void CHud::GetRidOfAllHudMessages(void) { EAXJMP(0x504F90); }
#else
void CHud::GetRidOfAllHudMessages() void CHud::GetRidOfAllHudMessages()
{ {
m_ZoneState = 0; m_ZoneState = 0;
@ -1301,7 +1289,6 @@ void CHud::GetRidOfAllHudMessages()
m_BigMessage[i][j] = 0; m_BigMessage[i][j] = 0;
} }
} }
#endif
void CHud::Initialise() void CHud::Initialise()
{ {
@ -1343,9 +1330,6 @@ void CHud::Initialise()
CTxdStore::PopCurrentTxd(); CTxdStore::PopCurrentTxd();
} }
#if 0
WRAPPER void CHud::ReInitialise(void) { EAXJMP(0x504CC0); }
#else
void CHud::ReInitialise() { void CHud::ReInitialise() {
m_Wants_To_Draw_Hud = true; m_Wants_To_Draw_Hud = true;
m_Wants_To_Draw_3dMarkers = true; m_Wants_To_Draw_3dMarkers = true;
@ -1367,12 +1351,9 @@ void CHud::ReInitialise() {
PagerSoundPlayed = 0; PagerSoundPlayed = 0;
PagerXOffset = 150.0f; PagerXOffset = 150.0f;
} }
#endif
wchar LastBigMessage[6][128]; wchar LastBigMessage[6][128];
#if 0
WRAPPER void CHud::SetBigMessage(wchar *message, int16 style) { EAXJMP(0x50A250); }
#else
void CHud::SetBigMessage(wchar *message, int16 style) void CHud::SetBigMessage(wchar *message, int16 style)
{ {
int i = 0; int i = 0;
@ -1400,11 +1381,7 @@ void CHud::SetBigMessage(wchar *message, int16 style)
LastBigMessage[style][i] = 0; LastBigMessage[style][i] = 0;
m_BigMessage[style][i] = 0; m_BigMessage[style][i] = 0;
} }
#endif
#if 0
WRAPPER void CHud::SetHelpMessage(wchar *message, bool quick) { EAXJMP(0x5051E0); }
#else
void CHud::SetHelpMessage(wchar *message, bool quick) void CHud::SetHelpMessage(wchar *message, bool quick)
{ {
if (!CReplay::IsPlayingBack()) { if (!CReplay::IsPlayingBack()) {
@ -1419,11 +1396,7 @@ void CHud::SetHelpMessage(wchar *message, bool quick)
m_HelpMessageQuick = quick; m_HelpMessageQuick = quick;
} }
} }
#endif
#if 0
WRAPPER void CHud::SetMessage(wchar *message) { EAXJMP(0x50A210); }
#else
void CHud::SetMessage(wchar *message) void CHud::SetMessage(wchar *message)
{ {
int i = 0; int i = 0;
@ -1435,11 +1408,7 @@ void CHud::SetMessage(wchar *message)
} }
m_Message[i] = 0; m_Message[i] = 0;
} }
#endif
#if 0
WRAPPER void CHud::SetPagerMessage(wchar *message) { EAXJMP(0x50A320); }
#else
void CHud::SetPagerMessage(wchar *message) void CHud::SetPagerMessage(wchar *message)
{ {
int i = 0; int i = 0;
@ -1451,25 +1420,16 @@ void CHud::SetPagerMessage(wchar *message)
} }
m_PagerMessage[i] = 0; m_PagerMessage[i] = 0;
} }
#endif
#if 0
WRAPPER void CHud::SetVehicleName(wchar *name) { EAXJMP(0x505290); }
#else
void CHud::SetVehicleName(wchar *name) void CHud::SetVehicleName(wchar *name)
{ {
m_VehicleName = name; m_VehicleName = name;
} }
#endif
#if 0
WRAPPER void CHud::SetZoneName(wchar *name) { EAXJMP(0x5051D0); }
#else
void CHud::SetZoneName(wchar *name) void CHud::SetZoneName(wchar *name)
{ {
m_pZoneName = name; m_pZoneName = name;
} }
#endif
void CHud::Shutdown() void CHud::Shutdown()
{ {

View File

@ -7,3 +7,4 @@ WRAPPER void CRubbish::StirUp(CVehicle *veh) { EAXJMP(0x512690); }
WRAPPER void CRubbish::Update(void) { EAXJMP(0x511B90); } WRAPPER void CRubbish::Update(void) { EAXJMP(0x511B90); }
WRAPPER void CRubbish::SetVisibility(bool) { EAXJMP(0x512AA0); } WRAPPER void CRubbish::SetVisibility(bool) { EAXJMP(0x512AA0); }
WRAPPER void CRubbish::Init(void) { EAXJMP(0x511940); } WRAPPER void CRubbish::Init(void) { EAXJMP(0x511940); }
WRAPPER void CRubbish::Shutdown(void) { EAXJMP(0x511B50); }

View File

@ -10,4 +10,5 @@ public:
static void Update(void); static void Update(void);
static void SetVisibility(bool); static void SetVisibility(bool);
static void Init(void); static void Init(void);
static void Shutdown(void);
}; };

View File

@ -9,3 +9,4 @@ WRAPPER void CSkidmarks::Render(void) { EAXJMP(0x5182E0); }
WRAPPER void CSkidmarks::RegisterOne(uint32 id, CVector pos, float fwdx, float fwdY, bool *isMuddy, bool *isBloddy) { EAXJMP(0x5185C0); } WRAPPER void CSkidmarks::RegisterOne(uint32 id, CVector pos, float fwdx, float fwdY, bool *isMuddy, bool *isBloddy) { EAXJMP(0x5185C0); }
WRAPPER void CSkidmarks::Init(void) { EAXJMP(0x517D70); } WRAPPER void CSkidmarks::Init(void) { EAXJMP(0x517D70); }
WRAPPER void CSkidmarks::Shutdown(void) { EAXJMP(0x518100); }

View File

@ -8,4 +8,5 @@ public:
static void Render(void); static void Render(void);
static void RegisterOne(uint32 id, CVector pos, float fwdx, float fwdY, bool *isMuddy, bool *isBloddy); static void RegisterOne(uint32 id, CVector pos, float fwdx, float fwdY, bool *isMuddy, bool *isBloddy);
static void Init(void); static void Init(void);
static void Shutdown(void);
}; };

View File

@ -20,6 +20,7 @@
WRAPPER void CSpecialFX::Render(void) { EAXJMP(0x518DC0); } WRAPPER void CSpecialFX::Render(void) { EAXJMP(0x518DC0); }
WRAPPER void CSpecialFX::Update(void) { EAXJMP(0x518D40); } WRAPPER void CSpecialFX::Update(void) { EAXJMP(0x518D40); }
WRAPPER void CSpecialFX::Init(void) { EAXJMP(0x5189E0); } WRAPPER void CSpecialFX::Init(void) { EAXJMP(0x5189E0); }
WRAPPER void CSpecialFX::Shutdown(void) { EAXJMP(0x518BE0); }
WRAPPER void CMotionBlurStreaks::RegisterStreak(int32 id, uint8 r, uint8 g, uint8 b, CVector p1, CVector p2) { EAXJMP(0x519460); } WRAPPER void CMotionBlurStreaks::RegisterStreak(int32 id, uint8 r, uint8 g, uint8 b, CVector p1, CVector p2) { EAXJMP(0x519460); }

View File

@ -6,6 +6,7 @@ public:
static void Render(void); static void Render(void);
static void Update(void); static void Update(void);
static void Init(void); static void Init(void);
static void Shutdown(void);
}; };
class CMotionBlurStreaks class CMotionBlurStreaks

View File

@ -1,45 +1,106 @@
#include "common.h" #include "common.h"
#include "patcher.h" #include "patcher.h"
#include "WeaponEffects.h" #include "WeaponEffects.h"
#include "TxdStore.h" #include "TxdStore.h"
#include "Sprite.h"
WRAPPER void CWeaponEffects::Render(void) { EAXJMP(0x564D70); } RwTexture *gpCrossHairTex;
RwRaster *gpCrossHairRaster;
CWeaponEffects &gCrossHair = *(CWeaponEffects*)0x6503BC; CWeaponEffects gCrossHair;
CWeaponEffects::CWeaponEffects()
{
}
CWeaponEffects::~CWeaponEffects()
{
}
void void
CWeaponEffects::ClearCrossHair() CWeaponEffects::Init(void)
{ {
gCrossHair.m_bCrosshair = false; gCrossHair.m_bActive = false;
gCrossHair.m_vecPos = CVector(0.0f, 0.0f, 0.0f);
gCrossHair.m_nRed = 0;
gCrossHair.m_nGreen = 0;
gCrossHair.m_nBlue = 0;
gCrossHair.m_nAlpha = 255;
gCrossHair.m_fSize = 1.0f;
gCrossHair.m_fRotation = 0.0f;
CTxdStore::PushCurrentTxd();
int32 slot = CTxdStore::FindTxdSlot("particle");
CTxdStore::SetCurrentTxd(slot);
gpCrossHairTex = RwTextureRead("crosshair", nil);
gpCrossHairRaster = RwTextureGetRaster(gpCrossHairTex);
CTxdStore::PopCurrentTxd();
}
void
CWeaponEffects::Shutdown(void)
{
RwTextureDestroy(gpCrossHairTex);
} }
void void
CWeaponEffects::MarkTarget(CVector pos, uint8 red, uint8 green, uint8 blue, uint8 alpha, float size) CWeaponEffects::MarkTarget(CVector pos, uint8 red, uint8 green, uint8 blue, uint8 alpha, float size)
{ {
gCrossHair.m_bCrosshair = true; gCrossHair.m_bActive = true;
gCrossHair.m_vecPos = pos; gCrossHair.m_vecPos = pos;
gCrossHair.m_red = red; gCrossHair.m_nRed = red;
gCrossHair.m_green = green; gCrossHair.m_nGreen = green;
gCrossHair.m_blue = blue; gCrossHair.m_nBlue = blue;
gCrossHair.m_alpha = alpha; gCrossHair.m_nAlpha = alpha;
gCrossHair.m_size = size; gCrossHair.m_fSize = size;
} }
void void
CWeaponEffects::Init() CWeaponEffects::ClearCrossHair(void)
{ {
gCrossHair.m_bCrosshair = false; gCrossHair.m_bActive = false;
gCrossHair.m_vecPos = CVector(0.0f, 0.0f, 0.0f);
gCrossHair.m_red = 0;
gCrossHair.m_green = 0;
gCrossHair.m_blue = 0;
gCrossHair.m_alpha = 255;
gCrossHair.m_size = 1.0f;
gCrossHair.field_24 = 0;
CTxdStore::PushCurrentTxd();
CTxdStore::SetCurrentTxd(CTxdStore::FindTxdSlot("particle"));
gCrossHair.m_pTexture = RwTextureRead("crosshair", nil);
gCrossHair.m_pRaster = gCrossHair.m_pTexture->raster;
CTxdStore::PopCurrentTxd();
} }
void
CWeaponEffects::Render(void)
{
if ( gCrossHair.m_bActive )
{
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void *)gpCrossHairRaster);
RwV3d pos;
float w, h;
if ( CSprite::CalcScreenCoors(gCrossHair.m_vecPos, &pos, &w, &h, true) )
{
float recipz = 1.0f / pos.z;
CSprite::RenderOneXLUSprite(pos.x, pos.y, pos.z,
gCrossHair.m_fSize * w, gCrossHair.m_fSize * h,
gCrossHair.m_nRed, gCrossHair.m_nGreen, gCrossHair.m_nBlue, 255,
recipz, 255);
}
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)FALSE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)FALSE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDINVSRCALPHA);
}
}
STARTPATCHES
//InjectHook(0x564C40, CWeaponEffects::CWeaponEffects, PATCH_JUMP);
//InjectHook(0x564C50, CWeaponEffects::~CWeaponEffects, PATCH_JUMP);
InjectHook(0x564C60, CWeaponEffects::Init, PATCH_JUMP);
InjectHook(0x564CF0, CWeaponEffects::Shutdown, PATCH_JUMP);
InjectHook(0x564D00, CWeaponEffects::MarkTarget, PATCH_JUMP);
InjectHook(0x564D60, CWeaponEffects::ClearCrossHair, PATCH_JUMP);
InjectHook(0x564D70, CWeaponEffects::Render, PATCH_JUMP);
ENDPATCHES

View File

@ -3,21 +3,25 @@
class CWeaponEffects class CWeaponEffects
{ {
public: public:
bool m_bCrosshair; bool m_bActive;
int8 gap_1[3]; char _pad[3];
CVector m_vecPos; CVector m_vecPos;
uint8 m_red; uint8 m_nRed;
uint8 m_green; uint8 m_nGreen;
uint8 m_blue; uint8 m_nBlue;
uint8 m_alpha; uint8 m_nAlpha;
float m_size; float m_fSize;
int32 field_24; float m_fRotation;
RwTexture *m_pTexture;
RwRaster *m_pRaster;
public: public:
static void Render(void); CWeaponEffects();
static void ClearCrossHair(); ~CWeaponEffects();
static void MarkTarget(CVector, uint8, uint8, uint8, uint8, float);
static void Init(void); static void Init(void);
static void Shutdown(void);
static void MarkTarget(CVector pos, uint8 red, uint8 green, uint8 blue, uint8 alpha, float size);
static void ClearCrossHair(void);
static void Render(void);
}; };
VALIDATE_SIZE(CWeaponEffects, 0x1C);

View File

@ -51,7 +51,6 @@ CDate &CompileDateAndTime = *(CDate*)0x72BCB8;
#define ReadDataFromBufferPointer(buf, to) memcpy(&to, buf, sizeof(to)); buf += align4bytes(sizeof(to)); #define ReadDataFromBufferPointer(buf, to) memcpy(&to, buf, sizeof(to)); buf += align4bytes(sizeof(to));
#define WriteDataToBufferPointer(buf, from) memcpy(buf, &from, sizeof(from)); buf += align4bytes(sizeof(from)); #define WriteDataToBufferPointer(buf, from) memcpy(buf, &from, sizeof(from)); buf += align4bytes(sizeof(from));
//WRAPPER bool GenericSave(int file) { EAXJMP(0x58F8D0); }
WRAPPER bool GenericLoad() { EAXJMP(0x590A00); } WRAPPER bool GenericLoad() { EAXJMP(0x590A00); }

View File

@ -2823,13 +2823,13 @@ CAutomobile::ProcessBuoyancy(void)
if(pDriver){ if(pDriver){
pDriver->bIsInWater = true; pDriver->bIsInWater = true;
if(pDriver->IsPlayer() || !bWaterTight) if(pDriver->IsPlayer() || !bWaterTight)
pDriver->InflictDamage(nil, WEAPONTYPE_WATER, CTimer::GetTimeStep(), PEDPIECE_TORSO, 0); pDriver->InflictDamage(nil, WEAPONTYPE_DROWNING, CTimer::GetTimeStep(), PEDPIECE_TORSO, 0);
} }
for(i = 0; i < m_nNumMaxPassengers; i++) for(i = 0; i < m_nNumMaxPassengers; i++)
if(pPassengers[i]){ if(pPassengers[i]){
pPassengers[i]->bIsInWater = true; pPassengers[i]->bIsInWater = true;
if(pPassengers[i]->IsPlayer() || !bWaterTight) if(pPassengers[i]->IsPlayer() || !bWaterTight)
pPassengers[i]->InflictDamage(nil, WEAPONTYPE_WATER, CTimer::GetTimeStep(), PEDPIECE_TORSO, 0); pPassengers[i]->InflictDamage(nil, WEAPONTYPE_DROWNING, CTimer::GetTimeStep(), PEDPIECE_TORSO, 0);
} }
}else }else
bIsInWater = false; bIsInWater = false;

View File

@ -6,8 +6,6 @@
CExplosion(&gaExplosion)[48] = *(CExplosion(*)[48])*(uintptr*)0x64E208; CExplosion(&gaExplosion)[48] = *(CExplosion(*)[48])*(uintptr*)0x64E208;
WRAPPER void CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32) { EAXJMP(0x5591C0); } WRAPPER void CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32) { EAXJMP(0x5591C0); }
//WRAPPER void CExplosion::RemoveAllExplosionsInArea(CVector, float) { EAXJMP(0x55AD40); }
//WRAPPER bool CExplosion::TestForExplosionInArea(eExplosionType, float, float, float, float, float, float) { EAXJMP(0x55AC80); }
int AudioHandle = AEHANDLE_NONE; int AudioHandle = AEHANDLE_NONE;

View File

@ -6,6 +6,7 @@
#include "Ped.h" #include "Ped.h"
#include "World.h" #include "World.h"
WRAPPER void CWeapon::ShutdownWeapons(void) { EAXJMP(0x55C2F0); }
WRAPPER void CWeapon::UpdateWeapons(void) { EAXJMP(0x55C310); } WRAPPER void CWeapon::UpdateWeapons(void) { EAXJMP(0x55C310); }
WRAPPER bool CWeapon::Fire(CEntity*, CVector*) { EAXJMP(0x55C380); } WRAPPER bool CWeapon::Fire(CEntity*, CVector*) { EAXJMP(0x55C380); }
WRAPPER void CWeapon::FireFromCar(CAutomobile *car, bool left) { EAXJMP(0x55C940); } WRAPPER void CWeapon::FireFromCar(CAutomobile *car, bool left) { EAXJMP(0x55C940); }

View File

@ -15,17 +15,19 @@ enum eWeaponType
WEAPONTYPE_MOLOTOV, WEAPONTYPE_MOLOTOV,
WEAPONTYPE_GRENADE, WEAPONTYPE_GRENADE,
WEAPONTYPE_DETONATOR, WEAPONTYPE_DETONATOR,
WEAPONTYPE_TOTAL_INVENTORY_WEAPONS = 13, WEAPONTYPE_HELICANNON,
WEAPONTYPE_HELICANNON = 13, WEAPONTYPE_LAST_WEAPONTYPE,
WEAPONTYPE_TOTALWEAPONS,
WEAPONTYPE_ARMOUR, WEAPONTYPE_ARMOUR,
WEAPONTYPE_RAMMEDBYCAR, WEAPONTYPE_RAMMEDBYCAR,
WEAPONTYPE_RUNOVERBYCAR, WEAPONTYPE_RUNOVERBYCAR,
WEAPONTYPE_EXPLOSION, WEAPONTYPE_EXPLOSION,
WEAPONTYPE_UZI_DRIVEBY, WEAPONTYPE_UZI_DRIVEBY,
WEAPONTYPE_WATER, WEAPONTYPE_DROWNING,
WEAPONTYPE_FALL_DAMAGE, WEAPONTYPE_FALL,
WEAPONTYPE_UNIDENTIFIED, WEAPONTYPE_UNIDENTIFIED,
WEAPONTYPE_TOTALWEAPONS = WEAPONTYPE_LAST_WEAPONTYPE,
WEAPONTYPE_TOTAL_INVENTORY_WEAPONS = 13,
}; };
enum eWeaponFire { enum eWeaponFire {
@ -63,6 +65,7 @@ public:
m_bAddRotOffset = false; m_bAddRotOffset = false;
} }
static void ShutdownWeapons(void);
void Initialise(eWeaponType type, int ammo); void Initialise(eWeaponType type, int ammo);
void Update(int32 audioEntity); void Update(int32 audioEntity);
void Reload(void); void Reload(void);