Merge branch 'master' into MoreLanguages
# Conflicts: # src/core/Frontend.cpp # src/render/Font.cpp # src/render/Hud.cpp # src/render/Hud.h # src/text/Messages.cpp # src/text/Text.cpp
This commit is contained in:
commit
e373d0526e
36
README.md
36
README.md
@ -16,12 +16,6 @@ such that we have a working game at all times.
|
||||
- Since re3 is a DLL that works with original GTA III for now, you need Simple DLL Loader. You can get it [here](https://github.com/aap/simpledllloader).
|
||||
- Build re3 or download it from one of the above links (Debug or Release).
|
||||
- Make sure you included the re3 in `plugins.cfg` or `dlls.cfg`.
|
||||
- re3 starts the script `main_freeroam.scm` that comes along with it by default, so you should copy it to from `gamefiles/` to your game's `data/` directory.
|
||||
|
||||
![#ffa500](https://placehold.it/15/ffa500/000000?text=+) **Notice**
|
||||
|
||||
If you want to load original script/story, press and hold G while game is loading.
|
||||
This includes both starting new game and loading save game.
|
||||
|
||||
![#ffa500](https://placehold.it/15/ffa500/000000?text=+) **Notice if you will build it**
|
||||
|
||||
@ -38,35 +32,19 @@ to reverse at the time, calling the original functions is acceptable.
|
||||
|
||||
### Unreversed / incomplete classes (at least the ones we know)
|
||||
```
|
||||
cAudioManager - WIP
|
||||
CBoat
|
||||
CBrightLights
|
||||
CBulletInfo
|
||||
CCrane
|
||||
CCranes
|
||||
CCullZone
|
||||
CCullZones
|
||||
CExplosion
|
||||
CFallingGlassPane
|
||||
CGlass
|
||||
CMenuManager - WIP
|
||||
CMotionBlurStreaks
|
||||
CObject
|
||||
CPacManPickups
|
||||
CPedPath
|
||||
CRecordDataForChase
|
||||
CRoadBlocks
|
||||
CRubbish
|
||||
CSceneEdit
|
||||
CSkidmarks
|
||||
CSpecialFX
|
||||
CStats
|
||||
CTrafficLights
|
||||
CWeapon
|
||||
CWeather
|
||||
CWorld
|
||||
```
|
||||
|
||||
The following classes have only unused or practically unused code left:
|
||||
```
|
||||
CCullZone - only mobile stuff
|
||||
CCullZones - only mobile stuff
|
||||
CSceneEdit
|
||||
```
|
||||
|
||||
### Coding style
|
||||
|
||||
I started writing in [Plan 9 style](http://man.cat-v.org/plan_9/6/style),
|
||||
|
BIN
gamefiles/menu.txd
Normal file
BIN
gamefiles/menu.txd
Normal file
Binary file not shown.
22
premake5.lua
22
premake5.lua
@ -1,5 +1,5 @@
|
||||
workspace "re3"
|
||||
configurations { "Debug", "Release", "ReleaseFH" }
|
||||
configurations { "Debug", "Release", "ReleaseFH", "DebugRW", "ReleaseRW" }
|
||||
location "build"
|
||||
|
||||
files { "src/*.*" }
|
||||
@ -13,6 +13,7 @@ workspace "re3"
|
||||
files { "src/objects/*.*" }
|
||||
files { "src/peds/*.*" }
|
||||
files { "src/render/*.*" }
|
||||
files { "src/rw/*.*" }
|
||||
files { "src/save/*.*" }
|
||||
files { "src/skel/*.*" }
|
||||
files { "src/skel/win/*.*" }
|
||||
@ -32,6 +33,7 @@ workspace "re3"
|
||||
includedirs { "src/objects" }
|
||||
includedirs { "src/peds" }
|
||||
includedirs { "src/render" }
|
||||
includedirs { "src/rw" }
|
||||
includedirs { "src/save/" }
|
||||
includedirs { "src/skel/" }
|
||||
includedirs { "src/skel/win" }
|
||||
@ -48,6 +50,12 @@ workspace "re3"
|
||||
libdirs { "dxsdk/lib" }
|
||||
libdirs { "milessdk/lib" }
|
||||
|
||||
filter "configurations:DebugRW or configurations:ReleaseRW"
|
||||
defines { "RWLIBS" }
|
||||
libdirs { "rwsdk/lib/d3d8/release" }
|
||||
links { "rwcore", "rpworld", "rpmatfx", "rpskin", "rphanim", "rtbmp" }
|
||||
filter {}
|
||||
|
||||
pbcommands = {
|
||||
"setlocal EnableDelayedExpansion",
|
||||
"set file=$(TargetPath)",
|
||||
@ -102,3 +110,15 @@ project "re3"
|
||||
staticruntime "on"
|
||||
targetextension ".asi"
|
||||
setpaths("$(GTA_III_RE_DIR)/", "gta3.exe", "scripts/")
|
||||
|
||||
filter "configurations:DebugRW"
|
||||
defines { "DEBUG" }
|
||||
staticruntime "on"
|
||||
symbols "On"
|
||||
setpaths("$(GTA_III_RE_DIR)/", "gta3.exe", "plugins/")
|
||||
|
||||
filter "configurations:ReleaseRW"
|
||||
defines { "NDEBUG" }
|
||||
optimize "On"
|
||||
staticruntime "on"
|
||||
setpaths("$(GTA_III_RE_DIR)/", "gta3.exe", "plugins/")
|
||||
|
@ -134,8 +134,8 @@ uint32 &CCutsceneMgr::ms_cutsceneLoadStatus = *(uint32*)0x95CB40;
|
||||
RpAtomic *
|
||||
CalculateBoundingSphereRadiusCB(RpAtomic *atomic, void *data)
|
||||
{
|
||||
float radius = RpAtomicGetBoundingSphereMacro(atomic)->radius;
|
||||
RwV3d center = RpAtomicGetBoundingSphereMacro(atomic)->center;
|
||||
float radius = RpAtomicGetBoundingSphere(atomic)->radius;
|
||||
RwV3d center = RpAtomicGetBoundingSphere(atomic)->center;
|
||||
|
||||
for (RwFrame *frame = RpAtomicGetFrame(atomic); RwFrameGetParent(frame); frame = RwFrameGetParent(frame))
|
||||
RwV3dTransformPoints(¢er, ¢er, 1, RwFrameGetMatrix(frame));
|
||||
@ -326,7 +326,7 @@ CCutsceneMgr::CreateCutsceneObject(int modelId)
|
||||
|
||||
pModelInfo->SetColModel(pColModel);
|
||||
clump = (RpClump*)pModelInfo->GetRwObject();
|
||||
assert(RwObjectGetType(clump) == rpCLUMP);
|
||||
assert(RwObjectGetType((RwObject*)clump) == rpCLUMP);
|
||||
RpClumpForAllAtomics(clump, CalculateBoundingSphereRadiusCB, &radius);
|
||||
|
||||
pColModel->boundingSphere.radius = radius;
|
||||
@ -352,6 +352,7 @@ CCutsceneMgr::DeleteCutsceneData(void)
|
||||
CWorld::Remove(ms_pCutsceneObjects[ms_numCutsceneObjs]);
|
||||
ms_pCutsceneObjects[ms_numCutsceneObjs]->DeleteRwObject();
|
||||
delete ms_pCutsceneObjects[ms_numCutsceneObjs];
|
||||
ms_pCutsceneObjects[ms_numCutsceneObjs] = nil;
|
||||
}
|
||||
ms_numCutsceneObjs = 0;
|
||||
|
||||
@ -409,7 +410,7 @@ CCutsceneMgr::Update(void)
|
||||
|
||||
if (!ms_running) return;
|
||||
|
||||
ms_cutsceneTimer += CTimer::GetTimeStepNonClipped() * 0.02f;
|
||||
ms_cutsceneTimer += CTimer::GetTimeStepNonClippedInSeconds();
|
||||
if (CGeneral::faststricmp(ms_cutsceneName, "end") && TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FLYBY && ms_cutsceneLoadStatus == CUTSCENE_LOADING_0) {
|
||||
if (CPad::GetPad(0)->GetCrossJustDown()
|
||||
|| (CGame::playingIntro && CPad::GetPad(0)->GetStartJustDown())
|
@ -26,7 +26,7 @@ public:
|
||||
static CDirectory *&ms_pCutsceneDir;
|
||||
static uint32 &ms_cutsceneLoadStatus;
|
||||
|
||||
static void SetRunning(bool running) { ms_running = running; }
|
||||
static void StartCutsceneProcessing() { ms_cutsceneProcessing = true; }
|
||||
static bool IsRunning(void) { return ms_running; }
|
||||
static bool IsCutsceneProcessing(void) { return ms_cutsceneProcessing; }
|
||||
static bool UseLodMultiplier(void) { return ms_useLodMultiplier; }
|
@ -10,6 +10,22 @@
|
||||
|
||||
const int CollisionSoundIntensity = 60;
|
||||
|
||||
cAudioCollisionManager::cAudioCollisionManager()
|
||||
{
|
||||
m_sQueue.m_pEntity1 = nil;
|
||||
m_sQueue.m_pEntity2 = nil;
|
||||
m_sQueue.m_bSurface1 = SURFACE_DEFAULT;
|
||||
m_sQueue.m_bSurface2 = SURFACE_DEFAULT;
|
||||
m_sQueue.m_fIntensity2 = 0.0f;
|
||||
m_sQueue.m_fIntensity1 = 0.0f;
|
||||
m_sQueue.m_vecPosition = CVector(0.0f, 0.0f, 0.0f);
|
||||
|
||||
for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
|
||||
m_bIndicesTable[i] = NUMAUDIOCOLLISIONS;
|
||||
|
||||
m_bCollisionsInQueue = 0;
|
||||
}
|
||||
|
||||
void
|
||||
cAudioCollisionManager::AddCollisionToRequestedQueue()
|
||||
{
|
||||
@ -151,21 +167,21 @@ cAudioManager::SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter)
|
||||
m_sQueueSample.m_bVolume =
|
||||
ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
|
||||
if(m_sQueueSample.m_bVolume) {
|
||||
m_sQueueSample.m_counter = counter;
|
||||
m_sQueueSample.m_nCounter = counter;
|
||||
m_sQueueSample.m_vecPos = col->m_vecPosition;
|
||||
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
|
||||
m_sQueueSample.m_bIsDistant = false;
|
||||
m_sQueueSample.field_16 = 7;
|
||||
m_sQueueSample.m_bIs2D = false;
|
||||
m_sQueueSample.m_nReleasingVolumeModificator = 7;
|
||||
m_sQueueSample.m_nLoopCount = 0;
|
||||
m_sQueueSample.m_bEmittingVolume = emittingVol;
|
||||
m_sQueueSample.m_nLoopStart =
|
||||
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
|
||||
m_sQueueSample.m_nLoopEnd =
|
||||
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
|
||||
m_sQueueSample.field_48 = 4.0f;
|
||||
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
|
||||
m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity;
|
||||
m_sQueueSample.field_56 = 0;
|
||||
m_sQueueSample.field_76 = 5;
|
||||
m_sQueueSample.m_bReleasingSoundFlag = false;
|
||||
m_sQueueSample.m_nReleasingVolumeDivider = 5;
|
||||
m_sQueueSample.m_bReverbFlag = true;
|
||||
m_sQueueSample.m_bRequireReflection = false;
|
||||
AddSampleToRequestedQueue();
|
||||
@ -270,19 +286,19 @@ cAudioManager::SetUpOneShotCollisionSound(cAudioCollision *col)
|
||||
break;
|
||||
}
|
||||
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
|
||||
m_sQueueSample.m_counter = counter++;
|
||||
m_sQueueSample.m_nCounter = counter++;
|
||||
if(counter >= 255) counter = 28;
|
||||
m_sQueueSample.m_vecPos = col->m_vecPosition;
|
||||
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
|
||||
m_sQueueSample.m_bIsDistant = false;
|
||||
m_sQueueSample.field_16 = 11;
|
||||
m_sQueueSample.m_bIs2D = false;
|
||||
m_sQueueSample.m_nReleasingVolumeModificator = 11;
|
||||
m_sQueueSample.m_nLoopCount = 1;
|
||||
m_sQueueSample.m_bEmittingVolume = emittingVol;
|
||||
m_sQueueSample.m_nLoopStart = 0;
|
||||
m_sQueueSample.m_nLoopEnd = -1;
|
||||
m_sQueueSample.field_48 = 4.0f;
|
||||
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
|
||||
m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity;
|
||||
m_sQueueSample.field_56 = 1;
|
||||
m_sQueueSample.m_bReleasingSoundFlag = true;
|
||||
m_sQueueSample.m_bReverbFlag = true;
|
||||
m_sQueueSample.m_bRequireReflection = false;
|
||||
AddSampleToRequestedQueue();
|
||||
|
@ -29,8 +29,8 @@ public:
|
||||
uint8 m_bCollisionsInQueue;
|
||||
cAudioCollision m_sQueue;
|
||||
|
||||
// reversed all methods
|
||||
void AddCollisionToRequestedQueue(); /// ok
|
||||
cAudioCollisionManager();
|
||||
void AddCollisionToRequestedQueue();
|
||||
};
|
||||
|
||||
static_assert(sizeof(cAudioCollisionManager) == 852, "cAudioCollisionManager: error");
|
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,14 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "DMAudio.h"
|
||||
#include "common.h"
|
||||
#include "config.h"
|
||||
|
||||
#include "DMAudio.h"
|
||||
|
||||
#include "AudioCollision.h"
|
||||
#include "PoliceRadio.h"
|
||||
|
||||
enum eScriptSounds : int16
|
||||
{
|
||||
enum eScriptSounds : int16 {
|
||||
SCRIPT_SOUND_0 = 0,
|
||||
SCRIPT_SOUND_1 = 1,
|
||||
SCRIPT_SOUND_2 = 2,
|
||||
@ -138,47 +139,47 @@ class tSound
|
||||
{
|
||||
public:
|
||||
int32 m_nEntityIndex;
|
||||
int32 m_counter;
|
||||
int32 m_nCounter;
|
||||
int32 m_nSampleIndex;
|
||||
uint8 m_bBankIndex;
|
||||
bool m_bIsDistant;
|
||||
uint8 field_14;
|
||||
uint8 field_15;
|
||||
int32 field_16;
|
||||
bool m_bIs2D;
|
||||
uint8 field_14; // unused
|
||||
uint8 field_15; // unused
|
||||
int32 m_nReleasingVolumeModificator;
|
||||
int32 m_nFrequency;
|
||||
uint8 m_bVolume;
|
||||
uint8 field_25;
|
||||
uint8 field_26;
|
||||
uint8 field_27;
|
||||
uint8 field_25; // unused
|
||||
uint8 field_26; // unused
|
||||
uint8 field_27; // unused
|
||||
float m_fDistance;
|
||||
int32 m_nLoopCount;
|
||||
int32 m_nLoopStart;
|
||||
int32 m_nLoopEnd;
|
||||
uint8 m_bEmittingVolume;
|
||||
uint8 field_45;
|
||||
uint8 field_46;
|
||||
uint8 field_47;
|
||||
float field_48;
|
||||
uint8 field_45; // unused
|
||||
uint8 field_46; // unused
|
||||
uint8 field_47; // unused
|
||||
float m_fSpeedMultiplier;
|
||||
float m_fSoundIntensity;
|
||||
uint8 field_56;
|
||||
uint8 field_57;
|
||||
uint8 field_58;
|
||||
uint8 field_59;
|
||||
bool m_bReleasingSoundFlag;
|
||||
uint8 field_57; // unused
|
||||
uint8 field_58; // unused
|
||||
uint8 field_59; // unused
|
||||
CVector m_vecPos;
|
||||
bool m_bReverbFlag;
|
||||
uint8 m_bLoopsRemaining;
|
||||
bool m_bRequireReflection;
|
||||
bool m_bRequireReflection; // Used for oneshots
|
||||
uint8 m_bOffset;
|
||||
int32 field_76;
|
||||
uint8 m_bIsProcessed;
|
||||
uint8 m_bLoopEnded;
|
||||
uint8 field_82;
|
||||
uint8 field_83;
|
||||
int32 calculatedVolume;
|
||||
int8 field_88;
|
||||
uint8 field_89;
|
||||
uint8 field_90;
|
||||
uint8 field_91;
|
||||
int32 m_nReleasingVolumeDivider;
|
||||
bool m_bIsProcessed;
|
||||
bool m_bLoopEnded;
|
||||
uint8 field_82; // unused
|
||||
uint8 field_83; // unused
|
||||
int32 m_nCalculatedVolume;
|
||||
int8 m_nVolumeChange;
|
||||
uint8 field_89; // unused
|
||||
uint8 field_90; // unused
|
||||
uint8 field_91; // unused
|
||||
|
||||
// no methods
|
||||
};
|
||||
@ -196,7 +197,7 @@ public:
|
||||
bool m_bIsUsed;
|
||||
uint8 m_bStatus;
|
||||
int16 m_awAudioEvent[NUM_AUDIOENTITY_EVENTS];
|
||||
uint8 gap_18[2];
|
||||
//uint8 gap_18[2];
|
||||
float m_afVolume[NUM_AUDIOENTITY_EVENTS];
|
||||
uint8 m_AudioEvents;
|
||||
uint8 field_25[3];
|
||||
@ -210,12 +211,11 @@ class tPedComment
|
||||
{
|
||||
public:
|
||||
int32 m_nSampleIndex;
|
||||
int32 m_entityIndex;
|
||||
int32 m_nEntityIndex;
|
||||
CVector m_vecPos;
|
||||
float m_fDistance;
|
||||
uint8 m_bVolume;
|
||||
int8 field_25; // allocated time?
|
||||
uint8 gap_26[2];
|
||||
int8 m_nProcess;
|
||||
|
||||
// no methods
|
||||
};
|
||||
@ -226,14 +226,13 @@ class cPedComments
|
||||
{
|
||||
public:
|
||||
tPedComment m_asPedComments[NUM_PED_COMMENTS_BANKS][NUM_PED_COMMENTS_SLOTS];
|
||||
uint8 indexMap[NUM_PED_COMMENTS_BANKS][NUM_PED_COMMENTS_SLOTS];
|
||||
uint8 nrOfCommentsInBank[NUM_PED_COMMENTS_BANKS];
|
||||
uint8 activeBank;
|
||||
uint8 gap_1163[1];
|
||||
uint8 m_nIndexMap[NUM_PED_COMMENTS_BANKS][NUM_PED_COMMENTS_SLOTS];
|
||||
uint8 m_nCommentsInBank[NUM_PED_COMMENTS_BANKS];
|
||||
uint8 m_nActiveBank;
|
||||
|
||||
// reversed all methods
|
||||
void Add(tPedComment *com); /// ok
|
||||
void Process(); /// ok
|
||||
cPedComments();
|
||||
void Add(tPedComment *com);
|
||||
void Process();
|
||||
};
|
||||
|
||||
static_assert(sizeof(cPedComments) == 1164, "cPedComments: error");
|
||||
@ -244,23 +243,35 @@ class cMissionAudio
|
||||
{
|
||||
public:
|
||||
CVector m_vecPos;
|
||||
uint8 field_12;
|
||||
uint8 gap_13[3];
|
||||
bool m_bPredefinedProperties;
|
||||
//uint8 gap_13[3];
|
||||
int m_nSampleIndex;
|
||||
uint8 m_bLoadingStatus;
|
||||
uint8 m_bPlayStatus;
|
||||
uint8 field_22;
|
||||
uint8 field_23;
|
||||
int field_24;
|
||||
uint8 field_22; // todo find a name
|
||||
uint8 field_23; // unused
|
||||
int32 m_nMissionAudioCounter;
|
||||
bool m_bIsPlayed;
|
||||
uint8 field_29;
|
||||
uint8 field_30;
|
||||
uint8 field_31;
|
||||
// no methods
|
||||
uint8 field_29; // unused
|
||||
uint8 field_30; // unused
|
||||
uint8 field_31; // unused
|
||||
// no methods
|
||||
};
|
||||
|
||||
static_assert(sizeof(cMissionAudio) == 32, "cMissionAudio: error");
|
||||
|
||||
// name made up
|
||||
class cAudioScriptObjectManager
|
||||
{
|
||||
public:
|
||||
int32 m_anScriptObjectEntityIndices[NUM_SCRIPT_MAX_ENTITIES];
|
||||
int32 m_nScriptObjectEntityTotal;
|
||||
|
||||
cAudioScriptObjectManager() { m_nScriptObjectEntityTotal = 0; }
|
||||
~cAudioScriptObjectManager() { m_nScriptObjectEntityTotal = 0; }
|
||||
};
|
||||
|
||||
|
||||
class cVehicleParams;
|
||||
class CPlane;
|
||||
class CVehicle;
|
||||
@ -289,22 +300,22 @@ class cAudioManager
|
||||
{
|
||||
public:
|
||||
bool m_bIsInitialised;
|
||||
uint8 field_1;
|
||||
uint8 field_2;
|
||||
uint8 field_1; // unused
|
||||
bool m_bFifthFrameFlag;
|
||||
uint8 m_bActiveSamples;
|
||||
uint8 field_4;
|
||||
uint8 field_4; // unused
|
||||
bool m_bDynamicAcousticModelingStatus;
|
||||
uint8 field_6;
|
||||
uint8 field_7;
|
||||
float speedOfSound;
|
||||
uint8 field_6; // unused
|
||||
uint8 field_7; // unused
|
||||
float m_fSpeedOfSound;
|
||||
bool m_bTimerJustReset;
|
||||
uint8 field_13;
|
||||
uint8 field_14;
|
||||
uint8 field_15;
|
||||
uint8 field_13; // unused
|
||||
uint8 field_14; // unused
|
||||
uint8 field_15; // unused
|
||||
int32 m_nTimer;
|
||||
tSound m_sQueueSample;
|
||||
bool m_bActiveSampleQueue;
|
||||
uint8 gap_109[3];
|
||||
uint8 gap_109[3]; // unused
|
||||
tSound m_asSamples[NUM_SOUNDS_SAMPLES_BANKS][NUM_SOUNDS_SAMPLES_SLOTS];
|
||||
uint8 m_abSampleQueueIndexTable[NUM_SOUNDS_SAMPLES_BANKS][NUM_SOUNDS_SAMPLES_SLOTS];
|
||||
uint8 m_bSampleRequestQueuesStatus[NUM_SOUNDS_SAMPLES_BANKS];
|
||||
@ -314,8 +325,7 @@ public:
|
||||
int32 m_nAudioEntitiesTotal;
|
||||
CVector m_avecReflectionsPos[NUM_AUDIO_REFLECTIONS];
|
||||
float m_afReflectionsDistances[NUM_AUDIO_REFLECTIONS];
|
||||
int32 m_anScriptObjectEntityIndices[NUM_SCRIPT_MAX_ENTITIES];
|
||||
int32 m_nScriptObjectEntityTotal;
|
||||
cAudioScriptObjectManager m_sAudioScriptObjectManager;
|
||||
cPedComments m_sPedComments;
|
||||
int32 m_nFireAudioEntity;
|
||||
int32 m_nWaterCannonEntity;
|
||||
@ -328,12 +338,15 @@ public:
|
||||
int32 m_nBridgeEntity;
|
||||
cMissionAudio m_sMissionAudio;
|
||||
int32 m_anRandomTable[5];
|
||||
uint8 field_19192;
|
||||
uint8 m_bTimeSpent;
|
||||
uint8 m_bUserPause;
|
||||
uint8 m_bPreviousUserPause;
|
||||
uint8 field_19195; // time?
|
||||
uint8 field_19195; // unused
|
||||
uint32 m_FrameCounter;
|
||||
|
||||
cAudioManager();
|
||||
~cAudioManager();
|
||||
|
||||
// getters
|
||||
uint32 GetFrameCounter() const { return m_FrameCounter; }
|
||||
float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; }
|
||||
@ -341,29 +354,29 @@ public:
|
||||
bool IsMissionAudioPlaying() const { return m_sMissionAudio.m_bPlayStatus == 1; }
|
||||
|
||||
// "Should" be in alphabetic order, except "getXTalkSfx"
|
||||
void AddDetailsToRequestedOrderList(uint8 sample); /// ok (check once more)
|
||||
void AddDetailsToRequestedOrderList(uint8 sample);
|
||||
void AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 unk1,
|
||||
uint8 counter, bool notLooping); /// ok
|
||||
void AddReflectionsToRequestedQueue(); /// ok (check value)
|
||||
void AddReleasingSounds(); /// ok (check)
|
||||
void AddSampleToRequestedQueue(); /// ok
|
||||
void AgeCrimes(); /// ok
|
||||
uint8 counter, bool notLooping);
|
||||
void AddReflectionsToRequestedQueue();
|
||||
void AddReleasingSounds();
|
||||
void AddSampleToRequestedQueue();
|
||||
void AgeCrimes();
|
||||
|
||||
void CalculateDistance(bool &condition, float dist); /// ok
|
||||
bool CheckForAnAudioFileOnCD() const; /// ok
|
||||
void ClearActiveSamples(); /// ok
|
||||
void ClearMissionAudio(); /// ok
|
||||
void ClearRequestedQueue(); /// ok
|
||||
void CalculateDistance(bool &condition, float dist);
|
||||
bool CheckForAnAudioFileOnCD() const;
|
||||
void ClearActiveSamples();
|
||||
void ClearMissionAudio();
|
||||
void ClearRequestedQueue();
|
||||
int32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2,
|
||||
float speedMultiplier) const; /// ok
|
||||
int32 ComputePan(float, CVector *); /// ok
|
||||
uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const; /// ok
|
||||
int32 CreateEntity(int32 type, void *entity); /// ok
|
||||
float speedMultiplier) const;
|
||||
int32 ComputePan(float, CVector *);
|
||||
uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const;
|
||||
int32 CreateEntity(int32 type, void *entity);
|
||||
|
||||
void DestroyAllGameCreatedEntities(); /// ok
|
||||
void DestroyEntity(int32 id); /// ok
|
||||
void DoJumboVolOffset() const; /// ok
|
||||
void DoPoliceRadioCrackle(); /// ok
|
||||
void DestroyAllGameCreatedEntities();
|
||||
void DestroyEntity(int32 id);
|
||||
void DoJumboVolOffset() const;
|
||||
void DoPoliceRadioCrackle();
|
||||
|
||||
// functions returning talk sfx,
|
||||
// order from GetPedCommentSfx
|
||||
@ -445,154 +458,151 @@ public:
|
||||
uint32 GetGenericFemaleTalkSfx(int16 sound);
|
||||
// end of functions returning talk sfx
|
||||
|
||||
void GenerateIntegerRandomNumberTable(); /// ok
|
||||
void GenerateIntegerRandomNumberTable();
|
||||
char *Get3DProviderName(uint8 id) const;
|
||||
uint8 GetCDAudioDriveLetter() const;
|
||||
int8 GetCurrent3DProviderIndex() const; /// ok
|
||||
int8 GetCurrent3DProviderIndex() const;
|
||||
float GetCollisionLoopingRatio(uint32 a, uint32 b, float c) const; // not used
|
||||
float GetCollisionOneShotRatio(int32 a, float b) const; /// ok
|
||||
float GetCollisionRatio(float a, float b, float c, float d) const; /// ok
|
||||
float GetDistanceSquared(CVector *v) const; /// ok
|
||||
int32 GetJumboTaxiFreq() const; /// ok
|
||||
bool GetMissionAudioLoadingStatus() const; /// ok
|
||||
int8 GetMissionScriptPoliceAudioPlayingStatus() const; /// ok
|
||||
float GetCollisionOneShotRatio(int32 a, float b) const;
|
||||
float GetCollisionRatio(float a, float b, float c, float d) const;
|
||||
float GetDistanceSquared(CVector *v) const;
|
||||
int32 GetJumboTaxiFreq() const;
|
||||
bool GetMissionAudioLoadingStatus() const;
|
||||
int8 GetMissionScriptPoliceAudioPlayingStatus() const;
|
||||
uint8 GetNum3DProvidersAvailable() const;
|
||||
int32 GetPedCommentSfx(CPed *ped, int32 sound);
|
||||
void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint32 maxOffset) const;
|
||||
float GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile,
|
||||
cTransmission *transmission,
|
||||
float velocityChange); /// ok
|
||||
cTransmission *transmission, float velocityChange);
|
||||
float GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile,
|
||||
cTransmission *transmission,
|
||||
float velocityChange); /// ok
|
||||
cTransmission *transmission, float velocityChange);
|
||||
|
||||
bool HasAirBrakes(int32 model) const; /// ok
|
||||
bool HasAirBrakes(int32 model) const;
|
||||
|
||||
void Initialise(); /// ok
|
||||
void InitialisePoliceRadio(); /// ok
|
||||
void InitialisePoliceRadioZones(); /// ok
|
||||
void InterrogateAudioEntities(); /// ok
|
||||
bool IsAudioInitialised() const; /// ok
|
||||
bool IsMissionAudioSampleFinished(); /// ok
|
||||
void Initialise();
|
||||
void InitialisePoliceRadio();
|
||||
void InitialisePoliceRadioZones();
|
||||
void InterrogateAudioEntities();
|
||||
bool IsAudioInitialised() const;
|
||||
bool IsMissionAudioSampleFinished();
|
||||
bool IsMP3RadioChannelAvailable() const;
|
||||
|
||||
bool MissionScriptAudioUsesPoliceChannel(int32 soundMission) const; /// ok
|
||||
bool MissionScriptAudioUsesPoliceChannel(int32 soundMission) const;
|
||||
|
||||
void PlayLoadedMissionAudio(); /// ok
|
||||
void PlayOneShot(int32 index, int16 sound, float vol); /// ok
|
||||
void PlaySuspectLastSeen(float x, float y, float z); /// ok
|
||||
void PlayerJustGotInCar() const; /// ok
|
||||
void PlayerJustLeftCar() const; /// ok
|
||||
void PostInitialiseGameSpecificSetup(); /// ok
|
||||
void PostTerminateGameSpecificShutdown(); /// ok
|
||||
void PreInitialiseGameSpecificSetup() const; /// ok
|
||||
void PreloadMissionAudio(const char *name); /// ok
|
||||
void PreTerminateGameSpecificShutdown(); /// ok
|
||||
void PlayLoadedMissionAudio();
|
||||
void PlayOneShot(int32 index, int16 sound, float vol);
|
||||
void PlaySuspectLastSeen(float x, float y, float z);
|
||||
void PlayerJustGotInCar() const;
|
||||
void PlayerJustLeftCar() const;
|
||||
void PostInitialiseGameSpecificSetup();
|
||||
void PostTerminateGameSpecificShutdown();
|
||||
void PreInitialiseGameSpecificSetup() const;
|
||||
void PreloadMissionAudio(const char *name);
|
||||
void PreTerminateGameSpecificShutdown();
|
||||
/// processX - main logic of adding new sounds
|
||||
void ProcessActiveQueues(); /// ok
|
||||
bool ProcessAirBrakes(cVehicleParams *params); /// ok
|
||||
void ProcessAirportScriptObject(uint8 sound); /// ok
|
||||
bool ProcessBoatEngine(cVehicleParams *params); /// ok
|
||||
bool ProcessBoatMovingOverWater(cVehicleParams *params); /// ok
|
||||
void ProcessBridge(); /// ok
|
||||
void ProcessBridgeMotor(); /// ok
|
||||
void ProcessBridgeOneShots(); /// ok
|
||||
void ProcessBridgeWarning(); /// ok
|
||||
bool ProcessCarBombTick(cVehicleParams *params); /// ok
|
||||
void ProcessCesna(cVehicleParams *params); /// ok
|
||||
void ProcessCinemaScriptObject(uint8 sound); /// ok
|
||||
void ProcessCrane(); /// ok
|
||||
void ProcessDocksScriptObject(uint8 sound); /// ok
|
||||
bool ProcessEngineDamage(cVehicleParams *params); /// ok
|
||||
void ProcessEntity(int32 sound); /// ok
|
||||
void ProcessExplosions(int32 explosion); /// ok
|
||||
void ProcessFireHydrant(); /// ok
|
||||
void ProcessFires(int32 entity); /// ok
|
||||
void ProcessFrontEnd(); /// ok
|
||||
void ProcessGarages(); /// ok
|
||||
bool ProcessHelicopter(cVehicleParams *params); /// ok
|
||||
void ProcessHomeScriptObject(uint8 sound); /// ok
|
||||
void ProcessJumbo(cVehicleParams *); /// ok
|
||||
void ProcessJumboAccel(CPlane *plane); /// ok
|
||||
void ProcessJumboDecel(CPlane *plane); /// ok
|
||||
void ProcessJumboFlying(); /// ok
|
||||
void ProcessJumboLanding(CPlane *plane); /// ok
|
||||
void ProcessJumboTakeOff(CPlane *plane); /// ok
|
||||
void ProcessJumboTaxi(); /// ok
|
||||
void ProcessLaunderetteScriptObject(uint8 sound); /// ok
|
||||
void ProcessLoopingScriptObject(uint8 sound); /// ok
|
||||
void ProcessMissionAudio(); /// ok
|
||||
void ProcessModelCarEngine(cVehicleParams *params); /// ok
|
||||
void ProcessOneShotScriptObject(uint8 sound); /// ok
|
||||
void ProcessPed(CPhysical *ped); /// ok
|
||||
void ProcessPedHeadphones(cPedParams *params); /// ok
|
||||
void ProcessPedOneShots(cPedParams *params); // todo later (weird)
|
||||
void ProcessPhysical(int32 id); /// ok
|
||||
void ProcessPlane(cVehicleParams *params); /// ok
|
||||
void ProcessPlayersVehicleEngine(cVehicleParams *params,
|
||||
CAutomobile *automobile); /// ok
|
||||
void ProcessPoliceCellBeatingScriptObject(uint8 sound); /// ok
|
||||
void ProcessPornCinema(uint8 sound); /// ok
|
||||
void ProcessProjectiles(); /// ok
|
||||
void ProcessRainOnVehicle(cVehicleParams *params); /// ok
|
||||
void ProcessReverb() const; /// ok
|
||||
bool ProcessReverseGear(cVehicleParams *params); /// ok
|
||||
void ProcessSawMillScriptObject(uint8 sound); /// ok
|
||||
void ProcessScriptObject(int32 id); /// ok
|
||||
void ProcessShopScriptObject(uint8 sound); /// ok
|
||||
void ProcessSpecial(); /// ok
|
||||
bool ProcessTrainNoise(cVehicleParams *params); /// ok
|
||||
void ProcessVehicle(CVehicle *vehicle); /// ok
|
||||
bool ProcessVehicleDoors(cVehicleParams *params); /// ok
|
||||
void ProcessVehicleEngine(cVehicleParams *params); /// ok
|
||||
void ProcessVehicleHorn(cVehicleParams *params); /// ok
|
||||
void ProcessVehicleOneShots(void *); // todo
|
||||
bool ProcessVehicleReverseWarning(cVehicleParams *params); /// ok
|
||||
bool ProcessVehicleRoadNoise(cVehicleParams *params); /// ok
|
||||
void ProcessVehicleSirenOrAlarm(cVehicleParams *params); /// ok
|
||||
void ProcessVehicleSkidding(cVehicleParams *params); /// ok
|
||||
void ProcessWaterCannon(int32); /// ok
|
||||
void ProcessWeather(int32 id); /// ok
|
||||
bool ProcessWetRoadNoise(cVehicleParams *params); /// ok
|
||||
void ProcessWorkShopScriptObject(uint8 sound); /// ok
|
||||
void ProcessActiveQueues();
|
||||
bool ProcessAirBrakes(cVehicleParams *params);
|
||||
void ProcessAirportScriptObject(uint8 sound);
|
||||
bool ProcessBoatEngine(cVehicleParams *params);
|
||||
bool ProcessBoatMovingOverWater(cVehicleParams *params);
|
||||
void ProcessBridge();
|
||||
void ProcessBridgeMotor();
|
||||
void ProcessBridgeOneShots();
|
||||
void ProcessBridgeWarning();
|
||||
bool ProcessCarBombTick(cVehicleParams *params);
|
||||
void ProcessCesna(cVehicleParams *params);
|
||||
void ProcessCinemaScriptObject(uint8 sound);
|
||||
void ProcessCrane();
|
||||
void ProcessDocksScriptObject(uint8 sound);
|
||||
bool ProcessEngineDamage(cVehicleParams *params);
|
||||
void ProcessEntity(int32 sound);
|
||||
void ProcessExplosions(int32 explosion);
|
||||
void ProcessFireHydrant();
|
||||
void ProcessFires(int32 entity);
|
||||
void ProcessFrontEnd();
|
||||
void ProcessGarages();
|
||||
bool ProcessHelicopter(cVehicleParams *params);
|
||||
void ProcessHomeScriptObject(uint8 sound);
|
||||
void ProcessJumbo(cVehicleParams *);
|
||||
void ProcessJumboAccel(CPlane *plane);
|
||||
void ProcessJumboDecel(CPlane *plane);
|
||||
void ProcessJumboFlying();
|
||||
void ProcessJumboLanding(CPlane *plane);
|
||||
void ProcessJumboTakeOff(CPlane *plane);
|
||||
void ProcessJumboTaxi();
|
||||
void ProcessLaunderetteScriptObject(uint8 sound);
|
||||
void ProcessLoopingScriptObject(uint8 sound);
|
||||
void ProcessMissionAudio();
|
||||
void ProcessModelCarEngine(cVehicleParams *params);
|
||||
void ProcessOneShotScriptObject(uint8 sound);
|
||||
void ProcessPed(CPhysical *ped);
|
||||
void ProcessPedHeadphones(cPedParams *params);
|
||||
void ProcessPedOneShots(cPedParams *params);
|
||||
void ProcessPhysical(int32 id);
|
||||
void ProcessPlane(cVehicleParams *params);
|
||||
void ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *automobile);
|
||||
void ProcessPoliceCellBeatingScriptObject(uint8 sound);
|
||||
void ProcessPornCinema(uint8 sound);
|
||||
void ProcessProjectiles();
|
||||
void ProcessRainOnVehicle(cVehicleParams *params);
|
||||
void ProcessReverb() const;
|
||||
bool ProcessReverseGear(cVehicleParams *params);
|
||||
void ProcessSawMillScriptObject(uint8 sound);
|
||||
void ProcessScriptObject(int32 id);
|
||||
void ProcessShopScriptObject(uint8 sound);
|
||||
void ProcessSpecial();
|
||||
bool ProcessTrainNoise(cVehicleParams *params);
|
||||
void ProcessVehicle(CVehicle *vehicle);
|
||||
bool ProcessVehicleDoors(cVehicleParams *params);
|
||||
void ProcessVehicleEngine(cVehicleParams *params);
|
||||
void ProcessVehicleHorn(cVehicleParams *params);
|
||||
void ProcessVehicleOneShots(cVehicleParams *params);
|
||||
bool ProcessVehicleReverseWarning(cVehicleParams *params);
|
||||
bool ProcessVehicleRoadNoise(cVehicleParams *params);
|
||||
void ProcessVehicleSirenOrAlarm(cVehicleParams *params);
|
||||
void ProcessVehicleSkidding(cVehicleParams *params);
|
||||
void ProcessWaterCannon(int32);
|
||||
void ProcessWeather(int32 id);
|
||||
bool ProcessWetRoadNoise(cVehicleParams *params);
|
||||
void ProcessWorkShopScriptObject(uint8 sound);
|
||||
|
||||
int32 RandomDisplacement(uint32 seed) const;
|
||||
void ReacquireDigitalHandle() const;
|
||||
void ReleaseDigitalHandle() const;
|
||||
void ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, float collisionPower,
|
||||
float intensity2); /// ok
|
||||
void ReportCrime(int32 crime, const CVector *pos); /// ok
|
||||
void ResetAudioLogicTimers(uint32 timer); /// ok
|
||||
void ResetPoliceRadio(); /// ok
|
||||
void ResetTimers(uint32 time); /// ok
|
||||
void ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2,
|
||||
float collisionPower, float intensity2);
|
||||
void ReportCrime(int32 crime, const CVector *pos);
|
||||
void ResetAudioLogicTimers(uint32 timer);
|
||||
void ResetPoliceRadio();
|
||||
void ResetTimers(uint32 time);
|
||||
|
||||
void Service(); /// ok
|
||||
void ServiceCollisions(); /// ok
|
||||
void ServicePoliceRadio(); /// ok
|
||||
void ServicePoliceRadioChannel(int32 wantedLevel); /// ok
|
||||
void ServiceSoundEffects(); /// ok
|
||||
int8 SetCurrent3DProvider(uint8 which); /// ok
|
||||
void Service();
|
||||
void ServiceCollisions();
|
||||
void ServicePoliceRadio();
|
||||
void ServicePoliceRadioChannel(int32 wantedLevel);
|
||||
void ServiceSoundEffects();
|
||||
int8 SetCurrent3DProvider(uint8 which);
|
||||
void SetDynamicAcousticModelingStatus(bool status);
|
||||
void SetEffectsFadeVolume(uint8 volume) const;
|
||||
void SetEffectsMasterVolume(uint8 volume) const;
|
||||
void SetEntityStatus(int32 id, uint8 status);
|
||||
uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(cAudioCollision *audioCollision); /// ok
|
||||
uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(cAudioCollision *audioCollision);
|
||||
void SetMissionAudioLocation(float x, float y, float z);
|
||||
void SetMissionScriptPoliceAudio(int32 sfx) const;
|
||||
void SetMonoMode(uint8); // todo (mobile)
|
||||
void SetMusicFadeVolume(uint8 volume) const;
|
||||
void SetMusicMasterVolume(uint8 volume) const;
|
||||
void SetSpeakerConfig(int32 conf) const;
|
||||
void SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter); /// ok
|
||||
void SetUpOneShotCollisionSound(cAudioCollision *col); /// ok
|
||||
bool SetupCrimeReport(); /// ok
|
||||
bool SetupJumboEngineSound(uint8 vol, int32 freq); /// ok
|
||||
bool SetupJumboFlySound(uint8 emittingVol); /// ok
|
||||
bool SetupJumboRumbleSound(uint8 emittingVol); /// ok
|
||||
bool SetupJumboTaxiSound(uint8 vol); /// ok
|
||||
bool SetupJumboWhineSound(uint8 emittingVol, int32 freq); /// ok
|
||||
void SetupPedComments(cPedParams *params, uint32 sound); /// ok
|
||||
void SetupSuspectLastSeenReport(); /// ok
|
||||
void SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter);
|
||||
void SetUpOneShotCollisionSound(cAudioCollision *col);
|
||||
bool SetupCrimeReport();
|
||||
bool SetupJumboEngineSound(uint8 vol, int32 freq);
|
||||
bool SetupJumboFlySound(uint8 emittingVol);
|
||||
bool SetupJumboRumbleSound(uint8 emittingVol);
|
||||
bool SetupJumboTaxiSound(uint8 vol);
|
||||
bool SetupJumboWhineSound(uint8 emittingVol, int32 freq);
|
||||
void SetupPedComments(cPedParams *params, uint32 sound);
|
||||
void SetupSuspectLastSeenReport();
|
||||
|
||||
void Terminate();
|
||||
void TranslateEntity(CVector *v1, CVector *v2) const;
|
||||
@ -604,11 +614,10 @@ public:
|
||||
bool UsesSirenSwitching(int32 model) const;
|
||||
|
||||
// only used in pc
|
||||
void AdjustSamplesVolume(); /// ok
|
||||
uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity,
|
||||
float dist); /// ok
|
||||
void AdjustSamplesVolume();
|
||||
uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist);
|
||||
};
|
||||
|
||||
static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error");
|
||||
|
||||
extern cAudioManager &AudioManager;
|
||||
extern cAudioManager AudioManager;
|
||||
|
@ -61,7 +61,7 @@ cAudioScriptObject::SaveAllAudioScriptObjects(uint8 *buf, uint32 *size)
|
||||
INITSAVEBUF
|
||||
|
||||
int32 pool_size = CPools::GetAudioScriptObjectPool()->GetNoOfUsedSpaces();
|
||||
*size = SAVE_HEADER_SIZE + pool_size * (sizeof(cAudioScriptObject) + sizeof(int32));
|
||||
*size = SAVE_HEADER_SIZE + sizeof(int32) + pool_size * (sizeof(cAudioScriptObject) + sizeof(int32));
|
||||
WriteSaveHeader(buf, 'A', 'U', 'D', '\0', *size - SAVE_HEADER_SIZE);
|
||||
WriteSaveBuf(buf, pool_size);
|
||||
|
||||
|
@ -125,21 +125,21 @@ void
|
||||
cAudioManager::DoPoliceRadioCrackle()
|
||||
{
|
||||
m_sQueueSample.m_nEntityIndex = m_nPoliceChannelEntity;
|
||||
m_sQueueSample.m_counter = 0;
|
||||
m_sQueueSample.m_nCounter = 0;
|
||||
m_sQueueSample.m_nSampleIndex = SFX_POLICE_RADIO_CRACKLE;
|
||||
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
|
||||
m_sQueueSample.m_bIsDistant = true;
|
||||
m_sQueueSample.field_16 = 10;
|
||||
m_sQueueSample.m_bIs2D = true;
|
||||
m_sQueueSample.m_nReleasingVolumeModificator = 10;
|
||||
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_RADIO_CRACKLE);
|
||||
m_sQueueSample.m_bVolume = m_anRandomTable[2] % 20 + 15;
|
||||
m_sQueueSample.m_nLoopCount = 0;
|
||||
m_sQueueSample.m_bEmittingVolume = m_sQueueSample.m_bVolume;
|
||||
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_POLICE_RADIO_CRACKLE);
|
||||
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_POLICE_RADIO_CRACKLE);
|
||||
m_sQueueSample.field_56 = 0;
|
||||
m_sQueueSample.m_bReleasingSoundFlag = false;
|
||||
m_sQueueSample.m_bReverbFlag = false;
|
||||
m_sQueueSample.m_bOffset = 63;
|
||||
m_sQueueSample.field_76 = 3;
|
||||
m_sQueueSample.m_nReleasingVolumeDivider = 3;
|
||||
m_sQueueSample.m_bRequireReflection = false;
|
||||
AddSampleToRequestedQueue();
|
||||
}
|
||||
@ -147,17 +147,20 @@ cAudioManager::DoPoliceRadioCrackle()
|
||||
void
|
||||
cAudioManager::ServicePoliceRadio()
|
||||
{
|
||||
int32 wantedLevel = 0; // bug?;
|
||||
int32 wantedLevel = 0; // uninitialized variable
|
||||
static uint32 nLastSeen = 300;
|
||||
|
||||
if (!m_bIsInitialised) return;
|
||||
if(!m_bIsInitialised) return;
|
||||
|
||||
if (!m_bUserPause) {
|
||||
if(!m_bUserPause) {
|
||||
bool crimeReport = SetupCrimeReport();
|
||||
#ifdef FIX_BUGS // Crash at 0x5fe6ef
|
||||
if(!FindPlayerPed() || !FindPlayerPed()->m_pWanted) return;
|
||||
#endif
|
||||
wantedLevel = FindPlayerPed()->m_pWanted->m_nWantedLevel;
|
||||
if (!crimeReport) {
|
||||
if (wantedLevel) {
|
||||
if (nLastSeen) {
|
||||
if(!crimeReport) {
|
||||
if(wantedLevel) {
|
||||
if(nLastSeen) {
|
||||
--nLastSeen;
|
||||
} else {
|
||||
nLastSeen = m_anRandomTable[1] % 1000 + 2000;
|
||||
|
@ -12,17 +12,17 @@ void CAutoPilot::ModifySpeed(float speed)
|
||||
float positionBetweenNodes = (float)(CTimer::GetTimeInMilliseconds() - m_nTimeEnteredCurve) / m_nTimeToSpendOnCurrentCurve;
|
||||
CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[m_nCurrentPathNodeInfo];
|
||||
CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[m_nNextPathNodeInfo];
|
||||
float currentPathLinkForwardX = m_nCurrentDirection * ThePaths.m_carPathLinks[m_nCurrentPathNodeInfo].dirX;
|
||||
float currentPathLinkForwardY = m_nCurrentDirection * ThePaths.m_carPathLinks[m_nCurrentPathNodeInfo].dirY;
|
||||
float nextPathLinkForwardX = m_nNextDirection * ThePaths.m_carPathLinks[m_nNextPathNodeInfo].dirX;
|
||||
float nextPathLinkForwardY = m_nNextDirection * ThePaths.m_carPathLinks[m_nNextPathNodeInfo].dirY;
|
||||
float currentPathLinkForwardX = m_nCurrentDirection * ThePaths.m_carPathLinks[m_nCurrentPathNodeInfo].dir.x;
|
||||
float currentPathLinkForwardY = m_nCurrentDirection * ThePaths.m_carPathLinks[m_nCurrentPathNodeInfo].dir.y;
|
||||
float nextPathLinkForwardX = m_nNextDirection * ThePaths.m_carPathLinks[m_nNextPathNodeInfo].dir.x;
|
||||
float nextPathLinkForwardY = m_nNextDirection * ThePaths.m_carPathLinks[m_nNextPathNodeInfo].dir.y;
|
||||
CVector positionOnCurrentLinkIncludingLane(
|
||||
pCurrentLink->posX + ((m_nCurrentLane + 0.5f) * LANE_WIDTH) * currentPathLinkForwardY,
|
||||
pCurrentLink->posY - ((m_nCurrentLane + 0.5f) * LANE_WIDTH) * currentPathLinkForwardX,
|
||||
pCurrentLink->pos.x + ((m_nCurrentLane + 0.5f) * LANE_WIDTH) * currentPathLinkForwardY,
|
||||
pCurrentLink->pos.y - ((m_nCurrentLane + 0.5f) * LANE_WIDTH) * currentPathLinkForwardX,
|
||||
0.0f);
|
||||
CVector positionOnNextLinkIncludingLane(
|
||||
pNextLink->posX + ((m_nNextLane + 0.5f) * LANE_WIDTH) * nextPathLinkForwardY,
|
||||
pNextLink->posY - ((m_nNextLane + 0.5f) * LANE_WIDTH) * nextPathLinkForwardX,
|
||||
pNextLink->pos.x + ((m_nNextLane + 0.5f) * LANE_WIDTH) * nextPathLinkForwardY,
|
||||
pNextLink->pos.y - ((m_nNextLane + 0.5f) * LANE_WIDTH) * nextPathLinkForwardX,
|
||||
0.0f);
|
||||
m_nTimeToSpendOnCurrentCurve = CCurves::CalcSpeedScaleFactor(
|
||||
&positionOnCurrentLinkIncludingLane,
|
||||
|
@ -90,7 +90,7 @@ uint32 (&aCarsToKeepTime)[MAX_CARS_TO_KEEP] = *(uint32(*)[MAX_CARS_TO_KEEP])*(ui
|
||||
void
|
||||
CCarCtrl::GenerateRandomCars()
|
||||
{
|
||||
if (CCutsceneMgr::IsCutsceneProcessing())
|
||||
if (CCutsceneMgr::IsRunning())
|
||||
return;
|
||||
if (NumRandomCars < 30){
|
||||
if (CountDownToCarsAtStart == 0){
|
||||
@ -393,25 +393,25 @@ CCarCtrl::GenerateOneRandomCar()
|
||||
pCar->GetRight() = CVector(forwardY, -forwardX, 0.0f);
|
||||
pCar->GetUp() = CVector(0.0f, 0.0f, 1.0f);
|
||||
|
||||
float currentPathLinkForwardX = pCar->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nCurrentPathNodeInfo].dirX;
|
||||
float currentPathLinkForwardY = pCar->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nCurrentPathNodeInfo].dirY;
|
||||
float nextPathLinkForwardX = pCar->AutoPilot.m_nNextDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nNextPathNodeInfo].dirX;
|
||||
float nextPathLinkForwardY = pCar->AutoPilot.m_nNextDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nNextPathNodeInfo].dirY;
|
||||
float currentPathLinkForwardX = pCar->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nCurrentPathNodeInfo].dir.x;
|
||||
float currentPathLinkForwardY = pCar->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nCurrentPathNodeInfo].dir.y;
|
||||
float nextPathLinkForwardX = pCar->AutoPilot.m_nNextDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nNextPathNodeInfo].dir.x;
|
||||
float nextPathLinkForwardY = pCar->AutoPilot.m_nNextDirection * ThePaths.m_carPathLinks[pCar->AutoPilot.m_nNextPathNodeInfo].dir.y;
|
||||
|
||||
CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[pCar->AutoPilot.m_nCurrentPathNodeInfo];
|
||||
CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[pCar->AutoPilot.m_nNextPathNodeInfo];
|
||||
CVector positionOnCurrentLinkIncludingLane(
|
||||
pCurrentLink->posX + ((pCar->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
|
||||
pCurrentLink->posY - ((pCar->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
|
||||
pCurrentLink->pos.x + ((pCar->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
|
||||
pCurrentLink->pos.y - ((pCar->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
|
||||
0.0f);
|
||||
CVector positionOnNextLinkIncludingLane(
|
||||
pNextLink->posX + ((pCar->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
|
||||
pNextLink->posY - ((pCar->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
|
||||
pNextLink->pos.x + ((pCar->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
|
||||
pNextLink->pos.y - ((pCar->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
|
||||
0.0f);
|
||||
float directionCurrentLinkX = pCurrentLink->dirX * pCar->AutoPilot.m_nCurrentDirection;
|
||||
float directionCurrentLinkY = pCurrentLink->dirY * pCar->AutoPilot.m_nCurrentDirection;
|
||||
float directionNextLinkX = pNextLink->dirX * pCar->AutoPilot.m_nNextDirection;
|
||||
float directionNextLinkY = pNextLink->dirY * pCar->AutoPilot.m_nNextDirection;
|
||||
float directionCurrentLinkX = pCurrentLink->dir.x * pCar->AutoPilot.m_nCurrentDirection;
|
||||
float directionCurrentLinkY = pCurrentLink->dir.y * pCar->AutoPilot.m_nCurrentDirection;
|
||||
float directionNextLinkX = pNextLink->dir.x * pCar->AutoPilot.m_nNextDirection;
|
||||
float directionNextLinkY = pNextLink->dir.y * pCar->AutoPilot.m_nNextDirection;
|
||||
/* We want to make a path between two links that may not have the same forward directions a curve. */
|
||||
pCar->AutoPilot.m_nTimeToSpendOnCurrentCurve = CCurves::CalcSpeedScaleFactor(
|
||||
&positionOnCurrentLinkIncludingLane,
|
||||
@ -763,17 +763,17 @@ CCarCtrl::UpdateCarOnRails(CVehicle* pVehicle)
|
||||
return;
|
||||
CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo];
|
||||
CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo];
|
||||
float currentPathLinkForwardX = pCurrentLink->dirX * pVehicle->AutoPilot.m_nCurrentDirection;
|
||||
float currentPathLinkForwardY = pCurrentLink->dirY * pVehicle->AutoPilot.m_nCurrentDirection;
|
||||
float nextPathLinkForwardX = pNextLink->dirX * pVehicle->AutoPilot.m_nNextDirection;
|
||||
float nextPathLinkForwardY = pNextLink->dirY * pVehicle->AutoPilot.m_nNextDirection;
|
||||
float currentPathLinkForwardX = pCurrentLink->dir.x * pVehicle->AutoPilot.m_nCurrentDirection;
|
||||
float currentPathLinkForwardY = pCurrentLink->dir.y * pVehicle->AutoPilot.m_nCurrentDirection;
|
||||
float nextPathLinkForwardX = pNextLink->dir.x * pVehicle->AutoPilot.m_nNextDirection;
|
||||
float nextPathLinkForwardY = pNextLink->dir.y * pVehicle->AutoPilot.m_nNextDirection;
|
||||
CVector positionOnCurrentLinkIncludingLane(
|
||||
pCurrentLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
|
||||
pCurrentLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
|
||||
pCurrentLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
|
||||
pCurrentLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
|
||||
0.0f);
|
||||
CVector positionOnNextLinkIncludingLane(
|
||||
pNextLink->posX + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
|
||||
pNextLink->posY - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
|
||||
pNextLink->pos.x + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
|
||||
pNextLink->pos.y - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
|
||||
0.0f);
|
||||
CVector directionCurrentLink(currentPathLinkForwardX, currentPathLinkForwardY, 0.0f);
|
||||
CVector directionNextLink(nextPathLinkForwardX, nextPathLinkForwardY, 0.0f);
|
||||
@ -1553,8 +1553,8 @@ void CCarCtrl::PickNextNodeRandomly(CVehicle* pVehicle)
|
||||
pVehicle->AutoPilot.m_nNextDirection = -1;
|
||||
lanesOnNextNode = pNextLink->numRightLanes;
|
||||
}
|
||||
float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dirX;
|
||||
float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dirX;
|
||||
float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dir.x;
|
||||
float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dir.x;
|
||||
if (lanesOnNextNode >= 0){
|
||||
if ((CGeneral::GetRandomNumber() & 0x600) == 0){
|
||||
/* 25% chance vehicle will try to switch lane */
|
||||
@ -1574,17 +1574,17 @@ void CCarCtrl::PickNextNodeRandomly(CVehicle* pVehicle)
|
||||
if (pVehicle->AutoPilot.m_bStayInFastLane)
|
||||
pVehicle->AutoPilot.m_nNextLane = 0;
|
||||
CVector positionOnCurrentLinkIncludingLane(
|
||||
pCurLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH), /* ...what about Y? */
|
||||
pCurLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
|
||||
pCurLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH), /* ...what about Y? */
|
||||
pCurLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
|
||||
0.0f);
|
||||
CVector positionOnNextLinkIncludingLane(
|
||||
pNextLink->posX + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH),
|
||||
pNextLink->posY - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
|
||||
pNextLink->pos.x + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH),
|
||||
pNextLink->pos.y - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
|
||||
0.0f);
|
||||
float directionCurrentLinkX = pCurLink->dirX * pVehicle->AutoPilot.m_nCurrentDirection;
|
||||
float directionCurrentLinkY = pCurLink->dirY * pVehicle->AutoPilot.m_nCurrentDirection;
|
||||
float directionNextLinkX = pNextLink->dirX * pVehicle->AutoPilot.m_nNextDirection;
|
||||
float directionNextLinkY = pNextLink->dirY * pVehicle->AutoPilot.m_nNextDirection;
|
||||
float directionCurrentLinkX = pCurLink->dir.x * pVehicle->AutoPilot.m_nCurrentDirection;
|
||||
float directionCurrentLinkY = pCurLink->dir.y * pVehicle->AutoPilot.m_nCurrentDirection;
|
||||
float directionNextLinkX = pNextLink->dir.x * pVehicle->AutoPilot.m_nNextDirection;
|
||||
float directionNextLinkY = pNextLink->dir.y * pVehicle->AutoPilot.m_nNextDirection;
|
||||
/* We want to make a path between two links that may not have the same forward directions a curve. */
|
||||
pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve = CCurves::CalcSpeedScaleFactor(
|
||||
&positionOnCurrentLinkIncludingLane,
|
||||
@ -1725,10 +1725,10 @@ void CCarCtrl::PickNextNodeToChaseCar(CVehicle* pVehicle, float targetX, float t
|
||||
pVehicle->AutoPilot.m_nNextDirection = -1;
|
||||
lanesOnNextNode = pNextLink->numRightLanes;
|
||||
}
|
||||
float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dirX;
|
||||
float currentPathLinkForwardY = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dirY;
|
||||
float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dirX;
|
||||
float nextPathLinkForwardY = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dirY;
|
||||
float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dir.x;
|
||||
float currentPathLinkForwardY = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dir.y;
|
||||
float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dir.x;
|
||||
float nextPathLinkForwardY = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dir.y;
|
||||
if (lanesOnNextNode >= 0) {
|
||||
CVector2D dist = pNextPathNode->pos - pCurNode->pos;
|
||||
if (dist.MagnitudeSqr() >= SQR(7.0f)){
|
||||
@ -1755,17 +1755,17 @@ void CCarCtrl::PickNextNodeToChaseCar(CVehicle* pVehicle, float targetX, float t
|
||||
if (pVehicle->AutoPilot.m_bStayInFastLane)
|
||||
pVehicle->AutoPilot.m_nNextLane = 0;
|
||||
CVector positionOnCurrentLinkIncludingLane(
|
||||
pCurLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
|
||||
pCurLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
|
||||
pCurLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
|
||||
pCurLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
|
||||
0.0f);
|
||||
CVector positionOnNextLinkIncludingLane(
|
||||
pNextLink->posX + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
|
||||
pNextLink->posY - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
|
||||
pNextLink->pos.x + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
|
||||
pNextLink->pos.y - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
|
||||
0.0f);
|
||||
float directionCurrentLinkX = pCurLink->dirX * pVehicle->AutoPilot.m_nCurrentDirection;
|
||||
float directionCurrentLinkY = pCurLink->dirY * pVehicle->AutoPilot.m_nCurrentDirection;
|
||||
float directionNextLinkX = pNextLink->dirX * pVehicle->AutoPilot.m_nNextDirection;
|
||||
float directionNextLinkY = pNextLink->dirY * pVehicle->AutoPilot.m_nNextDirection;
|
||||
float directionCurrentLinkX = pCurLink->dir.x * pVehicle->AutoPilot.m_nCurrentDirection;
|
||||
float directionCurrentLinkY = pCurLink->dir.y * pVehicle->AutoPilot.m_nCurrentDirection;
|
||||
float directionNextLinkX = pNextLink->dir.x * pVehicle->AutoPilot.m_nNextDirection;
|
||||
float directionNextLinkY = pNextLink->dir.y * pVehicle->AutoPilot.m_nNextDirection;
|
||||
/* We want to make a path between two links that may not have the same forward directions a curve. */
|
||||
pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve = CCurves::CalcSpeedScaleFactor(
|
||||
&positionOnCurrentLinkIncludingLane,
|
||||
@ -1814,10 +1814,10 @@ bool CCarCtrl::PickNextNodeToFollowPath(CVehicle* pVehicle)
|
||||
pVehicle->AutoPilot.m_nNextDirection = -1;
|
||||
lanesOnNextNode = pNextLink->numRightLanes;
|
||||
}
|
||||
float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dirX;
|
||||
float currentPathLinkForwardY = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dirY;
|
||||
float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dirX;
|
||||
float nextPathLinkForwardY = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dirY;
|
||||
float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dir.x;
|
||||
float currentPathLinkForwardY = pVehicle->AutoPilot.m_nCurrentDirection * pCurLink->dir.y;
|
||||
float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dir.x;
|
||||
float nextPathLinkForwardY = pVehicle->AutoPilot.m_nNextDirection * pNextLink->dir.y;
|
||||
if (lanesOnNextNode >= 0) {
|
||||
CVector2D dist = pNextPathNode->pos - pCurNode->pos;
|
||||
if (dist.MagnitudeSqr() >= SQR(7.0f) && (CGeneral::GetRandomNumber() & 0x600) == 0) {
|
||||
@ -1835,17 +1835,17 @@ bool CCarCtrl::PickNextNodeToFollowPath(CVehicle* pVehicle)
|
||||
if (pVehicle->AutoPilot.m_bStayInFastLane)
|
||||
pVehicle->AutoPilot.m_nNextLane = 0;
|
||||
CVector positionOnCurrentLinkIncludingLane(
|
||||
pCurLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
|
||||
pCurLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
|
||||
pCurLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY,
|
||||
pCurLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
|
||||
0.0f);
|
||||
CVector positionOnNextLinkIncludingLane(
|
||||
pNextLink->posX + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
|
||||
pNextLink->posY - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
|
||||
pNextLink->pos.x + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
|
||||
pNextLink->pos.y - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
|
||||
0.0f);
|
||||
float directionCurrentLinkX = pCurLink->dirX * pVehicle->AutoPilot.m_nCurrentDirection;
|
||||
float directionCurrentLinkY = pCurLink->dirY * pVehicle->AutoPilot.m_nCurrentDirection;
|
||||
float directionNextLinkX = pNextLink->dirX * pVehicle->AutoPilot.m_nNextDirection;
|
||||
float directionNextLinkY = pNextLink->dirY * pVehicle->AutoPilot.m_nNextDirection;
|
||||
float directionCurrentLinkX = pCurLink->dir.x * pVehicle->AutoPilot.m_nCurrentDirection;
|
||||
float directionCurrentLinkY = pCurLink->dir.y * pVehicle->AutoPilot.m_nCurrentDirection;
|
||||
float directionNextLinkX = pNextLink->dir.x * pVehicle->AutoPilot.m_nNextDirection;
|
||||
float directionNextLinkY = pNextLink->dir.y * pVehicle->AutoPilot.m_nNextDirection;
|
||||
/* We want to make a path between two links that may not have the same forward directions a curve. */
|
||||
pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve = CCurves::CalcSpeedScaleFactor(
|
||||
&positionOnCurrentLinkIncludingLane,
|
||||
@ -2192,16 +2192,16 @@ void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerv
|
||||
forward.Normalise();
|
||||
CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo];
|
||||
CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo];
|
||||
CVector2D currentPathLinkForward(pCurrentLink->dirX * pVehicle->AutoPilot.m_nCurrentDirection,
|
||||
pCurrentLink->dirY * pVehicle->AutoPilot.m_nCurrentDirection);
|
||||
float nextPathLinkForwardX = pNextLink->dirX * pVehicle->AutoPilot.m_nNextDirection;
|
||||
float nextPathLinkForwardY = pNextLink->dirY * pVehicle->AutoPilot.m_nNextDirection;
|
||||
CVector2D currentPathLinkForward(pCurrentLink->dir.x * pVehicle->AutoPilot.m_nCurrentDirection,
|
||||
pCurrentLink->dir.y * pVehicle->AutoPilot.m_nCurrentDirection);
|
||||
float nextPathLinkForwardX = pNextLink->dir.x * pVehicle->AutoPilot.m_nNextDirection;
|
||||
float nextPathLinkForwardY = pNextLink->dir.y * pVehicle->AutoPilot.m_nNextDirection;
|
||||
CVector2D positionOnCurrentLinkIncludingLane(
|
||||
pCurrentLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y,
|
||||
pCurrentLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x);
|
||||
pCurrentLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y,
|
||||
pCurrentLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x);
|
||||
CVector2D positionOnNextLinkIncludingLane(
|
||||
pNextLink->posX + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
|
||||
pNextLink->posY - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX);
|
||||
pNextLink->pos.x + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY,
|
||||
pNextLink->pos.y - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX);
|
||||
CVector2D distanceToNextNode = (CVector2D)pVehicle->GetPosition() - positionOnCurrentLinkIncludingLane;
|
||||
float scalarDistanceToNextNode = distanceToNextNode.Magnitude();
|
||||
CVector2D distanceBetweenNodes = positionOnNextLinkIncludingLane - positionOnCurrentLinkIncludingLane;
|
||||
@ -2230,16 +2230,16 @@ void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerv
|
||||
}
|
||||
pCurrentLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo];
|
||||
scalarDistanceToNextNode = CVector2D(
|
||||
pCurrentLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y - pVehicle->GetPosition().x,
|
||||
pCurrentLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x - pVehicle->GetPosition().y).Magnitude();
|
||||
pCurrentLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y - pVehicle->GetPosition().x,
|
||||
pCurrentLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x - pVehicle->GetPosition().y).Magnitude();
|
||||
pNextLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo];
|
||||
currentPathLinkForward.x = pCurrentLink->dirX * pVehicle->AutoPilot.m_nCurrentDirection;
|
||||
currentPathLinkForward.y = pCurrentLink->dirY * pVehicle->AutoPilot.m_nCurrentDirection;
|
||||
nextPathLinkForwardX = pNextLink->dirX * pVehicle->AutoPilot.m_nNextDirection;
|
||||
nextPathLinkForwardY = pNextLink->dirY * pVehicle->AutoPilot.m_nNextDirection;
|
||||
currentPathLinkForward.x = pCurrentLink->dir.x * pVehicle->AutoPilot.m_nCurrentDirection;
|
||||
currentPathLinkForward.y = pCurrentLink->dir.y * pVehicle->AutoPilot.m_nCurrentDirection;
|
||||
nextPathLinkForwardX = pNextLink->dir.x * pVehicle->AutoPilot.m_nNextDirection;
|
||||
nextPathLinkForwardY = pNextLink->dir.y * pVehicle->AutoPilot.m_nNextDirection;
|
||||
}
|
||||
positionOnCurrentLinkIncludingLane.x = pCurrentLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y;
|
||||
positionOnCurrentLinkIncludingLane.y = pCurrentLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x;
|
||||
positionOnCurrentLinkIncludingLane.x = pCurrentLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y;
|
||||
positionOnCurrentLinkIncludingLane.y = pCurrentLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x;
|
||||
CVector2D projectedPosition = positionOnCurrentLinkIncludingLane - currentPathLinkForward * scalarDistanceToNextNode * 0.4f;
|
||||
if (scalarDistanceToNextNode > DISTANCE_TO_NEXT_NODE_TO_CONSIDER_SLOWING_DOWN){
|
||||
projectedPosition.x = positionOnCurrentLinkIncludingLane.x;
|
||||
@ -2281,8 +2281,8 @@ void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerv
|
||||
CCarAI::CarHasReasonToStop(pVehicle);
|
||||
speedStyleMultiplier = 0.0f;
|
||||
}
|
||||
CVector2D trajectory(pCurrentLink->posX + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y,
|
||||
pCurrentLink->posY - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x);
|
||||
CVector2D trajectory(pCurrentLink->pos.x + ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.y,
|
||||
pCurrentLink->pos.y - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x);
|
||||
trajectory -= pVehicle->GetPosition();
|
||||
float speedAngleMultiplier = FindSpeedMultiplier(
|
||||
CGeneral::GetATanOfXY(trajectory.x, trajectory.y) - angleForward,
|
||||
|
@ -1,14 +0,0 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "Cranes.h"
|
||||
|
||||
WRAPPER bool CCranes::IsThisCarBeingTargettedByAnyCrane(CVehicle*) { EAXJMP(0x5451E0); }
|
||||
WRAPPER bool CCranes::IsThisCarBeingCarriedByAnyCrane(CVehicle*) { EAXJMP(0x545190); }
|
||||
WRAPPER bool CCranes::IsThisCarPickedUp(float, float, CVehicle*) { EAXJMP(0x543940); }
|
||||
WRAPPER bool CCranes::HaveAllCarsBeenCollectedByMilitaryCrane() { EAXJMP(0x544BE0); }
|
||||
WRAPPER void CCranes::ActivateCrane(float, float, float, float, float, float, float, float, bool, bool, float, float) { EAXJMP(0x543650); }
|
||||
WRAPPER void CCranes::DeActivateCrane(float, float) { EAXJMP(0x543890); }
|
||||
WRAPPER void CCranes::InitCranes(void) { EAXJMP(0x543360); }
|
||||
WRAPPER void CCranes::UpdateCranes(void) { EAXJMP(0x5439E0); }
|
||||
WRAPPER void CCranes::Save(uint8*, uint32*) { EAXJMP(0x545210); }
|
||||
WRAPPER void CranesLoad(uint8*, uint32) { EAXJMP(0x5454d0); }
|
@ -1,61 +0,0 @@
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
|
||||
class CVehicle;
|
||||
class CEntity;
|
||||
class CObject;
|
||||
|
||||
class CCrane
|
||||
{
|
||||
public:
|
||||
CEntity *m_pObject;
|
||||
CObject *m_pMagnet;
|
||||
int m_nAudioEntity;
|
||||
float m_fPickupX1;
|
||||
float m_fPickupX2;
|
||||
float m_fPickupY1;
|
||||
float m_fPickupY2;
|
||||
CVector m_vecDropoffTarget;
|
||||
float m_fDropoffHeading;
|
||||
float m_fPickupAngle;
|
||||
float m_fDropoffAngle;
|
||||
float m_fPickupDistance;
|
||||
float m_fDropoffDistance;
|
||||
float m_fAngle;
|
||||
float m_fDistance;
|
||||
float m_fHeight;
|
||||
float m_fHookOffset;
|
||||
float m_fHookHeight;
|
||||
CVector m_vecHookInitPos;
|
||||
CVector m_vecHookCurPos;
|
||||
float m_fHookVelocityX;
|
||||
float m_fHookVelocityY;
|
||||
CVehicle *m_pVehiclePickedUp;
|
||||
int m_nUpdateTimer;
|
||||
char m_bCraneActive;
|
||||
char m_bCraneStatus;
|
||||
char m_bVehiclesCollected;
|
||||
char m_bIsCrusher;
|
||||
char m_bIsMilitaryCrane;
|
||||
char field_125;
|
||||
char m_bNotMilitaryCrane;
|
||||
char gap_127[1];
|
||||
};
|
||||
|
||||
static_assert(sizeof(CCrane) == 128, "CCrane: error");
|
||||
|
||||
class CCranes
|
||||
{
|
||||
public:
|
||||
static bool IsThisCarBeingTargettedByAnyCrane(CVehicle*);
|
||||
static bool IsThisCarBeingCarriedByAnyCrane(CVehicle*);
|
||||
static bool IsThisCarPickedUp(float, float, CVehicle*);
|
||||
static bool HaveAllCarsBeenCollectedByMilitaryCrane();
|
||||
static void ActivateCrane(float, float, float, float, float, float, float, float, bool, bool, float, float);
|
||||
static void DeActivateCrane(float, float);
|
||||
static void InitCranes(void);
|
||||
static void UpdateCranes(void);
|
||||
static void Save(uint8*, uint32*);
|
||||
};
|
||||
|
||||
void CranesLoad(uint8*, uint32); // is this really outside CCranes?
|
@ -126,7 +126,6 @@ uint32& CGarages::MessageEndTime = *(uint32*)0x8F597C;
|
||||
uint32& CGarages::NumGarages = *(uint32*)0x8F29F4;
|
||||
bool& CGarages::PlayerInGarage = *(bool*)0x95CD83;
|
||||
int32& CGarages::PoliceCarsCollected = *(int32*)0x941444;
|
||||
uint32& CGarages::GarageToBeTidied = *(uint32*)0x623570;
|
||||
CStoredCar(&CGarages::aCarsInSafeHouse1)[NUM_GARAGE_STORED_CARS] = *(CStoredCar(*)[NUM_GARAGE_STORED_CARS]) * (uintptr*)0x6FA210;
|
||||
CStoredCar(&CGarages::aCarsInSafeHouse2)[NUM_GARAGE_STORED_CARS] = *(CStoredCar(*)[NUM_GARAGE_STORED_CARS]) * (uintptr*)0x6FA300;
|
||||
CStoredCar(&CGarages::aCarsInSafeHouse3)[NUM_GARAGE_STORED_CARS] = *(CStoredCar(*)[NUM_GARAGE_STORED_CARS]) * (uintptr*)0x6FA3F0;
|
||||
@ -322,6 +321,9 @@ void CGarage::Update()
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (m_bDeactivated && m_eGarageState == GS_FULLYCLOSED)
|
||||
@ -408,11 +410,11 @@ void CGarage::Update()
|
||||
if (!((CAutomobile*)(FindPlayerVehicle()))->bFixedColour) {
|
||||
uint8 colour1, colour2;
|
||||
uint16 attempt;
|
||||
((CVehicleModelInfo*)CModelInfo::GetModelInfo(FindPlayerVehicle()->GetModelIndex()))->ChooseVehicleColour(colour1, colour2);
|
||||
FindPlayerVehicle()->GetModelInfo()->ChooseVehicleColour(colour1, colour2);
|
||||
for (attempt = 0; attempt < 10; attempt++) {
|
||||
if (colour1 != FindPlayerVehicle()->m_currentColour1 || colour2 != FindPlayerVehicle()->m_currentColour2)
|
||||
break;
|
||||
((CVehicleModelInfo*)CModelInfo::GetModelInfo(FindPlayerVehicle()->GetModelIndex()))->ChooseVehicleColour(colour1, colour2);
|
||||
FindPlayerVehicle()->GetModelInfo()->ChooseVehicleColour(colour1, colour2);
|
||||
}
|
||||
bChangedColour = (attempt < 10);
|
||||
FindPlayerVehicle()->m_currentColour1 = colour1;
|
||||
@ -490,7 +492,7 @@ void CGarage::Update()
|
||||
break;
|
||||
}
|
||||
if (!CGarages::BombsAreFree && CWorld::Players[CWorld::PlayerInFocus].m_nMoney < BOMB_PRICE) {
|
||||
CGarages::TriggerMessage("GA_4", -1, 4000, -1); // "Car bombs are $1000 each"
|
||||
CGarages::TriggerMessage("GA_4", -1, 4000, -1); // "Car bombs are $1000 each" - weird that the price is hardcoded in message
|
||||
m_eGarageState = GS_OPENEDCONTAINSCAR;
|
||||
DMAudio.PlayFrontEndSound(SOUND_GARAGE_NO_MONEY, 1);
|
||||
break;
|
||||
@ -524,7 +526,7 @@ void CGarage::Update()
|
||||
((CAutomobile*)(FindPlayerVehicle()))->m_pBombRigger = FindPlayerPed();
|
||||
if (m_eGarageType == GARAGE_BOMBSHOP3)
|
||||
CGarages::GivePlayerDetonator();
|
||||
CStats::KgOfExplosivesUsed += KGS_OF_EXPLOSIVES_IN_BOMB;
|
||||
CStats::KgsOfExplosivesUsed += KGS_OF_EXPLOSIVES_IN_BOMB;
|
||||
}
|
||||
switch (m_eGarageType) {
|
||||
case GARAGE_BOMBSHOP1:
|
||||
@ -1184,7 +1186,7 @@ bool CGarage::IsEntityEntirelyInside(CEntity * pEntity)
|
||||
if (pEntity->GetPosition().x < m_fX1 || pEntity->GetPosition().x > m_fX2 ||
|
||||
pEntity->GetPosition().y < m_fY1 || pEntity->GetPosition().y > m_fY2)
|
||||
return false;
|
||||
CColModel* pColModel = CModelInfo::GetModelInfo(pEntity->GetModelIndex())->GetColModel();
|
||||
CColModel* pColModel = pEntity->GetColModel();
|
||||
for (int i = 0; i < pColModel->numSpheres; i++) {
|
||||
CVector pos = pEntity->GetMatrix() * pColModel->spheres[i].center;
|
||||
float radius = pColModel->spheres[i].radius;
|
||||
@ -1201,7 +1203,7 @@ bool CGarage::IsEntityEntirelyInside3D(CEntity * pEntity, float fMargin)
|
||||
pEntity->GetPosition().y < m_fY1 - fMargin || pEntity->GetPosition().y > m_fY2 + fMargin ||
|
||||
pEntity->GetPosition().z < m_fZ1 - fMargin || pEntity->GetPosition().z > m_fZ2 + fMargin)
|
||||
return false;
|
||||
CColModel* pColModel = CModelInfo::GetModelInfo(pEntity->GetModelIndex())->GetColModel();
|
||||
CColModel* pColModel = pEntity->GetColModel();
|
||||
for (int i = 0; i < pColModel->numSpheres; i++) {
|
||||
CVector pos = pEntity->GetMatrix() * pColModel->spheres[i].center;
|
||||
float radius = pColModel->spheres[i].radius;
|
||||
@ -1218,7 +1220,7 @@ bool CGarage::IsEntityEntirelyOutside(CEntity * pEntity, float fMargin)
|
||||
if (pEntity->GetPosition().x > m_fX1 - fMargin && pEntity->GetPosition().x < m_fX2 + fMargin &&
|
||||
pEntity->GetPosition().y > m_fY1 - fMargin && pEntity->GetPosition().y < m_fY2 + fMargin)
|
||||
return false;
|
||||
CColModel* pColModel = CModelInfo::GetModelInfo(pEntity->GetModelIndex())->GetColModel();
|
||||
CColModel* pColModel = pEntity->GetColModel();
|
||||
for (int i = 0; i < pColModel->numSpheres; i++) {
|
||||
CVector pos = pEntity->GetMatrix() * pColModel->spheres[i].center;
|
||||
float radius = pColModel->spheres[i].radius;
|
||||
@ -1250,7 +1252,7 @@ bool CGarage::IsEntityTouching3D(CEntity * pEntity)
|
||||
pEntity->GetPosition().y - radius < m_fY1 || pEntity->GetPosition().y + radius > m_fY2 ||
|
||||
pEntity->GetPosition().z - radius < m_fZ1 || pEntity->GetPosition().z + radius > m_fZ2)
|
||||
return false;
|
||||
CColModel* pColModel = CModelInfo::GetModelInfo(pEntity->GetModelIndex())->GetColModel();
|
||||
CColModel* pColModel = pEntity->GetColModel();
|
||||
for (int i = 0; i < pColModel->numSpheres; i++) {
|
||||
CVector pos = pEntity->GetMatrix() * pColModel->spheres[i].center;
|
||||
radius = pColModel->spheres[i].radius;
|
||||
@ -1264,7 +1266,7 @@ bool CGarage::IsEntityTouching3D(CEntity * pEntity)
|
||||
|
||||
bool CGarage::EntityHasASphereWayOutsideGarage(CEntity * pEntity, float fMargin)
|
||||
{
|
||||
CColModel* pColModel = CModelInfo::GetModelInfo(pEntity->GetModelIndex())->GetColModel();
|
||||
CColModel* pColModel = pEntity->GetColModel();
|
||||
for (int i = 0; i < pColModel->numSpheres; i++) {
|
||||
CVector pos = pEntity->GetMatrix() * pColModel->spheres[i].center;
|
||||
float radius = pColModel->spheres[i].radius;
|
||||
@ -1285,7 +1287,7 @@ bool CGarage::IsAnyOtherCarTouchingGarage(CVehicle * pException)
|
||||
continue;
|
||||
if (!IsEntityTouching3D(pVehicle))
|
||||
continue;
|
||||
CColModel* pColModel = CModelInfo::GetModelInfo(pVehicle->GetModelIndex())->GetColModel();
|
||||
CColModel* pColModel = pVehicle->GetColModel();
|
||||
for (int i = 0; i < pColModel->numSpheres; i++) {
|
||||
CVector pos = pVehicle->GetMatrix() * pColModel->spheres[i].center;
|
||||
float radius = pColModel->spheres[i].radius;
|
||||
@ -1307,7 +1309,7 @@ bool CGarage::IsAnyOtherPedTouchingGarage(CPed * pException)
|
||||
continue;
|
||||
if (!IsEntityTouching3D(pPed))
|
||||
continue;
|
||||
CColModel* pColModel = CModelInfo::GetModelInfo(pPed->GetModelIndex())->GetColModel();
|
||||
CColModel* pColModel = pException->GetColModel();
|
||||
for (int i = 0; i < pColModel->numSpheres; i++) {
|
||||
CVector pos = pPed->GetMatrix() * pColModel->spheres[i].center;
|
||||
float radius = pColModel->spheres[i].radius;
|
||||
@ -1329,7 +1331,7 @@ bool CGarage::IsAnyCarBlockingDoor()
|
||||
continue;
|
||||
if (!IsEntityTouching3D(pVehicle))
|
||||
continue;
|
||||
CColModel* pColModel = CModelInfo::GetModelInfo(pVehicle->GetModelIndex())->GetColModel();
|
||||
CColModel* pColModel = pVehicle->GetColModel();
|
||||
for (int i = 0; i < pColModel->numSpheres; i++) {
|
||||
CVector pos = pVehicle->GetMatrix() * pColModel->spheres[i].center;
|
||||
float radius = pColModel->spheres[i].radius;
|
||||
@ -1677,7 +1679,7 @@ float CGarage::CalcDistToGarageRectangleSquared(float X, float Y)
|
||||
else
|
||||
distX = 0.0f;
|
||||
if (Y < m_fY1)
|
||||
distY = m_fY1 - X;
|
||||
distY = m_fY1 - Y;
|
||||
else if (Y > m_fY2)
|
||||
distY = Y - m_fY2;
|
||||
else
|
||||
@ -1698,8 +1700,8 @@ float CGarage::CalcSmallestDistToGarageDoorSquared(float X, float Y)
|
||||
|
||||
void CGarage::FindDoorsEntities()
|
||||
{
|
||||
m_pDoor1 = false;
|
||||
m_pDoor2 = false;
|
||||
m_pDoor1 = nil;
|
||||
m_pDoor2 = nil;
|
||||
int xstart = max(0, CWorld::GetSectorIndexX(m_fX1));
|
||||
int xend = min(NUMSECTORS_X - 1, CWorld::GetSectorIndexX(m_fX2));
|
||||
int ystart = max(0, CWorld::GetSectorIndexY(m_fY1));
|
||||
@ -1992,7 +1994,7 @@ void CGarage::TidyUpGarageClose()
|
||||
continue;
|
||||
bool bRemove = false;
|
||||
if (m_eGarageState != GS_FULLYCLOSED) {
|
||||
CColModel* pColModel = CModelInfo::GetModelInfo(pVehicle->GetModelIndex())->GetColModel();
|
||||
CColModel* pColModel = pVehicle->GetColModel();
|
||||
for (int i = 0; i < pColModel->numSpheres; i++) {
|
||||
CVector pos = pVehicle->GetMatrix() * pColModel->spheres[i].center;
|
||||
float radius = pColModel->spheres[i].radius;
|
||||
@ -2106,7 +2108,7 @@ void CGarages::CloseHideOutGaragesBeforeSave()
|
||||
aGarages[i].m_eGarageType != GARAGE_HIDEOUT_THREE)
|
||||
continue;
|
||||
if (aGarages[i].m_eGarageState != GS_FULLYCLOSED &&
|
||||
aGarages[i].m_eGarageType != GARAGE_HIDEOUT_ONE || !aGarages[i].IsAnyCarBlockingDoor()) {
|
||||
(aGarages[i].m_eGarageType != GARAGE_HIDEOUT_ONE || !aGarages[i].IsAnyCarBlockingDoor())) {
|
||||
aGarages[i].m_eGarageState = GS_FULLYCLOSED;
|
||||
switch (aGarages[i].m_eGarageType) {
|
||||
case GARAGE_HIDEOUT_ONE:
|
||||
@ -2227,6 +2229,7 @@ void CGarages::SetAllDoorsBackToOriginalHeight()
|
||||
void CGarages::Save(uint8 * buf, uint32 * size)
|
||||
{
|
||||
#ifdef FIX_GARAGE_SIZE
|
||||
INITSAVEBUF
|
||||
*size = (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + 3 * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage));
|
||||
#else
|
||||
* size = 5484;
|
||||
@ -2248,6 +2251,9 @@ void CGarages::Save(uint8 * buf, uint32 * size)
|
||||
}
|
||||
for (int i = 0; i < NUM_GARAGES; i++)
|
||||
WriteSaveBuf(buf, aGarages[i]);
|
||||
#ifdef FIX_GARAGE_SIZE
|
||||
VALIDATESAVEBUF(*size);
|
||||
#endif
|
||||
}
|
||||
|
||||
CStoredCar::CStoredCar(const CStoredCar & other)
|
||||
@ -2271,6 +2277,7 @@ CStoredCar::CStoredCar(const CStoredCar & other)
|
||||
void CGarages::Load(uint8* buf, uint32 size)
|
||||
{
|
||||
#ifdef FIX_GARAGE_SIZE
|
||||
INITSAVEBUF
|
||||
assert(size == (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + 3 * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage));
|
||||
#else
|
||||
assert(size == 5484);
|
||||
@ -2303,6 +2310,9 @@ void CGarages::Load(uint8* buf, uint32 size)
|
||||
else
|
||||
aGarages[i].UpdateDoorsHeight();
|
||||
}
|
||||
#ifdef FIX_GARAGE_SIZE
|
||||
VALIDATESAVEBUF(size);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
@ -2345,7 +2355,6 @@ CGarages::IsModelIndexADoor(uint32 id)
|
||||
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x426B20, CGarages::TriggerMessage, PATCH_JUMP); // CCrane::Update, CCrane::FindCarInSectorList
|
||||
InjectHook(0x427AB0, CGarages::IsPointInAGarageCameraZone, PATCH_JUMP); // CCamera::CamControl
|
||||
InjectHook(0x427BC0, CGarages::CameraShouldBeOutside, PATCH_JUMP); // CCamera::CamControl
|
||||
InjectHook(0x428940, CGarages::Load, PATCH_JUMP); // GenericLoad
|
||||
|
@ -194,7 +194,6 @@ class CGarages
|
||||
static uint32 &NumGarages;
|
||||
static bool &PlayerInGarage;
|
||||
static int32 &PoliceCarsCollected;
|
||||
static uint32 &GarageToBeTidied;
|
||||
static CGarage(&aGarages)[NUM_GARAGES];
|
||||
static CStoredCar(&aCarsInSafeHouse1)[NUM_GARAGE_STORED_CARS];
|
||||
static CStoredCar(&aCarsInSafeHouse2)[NUM_GARAGE_STORED_CARS];
|
||||
|
@ -5,8 +5,13 @@
|
||||
#include "Camera.h"
|
||||
#include "Vehicle.h"
|
||||
#include "World.h"
|
||||
#include "Lines.h" // for debug
|
||||
#include "PathFind.h"
|
||||
|
||||
bool gbShowPedPaths;
|
||||
bool gbShowCarPaths;
|
||||
bool gbShowCarPathsLinks;
|
||||
|
||||
CPathFind &ThePaths = *(CPathFind*)0x8F6754;
|
||||
|
||||
WRAPPER bool CPedPath::CalcPedRoute(uint8, CVector, CVector, CVector*, int16*, int16) { EAXJMP(0x42E680); }
|
||||
@ -466,20 +471,20 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
|
||||
// IMPROVE: use a goto here
|
||||
// Find existing car path link
|
||||
for(k = 0; k < m_numCarPathLinks; k++){
|
||||
if(m_carPathLinks[k].dirX == tempnodes[j].dirX &&
|
||||
m_carPathLinks[k].dirY == tempnodes[j].dirY &&
|
||||
m_carPathLinks[k].posX == tempnodes[j].pos.x &&
|
||||
m_carPathLinks[k].posY == tempnodes[j].pos.y){
|
||||
if(m_carPathLinks[k].dir.x == tempnodes[j].dirX &&
|
||||
m_carPathLinks[k].dir.y == tempnodes[j].dirY &&
|
||||
m_carPathLinks[k].pos.x == tempnodes[j].pos.x &&
|
||||
m_carPathLinks[k].pos.y == tempnodes[j].pos.y){
|
||||
m_carPathConnections[m_numConnections] = k;
|
||||
k = m_numCarPathLinks;
|
||||
}
|
||||
}
|
||||
// k is m_numCarPathLinks+1 if we found one
|
||||
if(k == m_numCarPathLinks){
|
||||
m_carPathLinks[m_numCarPathLinks].dirX = tempnodes[j].dirX;
|
||||
m_carPathLinks[m_numCarPathLinks].dirY = tempnodes[j].dirY;
|
||||
m_carPathLinks[m_numCarPathLinks].posX = tempnodes[j].pos.x;
|
||||
m_carPathLinks[m_numCarPathLinks].posY = tempnodes[j].pos.y;
|
||||
m_carPathLinks[m_numCarPathLinks].dir.x = tempnodes[j].dirX;
|
||||
m_carPathLinks[m_numCarPathLinks].dir.y = tempnodes[j].dirY;
|
||||
m_carPathLinks[m_numCarPathLinks].pos.x = tempnodes[j].pos.x;
|
||||
m_carPathLinks[m_numCarPathLinks].pos.y = tempnodes[j].pos.y;
|
||||
m_carPathLinks[m_numCarPathLinks].pathNodeIndex = i;
|
||||
m_carPathLinks[m_numCarPathLinks].numLeftLanes = tempnodes[j].numLeftLanes;
|
||||
m_carPathLinks[m_numCarPathLinks].numRightLanes = tempnodes[j].numRightLanes;
|
||||
@ -529,20 +534,20 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
|
||||
// IMPROVE: use a goto here
|
||||
// Find existing car path link
|
||||
for(k = 0; k < m_numCarPathLinks; k++){
|
||||
if(m_carPathLinks[k].dirX == dx &&
|
||||
m_carPathLinks[k].dirY == dy &&
|
||||
m_carPathLinks[k].posX == posx &&
|
||||
m_carPathLinks[k].posY == posy){
|
||||
if(m_carPathLinks[k].dir.x == dx &&
|
||||
m_carPathLinks[k].dir.y == dy &&
|
||||
m_carPathLinks[k].pos.x == posx &&
|
||||
m_carPathLinks[k].pos.y == posy){
|
||||
m_carPathConnections[m_numConnections] = k;
|
||||
k = m_numCarPathLinks;
|
||||
}
|
||||
}
|
||||
// k is m_numCarPathLinks+1 if we found one
|
||||
if(k == m_numCarPathLinks){
|
||||
m_carPathLinks[m_numCarPathLinks].dirX = dx;
|
||||
m_carPathLinks[m_numCarPathLinks].dirY = dy;
|
||||
m_carPathLinks[m_numCarPathLinks].posX = posx;
|
||||
m_carPathLinks[m_numCarPathLinks].posY = posy;
|
||||
m_carPathLinks[m_numCarPathLinks].dir.x = dx;
|
||||
m_carPathLinks[m_numCarPathLinks].dir.y = dy;
|
||||
m_carPathLinks[m_numCarPathLinks].pos.x = posx;
|
||||
m_carPathLinks[m_numCarPathLinks].pos.y = posy;
|
||||
m_carPathLinks[m_numCarPathLinks].pathNodeIndex = i;
|
||||
m_carPathLinks[m_numCarPathLinks].numLeftLanes = -1;
|
||||
m_carPathLinks[m_numCarPathLinks].numRightLanes = -1;
|
||||
@ -760,8 +765,8 @@ CPathFind::SetLinksBridgeLights(float x1, float x2, float y1, float y2, bool ena
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < m_numCarPathLinks; i++)
|
||||
if(x1 < m_carPathLinks[i].posX && m_carPathLinks[i].posX < x2 &&
|
||||
y1 < m_carPathLinks[i].posY && m_carPathLinks[i].posY < y2)
|
||||
if(x1 < m_carPathLinks[i].pos.x && m_carPathLinks[i].pos.x < x2 &&
|
||||
y1 < m_carPathLinks[i].pos.y && m_carPathLinks[i].pos.y < y2)
|
||||
m_carPathLinks[i].bBridgeLights = enable;
|
||||
}
|
||||
|
||||
@ -1444,6 +1449,132 @@ CPathFind::Load(uint8 *buf, uint32 size)
|
||||
m_pathNodes[i].bBetweenLevels = false;
|
||||
}
|
||||
|
||||
void
|
||||
CPathFind::DisplayPathData(void)
|
||||
{
|
||||
// Not the function from mobm_carPathLinksile but my own!
|
||||
|
||||
int i, j, k;
|
||||
// Draw 50 units around camera
|
||||
CVector pos = TheCamera.GetPosition();
|
||||
const float maxDist = 50.0f;
|
||||
|
||||
// Render car path nodes
|
||||
if(gbShowCarPaths)
|
||||
for(i = 0; i < m_numCarPathNodes; i++){
|
||||
if((m_pathNodes[i].pos - pos).MagnitudeSqr() > SQR(maxDist))
|
||||
continue;
|
||||
|
||||
CVector n1 = m_pathNodes[i].pos;
|
||||
n1.z += 0.3f;
|
||||
|
||||
// Draw node itself
|
||||
CLines::RenderLineWithClipping(n1.x, n1.y, n1.z,
|
||||
n1.x, n1.y, n1.z + 1.0f,
|
||||
0xFFFFFFFF, 0xFFFFFFFF);
|
||||
|
||||
for(j = 0; j < m_pathNodes[i].numLinks; j++){
|
||||
k = m_connections[m_pathNodes[i].firstLink + j];
|
||||
CVector n2 = m_pathNodes[k].pos;
|
||||
n2.z += 0.3f;
|
||||
// Draw links to neighbours
|
||||
CLines::RenderLineWithClipping(n1.x, n1.y, n1.z,
|
||||
n2.x, n2.y, n2.z,
|
||||
0xFFFFFFFF, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
// Render car path nodes
|
||||
if(gbShowCarPathsLinks)
|
||||
for(i = 0; i < m_numCarPathLinks; i++){
|
||||
CVector2D n1_2d = m_carPathLinks[i].pos;
|
||||
if((n1_2d - pos).MagnitudeSqr() > SQR(maxDist))
|
||||
continue;
|
||||
|
||||
int ni = m_carPathLinks[i].pathNodeIndex;
|
||||
CVector pn1 = m_pathNodes[ni].pos;
|
||||
pn1.z += 0.3f;
|
||||
CVector n1(n1_2d.x, n1_2d.y, pn1.z);
|
||||
n1.z += 0.3f;
|
||||
|
||||
// Draw car node itself
|
||||
CLines::RenderLineWithClipping(n1.x, n1.y, n1.z,
|
||||
n1.x, n1.y, n1.z + 1.0f,
|
||||
0xFFFFFFFF, 0xFFFFFFFF);
|
||||
CLines::RenderLineWithClipping(n1.x, n1.y, n1.z + 0.5f,
|
||||
n1.x+m_carPathLinks[i].dir.x, n1.y+m_carPathLinks[i].dir.y, n1.z + 0.5f,
|
||||
0xFFFFFFFF, 0xFFFFFFFF);
|
||||
|
||||
// Draw connection to car path node
|
||||
CLines::RenderLineWithClipping(n1.x, n1.y, n1.z,
|
||||
pn1.x, pn1.y, pn1.z,
|
||||
0xFF0000FF, 0xFFFFFFFF);
|
||||
|
||||
// traffic light type
|
||||
uint32 col = 0xFF;
|
||||
if((m_carPathLinks[i].trafficLightType&0x7F) == 1)
|
||||
col += 0xFF000000;
|
||||
if((m_carPathLinks[i].trafficLightType&0x7F) == 2)
|
||||
col += 0x00FF0000;
|
||||
if(m_carPathLinks[i].trafficLightType & 0x80)
|
||||
col += 0x0000FF00;
|
||||
CLines::RenderLineWithClipping(n1.x+0.2f, n1.y, n1.z,
|
||||
n1.x+0.2f, n1.y, n1.z + 1.0f,
|
||||
col, col);
|
||||
|
||||
for(j = 0; j < m_pathNodes[ni].numLinks; j++){
|
||||
k = m_carPathConnections[m_pathNodes[ni].firstLink + j];
|
||||
CVector2D n2_2d = m_carPathLinks[k].pos;
|
||||
int nk = m_carPathLinks[k].pathNodeIndex;
|
||||
CVector pn2 = m_pathNodes[nk].pos;
|
||||
pn2.z += 0.3f;
|
||||
CVector n2(n2_2d.x, n2_2d.y, pn2.z);
|
||||
n2.z += 0.3f;
|
||||
|
||||
// Draw links to neighbours
|
||||
CLines::RenderLineWithClipping(n1.x, n1.y, n1.z,
|
||||
n2.x, n2.y, n2.z,
|
||||
0xFF00FFFF, 0xFF00FFFF);
|
||||
}
|
||||
}
|
||||
|
||||
// Render ped path nodes
|
||||
if(gbShowPedPaths)
|
||||
for(i = m_numCarPathNodes; i < m_numPathNodes; i++){
|
||||
if((m_pathNodes[i].pos - pos).MagnitudeSqr() > SQR(maxDist))
|
||||
continue;
|
||||
|
||||
CVector n1 = m_pathNodes[i].pos;
|
||||
n1.z += 0.3f;
|
||||
|
||||
// Draw node itself
|
||||
CLines::RenderLineWithClipping(n1.x, n1.y, n1.z,
|
||||
n1.x, n1.y, n1.z + 1.0f,
|
||||
0xFFFFFFFF, 0xFFFFFFFF);
|
||||
|
||||
for(j = 0; j < m_pathNodes[i].numLinks; j++){
|
||||
k = m_connections[m_pathNodes[i].firstLink + j];
|
||||
CVector n2 = m_pathNodes[k].pos;
|
||||
n2.z += 0.3f;
|
||||
// Draw links to neighbours
|
||||
CLines::RenderLineWithClipping(n1.x, n1.y, n1.z,
|
||||
n2.x, n2.y, n2.z,
|
||||
0xFFFFFFFF, 0xFFFFFFFF);
|
||||
|
||||
// Draw connection flags
|
||||
CVector mid = (n1+n2)/2.0f;
|
||||
uint32 col = 0xFF;
|
||||
if(m_connectionFlags[m_pathNodes[i].firstLink + j].bCrossesRoad)
|
||||
col += 0x00FF0000;
|
||||
if(m_connectionFlags[m_pathNodes[i].firstLink + j].bTrafficLight)
|
||||
col += 0xFF000000;
|
||||
CLines::RenderLineWithClipping(mid.x, mid.y, mid.z,
|
||||
mid.x, mid.y, mid.z + 1.0f,
|
||||
col, col);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x4294A0, &CPathFind::Init, PATCH_JUMP);
|
||||
InjectHook(0x42D580, &CPathFind::AllocatePathFindInfoMem, PATCH_JUMP);
|
||||
|
@ -84,10 +84,8 @@ union CConnectionFlags
|
||||
|
||||
struct CCarPathLink
|
||||
{
|
||||
float posX;
|
||||
float posY;
|
||||
float dirX;
|
||||
float dirY;
|
||||
CVector2D pos;
|
||||
CVector2D dir;
|
||||
int16 pathNodeIndex;
|
||||
int8 numLeftLanes;
|
||||
int8 numRightLanes;
|
||||
@ -208,7 +206,13 @@ public:
|
||||
bool TestCoorsCloseness(CVector target, uint8 type, CVector start);
|
||||
void Save(uint8 *buf, uint32 *size);
|
||||
void Load(uint8 *buf, uint32 size);
|
||||
|
||||
void DisplayPathData(void);
|
||||
};
|
||||
static_assert(sizeof(CPathFind) == 0x49bf4, "CPathFind: error");
|
||||
|
||||
extern CPathFind &ThePaths;
|
||||
|
||||
extern bool gbShowPedPaths;
|
||||
extern bool gbShowCarPaths;
|
||||
extern bool gbShowCarPathsLinks;
|
||||
|
@ -54,23 +54,6 @@ uint8 aWeaponGreens[] = { 0, 255, 128, 255, 0, 255, 128, 255, 0, 255, 255, 0, 25
|
||||
uint8 aWeaponBlues[] = { 0, 0, 255, 0, 255, 255, 0, 128, 255, 0, 255, 0, 128, 255, 0, 0 };
|
||||
float aWeaponScale[] = { 1.0f, 2.0f, 1.5f, 1.0f, 1.0f, 1.5f, 1.0f, 2.0f, 1.0f, 2.0f, 2.5f, 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
|
||||
WRAPPER void CPacManPickups::Init(void) { EAXJMP(0x432760); }
|
||||
WRAPPER void CPacManPickups::Update(void) { EAXJMP(0x432800); }
|
||||
WRAPPER void CPacManPickups::GeneratePMPickUps(CVector, float, int16, uint8) { EAXJMP(0x432AE0); }
|
||||
WRAPPER void CPacManPickups::GeneratePMPickUpsForRace(int32) { EAXJMP(0x432D50); }
|
||||
WRAPPER void CPacManPickups::GenerateOnePMPickUp(CVector) { EAXJMP(0x432F20); }
|
||||
WRAPPER void CPacManPickups::Render(void) { EAXJMP(0x432F60); }
|
||||
WRAPPER void CPacManPickups::DoCleanUpPacManStuff(void) { EAXJMP(0x433150); }
|
||||
WRAPPER void CPacManPickups::StartPacManRace(int32) { EAXJMP(0x433340); }
|
||||
WRAPPER void CPacManPickups::StartPacManRecord(void) { EAXJMP(0x433360); }
|
||||
WRAPPER uint32 CPacManPickups::QueryPowerPillsEatenInRace(void) { EAXJMP(0x4333A0); }
|
||||
WRAPPER void CPacManPickups::ResetPowerPillsEatenInRace(void) { EAXJMP(0x4333B0); }
|
||||
WRAPPER void CPacManPickups::CleanUpPacManStuff(void) { EAXJMP(0x4333C0); }
|
||||
WRAPPER void CPacManPickups::StartPacManScramble(CVector, float, int16) { EAXJMP(0x4333D0); }
|
||||
WRAPPER uint32 CPacManPickups::QueryPowerPillsCarriedByPlayer(void) { EAXJMP(0x4333F0); }
|
||||
WRAPPER void CPacManPickups::ResetPowerPillsCarriedByPlayer(void) { EAXJMP(0x433410); }
|
||||
|
||||
|
||||
void
|
||||
CPickup::RemoveKeepType()
|
||||
{
|
||||
@ -111,7 +94,7 @@ CPickup::GiveUsAPickUpObject(int32 handle)
|
||||
object->bUsesCollision = false;
|
||||
object->bIsPickup = true;
|
||||
|
||||
object->field_172 = m_eModelIndex == MI_PICKUP_BONUS ? m_nQuantity : 0;
|
||||
object->m_nBonusValue = m_eModelIndex == MI_PICKUP_BONUS ? m_nQuantity : 0;
|
||||
|
||||
switch (m_eType)
|
||||
{
|
||||
@ -289,13 +272,6 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
|
||||
Remove();
|
||||
DMAudio.PlayFrontEndSound(SOUND_PICKUP_MONEY, 0);
|
||||
return true;
|
||||
//case PICKUP_IN_SHOP_OUT_OF_STOCK:
|
||||
//case PICKUP_MINE_INACTIVE:
|
||||
//case PICKUP_MINE_ARMED:
|
||||
//case PICKUP_NAUTICAL_MINE_INACTIVE:
|
||||
//case PICKUP_NAUTICAL_MINE_ARMED:
|
||||
//case PICKUP_FLOATINGPACKAGE:
|
||||
//case PICKUP_FLOATINGPACKAGE_FLOATING:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -530,14 +506,12 @@ CPickups::GenerateNewOne(CVector pos, uint32 modelIndex, uint8 type, uint32 quan
|
||||
}
|
||||
}
|
||||
|
||||
if (!bFreeFound)
|
||||
{
|
||||
if (!bFreeFound) {
|
||||
for (slot = 0; slot < NUMGENERALPICKUPS; slot++) {
|
||||
if (aPickUps[slot].m_eType == PICKUP_MONEY) break;
|
||||
}
|
||||
|
||||
if (slot >= NUMGENERALPICKUPS)
|
||||
{
|
||||
if (slot >= NUMGENERALPICKUPS) {
|
||||
for (slot = 0; slot < NUMGENERALPICKUPS; slot++) {
|
||||
if (aPickUps[slot].m_eType == PICKUP_ONCE_TIMEOUT) break;
|
||||
}
|
||||
@ -671,9 +645,9 @@ void
|
||||
CPickups::DoPickUpEffects(CEntity *entity)
|
||||
{
|
||||
if (entity->GetModelIndex() == MI_PICKUP_KILLFRENZY)
|
||||
entity->m_flagD80 = CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame;
|
||||
entity->bDoNotRender = CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame;
|
||||
|
||||
if (!entity->m_flagD80) {
|
||||
if (!entity->bDoNotRender) {
|
||||
float s = Sin((float)((CTimer::GetTimeInMilliseconds() + (uintptr)entity) & 0x7FF) * DEGTORAD(360.0f / 0x800));
|
||||
float modifiedSin = 0.3f * (s + 1.0f);
|
||||
|
||||
@ -716,7 +690,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
|
||||
size, 65.0f, CCoronas::TYPE_RING, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
|
||||
|
||||
CObject *object = (CObject*)entity;
|
||||
if (object->m_obj_flag2 || object->bOutOfStock || object->field_172) {
|
||||
if (object->m_obj_flag2 || object->bOutOfStock || object->m_nBonusValue) {
|
||||
float dist = (TheCamera.GetPosition() - pos).Magnitude();
|
||||
const float MAXDIST = 12.0f;
|
||||
|
||||
@ -734,7 +708,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
|
||||
aMessages[NumMessages].m_color.blue = aWeaponBlues[colorId];
|
||||
aMessages[NumMessages].m_color.alpha = (1.0f - dist / MAXDIST) * 128.0f;
|
||||
aMessages[NumMessages].m_bOutOfStock = object->bOutOfStock;
|
||||
aMessages[NumMessages].m_quantity = object->field_172;
|
||||
aMessages[NumMessages].m_quantity = object->m_nBonusValue;
|
||||
NumMessages++;
|
||||
}
|
||||
}
|
||||
@ -1021,6 +995,418 @@ INITSAVEBUF
|
||||
VALIDATESAVEBUF(*size)
|
||||
}
|
||||
|
||||
void
|
||||
CPacManPickup::Update()
|
||||
{
|
||||
if (FindPlayerVehicle() == nil) return;
|
||||
|
||||
CVehicle *veh = FindPlayerVehicle();
|
||||
|
||||
if (DistanceSqr2D(FindPlayerVehicle()->GetPosition(), m_vecPosn.x, m_vecPosn.y) < 100.0f && veh->IsSphereTouchingVehicle(m_vecPosn.x, m_vecPosn.y, m_vecPosn.z, 1.5f)) {
|
||||
switch (m_eType)
|
||||
{
|
||||
case PACMAN_SCRAMBLE:
|
||||
{
|
||||
veh->m_nPacManPickupsCarried++;
|
||||
veh->m_vecMoveSpeed *= 0.65f;
|
||||
float massMult = (veh->m_fMass + 250.0f) / veh->m_fMass;
|
||||
veh->m_fMass *= massMult;
|
||||
veh->m_fTurnMass *= massMult;
|
||||
veh->m_fForceMultiplier *= massMult;
|
||||
FindPlayerPed()->m_pWanted->m_nChaos += 10;
|
||||
FindPlayerPed()->m_pWanted->UpdateWantedLevel();
|
||||
DMAudio.PlayFrontEndSound(SOUND_PICKUP_PACMAN_PACKAGE, 0);
|
||||
break;
|
||||
}
|
||||
case PACMAN_RACE:
|
||||
CPacManPickups::PillsEatenInRace++;
|
||||
DMAudio.PlayFrontEndSound(SOUND_PICKUP_PACMAN_PILL, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
m_eType = PACMAN_NONE;
|
||||
if (m_pObject != nil) {
|
||||
CWorld::Remove(m_pObject);
|
||||
delete m_pObject;
|
||||
m_pObject = nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int32 CollectGameState;
|
||||
int16 ThingsToCollect;
|
||||
|
||||
CPacManPickup CPacManPickups::aPMPickUps[NUMPACMANPICKUPS];
|
||||
CVector CPacManPickups::LastPickUpCoors;
|
||||
int32 CPacManPickups::PillsEatenInRace;
|
||||
bool CPacManPickups::bPMActive;
|
||||
|
||||
void
|
||||
CPacManPickups::Init()
|
||||
{
|
||||
for (int i = 0; i < NUMPACMANPICKUPS; i++)
|
||||
aPMPickUps[i].m_eType = PACMAN_NONE;
|
||||
bPMActive = false;
|
||||
}
|
||||
|
||||
void
|
||||
CPacManPickups::Update()
|
||||
{
|
||||
if (FindPlayerVehicle()) {
|
||||
float dist = Distance(FindPlayerCoors(), CVector(1072.0f, -948.0f, 14.5f));
|
||||
switch (CollectGameState) {
|
||||
case 1:
|
||||
if (dist < 10.0f) {
|
||||
ThingsToCollect -= FindPlayerVehicle()->m_nPacManPickupsCarried;
|
||||
FindPlayerVehicle()->m_nPacManPickupsCarried = 0;
|
||||
FindPlayerVehicle()->m_fMass /= FindPlayerVehicle()->m_fForceMultiplier;
|
||||
FindPlayerVehicle()->m_fTurnMass /= FindPlayerVehicle()->m_fForceMultiplier;
|
||||
FindPlayerVehicle()->m_fForceMultiplier = 1.0f;
|
||||
}
|
||||
if (ThingsToCollect <= 0) {
|
||||
CollectGameState = 2;
|
||||
ClearPMPickUps();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (dist > 11.0f)
|
||||
CollectGameState = 0;
|
||||
break;
|
||||
case 20:
|
||||
if (Distance(FindPlayerCoors(), LastPickUpCoors) > 30.0f) {
|
||||
LastPickUpCoors = FindPlayerCoors();
|
||||
printf("%f, %f, %f,\n", LastPickUpCoors.x, LastPickUpCoors.y, LastPickUpCoors.z);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (bPMActive) {
|
||||
#define PACMANPICKUPS_FRAME_SPAN (4)
|
||||
for (uint32 i = (CTimer::GetFrameCounter() % PACMANPICKUPS_FRAME_SPAN) * (NUMPACMANPICKUPS / PACMANPICKUPS_FRAME_SPAN); i < ((CTimer::GetFrameCounter() % PACMANPICKUPS_FRAME_SPAN) + 1) * (NUMPACMANPICKUPS / PACMANPICKUPS_FRAME_SPAN); i++) {
|
||||
if (aPMPickUps[i].m_eType != PACMAN_NONE)
|
||||
aPMPickUps[i].Update();
|
||||
}
|
||||
#undef PACMANPICKUPS_FRAME_SPAN
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CPacManPickups::GeneratePMPickUps(CVector pos, float scrambleMult, int16 count, uint8 type)
|
||||
{
|
||||
int i = 0;
|
||||
while (count > 0) {
|
||||
while (aPMPickUps[i].m_eType != PACMAN_NONE)
|
||||
i++;
|
||||
|
||||
bool bPickupCreated = false;
|
||||
while (!bPickupCreated) {
|
||||
CVector newPos = pos;
|
||||
CColPoint colPoint;
|
||||
CEntity *pRoad;
|
||||
uint16 nRand = CGeneral::GetRandomNumber();
|
||||
newPos.x += ((nRand & 0xFF) - 128) * scrambleMult / 128.0f;
|
||||
newPos.y += (((nRand >> 8) & 0xFF) - 128) * scrambleMult / 128.0f;
|
||||
newPos.z = 1000.0f;
|
||||
if (CWorld::ProcessVerticalLine(newPos, -1000.0f, colPoint, pRoad, true, false, false, false, true, false, nil) && pRoad->IsBuilding() && ((CBuilding*)pRoad)->GetIsATreadable()) {
|
||||
newPos.z = 0.7f + colPoint.point.z;
|
||||
aPMPickUps[i].m_eType = type;
|
||||
aPMPickUps[i].m_vecPosn = newPos;
|
||||
CObject *obj = new CObject(MI_BULLION, true);
|
||||
if (obj != nil) {
|
||||
obj->ObjectCreatedBy = MISSION_OBJECT;
|
||||
obj->GetPosition() = aPMPickUps[i].m_vecPosn;
|
||||
obj->SetOrientation(0.0f, 0.0f, -HALFPI);
|
||||
obj->GetMatrix().UpdateRW();
|
||||
obj->UpdateRwFrame();
|
||||
|
||||
obj->bAffectedByGravity = false;
|
||||
obj->bExplosionProof = true;
|
||||
obj->bUsesCollision = false;
|
||||
obj->bIsPickup = false;
|
||||
CWorld::Add(obj);
|
||||
}
|
||||
aPMPickUps[i].m_pObject = obj;
|
||||
bPickupCreated = true;
|
||||
}
|
||||
}
|
||||
count--;
|
||||
}
|
||||
bPMActive = true;
|
||||
}
|
||||
|
||||
// diablo porn mission pickups
|
||||
static const CVector aRacePoints1[] = {
|
||||
CVector(913.62219f, -155.13692f, 4.9699469f),
|
||||
CVector(913.92401f, -124.12943f, 4.9692569f),
|
||||
CVector(913.27899f, -93.524231f, 7.4325991f),
|
||||
CVector(912.60852f, -63.15905f, 7.4533591f),
|
||||
CVector(934.22144f, -42.049122f, 7.4511471f),
|
||||
CVector(958.88092f, -23.863735f, 7.4652338f),
|
||||
CVector(978.50812f, -0.78458798f, 5.13515f),
|
||||
CVector(1009.4175f, -2.1041219f, 2.4461579f),
|
||||
CVector(1040.6313f, -2.0793829f, 2.293175f),
|
||||
CVector(1070.7863f, -2.084095f, 2.2789791f),
|
||||
CVector(1100.5773f, -8.468729f, 5.3248072f),
|
||||
CVector(1119.9341f, -31.738031f, 7.1913071f),
|
||||
CVector(1122.1664f, -62.762737f, 7.4703908f),
|
||||
CVector(1122.814f, -93.650566f, 8.5577497f),
|
||||
CVector(1125.8253f, -124.26616f, 9.9803305f),
|
||||
CVector(1153.8727f, -135.47169f, 14.150617f),
|
||||
CVector(1184.0831f, -135.82845f, 14.973998f),
|
||||
CVector(1192.0432f, -164.57816f, 19.18627f),
|
||||
CVector(1192.7761f, -194.28871f, 24.799675f),
|
||||
CVector(1215.1527f, -215.0714f, 25.74975f),
|
||||
CVector(1245.79f, -215.39304f, 28.70726f),
|
||||
CVector(1276.2477f, -216.39485f, 33.71236f),
|
||||
CVector(1306.5535f, -216.71007f, 39.711472f),
|
||||
CVector(1335.0244f, -224.59329f, 46.474979f),
|
||||
CVector(1355.4879f, -246.27664f, 49.934841f),
|
||||
CVector(1362.6003f, -276.47064f, 49.96265f),
|
||||
CVector(1363.027f, -307.30847f, 49.969173f),
|
||||
CVector(1365.343f, -338.08609f, 49.967789f),
|
||||
CVector(1367.5957f, -368.01105f, 50.092304f),
|
||||
CVector(1368.2749f, -398.38049f, 50.061268f),
|
||||
CVector(1366.9034f, -429.98483f, 50.057545f),
|
||||
CVector(1356.8534f, -459.09259f, 50.035545f),
|
||||
CVector(1335.5819f, -481.13544f, 47.217903f),
|
||||
CVector(1306.7552f, -491.07443f, 40.202629f),
|
||||
CVector(1275.5978f, -491.33194f, 33.969223f),
|
||||
CVector(1244.702f, -491.46451f, 29.111021f),
|
||||
CVector(1213.2222f, -491.8754f, 25.771168f),
|
||||
CVector(1182.7729f, -492.19995f, 24.749964f),
|
||||
CVector(1152.6874f, -491.42221f, 21.70038f),
|
||||
CVector(1121.5352f, -491.94604f, 20.075182f),
|
||||
CVector(1090.7056f, -492.63751f, 17.585758f),
|
||||
CVector(1059.6008f, -491.65762f, 14.848632f),
|
||||
CVector(1029.113f, -489.66031f, 14.918498f),
|
||||
CVector(998.20679f, -486.78107f, 14.945688f),
|
||||
CVector(968.00555f, -484.91266f, 15.001229f),
|
||||
CVector(937.74939f, -492.09015f, 14.958629f),
|
||||
CVector(927.17352f, -520.97736f, 14.972308f),
|
||||
CVector(929.29749f, -552.08643f, 14.978855f),
|
||||
CVector(950.69525f, -574.47778f, 14.972788f),
|
||||
CVector(974.02826f, -593.56024f, 14.966445f),
|
||||
CVector(989.04779f, -620.12854f, 14.951016f),
|
||||
CVector(1014.1639f, -637.3905f, 14.966736f),
|
||||
CVector(1017.5961f, -667.3736f, 14.956415f),
|
||||
CVector(1041.9735f, -685.94391f, 15.003841f),
|
||||
CVector(1043.3064f, -716.11298f, 14.974236f),
|
||||
CVector(1043.5337f, -746.63855f, 14.96919f),
|
||||
CVector(1044.142f, -776.93823f, 14.965424f),
|
||||
CVector(1044.2657f, -807.29395f, 14.97171f),
|
||||
CVector(1017.0797f, -820.1076f, 14.975431f),
|
||||
CVector(986.23865f, -820.37103f, 14.972883f),
|
||||
CVector(956.10065f, -820.23291f, 14.981133f),
|
||||
CVector(925.86914f, -820.19049f, 14.976553f),
|
||||
CVector(897.69702f, -831.08734f, 14.962709f),
|
||||
CVector(868.06586f, -835.99237f, 14.970685f),
|
||||
CVector(836.93054f, -836.84387f, 14.965049f),
|
||||
CVector(811.63586f, -853.7915f, 15.067576f),
|
||||
CVector(811.46344f, -884.27368f, 12.247812f),
|
||||
CVector(811.60651f, -914.70959f, 9.2393751f),
|
||||
CVector(811.10425f, -945.16272f, 5.817255f),
|
||||
CVector(816.54584f, -975.64587f, 4.998558f),
|
||||
CVector(828.2951f, -1003.3685f, 5.0471172f),
|
||||
CVector(852.28839f, -1021.5963f, 4.9371028f),
|
||||
CVector(882.50067f, -1025.4459f, 5.14077f),
|
||||
CVector(912.84821f, -1026.7874f, 8.3415451f),
|
||||
CVector(943.68274f, -1026.6914f, 11.341879f),
|
||||
CVector(974.4129f, -1027.3682f, 14.410345f),
|
||||
CVector(1004.1079f, -1036.0778f, 14.92961f),
|
||||
CVector(1030.1144f, -1051.1224f, 14.850387f),
|
||||
CVector(1058.7585f, -1060.342f, 14.821624f),
|
||||
CVector(1087.7797f, -1068.3263f, 14.800561f),
|
||||
CVector(1099.8807f, -1095.656f, 11.877907f),
|
||||
CVector(1130.0005f, -1101.994f, 11.853914f),
|
||||
CVector(1160.3809f, -1101.6355f, 11.854824f),
|
||||
CVector(1191.8524f, -1102.1577f, 11.853843f),
|
||||
CVector(1223.3307f, -1102.7448f, 11.852233f),
|
||||
CVector(1253.564f, -1098.1045f, 11.853944f),
|
||||
CVector(1262.0203f, -1069.1785f, 14.8147f),
|
||||
CVector(1290.9998f, -1059.1882f, 14.816016f),
|
||||
CVector(1316.246f, -1041.0635f, 14.81109f),
|
||||
CVector(1331.7539f, -1013.835f, 14.81207f),
|
||||
CVector(1334.0579f, -983.55402f, 14.827253f),
|
||||
CVector(1323.2429f, -954.23083f, 14.954678f),
|
||||
CVector(1302.7495f, -932.21216f, 14.962917f),
|
||||
CVector(1317.418f, -905.89325f, 14.967506f),
|
||||
CVector(1337.9503f, -883.5025f, 14.969675f),
|
||||
CVector(1352.6929f, -855.96954f, 14.967854f),
|
||||
CVector(1357.2388f, -826.26971f, 14.97295f),
|
||||
CVector(1384.8668f, -812.47693f, 12.907736f),
|
||||
CVector(1410.8983f, -795.39056f, 12.052228f),
|
||||
CVector(1433.901f, -775.55811f, 11.96265f),
|
||||
CVector(1443.8615f, -746.92511f, 11.976114f),
|
||||
CVector(1457.7015f, -720.00903f, 11.971177f),
|
||||
CVector(1481.5685f, -701.30237f, 11.977908f),
|
||||
CVector(1511.4004f, -696.83295f, 11.972709f),
|
||||
CVector(1542.1796f, -695.61676f, 11.970441f),
|
||||
CVector(1570.3301f, -684.6239f, 11.969202f),
|
||||
CVector(0.0f, 0.0f, 0.0f),
|
||||
};
|
||||
|
||||
void
|
||||
CPacManPickups::GeneratePMPickUpsForRace(int32 race)
|
||||
{
|
||||
const CVector *pPos = nil;
|
||||
int i = 0;
|
||||
|
||||
if (race == 0) pPos = aRacePoints1; // there's only one available
|
||||
assert(pPos != nil);
|
||||
|
||||
while (!pPos->IsZero()) {
|
||||
while (aPMPickUps[i].m_eType != PACMAN_NONE)
|
||||
i++;
|
||||
|
||||
aPMPickUps[i].m_eType = PACMAN_RACE;
|
||||
aPMPickUps[i].m_vecPosn = *(pPos++);
|
||||
if (race == 0) {
|
||||
CObject* obj = new CObject(MI_DONKEYMAG, true);
|
||||
if (obj != nil) {
|
||||
obj->ObjectCreatedBy = MISSION_OBJECT;
|
||||
|
||||
obj->GetPosition() = aPMPickUps[i].m_vecPosn;
|
||||
obj->SetOrientation(0.0f, 0.0f, -HALFPI);
|
||||
obj->GetMatrix().UpdateRW();
|
||||
obj->UpdateRwFrame();
|
||||
|
||||
obj->bAffectedByGravity = false;
|
||||
obj->bExplosionProof = true;
|
||||
obj->bUsesCollision = false;
|
||||
obj->bIsPickup = false;
|
||||
|
||||
CWorld::Add(obj);
|
||||
}
|
||||
aPMPickUps[i].m_pObject = obj;
|
||||
} else
|
||||
aPMPickUps[i].m_pObject = nil;
|
||||
}
|
||||
bPMActive = true;
|
||||
}
|
||||
|
||||
void
|
||||
CPacManPickups::GenerateOnePMPickUp(CVector pos)
|
||||
{
|
||||
bPMActive = true;
|
||||
aPMPickUps[0].m_eType = PACMAN_RACE;
|
||||
aPMPickUps[0].m_vecPosn = pos;
|
||||
}
|
||||
|
||||
void
|
||||
CPacManPickups::Render()
|
||||
{
|
||||
if (!bPMActive) return;
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCoronaTexture[6]));
|
||||
|
||||
RwV3d pos;
|
||||
float w, h;
|
||||
|
||||
for (int i = 0; i < NUMPACMANPICKUPS; i++) {
|
||||
switch (aPMPickUps[i].m_eType)
|
||||
{
|
||||
case PACMAN_SCRAMBLE:
|
||||
case PACMAN_RACE:
|
||||
if (CSprite::CalcScreenCoors(aPMPickUps[i].m_vecPosn, &pos, &w, &h, true) && pos.z < 100.0f) {
|
||||
if (aPMPickUps[i].m_pObject != nil) {
|
||||
aPMPickUps[i].m_pObject->GetMatrix().SetRotateZOnly((CTimer::GetTimeInMilliseconds() % 1024) * TWOPI / 1024.0f);
|
||||
aPMPickUps[i].m_pObject->GetMatrix().UpdateRW();
|
||||
aPMPickUps[i].m_pObject->UpdateRwFrame();
|
||||
}
|
||||
float fsin = Sin((CTimer::GetTimeInMilliseconds() % 1024) * 6.28f / 1024.0f); // yes, it is 6.28f when it was TWOPI just now...
|
||||
CSprite::RenderOneXLUSprite(pos.x, pos.y, pos.z, 0.8f * w * fsin, 0.8f * h, 100, 50, 5, 255, 1.0f / pos.z, 255);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
CPacManPickups::ClearPMPickUps()
|
||||
{
|
||||
bPMActive = false;
|
||||
|
||||
for (int i = 0; i < NUMPACMANPICKUPS; i++) {
|
||||
if (aPMPickUps[i].m_pObject != nil) {
|
||||
CWorld::Remove(aPMPickUps[i].m_pObject);
|
||||
delete aPMPickUps[i].m_pObject;
|
||||
aPMPickUps[i].m_pObject = nil;
|
||||
}
|
||||
aPMPickUps[i].m_eType = PACMAN_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CPacManPickups::StartPacManRace(int32 race)
|
||||
{
|
||||
GeneratePMPickUpsForRace(race);
|
||||
PillsEatenInRace = 0;
|
||||
}
|
||||
|
||||
void
|
||||
CPacManPickups::StartPacManRecord()
|
||||
{
|
||||
CollectGameState = 20;
|
||||
LastPickUpCoors = FindPlayerCoors();
|
||||
}
|
||||
|
||||
uint32
|
||||
CPacManPickups::QueryPowerPillsEatenInRace()
|
||||
{
|
||||
return PillsEatenInRace;
|
||||
}
|
||||
|
||||
void
|
||||
CPacManPickups::ResetPowerPillsEatenInRace()
|
||||
{
|
||||
PillsEatenInRace = 0;
|
||||
}
|
||||
|
||||
void
|
||||
CPacManPickups::CleanUpPacManStuff()
|
||||
{
|
||||
ClearPMPickUps();
|
||||
}
|
||||
|
||||
void
|
||||
CPacManPickups::StartPacManScramble(CVector pos, float scrambleMult, int16 count)
|
||||
{
|
||||
GeneratePMPickUps(pos, scrambleMult, count, PACMAN_SCRAMBLE);
|
||||
}
|
||||
|
||||
uint32
|
||||
CPacManPickups::QueryPowerPillsCarriedByPlayer()
|
||||
{
|
||||
if (FindPlayerVehicle())
|
||||
return FindPlayerVehicle()->m_nPacManPickupsCarried;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
CPacManPickups::ResetPowerPillsCarriedByPlayer()
|
||||
{
|
||||
if (FindPlayerVehicle() != nil) {
|
||||
FindPlayerVehicle()->m_nPacManPickupsCarried = 0;
|
||||
FindPlayerVehicle()->m_fMass /= FindPlayerVehicle()->m_fForceMultiplier;
|
||||
FindPlayerVehicle()->m_fTurnMass /= FindPlayerVehicle()->m_fForceMultiplier;
|
||||
FindPlayerVehicle()->m_fForceMultiplier = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x430220, CPickups::Init, PATCH_JUMP);
|
||||
InjectHook(0x4303D0, CPickups::Update, PATCH_JUMP);
|
||||
@ -1046,4 +1432,21 @@ STARTPATCHES
|
||||
InjectHook(0x433E40, CPickups::Save, PATCH_JUMP);
|
||||
InjectHook(0x433BA0, &CPickup::GiveUsAPickUpObject, PATCH_JUMP);
|
||||
InjectHook(0x430860, &CPickup::Update, PATCH_JUMP);
|
||||
InjectHook(0x4331B0, &CPacManPickup::Update, PATCH_JUMP);
|
||||
InjectHook(0x432760, CPacManPickups::Init, PATCH_JUMP);
|
||||
InjectHook(0x432800, CPacManPickups::Update, PATCH_JUMP);
|
||||
InjectHook(0x432AE0, CPacManPickups::GeneratePMPickUps, PATCH_JUMP);
|
||||
InjectHook(0x432D50, CPacManPickups::GeneratePMPickUpsForRace, PATCH_JUMP);
|
||||
InjectHook(0x432F20, CPacManPickups::GenerateOnePMPickUp, PATCH_JUMP);
|
||||
InjectHook(0x432F60, CPacManPickups::Render, PATCH_JUMP);
|
||||
InjectHook(0x433150, CPacManPickups::ClearPMPickUps, PATCH_JUMP);
|
||||
InjectHook(0x433340, CPacManPickups::StartPacManRace, PATCH_JUMP);
|
||||
InjectHook(0x433360, CPacManPickups::StartPacManRecord, PATCH_JUMP);
|
||||
InjectHook(0x4333A0, CPacManPickups::QueryPowerPillsEatenInRace, PATCH_JUMP);
|
||||
InjectHook(0x4333B0, CPacManPickups::ResetPowerPillsEatenInRace, PATCH_JUMP);
|
||||
InjectHook(0x4333C0, CPacManPickups::CleanUpPacManStuff, PATCH_JUMP);
|
||||
InjectHook(0x4333D0, CPacManPickups::StartPacManScramble, PATCH_JUMP);
|
||||
InjectHook(0x4333F0, CPacManPickups::QueryPowerPillsCarriedByPlayer, PATCH_JUMP);
|
||||
InjectHook(0x433410, CPacManPickups::ResetPowerPillsCarriedByPlayer, PATCH_JUMP);
|
||||
|
||||
ENDPATCHES
|
||||
|
@ -102,8 +102,31 @@ extern uint16 AmmoForWeapon[20];
|
||||
extern uint16 AmmoForWeapon_OnStreet[20];
|
||||
extern uint16 CostOfWeapon[20];
|
||||
|
||||
enum ePacmanPickupType
|
||||
{
|
||||
PACMAN_NONE,
|
||||
PACMAN_SCRAMBLE,
|
||||
PACMAN_RACE,
|
||||
};
|
||||
|
||||
class CPacManPickup
|
||||
{
|
||||
public:
|
||||
CVector m_vecPosn;
|
||||
CObject *m_pObject;
|
||||
uint8 m_eType;
|
||||
|
||||
void Update();
|
||||
};
|
||||
|
||||
class CPacManPickups
|
||||
{
|
||||
friend CPacManPickup;
|
||||
|
||||
static CPacManPickup aPMPickUps[NUMPACMANPICKUPS];
|
||||
static CVector LastPickUpCoors;
|
||||
static int PillsEatenInRace;
|
||||
static bool bPMActive;
|
||||
public:
|
||||
static void Init(void);
|
||||
static void Update(void);
|
||||
@ -111,11 +134,11 @@ public:
|
||||
static void GeneratePMPickUpsForRace(int32);
|
||||
static void GenerateOnePMPickUp(CVector);
|
||||
static void Render(void);
|
||||
static void DoCleanUpPacManStuff(void);
|
||||
static void StartPacManRace(int32);
|
||||
static void StartPacManRecord(void);
|
||||
static uint32 QueryPowerPillsEatenInRace(void);
|
||||
static void ResetPowerPillsEatenInRace(void);
|
||||
static void ClearPMPickUps(void);
|
||||
static void CleanUpPacManStuff(void);
|
||||
static void StartPacManScramble(CVector, float, int16);
|
||||
static uint32 QueryPowerPillsCarriedByPlayer(void);
|
||||
|
@ -2,18 +2,522 @@
|
||||
#include "patcher.h"
|
||||
#include "Record.h"
|
||||
|
||||
#include "FileMgr.h"
|
||||
#include "Pad.h"
|
||||
#include "Pools.h"
|
||||
#include "Streaming.h"
|
||||
#include "Timer.h"
|
||||
#include "VehicleModelInfo.h"
|
||||
#include "World.h"
|
||||
|
||||
uint16 &CRecordDataForGame::RecordingState = *(uint16*)0x95CC24;
|
||||
uint8*& CRecordDataForGame::pDataBuffer = *(uint8**)0x8F1B70;
|
||||
uint8*& CRecordDataForGame::pDataBufferPointer = *(uint8**)0x8F1AB0;
|
||||
int& CRecordDataForGame::FId = *(int*)0x885BA4;
|
||||
tGameBuffer& CRecordDataForGame::pDataBufferForFrame = *(tGameBuffer*)0x72CED0;
|
||||
|
||||
uint8 &CRecordDataForChase::Status = *(uint8*)0x95CDCE;
|
||||
#define MEMORY_FOR_GAME_RECORD (150000)
|
||||
|
||||
WRAPPER void CRecordDataForGame::SaveOrRetrieveDataForThisFrame(void) { EAXJMP(0x4341F0); }
|
||||
WRAPPER void CRecordDataForGame::Init(void) { EAXJMP(0x4340F0); }
|
||||
void CRecordDataForGame::Init(void)
|
||||
{
|
||||
RecordingState = STATE_NONE;
|
||||
delete[] pDataBuffer;
|
||||
pDataBufferPointer = nil;
|
||||
pDataBuffer = nil;
|
||||
#ifndef GTA_PS2 // this stuff is not present on PS2
|
||||
FId = CFileMgr::OpenFile("playback.dat", "r");
|
||||
if (FId <= 0) {
|
||||
if ((FId = CFileMgr::OpenFile("record.dat", "r")) <= 0)
|
||||
RecordingState = STATE_NONE;
|
||||
else {
|
||||
CFileMgr::CloseFile(FId);
|
||||
FId = CFileMgr::OpenFileForWriting("record.dat");
|
||||
RecordingState = STATE_RECORD;
|
||||
}
|
||||
}
|
||||
else {
|
||||
RecordingState = STATE_PLAYBACK;
|
||||
}
|
||||
if (RecordingState == STATE_PLAYBACK) {
|
||||
pDataBufferPointer = new uint8[MEMORY_FOR_GAME_RECORD];
|
||||
pDataBuffer = pDataBufferPointer;
|
||||
pDataBuffer[CFileMgr::Read(FId, (char*)pDataBufferPointer, MEMORY_FOR_GAME_RECORD) + 8] = (uint8)-1;
|
||||
CFileMgr::CloseFile(FId);
|
||||
}
|
||||
#else
|
||||
RecordingState = STATE_NONE; // second time to make sure
|
||||
#endif
|
||||
}
|
||||
|
||||
void CRecordDataForGame::SaveOrRetrieveDataForThisFrame(void)
|
||||
{
|
||||
switch (RecordingState) {
|
||||
case STATE_RECORD:
|
||||
{
|
||||
pDataBufferForFrame.m_fTimeStep = CTimer::GetTimeStep();
|
||||
pDataBufferForFrame.m_nTimeInMilliseconds = CTimer::GetTimeInMilliseconds();
|
||||
pDataBufferForFrame.m_nSizeOfPads[0] = 0;
|
||||
pDataBufferForFrame.m_nSizeOfPads[1] = 0;
|
||||
pDataBufferForFrame.m_nChecksum = CalcGameChecksum();
|
||||
uint8* pController1 = PackCurrentPadValues(pDataBufferForFrame.m_ControllerBuffer, &CPad::GetPad(0)->OldState, &CPad::GetPad(0)->NewState);
|
||||
pDataBufferForFrame.m_nSizeOfPads[0] = (pController1 - pDataBufferForFrame.m_ControllerBuffer) / 2;
|
||||
uint8* pController2 = PackCurrentPadValues(pController1, &CPad::GetPad(1)->OldState, &CPad::GetPad(1)->NewState);
|
||||
pDataBufferForFrame.m_nSizeOfPads[1] = (pController2 - pController1) / 2;
|
||||
uint8* pEndPtr = pController2;
|
||||
if ((pDataBufferForFrame.m_nSizeOfPads[0] + pDataBufferForFrame.m_nSizeOfPads[1]) & 1)
|
||||
pEndPtr += 2;
|
||||
CFileMgr::Write(FId, (char*)&pDataBufferForFrame, pEndPtr - (uint8*)&pDataBufferForFrame);
|
||||
break;
|
||||
}
|
||||
case STATE_PLAYBACK:
|
||||
if (pDataBufferPointer[8] == (uint8)-1)
|
||||
CPad::GetPad(0)->NewState.Clear();
|
||||
else {
|
||||
tGameBuffer* pData = (tGameBuffer*)pDataBufferPointer;
|
||||
CTimer::SetTimeInMilliseconds(pData->m_nTimeInMilliseconds);
|
||||
CTimer::SetTimeStep(pData->m_fTimeStep);
|
||||
uint8 size1 = pData->m_nSizeOfPads[0];
|
||||
uint8 size2 = pData->m_nSizeOfPads[1];
|
||||
pDataBufferPointer = (uint8*)&pData->m_ControllerBuffer;
|
||||
pDataBufferPointer = UnPackCurrentPadValues(pDataBufferPointer, size1, &CPad::GetPad(0)->NewState);
|
||||
pDataBufferPointer = UnPackCurrentPadValues(pDataBufferPointer, size2, &CPad::GetPad(1)->NewState);
|
||||
if ((size1 + size2) & 1)
|
||||
pDataBufferPointer += 2;
|
||||
if (pData->m_nChecksum != CalcGameChecksum())
|
||||
printf("Playback out of sync\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define PROCESS_BUTTON_STATE_STORE(buf, os, ns, field, id) \
|
||||
do { \
|
||||
if (os->field != ns->field){ \
|
||||
*buf++ = id; \
|
||||
*buf++ = ns->field; \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
uint8* CRecordDataForGame::PackCurrentPadValues(uint8* buf, CControllerState* os, CControllerState* ns)
|
||||
{
|
||||
PROCESS_BUTTON_STATE_STORE(buf, os, ns, LeftStickX, 0);
|
||||
PROCESS_BUTTON_STATE_STORE(buf, os, ns, LeftStickY, 1);
|
||||
PROCESS_BUTTON_STATE_STORE(buf, os, ns, RightStickX, 2);
|
||||
PROCESS_BUTTON_STATE_STORE(buf, os, ns, RightStickY, 3);
|
||||
PROCESS_BUTTON_STATE_STORE(buf, os, ns, LeftShoulder1, 4);
|
||||
PROCESS_BUTTON_STATE_STORE(buf, os, ns, LeftShoulder2, 5);
|
||||
PROCESS_BUTTON_STATE_STORE(buf, os, ns, RightShoulder1, 6);
|
||||
PROCESS_BUTTON_STATE_STORE(buf, os, ns, RightShoulder2, 7);
|
||||
PROCESS_BUTTON_STATE_STORE(buf, os, ns, DPadUp, 8);
|
||||
PROCESS_BUTTON_STATE_STORE(buf, os, ns, DPadDown, 9);
|
||||
PROCESS_BUTTON_STATE_STORE(buf, os, ns, DPadLeft, 10);
|
||||
PROCESS_BUTTON_STATE_STORE(buf, os, ns, DPadRight, 11);
|
||||
PROCESS_BUTTON_STATE_STORE(buf, os, ns, Start, 12);
|
||||
PROCESS_BUTTON_STATE_STORE(buf, os, ns, Select, 13);
|
||||
PROCESS_BUTTON_STATE_STORE(buf, os, ns, Square, 14);
|
||||
PROCESS_BUTTON_STATE_STORE(buf, os, ns, Triangle, 15);
|
||||
PROCESS_BUTTON_STATE_STORE(buf, os, ns, Cross, 16);
|
||||
PROCESS_BUTTON_STATE_STORE(buf, os, ns, Circle, 17);
|
||||
PROCESS_BUTTON_STATE_STORE(buf, os, ns, LeftShock, 18);
|
||||
PROCESS_BUTTON_STATE_STORE(buf, os, ns, RightShock, 19);
|
||||
return buf;
|
||||
}
|
||||
#undef PROCESS_BUTTON_STATE_STORE
|
||||
|
||||
#define PROCESS_BUTTON_STATE_RESTORE(buf, state, field, id) case id: state->field = *buf++; break;
|
||||
|
||||
uint8* CRecordDataForGame::UnPackCurrentPadValues(uint8* buf, uint8 total, CControllerState* state)
|
||||
{
|
||||
for (uint8 i = 0; i < total; i++) {
|
||||
switch (*buf++) {
|
||||
PROCESS_BUTTON_STATE_RESTORE(buf, state, LeftStickX, 0);
|
||||
PROCESS_BUTTON_STATE_RESTORE(buf, state, LeftStickY, 1);
|
||||
PROCESS_BUTTON_STATE_RESTORE(buf, state, RightStickX, 2);
|
||||
PROCESS_BUTTON_STATE_RESTORE(buf, state, RightStickY, 3);
|
||||
PROCESS_BUTTON_STATE_RESTORE(buf, state, LeftShoulder1, 4);
|
||||
PROCESS_BUTTON_STATE_RESTORE(buf, state, LeftShoulder2, 5);
|
||||
PROCESS_BUTTON_STATE_RESTORE(buf, state, RightShoulder1, 6);
|
||||
PROCESS_BUTTON_STATE_RESTORE(buf, state, RightShoulder2, 7);
|
||||
PROCESS_BUTTON_STATE_RESTORE(buf, state, DPadUp, 8);
|
||||
PROCESS_BUTTON_STATE_RESTORE(buf, state, DPadDown, 9);
|
||||
PROCESS_BUTTON_STATE_RESTORE(buf, state, DPadLeft, 10);
|
||||
PROCESS_BUTTON_STATE_RESTORE(buf, state, DPadRight, 11);
|
||||
PROCESS_BUTTON_STATE_RESTORE(buf, state, Start, 12);
|
||||
PROCESS_BUTTON_STATE_RESTORE(buf, state, Select, 13);
|
||||
PROCESS_BUTTON_STATE_RESTORE(buf, state, Square, 14);
|
||||
PROCESS_BUTTON_STATE_RESTORE(buf, state, Triangle, 15);
|
||||
PROCESS_BUTTON_STATE_RESTORE(buf, state, Cross, 16);
|
||||
PROCESS_BUTTON_STATE_RESTORE(buf, state, Circle, 17);
|
||||
PROCESS_BUTTON_STATE_RESTORE(buf, state, LeftShock, 18);
|
||||
PROCESS_BUTTON_STATE_RESTORE(buf, state, RightShock, 19);
|
||||
}
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
#undef PROCESS_BUTTON_STATE_RESTORE
|
||||
|
||||
uint16 CRecordDataForGame::CalcGameChecksum(void)
|
||||
{
|
||||
uint32 checksum = 0;
|
||||
int i = CPools::GetPedPool()->GetSize();
|
||||
while (i--) {
|
||||
CPed* pPed = CPools::GetPedPool()->GetSlot(i);
|
||||
if (!pPed)
|
||||
continue;
|
||||
checksum ^= pPed->GetModelIndex() ^ *(uint32*)&pPed->GetPosition().z ^ *(uint32*)&pPed->GetPosition().y ^ *(uint32*)&pPed->GetPosition().x;
|
||||
}
|
||||
i = CPools::GetVehiclePool()->GetSize();
|
||||
while (i--) {
|
||||
CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i);
|
||||
if (!pVehicle)
|
||||
continue;
|
||||
checksum ^= pVehicle->GetModelIndex() ^ *(uint32*)&pVehicle->GetPosition().z ^ *(uint32*)&pVehicle->GetPosition().y ^ *(uint32*)&pVehicle->GetPosition().x;
|
||||
}
|
||||
return checksum ^ checksum >> 16;
|
||||
}
|
||||
|
||||
uint8& CRecordDataForChase::Status = *(uint8*)0x95CDCE;
|
||||
int& CRecordDataForChase::PositionChanges = *(int*)0x8F59C8;
|
||||
uint8& CRecordDataForChase::CurrentCar = *(uint8*)0x95CDC9;
|
||||
CAutomobile* (&CRecordDataForChase::pChaseCars)[NUM_CHASE_CARS] = *(CAutomobile * (*)[NUM_CHASE_CARS])*(uintptr*)0x6F46A8;
|
||||
uint32& CRecordDataForChase::AnimStartTime = *(uint32*)0x8F1AEC;
|
||||
float& CRecordDataForChase::AnimTime = *(float*)0x880F88;
|
||||
CCarStateEachFrame* (&CRecordDataForChase::pBaseMemForCar)[NUM_CHASE_CARS] = *(CCarStateEachFrame * (*)[NUM_CHASE_CARS])*(uintptr*)0x70EA18;
|
||||
float& CRecordDataForChase::TimeMultiplier = *(float*)0x8E2A94;
|
||||
int& CRecordDataForChase::FId2 = *(int*)0x8E2C18;
|
||||
|
||||
#define CHASE_SCENE_LENGTH_IN_SECONDS (80)
|
||||
#define CHASE_SCENE_FRAMES_PER_SECOND (15) // skipping every second frame
|
||||
#define CHASE_SCENE_FRAMES_IN_RECORDING (CHASE_SCENE_LENGTH_IN_SECONDS * CHASE_SCENE_FRAMES_PER_SECOND)
|
||||
#define CHASE_SCENE_LENGTH_IN_FRAMES (CHASE_SCENE_FRAMES_IN_RECORDING * 2)
|
||||
|
||||
void CRecordDataForChase::Init(void)
|
||||
{
|
||||
Status = STATE_NONE;
|
||||
PositionChanges = 0;
|
||||
CurrentCar = 0;
|
||||
for (int i = 0; i < NUM_CHASE_CARS; i++)
|
||||
pChaseCars[i] = nil;
|
||||
AnimStartTime = 0;
|
||||
}
|
||||
|
||||
void CRecordDataForChase::SaveOrRetrieveDataForThisFrame(void)
|
||||
{
|
||||
switch (Status) {
|
||||
case STATE_NONE:
|
||||
return;
|
||||
case STATE_RECORD:
|
||||
{
|
||||
if ((CTimer::GetFrameCounter() & 1) == 0)
|
||||
StoreInfoForCar(pChaseCars[CurrentCar], &pBaseMemForCar[CurrentCar][CTimer::GetFrameCounter() / 2]);
|
||||
if (CTimer::GetFrameCounter() < CHASE_SCENE_LENGTH_IN_FRAMES * 2)
|
||||
return;
|
||||
CFileMgr::SetDir("data\\paths");
|
||||
sprintf(gString, "chase%d.dat", CurrentCar);
|
||||
int fid = CFileMgr::OpenFileForWriting(gString);
|
||||
uint32 fs = CHASE_SCENE_LENGTH_IN_FRAMES * sizeof(CCarStateEachFrame);
|
||||
printf("FileSize:%d\n", fs);
|
||||
CFileMgr::Write(fid, (char*)pBaseMemForCar[CurrentCar], fs);
|
||||
CFileMgr::CloseFile(fid);
|
||||
CFileMgr::SetDir("");
|
||||
sprintf(gString, "car%d.max", CurrentCar);
|
||||
int fid2 = CFileMgr::OpenFileForWriting(gString);
|
||||
for (int i = 0; i < CHASE_SCENE_FRAMES_IN_RECORDING; i++) {
|
||||
// WTF? Was it ever used?
|
||||
#ifdef FIX_BUGS
|
||||
CCarStateEachFrame* pState = pBaseMemForCar[CurrentCar];
|
||||
#else
|
||||
CCarStateEachFrame* pState = (CCarStateEachFrame*)pChaseCars[CurrentCar];
|
||||
#endif
|
||||
CVector right = CVector(pState->rightX, pState->rightY, pState->rightZ) / INT8_MAX;
|
||||
CVector forward = CVector(pState->forwardX, pState->forwardY, pState->forwardZ) / INT8_MAX;
|
||||
CVector up = CrossProduct(right, forward);
|
||||
sprintf(gString, "%f %f %f\n", pState->pos.x, pState->pos.y, pState->pos.z);
|
||||
CFileMgr::Write(fid2, gString, strlen(gString) - 1);
|
||||
sprintf(gString, "%f %f %f\n", right.x, right.y, right.z);
|
||||
CFileMgr::Write(fid2, gString, strlen(gString) - 1);
|
||||
sprintf(gString, "%f %f %f\n", forward.x, forward.y, forward.z);
|
||||
CFileMgr::Write(fid2, gString, strlen(gString) - 1);
|
||||
sprintf(gString, "%f %f %f\n", up.x, up.y, up.z);
|
||||
CFileMgr::Write(fid2, gString, strlen(gString) - 1);
|
||||
}
|
||||
CFileMgr::CloseFile(fid2);
|
||||
}
|
||||
case STATE_PLAYBACK:
|
||||
case STATE_PLAYBACK_BEFORE_RECORDING:
|
||||
case STATE_PLAYBACK_INIT:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
struct tCoors {
|
||||
CVector pos;
|
||||
float angle;
|
||||
};
|
||||
|
||||
// I guess developer was filling this with actual data before running the game
|
||||
tCoors NewCoorsForRecordedCars[7];
|
||||
|
||||
void CRecordDataForChase::SaveOrRetrieveCarPositions(void)
|
||||
{
|
||||
switch (Status) {
|
||||
case STATE_NONE:
|
||||
return;
|
||||
case STATE_RECORD:
|
||||
case STATE_PLAYBACK_BEFORE_RECORDING:
|
||||
for (int i = 0; i < NUM_CHASE_CARS; i++) {
|
||||
if (i != CurrentCar && CTimer::GetFrameCounter()) {
|
||||
RestoreInfoForCar(pChaseCars[i], &pBaseMemForCar[i][CTimer::GetFrameCounter() / 2], false);
|
||||
pChaseCars[i]->GetMatrix().UpdateRW();
|
||||
pChaseCars[i]->UpdateRwFrame();
|
||||
}
|
||||
}
|
||||
if (Status == STATE_PLAYBACK_BEFORE_RECORDING && CTimer::GetFrameCounter()) {
|
||||
RestoreInfoForCar(pChaseCars[CurrentCar], &pBaseMemForCar[CurrentCar][CTimer::GetFrameCounter() / 2], false);
|
||||
pChaseCars[CurrentCar]->GetMatrix().UpdateRW();
|
||||
pChaseCars[CurrentCar]->UpdateRwFrame();
|
||||
}
|
||||
if (CPad::GetPad(0)->GetLeftShockJustDown() && CPad::GetPad(0)->GetRightShockJustDown()) {
|
||||
if (!CPad::GetPad(0)->GetRightShockJustDown()) {
|
||||
pChaseCars[CurrentCar]->GetPosition() = NewCoorsForRecordedCars[PositionChanges].pos;
|
||||
pChaseCars[CurrentCar]->SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
||||
pChaseCars[CurrentCar]->GetMatrix().SetRotateZOnly(DEGTORAD(NewCoorsForRecordedCars[PositionChanges].angle));
|
||||
++PositionChanges;
|
||||
}
|
||||
if (Status == STATE_PLAYBACK_BEFORE_RECORDING) {
|
||||
Status = STATE_RECORD;
|
||||
pChaseCars[CurrentCar]->m_status = STATUS_PLAYER;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case STATE_PLAYBACK_INIT:
|
||||
Status = STATE_PLAYBACK;
|
||||
break;
|
||||
case STATE_PLAYBACK:
|
||||
{
|
||||
TimeMultiplier += CTimer::GetTimeStepNonClippedInSeconds();
|
||||
float EndOfFrameTime = CHASE_SCENE_FRAMES_PER_SECOND * min(CHASE_SCENE_LENGTH_IN_SECONDS, TimeMultiplier);
|
||||
for (int i = 0; i < NUM_CHASE_CARS; i++) {
|
||||
if (!pBaseMemForCar[i])
|
||||
continue;
|
||||
if (!pChaseCars[i])
|
||||
continue;
|
||||
if (EndOfFrameTime < CHASE_SCENE_FRAMES_IN_RECORDING - 1) {
|
||||
int FlooredEOFTime = EndOfFrameTime;
|
||||
RestoreInfoForCar(pChaseCars[i], &pBaseMemForCar[i][FlooredEOFTime], false);
|
||||
CMatrix tmp;
|
||||
float dp = EndOfFrameTime - FlooredEOFTime;
|
||||
RestoreInfoForMatrix(tmp, &pBaseMemForCar[i][FlooredEOFTime + 1]);
|
||||
pChaseCars[i]->GetRight() += (tmp.GetRight() - pChaseCars[i]->GetRight()) * dp;
|
||||
pChaseCars[i]->GetForward() += (tmp.GetForward() - pChaseCars[i]->GetForward()) * dp;
|
||||
pChaseCars[i]->GetUp() += (tmp.GetUp() - pChaseCars[i]->GetUp()) * dp;
|
||||
pChaseCars[i]->GetPosition() += (tmp.GetPosition() - pChaseCars[i]->GetPosition()) * dp;
|
||||
}
|
||||
else{
|
||||
RestoreInfoForCar(pChaseCars[i], &pBaseMemForCar[i][CHASE_SCENE_FRAMES_IN_RECORDING - 1], true);
|
||||
if (i == 0)
|
||||
pChaseCars[i]->GetPosition().z += 0.2f;
|
||||
}
|
||||
pChaseCars[i]->GetMatrix().UpdateRW();
|
||||
pChaseCars[i]->UpdateRwFrame();
|
||||
pChaseCars[i]->RemoveAndAdd();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CRecordDataForChase::StoreInfoForCar(CAutomobile* pCar, CCarStateEachFrame* pState)
|
||||
{
|
||||
pState->rightX = INT8_MAX * pCar->GetRight().x;
|
||||
pState->rightY = INT8_MAX * pCar->GetRight().y;
|
||||
pState->rightZ = INT8_MAX * pCar->GetRight().z;
|
||||
pState->forwardX = INT8_MAX * pCar->GetForward().x;
|
||||
pState->forwardY = INT8_MAX * pCar->GetForward().y;
|
||||
pState->forwardZ = INT8_MAX * pCar->GetForward().z;
|
||||
pState->pos = pCar->GetPosition();
|
||||
pState->velX = 0.5f * INT16_MAX * pCar->GetMoveSpeed().x;
|
||||
pState->velY = 0.5f * INT16_MAX * pCar->GetMoveSpeed().y;
|
||||
pState->velZ = 0.5f * INT16_MAX * pCar->GetMoveSpeed().z;
|
||||
pState->wheel = 20 * pCar->m_fSteerAngle;
|
||||
pState->gas = 100 * pCar->m_fGasPedal;
|
||||
pState->brake = 100 * pCar->m_fBrakePedal;
|
||||
pState->handbrake = pCar->bIsHandbrakeOn;
|
||||
}
|
||||
|
||||
void CRecordDataForChase::RestoreInfoForMatrix(CMatrix& matrix, CCarStateEachFrame* pState)
|
||||
{
|
||||
matrix.GetRight() = CVector(pState->rightX, pState->rightY, pState->rightZ) / INT8_MAX;
|
||||
matrix.GetForward() = CVector(pState->forwardX, pState->forwardY, pState->forwardZ) / INT8_MAX;
|
||||
matrix.GetUp() = CrossProduct(matrix.GetRight(), matrix.GetForward());
|
||||
matrix.GetPosition() = pState->pos;
|
||||
}
|
||||
|
||||
void CRecordDataForChase::RestoreInfoForCar(CAutomobile* pCar, CCarStateEachFrame* pState, bool stop)
|
||||
{
|
||||
CVector oldPos = pCar->GetPosition();
|
||||
RestoreInfoForMatrix(pCar->GetMatrix(), pState);
|
||||
pCar->SetMoveSpeed(CVector(pState->velX, pState->velY, pState->velZ) / INT16_MAX / 0.5f);
|
||||
pCar->SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
||||
pCar->m_fSteerAngle = pState->wheel / 20.0f;
|
||||
pCar->m_fGasPedal = pState->gas / 100.0f;
|
||||
pCar->m_fBrakePedal = pState->brake / 100.0f;
|
||||
pCar->bIsHandbrakeOn = pState->handbrake;
|
||||
if ((oldPos - pCar->GetPosition()).Magnitude() > 15.0f) {
|
||||
if (pCar == pChaseCars[14]) {
|
||||
pCar->m_currentColour1 = 58;
|
||||
pCar->m_currentColour2 = 1;
|
||||
}
|
||||
else
|
||||
pCar->GetModelInfo()->ChooseVehicleColour(pCar->m_currentColour1, pCar->m_currentColour2);
|
||||
}
|
||||
pCar->m_fHealth = min(pCar->m_fHealth, 500.0f);
|
||||
if (stop) {
|
||||
pCar->m_fGasPedal = 0.0f;
|
||||
pCar->m_fBrakePedal = 0.0f;
|
||||
pCar->SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
||||
pCar->bIsHandbrakeOn = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CRecordDataForChase::ProcessControlCars(void)
|
||||
{
|
||||
if (Status != STATE_PLAYBACK)
|
||||
return;
|
||||
for (int i = 0; i < NUM_CHASE_CARS; i++) {
|
||||
if (pChaseCars[i])
|
||||
pChaseCars[i]->ProcessControl();
|
||||
}
|
||||
}
|
||||
|
||||
#if (defined(GTA_PS2) || defined(FIX_BUGS))
|
||||
bool CRecordDataForChase::ShouldThisPadBeLeftAlone(uint8 pad)
|
||||
{
|
||||
// may be wrong
|
||||
if (Status == STATE_NONE || Status == STATE_PLAYBACK)
|
||||
return false;
|
||||
return pad != 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void CRecordDataForChase::GiveUsACar(int32 mi, CVector pos, float angle, CAutomobile** ppCar, uint8 colour1, uint8 colour2)
|
||||
{
|
||||
CStreaming::RequestModel(mi, STREAMFLAGS_DEPENDENCY);
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
if (!CStreaming::HasModelLoaded(mi))
|
||||
return;
|
||||
CAutomobile* pCar = new CAutomobile(mi, MISSION_VEHICLE);
|
||||
pCar->GetPosition() = pos;
|
||||
pCar->m_status = STATUS_PLAYER_PLAYBACKFROMBUFFER;
|
||||
pCar->GetMatrix().SetRotateZOnly(DEGTORAD(angle));
|
||||
pCar->pDriver = nil;
|
||||
pCar->m_currentColour1 = colour1;
|
||||
pCar->m_currentColour2 = colour2;
|
||||
CWorld::Add(pCar);
|
||||
*ppCar = pCar;
|
||||
}
|
||||
|
||||
void RemoveUnusedCollision(void)
|
||||
{
|
||||
static const char* dontDeleteArray[] = {
|
||||
"rd_SrRoad2A50", "rd_SrRoad2A20", "rd_CrossRda1w22", "rd_CrossRda1rw22",
|
||||
"road_broadway02", "road_broadway01", "com_21way5", "com_21way50",
|
||||
"cm1waycrosscom", "com_21way20", "com_21way10", "road_broadway04",
|
||||
"com_rvroads52", "com_roadsrv", "com_roadkb23", "com_roadkb22"
|
||||
};
|
||||
for (int i = 0; i < ARRAY_SIZE(dontDeleteArray); i++)
|
||||
CModelInfo::GetModelInfo(dontDeleteArray[i], nil)->GetColModel()->level = LEVEL_NONE;
|
||||
CModelInfo::RemoveColModelsFromOtherLevels(LEVEL_NONE);
|
||||
for (int i = 0; i < ARRAY_SIZE(dontDeleteArray); i++)
|
||||
CModelInfo::GetModelInfo(dontDeleteArray[i], nil)->GetColModel()->level = LEVEL_COMMERCIAL;
|
||||
}
|
||||
|
||||
void CRecordDataForChase::StartChaseScene(float startTime)
|
||||
{
|
||||
char filename[28];
|
||||
SetUpCarsForChaseScene();
|
||||
Status = STATE_PLAYBACK;
|
||||
AnimTime = startTime;
|
||||
AnimStartTime = CTimer::GetTimeInMilliseconds();
|
||||
RemoveUnusedCollision();
|
||||
CStreaming::RemoveIslandsNotUsed(LEVEL_SUBURBAN);
|
||||
CGame::TidyUpMemory(true, true);
|
||||
CStreaming::ImGonnaUseStreamingMemory();
|
||||
CFileMgr::SetDir("data\\paths");
|
||||
for (int i = 0; i < NUM_CHASE_CARS; i++) {
|
||||
if (!pChaseCars[i]) {
|
||||
pBaseMemForCar[i] = nil;
|
||||
continue;
|
||||
}
|
||||
sprintf(filename, "chase%d.dat", i);
|
||||
FId2 = CFileMgr::OpenFile(filename, "rb");
|
||||
if (FId2 <= 0) {
|
||||
pBaseMemForCar[i] = nil;
|
||||
continue;
|
||||
}
|
||||
pBaseMemForCar[i] = new CCarStateEachFrame[CHASE_SCENE_FRAMES_IN_RECORDING];
|
||||
for (int j = 0; j < CHASE_SCENE_FRAMES_IN_RECORDING; j++) {
|
||||
CFileMgr::Read(FId2, (char*)&pBaseMemForCar[i][j], sizeof(CCarStateEachFrame));
|
||||
CFileMgr::Seek(FId2, sizeof(CCarStateEachFrame), 1);
|
||||
}
|
||||
CFileMgr::CloseFile(FId2);
|
||||
}
|
||||
CFileMgr::SetDir("");
|
||||
CStreaming::IHaveUsedStreamingMemory();
|
||||
TimeMultiplier = 0.0f;
|
||||
}
|
||||
|
||||
void CRecordDataForChase::CleanUpChaseScene(void)
|
||||
{
|
||||
if (Status != STATE_PLAYBACK_INIT && Status != STATE_PLAYBACK)
|
||||
return;
|
||||
Status = STATE_NONE;
|
||||
CleanUpCarsForChaseScene();
|
||||
for (int i = 0; i < NUM_CHASE_CARS; i++) {
|
||||
if (pBaseMemForCar[i]) {
|
||||
delete[] pBaseMemForCar[i];
|
||||
pBaseMemForCar[i] = nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CRecordDataForChase::SetUpCarsForChaseScene(void)
|
||||
{
|
||||
GiveUsACar(MI_POLICE, CVector(273.54221f, -1167.1907f, 24.880601f), 63.0f, &pChaseCars[0], 2, 1);
|
||||
GiveUsACar(MI_ENFORCER, CVector(231.1783f, -1388.8322f, 25.978201f), 90.0f, &pChaseCars[1], 2, 1);
|
||||
GiveUsACar(MI_TAXI, CVector(184.3156f, -1473.251f, 25.978201f), 0.0f, &pChaseCars[4], 6, 6);
|
||||
GiveUsACar(MI_CHEETAH, CVector(173.8868f, -1377.6514f, 25.978201f), 0.0f, &pChaseCars[6], 4, 5);
|
||||
GiveUsACar(MI_STINGER, CVector(102.5946f, -943.93628f, 25.9781f), 270.0f, &pChaseCars[7], 53, 53);
|
||||
GiveUsACar(MI_CHEETAH, CVector(-177.7157f, -862.18652f, 25.978201f), 155.0f, &pChaseCars[10], 41, 1);
|
||||
GiveUsACar(MI_STINGER, CVector(-170.56979f, -889.02362f, 25.978201f), 154.0f, &pChaseCars[11], 10, 10);
|
||||
GiveUsACar(MI_KURUMA, CVector(402.60809f, -917.49628f, 37.381001f), 90.0f, &pChaseCars[14], 34, 1);
|
||||
GiveUsACar(MI_TAXI, CVector(-33.496201f, -938.4563f, 25.9781f), 266.0f, &pChaseCars[16], 6, 6);
|
||||
GiveUsACar(MI_KURUMA, CVector(49.363098f, -987.60498f, 25.9781f), 0.0f, &pChaseCars[18], 51, 1);
|
||||
GiveUsACar(MI_TAXI, CVector(179.0049f, -1154.6686f, 25.9781f), 0.0f, &pChaseCars[19], 6, 76);
|
||||
GiveUsACar(MI_RUMPO, CVector(-28.9762f, -1031.3367f, 25.990601f), 242.0f, &pChaseCars[2], 1, 75);
|
||||
GiveUsACar(MI_PATRIOT, CVector(114.1564f, -796.69379f, 24.978201f), 180.0f, &pChaseCars[3], 0, 0);
|
||||
}
|
||||
|
||||
void CRecordDataForChase::CleanUpCarsForChaseScene(void)
|
||||
{
|
||||
for (int i = 0; i < NUM_CHASE_CARS; i++)
|
||||
RemoveCarFromChase(i);
|
||||
}
|
||||
|
||||
void CRecordDataForChase::RemoveCarFromChase(int32 i)
|
||||
{
|
||||
if (!pChaseCars[i])
|
||||
return;
|
||||
CWorld::Remove(pChaseCars[i]);
|
||||
delete pChaseCars[i];
|
||||
pChaseCars[i] = nil;
|
||||
}
|
||||
|
||||
CVehicle* CRecordDataForChase::TurnChaseCarIntoScriptCar(int32 i)
|
||||
{
|
||||
CVehicle* pVehicle = pChaseCars[i];
|
||||
pChaseCars[i] = nil;
|
||||
pVehicle->m_status = STATUS_PHYSICS;
|
||||
return pVehicle;
|
||||
}
|
||||
|
||||
WRAPPER void CRecordDataForChase::SaveOrRetrieveDataForThisFrame(void) { EAXJMP(0x4347F0); }
|
||||
WRAPPER void CRecordDataForChase::ProcessControlCars(void) { EAXJMP(0x435540); }
|
||||
WRAPPER void CRecordDataForChase::SaveOrRetrieveCarPositions(void) { EAXJMP(0x434B20); }
|
||||
WRAPPER void CRecordDataForChase::StartChaseScene(float) { EAXJMP(0x435690); }
|
||||
WRAPPER void CRecordDataForChase::CleanUpChaseScene() { EAXJMP(0x4357C0); }
|
||||
WRAPPER void CRecordDataForChase::RemoveCarFromChase(int32) { EAXJMP(0x435BC0); }
|
||||
WRAPPER CVehicle* CRecordDataForChase::TurnChaseCarIntoScriptCar(int32) { EAXJMP(0x435C00); }
|
||||
WRAPPER void CRecordDataForChase::Init(void) { EAXJMP(0x434780); }
|
||||
|
@ -1,34 +1,106 @@
|
||||
#pragma once
|
||||
|
||||
class CAutomobile;
|
||||
class CVehicle;
|
||||
class CControllerState;
|
||||
|
||||
enum {
|
||||
RECORDSTATE_0,
|
||||
RECORDSTATE_1,
|
||||
RECORDSTATE_2,
|
||||
class CCarStateEachFrame
|
||||
{
|
||||
public:
|
||||
int16 velX;
|
||||
int16 velY;
|
||||
int16 velZ;
|
||||
int8 rightX;
|
||||
int8 rightY;
|
||||
int8 rightZ;
|
||||
int8 forwardX;
|
||||
int8 forwardY;
|
||||
int8 forwardZ;
|
||||
int8 wheel;
|
||||
uint8 gas;
|
||||
uint8 brake;
|
||||
bool handbrake;
|
||||
CVector pos;
|
||||
};
|
||||
|
||||
extern char* gString;
|
||||
|
||||
class CRecordDataForChase
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
NUM_CHASE_CARS = 20
|
||||
};
|
||||
enum {
|
||||
STATE_NONE = 0,
|
||||
STATE_RECORD = 1,
|
||||
STATE_PLAYBACK_INIT = 2,
|
||||
STATE_PLAYBACK = 3,
|
||||
STATE_PLAYBACK_BEFORE_RECORDING = 4
|
||||
};
|
||||
static uint8 &Status;
|
||||
static int &PositionChanges;
|
||||
static uint8 &CurrentCar;
|
||||
static CAutomobile*(&pChaseCars)[NUM_CHASE_CARS];
|
||||
static float &AnimTime;
|
||||
static uint32 &AnimStartTime;
|
||||
static CCarStateEachFrame* (&pBaseMemForCar)[NUM_CHASE_CARS];
|
||||
static float &TimeMultiplier;
|
||||
static int &FId2;
|
||||
public:
|
||||
|
||||
static bool IsRecording(void) { return Status == STATE_RECORD; }
|
||||
|
||||
static void Init(void);
|
||||
static void SaveOrRetrieveDataForThisFrame(void);
|
||||
static void ProcessControlCars(void);
|
||||
static void SaveOrRetrieveCarPositions(void);
|
||||
static void StoreInfoForCar(CAutomobile*, CCarStateEachFrame*);
|
||||
static void RestoreInfoForMatrix(CMatrix&, CCarStateEachFrame*);
|
||||
static void RestoreInfoForCar(CAutomobile*, CCarStateEachFrame*, bool);
|
||||
static void ProcessControlCars(void);
|
||||
#if (defined(GTA_PS2) || defined(FIX_BUGS))
|
||||
static bool ShouldThisPadBeLeftAlone(uint8 pad);
|
||||
#endif
|
||||
static void GiveUsACar(int32, CVector, float, CAutomobile**, uint8, uint8);
|
||||
static void StartChaseScene(float);
|
||||
static void CleanUpChaseScene();
|
||||
static void CleanUpChaseScene(void);
|
||||
static void SetUpCarsForChaseScene(void);
|
||||
static void CleanUpCarsForChaseScene(void);
|
||||
static void RemoveCarFromChase(int32);
|
||||
static CVehicle* TurnChaseCarIntoScriptCar(int32);
|
||||
static void Init(void);
|
||||
|
||||
};
|
||||
|
||||
struct tGameBuffer
|
||||
{
|
||||
float m_fTimeStep;
|
||||
uint32 m_nTimeInMilliseconds;
|
||||
uint8 m_nSizeOfPads[2];
|
||||
uint16 m_nChecksum;
|
||||
uint8 m_ControllerBuffer[116];
|
||||
};
|
||||
|
||||
class CRecordDataForGame
|
||||
{
|
||||
enum {
|
||||
STATE_NONE = 0,
|
||||
STATE_RECORD = 1,
|
||||
STATE_PLAYBACK = 2,
|
||||
};
|
||||
static uint16& RecordingState;
|
||||
static uint8* &pDataBuffer;
|
||||
static uint8* &pDataBufferPointer;
|
||||
static int &FId;
|
||||
static tGameBuffer &pDataBufferForFrame;
|
||||
|
||||
public:
|
||||
static uint16 &RecordingState;
|
||||
static bool IsRecording() { return RecordingState == STATE_RECORD; }
|
||||
static bool IsPlayingBack() { return RecordingState == STATE_PLAYBACK; }
|
||||
|
||||
static void SaveOrRetrieveDataForThisFrame(void);
|
||||
static void Init(void);
|
||||
|
||||
private:
|
||||
static uint16 CalcGameChecksum(void);
|
||||
static uint8* PackCurrentPadValues(uint8*, CControllerState*, CControllerState*);
|
||||
static uint8* UnPackCurrentPadValues(uint8*, uint8, CControllerState*);
|
||||
};
|
||||
|
@ -1107,7 +1107,7 @@ void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float ca
|
||||
CStreaming::LoadScene(ff_coord);
|
||||
}
|
||||
if (cam_mode == REPLAYCAMMODE_ASSTORED)
|
||||
TheCamera.CarZoomIndicator = 5.0f;
|
||||
TheCamera.CarZoomIndicator = CAM_ZOOM_CINEMATIC;
|
||||
}
|
||||
|
||||
void CReplay::StoreStuffInMem(void)
|
||||
@ -1129,8 +1129,8 @@ void CReplay::StoreStuffInMem(void)
|
||||
pEmptyReferences = CReferences::pEmptyList;
|
||||
pStoredCam = new uint8[sizeof(CCamera)];
|
||||
memcpy(pStoredCam, &TheCamera, sizeof(CCamera));
|
||||
pRadarBlips = new uint8[sizeof(CBlip) * NUMRADARBLIPS];
|
||||
memcpy(pRadarBlips, CRadar::ms_RadarTrace, NUMRADARBLIPS * sizeof(CBlip));
|
||||
pRadarBlips = new uint8[sizeof(sRadarTrace) * NUMRADARBLIPS];
|
||||
memcpy(pRadarBlips, CRadar::ms_RadarTrace, NUMRADARBLIPS * sizeof(sRadarTrace));
|
||||
PlayerWanted = *FindPlayerPed()->m_pWanted;
|
||||
PlayerInfo = CWorld::Players[0];
|
||||
Time1 = CTimer::GetTimeInMilliseconds();
|
||||
@ -1179,7 +1179,7 @@ void CReplay::RestoreStuffFromMem(void)
|
||||
memcpy(&TheCamera, pStoredCam, sizeof(CCamera));
|
||||
delete[] pStoredCam;
|
||||
pStoredCam = nil;
|
||||
memcpy(CRadar::ms_RadarTrace, pRadarBlips, sizeof(CBlip) * NUMRADARBLIPS);
|
||||
memcpy(CRadar::ms_RadarTrace, pRadarBlips, sizeof(sRadarTrace) * NUMRADARBLIPS);
|
||||
delete[] pRadarBlips;
|
||||
pRadarBlips = nil;
|
||||
FindPlayerPed()->m_pWanted = new CWanted(PlayerWanted);
|
||||
|
@ -2,36 +2,202 @@
|
||||
#include "patcher.h"
|
||||
#include "RoadBlocks.h"
|
||||
#include "PathFind.h"
|
||||
#include "ModelIndices.h"
|
||||
#include "Streaming.h"
|
||||
#include "World.h"
|
||||
#include "PedPlacement.h"
|
||||
#include "Automobile.h"
|
||||
#include "CopPed.h"
|
||||
#include "VisibilityPlugins.h"
|
||||
#include "PlayerPed.h"
|
||||
#include "Wanted.h"
|
||||
#include "Camera.h"
|
||||
#include "CarCtrl.h"
|
||||
#include "General.h"
|
||||
|
||||
int16 &CRoadBlocks::NumRoadBlocks = *(int16*)0x95CC34;
|
||||
int16 (&CRoadBlocks::RoadBlockObjects)[NUMROADBLOCKS] = *(int16(*)[NUMROADBLOCKS]) * (uintptr*)0x72B3A8;
|
||||
bool (&CRoadBlocks::InOrOut)[NUMROADBLOCKS] = *(bool(*)[NUMROADBLOCKS]) * (uintptr*)0x733810;
|
||||
|
||||
WRAPPER void CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle*, int32, int16) { EAXJMP(0x4376A0); }
|
||||
WRAPPER void CRoadBlocks::GenerateRoadBlocks(void) { EAXJMP(0x436FA0); }
|
||||
|
||||
void
|
||||
CRoadBlocks::Init(void)
|
||||
{
|
||||
NumRoadBlocks = 0;
|
||||
for (int objId = 0; objId < ThePaths.m_numMapObjects; objId++) {
|
||||
if (ThePaths.m_objectFlags[objId] & UseInRoadBlock) {
|
||||
if (NumRoadBlocks < 600) {
|
||||
InOrOut[NumRoadBlocks] = true;
|
||||
RoadBlockObjects[NumRoadBlocks] = objId;
|
||||
NumRoadBlocks++;
|
||||
} else {
|
||||
NumRoadBlocks = 0;
|
||||
for (int objId = 0; objId < ThePaths.m_numMapObjects; objId++) {
|
||||
if (ThePaths.m_objectFlags[objId] & UseInRoadBlock) {
|
||||
if (NumRoadBlocks < NUMROADBLOCKS) {
|
||||
InOrOut[NumRoadBlocks] = true;
|
||||
RoadBlockObjects[NumRoadBlocks] = objId;
|
||||
NumRoadBlocks++;
|
||||
} else {
|
||||
#ifndef MASTER
|
||||
printf("Not enough room for the potential roadblocks\n");
|
||||
printf("Not enough room for the potential roadblocks\n");
|
||||
#endif
|
||||
// FIX: Don't iterate loop after NUMROADBLOCKS
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// FIX: Don't iterate loop after NUMROADBLOCKS
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType, int16 roadBlockNode)
|
||||
{
|
||||
static const CVector vecRoadBlockOffets[6] = { {-1.5, 1.8f, 0.0f}, {-1.5f, -1.8f, 0.0f}, {1.5f, 1.8f, 0.0f},
|
||||
{1.5f, -1.8f, 0.0f}, {-1.5f, 0.0f, 0.0f}, {1.5, 0.0, 0.0} };
|
||||
CEntity* pEntityToAttack = (CEntity*)FindPlayerVehicle();
|
||||
if (!pEntityToAttack)
|
||||
pEntityToAttack = (CEntity*)FindPlayerPed();
|
||||
CColModel* pPoliceColModel = CModelInfo::GetModelInfo(MI_POLICE)->GetColModel();
|
||||
float fRadius = pVehicle->GetBoundRadius() / pPoliceColModel->boundingSphere.radius;
|
||||
for (int32 i = 0; i < 2; i++) {
|
||||
const int32 roadBlockIndex = i + 2 * roadBlockType;
|
||||
CVector posForZ = pVehicle->m_matrix * (fRadius * vecRoadBlockOffets[roadBlockIndex]);
|
||||
int32 modelInfoId = MI_COP;
|
||||
eCopType copType = COP_STREET;
|
||||
switch (pVehicle->GetModelIndex())
|
||||
{
|
||||
case MI_FBICAR:
|
||||
modelInfoId = MI_FBI;
|
||||
copType = COP_FBI;
|
||||
break;
|
||||
case MI_ENFORCER:
|
||||
modelInfoId = MI_SWAT;
|
||||
copType = COP_SWAT;
|
||||
break;
|
||||
case MI_BARRACKS:
|
||||
modelInfoId = MI_ARMY;
|
||||
copType = COP_ARMY;
|
||||
break;
|
||||
}
|
||||
if (!CStreaming::HasModelLoaded(modelInfoId))
|
||||
copType = COP_STREET;
|
||||
CCopPed* pCopPed = new CCopPed(copType);
|
||||
if (copType == COP_STREET)
|
||||
pCopPed->SetCurrentWeapon(WEAPONTYPE_COLT45);
|
||||
CPedPlacement::FindZCoorForPed(&posForZ);
|
||||
pCopPed->m_matrix.GetPosition() = posForZ;
|
||||
CVector vecSavedPos = pCopPed->m_matrix.GetPosition();
|
||||
pCopPed->m_matrix.SetRotate(0.0f, 0.0f, -HALFPI);
|
||||
pCopPed->m_matrix.GetPosition() += vecSavedPos;
|
||||
pCopPed->m_bIsDisabledCop = true;
|
||||
pCopPed->SetIdle();
|
||||
pCopPed->bKindaStayInSamePlace = true;
|
||||
pCopPed->bNotAllowedToDuck = false;
|
||||
pCopPed->m_wRoadblockNode = roadBlockNode;
|
||||
pCopPed->bCrouchWhenShooting = roadBlockType != 2;
|
||||
if (pEntityToAttack) {
|
||||
pCopPed->m_pPointGunAt = pEntityToAttack;
|
||||
pEntityToAttack->RegisterReference(&pCopPed->m_pPointGunAt);
|
||||
pCopPed->SetAttack(pEntityToAttack);
|
||||
}
|
||||
pCopPed->m_pMyVehicle = pVehicle;
|
||||
pVehicle->RegisterReference((CEntity**)&pCopPed->m_pMyVehicle);
|
||||
pCopPed->bCullExtraFarAway = true;
|
||||
CVisibilityPlugins::SetClumpAlpha(pCopPed->GetClump(), 0);
|
||||
CWorld::Add(pCopPed);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CRoadBlocks::GenerateRoadBlocks(void)
|
||||
{
|
||||
CMatrix offsetMatrix;
|
||||
uint32 frame = CTimer::GetFrameCounter() & 0xF;
|
||||
int16 nRoadblockNode = (int16)(NUMROADBLOCKS * frame) / 16;
|
||||
const int16 maxRoadBlocks = (int16)(NUMROADBLOCKS * (frame + 1)) / 16;
|
||||
int16 numRoadBlocks = CRoadBlocks::NumRoadBlocks;
|
||||
if (CRoadBlocks::NumRoadBlocks >= maxRoadBlocks)
|
||||
numRoadBlocks = maxRoadBlocks;
|
||||
for (; nRoadblockNode < numRoadBlocks; nRoadblockNode++) {
|
||||
CTreadable *mapObject = ThePaths.m_mapObjects[CRoadBlocks::RoadBlockObjects[nRoadblockNode]];
|
||||
CVector2D vecDistance = FindPlayerCoors() - mapObject->GetPosition();
|
||||
if (vecDistance.x > -80.0f && vecDistance.x < 80.0f &&
|
||||
vecDistance.y > -80.0f && vecDistance.y < 80.0f &&
|
||||
vecDistance.Magnitude() < 80.0f) {
|
||||
if (!CRoadBlocks::InOrOut[nRoadblockNode]) {
|
||||
CRoadBlocks::InOrOut[nRoadblockNode] = true;
|
||||
if (FindPlayerVehicle() && (CGeneral::GetRandomNumber() & 0x7F) < FindPlayerPed()->m_pWanted->m_RoadblockDensity) {
|
||||
CWanted *pPlayerWanted = FindPlayerPed()->m_pWanted;
|
||||
float fMapObjectRadius = 2.0f * mapObject->GetColModel()->boundingBox.max.x;
|
||||
int32 vehicleId = MI_POLICE;
|
||||
if (pPlayerWanted->AreArmyRequired())
|
||||
vehicleId = MI_BARRACKS;
|
||||
else if (pPlayerWanted->AreFbiRequired())
|
||||
vehicleId = MI_FBICAR;
|
||||
else if (pPlayerWanted->AreSwatRequired())
|
||||
vehicleId = MI_ENFORCER;
|
||||
if (!CStreaming::HasModelLoaded(vehicleId))
|
||||
vehicleId = MI_POLICE;
|
||||
CColModel *pVehicleColModel = CModelInfo::GetModelInfo(vehicleId)->GetColModel();
|
||||
float fModelRadius = 2.0f * pVehicleColModel->boundingSphere.radius + 0.25f;
|
||||
int16 radius = (int16)(fMapObjectRadius / fModelRadius);
|
||||
if (radius > 0 && radius < 6) {
|
||||
CVector2D vecDistanceToCamera = TheCamera.GetPosition() - mapObject->m_matrix.GetPosition();
|
||||
float fDotProduct = DotProduct2D(vecDistanceToCamera, mapObject->m_matrix.GetUp());
|
||||
float fOffset = 0.5f * fModelRadius * (float)(radius - 1);
|
||||
for (int16 i = 0; i < radius; i++) {
|
||||
uint8 nRoadblockType = fDotProduct < 0.0f;
|
||||
if (CGeneral::GetRandomNumber() & 1) {
|
||||
offsetMatrix.SetRotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f + HALFPI);
|
||||
}
|
||||
else {
|
||||
nRoadblockType = !nRoadblockType;
|
||||
offsetMatrix.SetRotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f - HALFPI);
|
||||
}
|
||||
if (ThePaths.m_objectFlags[CRoadBlocks::RoadBlockObjects[nRoadblockNode]] & ObjectEastWest)
|
||||
offsetMatrix.GetPosition() = CVector(0.0f, -fOffset, 0.6f);
|
||||
else
|
||||
offsetMatrix.GetPosition() = CVector(-fOffset, 0.0f, 0.6f);
|
||||
CMatrix vehicleMatrix = mapObject->m_matrix * offsetMatrix;
|
||||
float fModelRadius = CModelInfo::GetModelInfo(vehicleId)->GetColModel()->boundingSphere.radius - 0.25f;
|
||||
int16 colliding = 0;
|
||||
CWorld::FindObjectsKindaColliding(vehicleMatrix.GetPosition(), fModelRadius, 0, &colliding, 2, nil, false, true, true, false, false);
|
||||
if (!colliding) {
|
||||
CAutomobile *pVehicle = new CAutomobile(vehicleId, RANDOM_VEHICLE);
|
||||
pVehicle->m_status = STATUS_ABANDONED;
|
||||
// pVehicle->GetHeightAboveRoad(); // called but return value is ignored?
|
||||
vehicleMatrix.GetPosition().z += fModelRadius - 0.6f;
|
||||
pVehicle->m_matrix = vehicleMatrix;
|
||||
pVehicle->PlaceOnRoadProperly();
|
||||
pVehicle->bIsStatic = false;
|
||||
pVehicle->m_matrix.UpdateRW();
|
||||
pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
|
||||
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
|
||||
pVehicle->bIsLocked = false;
|
||||
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
||||
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
|
||||
pVehicle->AutoPilot.m_nCurrentLane = 0;
|
||||
pVehicle->AutoPilot.m_nNextLane = 0;
|
||||
pVehicle->AutoPilot.m_fMaxTrafficSpeed = 0.0f;
|
||||
pVehicle->AutoPilot.m_nCruiseSpeed = 0.0f;
|
||||
pVehicle->bExtendedRange = true;
|
||||
if (pVehicle->UsesSiren(pVehicle->GetModelIndex()) && CGeneral::GetRandomNumber() & 1)
|
||||
pVehicle->m_bSirenOrAlarm = true;
|
||||
if (pVehicle->m_matrix.GetForward().z > 0.94f) {
|
||||
CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), 0);
|
||||
CWorld::Add(pVehicle);
|
||||
pVehicle->bCreateRoadBlockPeds = true;
|
||||
pVehicle->m_nRoadblockType = nRoadblockType;
|
||||
pVehicle->m_nRoadblockNode = nRoadblockNode;
|
||||
}
|
||||
else {
|
||||
delete pVehicle;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CRoadBlocks::InOrOut[nRoadblockNode] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x436F50, &CRoadBlocks::Init, PATCH_JUMP);
|
||||
InjectHook(0x4376A0, &CRoadBlocks::GenerateRoadBlockCopsForCar, PATCH_JUMP);
|
||||
InjectHook(0x436FA0, &CRoadBlocks::GenerateRoadBlocks, PATCH_JUMP);
|
||||
ENDPATCHES
|
@ -11,6 +11,6 @@ public:
|
||||
static bool (&InOrOut)[NUMROADBLOCKS];
|
||||
|
||||
static void Init(void);
|
||||
static void GenerateRoadBlockCopsForCar(CVehicle*, int32, int16);
|
||||
static void GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType, int16 roadBlockNode);
|
||||
static void GenerateRoadBlocks(void);
|
||||
};
|
||||
|
@ -91,10 +91,10 @@ uint8 (&CTheScripts::ScriptSpace)[SIZE_SCRIPT_SPACE] = *(uint8(*)[SIZE_SCRIPT_SP
|
||||
CRunningScript(&CTheScripts::ScriptsArray)[MAX_NUM_SCRIPTS] = *(CRunningScript(*)[MAX_NUM_SCRIPTS])*(uintptr*)0x6F5C08;
|
||||
int32(&CTheScripts::BaseBriefIdForContact)[MAX_NUM_CONTACTS] = *(int32(*)[MAX_NUM_CONTACTS])*(uintptr*)0x880200;
|
||||
int32(&CTheScripts::OnAMissionForContactFlag)[MAX_NUM_CONTACTS] = *(int32(*)[MAX_NUM_CONTACTS])*(uintptr*)0x8622F0;
|
||||
CTextLine (&CTheScripts::IntroTextLines)[MAX_NUM_INTRO_TEXT_LINES] = *(CTextLine (*)[MAX_NUM_INTRO_TEXT_LINES])*(uintptr*)0x70EA68;
|
||||
CScriptRectangle (&CTheScripts::IntroRectangles)[MAX_NUM_INTRO_RECTANGLES] = *(CScriptRectangle (*)[MAX_NUM_INTRO_RECTANGLES])*(uintptr*)0x72D108;
|
||||
intro_text_line (&CTheScripts::IntroTextLines)[MAX_NUM_INTRO_TEXT_LINES] = *(intro_text_line (*)[MAX_NUM_INTRO_TEXT_LINES])*(uintptr*)0x70EA68;
|
||||
intro_script_rectangle (&CTheScripts::IntroRectangles)[MAX_NUM_INTRO_RECTANGLES] = *(intro_script_rectangle (*)[MAX_NUM_INTRO_RECTANGLES])*(uintptr*)0x72D108;
|
||||
CSprite2d (&CTheScripts::ScriptSprites)[MAX_NUM_SCRIPT_SRPITES] = *(CSprite2d(*)[MAX_NUM_SCRIPT_SRPITES])*(uintptr*)0x72B090;
|
||||
CScriptSphere(&CTheScripts::ScriptSphereArray)[MAX_NUM_SCRIPT_SPHERES] = *(CScriptSphere(*)[MAX_NUM_SCRIPT_SPHERES])*(uintptr*)0x727D60;
|
||||
script_sphere_struct(&CTheScripts::ScriptSphereArray)[MAX_NUM_SCRIPT_SPHERES] = *(script_sphere_struct(*)[MAX_NUM_SCRIPT_SPHERES])*(uintptr*)0x727D60;
|
||||
tCollectiveData(&CTheScripts::CollectiveArray)[MAX_NUM_COLLECTIVES] = *(tCollectiveData(*)[MAX_NUM_COLLECTIVES])*(uintptr*)0x6FA008;
|
||||
tUsedObject(&CTheScripts::UsedObjectArray)[MAX_NUM_USED_OBJECTS] = *(tUsedObject(*)[MAX_NUM_USED_OBJECTS])*(uintptr*)0x6E69C8;
|
||||
int32(&CTheScripts::MultiScriptArray)[MAX_NUM_MISSION_SCRIPTS] = *(int32(*)[MAX_NUM_MISSION_SCRIPTS])*(uintptr*)0x6F0558;
|
||||
@ -313,7 +313,7 @@ bool CUpsideDownCarCheck::HasCarBeenUpsideDownForAWhile(int32 id)
|
||||
return false;
|
||||
}
|
||||
|
||||
void CStuckCarCheckEntry::Reset()
|
||||
void stuck_car_data::Reset()
|
||||
{
|
||||
m_nVehicleIndex = -1;
|
||||
m_vecPos = CVector(-5000.0f, -5000.0f, -5000.0f);
|
||||
@ -2229,6 +2229,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
||||
if (pos.z <= -100)
|
||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||
UpdateCompareFlag(TheCamera.IsSphereVisible(pos, *(float*)&ScriptParams[3]));
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_DEBUG_ON:
|
||||
CTheScripts::DbgFlag = true;
|
||||
@ -7116,7 +7117,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
||||
case COMMAND_CLOSE_GARAGE:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
CGarages::CloseGarage(ScriptParams[1]);
|
||||
CGarages::CloseGarage(ScriptParams[0]);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_WARP_CHAR_FROM_CAR_TO_COORD:
|
||||
@ -7657,13 +7658,13 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
||||
assert(pObject);
|
||||
if (ScriptParams[1]) {
|
||||
if (pObject->bIsStatic) {
|
||||
pObject->bIsStatic = true;
|
||||
pObject->bIsStatic = false;
|
||||
pObject->AddToMovingList();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!pObject->bIsStatic) {
|
||||
pObject->bIsStatic = false;
|
||||
pObject->bIsStatic = true;
|
||||
pObject->RemoveFromMovingList();
|
||||
}
|
||||
}
|
||||
@ -8441,7 +8442,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
||||
CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]];
|
||||
CPad::GetPad(ScriptParams[0])->DisablePlayerControls |= PLAYERCONTROL_DISABLED_80;
|
||||
pPlayerInfo->MakePlayerSafe(true);
|
||||
CCutsceneMgr::SetRunning(true);
|
||||
CCutsceneMgr::StartCutsceneProcessing();
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_USE_TEXT_COMMANDS:
|
||||
@ -9140,7 +9141,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
|
||||
assert(pVehicle);
|
||||
assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR);
|
||||
CAutomobile* pCar = (CAutomobile*)pVehicle;
|
||||
pCar->bTakeLessDamage = ScriptParams[1];
|
||||
pCar->bMoreResistantToDamage = ScriptParams[1];
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SET_JAMES_CAR_ON_PATH_TO_PLAYER:
|
||||
@ -9152,6 +9153,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_LOAD_END_OF_GAME_TUNE:
|
||||
DMAudio.ChangeMusicMode(MUSICMODE_CUTSCENE);
|
||||
printf("Start preload end of game audio\n");
|
||||
DMAudio.PreloadCutSceneMusic(STREAMED_SOUND_GAME_COMPLETED);
|
||||
printf("End preload end of game audio\n");
|
||||
@ -11037,6 +11039,7 @@ void CRunningScript::DoDeatharrestCheck()
|
||||
int contactFlagOffset = CTheScripts::OnAMissionForContactFlag[contact];
|
||||
if (contactFlagOffset && CTheScripts::ScriptSpace[contactFlagOffset] == 1) {
|
||||
messageId += CTheScripts::BaseBriefIdForContact[contact];
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
@ -11331,6 +11334,7 @@ INITSAVEBUF
|
||||
break;
|
||||
case 4:
|
||||
InvisibilitySettingArray[i] = CPools::GetDummyPool()->GetSlot(handle - 1);
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
@ -11369,15 +11373,15 @@ void CTheScripts::ClearSpaceForMissionEntity(const CVector& pos, CEntity* pEntit
|
||||
continue;
|
||||
CEntity* pFound = aEntities[i];
|
||||
int cols;
|
||||
if (CModelInfo::GetModelInfo(pEntity->GetModelIndex())->GetColModel()->numLines <= 0)
|
||||
cols = CCollision::ProcessColModels(pEntity->GetMatrix(), *CModelInfo::GetModelInfo(pEntity->GetModelIndex())->GetColModel(),
|
||||
pFound->GetMatrix(), *CModelInfo::GetModelInfo(pFound->GetModelIndex())->GetColModel(), aTempColPoints, nil, nil);
|
||||
if (pEntity->GetColModel()->numLines <= 0)
|
||||
cols = CCollision::ProcessColModels(pEntity->GetMatrix(), *pEntity->GetColModel(),
|
||||
pFound->GetMatrix(), *pFound->GetColModel(), aTempColPoints, nil, nil);
|
||||
else {
|
||||
float lines[4];
|
||||
lines[0] = lines[1] = lines[2] = lines[3] = 1.0f;
|
||||
CColPoint tmp;
|
||||
cols = CCollision::ProcessColModels(pEntity->GetMatrix(), *CModelInfo::GetModelInfo(pEntity->GetModelIndex())->GetColModel(),
|
||||
pFound->GetMatrix(), *CModelInfo::GetModelInfo(pFound->GetModelIndex())->GetColModel(), aTempColPoints, &tmp, lines);
|
||||
CColPoint tmp[4];
|
||||
cols = CCollision::ProcessColModels(pEntity->GetMatrix(), *pEntity->GetColModel(),
|
||||
pFound->GetMatrix(), *pFound->GetColModel(), aTempColPoints,tmp, lines);
|
||||
}
|
||||
if (cols <= 0)
|
||||
continue;
|
||||
|
@ -15,22 +15,25 @@ class CRunningScript;
|
||||
|
||||
#define KEY_LENGTH_IN_SCRIPT 8
|
||||
|
||||
struct CScriptRectangle
|
||||
struct intro_script_rectangle
|
||||
{
|
||||
int8 m_bIsUsed;
|
||||
bool m_bIsUsed;
|
||||
bool m_bBeforeFade;
|
||||
int16 m_nTextureId;
|
||||
CRect m_sRect;
|
||||
CRGBA m_sColor;
|
||||
|
||||
intro_script_rectangle() { }
|
||||
~intro_script_rectangle() { }
|
||||
};
|
||||
|
||||
static_assert(sizeof(CScriptRectangle) == 0x18, "Script.h: error");
|
||||
static_assert(sizeof(intro_script_rectangle) == 0x18, "Script.h: error");
|
||||
|
||||
enum {
|
||||
SCRIPT_TEXT_MAX_LENGTH = 500
|
||||
};
|
||||
|
||||
struct CTextLine
|
||||
struct intro_text_line
|
||||
{
|
||||
float m_fScaleX;
|
||||
float m_fScaleY;
|
||||
@ -50,6 +53,9 @@ struct CTextLine
|
||||
float m_fAtY;
|
||||
wchar m_Text[SCRIPT_TEXT_MAX_LENGTH];
|
||||
|
||||
intro_text_line() { }
|
||||
~intro_text_line() { }
|
||||
|
||||
void Reset()
|
||||
{
|
||||
m_fScaleX = 0.48f;
|
||||
@ -72,15 +78,17 @@ struct CTextLine
|
||||
}
|
||||
};
|
||||
|
||||
static_assert(sizeof(CTextLine) == 0x414, "Script.h: error");
|
||||
static_assert(sizeof(intro_text_line) == 0x414, "Script.h: error");
|
||||
|
||||
struct CScriptSphere
|
||||
struct script_sphere_struct
|
||||
{
|
||||
bool m_bInUse;
|
||||
uint16 m_Index;
|
||||
uint32 m_Id;
|
||||
CVector m_vecCenter;
|
||||
float m_fRadius;
|
||||
|
||||
script_sphere_struct() { }
|
||||
};
|
||||
|
||||
struct CStoredLine
|
||||
@ -145,7 +153,7 @@ public:
|
||||
bool HasCarBeenUpsideDownForAWhile(int32);
|
||||
};
|
||||
|
||||
struct CStuckCarCheckEntry
|
||||
struct stuck_car_data
|
||||
{
|
||||
int32 m_nVehicleIndex;
|
||||
CVector m_vecPos;
|
||||
@ -154,12 +162,13 @@ struct CStuckCarCheckEntry
|
||||
uint32 m_nStuckTime;
|
||||
bool m_bStuck;
|
||||
|
||||
stuck_car_data() { }
|
||||
inline void Reset();
|
||||
};
|
||||
|
||||
class CStuckCarCheck
|
||||
{
|
||||
CStuckCarCheckEntry m_sCars[MAX_STUCK_CAR_CHECKS];
|
||||
stuck_car_data m_sCars[MAX_STUCK_CAR_CHECKS];
|
||||
|
||||
public:
|
||||
void Init();
|
||||
@ -235,10 +244,10 @@ class CTheScripts
|
||||
static CRunningScript(&ScriptsArray)[MAX_NUM_SCRIPTS];
|
||||
static int32(&BaseBriefIdForContact)[MAX_NUM_CONTACTS];
|
||||
static int32(&OnAMissionForContactFlag)[MAX_NUM_CONTACTS];
|
||||
static CTextLine(&IntroTextLines)[MAX_NUM_INTRO_TEXT_LINES];
|
||||
static CScriptRectangle(&IntroRectangles)[MAX_NUM_INTRO_RECTANGLES];
|
||||
static intro_text_line(&IntroTextLines)[MAX_NUM_INTRO_TEXT_LINES];
|
||||
static intro_script_rectangle(&IntroRectangles)[MAX_NUM_INTRO_RECTANGLES];
|
||||
static CSprite2d(&ScriptSprites)[MAX_NUM_SCRIPT_SRPITES];
|
||||
static CScriptSphere(&ScriptSphereArray)[MAX_NUM_SCRIPT_SPHERES];
|
||||
static script_sphere_struct(&ScriptSphereArray)[MAX_NUM_SCRIPT_SPHERES];
|
||||
static tCollectiveData(&CollectiveArray)[MAX_NUM_COLLECTIVES];
|
||||
static tUsedObject(&UsedObjectArray)[MAX_NUM_USED_OBJECTS];
|
||||
static int32(&MultiScriptArray)[MAX_NUM_MISSION_SCRIPTS];
|
||||
|
@ -1,23 +1,335 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "TrafficLights.h"
|
||||
#include "General.h"
|
||||
#include "Camera.h"
|
||||
#include "World.h"
|
||||
#include "PathFind.h"
|
||||
#include "Timer.h"
|
||||
#include "Clock.h"
|
||||
#include "Weather.h"
|
||||
#include "Timecycle.h"
|
||||
#include "Pointlights.h"
|
||||
#include "Shadows.h"
|
||||
#include "Coronas.h"
|
||||
#include "SpecialFX.h"
|
||||
#include "Vehicle.h"
|
||||
#include "TrafficLights.h"
|
||||
|
||||
WRAPPER void CTrafficLights::DisplayActualLight(CEntity *ent) { EAXJMP(0x455800); }
|
||||
WRAPPER void CTrafficLights::ScanForLightsOnMap(void) { EAXJMP(0x454F40); }
|
||||
WRAPPER bool CTrafficLights::ShouldCarStopForLight(CVehicle*, bool) { EAXJMP(0x455350); }
|
||||
WRAPPER bool CTrafficLights::ShouldCarStopForBridge(CVehicle*) { EAXJMP(0x456460); }
|
||||
// TODO: figure out the meaning of this
|
||||
enum { SOME_FLAG = 0x80 };
|
||||
|
||||
void
|
||||
CTrafficLights::DisplayActualLight(CEntity *ent)
|
||||
{
|
||||
if(ent->GetUp().z < 0.96f || ent->bRenderDamaged)
|
||||
return;
|
||||
|
||||
int phase;
|
||||
if(FindTrafficLightType(ent) == 1)
|
||||
phase = LightForCars1();
|
||||
else
|
||||
phase = LightForCars2();
|
||||
|
||||
int i;
|
||||
CBaseModelInfo *mi = CModelInfo::GetModelInfo(ent->GetModelIndex());
|
||||
float x = mi->Get2dEffect(0)->pos.x;
|
||||
float yMin = mi->Get2dEffect(0)->pos.y;
|
||||
float yMax = mi->Get2dEffect(0)->pos.y;
|
||||
float zMin = mi->Get2dEffect(0)->pos.z;
|
||||
float zMax = mi->Get2dEffect(0)->pos.z;
|
||||
for(i = 1; i < 6; i++){
|
||||
assert(mi->Get2dEffect(i));
|
||||
yMin = min(yMin, mi->Get2dEffect(i)->pos.y);
|
||||
yMax = max(yMax, mi->Get2dEffect(i)->pos.y);
|
||||
zMin = min(zMin, mi->Get2dEffect(i)->pos.z);
|
||||
zMax = max(zMax, mi->Get2dEffect(i)->pos.z);
|
||||
}
|
||||
|
||||
CVector pos1, pos2;
|
||||
uint8 r, g;
|
||||
int id;
|
||||
switch(phase){
|
||||
case CAR_LIGHTS_GREEN:
|
||||
r = 0;
|
||||
g = 255;
|
||||
pos1 = ent->GetMatrix() * CVector(x, yMax, zMin);
|
||||
pos2 = ent->GetMatrix() * CVector(x, yMin, zMin);
|
||||
id = 0;
|
||||
break;
|
||||
case CAR_LIGHTS_YELLOW:
|
||||
r = 255;
|
||||
g = 128;
|
||||
pos1 = ent->GetMatrix() * CVector(x, yMax, (zMin+zMax)/2.0f);
|
||||
pos2 = ent->GetMatrix() * CVector(x, yMin, (zMin+zMax)/2.0f);
|
||||
id = 1;
|
||||
break;
|
||||
case CAR_LIGHTS_RED:
|
||||
default:
|
||||
r = 255;
|
||||
g = 0;
|
||||
pos1 = ent->GetMatrix() * CVector(x, yMax, zMax);
|
||||
pos2 = ent->GetMatrix() * CVector(x, yMin, zMax);
|
||||
id = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
if(CClock::GetHours() > 19 || CClock::GetHours() < 6 || CWeather::Foggyness > 0.05f)
|
||||
CPointLights::AddLight(CPointLights::LIGHT_POINT,
|
||||
pos1, CVector(0.0f, 0.0f, 0.0f), 8.0f,
|
||||
r/255.0f, g/255.0f, 0/255.0f, CPointLights::FOG_NORMAL, true);
|
||||
|
||||
CShadows::StoreStaticShadow((uintptr)ent,
|
||||
SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos1,
|
||||
8.0f, 0.0f, 0.0f, -8.0f, 128,
|
||||
r*CTimeCycle::GetLightOnGroundBrightness()/8.0f,
|
||||
g*CTimeCycle::GetLightOnGroundBrightness()/8.0f,
|
||||
0*CTimeCycle::GetLightOnGroundBrightness()/8.0f,
|
||||
12.0f, 1.0f, 40.0f, false, 0.0f);
|
||||
|
||||
if(DotProduct(TheCamera.GetForward(), ent->GetForward()) < 0.0f)
|
||||
CCoronas::RegisterCorona((uintptr)ent + id,
|
||||
r*CTimeCycle::GetSpriteBrightness()*0.7f,
|
||||
g*CTimeCycle::GetSpriteBrightness()*0.7f,
|
||||
0*CTimeCycle::GetSpriteBrightness()*0.7f,
|
||||
255,
|
||||
pos1, 1.75f*CTimeCycle::GetSpriteSize(), 50.0f,
|
||||
CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
|
||||
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
|
||||
else
|
||||
CCoronas::RegisterCorona((uintptr)ent + id + 3,
|
||||
r*CTimeCycle::GetSpriteBrightness()*0.7f,
|
||||
g*CTimeCycle::GetSpriteBrightness()*0.7f,
|
||||
0*CTimeCycle::GetSpriteBrightness()*0.7f,
|
||||
255,
|
||||
pos2, 1.75f*CTimeCycle::GetSpriteSize(), 50.0f,
|
||||
CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
|
||||
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
|
||||
|
||||
CBrightLights::RegisterOne(pos1, ent->GetUp(), ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN);
|
||||
CBrightLights::RegisterOne(pos2, ent->GetUp(), -ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN);
|
||||
|
||||
static const float top = -0.127f;
|
||||
static const float bot = -0.539f;
|
||||
static const float mid = bot + (top-bot)/3.0f;
|
||||
static const float left = 1.256f;
|
||||
static const float right = 0.706f;
|
||||
phase = CTrafficLights::LightForPeds();
|
||||
if(phase == PED_LIGHTS_DONT_WALK){
|
||||
CVector p0(2.7f, right, top);
|
||||
CVector p1(2.7f, left, top);
|
||||
CVector p2(2.7f, right, mid);
|
||||
CVector p3(2.7f, left, mid);
|
||||
CShinyTexts::RegisterOne(ent->GetMatrix()*p0, ent->GetMatrix()*p1, ent->GetMatrix()*p2, ent->GetMatrix()*p3,
|
||||
1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f,
|
||||
SHINYTEXT_WALK, 255, 0, 0, 60.0f);
|
||||
}else if(phase == PED_LIGHTS_WALK || CTimer::GetTimeInMilliseconds() & 0x100){
|
||||
CVector p0(2.7f, right, mid);
|
||||
CVector p1(2.7f, left, mid);
|
||||
CVector p2(2.7f, right, bot);
|
||||
CVector p3(2.7f, left, bot);
|
||||
CShinyTexts::RegisterOne(ent->GetMatrix()*p0, ent->GetMatrix()*p1, ent->GetMatrix()*p2, ent->GetMatrix()*p3,
|
||||
1.0f, 0.5f, 0.0f, 0.5f, 1.0f, 1.0f, 0.0f, 1.0f,
|
||||
SHINYTEXT_WALK, 255, 255, 255, 60.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CTrafficLights::ScanForLightsOnMap(void)
|
||||
{
|
||||
int x, y;
|
||||
int i, j, l;
|
||||
CPtrNode *node;
|
||||
|
||||
for(x = 0; x < NUMSECTORS_X; x++)
|
||||
for(y = 0; y < NUMSECTORS_Y; y++){
|
||||
CPtrList &list = CWorld::GetSector(x, y)->m_lists[ENTITYLIST_DUMMIES];
|
||||
for(node = list.first; node; node = node->next){
|
||||
CEntity *light = (CEntity*)node->item;
|
||||
if(light->GetModelIndex() != MI_TRAFFICLIGHTS)
|
||||
continue;
|
||||
|
||||
// Check cars
|
||||
for(i = 0; i < ThePaths.m_numCarPathLinks; i++){
|
||||
CVector2D dist = ThePaths.m_carPathLinks[i].pos - light->GetPosition();
|
||||
float dotY = Abs(DotProduct2D(dist, light->GetForward())); // forward is direction of car light
|
||||
float dotX = DotProduct2D(dist, light->GetRight()); // towards base of light
|
||||
// it has to be on the correct side of the node and also not very far away
|
||||
if(dotX < 0.0f && dotX > -15.0f && dotY < 3.0f){
|
||||
float dz = ThePaths.m_pathNodes[ThePaths.m_carPathLinks[i].pathNodeIndex].pos.z -
|
||||
light->GetPosition().z;
|
||||
if(dz < 15.0f){
|
||||
ThePaths.m_carPathLinks[i].trafficLightType = FindTrafficLightType(light);
|
||||
// Find two neighbour nodes of this one
|
||||
int n1 = -1;
|
||||
int n2 = -1;
|
||||
for(j = 0; j < ThePaths.m_numPathNodes; j++)
|
||||
for(l = 0; l < ThePaths.m_pathNodes[j].numLinks; l++)
|
||||
if(ThePaths.m_carPathConnections[ThePaths.m_pathNodes[j].firstLink + l] == i){
|
||||
if(n1 == -1)
|
||||
n1 = j;
|
||||
else
|
||||
n2 = j;
|
||||
}
|
||||
// What's going on here?
|
||||
if(ThePaths.m_pathNodes[n1].numLinks <= ThePaths.m_pathNodes[n2].numLinks)
|
||||
n1 = n2;
|
||||
if(ThePaths.m_carPathLinks[i].pathNodeIndex != n1)
|
||||
ThePaths.m_carPathLinks[i].trafficLightType |= SOME_FLAG;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check peds
|
||||
for(i = ThePaths.m_numCarPathNodes; i < ThePaths.m_numPathNodes; i++){
|
||||
float dist1, dist2;
|
||||
dist1 = Abs(ThePaths.m_pathNodes[i].pos.x - light->GetPosition().x) +
|
||||
Abs(ThePaths.m_pathNodes[i].pos.y - light->GetPosition().y);
|
||||
if(dist1 < 50.0f){
|
||||
for(l = 0; l < ThePaths.m_pathNodes[i].numLinks; l++){
|
||||
j = ThePaths.m_pathNodes[i].firstLink + l;
|
||||
if(ThePaths.m_connectionFlags[j].bCrossesRoad){
|
||||
dist2 = Abs(ThePaths.m_pathNodes[j].pos.x - light->GetPosition().x) +
|
||||
Abs(ThePaths.m_pathNodes[j].pos.y - light->GetPosition().y);
|
||||
if(dist1 < 15.0f || dist2 < 15.0f)
|
||||
ThePaths.m_connectionFlags[j].bTrafficLight = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
CTrafficLights::ShouldCarStopForLight(CVehicle *vehicle, bool alwaysStop)
|
||||
{
|
||||
int node, type;
|
||||
|
||||
node = vehicle->AutoPilot.m_nNextPathNodeInfo;
|
||||
type = ThePaths.m_carPathLinks[node].trafficLightType;
|
||||
if(type){
|
||||
if((type & SOME_FLAG || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nNextRouteNode) &&
|
||||
(!(type & SOME_FLAG) || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nNextRouteNode))
|
||||
if(alwaysStop ||
|
||||
(type&~SOME_FLAG) == 1 && LightForCars1() != CAR_LIGHTS_GREEN ||
|
||||
(type&~SOME_FLAG) == 2 && LightForCars2() != CAR_LIGHTS_GREEN){
|
||||
float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].pos,
|
||||
ThePaths.m_carPathLinks[node].dir);
|
||||
if(vehicle->AutoPilot.m_nNextDirection == -1){
|
||||
if(dist > 0.0f && dist < 8.0f)
|
||||
return true;
|
||||
}else{
|
||||
if(dist < 0.0f && dist > -8.0f)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
node = vehicle->AutoPilot.m_nCurrentPathNodeInfo;
|
||||
type = ThePaths.m_carPathLinks[node].trafficLightType;
|
||||
if(type){
|
||||
if((type & SOME_FLAG || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nCurrentRouteNode) &&
|
||||
(!(type & SOME_FLAG) || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nCurrentRouteNode))
|
||||
if(alwaysStop ||
|
||||
(type&~SOME_FLAG) == 1 && LightForCars1() != CAR_LIGHTS_GREEN ||
|
||||
(type&~SOME_FLAG) == 2 && LightForCars2() != CAR_LIGHTS_GREEN){
|
||||
float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].pos,
|
||||
ThePaths.m_carPathLinks[node].dir);
|
||||
if(vehicle->AutoPilot.m_nCurrentDirection == -1){
|
||||
if(dist > 0.0f && dist < 8.0f)
|
||||
return true;
|
||||
}else{
|
||||
if(dist < 0.0f && dist > -8.0f)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(vehicle->m_status == STATUS_PHYSICS){
|
||||
node = vehicle->AutoPilot.m_nPreviousPathNodeInfo;
|
||||
type = ThePaths.m_carPathLinks[node].trafficLightType;
|
||||
if(type){
|
||||
if((type & SOME_FLAG || ThePaths.m_carPathLinks[node].pathNodeIndex == vehicle->AutoPilot.m_nPrevRouteNode) &&
|
||||
(!(type & SOME_FLAG) || ThePaths.m_carPathLinks[node].pathNodeIndex != vehicle->AutoPilot.m_nPrevRouteNode))
|
||||
if(alwaysStop ||
|
||||
(type&~SOME_FLAG) == 1 && LightForCars1() != CAR_LIGHTS_GREEN ||
|
||||
(type&~SOME_FLAG) == 2 && LightForCars2() != CAR_LIGHTS_GREEN){
|
||||
float dist = DotProduct2D(CVector2D(vehicle->GetPosition()) - ThePaths.m_carPathLinks[node].pos,
|
||||
ThePaths.m_carPathLinks[node].dir);
|
||||
if(vehicle->AutoPilot.m_nPreviousDirection == -1){
|
||||
if(dist > 0.0f && dist < 6.0f)
|
||||
return true;
|
||||
}else{
|
||||
if(dist < 0.0f && dist > -6.0f)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
CTrafficLights::ShouldCarStopForBridge(CVehicle *vehicle)
|
||||
{
|
||||
return ThePaths.m_carPathLinks[vehicle->AutoPilot.m_nNextPathNodeInfo].bBridgeLights &&
|
||||
!ThePaths.m_carPathLinks[vehicle->AutoPilot.m_nCurrentPathNodeInfo].bBridgeLights;
|
||||
}
|
||||
|
||||
int
|
||||
CTrafficLights::FindTrafficLightType(CEntity *light)
|
||||
{
|
||||
float orientation = RADTODEG(CGeneral::GetATanOfXY(light->GetForward().x, light->GetForward().y));
|
||||
if((orientation > 60.0f && orientation < 60.0f + 90.0f) ||
|
||||
(orientation > 240.0f && orientation < 240.0f + 90.0f))
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
|
||||
uint8
|
||||
CTrafficLights::LightForPeds(void)
|
||||
{
|
||||
uint32 period = CTimer::GetTimeInMilliseconds() & 0x3FFF; // Equals to % 16384
|
||||
uint32 period = CTimer::GetTimeInMilliseconds() % 16384;
|
||||
|
||||
if (period >= 15384)
|
||||
return PED_LIGHTS_WALK_BLINK;
|
||||
else if (period >= 12000)
|
||||
if(period < 12000)
|
||||
return PED_LIGHTS_DONT_WALK;
|
||||
else if(period < 16384 - 1000)
|
||||
return PED_LIGHTS_WALK;
|
||||
else
|
||||
return PED_LIGHTS_DONT_WALK;
|
||||
return PED_LIGHTS_WALK_BLINK;
|
||||
}
|
||||
|
||||
uint8
|
||||
CTrafficLights::LightForCars1(void)
|
||||
{
|
||||
uint32 period = CTimer::GetTimeInMilliseconds() % 16384;
|
||||
|
||||
if(period < 5000)
|
||||
return CAR_LIGHTS_GREEN;
|
||||
else if(period < 5000 + 1000)
|
||||
return CAR_LIGHTS_YELLOW;
|
||||
else
|
||||
return CAR_LIGHTS_RED;
|
||||
}
|
||||
|
||||
uint8
|
||||
CTrafficLights::LightForCars2(void)
|
||||
{
|
||||
uint32 period = CTimer::GetTimeInMilliseconds() % 16384;
|
||||
|
||||
if(period < 6000)
|
||||
return CAR_LIGHTS_RED;
|
||||
else if(period < 12000 - 1000)
|
||||
return CAR_LIGHTS_GREEN;
|
||||
else if(period < 12000)
|
||||
return CAR_LIGHTS_YELLOW;
|
||||
else
|
||||
return CAR_LIGHTS_RED;
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x455760, &CTrafficLights::LightForCars1, PATCH_JUMP);
|
||||
InjectHook(0x455790, &CTrafficLights::LightForCars2, PATCH_JUMP);
|
||||
InjectHook(0x4557D0, &CTrafficLights::LightForPeds, PATCH_JUMP);
|
||||
ENDPATCHES
|
||||
|
@ -7,6 +7,10 @@ enum {
|
||||
PED_LIGHTS_WALK,
|
||||
PED_LIGHTS_WALK_BLINK,
|
||||
PED_LIGHTS_DONT_WALK,
|
||||
|
||||
CAR_LIGHTS_GREEN = 0,
|
||||
CAR_LIGHTS_YELLOW,
|
||||
CAR_LIGHTS_RED
|
||||
};
|
||||
|
||||
class CTrafficLights
|
||||
@ -14,7 +18,10 @@ class CTrafficLights
|
||||
public:
|
||||
static void DisplayActualLight(CEntity *ent);
|
||||
static void ScanForLightsOnMap(void);
|
||||
static int FindTrafficLightType(CEntity *light);
|
||||
static uint8 LightForPeds(void);
|
||||
static uint8 LightForCars1(void);
|
||||
static uint8 LightForCars2(void);
|
||||
static bool ShouldCarStopForLight(CVehicle*, bool);
|
||||
static bool ShouldCarStopForBridge(CVehicle*);
|
||||
};
|
||||
|
@ -3511,7 +3511,7 @@ CCam::Process_FlyBy(const CVector&, float, float, float)
|
||||
|
||||
Up = CVector(0.0f, 0.0f, 1.0f);
|
||||
if(TheCamera.m_bStartingSpline)
|
||||
m_fTimeElapsedFloat += CTimer::GetTimeStepInMilliseconds();
|
||||
m_fTimeElapsedFloat += CTimer::GetTimeStepNonClippedInMilliseconds();
|
||||
else{
|
||||
m_fTimeElapsedFloat = 0.0f;
|
||||
m_uiFinishTime = MS(TheCamera.m_arrPathArray[2].m_arr_PathData[10*((int)TheCamera.m_arrPathArray[2].m_arr_PathData[0]-1) + 1]);
|
||||
@ -4672,15 +4672,15 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
||||
else {
|
||||
switch ((int)TheCamera.CarZoomIndicator) {
|
||||
// near
|
||||
case 1:
|
||||
case CAM_ZOOM_1:
|
||||
zoomModeAlphaOffset = ZmOneAlphaOffsetLCS[alphaArrPos];
|
||||
break;
|
||||
// mid
|
||||
case 2:
|
||||
case CAM_ZOOM_2:
|
||||
zoomModeAlphaOffset = ZmTwoAlphaOffsetLCS[alphaArrPos];
|
||||
break;
|
||||
// far
|
||||
case 3:
|
||||
case CAM_ZOOM_3:
|
||||
zoomModeAlphaOffset = ZmThreeAlphaOffsetLCS[alphaArrPos];
|
||||
break;
|
||||
default:
|
||||
@ -4705,14 +4705,12 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
||||
}
|
||||
} else {
|
||||
// 0.6f = fTestShiftHeliCamTarget
|
||||
TargetCoors.x += 0.6f * car->GetUp().x * colMaxZ;
|
||||
TargetCoors.y += 0.6f * car->GetUp().y * colMaxZ;
|
||||
TargetCoors.z += 0.6f * car->GetUp().z * colMaxZ;
|
||||
TargetCoors += 0.6f * car->GetUp() * colMaxZ;
|
||||
}
|
||||
|
||||
float minDistForVehType = CARCAM_SET[camSetArrPos][4];
|
||||
|
||||
if ((int)TheCamera.CarZoomIndicator == 1 && (camSetArrPos < 2 || camSetArrPos == 7)) {
|
||||
if (TheCamera.CarZoomIndicator == CAM_ZOOM_1 && (camSetArrPos < 2 || camSetArrPos == 7)) {
|
||||
minDistForVehType = minDistForVehType * 0.65f;
|
||||
}
|
||||
|
||||
@ -4904,8 +4902,8 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
||||
// yMovement = 0.0;
|
||||
|
||||
if (!nextDirectionIsForward) {
|
||||
yMovement = 0.0;
|
||||
xMovement = 0.0;
|
||||
yMovement = 0.0f;
|
||||
xMovement = 0.0f;
|
||||
}
|
||||
|
||||
if (camSetArrPos == 0 || camSetArrPos == 7) {
|
||||
|
@ -124,8 +124,8 @@ CCamera::Init(void)
|
||||
m_WideScreenOn = false;
|
||||
m_fFOV_Wide_Screen = 0.0f;
|
||||
m_bRestoreByJumpCut = false;
|
||||
CarZoomIndicator = 2.0f;
|
||||
PedZoomIndicator = 2.0f;
|
||||
CarZoomIndicator = CAM_ZOOM_2;
|
||||
PedZoomIndicator = CAM_ZOOM_2;
|
||||
CarZoomValueSmooth = 0.0f;
|
||||
m_fPedZoomValueSmooth = 0.0f;
|
||||
pTargetEntity = nil;
|
||||
@ -142,7 +142,7 @@ CCamera::Init(void)
|
||||
PlayerExhaustion = 1.0f;
|
||||
DebugCamMode = CCam::MODE_NONE;
|
||||
m_PedOrientForBehindOrInFront = 0.0f;
|
||||
if(!FrontEndMenuManager.m_bStartGameLoading){
|
||||
if(!FrontEndMenuManager.m_bWantToRestart){
|
||||
m_bFading = false;
|
||||
CDraw::FadeValue = 0;
|
||||
m_fFLOATingFade = 0.0f;
|
||||
@ -151,7 +151,7 @@ CCamera::Init(void)
|
||||
m_fFLOATingFadeMusic = 0.0f;
|
||||
}
|
||||
m_bMoveCamToAvoidGeom = false;
|
||||
if(FrontEndMenuManager.m_bStartGameLoading)
|
||||
if(FrontEndMenuManager.m_bWantToRestart)
|
||||
m_bMoveCamToAvoidGeom = true;
|
||||
m_bStartingSpline = false;
|
||||
m_iTypeOfSwitch = INTERPOLATION;
|
||||
@ -623,11 +623,11 @@ CCamera::CamControl(void)
|
||||
if(CPad::GetPad(0)->CycleCameraModeUpJustDown() && !CReplay::IsPlayingBack() &&
|
||||
(m_bLookingAtPlayer || WhoIsInControlOfTheCamera == CAMCONTROL_OBBE) &&
|
||||
!m_WideScreenOn)
|
||||
CarZoomIndicator -= 1.0f;
|
||||
CarZoomIndicator--;
|
||||
if(CPad::GetPad(0)->CycleCameraModeDownJustDown() && !CReplay::IsPlayingBack() &&
|
||||
(m_bLookingAtPlayer || WhoIsInControlOfTheCamera == CAMCONTROL_OBBE) &&
|
||||
!m_WideScreenOn)
|
||||
CarZoomIndicator += 1.0f;
|
||||
CarZoomIndicator++;
|
||||
if(!m_bFailedCullZoneTestPreviously){
|
||||
if(CarZoomIndicator < CAM_ZOOM_1STPRS) CarZoomIndicator = CAM_ZOOM_CINEMATIC;
|
||||
else if(CarZoomIndicator > CAM_ZOOM_CINEMATIC) CarZoomIndicator = CAM_ZOOM_1STPRS;
|
||||
@ -727,12 +727,24 @@ CCamera::CamControl(void)
|
||||
if(CarZoomIndicator == CAM_ZOOM_1STPRS && !m_bPlayerIsInGarage){
|
||||
CarZoomValue = 0.0f;
|
||||
ReqMode = CCam::MODE_1STPERSON;
|
||||
}else if(CarZoomIndicator == CAM_ZOOM_1)
|
||||
CarZoomValue = 0.05f;
|
||||
}
|
||||
#ifdef FREE_CAM
|
||||
else if (bFreeCam) {
|
||||
if (CarZoomIndicator == CAM_ZOOM_1)
|
||||
CarZoomValue = ((CVehicle*)pTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_1 : FREE_CAR_ZOOM_VALUE_1;
|
||||
else if (CarZoomIndicator == CAM_ZOOM_2)
|
||||
CarZoomValue = ((CVehicle*)pTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_2 : FREE_CAR_ZOOM_VALUE_2;
|
||||
else if (CarZoomIndicator == CAM_ZOOM_3)
|
||||
CarZoomValue = ((CVehicle*)pTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_3 : FREE_CAR_ZOOM_VALUE_3;
|
||||
}
|
||||
#endif
|
||||
else if(CarZoomIndicator == CAM_ZOOM_1)
|
||||
CarZoomValue = DEFAULT_CAR_ZOOM_VALUE_1;
|
||||
else if(CarZoomIndicator == CAM_ZOOM_2)
|
||||
CarZoomValue = 1.9f;
|
||||
CarZoomValue = DEFAULT_CAR_ZOOM_VALUE_2;
|
||||
else if(CarZoomIndicator == CAM_ZOOM_3)
|
||||
CarZoomValue = 3.9f;
|
||||
CarZoomValue = DEFAULT_CAR_ZOOM_VALUE_3;
|
||||
|
||||
if(CarZoomIndicator == CAM_ZOOM_TOPDOWN && !m_bPlayerIsInGarage){
|
||||
CarZoomValue = 1.0f;
|
||||
ReqMode = CCam::MODE_TOPDOWN;
|
||||
@ -800,7 +812,7 @@ CCamera::CamControl(void)
|
||||
else
|
||||
PedZoomIndicator = CAM_ZOOM_TOPDOWN;
|
||||
}else
|
||||
PedZoomIndicator -= 1.0f;
|
||||
PedZoomIndicator--;
|
||||
}
|
||||
if(CPad::GetPad(0)->CycleCameraModeDownJustDown() && !CReplay::IsPlayingBack() &&
|
||||
(m_bLookingAtPlayer || WhoIsInControlOfTheCamera == CAMCONTROL_OBBE) &&
|
||||
@ -811,7 +823,7 @@ CCamera::CamControl(void)
|
||||
else
|
||||
PedZoomIndicator = CAM_ZOOM_TOPDOWN;
|
||||
}else
|
||||
PedZoomIndicator += 1.0f;
|
||||
PedZoomIndicator++;
|
||||
}
|
||||
// disabled obbe's cam here
|
||||
if(PedZoomIndicator < CAM_ZOOM_1) PedZoomIndicator = CAM_ZOOM_TOPDOWN;
|
||||
@ -1211,7 +1223,7 @@ CCamera::CamControl(void)
|
||||
ReqMode == CCam::MODE_1STPERSON_RUNABOUT || ReqMode == CCam::MODE_M16_1STPERSON_RUNABOUT ||
|
||||
ReqMode == CCam::MODE_FIGHT_CAM_RUNABOUT || ReqMode == CCam::MODE_HELICANNON_1STPERSON ||
|
||||
WhoIsInControlOfTheCamera == CAMCONTROL_SCRIPT ||
|
||||
m_bJustCameOutOfGarage || m_bPlayerIsInGarage)
|
||||
m_bJustCameOutOfGarage || m_bPlayerIsInGarage)
|
||||
canUseObbeCam = false;
|
||||
|
||||
if(m_bObbeCinematicPedCamOn && canUseObbeCam)
|
||||
@ -1512,7 +1524,7 @@ CCamera::UpdateTargetEntity(void)
|
||||
cantOpen = false;
|
||||
|
||||
if(PLAYER->GetPedState() == PED_ENTER_CAR && !cantOpen){
|
||||
if(!enteringCar && CarZoomIndicator != 0.0f){
|
||||
if(!enteringCar && CarZoomIndicator != CAM_ZOOM_1STPRS){
|
||||
pTargetEntity = PLAYER->m_pMyVehicle;
|
||||
if(PLAYER->m_pMyVehicle == nil)
|
||||
pTargetEntity = PLAYER;
|
||||
@ -1520,7 +1532,7 @@ CCamera::UpdateTargetEntity(void)
|
||||
}
|
||||
|
||||
if((PLAYER->GetPedState() == PED_CARJACK || PLAYER->GetPedState() == PED_OPEN_DOOR) && !cantOpen){
|
||||
if(!enteringCar && CarZoomIndicator != 0.0f)
|
||||
if(!enteringCar && CarZoomIndicator != CAM_ZOOM_1STPRS)
|
||||
#ifdef GTA_PS2_STUFF
|
||||
// dunno if this has any amazing effects
|
||||
{
|
||||
@ -1537,7 +1549,7 @@ CCamera::UpdateTargetEntity(void)
|
||||
pTargetEntity = FindPlayerPed();
|
||||
if(PLAYER->GetPedState() == PED_DRAG_FROM_CAR)
|
||||
pTargetEntity = FindPlayerPed();
|
||||
if(pTargetEntity->IsVehicle() && CarZoomIndicator != 0.0f && FindPlayerPed()->GetPedState() == PED_ARRESTED)
|
||||
if(pTargetEntity->IsVehicle() && CarZoomIndicator != CAM_ZOOM_1STPRS && FindPlayerPed()->GetPedState() == PED_ARRESTED)
|
||||
pTargetEntity = FindPlayerPed();
|
||||
}
|
||||
}
|
||||
@ -2956,11 +2968,23 @@ CCamera::SetZoomValueFollowPedScript(int16 dist)
|
||||
void
|
||||
CCamera::SetZoomValueCamStringScript(int16 dist)
|
||||
{
|
||||
switch (dist) {
|
||||
case 0: m_fCarZoomValueScript = 0.05f; break;
|
||||
case 1: m_fCarZoomValueScript = 1.9f; break;
|
||||
case 2: m_fCarZoomValueScript = 3.9f; break;
|
||||
default: m_fCarZoomValueScript = m_fCarZoomValueScript; break;
|
||||
#ifdef FREE_CAM
|
||||
if (bFreeCam) {
|
||||
switch (dist) {
|
||||
case 0: m_fCarZoomValueScript = ((CVehicle*)Cams[ActiveCam].CamTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_1 : FREE_CAR_ZOOM_VALUE_1; break;
|
||||
case 1: m_fCarZoomValueScript = ((CVehicle*)Cams[ActiveCam].CamTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_2 : FREE_CAR_ZOOM_VALUE_2; break;
|
||||
case 2: m_fCarZoomValueScript = ((CVehicle*)Cams[ActiveCam].CamTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_3 : FREE_CAR_ZOOM_VALUE_3; break;
|
||||
default: m_fCarZoomValueScript = m_fCarZoomValueScript; break;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
switch (dist) {
|
||||
case 0: m_fCarZoomValueScript = DEFAULT_CAR_ZOOM_VALUE_1; break;
|
||||
case 1: m_fCarZoomValueScript = DEFAULT_CAR_ZOOM_VALUE_2; break;
|
||||
case 2: m_fCarZoomValueScript = DEFAULT_CAR_ZOOM_VALUE_3; break;
|
||||
default: m_fCarZoomValueScript = m_fCarZoomValueScript; break;
|
||||
}
|
||||
}
|
||||
|
||||
m_bUseScriptZoomValueCar = true;
|
||||
@ -3245,7 +3269,7 @@ void
|
||||
CCamera::SetRwCamera(RwCamera *cam)
|
||||
{
|
||||
m_pRwCamera = cam;
|
||||
m_viewMatrix.Attach(&m_pRwCamera->viewMatrix, false);
|
||||
m_viewMatrix.Attach(RwCameraGetViewMatrix(m_pRwCamera), false);
|
||||
CMBlur::MotionBlurOpen(m_pRwCamera);
|
||||
}
|
||||
|
||||
|
@ -16,12 +16,29 @@ enum
|
||||
};
|
||||
|
||||
#define DEFAULT_NEAR (0.9f)
|
||||
#define CAM_ZOOM_1STPRS (0.0f)
|
||||
#define CAM_ZOOM_1 (1.0f)
|
||||
#define CAM_ZOOM_2 (2.0f)
|
||||
#define CAM_ZOOM_3 (3.0f)
|
||||
#define CAM_ZOOM_TOPDOWN (4.0f)
|
||||
#define CAM_ZOOM_CINEMATIC (5.0f)
|
||||
enum
|
||||
{
|
||||
CAM_ZOOM_1STPRS,
|
||||
CAM_ZOOM_1,
|
||||
CAM_ZOOM_2,
|
||||
CAM_ZOOM_3,
|
||||
CAM_ZOOM_TOPDOWN,
|
||||
CAM_ZOOM_CINEMATIC,
|
||||
};
|
||||
|
||||
#ifdef FREE_CAM // LCS values
|
||||
#define FREE_CAR_ZOOM_VALUE_1 (-1.0f)
|
||||
#define FREE_CAR_ZOOM_VALUE_2 (2.0f)
|
||||
#define FREE_CAR_ZOOM_VALUE_3 (6.0f)
|
||||
|
||||
#define FREE_BOAT_ZOOM_VALUE_1 (-2.41f)
|
||||
#define FREE_BOAT_ZOOM_VALUE_2 (6.49f)
|
||||
#define FREE_BOAT_ZOOM_VALUE_3 (15.0f)
|
||||
#endif
|
||||
|
||||
#define DEFAULT_CAR_ZOOM_VALUE_1 (0.05f)
|
||||
#define DEFAULT_CAR_ZOOM_VALUE_2 (1.9f)
|
||||
#define DEFAULT_CAR_ZOOM_VALUE_3 (3.9f)
|
||||
|
||||
class CCam
|
||||
{
|
||||
@ -398,7 +415,11 @@ uint32 unknown; // some counter having to do with music
|
||||
|
||||
float CamFrontXNorm;
|
||||
float CamFrontYNorm;
|
||||
#if 0 // TODO: FIX_BUGS once GenericLoad is done
|
||||
int32 CarZoomIndicator;
|
||||
#else
|
||||
float CarZoomIndicator;
|
||||
#endif
|
||||
float CarZoomValue;
|
||||
float CarZoomValueSmooth;
|
||||
|
||||
@ -434,7 +455,11 @@ uint32 unknown; // some counter having to do with music
|
||||
float m_ScreenReductionSpeed;
|
||||
float m_AlphaForPlayerAnim1rstPerson;
|
||||
float Orientation;
|
||||
#if 0 // TODO: FIX_BUGS once GenericLoad is done
|
||||
int32 PedZoomIndicator;
|
||||
#else
|
||||
float PedZoomIndicator;
|
||||
#endif
|
||||
float PlayerExhaustion;
|
||||
float SoundDistUp, SoundDistLeft, SoundDistRight;
|
||||
float SoundDistUpAsRead, SoundDistLeftAsRead, SoundDistRightAsRead;
|
||||
|
@ -34,8 +34,6 @@ enum Direction
|
||||
eLevelName &CCollision::ms_collisionInMemory = *(eLevelName*)0x8F6250;
|
||||
CLinkList<CColModel*> &CCollision::ms_colModelCache = *(CLinkList<CColModel*>*)0x95CB58;
|
||||
|
||||
WRAPPER bool CCollision::IsStoredPolyStillValidVerticalLine(const CVector &pos, float z, CColPoint &point, CStoredCollPoly *poly) { EAXJMP(0x4105A0); }
|
||||
|
||||
void
|
||||
CCollision::Init(void)
|
||||
{
|
||||
@ -926,6 +924,87 @@ CCollision::ProcessVerticalLineTriangle(const CColLine &line,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CCollision::IsStoredPolyStillValidVerticalLine(const CVector &pos, float z, CColPoint &point, CStoredCollPoly *poly)
|
||||
{
|
||||
float t;
|
||||
|
||||
if(!poly->valid)
|
||||
return false;
|
||||
|
||||
// maybe inlined?
|
||||
CColTriangle tri;
|
||||
tri.a = 0;
|
||||
tri.b = 1;
|
||||
tri.c = 2;
|
||||
CColTrianglePlane plane;
|
||||
plane.Set(poly->verts, tri);
|
||||
|
||||
const CVector &va = poly->verts[tri.a];
|
||||
const CVector &vb = poly->verts[tri.b];
|
||||
const CVector &vc = poly->verts[tri.c];
|
||||
CVector p0 = pos;
|
||||
CVector p1(pos.x, pos.y, z);
|
||||
|
||||
// The rest is pretty much CCollision::ProcessLineTriangle
|
||||
|
||||
// if points are on the same side, no collision
|
||||
if(plane.CalcPoint(p0) * plane.CalcPoint(p1) > 0.0f)
|
||||
return poly->valid = false;
|
||||
|
||||
// intersection parameter on line
|
||||
t = -plane.CalcPoint(p0) / DotProduct(p1 - p0, plane.normal);
|
||||
// find point of intersection
|
||||
CVector p = p0 + (p1-p0)*t;
|
||||
|
||||
CVector2D vec1, vec2, vec3, vect;
|
||||
switch(plane.dir){
|
||||
case DIR_X_POS:
|
||||
vec1.x = va.y; vec1.y = va.z;
|
||||
vec2.x = vc.y; vec2.y = vc.z;
|
||||
vec3.x = vb.y; vec3.y = vb.z;
|
||||
vect.x = p.y; vect.y = p.z;
|
||||
break;
|
||||
case DIR_X_NEG:
|
||||
vec1.x = va.y; vec1.y = va.z;
|
||||
vec2.x = vb.y; vec2.y = vb.z;
|
||||
vec3.x = vc.y; vec3.y = vc.z;
|
||||
vect.x = p.y; vect.y = p.z;
|
||||
break;
|
||||
case DIR_Y_POS:
|
||||
vec1.x = va.z; vec1.y = va.x;
|
||||
vec2.x = vc.z; vec2.y = vc.x;
|
||||
vec3.x = vb.z; vec3.y = vb.x;
|
||||
vect.x = p.z; vect.y = p.x;
|
||||
break;
|
||||
case DIR_Y_NEG:
|
||||
vec1.x = va.z; vec1.y = va.x;
|
||||
vec2.x = vb.z; vec2.y = vb.x;
|
||||
vec3.x = vc.z; vec3.y = vc.x;
|
||||
vect.x = p.z; vect.y = p.x;
|
||||
break;
|
||||
case DIR_Z_POS:
|
||||
vec1.x = va.x; vec1.y = va.y;
|
||||
vec2.x = vc.x; vec2.y = vc.y;
|
||||
vec3.x = vb.x; vec3.y = vb.y;
|
||||
vect.x = p.x; vect.y = p.y;
|
||||
break;
|
||||
case DIR_Z_NEG:
|
||||
vec1.x = va.x; vec1.y = va.y;
|
||||
vec2.x = vb.x; vec2.y = vb.y;
|
||||
vec3.x = vc.x; vec3.y = vc.y;
|
||||
vect.x = p.x; vect.y = p.y;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
if(CrossProduct2D(vec2-vec1, vect-vec1) < 0.0f) return poly->valid = false;
|
||||
if(CrossProduct2D(vec3-vec1, vect-vec1) > 0.0f) return poly->valid = false;
|
||||
if(CrossProduct2D(vec3-vec2, vect-vec2) < 0.0f) return poly->valid = false;
|
||||
point.point = p;
|
||||
return poly->valid = true;
|
||||
}
|
||||
|
||||
bool
|
||||
CCollision::ProcessLineTriangle(const CColLine &line ,
|
||||
const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane,
|
||||
|
@ -144,7 +144,6 @@ public:
|
||||
static bool ProcessLineOfSight(const CColLine &line, const CMatrix &matrix, CColModel &model, CColPoint &point, float &mindist, bool ignoreSeeThrough);
|
||||
static bool ProcessVerticalLine(const CColLine &line, const CMatrix &matrix, CColModel &model, CColPoint &point, float &mindist, bool ignoreSeeThrough, CStoredCollPoly *poly);
|
||||
static int32 ProcessColModels(const CMatrix &matrixA, CColModel &modelA, const CMatrix &matrixB, CColModel &modelB, CColPoint *spherepoints, CColPoint *linepoints, float *linedists);
|
||||
// TODO:
|
||||
static bool IsStoredPolyStillValidVerticalLine(const CVector &pos, float z, CColPoint &point, CStoredCollPoly *poly);
|
||||
|
||||
static float DistToLine(const CVector *l0, const CVector *l1, const CVector *point);
|
||||
|
@ -24,7 +24,7 @@ CDebug::DebugAddText(const char *str)
|
||||
{
|
||||
int32 i = 0;
|
||||
if (*str != '\0') {
|
||||
while (i < MAX_STR_LEN) {
|
||||
while (i < MAX_STR_LEN - 1) {
|
||||
ms_aTextBuffer[ms_nCurrentTextLine][i++] = *(str++);
|
||||
if (*str == '\0')
|
||||
break;
|
||||
|
@ -25,8 +25,6 @@
|
||||
#include "CdStream.h"
|
||||
#include "FileLoader.h"
|
||||
|
||||
WRAPPER void CFileLoader::ReloadPaths(const char *filename) { EAXJMP(0x476DB0); }
|
||||
|
||||
char CFileLoader::ms_line[256];
|
||||
|
||||
const char*
|
||||
@ -311,7 +309,7 @@ CFileLoader::FindRelatedModelInfoCB(RpAtomic *atomic, void *data)
|
||||
int n;
|
||||
RpClump *clump = (RpClump*)data;
|
||||
|
||||
nodename = GetFrameNodeName(RpClumpGetFrame(atomic));
|
||||
nodename = GetFrameNodeName(RpAtomicGetFrame(atomic));
|
||||
GetNameAndLOD(nodename, name, &n);
|
||||
mi = (CSimpleModelInfo*)CModelInfo::GetModelInfo(name, nil);
|
||||
if(mi){
|
||||
@ -1198,6 +1196,165 @@ CFileLoader::LoadMapZones(const char *filename)
|
||||
debug("Finished loading IPL\n");
|
||||
}
|
||||
|
||||
void
|
||||
CFileLoader::ReloadPaths(const char *filename)
|
||||
{
|
||||
enum {
|
||||
NONE,
|
||||
PATH,
|
||||
};
|
||||
char *line;
|
||||
int section = NONE;
|
||||
int id, pathType, pathIndex = -1;
|
||||
char pathTypeStr[20];
|
||||
debug("Reloading paths from %s...\n", filename);
|
||||
|
||||
int fd = CFileMgr::OpenFile(filename, "r");
|
||||
for (line = CFileLoader::LoadLine(fd); line; line = CFileLoader::LoadLine(fd)) {
|
||||
if (*line == '\0' || *line == '#')
|
||||
continue;
|
||||
|
||||
if (section == NONE) {
|
||||
if (strncmp(line, "path", 4) == 0) {
|
||||
section = PATH;
|
||||
ThePaths.AllocatePathFindInfoMem(4500);
|
||||
}
|
||||
} else if (strncmp(line, "end", 3) == 0) {
|
||||
section = NONE;
|
||||
} else {
|
||||
switch (section) {
|
||||
case PATH:
|
||||
if (pathIndex == -1) {
|
||||
id = LoadPathHeader(line, pathTypeStr);
|
||||
if (strncmp(pathTypeStr, "ped", 4) == 0)
|
||||
pathType = 1;
|
||||
else if (strncmp(pathTypeStr, "car", 4) == 0)
|
||||
pathType = 0;
|
||||
pathIndex = 0;
|
||||
} else {
|
||||
if (pathType == 1)
|
||||
LoadPedPathNode(line, id, pathIndex);
|
||||
else if (pathType == 0)
|
||||
LoadCarPathNode(line, id, pathIndex);
|
||||
pathIndex++;
|
||||
if (pathIndex == 12)
|
||||
pathIndex = -1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
CFileMgr::CloseFile(fd);
|
||||
}
|
||||
|
||||
void
|
||||
CFileLoader::ReloadObjectTypes(const char *filename)
|
||||
{
|
||||
enum {
|
||||
NONE,
|
||||
OBJS,
|
||||
TOBJ,
|
||||
TWODFX
|
||||
};
|
||||
char *line;
|
||||
int section = NONE;
|
||||
CModelInfo::ReInit2dEffects();
|
||||
debug("Reloading object types from %s...\n", filename);
|
||||
|
||||
CFileMgr::ChangeDir("\\DATA\\MAPS\\");
|
||||
int fd = CFileMgr::OpenFile(filename, "r");
|
||||
CFileMgr::ChangeDir("\\");
|
||||
for (line = CFileLoader::LoadLine(fd); line; line = CFileLoader::LoadLine(fd)) {
|
||||
if (*line == '\0' || *line == '#')
|
||||
continue;
|
||||
|
||||
if (section == NONE) {
|
||||
if (strncmp(line, "objs", 4) == 0) section = OBJS;
|
||||
else if (strncmp(line, "tobj", 4) == 0) section = TOBJ;
|
||||
else if (strncmp(line, "2dfx", 4) == 0) section = TWODFX;
|
||||
} else if (strncmp(line, "end", 3) == 0) {
|
||||
section = NONE;
|
||||
} else {
|
||||
switch (section) {
|
||||
case OBJS:
|
||||
case TOBJ:
|
||||
ReloadObject(line);
|
||||
break;
|
||||
case TWODFX:
|
||||
Load2dEffect(line);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
CFileMgr::CloseFile(fd);
|
||||
}
|
||||
|
||||
void
|
||||
CFileLoader::ReloadObject(const char *line)
|
||||
{
|
||||
int id, numObjs;
|
||||
char model[24], txd[24];
|
||||
float dist[3];
|
||||
uint32 flags;
|
||||
CSimpleModelInfo *mi;
|
||||
|
||||
if(sscanf(line, "%d %s %s %d", &id, model, txd, &numObjs) != 4)
|
||||
return;
|
||||
|
||||
switch(numObjs){
|
||||
case 1:
|
||||
sscanf(line, "%d %s %s %d %f %d",
|
||||
&id, model, txd, &numObjs, &dist[0], &flags);
|
||||
break;
|
||||
case 2:
|
||||
sscanf(line, "%d %s %s %d %f %f %d",
|
||||
&id, model, txd, &numObjs, &dist[0], &dist[1], &flags);
|
||||
break;
|
||||
case 3:
|
||||
sscanf(line, "%d %s %s %d %f %f %f %d",
|
||||
&id, model, txd, &numObjs, &dist[0], &dist[1], &dist[2], &flags);
|
||||
break;
|
||||
}
|
||||
|
||||
mi = (CSimpleModelInfo*) CModelInfo::GetModelInfo(id);
|
||||
if (
|
||||
#ifdef FIX_BUGS
|
||||
mi &&
|
||||
#endif
|
||||
mi->m_type == MITYPE_SIMPLE && !strcmp(mi->GetName(), model) && mi->m_numAtomics == numObjs) {
|
||||
mi->SetLodDistances(dist);
|
||||
SetModelInfoFlags(mi, flags);
|
||||
} else {
|
||||
printf("Can't reload %s\n", model);
|
||||
}
|
||||
}
|
||||
|
||||
// unused mobile function - crashes
|
||||
void
|
||||
CFileLoader::ReLoadScene(const char *filename)
|
||||
{
|
||||
char *line;
|
||||
CFileMgr::ChangeDir("\\DATA\\");
|
||||
int fd = CFileMgr::OpenFile(filename, "r");
|
||||
CFileMgr::ChangeDir("\\");
|
||||
|
||||
for (line = CFileLoader::LoadLine(fd); line; line = CFileLoader::LoadLine(fd)) {
|
||||
if (*line == '#')
|
||||
continue;
|
||||
|
||||
if (strncmp(line, "EXIT", 9) == 0) // BUG: 9?
|
||||
break;
|
||||
|
||||
if (strncmp(line, "IDE", 3) == 0) {
|
||||
LoadObjectTypes(line + 4);
|
||||
}
|
||||
}
|
||||
CFileMgr::CloseFile(fd);
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x476290, CFileLoader::LoadLevel, PATCH_JUMP);
|
||||
@ -1233,4 +1390,8 @@ STARTPATCHES
|
||||
InjectHook(0x478A90, CFileLoader::LoadCullZone, PATCH_JUMP);
|
||||
|
||||
InjectHook(0x478550, CFileLoader::LoadMapZones, PATCH_JUMP);
|
||||
|
||||
InjectHook(0x476DB0, CFileLoader::ReloadPaths, PATCH_JUMP);
|
||||
InjectHook(0x476F30, CFileLoader::ReloadObjectTypes, PATCH_JUMP);
|
||||
InjectHook(0x4772B0, CFileLoader::ReloadObject, PATCH_JUMP);
|
||||
ENDPATCHES
|
||||
|
@ -43,4 +43,7 @@ public:
|
||||
static void LoadMapZones(const char *filename);
|
||||
|
||||
static void ReloadPaths(const char *filename);
|
||||
static void ReloadObjectTypes(const char *filename);
|
||||
static void ReloadObject(const char *line);
|
||||
static void ReLoadScene(const char *filename); // unused mobile function
|
||||
};
|
||||
|
1881
src/core/FrontEndControls.cpp
Normal file
1881
src/core/FrontEndControls.cpp
Normal file
File diff suppressed because it is too large
Load Diff
712
src/core/FrontEndControls.h
Normal file
712
src/core/FrontEndControls.h
Normal file
@ -0,0 +1,712 @@
|
||||
#pragma once
|
||||
|
||||
enum {
|
||||
NUM_MULTICHOICE_OPTIONS = 16,
|
||||
// 50 actual lines and 15 for spacing
|
||||
NUM_LINELISTER_LINES = 50,
|
||||
NUM_LINELISTER_LINES_TOTAL = NUM_LINELISTER_LINES + 15,
|
||||
NUM_PAGE_WIDGETS = 10,
|
||||
};
|
||||
|
||||
|
||||
class CPlaceableText
|
||||
{
|
||||
public:
|
||||
CVector2D m_position;
|
||||
CRGBA m_color;
|
||||
wchar *m_text;
|
||||
|
||||
CPlaceableText(void)
|
||||
: m_position(0.0f, 0.0f), m_color(255, 255, 255, 255) {}
|
||||
void SetPosition(float x, float y) { m_position.x = x; m_position.y = y; }
|
||||
void SetColor(const CRGBA &color) { m_color = color; }
|
||||
CRGBA GetColor(void) { return m_color; }
|
||||
void SetAlpha(uint8 alpha) { m_color.alpha = alpha; }
|
||||
};
|
||||
|
||||
// No trace of this in the game but it makes the other classes simpler
|
||||
class CPlaceableTextTwoLines
|
||||
{
|
||||
public:
|
||||
CPlaceableText m_line1;
|
||||
CPlaceableText m_line2;
|
||||
|
||||
void SetColor(const CRGBA &color) { m_line1.SetColor(color); m_line2.SetColor(color); }
|
||||
void SetAlpha(uint8 alpha) { m_line1.SetAlpha(alpha); m_line2.SetAlpha(alpha); }
|
||||
};
|
||||
|
||||
// No trace of this in the game but it makes the other classes simpler
|
||||
class CShadowInfo
|
||||
{
|
||||
public:
|
||||
bool m_bRightJustify;
|
||||
bool m_bDropShadow;
|
||||
CRGBA m_shadowColor;
|
||||
CVector2D m_shadowOffset;
|
||||
|
||||
CShadowInfo(void)
|
||||
: m_bRightJustify(false), m_bDropShadow(false),
|
||||
m_shadowColor(255, 255, 255, 255),
|
||||
m_shadowOffset(-1.0f, -1.0f) {}
|
||||
CRGBA GetShadowColor(void) { return m_shadowColor; }
|
||||
void SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset){
|
||||
m_bDropShadow = bDropShadows;
|
||||
m_shadowColor = shadowColor;
|
||||
m_shadowOffset = shadowOffset;
|
||||
}
|
||||
};
|
||||
|
||||
// No trace of this in the game but it makes the other classes simpler
|
||||
class CSelectable
|
||||
{
|
||||
public:
|
||||
bool m_bSelected;
|
||||
CRGBA m_selectedColor;
|
||||
|
||||
CSelectable(void) : m_bSelected(false) {}
|
||||
CRGBA GetSelectedColor(void) { return m_selectedColor; }
|
||||
};
|
||||
|
||||
class CPlaceableShText : public CPlaceableText, public CShadowInfo
|
||||
{
|
||||
public:
|
||||
using CPlaceableText::SetPosition;
|
||||
void SetPosition(float x, float y, bool bRightJustify) { SetPosition(x, y); m_bRightJustify = bRightJustify; }
|
||||
void SetAlpha(uint8 alpha) { m_shadowColor.alpha = alpha; CPlaceableText::SetAlpha(alpha); }
|
||||
|
||||
void Draw(float x, float y);
|
||||
void Draw(const CRGBA &color, float x, float y);
|
||||
// unused arguments it seems
|
||||
void DrawShWrap(float x, float y, float wrapX, float wrapY) { Draw(x, y); }
|
||||
};
|
||||
|
||||
class CPlaceableShTextTwoLines : public CPlaceableTextTwoLines, public CShadowInfo
|
||||
{
|
||||
public:
|
||||
void SetAlpha(uint8 alpha) { m_shadowColor.alpha = alpha; CPlaceableTextTwoLines::SetAlpha(alpha); }
|
||||
|
||||
void Draw(float x, float y);
|
||||
void Draw(const CRGBA &color, float x, float y);
|
||||
};
|
||||
|
||||
class CPlaceableShOption : public CPlaceableShText, public CSelectable
|
||||
{
|
||||
public:
|
||||
void SetColors(const CRGBA &normal, const CRGBA &selection) { CPlaceableShText::SetColor(normal); m_selectedColor = selection; }
|
||||
void SetAlpha(uint8 alpha) { m_selectedColor.alpha = alpha; CPlaceableShText::SetAlpha(alpha); }
|
||||
|
||||
using CPlaceableShText::Draw;
|
||||
void Draw(const CRGBA &highlightColor, float x, float y, bool bHighlight);
|
||||
};
|
||||
|
||||
class CPlaceableShOptionTwoLines : public CPlaceableShTextTwoLines, public CSelectable
|
||||
{
|
||||
public:
|
||||
void SetColors(const CRGBA &normal, const CRGBA &selection) { CPlaceableShTextTwoLines::SetColor(normal); m_selectedColor = selection; }
|
||||
void SetAlpha(uint8 alpha) { m_selectedColor.alpha = alpha; CPlaceableShTextTwoLines::SetAlpha(alpha); }
|
||||
|
||||
using CPlaceableShTextTwoLines::Draw;
|
||||
void Draw(const CRGBA &highlightColor, float x, float y, bool bHighlight);
|
||||
};
|
||||
|
||||
class CPlaceableSprite
|
||||
{
|
||||
public:
|
||||
CSprite2d *m_pSprite;
|
||||
CVector2D m_position;
|
||||
CVector2D m_size;
|
||||
CRGBA m_color;
|
||||
|
||||
CPlaceableSprite(void)
|
||||
: m_pSprite(nil), m_position(0.0f, 0.0f),
|
||||
m_size(0.0f, 0.0f), m_color(255, 255, 255, 255) {}
|
||||
|
||||
void SetPosition(float x, float y) { m_position.x = x; m_position.y = y; }
|
||||
void SetAlpha(uint8 alpha) { m_color.alpha = alpha; }
|
||||
|
||||
void Draw(float x, float y);
|
||||
void Draw(const CRGBA &color, float x, float y);
|
||||
};
|
||||
|
||||
class CPlaceableShSprite
|
||||
{
|
||||
public:
|
||||
CPlaceableSprite m_sprite;
|
||||
CPlaceableSprite m_shadow;
|
||||
bool m_bDropShadow;
|
||||
|
||||
CPlaceableShSprite(void) : m_bDropShadow(false) {}
|
||||
|
||||
void SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset){
|
||||
m_bDropShadow = bDropShadows;
|
||||
m_shadow.m_color = shadowColor;
|
||||
m_shadow.m_position = shadowOffset;
|
||||
}
|
||||
void SetAlpha(uint8 alpha) { m_sprite.SetAlpha(alpha); m_shadow.SetAlpha(alpha); }
|
||||
|
||||
void Draw(float x, float y);
|
||||
};
|
||||
|
||||
|
||||
class CMenuBase
|
||||
{
|
||||
public:
|
||||
CVector2D m_position;
|
||||
bool m_bTwoState;
|
||||
|
||||
CMenuBase(void)
|
||||
: m_position(0.0f, 0.0f), m_bTwoState(false) {}
|
||||
void SetPosition(float x, float y) { m_position.x = x; m_position.y = y; }
|
||||
|
||||
virtual void Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y) = 0;
|
||||
virtual void DrawNormal(float x, float y) = 0;
|
||||
virtual void DrawHighlighted(const CRGBA &titleHighlight, float x, float y) = 0;
|
||||
virtual void SetAlpha(uint8 alpha) = 0;
|
||||
virtual void SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset) = 0;
|
||||
virtual bool GoNext(void) = 0;
|
||||
virtual bool GoPrev(void) = 0;
|
||||
virtual bool GoDown(void) = 0;
|
||||
virtual bool GoUp(void) = 0;
|
||||
virtual bool GoDownStill(void) = 0;
|
||||
virtual bool GoUpStill(void) = 0;
|
||||
virtual bool GoLeft(void) = 0;
|
||||
virtual bool GoRight(void) = 0;
|
||||
virtual bool GoLeftStill(void) = 0;
|
||||
virtual bool GoRightStill(void) = 0;
|
||||
virtual bool GoFirst(void) = 0;
|
||||
virtual bool GoLast(void) = 0;
|
||||
virtual void SelectCurrentOptionUnderCursor(void) = 0;
|
||||
virtual void SelectDefaultCancelAction(void) = 0;
|
||||
virtual void ActivateMenu(bool first) = 0;
|
||||
virtual void DeactivateMenu(void) = 0;
|
||||
virtual int GetMenuSelection(void) = 0;
|
||||
virtual void SetMenuSelection(int selection) = 0;
|
||||
};
|
||||
|
||||
class CMenuDummy : public CMenuBase
|
||||
{
|
||||
public:
|
||||
bool m_bActive;
|
||||
|
||||
virtual void Draw(const CRGBA &, const CRGBA &, float x, float y) {}
|
||||
virtual void DrawNormal(float x, float y) {}
|
||||
virtual void DrawHighlighted(const CRGBA &, float x, float y) {}
|
||||
virtual void SetAlpha(uint8 alpha) {}
|
||||
virtual void SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset) {}
|
||||
virtual bool GoNext(void) { DeactivateMenu(); return false; }
|
||||
virtual bool GoPrev(void) { DeactivateMenu(); return false; }
|
||||
virtual bool GoDown(void) { return GoNext(); }
|
||||
virtual bool GoUp(void) { return GoPrev(); }
|
||||
virtual bool GoDownStill(void) { return false; }
|
||||
virtual bool GoUpStill(void) { return false; }
|
||||
virtual bool GoLeft(void) { return true; }
|
||||
virtual bool GoRight(void) { return true; }
|
||||
virtual bool GoLeftStill(void) { return true; }
|
||||
virtual bool GoRightStill(void) { return true; }
|
||||
virtual bool GoFirst(void) { ActivateMenu(true); return true; }
|
||||
virtual bool GoLast(void) { ActivateMenu(true); return true; }
|
||||
virtual void SelectCurrentOptionUnderCursor(void) {}
|
||||
virtual void SelectDefaultCancelAction(void) {}
|
||||
virtual void ActivateMenu(bool first) { m_bActive = true; }
|
||||
virtual void DeactivateMenu(void) { m_bActive = false; }
|
||||
virtual int GetMenuSelection(void) { return -1; }
|
||||
virtual void SetMenuSelection(int) {}
|
||||
};
|
||||
|
||||
class CMenuPictureAndText : public CMenuBase
|
||||
{
|
||||
public:
|
||||
int m_numSprites;
|
||||
CPlaceableShSprite m_sprites[5];
|
||||
int m_numTexts;
|
||||
CPlaceableShText m_texts[20];
|
||||
|
||||
CVector2D m_oldTextScale;
|
||||
CVector2D m_textScale;
|
||||
bool m_bSetTextScale;
|
||||
|
||||
float m_wrapX;
|
||||
float m_oldWrapx;
|
||||
bool m_bWrap;
|
||||
// missing some?
|
||||
|
||||
|
||||
CMenuPictureAndText(void)
|
||||
: m_numSprites(0), m_numTexts(0),
|
||||
m_bSetTextScale(false), m_bWrap(false) {}
|
||||
|
||||
void SetNewOldShadowWrapX(bool bWrapX, float newWrapX, float oldWrapX);
|
||||
void SetNewOldTextScale(bool bTextScale, const CVector2D &newScale, const CVector2D &oldScale);
|
||||
void SetTextsColor(const CRGBA &color);
|
||||
void AddText(wchar *text, float positionX, float positionY, const CRGBA &color, bool bRightJustify);
|
||||
void AddPicture(CSprite2d *sprite, CSprite2d *shadow, float positionX, float positionY, float width, float height, const CRGBA &color);
|
||||
void AddPicture(CSprite2d *sprite, float positionX, float positionY, float width, float height, const CRGBA &color);
|
||||
|
||||
virtual void Draw(const CRGBA &, const CRGBA &, float x, float y);
|
||||
virtual void DrawNormal(float x, float y) { Draw(CRGBA(0,0,0,0), CRGBA(0,0,0,0), x, y); }
|
||||
virtual void DrawHighlighted(const CRGBA &, float x, float y) { Draw(CRGBA(0,0,0,0), CRGBA(0,0,0,0), x, y); }
|
||||
virtual void SetAlpha(uint8 alpha);
|
||||
virtual void SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset);
|
||||
virtual bool GoNext(void) { return false; }
|
||||
virtual bool GoPrev(void) { return false; }
|
||||
virtual bool GoDown(void) { return GoNext(); }
|
||||
virtual bool GoUp(void) { return GoPrev(); }
|
||||
virtual bool GoDownStill(void) { return false; }
|
||||
virtual bool GoUpStill(void) { return false; }
|
||||
virtual bool GoLeft(void) { return true; }
|
||||
virtual bool GoRight(void) { return true; }
|
||||
virtual bool GoLeftStill(void) { return true; }
|
||||
virtual bool GoRightStill(void) { return true; }
|
||||
virtual bool GoFirst(void) { return false; }
|
||||
virtual bool GoLast(void) { return false; }
|
||||
virtual void SelectCurrentOptionUnderCursor(void) {}
|
||||
virtual void SelectDefaultCancelAction(void) {}
|
||||
virtual void ActivateMenu(bool first) {}
|
||||
virtual void DeactivateMenu(void) {}
|
||||
virtual int GetMenuSelection(void) { return -1; }
|
||||
virtual void SetMenuSelection(int) {}
|
||||
};
|
||||
|
||||
class CMenuMultiChoice : public CMenuBase
|
||||
{
|
||||
public:
|
||||
int m_numOptions;
|
||||
CPlaceableShText m_title;
|
||||
CPlaceableShOption m_options[NUM_MULTICHOICE_OPTIONS];
|
||||
int m_cursor;
|
||||
CVector2D m_oldTextScale;
|
||||
CVector2D m_textScale;
|
||||
bool m_bSetTextScale;
|
||||
bool m_bSetTitleTextScale;
|
||||
|
||||
CMenuMultiChoice(void)
|
||||
: m_numOptions(0), m_cursor(-1),
|
||||
m_bSetTextScale(false), m_bSetTitleTextScale(false) {}
|
||||
|
||||
void AddTitle(wchar *text, float positionX, float positionY, bool bRightJustify);
|
||||
CPlaceableShOption *AddOption(wchar *text, float positionX, float positionY, bool bSelected, bool bRightJustify);
|
||||
void SetColors(const CRGBA &title, const CRGBA &normal, const CRGBA &selected);
|
||||
void SetNewOldTextScale(bool bTextScale, const CVector2D &newScale, const CVector2D &oldScale, bool bTitleTextScale);
|
||||
|
||||
virtual void Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y);
|
||||
virtual void DrawNormal(float x, float y);
|
||||
virtual void DrawHighlighted(const CRGBA &titleHighlight, float x, float y);
|
||||
virtual void SetAlpha(uint8 alpha);
|
||||
virtual void SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset);
|
||||
virtual bool GoNext(void);
|
||||
virtual bool GoPrev(void);
|
||||
virtual bool GoDown(void) { return GoNext(); }
|
||||
virtual bool GoUp(void) { return GoPrev(); }
|
||||
virtual bool GoDownStill(void) { return false; }
|
||||
virtual bool GoUpStill(void) { return false; }
|
||||
virtual bool GoLeft(void) { return GoPrev(); }
|
||||
virtual bool GoRight(void) { return GoNext(); }
|
||||
virtual bool GoLeftStill(void) { return true; }
|
||||
virtual bool GoRightStill(void) { return true; }
|
||||
virtual bool GoFirst(void) { m_cursor = 0; return true; }
|
||||
virtual bool GoLast(void) { m_cursor = m_numOptions-1; return true; }
|
||||
virtual void SelectCurrentOptionUnderCursor(void);
|
||||
virtual void SelectDefaultCancelAction(void) {}
|
||||
virtual void ActivateMenu(bool first) { m_cursor = first ? 0 : m_numOptions-1; }
|
||||
virtual void DeactivateMenu(void) { m_cursor = -1; }
|
||||
virtual int GetMenuSelection(void);
|
||||
virtual void SetMenuSelection(int selection);
|
||||
};
|
||||
|
||||
class CMenuMultiChoiceTriggered : public CMenuMultiChoice
|
||||
{
|
||||
public:
|
||||
typedef void (*Trigger)(CMenuMultiChoiceTriggered *);
|
||||
|
||||
Trigger m_triggers[NUM_MULTICHOICE_OPTIONS];
|
||||
Trigger m_defaultCancel;
|
||||
|
||||
CMenuMultiChoiceTriggered(void) { Initialise(); }
|
||||
|
||||
void Initialise(void);
|
||||
CPlaceableShOption *AddOption(wchar *text, float positionX, float positionY, Trigger trigger, bool bSelected, bool bRightJustify);
|
||||
|
||||
virtual void SelectCurrentOptionUnderCursor(void);
|
||||
virtual void SelectDefaultCancelAction(void);
|
||||
};
|
||||
|
||||
class CMenuMultiChoiceTriggeredAlways : public CMenuMultiChoiceTriggered
|
||||
{
|
||||
public:
|
||||
Trigger m_alwaysNormalTrigger;
|
||||
Trigger m_alwaysHighlightTrigger;
|
||||
Trigger m_alwaysTrigger;
|
||||
|
||||
CMenuMultiChoiceTriggeredAlways(void)
|
||||
: m_alwaysNormalTrigger(nil), m_alwaysHighlightTrigger(nil), m_alwaysTrigger(nil) {}
|
||||
|
||||
virtual void Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y);
|
||||
virtual void DrawNormal(float x, float y);
|
||||
virtual void DrawHighlighted(const CRGBA &titleHighlight, float x, float y);
|
||||
};
|
||||
|
||||
class CMenuMultiChoicePictured : public CMenuMultiChoice
|
||||
{
|
||||
public:
|
||||
CPlaceableSprite m_sprites[NUM_MULTICHOICE_OPTIONS];
|
||||
bool m_bHasSprite[NUM_MULTICHOICE_OPTIONS];
|
||||
|
||||
CMenuMultiChoicePictured(void) { Initialise(); }
|
||||
void Initialise(void);
|
||||
using CMenuMultiChoice::AddOption;
|
||||
CPlaceableShOption *AddOption(CSprite2d *sprite, float positionX, float positionY, const CVector2D &size, bool bSelected);
|
||||
|
||||
virtual void Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y);
|
||||
virtual void DrawNormal(float x, float y);
|
||||
virtual void DrawHighlighted(const CRGBA &titleHighlight, float x, float y);
|
||||
virtual void SetAlpha(uint8 alpha);
|
||||
// unnecessary - same as base class
|
||||
// virtual void SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset);
|
||||
};
|
||||
|
||||
class CMenuMultiChoicePicturedTriggered : public CMenuMultiChoicePictured
|
||||
{
|
||||
public:
|
||||
typedef void (*Trigger)(CMenuMultiChoicePicturedTriggered *);
|
||||
|
||||
Trigger m_triggers[NUM_MULTICHOICE_OPTIONS];
|
||||
Trigger m_defaultCancel;
|
||||
|
||||
CMenuMultiChoicePicturedTriggered(void) { Initialise(); }
|
||||
|
||||
void Initialise(void);
|
||||
using CMenuMultiChoicePictured::AddOption;
|
||||
CPlaceableShOption *AddOption(CSprite2d *sprite, float positionX, float positionY, const CVector2D &size, Trigger trigger, bool bSelected);
|
||||
|
||||
virtual void SelectCurrentOptionUnderCursor(void);
|
||||
virtual void SelectDefaultCancelAction(void);
|
||||
};
|
||||
|
||||
struct FEC_MOVETAB
|
||||
{
|
||||
int8 right;
|
||||
int8 left;
|
||||
int8 down;
|
||||
int8 up;
|
||||
};
|
||||
|
||||
class CMenuMultiChoicePicturedTriggeredAnyMove : public CMenuMultiChoicePicturedTriggered
|
||||
{
|
||||
public:
|
||||
FEC_MOVETAB m_moveTab[NUM_MULTICHOICE_OPTIONS];
|
||||
|
||||
CMenuMultiChoicePicturedTriggeredAnyMove(void) { Initialise(); }
|
||||
|
||||
void Initialise(void);
|
||||
using CMenuMultiChoicePicturedTriggered::AddOption;
|
||||
CPlaceableShOption *AddOption(CSprite2d *sprite, FEC_MOVETAB *moveTab, float positionX, float positionY, const CVector2D &size, Trigger trigger, bool bSelected);
|
||||
|
||||
virtual bool GoDown(void);
|
||||
virtual bool GoUp(void);
|
||||
virtual bool GoLeft(void);
|
||||
virtual bool GoRight(void);
|
||||
};
|
||||
|
||||
// copy of CMenuMultiChoice pretty much except for m_options type
|
||||
class CMenuMultiChoiceTwoLines : public CMenuBase
|
||||
{
|
||||
public:
|
||||
int m_numOptions;
|
||||
CPlaceableShText m_title;
|
||||
CPlaceableShOptionTwoLines m_options[NUM_MULTICHOICE_OPTIONS];
|
||||
int m_cursor;
|
||||
CVector2D m_oldTextScale;
|
||||
CVector2D m_textScale;
|
||||
bool m_bSetTextScale;
|
||||
bool m_bSetTitleTextScale;
|
||||
|
||||
CMenuMultiChoiceTwoLines(void)
|
||||
: m_numOptions(0), m_cursor(-1),
|
||||
m_bSetTextScale(false), m_bSetTitleTextScale(false) {}
|
||||
|
||||
void AddTitle(wchar *text, float positionX, float positionY, bool bRightJustify);
|
||||
CPlaceableShOptionTwoLines *AddOption(wchar *text, float positionX, float positionY, bool bSelected, bool bRightJustify);
|
||||
CPlaceableShOptionTwoLines *AddOption(wchar *text1, float positionX1, float positionY1, wchar *text2, float positionX2, float positionY2, bool bSelected, bool bRightJustify);
|
||||
void SetColors(const CRGBA &title, const CRGBA &normal, const CRGBA &selected);
|
||||
void SetNewOldTextScale(bool bTextScale, const CVector2D &newScale, const CVector2D &oldScale, bool bTitleTextScale);
|
||||
|
||||
virtual void Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y);
|
||||
virtual void DrawNormal(float x, float y);
|
||||
virtual void DrawHighlighted(const CRGBA &titleHighlight, float x, float y);
|
||||
virtual void SetAlpha(uint8 alpha);
|
||||
virtual void SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset);
|
||||
virtual bool GoNext(void);
|
||||
virtual bool GoPrev(void);
|
||||
virtual bool GoDown(void) { return GoNext(); }
|
||||
virtual bool GoUp(void) { return GoPrev(); }
|
||||
virtual bool GoDownStill(void) { return true; }
|
||||
virtual bool GoUpStill(void) { return true; }
|
||||
virtual bool GoLeft(void) { return GoPrev(); }
|
||||
virtual bool GoRight(void) { return GoNext(); }
|
||||
virtual bool GoLeftStill(void) { return true; }
|
||||
virtual bool GoRightStill(void) { return true; }
|
||||
virtual bool GoFirst(void) { m_cursor = 0; return true; }
|
||||
virtual bool GoLast(void) { m_cursor = m_numOptions-1; return true; }
|
||||
virtual void SelectCurrentOptionUnderCursor(void);
|
||||
virtual void SelectDefaultCancelAction(void) {}
|
||||
virtual void ActivateMenu(bool first) { m_cursor = first ? 0 : m_numOptions-1; }
|
||||
virtual void DeactivateMenu(void) { m_cursor = -1; }
|
||||
virtual int GetMenuSelection(void);
|
||||
virtual void SetMenuSelection(int selection);
|
||||
};
|
||||
|
||||
// copy of CMenuMultiChoiceTriggered except for m_options
|
||||
class CMenuMultiChoiceTwoLinesTriggered : public CMenuMultiChoiceTwoLines
|
||||
{
|
||||
public:
|
||||
typedef void (*Trigger)(CMenuMultiChoiceTwoLinesTriggered *);
|
||||
|
||||
Trigger m_triggers[NUM_MULTICHOICE_OPTIONS];
|
||||
Trigger m_defaultCancel;
|
||||
|
||||
CMenuMultiChoiceTwoLinesTriggered(void) { Initialise(); }
|
||||
|
||||
void Initialise(void);
|
||||
CPlaceableShOptionTwoLines *AddOption(wchar *text, float positionX, float positionY, Trigger trigger, bool bSelected, bool bRightJustify);
|
||||
CPlaceableShOptionTwoLines *AddOption(wchar *text1, float positionX1, float positionY1, wchar *text2, float positionX2, float positionY2, Trigger trigger, bool bSelected, bool bRightJustify);
|
||||
|
||||
virtual void SelectCurrentOptionUnderCursor(void);
|
||||
virtual void SelectDefaultCancelAction(void);
|
||||
};
|
||||
|
||||
|
||||
class CMenuOnOff : public CMenuBase
|
||||
{
|
||||
public:
|
||||
CPlaceableShOption m_title;
|
||||
CPlaceableShText m_options[2];
|
||||
bool m_bActive;
|
||||
bool m_bSetTextScale;
|
||||
bool m_bSetTitleTextScale;
|
||||
CVector2D m_textScale;
|
||||
CVector2D m_oldTextScale;
|
||||
int m_type; // 0: on/off 1: yes/no
|
||||
|
||||
void SetColors(const CRGBA &title, const CRGBA &options);
|
||||
void SetNewOldTextScale(bool bTextScale, const CVector2D &newScale, const CVector2D &oldScale, bool bTitleTextScale);
|
||||
void SetOptionPosition(float x, float y, bool bRightJustify);
|
||||
void AddTitle(wchar *text, bool bSelected, float positionX, float positionY, bool bRightJustify);
|
||||
|
||||
virtual void Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y);
|
||||
virtual void DrawNormal(float x, float y);
|
||||
virtual void DrawHighlighted(const CRGBA &titleHighlight, float x, float y);
|
||||
virtual void SetAlpha(uint8 alpha);
|
||||
virtual void SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset);
|
||||
virtual bool GoNext(void) { DeactivateMenu(); return false; }
|
||||
virtual bool GoPrev(void) { DeactivateMenu(); return false; }
|
||||
virtual bool GoDown(void) { return GoNext(); }
|
||||
virtual bool GoUp(void) { return GoPrev(); }
|
||||
virtual bool GoDownStill(void) { return false; }
|
||||
virtual bool GoUpStill(void) { return false; }
|
||||
virtual bool GoLeft(void) { SelectCurrentOptionUnderCursor(); return true; }
|
||||
virtual bool GoRight(void) { SelectCurrentOptionUnderCursor(); return true; }
|
||||
virtual bool GoLeftStill(void) { return true; }
|
||||
virtual bool GoRightStill(void) { return true; }
|
||||
virtual bool GoFirst(void) { ActivateMenu(true); return true; }
|
||||
virtual bool GoLast(void) { ActivateMenu(true); return true; }
|
||||
virtual void SelectCurrentOptionUnderCursor(void) { m_title.m_bSelected ^= 1; }
|
||||
virtual void SelectDefaultCancelAction(void) {}
|
||||
virtual void ActivateMenu(bool first) { m_bActive = true; }
|
||||
virtual void DeactivateMenu(void) { m_bActive = false; }
|
||||
virtual int GetMenuSelection(void) { return m_title.m_bSelected; }
|
||||
virtual void SetMenuSelection(int selection) { m_title.m_bSelected = selection; }
|
||||
};
|
||||
|
||||
class CMenuOnOffTriggered : public CMenuOnOff
|
||||
{
|
||||
public:
|
||||
typedef void (*Trigger)(CMenuOnOffTriggered *);
|
||||
|
||||
Trigger m_trigger;
|
||||
|
||||
void SetOptionPosition(float x, float y, Trigger trigger, bool bRightJustify);
|
||||
|
||||
virtual void SelectCurrentOptionUnderCursor(void);
|
||||
};
|
||||
|
||||
class CMenuSlider : public CMenuBase
|
||||
{
|
||||
public:
|
||||
CPlaceableShText m_title;
|
||||
CPlaceableShText m_box; // not really a text
|
||||
CRGBA m_colors[2]; // left and right
|
||||
CVector2D m_size[2]; // left and right
|
||||
int m_value;
|
||||
CPlaceableShText m_percentageText;
|
||||
bool m_bDrawPercentage;
|
||||
// char field_8D;
|
||||
// char field_8E;
|
||||
// char field_8F;
|
||||
uint8 m_someAlpha;
|
||||
// char field_91;
|
||||
// char field_92;
|
||||
// char field_93;
|
||||
bool m_bActive;
|
||||
int m_style;
|
||||
|
||||
static char Buf8[8];
|
||||
static wchar Buf16[8];
|
||||
|
||||
CMenuSlider(void)
|
||||
: m_value(0), m_bDrawPercentage(false), m_bActive(false), m_style(0) {}
|
||||
|
||||
void SetColors(const CRGBA &title, const CRGBA &percentage, const CRGBA &left, const CRGBA &right);
|
||||
void DrawTicks(const CVector2D &position, const CVector2D &size, float heightRight, float level, const CRGBA &leftCol, const CRGBA &selCol, const CRGBA &rightCol, bool bShadow, const CVector2D &shadowOffset, const CRGBA &shadowColor);
|
||||
void DrawTicks(const CVector2D &position, const CVector2D &size, float heightRight, float level, const CRGBA &leftCol, const CRGBA &rightCol, bool bShadow, const CVector2D &shadowOffset, const CRGBA &shadowColor);
|
||||
void AddTickBox(float positionX, float positionY, float width, float heigthLeft, float heightRight);
|
||||
void AddTitle(wchar *text, float positionX, float positionY);
|
||||
|
||||
virtual void Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y);
|
||||
virtual void DrawNormal(float x, float y);
|
||||
virtual void DrawHighlighted(const CRGBA &titleHighlight, float x, float y);
|
||||
virtual void SetAlpha(uint8 alpha);
|
||||
virtual void SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset);
|
||||
virtual bool GoNext(void) { DeactivateMenu(); return false; }
|
||||
virtual bool GoPrev(void) { DeactivateMenu(); return false; }
|
||||
virtual bool GoDown(void) { return GoNext(); }
|
||||
virtual bool GoUp(void) { return GoPrev(); }
|
||||
virtual bool GoDownStill(void) { return false; }
|
||||
virtual bool GoUpStill(void) { return false; }
|
||||
virtual bool GoLeft(void) { if(m_value < 0) m_value = 0; return true; }
|
||||
virtual bool GoRight(void) { if(m_value > 1000) m_value = 1000; return true; }
|
||||
virtual bool GoLeftStill(void) { m_value -= 8; if(m_value < 0) m_value = 0; return true; }
|
||||
virtual bool GoRightStill(void) { m_value += 8; if(m_value > 1000) m_value = 1000; return true; }
|
||||
virtual bool GoFirst(void) { ActivateMenu(true); return true; }
|
||||
virtual bool GoLast(void) { ActivateMenu(true); return true; }
|
||||
virtual void SelectCurrentOptionUnderCursor(void) {}
|
||||
virtual void SelectDefaultCancelAction(void) {}
|
||||
virtual void ActivateMenu(bool first) { m_bActive = true; }
|
||||
virtual void DeactivateMenu(void) { m_bActive = false; }
|
||||
virtual int GetMenuSelection(void) { return m_value/10; }
|
||||
virtual void SetMenuSelection(int selection) { m_value = selection*10; }
|
||||
};
|
||||
|
||||
class CMenuSliderTriggered : public CMenuSlider
|
||||
{
|
||||
public:
|
||||
typedef void (*Trigger)(CMenuSliderTriggered *);
|
||||
|
||||
Trigger m_trigger;
|
||||
Trigger m_alwaysTrigger;
|
||||
|
||||
CMenuSliderTriggered(void)
|
||||
: m_trigger(nil), m_alwaysTrigger(nil) {}
|
||||
|
||||
void AddTickBox(float positionX, float positionY, float width, float heigthLeft, float heightRight, Trigger trigger, Trigger alwaysTrigger);
|
||||
|
||||
virtual void Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y);
|
||||
virtual bool GoLeft(void);
|
||||
virtual bool GoRight(void);
|
||||
virtual bool GoLeftStill(void);
|
||||
virtual bool GoRightStill(void);
|
||||
};
|
||||
|
||||
|
||||
class CMenuLineLister : public CMenuBase
|
||||
{
|
||||
public:
|
||||
float m_width;
|
||||
float m_height;
|
||||
int m_numLines;
|
||||
CPlaceableShText m_linesLeft[NUM_LINELISTER_LINES_TOTAL];
|
||||
CPlaceableShText m_linesRight[NUM_LINELISTER_LINES_TOTAL];
|
||||
uint8 m_lineAlphas[NUM_LINELISTER_LINES_TOTAL];
|
||||
int8 m_lineFade[NUM_LINELISTER_LINES_TOTAL];
|
||||
float m_scrollPosition;
|
||||
float m_scrollSpeed;
|
||||
int field_10E8;
|
||||
float m_lineSpacing;
|
||||
|
||||
CMenuLineLister(void);
|
||||
|
||||
void SetLinesColor(const CRGBA &color);
|
||||
void ResetNumberOfTextLines(void);
|
||||
bool AddTextLine(wchar *left, wchar *right);
|
||||
|
||||
CPlaceableShText *GetLeftLine(int i) { return &m_linesLeft[(i%NUM_LINELISTER_LINES) + 15]; };
|
||||
CPlaceableShText *GetRightLine(int i) { return &m_linesRight[(i%NUM_LINELISTER_LINES) + 15]; };
|
||||
|
||||
virtual void Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, float x, float y);
|
||||
virtual void DrawNormal(float x, float y) { Draw(CRGBA(0,0,0,0), CRGBA(0,0,0,0), x, y); }
|
||||
virtual void DrawHighlighted(const CRGBA &titleHighlight, float x, float y) { Draw(CRGBA(0,0,0,0), CRGBA(0,0,0,0), x, y); }
|
||||
virtual void SetAlpha(uint8 alpha);
|
||||
virtual void SetShadows(bool bDropShadows, const CRGBA &shadowColor, const CVector2D &shadowOffset);
|
||||
virtual bool GoNext(void) { return false; }
|
||||
virtual bool GoPrev(void) { return false; }
|
||||
virtual bool GoDown(void) { return GoNext(); }
|
||||
virtual bool GoUp(void) { return GoPrev(); }
|
||||
virtual bool GoDownStill(void) { m_scrollSpeed = 0.0f; return true; }
|
||||
virtual bool GoUpStill(void) { m_scrollSpeed *= 6.0f; return true; }
|
||||
virtual bool GoLeft(void) { return true; }
|
||||
virtual bool GoRight(void) { return true; }
|
||||
virtual bool GoLeftStill(void) { return true; }
|
||||
virtual bool GoRightStill(void) { return true; }
|
||||
virtual bool GoFirst(void) { return true; }
|
||||
virtual bool GoLast(void) { return true; }
|
||||
virtual void SelectCurrentOptionUnderCursor(void) {}
|
||||
virtual void SelectDefaultCancelAction(void) {}
|
||||
virtual void ActivateMenu(bool first) {}
|
||||
virtual void DeactivateMenu(void) {}
|
||||
virtual int GetMenuSelection(void) { return -1; }
|
||||
virtual void SetMenuSelection(int selection) {}
|
||||
};
|
||||
|
||||
class CMenuPage
|
||||
{
|
||||
public:
|
||||
CMenuBase *m_controls[NUM_PAGE_WIDGETS];
|
||||
int m_numControls;
|
||||
CMenuBase *m_pCurrentControl;
|
||||
int m_cursor;
|
||||
|
||||
CMenuPage(void) { Initialise(); }
|
||||
void Initialise(void);
|
||||
bool AddMenu(CMenuBase *widget);
|
||||
|
||||
bool IsActiveMenuTwoState(void);
|
||||
void ActiveMenuTwoState_SelectNextPosition(void);
|
||||
void Draw(const CRGBA &,const CRGBA &, float, float);
|
||||
void DrawHighlighted(const CRGBA &titleHighlight, float x, float y);
|
||||
void DrawNormal(float x, float y);
|
||||
void ActivatePage(void);
|
||||
void SetAlpha(uint8 alpha);
|
||||
void SetShadows(bool, const CRGBA &, const CVector2D &);
|
||||
void GoPrev(void) { if(m_pCurrentControl) { if(!m_pCurrentControl->GoPrev()) m_pCurrentControl->GoLast(); } }
|
||||
void GoNext(void) { if(m_pCurrentControl) { if(!m_pCurrentControl->GoNext()) m_pCurrentControl->GoFirst(); } }
|
||||
void GoLeft(void) { if(m_pCurrentControl) { if(!m_pCurrentControl->GoLeft()) m_pCurrentControl->GoLast(); } }
|
||||
void GoRight(void) { if(m_pCurrentControl) { if(!m_pCurrentControl->GoRight()) m_pCurrentControl->GoFirst(); } }
|
||||
void GoUp(void) { if(m_pCurrentControl) { if(!m_pCurrentControl->GoUp()) m_pCurrentControl->GoLast(); } }
|
||||
void GoDown(void) { if(m_pCurrentControl) { if(!m_pCurrentControl->GoDown()) m_pCurrentControl->GoFirst(); } }
|
||||
void GoLeftStill(void) { if(m_pCurrentControl) m_pCurrentControl->GoLeftStill(); }
|
||||
void GoRightStill(void) { if(m_pCurrentControl) m_pCurrentControl->GoRightStill(); }
|
||||
void GoUpStill(void) { if(m_pCurrentControl) m_pCurrentControl->GoUpStill(); }
|
||||
void GoDownStill(void) { if(m_pCurrentControl) m_pCurrentControl->GoDownStill(); }
|
||||
void SelectDefaultCancelAction(void) { if(m_pCurrentControl) m_pCurrentControl->SelectDefaultCancelAction(); }
|
||||
void SelectCurrentOptionUnderCursor(void) { if(m_pCurrentControl) m_pCurrentControl->SelectCurrentOptionUnderCursor(); }
|
||||
|
||||
virtual void GoUpMenuOnPage(void);
|
||||
virtual void GoDownMenuOnPage(void);
|
||||
virtual void GoLeftMenuOnPage(void);
|
||||
virtual void GoRightMenuOnPage(void);
|
||||
};
|
||||
|
||||
class CMenuPageAnyMove : public CMenuPage
|
||||
{
|
||||
public:
|
||||
FEC_MOVETAB m_moveTab[NUM_PAGE_WIDGETS];
|
||||
|
||||
CMenuPageAnyMove(void) { Initialise(); }
|
||||
void Initialise(void);
|
||||
using CMenuPage::AddMenu;
|
||||
bool AddMenu(CMenuBase *widget, FEC_MOVETAB *moveTab);
|
||||
|
||||
virtual void GoUpMenuOnPage(void);
|
||||
virtual void GoDownMenuOnPage(void);
|
||||
virtual void GoLeftMenuOnPage(void);
|
||||
virtual void GoRightMenuOnPage(void);
|
||||
};
|
File diff suppressed because it is too large
Load Diff
@ -7,27 +7,10 @@
|
||||
#define MENUHEADER_WIDTH 0.84f
|
||||
#define MENUHEADER_HEIGHT 1.6f
|
||||
|
||||
#define MENUACTION_X_MARGIN 40.0f
|
||||
#define MENU_X_MARGIN 40.0f
|
||||
#define MENUACTION_POS_Y 60.0f
|
||||
#define MENUACTION_WIDTH 0.405f
|
||||
#define MENUACTION_HEIGHT 0.63f
|
||||
|
||||
#define MENUCOLUMN_POS_X MENUHEADER_POS_X + 16.0f
|
||||
#define MENUCOLUMN_MAX_Y 149.0f
|
||||
#define MENUCOLUMN_MID_Y 100.0f
|
||||
#define MENUCOLUMN_MIN_Y 110.0f
|
||||
#define MENUCOLUMN_PAUSE_Y 25.0f
|
||||
#define MENUCOLUMN_START_Y 9.0f
|
||||
#define MENUCOLUMN_FEDS 139.0f
|
||||
|
||||
#define MENUCOLUMN_SAVE_X 121.0f
|
||||
#define MENUCOLUMN_SAVE_Y 111.0f
|
||||
|
||||
#define MENUCOLUMN_SPACING_MAX 24.0f
|
||||
#define MENUCOLUMN_SPACING_MIN 20.0f
|
||||
|
||||
#define MENUSELECT_BOX_MAX 20.5f
|
||||
#define MENUSELECT_BOX_MIN 17.0f
|
||||
#define MENUACTION_WIDTH 38.0f
|
||||
#define MENUACTION_SCALE_MULT 0.9f
|
||||
|
||||
#ifndef ASPECT_RATIO_SCALE
|
||||
#define MENURADIO_ICON_X 31.5f
|
||||
@ -38,12 +21,63 @@
|
||||
#define MENURADIO_ICON_W 60.0f
|
||||
#define MENURADIO_ICON_H 60.0f
|
||||
|
||||
#define MENUDROP_COLOR_A 150
|
||||
#define MENUDROP_COLOR_SIZE -1
|
||||
|
||||
#define MENUSLIDER_X 256.0f
|
||||
#define MENUSLIDER_UNK 256.0f
|
||||
|
||||
#define BIGTEXT_X_SCALE 0.75f
|
||||
#define BIGTEXT_Y_SCALE 0.9f
|
||||
#define MEDIUMTEXT_X_SCALE 0.55f
|
||||
#define MEDIUMTEXT_Y_SCALE 0.8f
|
||||
#define SMALLTEXT_X_SCALE 0.45f
|
||||
#define SMALLTEXT_Y_SCALE 0.7f
|
||||
#define SMALLESTTEXT_X_SCALE 0.4f
|
||||
#define SMALLESTTEXT_Y_SCALE 0.6f
|
||||
|
||||
#define PLAYERSETUP_LIST_TOP 28.0f
|
||||
#define PLAYERSETUP_LIST_BOTTOM 125.0f
|
||||
#define PLAYERSETUP_LIST_LEFT 200.0f
|
||||
#define PLAYERSETUP_LIST_RIGHT 36.0f
|
||||
#ifdef FIX_BUGS // See the scrollbar button drawing code
|
||||
#define PLAYERSETUP_SCROLLBAR_WIDTH 19.0f
|
||||
#else
|
||||
#define PLAYERSETUP_SCROLLBAR_WIDTH 16.0f
|
||||
#endif
|
||||
#define PLAYERSETUP_SCROLLBUTTON_HEIGHT 17.0f
|
||||
#define PLAYERSETUP_SCROLLBUTTON_TXD_DIMENSION 64
|
||||
#define PLAYERSETUP_ROW_TEXT_X_SCALE 0.4f
|
||||
#define PLAYERSETUP_ROW_TEXT_Y_SCALE 0.6f
|
||||
#define PLAYERSETUP_SKIN_COLUMN_LEFT 220.0f
|
||||
#define PLAYERSETUP_DATE_COLUMN_RIGHT 56.0f
|
||||
#define PLAYERSETUP_LIST_BODY_TOP 47
|
||||
#define PLAYERSETUP_ROW_HEIGHT 9
|
||||
|
||||
#define STATS_SLIDE_Y_PER_SECOND 30.0f
|
||||
#define STATS_ROW_HEIGHT 20.0f
|
||||
#define STATS_ROW_X_MARGIN 50.0f
|
||||
#define STATS_BOTTOM_MARGIN 135.0f
|
||||
#define STATS_TOP_MARGIN 40.0f
|
||||
#define STATS_TOP_DIMMING_AREA_LENGTH (93.0f - STATS_TOP_MARGIN)
|
||||
#define STATS_BOTTOM_DIMMING_AREA_LENGTH 55.0f
|
||||
#define STATS_PUT_BACK_TO_BOTTOM_Y 50.0f
|
||||
#define STATS_RATING_X 24.0f
|
||||
#define STATS_RATING_Y 20.0f
|
||||
|
||||
#define CONTSETUP_STANDARD_ROW_HEIGHT 10.7f
|
||||
#define CONTSETUP_CLASSIC_ROW_HEIGHT 9.0f
|
||||
#define CONTSETUP_BOUND_HIGHLIGHT_HEIGHT 10
|
||||
#define CONTSETUP_BOUND_COLUMN_WIDTH 190.0f
|
||||
#define CONTSETUP_LIST_HEADER_HEIGHT 20.0f
|
||||
#define CONTSETUP_LIST_TOP 28.0f
|
||||
#define CONTSETUP_LIST_RIGHT 18.0f
|
||||
#define CONTSETUP_LIST_BOTTOM 120.0f
|
||||
#define CONTSETUP_LIST_LEFT 18.0f
|
||||
#define CONTSETUP_COLUMN_1_X 40.0f
|
||||
#define CONTSETUP_COLUMN_2_X 210.0f
|
||||
#define CONTSETUP_COLUMN_3_X (CONTSETUP_COLUMN_2_X + CONTSETUP_BOUND_COLUMN_WIDTH + 10.0f)
|
||||
#define CONTSETUP_BACK_RIGHT 35.0f
|
||||
#define CONTSETUP_BACK_BOTTOM 122.0f
|
||||
#define CONTSETUP_BACK_HEIGHT 25.0f
|
||||
|
||||
enum eLanguages
|
||||
{
|
||||
LANGUAGE_AMERICAN,
|
||||
@ -87,6 +121,8 @@ enum eFrontendSprites
|
||||
FE_RADIO7,
|
||||
FE_RADIO8,
|
||||
FE_RADIO9,
|
||||
|
||||
NUM_FE_SPRITES
|
||||
};
|
||||
|
||||
enum eMenuSprites
|
||||
@ -110,6 +146,8 @@ enum eMenuSprites
|
||||
MENUSPRITE_UPOFF,
|
||||
MENUSPRITE_UPON,
|
||||
MENUSPRITE_GTA3LOGO,
|
||||
MENUSPRITE_UNUSED,
|
||||
NUM_MENU_SPRITES
|
||||
};
|
||||
|
||||
enum eSaveSlot
|
||||
@ -127,6 +165,22 @@ enum eSaveSlot
|
||||
SAVESLOT_LABEL = 36
|
||||
};
|
||||
|
||||
#ifdef MENU_MAP
|
||||
enum MapSprites
|
||||
{
|
||||
MAPMID1,
|
||||
MAPMID2,
|
||||
MAPMID3,
|
||||
MAPBOT1,
|
||||
MAPBOT2,
|
||||
MAPBOT3,
|
||||
MAPTOP1,
|
||||
MAPTOP2,
|
||||
MAPTOP3,
|
||||
NUM_MAP_SPRITES
|
||||
};
|
||||
#endif
|
||||
|
||||
enum eMenuScreen
|
||||
{
|
||||
MENUPAGE_DISABLED = -1,
|
||||
@ -143,19 +197,19 @@ enum eMenuScreen
|
||||
MENUPAGE_NEW_GAME_RELOAD = 10,
|
||||
MENUPAGE_LOAD_SLOT_CONFIRM = 11,
|
||||
MENUPAGE_DELETE_SLOT_CONFIRM = 12,
|
||||
MENUPAGE_13 = 13,
|
||||
MENUPAGE_NO_MEMORY_CARD = 13, // hud adjustment page in mobile
|
||||
MENUPAGE_LOADING_IN_PROGRESS = 14,
|
||||
MENUPAGE_DELETING_IN_PROGRESS = 15,
|
||||
MENUPAGE_16 = 16,
|
||||
MENUPAGE_PS2_LOAD_FAILED = 16,
|
||||
MENUPAGE_DELETE_FAILED = 17,
|
||||
MENUPAGE_DEBUG_MENU = 18,
|
||||
MENUPAGE_MEMORY_CARD_1 = 19,
|
||||
MENUPAGE_MEMORY_CARD_2 = 20,
|
||||
MENUPAGE_MEMORY_CARD_DEBUG = 19,
|
||||
MENUPAGE_MEMORY_CARD_TEST = 20,
|
||||
MENUPAGE_MULTIPLAYER_MAIN = 21,
|
||||
MENUPAGE_SAVE_FAILED_1 = 22,
|
||||
MENUPAGE_SAVE_FAILED_2 = 23,
|
||||
MENUPAGE_PS2_SAVE_FAILED = 22,
|
||||
MENUPAGE_PS2_SAVE_FAILED_2 = 23,
|
||||
MENUPAGE_SAVE = 24,
|
||||
MENUPAGE_NO_MEMORY_CARD = 25,
|
||||
MENUPAGE_NO_MEMORY_CARD_2 = 25,
|
||||
MENUPAGE_CHOOSE_SAVE_SLOT = 26,
|
||||
MENUPAGE_SAVE_OVERWRITE_CONFIRM = 27,
|
||||
MENUPAGE_MULTIPLAYER_MAP = 28,
|
||||
@ -187,8 +241,11 @@ enum eMenuScreen
|
||||
MENUPAGE_SKIN_SELECT = 54,
|
||||
MENUPAGE_KEYBOARD_CONTROLS = 55,
|
||||
MENUPAGE_MOUSE_CONTROLS = 56,
|
||||
MENUPAGE_57 = 57,
|
||||
MENUPAGE_57 = 57, // mission failed, wanna restart page in mobile
|
||||
MENUPAGE_58 = 58,
|
||||
#ifdef MENU_MAP
|
||||
MENUPAGE_MAP = 59,
|
||||
#endif
|
||||
MENUPAGES
|
||||
};
|
||||
|
||||
@ -322,7 +379,7 @@ enum eCheckHover
|
||||
HOVEROPTION_6,
|
||||
HOVEROPTION_7,
|
||||
HOVEROPTION_8,
|
||||
HOVEROPTION_BACK, // used in controller setup
|
||||
HOVEROPTION_BACK, // also layer in controller setup and skin menu
|
||||
HOVEROPTION_10,
|
||||
HOVEROPTION_11,
|
||||
HOVEROPTION_OVER_SCROLL_UP,
|
||||
@ -332,9 +389,9 @@ enum eCheckHover
|
||||
HOVEROPTION_HOLDING_SCROLLBAR,
|
||||
HOVEROPTION_PAGEUP,
|
||||
HOVEROPTION_PAGEDOWN,
|
||||
HOVEROPTION_19,
|
||||
HOVEROPTION_20,
|
||||
HOVEROPTION_CHANGESKIN,
|
||||
HOVEROPTION_LIST, // also layer in controller setup and skin menu
|
||||
HOVEROPTION_SKIN,
|
||||
HOVEROPTION_USESKIN, // also layer in controller setup and skin menu
|
||||
HOVEROPTION_RADIO_0,
|
||||
HOVEROPTION_RADIO_1,
|
||||
HOVEROPTION_RADIO_2,
|
||||
@ -369,13 +426,20 @@ enum eControlMethod
|
||||
CONTROL_CLASSIC,
|
||||
};
|
||||
|
||||
// Why??
|
||||
enum ControllerSetupColumn
|
||||
{
|
||||
CONTSETUP_PED_COLUMN = 0,
|
||||
CONTSETUP_VEHICLE_COLUMN = 14,
|
||||
};
|
||||
|
||||
struct tSkinInfo
|
||||
{
|
||||
int32 field_0;
|
||||
char skinName[256];
|
||||
char currSkinName[256];
|
||||
int32 skinId;
|
||||
char skinNameDisplayed[256];
|
||||
char skinNameOriginal[256];
|
||||
char date[256];
|
||||
tSkinInfo *field_304;
|
||||
tSkinInfo *nextSkin;
|
||||
};
|
||||
|
||||
struct BottomBarOption
|
||||
@ -387,7 +451,7 @@ struct BottomBarOption
|
||||
struct CMenuScreen
|
||||
{
|
||||
char m_ScreenName[8];
|
||||
int32 unk;
|
||||
int32 unk; // 2 on MENUPAGE_MULTIPLAYER_START, 1 on everywhere else
|
||||
int32 m_PreviousPage[2]; // eMenuScreen
|
||||
int32 m_ParentEntry[2]; // row
|
||||
|
||||
@ -413,7 +477,7 @@ public:
|
||||
bool m_bMenuActive;
|
||||
bool m_bMenuStateChanged;
|
||||
bool m_bWaitingForNewKeyBind;
|
||||
bool m_bStartGameLoading;
|
||||
bool m_bWantToRestart;
|
||||
bool m_bFirstTime;
|
||||
bool m_bGameNotLoaded;
|
||||
int32 m_nMousePosX;
|
||||
@ -421,24 +485,24 @@ public:
|
||||
int32 m_nMouseTempPosX;
|
||||
int32 m_nMouseTempPosY;
|
||||
bool m_bShowMouse;
|
||||
tSkinInfo m_sSkin;
|
||||
tSkinInfo m_pSkinListHead;
|
||||
tSkinInfo *m_pSelectedSkin;
|
||||
int32 m_nFirstVisibleRowOnList;
|
||||
float m_nCurListItemY;
|
||||
float m_nScrollbarTopMargin;
|
||||
int32 m_nTotalListRow;
|
||||
int32 m_nSkinsTotal;
|
||||
char _unk0[4];
|
||||
int32 m_nSelectedListRow;
|
||||
bool m_bSkinsFound;
|
||||
bool m_bSkinsEnumerated;
|
||||
bool m_bQuitGameNoCD;
|
||||
bool m_bRenderGameInMenu;
|
||||
bool m_bSaveMenuActive;
|
||||
bool m_bLoadingSavedGame;
|
||||
bool m_bWantToLoad;
|
||||
char field_455;
|
||||
bool m_bStartWaitingForKeyBind;
|
||||
bool m_bSpritesLoaded;
|
||||
CSprite2d m_aFrontEndSprites[28];
|
||||
CSprite2d m_aMenuSprites[20];
|
||||
CSprite2d m_aFrontEndSprites[NUM_FE_SPRITES];
|
||||
CSprite2d m_aMenuSprites[NUM_MENU_SPRITES];
|
||||
int32 field_518;
|
||||
int32 m_nMenuFadeAlpha;
|
||||
bool m_bPressedPgUpOnList;
|
||||
@ -448,10 +512,10 @@ public:
|
||||
bool m_bPressedScrollButton;
|
||||
int32 m_CurrCntrlAction;
|
||||
char _unk1[4];
|
||||
int32 field_530;
|
||||
int32 m_nSelectedContSetupColumn;
|
||||
bool m_bKeyIsOK;
|
||||
bool field_535;
|
||||
int8 m_nCurrExLayer; // TODO: What's that?
|
||||
int8 m_nCurrExLayer;
|
||||
int32 m_nHelperTextAlpha;
|
||||
int32 m_nMouseOldPosX;
|
||||
int32 m_nMouseOldPosY;
|
||||
@ -468,47 +532,58 @@ public:
|
||||
bool GetIsMenuActive() {return !!m_bMenuActive;}
|
||||
|
||||
public:
|
||||
static int32 &OS_Language;
|
||||
static int8 &m_PrefsUseVibration;
|
||||
static int8 &m_DisplayControllerOnFoot;
|
||||
static int8 &m_PrefsUseWideScreen;
|
||||
static int8 &m_PrefsRadioStation;
|
||||
static int8 &m_PrefsVsync;
|
||||
static int8 &m_PrefsVsyncDisp;
|
||||
static int8 &m_PrefsFrameLimiter;
|
||||
static int8 &m_PrefsShowSubtitles;
|
||||
static int8 &m_PrefsSpeakers;
|
||||
static int32 &m_ControlMethod;
|
||||
static int8 &m_PrefsDMA;
|
||||
static int32 &m_PrefsLanguage;
|
||||
static int32 &m_PrefsBrightness;
|
||||
static float &m_PrefsLOD;
|
||||
static int8 &m_bFrontEnd_ReloadObrTxtGxt;
|
||||
static int32 &m_PrefsMusicVolume;
|
||||
static int32 &m_PrefsSfxVolume;
|
||||
static char *m_PrefsSkinFile;
|
||||
static int32 &m_KeyPressedCode;
|
||||
static int32 OS_Language;
|
||||
static int8 m_PrefsUseVibration;
|
||||
static int8 m_DisplayControllerOnFoot;
|
||||
static int8 m_PrefsUseWideScreen;
|
||||
static int8 m_PrefsRadioStation;
|
||||
static int8 m_PrefsVsync;
|
||||
static int8 m_PrefsVsyncDisp;
|
||||
static int8 m_PrefsFrameLimiter;
|
||||
static int8 m_PrefsShowSubtitles;
|
||||
static int8 m_PrefsSpeakers;
|
||||
static int32 m_ControlMethod;
|
||||
static int8 m_PrefsDMA;
|
||||
static int32 m_PrefsLanguage;
|
||||
static int32 m_PrefsBrightness;
|
||||
static float m_PrefsLOD;
|
||||
static int8 m_bFrontEnd_ReloadObrTxtGxt;
|
||||
static int32 m_PrefsMusicVolume;
|
||||
static int32 m_PrefsSfxVolume;
|
||||
static char m_PrefsSkinFile[256];
|
||||
static int32 m_KeyPressedCode;
|
||||
|
||||
static bool &m_bStartUpFrontEndRequested;
|
||||
static bool &m_bShutDownFrontEndRequested;
|
||||
static bool &m_PrefsAllowNastyGame;
|
||||
static bool m_bStartUpFrontEndRequested;
|
||||
static bool m_bShutDownFrontEndRequested;
|
||||
static bool m_PrefsAllowNastyGame;
|
||||
|
||||
static float &menuXYpadding;
|
||||
static float &actionTextScaleX;
|
||||
static float &actionTextScaleY;
|
||||
static int32 &sthWithButtons;
|
||||
static int32 &sthWithButtons2;
|
||||
static uint8 m_PrefsStereoMono;
|
||||
static int32 m_SelectedMap;
|
||||
static int32 m_SelectedGameType;
|
||||
static uint8 m_PrefsPlayerRed;
|
||||
static uint8 m_PrefsPlayerGreen;
|
||||
static uint8 m_PrefsPlayerBlue;
|
||||
|
||||
#ifndef MASTER
|
||||
static bool m_PrefsMarketing;
|
||||
static bool m_PrefsDisableTutorials;
|
||||
#endif // !MASTER
|
||||
|
||||
#ifdef MENU_MAP
|
||||
static bool bMenuMapActive;
|
||||
static bool bMapMouseShownOnce;
|
||||
static bool bMapLoaded;
|
||||
static float fMapSize;
|
||||
static float fMapCenterY;
|
||||
static float fMapCenterX;
|
||||
static CSprite2d m_aMapSprites[NUM_MAP_SPRITES];
|
||||
void PrintMap();
|
||||
#endif
|
||||
|
||||
public:
|
||||
static void BuildStatLine(char *text, void *stat, uint8 aFloat, void *stat2);
|
||||
static void BuildStatLine(char *text, void *stat, bool itsFloat, void *stat2);
|
||||
static void CentreMousePointer();
|
||||
int CheckCodesForControls(int32);
|
||||
void CheckCodesForControls(int);
|
||||
bool CheckHover(int x1, int x2, int y1, int y2);
|
||||
void CheckSliderMovement(int);
|
||||
int CostructStatLine(int);
|
||||
@ -516,7 +591,7 @@ public:
|
||||
int DisplaySlider(float, float, float, float, float, float);
|
||||
void DoSettingsBeforeStartingAGame();
|
||||
void Draw();
|
||||
void DrawControllerBound(int, int, int, uint8);
|
||||
void DrawControllerBound(int32, int32, int32, int8);
|
||||
void DrawControllerScreenExtraText(int, int, int);
|
||||
void DrawControllerSetupScreen();
|
||||
void DrawFrontEnd();
|
||||
@ -526,13 +601,13 @@ public:
|
||||
#endif
|
||||
void DrawPlayerSetupScreen();
|
||||
int FadeIn(int alpha);
|
||||
void FilterOutColorMarkersFromString(uint16, CRGBA &);
|
||||
void FilterOutColorMarkersFromString(wchar*, CRGBA &);
|
||||
int GetStartOptionsCntrlConfigScreens();
|
||||
static void InitialiseChangedLanguageSettings();
|
||||
void LoadAllTextures();
|
||||
void LoadSettings();
|
||||
static void MessageScreen(char *);
|
||||
static void PickNewPlayerColour();
|
||||
void MessageScreen(const char *);
|
||||
void PickNewPlayerColour();
|
||||
void PrintBriefs();
|
||||
static void PrintErrorMessage();
|
||||
void PrintStats();
|
||||
@ -552,6 +627,8 @@ public:
|
||||
void UnloadTextures();
|
||||
void WaitForUserCD();
|
||||
void PrintController();
|
||||
int GetNumOptionsCntrlConfigScreens();
|
||||
int ConstructStatLine(int);
|
||||
|
||||
// New (not in function or inlined in the game)
|
||||
void ThingsToDoBeforeLeavingPage();
|
||||
@ -565,4 +642,4 @@ public:
|
||||
|
||||
static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error");
|
||||
|
||||
extern CMenuManager &FrontEndMenuManager;
|
||||
extern CMenuManager FrontEndMenuManager;
|
||||
|
@ -89,8 +89,6 @@
|
||||
|
||||
|
||||
|
||||
#define DEFAULT_VIEWWINDOW (0.7f)
|
||||
|
||||
eLevelName &CGame::currLevel = *(eLevelName*)0x941514;
|
||||
bool &CGame::bDemoMode = *(bool*)0x5F4DD0;
|
||||
bool &CGame::nastyGame = *(bool*)0x5F4DD4;
|
||||
@ -492,7 +490,7 @@ void CGame::ReInitGameObjectVariables(void)
|
||||
CParticle::ReloadConfig();
|
||||
CCullZones::ResolveVisibilities();
|
||||
|
||||
if ( !FrontEndMenuManager.m_bLoadingSavedGame )
|
||||
if ( !FrontEndMenuManager.m_bWantToLoad )
|
||||
{
|
||||
CCranes::InitCranes();
|
||||
CTheScripts::StartTestScript();
|
||||
@ -566,7 +564,7 @@ void CGame::InitialiseWhenRestarting(void)
|
||||
|
||||
TheCamera.Init();
|
||||
|
||||
if ( FrontEndMenuManager.m_bLoadingSavedGame == true )
|
||||
if ( FrontEndMenuManager.m_bWantToLoad == true )
|
||||
{
|
||||
RestoreForStartLoad();
|
||||
CStreaming::LoadScene(TheCamera.GetPosition());
|
||||
@ -574,7 +572,7 @@ void CGame::InitialiseWhenRestarting(void)
|
||||
|
||||
ReInitGameObjectVariables();
|
||||
|
||||
if ( FrontEndMenuManager.m_bLoadingSavedGame == true )
|
||||
if ( FrontEndMenuManager.m_bWantToLoad == true )
|
||||
{
|
||||
if ( GenericLoad() == true )
|
||||
{
|
||||
@ -593,7 +591,7 @@ void CGame::InitialiseWhenRestarting(void)
|
||||
ShutDownForRestart();
|
||||
CTimer::Stop();
|
||||
CTimer::Initialise();
|
||||
FrontEndMenuManager.m_bLoadingSavedGame = false;
|
||||
FrontEndMenuManager.m_bWantToLoad = false;
|
||||
ReInitGameObjectVariables();
|
||||
currLevel = LEVEL_INDUSTRIAL;
|
||||
CCollision::SortOutCollisionAfterLoad();
|
||||
@ -609,6 +607,9 @@ extern void (*DebugMenuProcess)(void);
|
||||
void CGame::Process(void)
|
||||
{
|
||||
CPad::UpdatePads();
|
||||
#ifdef GTA_PS2
|
||||
ProcessTidyUpMemory();
|
||||
#endif
|
||||
TheCamera.SetMotionBlurAlpha(0);
|
||||
if (TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_SNIPER || TheCamera.m_BlurType == MBLUR_NORMAL)
|
||||
TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE);
|
||||
@ -695,6 +696,13 @@ void CGame::TidyUpMemory(bool, bool)
|
||||
#endif
|
||||
}
|
||||
|
||||
void CGame::ProcessTidyUpMemory(void)
|
||||
{
|
||||
#ifdef PS2
|
||||
// meow
|
||||
#endif
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x48BB80, CGame::InitialiseOnceBeforeRW, PATCH_JUMP);
|
||||
InjectHook(0x48BBA0, CGame::InitialiseRenderWare, PATCH_JUMP);
|
||||
|
@ -39,4 +39,5 @@ public:
|
||||
// NB: these do something on PS2
|
||||
static void TidyUpMemory(bool, bool);
|
||||
static void DrasticTidyUpMemory(bool);
|
||||
static void ProcessTidyUpMemory(void);
|
||||
};
|
||||
|
@ -1,18 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
// There are some missing/wrong entries in here.
|
||||
// TODO: There are some missing/wrong entries in here.
|
||||
|
||||
const CMenuScreen aScreens[] = {
|
||||
// MENUPAGE_NONE = 0
|
||||
{ "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, },
|
||||
{ "", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, },
|
||||
|
||||
// MENUPAGE_STATS = 1 - Both PrintStats and Draw were printing the page name, so deleted the string Draw looked for.
|
||||
{ ""/*"FET_STA"*/, MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
|
||||
// MENUPAGE_STATS = 1
|
||||
#ifdef MENU_MAP
|
||||
{ "FET_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 3,
|
||||
#else
|
||||
{ "FET_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
|
||||
#endif
|
||||
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
},
|
||||
|
||||
// MENUPAGE_NEW_GAME = 2
|
||||
{ "FET_SGA", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 0, 1,
|
||||
{ "FET_SGA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 0, 1,
|
||||
MENUACTION_CHANGEMENU, "FES_SNG", SAVESLOT_NONE, MENUPAGE_NEW_GAME_RELOAD,
|
||||
MENUACTION_POPULATESLOTS_CHANGEMENU, "GMLOAD", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT,
|
||||
MENUACTION_POPULATESLOTS_CHANGEMENU, "FES_DGA", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
|
||||
@ -20,12 +24,16 @@ const CMenuScreen aScreens[] = {
|
||||
},
|
||||
|
||||
// MENUPAGE_BRIEFS = 3
|
||||
{ "FET_BRE", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 6, 3,
|
||||
#ifdef MENU_MAP
|
||||
{ "FET_BRE", 1, MENUPAGE_NONE, MENUPAGE_NONE, 6, 4,
|
||||
#else
|
||||
{ "FET_BRE", 1, MENUPAGE_NONE, MENUPAGE_NONE, 6, 3,
|
||||
#endif
|
||||
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
},
|
||||
|
||||
// MENU_CONTROLLER_SETTINGS = 4
|
||||
{ "FET_CON", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0,
|
||||
{ "FET_CON", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0,
|
||||
MENUACTION_CTRLCONFIG, "FEC_CCF", SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS,
|
||||
MENUACTION_CTRLDISPLAY, "FEC_CDP", SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS,
|
||||
MENUACTION_CTRLVIBRATION, "FEC_VIB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS,
|
||||
@ -33,7 +41,7 @@ const CMenuScreen aScreens[] = {
|
||||
},
|
||||
|
||||
// MENUPAGE_SOUND_SETTINGS = 5
|
||||
{ "FET_AUD", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 1, 1,
|
||||
{ "FET_AUD", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 1, 1,
|
||||
MENUACTION_MUSICVOLUME, "FEA_MUS", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
|
||||
MENUACTION_SFXVOLUME, "FEA_SFX", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
|
||||
MENUACTION_AUDIOHW, "FEA_3DH", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
|
||||
@ -45,7 +53,7 @@ const CMenuScreen aScreens[] = {
|
||||
},
|
||||
|
||||
// MENUPAGE_GRAPHICS_SETTINGS = 6
|
||||
{ "FET_DIS", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 2, 2,
|
||||
{ "FET_DIS", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 2, 2,
|
||||
MENUACTION_BRIGHTNESS, "FED_BRI", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
|
||||
MENUACTION_DRAWDIST, "FEM_LOD", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
|
||||
MENUACTION_FRAMESYNC, "FEM_VSC", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
|
||||
@ -59,7 +67,7 @@ const CMenuScreen aScreens[] = {
|
||||
},
|
||||
|
||||
// MENUPAGE_LANGUAGE_SETTINGS = 7
|
||||
{ "FET_LAN", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 3, 3,
|
||||
{ "FET_LAN", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 3, 3,
|
||||
MENUACTION_LANG_ENG, "FEL_ENG", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_LANG_FRE, "FEL_FRE", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_LANG_GER, "FEL_GER", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
@ -73,7 +81,7 @@ const CMenuScreen aScreens[] = {
|
||||
},
|
||||
|
||||
// MENUPAGE_CHOOSE_LOAD_SLOT = 8
|
||||
{ "FET_LG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 1, 1,
|
||||
{ "FET_LG", 1, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 1, 1,
|
||||
MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
|
||||
MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_LOAD_SLOT_CONFIRM,
|
||||
MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_LOAD_SLOT_CONFIRM,
|
||||
@ -86,7 +94,7 @@ const CMenuScreen aScreens[] = {
|
||||
},
|
||||
|
||||
// MENUPAGE_CHOOSE_DELETE_SLOT = 9
|
||||
{ "FET_DG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 2, 2,
|
||||
{ "FET_DG", 1, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 2, 2,
|
||||
MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
|
||||
MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_DELETE_SLOT_CONFIRM,
|
||||
MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_DELETE_SLOT_CONFIRM,
|
||||
@ -99,104 +107,123 @@ const CMenuScreen aScreens[] = {
|
||||
},
|
||||
|
||||
// MENUPAGE_NEW_GAME_RELOAD = 10
|
||||
{ "FET_NG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 0, 0,
|
||||
{ "FET_NG", 1, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 0, 0,
|
||||
MENUACTION_LABEL, "FESZ_QR", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
|
||||
MENUACTION_NEWGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NEW_GAME_RELOAD,
|
||||
},
|
||||
|
||||
// MENUPAGE_LOAD_SLOT_CONFIRM = 11
|
||||
{ "FET_LG", MENUPAGE_CHOOSE_LOAD_SLOT, MENUPAGE_CHOOSE_LOAD_SLOT, MENUPAGE_CHOOSE_LOAD_SLOT, 0, 0,
|
||||
{ "FET_LG", 1, MENUPAGE_CHOOSE_LOAD_SLOT, MENUPAGE_CHOOSE_LOAD_SLOT, 0, 0,
|
||||
MENUACTION_LABEL, "FESZ_QL", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT,
|
||||
MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_LOADING_IN_PROGRESS,
|
||||
},
|
||||
|
||||
// MENUPAGE_DELETE_SLOT_CONFIRM = 12
|
||||
{ "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0,
|
||||
{ "FET_DG", 1, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0,
|
||||
MENUACTION_LABEL, "FESZ_QD", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
|
||||
MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_DELETING,
|
||||
},
|
||||
|
||||
// MENUPAGE_13 = 13
|
||||
{ "FES_NOC", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
|
||||
// MENUPAGE_NO_MEMORY_CARD = 13
|
||||
{ "FES_NOC", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
// hud adjustment page in mobile
|
||||
},
|
||||
|
||||
// MENUPAGE_LOADING_IN_PROGRESS = 14
|
||||
{ "FET_LG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
{ "FET_LG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
MENUACTION_LABEL, "FED_LDW", SAVESLOT_NONE, MENUPAGE_LOAD_SLOT_CONFIRM,
|
||||
},
|
||||
|
||||
// MENUPAGE_DELETING_IN_PROGRESS = 15
|
||||
{ "FET_DG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
{ "FET_DG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
MENUACTION_LABEL, "FEDL_WR", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
},
|
||||
|
||||
// MENUPAGE_16 = 16
|
||||
{ "FET_LG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
// MENUPAGE_PS2_LOAD_FAILED = 16
|
||||
{ "FET_LG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
MENUACTION_LABEL, "FES_LOE", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
},
|
||||
|
||||
// MENUPAGE_DELETE_FAILED = 17
|
||||
{ "FET_DG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
{ "FET_DG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
MENUACTION_LABEL, "FES_DEE", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_CHANGEMENU, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
|
||||
},
|
||||
|
||||
// MENUPAGE_DEBUG_MENU = 18
|
||||
{ "FED_DBG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
|
||||
{ "FED_DBG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 4, 0,
|
||||
MENUACTION_RELOADIDE, "FED_RID", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_RELOADIPL, "FED_RIP", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_SETDBGFLAG, "FED_DFL", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_SWITCHBIGWHITEDEBUGLIGHT, "FED_DLS", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_PEDROADGROUPS, "FED_SPR", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_CARROADGROUPS, "FED_SCR", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_COLLISIONPOLYS, "FED_SCP", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_PARSEHEAP, "FED_PAH", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_SHOWCULL, "FED_SCZ", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_DEBUGSTREAM, "FED_DSR", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
},
|
||||
|
||||
// MENUPAGE_MEMORY_CARD_1 = 19
|
||||
{ "FEM_MCM", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
|
||||
// MENUPAGE_MEMORY_CARD_DEBUG = 19
|
||||
{ "FEM_MCM", 1, MENUPAGE_NONE, MENUPAGE_NONE, 7, 0,
|
||||
MENUACTION_REGMEMCARD1, "FEM_RMC", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_TESTFORMATMEMCARD1, "FEM_TFM", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_TESTUNFORMATMEMCARD1, "FEM_TUM", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_CREATEROOTDIR, "FEM_CRD", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_CREATELOADICONS, "FEM_CLI", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_FILLWITHGUFF, "FEM_FFF", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_SAVEONLYTHEGAME, "FEM_SOG", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_SAVEGAME, "FEM_STG", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_SAVEGAMEUNDERGTA, "FEM_STS", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_CREATECOPYPROTECTED, "FEM_CPD", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
},
|
||||
|
||||
// MENUPAGE_MEMORY_CARD_2 = 20
|
||||
{ "FEM_MC2", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
// MENUPAGE_MEMORY_CARD_TEST = 20
|
||||
{ "FEM_MC2", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
|
||||
},
|
||||
|
||||
// MENUPAGE_MULTIPLAYER_MAIN = 21
|
||||
{ "FET_MP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
{ "FET_MP", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
|
||||
},
|
||||
|
||||
// MENUPAGE_SAVE_FAILED_1 = 22
|
||||
{ "MCDNSP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
// MENUPAGE_PS2_SAVE_FAILED = 22
|
||||
{ "MCDNSP", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
MENUACTION_MEMCARDSAVECONFIRM, "JAILB_U", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
},
|
||||
|
||||
// MENUPAGE_SAVE_FAILED_2 = 23
|
||||
{ "MCGNSP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
// MENUPAGE_PS2_SAVE_FAILED_2 = 23
|
||||
{ "MCGNSP", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
MENUACTION_MEMCARDSAVECONFIRM, "JAILB_U", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
},
|
||||
|
||||
// Unused in PC but anyway
|
||||
// MENUPAGE_SAVE = 24
|
||||
#ifdef PS2_SAVE_DIALOG
|
||||
{ "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
{ "FET_SG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
MENUACTION_CHANGEMENU, "FESZ_SA", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
|
||||
MENUACTION_RESUME_FROM_SAVEZONE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
},
|
||||
#else
|
||||
{ "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
{ "FET_SG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
MENUACTION_LABEL, "FES_SCG", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_POPULATESLOTS_CHANGEMENU, "GMSAVE", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
|
||||
MENUACTION_RESUME_FROM_SAVEZONE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
},
|
||||
#endif
|
||||
|
||||
// MENUPAGE_NO_MEMORY_CARD = 25
|
||||
{ "FES_NOC", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
|
||||
// MENUPAGE_NO_MEMORY_CARD_2 = 25
|
||||
{ "FES_NOC", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
},
|
||||
|
||||
// MENUPAGE_CHOOSE_SAVE_SLOT = 26
|
||||
{ "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
{ "FET_SG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
MENUACTION_RESUME_FROM_SAVEZONE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_CHANGEMENU, "FEM_SL1", SAVESLOT_1, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
|
||||
MENUACTION_CHANGEMENU, "FEM_SL2", SAVESLOT_2, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
|
||||
@ -209,59 +236,58 @@ const CMenuScreen aScreens[] = {
|
||||
},
|
||||
|
||||
// MENUPAGE_SAVE_OVERWRITE_CONFIRM = 27
|
||||
{ "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
|
||||
{ "FET_SG", 1, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
|
||||
MENUACTION_LABEL, "FESZ_QO", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_SAVING_IN_PROGRESS,
|
||||
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
|
||||
},
|
||||
|
||||
// MENUPAGE_MULTIPLAYER_MAP = 28
|
||||
{ "FET_MAP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
{ "FET_MAP", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
|
||||
},
|
||||
|
||||
// MENUPAGE_MULTIPLAYER_CONNECTION = 29
|
||||
{ "FET_CON", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
{ "FET_CON", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
|
||||
},
|
||||
|
||||
// MENUPAGE_MULTIPLAYER_FIND_GAME = 30
|
||||
{ "FET_FG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
{ "FET_FG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
|
||||
},
|
||||
|
||||
// MENUPAGE_MULTIPLAYER_MODE = 31
|
||||
{ "FET_GT", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
{ "FET_GT", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
|
||||
},
|
||||
|
||||
// MENUPAGE_MULTIPLAYER_CREATE = 32
|
||||
{ "FET_HG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
{ "FET_HG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
|
||||
},
|
||||
|
||||
// MENUPAGE_MULTIPLAYER_START = 33
|
||||
{ "FEN_STA", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
{ "FEN_STA", 2, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
|
||||
},
|
||||
|
||||
// MENUPAGE_SKIN_SELECT_OLD = 34
|
||||
{ "FET_PS", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
{ "FET_PS", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
|
||||
},
|
||||
|
||||
// MENUPAGE_CONTROLLER_PC = 35
|
||||
{ "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0,
|
||||
{ "FET_CTL", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0,
|
||||
MENUACTION_CTRLMETHOD, "FET_CME", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
|
||||
MENUACTION_CHANGEMENU, "FET_RDK", SAVESLOT_NONE, MENUPAGE_KEYBOARD_CONTROLS,
|
||||
MENUACTION_CHANGEMENU, "FET_AMS", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
|
||||
|
||||
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
|
||||
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
},
|
||||
|
||||
// MENUPAGE_CONTROLLER_PC_OLD1 = 36
|
||||
{ "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 0, 0,
|
||||
{ "FET_CTL", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 0, 0,
|
||||
MENUACTION_GETKEY, "FEC_PLB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD1,
|
||||
MENUACTION_GETKEY, "FEC_CWL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD1,
|
||||
MENUACTION_GETKEY, "FEC_CWR", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD1,
|
||||
@ -275,12 +301,12 @@ const CMenuScreen aScreens[] = {
|
||||
},
|
||||
|
||||
// MENUPAGE_CONTROLLER_PC_OLD2 = 37
|
||||
{ "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 1, 1,
|
||||
{ "FET_CTL", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 1, 1,
|
||||
|
||||
},
|
||||
|
||||
// MENUPAGE_CONTROLLER_PC_OLD3 = 38
|
||||
{ "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 2, 2,
|
||||
{ "FET_CTL", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 2, 2,
|
||||
MENUACTION_GETKEY, "FEC_LUP", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD3,
|
||||
MENUACTION_GETKEY, "FEC_LDN", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD3,
|
||||
MENUACTION_GETKEY, "FEC_SMS", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD3,
|
||||
@ -289,17 +315,25 @@ const CMenuScreen aScreens[] = {
|
||||
},
|
||||
|
||||
// MENUPAGE_CONTROLLER_PC_OLD4 = 39
|
||||
{ "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 3, 3,
|
||||
{ "FET_CTL", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 3, 3,
|
||||
|
||||
},
|
||||
|
||||
// MENUPAGE_CONTROLLER_DEBUG = 40
|
||||
{ "FEC_DBG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
|
||||
{ "FEC_DBG", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 3, 3,
|
||||
MENUACTION_GETKEY, "FEC_TGD", SAVESLOT_NONE, MENUPAGE_CONTROLLER_DEBUG,
|
||||
MENUACTION_GETKEY, "FEC_TDO", SAVESLOT_NONE, MENUPAGE_CONTROLLER_DEBUG,
|
||||
MENUACTION_GETKEY, "FEC_TSS", SAVESLOT_NONE, MENUPAGE_CONTROLLER_DEBUG,
|
||||
MENUACTION_GETKEY, "FEC_SMS", SAVESLOT_NONE, MENUPAGE_CONTROLLER_DEBUG,
|
||||
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
},
|
||||
|
||||
// MENUPAGE_OPTIONS = 41
|
||||
{ "FET_OPT", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 1, 4,
|
||||
#ifdef MENU_MAP
|
||||
{ "FET_OPT", 1, MENUPAGE_NONE, MENUPAGE_NONE, 1, 5,
|
||||
#else
|
||||
{ "FET_OPT", 1, MENUPAGE_NONE, MENUPAGE_NONE, 1, 4,
|
||||
#endif
|
||||
MENUACTION_CHANGEMENU, "FET_CTL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
|
||||
MENUACTION_LOADRADIO, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
|
||||
MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
|
||||
@ -309,67 +343,74 @@ const CMenuScreen aScreens[] = {
|
||||
},
|
||||
|
||||
// MENUPAGE_EXIT = 42
|
||||
{ "FET_QG", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 2, 5,
|
||||
#ifdef MENU_MAP
|
||||
{ "FET_QG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 2, 6,
|
||||
#else
|
||||
{ "FET_QG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 2, 5,
|
||||
#endif
|
||||
MENUACTION_LABEL, "FEQ_SRE", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_CANCELGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
},
|
||||
|
||||
// MENUPAGE_SAVING_IN_PROGRESS = 43
|
||||
{ "", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
|
||||
{ "", 1, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
|
||||
MENUACTION_LABEL, "FES_WAR", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
},
|
||||
|
||||
// MENUPAGE_SAVE_SUCCESSFUL = 44
|
||||
{ "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
|
||||
{ "FET_SG", 1, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
|
||||
MENUACTION_LABEL, "FES_SSC", SAVESLOT_LABEL, MENUPAGE_NONE,
|
||||
MENUACTION_RESUME_FROM_SAVEZONE, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
|
||||
},
|
||||
|
||||
// MENUPAGE_DELETING = 45
|
||||
{ "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0,
|
||||
{ "FET_DG", 1, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0,
|
||||
MENUACTION_LABEL, "FED_DLW", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
},
|
||||
|
||||
// MENUPAGE_DELETE_SUCCESS = 46
|
||||
{ "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0,
|
||||
{ "FET_DG", 1, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, 0, 0,
|
||||
MENUACTION_LABEL, "DEL_FNM", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_CHANGEMENU, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
|
||||
},
|
||||
|
||||
// MENUPAGE_SAVE_FAILED = 47
|
||||
{ "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
|
||||
{ "FET_SG", 1, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
|
||||
MENUACTION_LABEL, "FEC_SVU", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_CHANGEMENU, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
|
||||
},
|
||||
|
||||
// MENUPAGE_LOAD_FAILED = 48
|
||||
{ "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
|
||||
{ "FET_SG", 1, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
|
||||
MENUACTION_LABEL, "FEC_SVU", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
},
|
||||
|
||||
// MENUPAGE_LOAD_FAILED_2 = 49
|
||||
{ "FET_LG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
|
||||
{ "FET_LG", 1, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, 0, 0,
|
||||
MENUACTION_LABEL, "FEC_LUN", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT,
|
||||
},
|
||||
|
||||
// MENUPAGE_FILTER_GAME = 50
|
||||
{ "FIL_FLT", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
{ "FIL_FLT", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
|
||||
},
|
||||
|
||||
// MENUPAGE_START_MENU = 51
|
||||
{ "FEM_MM", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
{ "FEM_MM", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
MENUACTION_CHANGEMENU, "FEN_STA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
|
||||
MENUACTION_CHANGEMENU, "FET_OPT", SAVESLOT_NONE, MENUPAGE_OPTIONS,
|
||||
MENUACTION_CHANGEMENU, "FEM_QT", SAVESLOT_NONE, MENUPAGE_EXIT,
|
||||
},
|
||||
|
||||
// MENUPAGE_PAUSE_MENU = 52
|
||||
{ "FET_PAU", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
{ "FET_PAU", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
MENUACTION_RESUME, "FEM_RES", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
MENUACTION_CHANGEMENU, "FEN_STA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
|
||||
#ifdef MENU_MAP
|
||||
MENUACTION_CHANGEMENU, "FEG_MAP", SAVESLOT_NONE, MENUPAGE_MAP,
|
||||
#endif
|
||||
MENUACTION_CHANGEMENU, "FEP_STA", SAVESLOT_NONE, MENUPAGE_STATS,
|
||||
MENUACTION_CHANGEMENU, "FEP_BRI", SAVESLOT_NONE, MENUPAGE_BRIEFS,
|
||||
MENUACTION_CHANGEMENU, "FET_OPT", SAVESLOT_NONE, MENUPAGE_OPTIONS,
|
||||
@ -377,22 +418,24 @@ const CMenuScreen aScreens[] = {
|
||||
},
|
||||
|
||||
// MENUPAGE_CHOOSE_MODE = 53
|
||||
{ "FEN_STA", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
|
||||
{ "FEN_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 0, 1,
|
||||
MENUACTION_CHANGEMENU, "FET_SP", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
|
||||
MENUACTION_INITMP, "FET_MP", SAVESLOT_NONE, MENUPAGE_MULTIPLAYER_MAIN,
|
||||
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
|
||||
},
|
||||
|
||||
// MENUPAGE_SKIN_SELECT = 54
|
||||
{ "FET_PSU", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 4, 4,
|
||||
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_MULTIPLAYER_MAIN,
|
||||
{ "FET_PSU", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 4, 4,
|
||||
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_MULTIPLAYER_MAIN,
|
||||
},
|
||||
|
||||
// MENUPAGE_KEYBOARD_CONTROLS = 55
|
||||
{ "FET_STI", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 1, 1,
|
||||
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
|
||||
{ "FET_STI", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 1, 1,
|
||||
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
|
||||
},
|
||||
|
||||
// MENUPAGE_MOUSE_CONTROLS = 56
|
||||
{ "FET_MTI", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 2, 2,
|
||||
{ "FET_MTI", 1, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, 2, 2,
|
||||
MENUACTION_MOUSESENS, "FEC_MSH", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
|
||||
MENUACTION_INVVERT, "FEC_IVV", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
|
||||
MENUACTION_MOUSESTEER, "FET_MST", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
|
||||
@ -400,12 +443,18 @@ const CMenuScreen aScreens[] = {
|
||||
},
|
||||
|
||||
// MENUPAGE_57 = 57
|
||||
{ "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
|
||||
{ "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0,
|
||||
// mission failed, wanna restart page in mobile
|
||||
},
|
||||
|
||||
// MENUPAGE_58 = 58
|
||||
{ "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
|
||||
{ "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0,
|
||||
|
||||
},
|
||||
|
||||
#ifdef MENU_MAP
|
||||
// MENUPAGE_MAP = 59
|
||||
{ "FEG_MAP", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
403
src/core/Pad.cpp
403
src/core/Pad.cpp
@ -21,19 +21,26 @@
|
||||
#include "Hud.h"
|
||||
#include "Text.h"
|
||||
#include "Timer.h"
|
||||
#include "Record.h"
|
||||
#include "World.h"
|
||||
#include "Vehicle.h"
|
||||
#include "Ped.h"
|
||||
#include "Population.h"
|
||||
#include "Record.h"
|
||||
#include "Replay.h"
|
||||
#include "Weather.h"
|
||||
#include "win.h"
|
||||
#include "Streaming.h"
|
||||
#include "PathFind.h"
|
||||
#include "Wanted.h"
|
||||
#include "General.h"
|
||||
|
||||
CPad *Pads = (CPad*)0x6F0360; // [2]
|
||||
CMousePointerStateHelper &MousePointerStateHelper = *(CMousePointerStateHelper*)0x95CC8C;
|
||||
|
||||
bool &CPad::bDisplayNoControllerMessage = *(bool *)0x95CD52;
|
||||
bool &CPad::bObsoleteControllerMessage = *(bool *)0x95CDB8;
|
||||
bool CPad::bOldDisplayNoControllerMessage;
|
||||
bool &CPad::m_bMapPadOneToPadTwo = *(bool *)0x95CD48;
|
||||
|
||||
CKeyboardState &CPad::OldKeyState = *(CKeyboardState*)0x6F1E70;
|
||||
@ -49,29 +56,217 @@ CMouseControllerState &CPad::PCTempMouseControllerState = *(CMouseControllerStat
|
||||
_TODO("gbFastTime");
|
||||
extern bool &gbFastTime;
|
||||
|
||||
WRAPPER void WeaponCheat() { EAXJMP(0x490D90); }
|
||||
WRAPPER void HealthCheat() { EAXJMP(0x490E70); }
|
||||
WRAPPER void TankCheat() { EAXJMP(0x490EE0); }
|
||||
WRAPPER void BlowUpCarsCheat() { EAXJMP(0x491040); }
|
||||
WRAPPER void ChangePlayerCheat() { EAXJMP(0x4910B0); }
|
||||
WRAPPER void MayhemCheat() { EAXJMP(0x4911C0); }
|
||||
WRAPPER void EverybodyAttacksPlayerCheat() { EAXJMP(0x491270); }
|
||||
WRAPPER void WeaponsForAllCheat() { EAXJMP(0x491370); }
|
||||
WRAPPER void FastTimeCheat() { EAXJMP(0x4913A0); }
|
||||
WRAPPER void SlowTimeCheat() { EAXJMP(0x4913F0); }
|
||||
WRAPPER void MoneyCheat() { EAXJMP(0x491430); }
|
||||
WRAPPER void ArmourCheat() { EAXJMP(0x491460); }
|
||||
WRAPPER void WantedLevelUpCheat() { EAXJMP(0x491490); }
|
||||
WRAPPER void WantedLevelDownCheat() { EAXJMP(0x4914F0); }
|
||||
WRAPPER void SunnyWeatherCheat() { EAXJMP(0x491520); }
|
||||
WRAPPER void CloudyWeatherCheat() { EAXJMP(0x491550); }
|
||||
WRAPPER void RainyWeatherCheat() { EAXJMP(0x491580); }
|
||||
WRAPPER void FoggyWeatherCheat() { EAXJMP(0x4915B0); }
|
||||
WRAPPER void FastWeatherCheat() { EAXJMP(0x4915E0); }
|
||||
WRAPPER void OnlyRenderWheelsCheat() { EAXJMP(0x491610); }
|
||||
WRAPPER void ChittyChittyBangBangCheat() { EAXJMP(0x491640); }
|
||||
WRAPPER void StrongGripCheat() { EAXJMP(0x491670); }
|
||||
WRAPPER void NastyLimbsCheat() { EAXJMP(0x4916A0); }
|
||||
void WeaponCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT2"), true);
|
||||
FindPlayerPed()->GiveWeapon(WEAPONTYPE_BASEBALLBAT, 0);
|
||||
FindPlayerPed()->GiveWeapon(WEAPONTYPE_COLT45, 100);
|
||||
FindPlayerPed()->GiveWeapon(WEAPONTYPE_UZI, 100);
|
||||
FindPlayerPed()->GiveWeapon(WEAPONTYPE_SHOTGUN, 20);
|
||||
FindPlayerPed()->GiveWeapon(WEAPONTYPE_AK47, 200);
|
||||
FindPlayerPed()->GiveWeapon(WEAPONTYPE_M16, 200);
|
||||
FindPlayerPed()->GiveWeapon(WEAPONTYPE_SNIPERRIFLE, 5);
|
||||
FindPlayerPed()->GiveWeapon(WEAPONTYPE_ROCKETLAUNCHER, 5);
|
||||
FindPlayerPed()->GiveWeapon(WEAPONTYPE_MOLOTOV, 5);
|
||||
FindPlayerPed()->GiveWeapon(WEAPONTYPE_GRENADE, 5);
|
||||
FindPlayerPed()->GiveWeapon(WEAPONTYPE_FLAMETHROWER, 200);
|
||||
}
|
||||
|
||||
void HealthCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT3"), true);
|
||||
FindPlayerPed()->m_fHealth = 100.0f;
|
||||
if (FindPlayerVehicle()) {
|
||||
FindPlayerVehicle()->m_fHealth = 1000.0f;
|
||||
if (FindPlayerVehicle()->m_vehType == VEHICLE_TYPE_CAR)
|
||||
((CAutomobile*)FindPlayerVehicle())->Damage.SetEngineStatus(0);
|
||||
}
|
||||
}
|
||||
|
||||
void TankCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
|
||||
CStreaming::RequestModel(MI_RHINO, 0);
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
if (CStreaming::ms_aInfoForModel[MI_RHINO].m_loadState == STREAMSTATE_LOADED) {
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
|
||||
int32 node = ThePaths.FindNodeClosestToCoors(FindPlayerCoors(), PATH_CAR, 100.0f);
|
||||
|
||||
if (node < 0) return;
|
||||
|
||||
#ifdef FIX_BUGS
|
||||
CAutomobile* tank = new CAutomobile(MI_RHINO, RANDOM_VEHICLE);
|
||||
#else
|
||||
CAutomobile *tank = new CAutomobile(MI_RHINO, MISSION_VEHICLE);
|
||||
#endif
|
||||
if (tank != nil) {
|
||||
CVector pos = ThePaths.m_pathNodes[node].pos;
|
||||
pos.z += 4.0f;
|
||||
tank->GetPosition() = pos;
|
||||
tank->SetOrientation(0.0f, 0.0f, DEGTORAD(200.0f));
|
||||
|
||||
tank->m_status = STATUS_ABANDONED;
|
||||
tank->m_nDoorLock = CARLOCK_UNLOCKED;
|
||||
CWorld::Add(tank);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BlowUpCarsCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
|
||||
|
||||
int i = CPools::GetVehiclePool()->GetSize();
|
||||
while (i-- > 0) {
|
||||
if (CVehicle *veh = CPools::GetVehiclePool()->GetSlot(i))
|
||||
veh->BlowUpCar(nil);
|
||||
}
|
||||
}
|
||||
|
||||
void ChangePlayerCheat()
|
||||
{
|
||||
int modelId;
|
||||
|
||||
if (FindPlayerPed()->IsPedInControl() && CModelInfo::GetModelInfo("player", nil)) {
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
|
||||
CPlayerPed *ped = FindPlayerPed();
|
||||
AssocGroupId AnimGrp = ped->m_animGroup;
|
||||
do
|
||||
{
|
||||
do
|
||||
modelId = CGeneral::GetRandomNumberInRange(0, MI_CAS_WOM+1);
|
||||
while (!CModelInfo::GetModelInfo(modelId));
|
||||
} while (modelId >= MI_SPECIAL01 && modelId <= MI_SPECIAL04 || modelId == MI_TAXI_D);
|
||||
|
||||
uint8 flags = CStreaming::ms_aInfoForModel[modelId].m_flags;
|
||||
ped->DeleteRwObject();
|
||||
CStreaming::RequestModel(modelId, STREAMFLAGS_DEPENDENCY| STREAMFLAGS_DONT_REMOVE);
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
ped->m_modelIndex = -1;
|
||||
ped->SetModelIndex(modelId);
|
||||
ped->m_animGroup = AnimGrp;
|
||||
if (modelId != MI_PLAYER) {
|
||||
if (!(flags & STREAMFLAGS_DONT_REMOVE))
|
||||
CStreaming::SetModelIsDeletable(modelId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MayhemCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
|
||||
for (int i = PEDTYPE_CIVMALE; i < PEDTYPE_SPECIAL; i++)
|
||||
CPedType::SetThreats(i, PED_FLAG_PLAYER1 | PED_FLAG_PLAYER2 | PED_FLAG_PLAYER3 | PED_FLAG_PLAYER4 |
|
||||
PED_FLAG_CIVMALE | PED_FLAG_CIVFEMALE | PED_FLAG_COP | PED_FLAG_GANG1 |
|
||||
PED_FLAG_GANG2 | PED_FLAG_GANG3 | PED_FLAG_GANG4 | PED_FLAG_GANG5 |
|
||||
PED_FLAG_GANG6 | PED_FLAG_GANG7 | PED_FLAG_GANG8 | PED_FLAG_GANG9 |
|
||||
PED_FLAG_EMERGENCY | PED_FLAG_PROSTITUTE | PED_FLAG_CRIMINAL | PED_FLAG_SPECIAL );
|
||||
}
|
||||
|
||||
void EverybodyAttacksPlayerCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
|
||||
for (int i = PEDTYPE_CIVMALE; i < PEDTYPE_SPECIAL; i++)
|
||||
CPedType::AddThreat(i, PED_FLAG_PLAYER1);
|
||||
}
|
||||
|
||||
void WeaponsForAllCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
|
||||
CPopulation::ms_bGivePedsWeapons = !CPopulation::ms_bGivePedsWeapons;
|
||||
}
|
||||
|
||||
void FastTimeCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
|
||||
if (CTimer::GetTimeScale() < 4.0f)
|
||||
CTimer::SetTimeScale(CTimer::GetTimeScale() * 2.0f);
|
||||
}
|
||||
|
||||
void SlowTimeCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
|
||||
if (CTimer::GetTimeScale() > 0.25f)
|
||||
CTimer::SetTimeScale(CTimer::GetTimeScale() * 0.5f);
|
||||
}
|
||||
|
||||
void MoneyCheat()
|
||||
{
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 250000;
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT6"), true);
|
||||
}
|
||||
|
||||
void ArmourCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT4"), true);
|
||||
FindPlayerPed()->m_fArmour = 100.0f;
|
||||
}
|
||||
|
||||
void WantedLevelUpCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT5"), true);
|
||||
FindPlayerPed()->SetWantedLevel(min(FindPlayerPed()->m_pWanted->m_nWantedLevel + 2, 6));
|
||||
}
|
||||
|
||||
void WantedLevelDownCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT5"), true);
|
||||
FindPlayerPed()->SetWantedLevel(0);
|
||||
}
|
||||
|
||||
void SunnyWeatherCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT7"), true);
|
||||
CWeather::ForceWeatherNow(WEATHER_SUNNY);
|
||||
}
|
||||
|
||||
void CloudyWeatherCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT7"), true);
|
||||
CWeather::ForceWeatherNow(WEATHER_CLOUDY);
|
||||
}
|
||||
|
||||
void RainyWeatherCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT7"), true);
|
||||
CWeather::ForceWeatherNow(WEATHER_RAINY);
|
||||
}
|
||||
|
||||
void FoggyWeatherCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT7"), true);
|
||||
CWeather::ForceWeatherNow(WEATHER_FOGGY);
|
||||
}
|
||||
|
||||
void FastWeatherCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
|
||||
gbFastTime = !gbFastTime;
|
||||
}
|
||||
|
||||
void OnlyRenderWheelsCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
|
||||
CVehicle::bWheelsOnlyCheat = !CVehicle::bWheelsOnlyCheat;
|
||||
}
|
||||
|
||||
|
||||
void ChittyChittyBangBangCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
|
||||
CVehicle::bAllDodosCheat = !CVehicle::bAllDodosCheat;
|
||||
}
|
||||
|
||||
void StrongGripCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
|
||||
CVehicle::bCheat3 = !CVehicle::bCheat3;
|
||||
}
|
||||
|
||||
void NastyLimbsCheat()
|
||||
{
|
||||
CPed::bNastyLimbsCheat = !CPed::bNastyLimbsCheat;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef KANGAROO_CHEAT
|
||||
@ -88,7 +283,7 @@ void KangarooCheat()
|
||||
string = TheText.Get("CHEAT1");
|
||||
m_fMass = 15.0f;
|
||||
}
|
||||
CHud::SetHelpMessage(string, 1);
|
||||
CHud::SetHelpMessage(string, true);
|
||||
playerPed->m_ped_flagI80 = !playerPed->m_ped_flagI80;
|
||||
|
||||
playerPed->m_fMass = m_fMass;
|
||||
@ -137,6 +332,21 @@ void CKeyboardState::Clear()
|
||||
LWIN = RWIN = APPS = 0;
|
||||
}
|
||||
|
||||
#ifdef GTA_PS2_STUFF
|
||||
void CPad::Initialise(void)
|
||||
{
|
||||
for (int i = 0; i < MAX_PADS; i++)
|
||||
{
|
||||
CPad::GetPad(i)->Clear(true);
|
||||
CPad::GetPad(i)->Mode = 0;
|
||||
}
|
||||
|
||||
bObsoleteControllerMessage = false;
|
||||
bOldDisplayNoControllerMessage = false;
|
||||
bDisplayNoControllerMessage = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
void CPad::Clear(bool bResetPlayerControls)
|
||||
{
|
||||
NewState.Clear();
|
||||
@ -164,13 +374,13 @@ void CPad::Clear(bool bResetPlayerControls)
|
||||
bApplyBrakes = false;
|
||||
|
||||
|
||||
for ( int32 i = 0; i < _TODOCONST(5); i++ )
|
||||
for ( int32 i = 0; i < HORNHISTORY_SIZE; i++ )
|
||||
bHornHistory[i] = false;
|
||||
|
||||
iCurrHornHistory = 0;
|
||||
|
||||
for ( int32 i = 0; i < _TODOCONST(12); i++ )
|
||||
_unk[i] = ' ';
|
||||
for ( int32 i = 0; i < ARRAY_SIZE(CheatString); i++ )
|
||||
CheatString[i] = ' ';
|
||||
|
||||
LastTimeTouched = CTimer::GetTimeInMilliseconds();
|
||||
AverageWeapon = 0;
|
||||
@ -429,6 +639,108 @@ void CPad::StartShake_Train(float fX, float fY)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef GTA_PS2_STUFF
|
||||
void CPad::AddToCheatString(char c)
|
||||
{
|
||||
for ( int32 i = ARRAY_SIZE(CheatString) - 2; i >= 0; i-- )
|
||||
CheatString[i + 1] = CheatString[i];
|
||||
|
||||
#define _CHEATCMP(str) strncmp(str, CheatString, sizeof(str)-1)
|
||||
// "4414LDRULDRU" - R2 R2 L1 R2 LEFT DOWN RIGHT UP LEFT DOWN RIGHT UP
|
||||
if ( !_CHEATCMP("URDLURDL4144") )
|
||||
WeaponCheat();
|
||||
|
||||
// "4411LDRULDRU" - R2 R2 L1 L1 LEFT DOWN RIGHT UP LEFT DOWN RIGHT UP
|
||||
else if ( !_CHEATCMP("URDLURDL1144") )
|
||||
MoneyCheat();
|
||||
|
||||
// "4412LDRULDRU" - R2 R2 L1 L2 LEFT DOWN RIGHT UP LEFT DOWN RIGHT UP
|
||||
else if ( !_CHEATCMP("URDLURDL2144") )
|
||||
ArmourCheat();
|
||||
|
||||
// "4413LDRULDRU" - R2 R2 L1 R1 LEFT DOWN RIGHT UP LEFT DOWN RIGHT UP
|
||||
else if ( !_CHEATCMP("URDLURDL3144") )
|
||||
HealthCheat();
|
||||
|
||||
// "4414LRLRLR" - R2 R2 L1 R2 LEFT RIGHT LEFT RIGHT LEFT RIGHT
|
||||
else if ( !_CHEATCMP("RLRLRL4144") )
|
||||
WantedLevelUpCheat();
|
||||
|
||||
// "4414UDUDUD" - R2 R2 L1 R2 UP DOWN UP DOWN UP DOWN
|
||||
else if ( !_CHEATCMP("DUDUDU4144") )
|
||||
WantedLevelDownCheat();
|
||||
|
||||
// "1234432T" - L1 L2 R1 R2 R2 R1 L2 TRIANGLE
|
||||
else if ( !_CHEATCMP("T2344321") )
|
||||
SunnyWeatherCheat();
|
||||
|
||||
// "1234432S" - L1 L2 R1 R2 R2 R1 L2 SQUARE
|
||||
else if ( !_CHEATCMP("S2344321") )
|
||||
CloudyWeatherCheat();
|
||||
|
||||
// "1234432C" - L1 L2 R1 R2 R2 R1 L2 CIRCLE
|
||||
else if ( !_CHEATCMP("C2344321") )
|
||||
RainyWeatherCheat();
|
||||
|
||||
// "1234432X" - L1 L2 R1 R2 R2 R1 L2 CROSS
|
||||
else if ( !_CHEATCMP("X2344321") )
|
||||
FoggyWeatherCheat();
|
||||
|
||||
// "CCCCCC321TCT" - CIRCLE CIRCLE CIRCLE CIRCLE CIRCLE CIRCLE R1 L2 L1 TRIANGLE CIRCLE TRIANGLE
|
||||
else if ( !_CHEATCMP("TCT123CCCCCC") )
|
||||
TankCheat();
|
||||
|
||||
// "CCCSSSSS1TCT" - CIRCLE CIRCLE CIRCLE SQUARE SQUARE SQUARE SQUARE SQUARE L1 TRIANGLE CIRCLE TRIANGLE
|
||||
else if ( !_CHEATCMP("TCT1SSSSSCCC") )
|
||||
FastWeatherCheat();
|
||||
|
||||
// "241324TSCT21" - L2 R2 L1 R1 L2 R2 TRIANGLE SQUARE CIRCLE TRIANGLE L2 L1
|
||||
else if ( !_CHEATCMP("12TCST423142") )
|
||||
BlowUpCarsCheat();
|
||||
|
||||
// "RDLU12ULDR" - RIGHT DOWN LEFT UP L1 L2 UP LEFT DOWN RIGHT
|
||||
else if ( !_CHEATCMP("RDLU21ULDR") )
|
||||
ChangePlayerCheat();
|
||||
|
||||
// "DULUX3421" - DOWN UP LEFT UP CROSS R1 R2 L2 L1
|
||||
else if ( !_CHEATCMP("1243XULUD") )
|
||||
MayhemCheat();
|
||||
|
||||
// "DULUX3412" - DOWN UP LEFT UP CROSS R1 R2 L1 L2
|
||||
else if ( !_CHEATCMP("2143XULUD") )
|
||||
EverybodyAttacksPlayerCheat();
|
||||
|
||||
// "43TX21UD" - R2 R1 TRIANGLE CROSS L2 L1 UP DOWN
|
||||
else if ( !_CHEATCMP("DU12XT34") )
|
||||
WeaponsForAllCheat();
|
||||
|
||||
// "TURDS12" - TRIANGLE UP RIGHT DOWN SQUARE L1 L2
|
||||
else if ( !_CHEATCMP("21SDRUT") )
|
||||
FastTimeCheat();
|
||||
|
||||
// "TURDS34" - TRIANGLE UP RIGHT DOWN SQUARE R1 R2
|
||||
else if ( !_CHEATCMP("43SDRUT") )
|
||||
SlowTimeCheat();
|
||||
|
||||
// "11S4T1T" - L1 L1 SQUARE R2 TRIANGLE L1 TRIANGLE
|
||||
else if ( !_CHEATCMP("T1T4S11") )
|
||||
OnlyRenderWheelsCheat();
|
||||
|
||||
// "R4C32D13" - RIGHT R2 CIRCLE R1 L2 DOWN L1 R1
|
||||
else if ( !_CHEATCMP("31D23C4R") )
|
||||
ChittyChittyBangBangCheat();
|
||||
|
||||
// "3141L33T" - R1 L1 R2 L1 LEFT R1 R1 TRIANGLE
|
||||
else if ( !_CHEATCMP("T33L1413") )
|
||||
StrongGripCheat();
|
||||
|
||||
// "S1CD13TR1X" - SQUARE L1 CIRCLE DOWN L1 R1 TRIANGLE RIGHT L1 CROSS
|
||||
else if ( !_CHEATCMP("X1RT31DC1S") )
|
||||
NastyLimbsCheat();
|
||||
#undef _CHEATCMP
|
||||
}
|
||||
#endif
|
||||
|
||||
void CPad::AddToPCCheatString(char c)
|
||||
{
|
||||
for ( int32 i = ARRAY_SIZE(KeyBoardCheatString) - 2; i >= 0; i-- )
|
||||
@ -657,8 +969,13 @@ void CPad::Update(int16 unk)
|
||||
{
|
||||
OldState = NewState;
|
||||
|
||||
NewState = ReconcileTwoControllersInput(PCTempKeyState, PCTempJoyState);
|
||||
NewState = ReconcileTwoControllersInput(PCTempMouseState, NewState);
|
||||
#if (defined GTA_PS2 || defined FIX_BUGS)
|
||||
if (!CRecordDataForGame::IsPlayingBack() && !CRecordDataForChase::ShouldThisPadBeLeftAlone(unk))
|
||||
#endif
|
||||
{
|
||||
NewState = ReconcileTwoControllersInput(PCTempKeyState, PCTempJoyState);
|
||||
NewState = ReconcileTwoControllersInput(PCTempMouseState, NewState);
|
||||
}
|
||||
|
||||
PCTempJoyState.Clear();
|
||||
PCTempKeyState.Clear();
|
||||
@ -666,7 +983,7 @@ void CPad::Update(int16 unk)
|
||||
|
||||
ProcessPCSpecificStuff();
|
||||
|
||||
if ( ++iCurrHornHistory >= _TODOCONST(5) )
|
||||
if ( ++iCurrHornHistory >= HORNHISTORY_SIZE )
|
||||
iCurrHornHistory = 0;
|
||||
|
||||
bHornHistory[iCurrHornHistory] = GetHorn();
|
||||
@ -683,7 +1000,7 @@ void CPad::DoCheats(void)
|
||||
|
||||
void CPad::DoCheats(int16 unk)
|
||||
{
|
||||
#ifdef PS2
|
||||
#ifdef GTA_PS2_STUFF
|
||||
if ( GetTriangleJustDown() )
|
||||
AddToCheatString('T');
|
||||
|
||||
@ -2087,6 +2404,30 @@ int32 *CPad::EditCodesForControls(int32 *pRsKeys, int32 nSize)
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x490D90, &WeaponCheat, PATCH_JUMP);
|
||||
InjectHook(0x490E70, &HealthCheat, PATCH_JUMP);
|
||||
InjectHook(0x490EE0, &TankCheat, PATCH_JUMP);
|
||||
InjectHook(0x491040, &BlowUpCarsCheat, PATCH_JUMP);
|
||||
InjectHook(0x4910B0, &ChangePlayerCheat, PATCH_JUMP);
|
||||
InjectHook(0x4911C0, &MayhemCheat, PATCH_JUMP);
|
||||
InjectHook(0x491270, &EverybodyAttacksPlayerCheat, PATCH_JUMP);
|
||||
InjectHook(0x491370, &WeaponsForAllCheat, PATCH_JUMP);
|
||||
InjectHook(0x4913A0, &FastTimeCheat, PATCH_JUMP);
|
||||
InjectHook(0x4913F0, &SlowTimeCheat, PATCH_JUMP);
|
||||
InjectHook(0x491430, &MoneyCheat, PATCH_JUMP);
|
||||
InjectHook(0x491460, &ArmourCheat, PATCH_JUMP);
|
||||
InjectHook(0x491490, &WantedLevelUpCheat, PATCH_JUMP);
|
||||
InjectHook(0x4914F0, &WantedLevelDownCheat, PATCH_JUMP);
|
||||
InjectHook(0x491520, &SunnyWeatherCheat, PATCH_JUMP);
|
||||
InjectHook(0x491550, &CloudyWeatherCheat, PATCH_JUMP);
|
||||
InjectHook(0x491580, &RainyWeatherCheat, PATCH_JUMP);
|
||||
InjectHook(0x4915B0, &FoggyWeatherCheat, PATCH_JUMP);
|
||||
InjectHook(0x4915E0, &FastWeatherCheat, PATCH_JUMP);
|
||||
InjectHook(0x491610, &OnlyRenderWheelsCheat, PATCH_JUMP);
|
||||
InjectHook(0x491640, &ChittyChittyBangBangCheat, PATCH_JUMP);
|
||||
InjectHook(0x491670, &StrongGripCheat, PATCH_JUMP);
|
||||
InjectHook(0x4916A0, &NastyLimbsCheat, PATCH_JUMP);
|
||||
|
||||
InjectHook(0x4916C0, &CControllerState::Clear, PATCH_JUMP);
|
||||
InjectHook(0x491760, &CKeyboardState::Clear, PATCH_JUMP);
|
||||
InjectHook(0x491A10, &CPad::Clear, PATCH_JUMP);
|
||||
|
@ -136,6 +136,10 @@ enum
|
||||
class CPad
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
HORNHISTORY_SIZE = 5,
|
||||
};
|
||||
CControllerState NewState;
|
||||
CControllerState OldState;
|
||||
CControllerState PCTempKeyState;
|
||||
@ -146,11 +150,11 @@ public:
|
||||
int16 Mode;
|
||||
int16 ShakeDur;
|
||||
uint8 ShakeFreq;
|
||||
bool bHornHistory[5];
|
||||
bool bHornHistory[HORNHISTORY_SIZE];
|
||||
uint8 iCurrHornHistory;
|
||||
uint8 DisablePlayerControls;
|
||||
int8 bApplyBrakes;
|
||||
char _unk[12]; //int32 unk[3];
|
||||
char CheatString[12];
|
||||
char _pad0[3];
|
||||
int32 LastTimeTouched;
|
||||
int32 AverageWeapon;
|
||||
@ -161,6 +165,7 @@ public:
|
||||
|
||||
static bool &bDisplayNoControllerMessage;
|
||||
static bool &bObsoleteControllerMessage;
|
||||
static bool bOldDisplayNoControllerMessage;
|
||||
static bool &m_bMapPadOneToPadTwo;
|
||||
|
||||
static CKeyboardState &OldKeyState;
|
||||
@ -172,8 +177,9 @@ public:
|
||||
static CMouseControllerState &PCTempMouseControllerState;
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef GTA_PS2_STUFF
|
||||
static void Initialise(void);
|
||||
#endif
|
||||
void Clear(bool bResetPlayerControls);
|
||||
void ClearMouseHistory();
|
||||
void UpdateMouse();
|
||||
@ -181,6 +187,9 @@ public:
|
||||
void StartShake(int16 nDur, uint8 nFreq);
|
||||
void StartShake_Distance(int16 nDur, uint8 nFreq, float fX, float fY, float fz);
|
||||
void StartShake_Train(float fX, float fY);
|
||||
#ifdef GTA_PS2_STUFF
|
||||
void AddToCheatString(char c);
|
||||
#endif
|
||||
void AddToPCCheatString(char c);
|
||||
|
||||
static void UpdatePads(void);
|
||||
@ -409,6 +418,7 @@ public:
|
||||
bool GetLeftStickXJustDown() { return !!(NewState.LeftStickX && !OldState.LeftStickX); }
|
||||
bool GetLeftStickYJustDown() { return !!(NewState.LeftStickY && !OldState.LeftStickY); }
|
||||
|
||||
bool GetTriangleJustUp() { return !!(!NewState.Triangle && OldState.Triangle); }
|
||||
bool GetCrossJustUp() { return !!(!NewState.Cross && OldState.Cross); }
|
||||
bool GetSquareJustUp() { return !!(!NewState.Square && OldState.Square); }
|
||||
bool GetDPadUpJustUp() { return !!(!NewState.DPadUp && OldState.DPadUp); }
|
||||
|
@ -1,8 +1,14 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "Pools.h"
|
||||
#include "World.h"
|
||||
|
||||
#include "Boat.h"
|
||||
#include "CarCtrl.h"
|
||||
#include "Population.h"
|
||||
#include "ProjectileInfo.h"
|
||||
#include "Streaming.h"
|
||||
#include "Wanted.h"
|
||||
#include "World.h"
|
||||
|
||||
CCPtrNodePool *&CPools::ms_pPtrNodePool = *(CCPtrNodePool**)0x943044;
|
||||
CEntryInfoNodePool *&CPools::ms_pEntryInfoNodePool = *(CEntryInfoNodePool**)0x941448;
|
||||
@ -14,13 +20,6 @@ CObjectPool *&CPools::ms_pObjectPool = *(CObjectPool**)0x880E28;
|
||||
CDummyPool *&CPools::ms_pDummyPool = *(CDummyPool**)0x8F2C18;
|
||||
CAudioScriptObjectPool *&CPools::ms_pAudioScriptObjectPool = *(CAudioScriptObjectPool**)0x8F1B6C;
|
||||
|
||||
WRAPPER void CPools::LoadObjectPool(uint8* buf, uint32 size) { EAXJMP(0x4a2550); }
|
||||
WRAPPER void CPools::LoadPedPool(uint8* buf, uint32 size) { EAXJMP(0x4a2b50); }
|
||||
WRAPPER void CPools::LoadVehiclePool(uint8* buf, uint32 size) { EAXJMP(0x4a1b40); }
|
||||
WRAPPER void CPools::SaveObjectPool(uint8* buf, uint32 *size) { EAXJMP(0x4a22d0); }
|
||||
WRAPPER void CPools::SavePedPool(uint8* buf, uint32 *size) { EAXJMP(0x4a29b0); }
|
||||
WRAPPER void CPools::SaveVehiclePool(uint8* buf, uint32 *size) { EAXJMP(0x4a2080); }
|
||||
|
||||
void
|
||||
CPools::Initialise(void)
|
||||
{
|
||||
@ -99,6 +98,333 @@ CPools::MakeSureSlotInObjectPoolIsEmpty(int32 slot)
|
||||
}
|
||||
}
|
||||
|
||||
void CPools::LoadVehiclePool(uint8* buf, uint32 size)
|
||||
{
|
||||
INITSAVEBUF
|
||||
int nNumCars = ReadSaveBuf<int>(buf);
|
||||
int nNumBoats = ReadSaveBuf<int>(buf);
|
||||
for (int i = 0; i < nNumCars + nNumBoats; i++) {
|
||||
uint32 type = ReadSaveBuf<uint32>(buf);
|
||||
int16 model = ReadSaveBuf<int16>(buf);
|
||||
CStreaming::RequestModel(model, STREAMFLAGS_DEPENDENCY);
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
int32 slot = ReadSaveBuf<int32>(buf);
|
||||
CVehicle* pVehicle;
|
||||
char* vbuf = new char[max(sizeof(CAutomobile), sizeof(CBoat))];
|
||||
if (type == VEHICLE_TYPE_BOAT) {
|
||||
memcpy(vbuf, buf, sizeof(CBoat));
|
||||
SkipSaveBuf(buf, sizeof(CBoat));
|
||||
CBoat* pBoat = new(slot) CBoat(model, RANDOM_VEHICLE);
|
||||
pVehicle = pBoat;
|
||||
--CCarCtrl::NumRandomCars; // why?
|
||||
}
|
||||
else if (type == VEHICLE_TYPE_CAR) {
|
||||
memcpy(vbuf, buf, sizeof(CAutomobile));
|
||||
SkipSaveBuf(buf, sizeof(CAutomobile));
|
||||
CStreaming::RequestModel(model, 0); // is it needed?
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
CAutomobile* pAutomobile = new(slot) CAutomobile(model, RANDOM_VEHICLE);
|
||||
pVehicle = pAutomobile;
|
||||
CCarCtrl::NumRandomCars--; // why?
|
||||
pAutomobile->Damage = ((CAutomobile*)vbuf)->Damage;
|
||||
pAutomobile->SetupDamageAfterLoad();
|
||||
}
|
||||
else
|
||||
assert(0);
|
||||
CVehicle* pBufferVehicle = (CVehicle*)vbuf;
|
||||
pVehicle->GetMatrix() = pBufferVehicle->GetMatrix();
|
||||
pVehicle->VehicleCreatedBy = pBufferVehicle->VehicleCreatedBy;
|
||||
pVehicle->m_currentColour1 = pBufferVehicle->m_currentColour1;
|
||||
pVehicle->m_currentColour2 = pBufferVehicle->m_currentColour2;
|
||||
pVehicle->m_nAlarmState = pBufferVehicle->m_nAlarmState;
|
||||
pVehicle->m_nNumMaxPassengers = pBufferVehicle->m_nNumMaxPassengers;
|
||||
pVehicle->field_1D0[0] = pBufferVehicle->field_1D0[0];
|
||||
pVehicle->field_1D0[1] = pBufferVehicle->field_1D0[1];
|
||||
pVehicle->field_1D0[2] = pBufferVehicle->field_1D0[2];
|
||||
pVehicle->field_1D0[3] = pBufferVehicle->field_1D0[3];
|
||||
pVehicle->m_fSteerAngle = pBufferVehicle->m_fSteerAngle;
|
||||
pVehicle->m_fGasPedal = pBufferVehicle->m_fGasPedal;
|
||||
pVehicle->m_fBrakePedal = pBufferVehicle->m_fBrakePedal;
|
||||
pVehicle->bIsLawEnforcer = pBufferVehicle->bIsLawEnforcer;
|
||||
pVehicle->bIsLocked = pBufferVehicle->bIsLocked;
|
||||
pVehicle->bEngineOn = pBufferVehicle->bEngineOn;
|
||||
pVehicle->bIsHandbrakeOn = pBufferVehicle->bIsHandbrakeOn;
|
||||
pVehicle->bLightsOn = pBufferVehicle->bLightsOn;
|
||||
pVehicle->bFreebies = pBufferVehicle->bFreebies;
|
||||
pVehicle->m_fHealth = pBufferVehicle->m_fHealth;
|
||||
pVehicle->m_nCurrentGear = pBufferVehicle->m_nCurrentGear;
|
||||
pVehicle->m_fChangeGearTime = pBufferVehicle->m_fChangeGearTime;
|
||||
pVehicle->m_nTimeOfDeath = pBufferVehicle->m_nTimeOfDeath;
|
||||
#ifdef FIX_BUGS //must be copypaste
|
||||
pVehicle->m_nBombTimer = pBufferVehicle->m_nBombTimer;
|
||||
#else
|
||||
pVehicle->m_nTimeOfDeath = pBufferVehicle->m_nTimeOfDeath;
|
||||
#endif
|
||||
pVehicle->m_nDoorLock = pBufferVehicle->m_nDoorLock;
|
||||
pVehicle->m_status = pBufferVehicle->m_status;
|
||||
pVehicle->m_type = pBufferVehicle->m_type;
|
||||
(pVehicle->GetAddressOfEntityProperties())[0] = (pBufferVehicle->GetAddressOfEntityProperties())[0];
|
||||
(pVehicle->GetAddressOfEntityProperties())[1] = (pBufferVehicle->GetAddressOfEntityProperties())[1];
|
||||
pVehicle->AutoPilot = pBufferVehicle->AutoPilot;
|
||||
CWorld::Add(pVehicle);
|
||||
delete[] vbuf;
|
||||
}
|
||||
VALIDATESAVEBUF(size)
|
||||
}
|
||||
|
||||
void CPools::SaveVehiclePool(uint8* buf, uint32* size)
|
||||
{
|
||||
INITSAVEBUF
|
||||
int nNumCars = 0;
|
||||
int nNumBoats = 0;
|
||||
int nPoolSize = GetVehiclePool()->GetSize();
|
||||
for (int i = 0; i < nPoolSize; i++) {
|
||||
CVehicle* pVehicle = GetVehiclePool()->GetSlot(i);
|
||||
if (!pVehicle)
|
||||
continue;
|
||||
bool bHasPassenger = false;
|
||||
for (int j = 0; j < ARRAY_SIZE(pVehicle->pPassengers); j++) {
|
||||
if (pVehicle->pPassengers[i])
|
||||
bHasPassenger = true;
|
||||
}
|
||||
if (!pVehicle->pDriver && !bHasPassenger) {
|
||||
if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
|
||||
++nNumCars;
|
||||
if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
|
||||
++nNumBoats;
|
||||
}
|
||||
}
|
||||
*size = nNumCars * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + sizeof(CAutomobile)) + sizeof(int) +
|
||||
nNumBoats * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + sizeof(CBoat)) + sizeof(int);
|
||||
WriteSaveBuf(buf, nNumCars);
|
||||
WriteSaveBuf(buf, nNumBoats);
|
||||
for (int i = 0; i < nPoolSize; i++) {
|
||||
CVehicle* pVehicle = GetVehiclePool()->GetSlot(i);
|
||||
if (!pVehicle)
|
||||
continue;
|
||||
bool bHasPassenger = false;
|
||||
for (int j = 0; j < ARRAY_SIZE(pVehicle->pPassengers); j++) {
|
||||
if (pVehicle->pPassengers[j])
|
||||
bHasPassenger = true;
|
||||
}
|
||||
if (!pVehicle->pDriver && !bHasPassenger) {
|
||||
if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
|
||||
WriteSaveBuf(buf, (uint32)pVehicle->m_vehType);
|
||||
WriteSaveBuf(buf, pVehicle->m_modelIndex);
|
||||
WriteSaveBuf(buf, GetVehicleRef(pVehicle));
|
||||
memcpy(buf, pVehicle, sizeof(CAutomobile));
|
||||
SkipSaveBuf(buf, sizeof(CAutomobile));
|
||||
}
|
||||
if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
|
||||
WriteSaveBuf(buf, (uint32)pVehicle->m_vehType);
|
||||
WriteSaveBuf(buf, pVehicle->m_modelIndex);
|
||||
WriteSaveBuf(buf, GetVehicleRef(pVehicle));
|
||||
memcpy(buf, pVehicle, sizeof(CBoat));
|
||||
SkipSaveBuf(buf, sizeof(CBoat));
|
||||
}
|
||||
}
|
||||
}
|
||||
VALIDATESAVEBUF(*size)
|
||||
}
|
||||
|
||||
void CPools::SaveObjectPool(uint8* buf, uint32* size)
|
||||
{
|
||||
INITSAVEBUF
|
||||
CProjectileInfo::RemoveAllProjectiles();
|
||||
CObject::DeleteAllTempObjects();
|
||||
int nObjects = 0;
|
||||
int nPoolSize = GetObjectPool()->GetSize();
|
||||
for (int i = 0; i < nPoolSize; i++) {
|
||||
CObject* pObject = GetObjectPool()->GetSlot(i);
|
||||
if (!pObject)
|
||||
continue;
|
||||
if (pObject->ObjectCreatedBy == MISSION_OBJECT)
|
||||
++nObjects;
|
||||
}
|
||||
*size = nObjects * (sizeof(int16) + sizeof(int) + sizeof(CCompressedMatrixNotAligned) + sizeof(uint32) +
|
||||
sizeof(float) + sizeof(CCompressedMatrixNotAligned) + sizeof(uint32) + sizeof(int8) + 7 * sizeof(bool) + sizeof(float) +
|
||||
sizeof(int8) + sizeof(int8) + sizeof(uint32) + 2 * sizeof(uint32)) + sizeof(int);
|
||||
WriteSaveBuf(buf, nObjects);
|
||||
for (int i = 0; i < nPoolSize; i++) {
|
||||
CObject* pObject = GetObjectPool()->GetSlot(i);
|
||||
if (!pObject)
|
||||
continue;
|
||||
if (pObject->ObjectCreatedBy == MISSION_OBJECT) {
|
||||
bool bIsPickup = pObject->bIsPickup;
|
||||
bool bFlag2 = pObject->m_obj_flag2;
|
||||
bool bOutOfStock = pObject->bOutOfStock;
|
||||
bool bGlassCracked = pObject->bGlassCracked;
|
||||
bool bGlassBroken = pObject->bGlassBroken;
|
||||
bool bHasBeenDamaged = pObject->bHasBeenDamaged;
|
||||
bool bUseVehicleColours = pObject->bUseVehicleColours;
|
||||
CCompressedMatrixNotAligned tmp;
|
||||
WriteSaveBuf(buf, pObject->m_modelIndex);
|
||||
WriteSaveBuf(buf, GetObjectRef(pObject));
|
||||
tmp.CompressFromFullMatrix(pObject->GetMatrix());
|
||||
WriteSaveBuf(buf, tmp);
|
||||
WriteSaveBuf(buf, (uint32)0); // game writes ununitialized data here
|
||||
WriteSaveBuf(buf, pObject->m_fUprootLimit);
|
||||
tmp.CompressFromFullMatrix(pObject->m_objectMatrix);
|
||||
WriteSaveBuf(buf, tmp);
|
||||
WriteSaveBuf(buf, (uint32)0); // same
|
||||
WriteSaveBuf(buf, pObject->ObjectCreatedBy);
|
||||
WriteSaveBuf(buf, bIsPickup);
|
||||
WriteSaveBuf(buf, bFlag2);
|
||||
WriteSaveBuf(buf, bOutOfStock);
|
||||
WriteSaveBuf(buf, bGlassCracked);
|
||||
WriteSaveBuf(buf, bGlassBroken);
|
||||
WriteSaveBuf(buf, bHasBeenDamaged);
|
||||
WriteSaveBuf(buf, bUseVehicleColours);
|
||||
WriteSaveBuf(buf, pObject->m_fCollisionDamageMultiplier);
|
||||
WriteSaveBuf(buf, pObject->m_nCollisionDamageEffect);
|
||||
WriteSaveBuf(buf, pObject->m_nSpecialCollisionResponseCases);
|
||||
WriteSaveBuf(buf, pObject->m_nEndOfLifeTime);
|
||||
WriteSaveBuf(buf, (pObject->GetAddressOfEntityProperties())[0]);
|
||||
WriteSaveBuf(buf, (pObject->GetAddressOfEntityProperties())[1]);
|
||||
}
|
||||
}
|
||||
VALIDATESAVEBUF(*size)
|
||||
}
|
||||
|
||||
void CPools::LoadObjectPool(uint8* buf, uint32 size)
|
||||
{
|
||||
INITSAVEBUF
|
||||
int nObjects = ReadSaveBuf<int>(buf);
|
||||
for (int i = 0; i < nObjects; i++) {
|
||||
int16 mi = ReadSaveBuf<int16>(buf);
|
||||
int ref = ReadSaveBuf<int>(buf);
|
||||
char* obuf = new char[sizeof(CObject)];
|
||||
CObject* pBufferObject = (CObject*)obuf;
|
||||
CCompressedMatrixNotAligned tmp;
|
||||
tmp = ReadSaveBuf<CCompressedMatrixNotAligned>(buf);
|
||||
tmp.DecompressIntoFullMatrix(pBufferObject->GetMatrix());
|
||||
ReadSaveBuf<uint32>(buf);
|
||||
pBufferObject->m_fUprootLimit = ReadSaveBuf<float>(buf);
|
||||
tmp = ReadSaveBuf<CCompressedMatrixNotAligned>(buf);
|
||||
tmp.DecompressIntoFullMatrix(pBufferObject->m_objectMatrix);
|
||||
ReadSaveBuf<uint32>(buf);
|
||||
pBufferObject->ObjectCreatedBy = ReadSaveBuf<int8>(buf);
|
||||
pBufferObject->bIsPickup = ReadSaveBuf<bool>(buf);
|
||||
pBufferObject->m_flagE2 = ReadSaveBuf<bool>(buf);
|
||||
pBufferObject->bOutOfStock = ReadSaveBuf<bool>(buf);
|
||||
pBufferObject->bGlassCracked = ReadSaveBuf<bool>(buf);
|
||||
pBufferObject->bGlassBroken = ReadSaveBuf<bool>(buf);
|
||||
pBufferObject->bHasBeenDamaged = ReadSaveBuf<bool>(buf);
|
||||
pBufferObject->bUseVehicleColours = ReadSaveBuf<bool>(buf);
|
||||
pBufferObject->m_fCollisionDamageMultiplier = ReadSaveBuf<float>(buf);
|
||||
pBufferObject->m_nCollisionDamageEffect = ReadSaveBuf<uint8>(buf);
|
||||
pBufferObject->m_nSpecialCollisionResponseCases = ReadSaveBuf<uint8>(buf);
|
||||
pBufferObject->m_nEndOfLifeTime = ReadSaveBuf<uint32>(buf);
|
||||
(pBufferObject->GetAddressOfEntityProperties())[0] = ReadSaveBuf<uint32>(buf);
|
||||
(pBufferObject->GetAddressOfEntityProperties())[1] = ReadSaveBuf<uint32>(buf);
|
||||
if (GetObjectPool()->GetSlot(ref >> 8))
|
||||
CPopulation::ConvertToDummyObject(GetObjectPool()->GetSlot(ref >> 8));
|
||||
CObject* pObject = new(ref) CObject(mi, false);
|
||||
pObject->GetMatrix() = pBufferObject->GetMatrix();
|
||||
pObject->m_fUprootLimit = pBufferObject->m_fUprootLimit;
|
||||
pObject->m_objectMatrix = pBufferObject->m_objectMatrix;
|
||||
pObject->ObjectCreatedBy = pBufferObject->ObjectCreatedBy;
|
||||
pObject->bIsPickup = pBufferObject->bIsPickup;
|
||||
pObject->m_flagE2 = pBufferObject->m_flagE2;
|
||||
pObject->bOutOfStock = pBufferObject->bOutOfStock;
|
||||
pObject->bGlassCracked = pBufferObject->bGlassCracked;
|
||||
pObject->bGlassBroken = pBufferObject->bGlassBroken;
|
||||
pObject->bHasBeenDamaged = pBufferObject->bHasBeenDamaged;
|
||||
pObject->bUseVehicleColours = pBufferObject->bUseVehicleColours;
|
||||
pObject->m_fCollisionDamageMultiplier = pBufferObject->m_fCollisionDamageMultiplier;
|
||||
pObject->m_nCollisionDamageEffect = pBufferObject->m_nCollisionDamageEffect;
|
||||
pObject->m_nSpecialCollisionResponseCases = pBufferObject->m_nSpecialCollisionResponseCases;
|
||||
pObject->m_nEndOfLifeTime = pBufferObject->m_nEndOfLifeTime;
|
||||
(pObject->GetAddressOfEntityProperties())[0] = (pBufferObject->GetAddressOfEntityProperties())[0];
|
||||
(pObject->GetAddressOfEntityProperties())[1] = (pBufferObject->GetAddressOfEntityProperties())[1];
|
||||
pObject->bHasCollided = false;
|
||||
CWorld::Add(pObject);
|
||||
delete[] obuf;
|
||||
}
|
||||
VALIDATESAVEBUF(size)
|
||||
}
|
||||
|
||||
void CPools::SavePedPool(uint8* buf, uint32* size)
|
||||
{
|
||||
INITSAVEBUF
|
||||
int nNumPeds = 0;
|
||||
int nPoolSize = GetPedPool()->GetSize();
|
||||
for (int i = 0; i < nPoolSize; i++) {
|
||||
CPed* pPed = GetPedPool()->GetSlot(i);
|
||||
if (!pPed)
|
||||
continue;
|
||||
if (!pPed->bInVehicle && pPed->m_nPedType == PEDTYPE_PLAYER1)
|
||||
nNumPeds++;
|
||||
}
|
||||
*size = sizeof(int) + nNumPeds * (sizeof(uint32) + sizeof(int16) + sizeof(int) + sizeof(CPlayerPed) +
|
||||
sizeof(CWanted::MaximumWantedLevel) + sizeof(CWanted::nMaximumWantedLevel) + MAX_MODEL_NAME);
|
||||
WriteSaveBuf(buf, nNumPeds);
|
||||
for (int i = 0; i < nPoolSize; i++) {
|
||||
CPed* pPed = GetPedPool()->GetSlot(i);
|
||||
if (!pPed)
|
||||
continue;
|
||||
if (!pPed->bInVehicle && pPed->m_nPedType == PEDTYPE_PLAYER1) {
|
||||
WriteSaveBuf(buf, pPed->m_nPedType);
|
||||
WriteSaveBuf(buf, pPed->m_modelIndex);
|
||||
WriteSaveBuf(buf, GetPedRef(pPed));
|
||||
memcpy(buf, pPed, sizeof(CPlayerPed));
|
||||
SkipSaveBuf(buf, sizeof(CPlayerPed));
|
||||
WriteSaveBuf(buf, CWanted::MaximumWantedLevel);
|
||||
WriteSaveBuf(buf, CWanted::nMaximumWantedLevel);
|
||||
memcpy(buf, CModelInfo::GetModelInfo(pPed->GetModelIndex())->GetName(), MAX_MODEL_NAME);
|
||||
SkipSaveBuf(buf, MAX_MODEL_NAME);
|
||||
}
|
||||
}
|
||||
VALIDATESAVEBUF(*size);
|
||||
}
|
||||
|
||||
void CPools::LoadPedPool(uint8* buf, uint32 size)
|
||||
{
|
||||
INITSAVEBUF
|
||||
int nPeds = ReadSaveBuf<int>(buf);
|
||||
for (int i = 0; i < nPeds; i++) {
|
||||
uint32 pedtype = ReadSaveBuf<uint32>(buf);
|
||||
int16 model = ReadSaveBuf<int16>(buf);
|
||||
int ref = ReadSaveBuf<int>(buf);
|
||||
char* pbuf = new char[sizeof(CPlayerPed)];
|
||||
CPlayerPed* pBufferPlayer = (CPlayerPed*)pbuf;
|
||||
CPed* pPed;
|
||||
char name[MAX_MODEL_NAME];
|
||||
// the code implies that there was idea to load non-player ped
|
||||
if (pedtype == PEDTYPE_PLAYER1) { // always true
|
||||
memcpy(pbuf, buf, sizeof(CPlayerPed));
|
||||
SkipSaveBuf(buf, sizeof(CPlayerPed));
|
||||
CWanted::MaximumWantedLevel = ReadSaveBuf<int32>(buf);
|
||||
CWanted::nMaximumWantedLevel = ReadSaveBuf<int32>(buf);
|
||||
memcpy(name, buf, MAX_MODEL_NAME);
|
||||
SkipSaveBuf(buf, MAX_MODEL_NAME);
|
||||
}
|
||||
CStreaming::RequestSpecialModel(model, name, STREAMFLAGS_DONT_REMOVE);
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
if (pedtype == PEDTYPE_PLAYER1) {
|
||||
CPlayerPed* pPlayerPed = new(ref) CPlayerPed();
|
||||
for (int i = 0; i < ARRAY_SIZE(pPlayerPed->m_nTargettableObjects); i++)
|
||||
pPlayerPed->m_nTargettableObjects[i] = pBufferPlayer->m_nTargettableObjects[i];
|
||||
pPlayerPed->m_fMaxStamina = pBufferPlayer->m_fMaxStamina;
|
||||
pPed = pPlayerPed;
|
||||
}
|
||||
pPed->GetPosition() = pBufferPlayer->GetPosition();
|
||||
pPed->m_fHealth = pBufferPlayer->m_fHealth;
|
||||
pPed->m_fArmour = pBufferPlayer->m_fArmour;
|
||||
pPed->CharCreatedBy = pBufferPlayer->CharCreatedBy;
|
||||
pPed->m_currentWeapon = 0;
|
||||
pPed->m_maxWeaponTypeAllowed = pBufferPlayer->m_maxWeaponTypeAllowed;
|
||||
for (int i = 0; i < WEAPONTYPE_TOTAL_INVENTORY_WEAPONS; i++)
|
||||
pPed->m_weapons[i] = pBufferPlayer->m_weapons[i];
|
||||
if (pedtype == PEDTYPE_PLAYER1) {
|
||||
pPed->m_wepAccuracy = 100;
|
||||
CWorld::Players[0].m_pPed = (CPlayerPed*)pPed;
|
||||
}
|
||||
CWorld::Add(pPed);
|
||||
delete[] pbuf;
|
||||
}
|
||||
VALIDATESAVEBUF(size)
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x4A1770, CPools::Initialise, PATCH_JUMP);
|
||||
@ -111,4 +437,7 @@ STARTPATCHES
|
||||
InjectHook(0x4A1B00, CPools::GetObjectRef, PATCH_JUMP);
|
||||
InjectHook(0x4A1B20, CPools::GetObject, PATCH_JUMP);
|
||||
InjectHook(0x4A2DB0, CPools::MakeSureSlotInObjectPoolIsEmpty, PATCH_JUMP);
|
||||
InjectHook(0x4A1B40, CPools::LoadVehiclePool, PATCH_JUMP);
|
||||
InjectHook(0x4A2550, CPools::LoadObjectPool, PATCH_JUMP);
|
||||
InjectHook(0x4A2B50, CPools::LoadPedPool, PATCH_JUMP);
|
||||
ENDPATCHES
|
||||
|
71
src/core/Profile.cpp
Normal file
71
src/core/Profile.cpp
Normal file
@ -0,0 +1,71 @@
|
||||
#include "common.h"
|
||||
#include "Profile.h"
|
||||
|
||||
#ifndef MASTER
|
||||
float CProfile::ms_afStartTime[NUM_PROFILES];
|
||||
float CProfile::ms_afCumulativeTime[NUM_PROFILES];
|
||||
float CProfile::ms_afEndTime[NUM_PROFILES];
|
||||
float CProfile::ms_afMaxEndTime[NUM_PROFILES];
|
||||
float CProfile::ms_afMaxCumulativeTime[NUM_PROFILES];
|
||||
char *CProfile::ms_pProfileString[NUM_PROFILES];
|
||||
RwRGBA CProfile::ms_aBarColours[NUM_PROFILES];
|
||||
|
||||
void CProfile::Initialise()
|
||||
{
|
||||
ms_afMaxEndTime[PROFILE_FRAME_RATE] = 0.0f;
|
||||
ms_afMaxEndTime[PROFILE_PHYSICS] = 0.0f;
|
||||
ms_afMaxEndTime[PROFILE_COLLISION] = 0.0f;
|
||||
ms_afMaxEndTime[PROFILE_PED_AI] = 0.0f;
|
||||
ms_afMaxEndTime[PROFILE_PROCESSING_TIME] = 0.0f;
|
||||
ms_afMaxEndTime[PROFILE_RENDERING_TIME] = 0.0f;
|
||||
ms_afMaxEndTime[PROFILE_TOTAL] = 0.0f;
|
||||
|
||||
ms_pProfileString[PROFILE_FRAME_RATE] = "Frame rate";
|
||||
ms_pProfileString[PROFILE_PHYSICS] = "Physics";
|
||||
ms_pProfileString[PROFILE_COLLISION] = "Collision";
|
||||
ms_pProfileString[PROFILE_PED_AI] = "Ped AI";
|
||||
ms_pProfileString[PROFILE_PROCESSING_TIME] = "Processing time";
|
||||
ms_pProfileString[PROFILE_RENDERING_TIME] = "Rendering time";
|
||||
ms_pProfileString[PROFILE_TOTAL] = "Total";
|
||||
|
||||
ms_afMaxCumulativeTime[PROFILE_FRAME_RATE] = 0.0f;
|
||||
ms_afMaxCumulativeTime[PROFILE_PHYSICS] = 0.0f;
|
||||
ms_afMaxCumulativeTime[PROFILE_COLLISION] = 0.0f;
|
||||
ms_afMaxCumulativeTime[PROFILE_PED_AI] = 0.0f;
|
||||
ms_afMaxCumulativeTime[PROFILE_PROCESSING_TIME] = 0.0f;
|
||||
ms_afMaxCumulativeTime[PROFILE_RENDERING_TIME] = 0.0f;
|
||||
ms_afMaxCumulativeTime[PROFILE_TOTAL] = 0.0f;
|
||||
|
||||
ms_aBarColours[PROFILE_PHYSICS] = { 0, 127, 255, 255 };
|
||||
ms_aBarColours[PROFILE_COLLISION] = { 0, 255, 255, 255 };
|
||||
ms_aBarColours[PROFILE_PED_AI] = { 255, 0, 0, 255 };
|
||||
ms_aBarColours[PROFILE_PROCESSING_TIME] = { 0, 255, 0, 255 };
|
||||
ms_aBarColours[PROFILE_RENDERING_TIME] = { 0, 0, 255, 255 };
|
||||
ms_aBarColours[PROFILE_TOTAL] = { 255, 255, 255, 255 };
|
||||
}
|
||||
|
||||
void CProfile::SuspendProfile(eProfile profile)
|
||||
{
|
||||
ms_afEndTime[profile] = -ms_afStartTime[profile];
|
||||
ms_afCumulativeTime[profile] -= ms_afStartTime[profile];
|
||||
}
|
||||
|
||||
void CProfile::ShowResults()
|
||||
{
|
||||
ms_afMaxEndTime[PROFILE_FRAME_RATE] = max(ms_afMaxEndTime[PROFILE_FRAME_RATE], ms_afEndTime[PROFILE_FRAME_RATE]);
|
||||
ms_afMaxEndTime[PROFILE_PHYSICS] = max(ms_afMaxEndTime[PROFILE_PHYSICS], ms_afEndTime[PROFILE_PHYSICS]);
|
||||
ms_afMaxEndTime[PROFILE_COLLISION] = max(ms_afMaxEndTime[PROFILE_COLLISION], ms_afEndTime[PROFILE_COLLISION]);
|
||||
ms_afMaxEndTime[PROFILE_PED_AI] = max(ms_afMaxEndTime[PROFILE_PED_AI], ms_afEndTime[PROFILE_PED_AI]);
|
||||
ms_afMaxEndTime[PROFILE_PROCESSING_TIME] = max(ms_afMaxEndTime[PROFILE_PROCESSING_TIME], ms_afEndTime[PROFILE_PROCESSING_TIME]);
|
||||
ms_afMaxEndTime[PROFILE_RENDERING_TIME] = max(ms_afMaxEndTime[PROFILE_RENDERING_TIME], ms_afEndTime[PROFILE_RENDERING_TIME]);
|
||||
ms_afMaxEndTime[PROFILE_TOTAL] = max(ms_afMaxEndTime[PROFILE_TOTAL], ms_afEndTime[PROFILE_TOTAL]);
|
||||
|
||||
ms_afMaxCumulativeTime[PROFILE_FRAME_RATE] = max(ms_afMaxCumulativeTime[PROFILE_FRAME_RATE], ms_afCumulativeTime[PROFILE_FRAME_RATE]);
|
||||
ms_afMaxCumulativeTime[PROFILE_PHYSICS] = max(ms_afMaxCumulativeTime[PROFILE_PHYSICS], ms_afCumulativeTime[PROFILE_PHYSICS]);
|
||||
ms_afMaxCumulativeTime[PROFILE_COLLISION] = max(ms_afMaxCumulativeTime[PROFILE_COLLISION], ms_afCumulativeTime[PROFILE_COLLISION]);
|
||||
ms_afMaxCumulativeTime[PROFILE_PED_AI] = max(ms_afMaxCumulativeTime[PROFILE_PED_AI], ms_afCumulativeTime[PROFILE_PED_AI]);
|
||||
ms_afMaxCumulativeTime[PROFILE_PROCESSING_TIME] = max(ms_afMaxCumulativeTime[PROFILE_PROCESSING_TIME], ms_afCumulativeTime[PROFILE_PROCESSING_TIME]);
|
||||
ms_afMaxCumulativeTime[PROFILE_RENDERING_TIME] = max(ms_afMaxCumulativeTime[PROFILE_RENDERING_TIME], ms_afCumulativeTime[PROFILE_RENDERING_TIME]);
|
||||
ms_afMaxCumulativeTime[PROFILE_TOTAL] = max(ms_afMaxCumulativeTime[PROFILE_TOTAL], ms_afCumulativeTime[PROFILE_TOTAL]);
|
||||
}
|
||||
#endif
|
28
src/core/Profile.h
Normal file
28
src/core/Profile.h
Normal file
@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
enum eProfile
|
||||
{
|
||||
PROFILE_FRAME_RATE,
|
||||
PROFILE_PHYSICS,
|
||||
PROFILE_COLLISION,
|
||||
PROFILE_PED_AI,
|
||||
PROFILE_PROCESSING_TIME,
|
||||
PROFILE_RENDERING_TIME,
|
||||
PROFILE_TOTAL,
|
||||
NUM_PROFILES,
|
||||
};
|
||||
|
||||
class CProfile
|
||||
{
|
||||
static float ms_afStartTime[NUM_PROFILES];
|
||||
static float ms_afCumulativeTime[NUM_PROFILES];
|
||||
static float ms_afEndTime[NUM_PROFILES];
|
||||
static float ms_afMaxEndTime[NUM_PROFILES];
|
||||
static float ms_afMaxCumulativeTime[NUM_PROFILES];
|
||||
static char *ms_pProfileString[NUM_PROFILES];
|
||||
static RwRGBA ms_aBarColours[NUM_PROFILES];
|
||||
public:
|
||||
static void Initialise();
|
||||
static void SuspendProfile(eProfile profile);
|
||||
static void ShowResults();
|
||||
};
|
@ -17,7 +17,7 @@
|
||||
#include "SpecialFX.h"
|
||||
|
||||
float &CRadar::m_radarRange = *(float*)0x8E281C;
|
||||
CBlip (&CRadar::ms_RadarTrace)[NUMRADARBLIPS] = *(CBlip(*)[NUMRADARBLIPS]) * (uintptr*)0x6ED5E0;
|
||||
sRadarTrace (&CRadar::ms_RadarTrace)[NUMRADARBLIPS] = *(sRadarTrace(*)[NUMRADARBLIPS]) * (uintptr*)0x6ED5E0;
|
||||
CVector2D &vec2DRadarOrigin = *(CVector2D*)0x6299B8;
|
||||
int32 gRadarTxdIds[64];// = (int*)0x6299C0;
|
||||
|
||||
@ -75,8 +75,152 @@ static_assert(RADAR_TILE_SIZE == (WORLD_SIZE_Y / RADAR_NUM_TILES), "CRadar: not
|
||||
#define RADAR_MIN_SPEED (0.3f)
|
||||
#define RADAR_MAX_SPEED (0.9f)
|
||||
|
||||
#ifdef MENU_MAP
|
||||
CRGBA CRadar::ArrowBlipColour1;
|
||||
CRGBA CRadar::ArrowBlipColour2;
|
||||
uint16 CRadar::MapLegendCounter;
|
||||
uint16 CRadar::MapLegendList[NUM_MAP_LEGENDS];
|
||||
int CRadar::TargetMarkerId = -1;
|
||||
#endif
|
||||
|
||||
// taken from VC
|
||||
float CRadar::cachedCos;
|
||||
float CRadar::cachedSin;
|
||||
|
||||
void ClipRadarTileCoords(int32 &x, int32 &y)
|
||||
{
|
||||
if (x < 0)
|
||||
x = 0;
|
||||
if (x > RADAR_NUM_TILES-1)
|
||||
x = RADAR_NUM_TILES-1;
|
||||
if (y < 0)
|
||||
y = 0;
|
||||
if (y > RADAR_NUM_TILES-1)
|
||||
y = RADAR_NUM_TILES-1;
|
||||
}
|
||||
|
||||
void RequestMapSection(int32 x, int32 y)
|
||||
{
|
||||
ClipRadarTileCoords(x, y);
|
||||
CStreaming::RequestTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y], STREAMFLAGS_DONT_REMOVE | STREAMFLAGS_DEPENDENCY);
|
||||
}
|
||||
|
||||
void RemoveMapSection(int32 x, int32 y)
|
||||
{
|
||||
if (x >= 0 && x <= 7 && y >= 0 && y <= 7)
|
||||
CStreaming::RemoveTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y]);
|
||||
}
|
||||
|
||||
// Transform from section indices to world coordinates
|
||||
void GetTextureCorners(int32 x, int32 y, CVector2D *out)
|
||||
{
|
||||
x = x - RADAR_NUM_TILES/2;
|
||||
y = -(y - RADAR_NUM_TILES/2);
|
||||
|
||||
// bottom left
|
||||
out[0].x = RADAR_TILE_SIZE * (x);
|
||||
out[0].y = RADAR_TILE_SIZE * (y - 1);
|
||||
|
||||
// bottom right
|
||||
out[1].x = RADAR_TILE_SIZE * (x + 1);
|
||||
out[1].y = RADAR_TILE_SIZE * (y - 1);
|
||||
|
||||
// top right
|
||||
out[2].x = RADAR_TILE_SIZE * (x + 1);
|
||||
out[2].y = RADAR_TILE_SIZE * (y);
|
||||
|
||||
// top left
|
||||
out[3].x = RADAR_TILE_SIZE * (x);
|
||||
out[3].y = RADAR_TILE_SIZE * (y);
|
||||
}
|
||||
|
||||
|
||||
bool IsPointInsideRadar(const CVector2D &point)
|
||||
{
|
||||
if (point.x < -1.0f || point.x > 1.0f) return false;
|
||||
if (point.y < -1.0f || point.y > 1.0f) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// clip line p1,p2 against (-1.0, 1.0) in x and y, set out to clipped point closest to p1
|
||||
int LineRadarBoxCollision(CVector2D &out, const CVector2D &p1, const CVector2D &p2)
|
||||
{
|
||||
float d1, d2;
|
||||
float t;
|
||||
float x, y;
|
||||
float shortest = 1.0f;
|
||||
int edge = -1;
|
||||
|
||||
// clip against left edge, x = -1.0
|
||||
d1 = -1.0f - p1.x;
|
||||
d2 = -1.0f - p2.x;
|
||||
if (d1 * d2 < 0.0f) {
|
||||
// they are on opposite sides, get point of intersection
|
||||
t = d1 / (d1 - d2);
|
||||
y = (p2.y - p1.y)*t + p1.y;
|
||||
if (y >= -1.0f && y <= 1.0f && t <= shortest) {
|
||||
out.x = -1.0f;
|
||||
out.y = y;
|
||||
edge = 3;
|
||||
shortest = t;
|
||||
}
|
||||
}
|
||||
|
||||
// clip against right edge, x = 1.0
|
||||
d1 = p1.x - 1.0f;
|
||||
d2 = p2.x - 1.0f;
|
||||
if (d1 * d2 < 0.0f) {
|
||||
// they are on opposite sides, get point of intersection
|
||||
t = d1 / (d1 - d2);
|
||||
y = (p2.y - p1.y)*t + p1.y;
|
||||
if (y >= -1.0f && y <= 1.0f && t <= shortest) {
|
||||
out.x = 1.0f;
|
||||
out.y = y;
|
||||
edge = 1;
|
||||
shortest = t;
|
||||
}
|
||||
}
|
||||
|
||||
// clip against top edge, y = -1.0
|
||||
d1 = -1.0f - p1.y;
|
||||
d2 = -1.0f - p2.y;
|
||||
if (d1 * d2 < 0.0f) {
|
||||
// they are on opposite sides, get point of intersection
|
||||
t = d1 / (d1 - d2);
|
||||
x = (p2.x - p1.x)*t + p1.x;
|
||||
if (x >= -1.0f && x <= 1.0f && t <= shortest) {
|
||||
out.y = -1.0f;
|
||||
out.x = x;
|
||||
edge = 0;
|
||||
shortest = t;
|
||||
}
|
||||
}
|
||||
|
||||
// clip against bottom edge, y = 1.0
|
||||
d1 = p1.y - 1.0f;
|
||||
d2 = p2.y - 1.0f;
|
||||
if (d1 * d2 < 0.0f) {
|
||||
// they are on opposite sides, get point of intersection
|
||||
t = d1 / (d1 - d2);
|
||||
x = (p2.x - p1.x)*t + p1.x;
|
||||
if (x >= -1.0f && x <= 1.0f && t <= shortest) {
|
||||
out.y = 1.0f;
|
||||
out.x = x;
|
||||
edge = 2;
|
||||
shortest = t;
|
||||
}
|
||||
}
|
||||
|
||||
return edge;
|
||||
}
|
||||
|
||||
|
||||
uint8 CRadar::CalculateBlipAlpha(float dist)
|
||||
{
|
||||
#ifdef MENU_MAP
|
||||
if (CMenuManager::bMenuMapActive)
|
||||
return 255;
|
||||
#endif
|
||||
if (dist <= 1.0f)
|
||||
return 255;
|
||||
|
||||
@ -120,9 +264,12 @@ void CRadar::ClearBlip(int32 i)
|
||||
if (index != -1) {
|
||||
SetRadarMarkerState(index, false);
|
||||
ms_RadarTrace[index].m_bInUse = false;
|
||||
#ifndef MENU_MAP
|
||||
// Ssshhh
|
||||
ms_RadarTrace[index].m_eBlipType = BLIP_NONE;
|
||||
ms_RadarTrace[index].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
|
||||
ms_RadarTrace[index].m_IconID = RADAR_SPRITE_NONE;
|
||||
ms_RadarTrace[index].m_eRadarSprite = RADAR_SPRITE_NONE;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,7 +281,7 @@ void CRadar::ClearBlipForEntity(eBlipType type, int32 id)
|
||||
ms_RadarTrace[i].m_bInUse = false;
|
||||
ms_RadarTrace[i].m_eBlipType = BLIP_NONE;
|
||||
ms_RadarTrace[i].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
|
||||
ms_RadarTrace[i].m_IconID = RADAR_SPRITE_NONE;
|
||||
ms_RadarTrace[i].m_eRadarSprite = RADAR_SPRITE_NONE;
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -221,7 +368,7 @@ int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect)
|
||||
|
||||
bool CRadar::DisplayThisBlip(int32 counter)
|
||||
{
|
||||
switch (ms_RadarTrace[counter].m_IconID) {
|
||||
switch (ms_RadarTrace[counter].m_eRadarSprite) {
|
||||
case RADAR_SPRITE_BOMB:
|
||||
case RADAR_SPRITE_SPRAY:
|
||||
case RADAR_SPRITE_WEAPON:
|
||||
@ -297,28 +444,39 @@ void CRadar::DrawBlips()
|
||||
CVector2D in = CVector2D(0.0f, 0.0f);
|
||||
TransformRadarPointToScreenSpace(out, in);
|
||||
|
||||
float angle;
|
||||
if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN)
|
||||
angle = PI + FindPlayerHeading();
|
||||
#ifdef FIX_BUGS
|
||||
else if (TheCamera.GetLookDirection() != LOOKING_FORWARD)
|
||||
angle = FindPlayerHeading() - (PI + (TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetPosition() - TheCamera.Cams[TheCamera.ActiveCam].SourceBeforeLookBehind).Heading());
|
||||
#ifdef MENU_MAP
|
||||
if (!CMenuManager::bMenuMapActive) {
|
||||
#endif
|
||||
else
|
||||
angle = FindPlayerHeading() - (PI + TheCamera.GetForward().Heading());
|
||||
float angle;
|
||||
if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN)
|
||||
angle = PI + FindPlayerHeading();
|
||||
#ifdef FIX_BUGS
|
||||
else if (TheCamera.GetLookDirection() != LOOKING_FORWARD)
|
||||
angle = FindPlayerHeading() - (PI + (TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetPosition() - TheCamera.Cams[TheCamera.ActiveCam].SourceBeforeLookBehind).Heading());
|
||||
#endif
|
||||
else
|
||||
angle = FindPlayerHeading() - (PI + TheCamera.GetForward().Heading());
|
||||
|
||||
DrawRotatingRadarSprite(&CentreSprite, out.x, out.y, angle, 255);
|
||||
DrawRotatingRadarSprite(&CentreSprite, out.x, out.y, angle, 255);
|
||||
|
||||
CVector2D vec2d;
|
||||
vec2d.x = vec2DRadarOrigin.x;
|
||||
vec2d.y = M_SQRT2 * m_radarRange + vec2DRadarOrigin.y;
|
||||
TransformRealWorldPointToRadarSpace(in, vec2d);
|
||||
LimitRadarPoint(in);
|
||||
TransformRadarPointToScreenSpace(out, in);
|
||||
DrawRadarSprite(RADAR_SPRITE_NORTH, out.x, out.y, 255);
|
||||
CVector2D vec2d;
|
||||
vec2d.x = vec2DRadarOrigin.x;
|
||||
vec2d.y = M_SQRT2 * m_radarRange + vec2DRadarOrigin.y;
|
||||
TransformRealWorldPointToRadarSpace(in, vec2d);
|
||||
LimitRadarPoint(in);
|
||||
TransformRadarPointToScreenSpace(out, in);
|
||||
DrawRadarSprite(RADAR_SPRITE_NORTH, out.x, out.y, 255);
|
||||
#ifdef MENU_MAP
|
||||
}
|
||||
#endif
|
||||
|
||||
CEntity *blipEntity = nil;
|
||||
for(int blipId = 0; blipId < NUMRADARBLIPS; blipId++) {
|
||||
#ifdef MENU_MAP
|
||||
// A little hack to reuse cleared blips in menu map. hehe
|
||||
if (!CMenuManager::bMenuMapActive || ms_RadarTrace[blipId].m_eBlipType == BLIP_CAR ||
|
||||
ms_RadarTrace[blipId].m_eBlipType == BLIP_CHAR || ms_RadarTrace[blipId].m_eBlipType == BLIP_OBJECT)
|
||||
#endif
|
||||
if (!ms_RadarTrace[blipId].m_bInUse)
|
||||
continue;
|
||||
|
||||
@ -326,8 +484,8 @@ void CRadar::DrawBlips()
|
||||
case BLIP_CAR:
|
||||
case BLIP_CHAR:
|
||||
case BLIP_OBJECT:
|
||||
if (ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_BOMB || ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_SAVE
|
||||
|| ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_SPRAY || ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_WEAPON) {
|
||||
if (ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_BOMB || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SAVE
|
||||
|| ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SPRAY || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_WEAPON) {
|
||||
|
||||
switch (ms_RadarTrace[blipId].m_eBlipType) {
|
||||
case BLIP_CAR:
|
||||
@ -360,8 +518,8 @@ void CRadar::DrawBlips()
|
||||
TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition());
|
||||
float dist = LimitRadarPoint(in);
|
||||
TransformRadarPointToScreenSpace(out, in);
|
||||
if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_NONE) {
|
||||
DrawRadarSprite(ms_RadarTrace[blipId].m_IconID, out.x, out.y, CalculateBlipAlpha(dist));
|
||||
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) {
|
||||
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
|
||||
} else {
|
||||
#ifdef TRIANGULAR_BLIPS
|
||||
CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
|
||||
@ -382,8 +540,8 @@ void CRadar::DrawBlips()
|
||||
break;
|
||||
case BLIP_COORD:
|
||||
case BLIP_CONTACT_POINT:
|
||||
if ((ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_BOMB || ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_SAVE
|
||||
|| ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_SPRAY || ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_WEAPON)
|
||||
if ((ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_BOMB || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SAVE
|
||||
|| ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SPRAY || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_WEAPON)
|
||||
&& (ms_RadarTrace[blipId].m_eBlipType != BLIP_CONTACT_POINT || !CTheScripts::IsPlayerOnAMission())) {
|
||||
|
||||
uint32 color = GetRadarTraceColour(ms_RadarTrace[blipId].m_nColor, ms_RadarTrace[blipId].m_bDim);
|
||||
@ -399,8 +557,8 @@ void CRadar::DrawBlips()
|
||||
TransformRealWorldPointToRadarSpace(in, ms_RadarTrace[blipId].m_vec2DPos);
|
||||
float dist = LimitRadarPoint(in);
|
||||
TransformRadarPointToScreenSpace(out, in);
|
||||
if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_NONE) {
|
||||
DrawRadarSprite(ms_RadarTrace[blipId].m_IconID, out.x, out.y, CalculateBlipAlpha(dist));
|
||||
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) {
|
||||
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
|
||||
} else {
|
||||
#ifdef TRIANGULAR_BLIPS
|
||||
CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
|
||||
@ -430,8 +588,8 @@ void CRadar::DrawBlips()
|
||||
case BLIP_CAR:
|
||||
case BLIP_CHAR:
|
||||
case BLIP_OBJECT:
|
||||
if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_BOMB && ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_SAVE
|
||||
&& ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_WEAPON) {
|
||||
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_BOMB && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SAVE
|
||||
&& ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_WEAPON) {
|
||||
|
||||
switch (ms_RadarTrace[blipId].m_eBlipType) {
|
||||
case BLIP_CAR:
|
||||
@ -465,8 +623,8 @@ void CRadar::DrawBlips()
|
||||
TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition());
|
||||
float dist = LimitRadarPoint(in);
|
||||
TransformRadarPointToScreenSpace(out, in);
|
||||
if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_NONE)
|
||||
DrawRadarSprite(ms_RadarTrace[blipId].m_IconID, out.x, out.y, CalculateBlipAlpha(dist));
|
||||
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE)
|
||||
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
|
||||
else
|
||||
#ifdef TRIANGULAR_BLIPS
|
||||
{
|
||||
@ -497,8 +655,8 @@ void CRadar::DrawBlips()
|
||||
switch (ms_RadarTrace[blipId].m_eBlipType) {
|
||||
case BLIP_COORD:
|
||||
case BLIP_CONTACT_POINT:
|
||||
if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_BOMB && ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_SAVE
|
||||
&& ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_WEAPON
|
||||
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_BOMB && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SAVE
|
||||
&& ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_WEAPON
|
||||
&& (ms_RadarTrace[blipId].m_eBlipType != BLIP_CONTACT_POINT || !CTheScripts::IsPlayerOnAMission())) {
|
||||
|
||||
uint32 color = GetRadarTraceColour(ms_RadarTrace[blipId].m_nColor, ms_RadarTrace[blipId].m_bDim);
|
||||
@ -514,8 +672,8 @@ void CRadar::DrawBlips()
|
||||
TransformRealWorldPointToRadarSpace(in, ms_RadarTrace[blipId].m_vec2DPos);
|
||||
float dist = LimitRadarPoint(in);
|
||||
TransformRadarPointToScreenSpace(out, in);
|
||||
if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_NONE)
|
||||
DrawRadarSprite(ms_RadarTrace[blipId].m_IconID, out.x, out.y, CalculateBlipAlpha(dist));
|
||||
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE)
|
||||
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
|
||||
else
|
||||
#ifdef TRIANGULAR_BLIPS
|
||||
{
|
||||
@ -538,12 +696,23 @@ void CRadar::DrawBlips()
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifdef MENU_MAP
|
||||
if (CMenuManager::bMenuMapActive) {
|
||||
CVector2D in, out;
|
||||
TransformRealWorldPointToRadarSpace(in, FindPlayerCentreOfWorld_NoSniperShift());
|
||||
TransformRadarPointToScreenSpace(out, in);
|
||||
DrawYouAreHereSprite(out.x, out.y);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void CRadar::DrawMap()
|
||||
{
|
||||
if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) {
|
||||
#if 1 // from VC
|
||||
CalculateCachedSinCos();
|
||||
#endif
|
||||
if (FindPlayerVehicle()) {
|
||||
float speed = FindPlayerSpeed().Magnitude();
|
||||
if (speed < RADAR_MIN_SPEED)
|
||||
@ -604,15 +773,14 @@ void CRadar::DrawRadarMask()
|
||||
};
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDZERO);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
|
||||
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
|
||||
RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT);
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||
RwD3D8SetRenderState(rwRENDERSTATESTENCILFUNCTION, rwSTENCILFUNCTIONALWAYS);
|
||||
|
||||
CVector2D out[8];
|
||||
CVector2D in;
|
||||
@ -634,8 +802,6 @@ void CRadar::DrawRadarMask()
|
||||
CSprite2d::SetMaskVertices(8, (float *)out);
|
||||
RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::GetVertices(), 8);
|
||||
};
|
||||
|
||||
RwD3D8SetRenderState(rwRENDERSTATESTENCILFUNCTION, rwSTENCILFUNCTIONGREATER);
|
||||
}
|
||||
|
||||
void CRadar::DrawRadarSection(int32 x, int32 y)
|
||||
@ -685,6 +851,19 @@ void CRadar::DrawRadarSection(int32 x, int32 y)
|
||||
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));
|
||||
#ifdef MENU_MAP
|
||||
if (CMenuManager::bMenuMapActive) {
|
||||
bool alreadyThere = false;
|
||||
for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
|
||||
if (MapLegendList[i] == sprite)
|
||||
alreadyThere = true;
|
||||
}
|
||||
if (!alreadyThere) {
|
||||
MapLegendList[MapLegendCounter] = sprite;
|
||||
MapLegendCounter++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int32 alpha)
|
||||
@ -806,7 +985,7 @@ CRadar::Initialise()
|
||||
ms_RadarTrace[i].m_bInUse = false;
|
||||
ms_RadarTrace[i].m_eBlipType = BLIP_NONE;
|
||||
ms_RadarTrace[i].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
|
||||
ms_RadarTrace[i].m_IconID = RADAR_SPRITE_NONE;
|
||||
ms_RadarTrace[i].m_eRadarSprite = RADAR_SPRITE_NONE;
|
||||
}
|
||||
|
||||
m_radarRange = 350.0f;
|
||||
@ -819,6 +998,10 @@ float CRadar::LimitRadarPoint(CVector2D &point)
|
||||
float dist, invdist;
|
||||
|
||||
dist = point.Magnitude();
|
||||
#ifdef MENU_MAP
|
||||
if (CMenuManager::bMenuMapActive)
|
||||
return dist;
|
||||
#endif
|
||||
if (dist > 1.0f) {
|
||||
invdist = 1.0f / dist;
|
||||
point.x *= invdist;
|
||||
@ -834,7 +1017,7 @@ INITSAVEBUF
|
||||
CheckSaveHeader(buf, 'R', 'D', 'R', '\0', size - SAVE_HEADER_SIZE);
|
||||
|
||||
for (int i = 0; i < NUMRADARBLIPS; i++)
|
||||
ms_RadarTrace[i] = ReadSaveBuf<CBlip>(buf);
|
||||
ms_RadarTrace[i] = ReadSaveBuf<sRadarTrace>(buf);
|
||||
|
||||
VALIDATESAVEBUF(size);
|
||||
}
|
||||
@ -867,12 +1050,6 @@ CRadar::LoadTextures()
|
||||
CTxdStore::PopCurrentTxd();
|
||||
}
|
||||
|
||||
void RemoveMapSection(int32 x, int32 y)
|
||||
{
|
||||
if (x >= 0 && x <= 7 && y >= 0 && y <= 7)
|
||||
CStreaming::RemoveTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y]);
|
||||
}
|
||||
|
||||
void CRadar::RemoveRadarSections()
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
@ -880,12 +1057,6 @@ void CRadar::RemoveRadarSections()
|
||||
RemoveMapSection(i, j);
|
||||
}
|
||||
|
||||
void CRadar::RequestMapSection(int32 x, int32 y)
|
||||
{
|
||||
ClipRadarTileCoords(x, y);
|
||||
CStreaming::RequestTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y], STREAMFLAGS_DONT_REMOVE | STREAMFLAGS_DEPENDENCY);
|
||||
}
|
||||
|
||||
void CRadar::SaveAllRadarBlips(uint8 *buf, uint32 *size)
|
||||
{
|
||||
*size = SAVE_HEADER_SIZE + sizeof(ms_RadarTrace);
|
||||
@ -902,7 +1073,7 @@ void CRadar::SetBlipSprite(int32 i, int32 icon)
|
||||
{
|
||||
int index = CRadar::GetActualBlipArrayIndex(i);
|
||||
if (index != -1) {
|
||||
ms_RadarTrace[index].m_IconID = icon;
|
||||
ms_RadarTrace[index].m_eRadarSprite = icon;
|
||||
}
|
||||
}
|
||||
|
||||
@ -923,7 +1094,7 @@ int CRadar::SetCoordBlip(eBlipType type, CVector pos, int32 color, eBlipDisplay
|
||||
ms_RadarTrace[nextBlip].m_nEntityHandle = 0;
|
||||
ms_RadarTrace[nextBlip].m_wScale = 1;
|
||||
ms_RadarTrace[nextBlip].m_eBlipDisplay = display;
|
||||
ms_RadarTrace[nextBlip].m_IconID = RADAR_SPRITE_NONE;
|
||||
ms_RadarTrace[nextBlip].m_eRadarSprite = RADAR_SPRITE_NONE;
|
||||
return CRadar::GetNewUniqueBlipIndex(nextBlip);
|
||||
}
|
||||
|
||||
@ -942,7 +1113,7 @@ int CRadar::SetEntityBlip(eBlipType type, int32 handle, int32 color, eBlipDispla
|
||||
ms_RadarTrace[nextBlip].m_nEntityHandle = handle;
|
||||
ms_RadarTrace[nextBlip].m_wScale = 1;
|
||||
ms_RadarTrace[nextBlip].m_eBlipDisplay = display;
|
||||
ms_RadarTrace[nextBlip].m_IconID = RADAR_SPRITE_NONE;
|
||||
ms_RadarTrace[nextBlip].m_eRadarSprite = RADAR_SPRITE_NONE;
|
||||
return GetNewUniqueBlipIndex(nextBlip);
|
||||
}
|
||||
|
||||
@ -1020,6 +1191,21 @@ void CRadar::ShowRadarTraceWithHeight(float x, float y, uint32 size, uint8 red,
|
||||
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));
|
||||
break;
|
||||
}
|
||||
#ifdef MENU_MAP
|
||||
// VC uses -1 for coords and -2 for entities but meh, I don't want to edit DrawBlips
|
||||
if (CMenuManager::bMenuMapActive) {
|
||||
bool alreadyThere = false;
|
||||
for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
|
||||
if (MapLegendList[i] == -1)
|
||||
alreadyThere = true;
|
||||
}
|
||||
if (!alreadyThere) {
|
||||
MapLegendList[MapLegendCounter] = -1;
|
||||
MapLegendCounter++;
|
||||
ArrowBlipColour1 = CRGBA(red, green, blue, alpha);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void CRadar::Shutdown()
|
||||
@ -1075,6 +1261,11 @@ void CRadar::TransformRealWorldToTexCoordSpace(CVector2D &out, const CVector2D &
|
||||
void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D &in)
|
||||
{
|
||||
float s, c;
|
||||
#if 1
|
||||
s = -cachedSin;
|
||||
c = cachedCos;
|
||||
#else
|
||||
// Original code
|
||||
|
||||
s = -Sin(TheCamera.GetForward().Heading());
|
||||
c = Cos(TheCamera.GetForward().Heading());
|
||||
@ -1096,6 +1287,7 @@ void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D
|
||||
s = -Sin(forward.Heading());
|
||||
c = Cos(forward.Heading());
|
||||
}
|
||||
#endif
|
||||
|
||||
out.x = s * in.y + c * in.x;
|
||||
out.y = c * in.y - s * in.x;
|
||||
@ -1106,17 +1298,33 @@ void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D
|
||||
// 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)
|
||||
{
|
||||
#ifdef FIX_BUGS
|
||||
out.x = (in.x + 1.0f)*0.5f*SCREEN_SCALE_X(RADAR_WIDTH) + SCREEN_SCALE_X(RADAR_LEFT);
|
||||
#else
|
||||
out.x = (in.x + 1.0f)*0.5f*SCREEN_SCALE_X(RADAR_WIDTH) + RADAR_LEFT;
|
||||
#ifdef MENU_MAP
|
||||
if (CMenuManager::bMenuMapActive) {
|
||||
// fMapSize is actually half map size. Radar range is 1000, so if x is -2000, in.x + 2.0f is 0.
|
||||
out.x = (CMenuManager::fMapCenterX - CMenuManager::fMapSize) + (in.x + 2.0f) * CMenuManager::fMapSize * 2.0f / 4.0f;
|
||||
out.y = (CMenuManager::fMapCenterY - CMenuManager::fMapSize) + (2.0f - in.y) * CMenuManager::fMapSize * 2.0f / 4.0f;
|
||||
} else
|
||||
#endif
|
||||
out.y = (1.0f - in.y)*0.5f*SCREEN_SCALE_Y(RADAR_HEIGHT) + SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT);
|
||||
{
|
||||
#ifdef FIX_BUGS
|
||||
out.x = (in.x + 1.0f) * 0.5f * SCREEN_SCALE_X(RADAR_WIDTH) + SCREEN_SCALE_X(RADAR_LEFT);
|
||||
#else
|
||||
out.x = (in.x + 1.0f) * 0.5f * SCREEN_SCALE_X(RADAR_WIDTH) + RADAR_LEFT;
|
||||
#endif
|
||||
out.y = (1.0f - in.y) * 0.5f * SCREEN_SCALE_Y(RADAR_HEIGHT) + SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D &in)
|
||||
{
|
||||
float s, c;
|
||||
#if 1
|
||||
s = cachedSin;
|
||||
c = cachedCos;
|
||||
#else
|
||||
// Original code
|
||||
|
||||
float s, c;
|
||||
if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED) {
|
||||
s = 0.0f;
|
||||
c = 1.0f;
|
||||
@ -1138,6 +1346,7 @@ void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D
|
||||
s = Sin(forward.Heading());
|
||||
c = Cos(forward.Heading());
|
||||
}
|
||||
#endif
|
||||
|
||||
float x = (in.x - vec2DRadarOrigin.x) * (1.0f / m_radarRange);
|
||||
float y = (in.y - vec2DRadarOrigin.y) * (1.0f / m_radarRange);
|
||||
@ -1146,121 +1355,107 @@ void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D
|
||||
out.y = c * y - s * x;
|
||||
}
|
||||
|
||||
// Transform from section indices to world coordinates
|
||||
void CRadar::GetTextureCorners(int32 x, int32 y, CVector2D *out)
|
||||
void
|
||||
CRadar::CalculateCachedSinCos()
|
||||
{
|
||||
x = x - RADAR_NUM_TILES/2;
|
||||
y = -(y - RADAR_NUM_TILES/2);
|
||||
if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED
|
||||
#ifdef MENU_MAP
|
||||
|| CMenuManager::bMenuMapActive
|
||||
#endif
|
||||
) {
|
||||
cachedSin = 0.0f;
|
||||
cachedCos = 1.0f;
|
||||
} else if (TheCamera.GetLookDirection() == LOOKING_FORWARD) {
|
||||
cachedSin = Sin(TheCamera.GetForward().Heading());
|
||||
cachedCos = Cos(TheCamera.GetForward().Heading());
|
||||
} else {
|
||||
CVector forward;
|
||||
|
||||
// bottom left
|
||||
out[0].x = RADAR_TILE_SIZE * (x);
|
||||
out[0].y = RADAR_TILE_SIZE * (y - 1);
|
||||
if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON) {
|
||||
forward = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetForward();
|
||||
forward.Normalise(); // a bit useless...
|
||||
}
|
||||
else
|
||||
forward = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetPosition() - TheCamera.Cams[TheCamera.ActiveCam].SourceBeforeLookBehind;
|
||||
|
||||
// bottom right
|
||||
out[1].x = RADAR_TILE_SIZE * (x + 1);
|
||||
out[1].y = RADAR_TILE_SIZE * (y - 1);
|
||||
|
||||
// top right
|
||||
out[2].x = RADAR_TILE_SIZE * (x + 1);
|
||||
out[2].y = RADAR_TILE_SIZE * (y);
|
||||
|
||||
// top left
|
||||
out[3].x = RADAR_TILE_SIZE * (x);
|
||||
out[3].y = RADAR_TILE_SIZE * (y);
|
||||
cachedSin = Sin(forward.Heading());
|
||||
cachedCos = Cos(forward.Heading());
|
||||
}
|
||||
}
|
||||
|
||||
void CRadar::ClipRadarTileCoords(int32 &x, int32 &y)
|
||||
#ifdef MENU_MAP
|
||||
void
|
||||
CRadar::InitFrontEndMap()
|
||||
{
|
||||
if (x < 0)
|
||||
x = 0;
|
||||
if (x > RADAR_NUM_TILES-1)
|
||||
x = RADAR_NUM_TILES-1;
|
||||
if (y < 0)
|
||||
y = 0;
|
||||
if (y > RADAR_NUM_TILES-1)
|
||||
y = RADAR_NUM_TILES-1;
|
||||
CalculateCachedSinCos();
|
||||
vec2DRadarOrigin.x = 0.0f;
|
||||
vec2DRadarOrigin.y = 0.0f;
|
||||
m_radarRange = 1000.0f; // doesn't mean anything, just affects the calculation in TransformRadarPointToScreenSpace
|
||||
for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
|
||||
MapLegendList[i] = RADAR_SPRITE_NONE;
|
||||
}
|
||||
MapLegendCounter = 0;
|
||||
ArrowBlipColour1 = CRGBA(0, 0, 0, 0);
|
||||
ArrowBlipColour2 = CRGBA(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
bool CRadar::IsPointInsideRadar(const CVector2D &point)
|
||||
void
|
||||
CRadar::DrawYouAreHereSprite(float x, float y)
|
||||
{
|
||||
if (point.x < -1.0f || point.x > 1.0f) return false;
|
||||
if (point.y < -1.0f || point.y > 1.0f) return false;
|
||||
return true;
|
||||
}
|
||||
static uint32 lastChange = 0;
|
||||
static bool show = true;
|
||||
|
||||
// clip line p1,p2 against (-1.0, 1.0) in x and y, set out to clipped point closest to p1
|
||||
int CRadar::LineRadarBoxCollision(CVector2D &out, const CVector2D &p1, const CVector2D &p2)
|
||||
{
|
||||
float d1, d2;
|
||||
float t;
|
||||
float x, y;
|
||||
float shortest = 1.0f;
|
||||
int edge = -1;
|
||||
|
||||
// clip against left edge, x = -1.0
|
||||
d1 = -1.0f - p1.x;
|
||||
d2 = -1.0f - p2.x;
|
||||
if (d1 * d2 < 0.0f) {
|
||||
// they are on opposite sides, get point of intersection
|
||||
t = d1 / (d1 - d2);
|
||||
y = (p2.y - p1.y)*t + p1.y;
|
||||
if (y >= -1.0f && y <= 1.0f && t <= shortest) {
|
||||
out.x = -1.0f;
|
||||
out.y = y;
|
||||
edge = 3;
|
||||
shortest = t;
|
||||
if (show) {
|
||||
if (CTimer::GetTimeInMillisecondsPauseMode() - lastChange > 500) {
|
||||
lastChange = CTimer::GetTimeInMillisecondsPauseMode();
|
||||
show = !show;
|
||||
}
|
||||
} else {
|
||||
if (CTimer::GetTimeInMillisecondsPauseMode() - lastChange > 200) {
|
||||
lastChange = CTimer::GetTimeInMillisecondsPauseMode();
|
||||
show = !show;
|
||||
}
|
||||
}
|
||||
|
||||
// clip against right edge, x = 1.0
|
||||
d1 = p1.x - 1.0f;
|
||||
d2 = p2.x - 1.0f;
|
||||
if (d1 * d2 < 0.0f) {
|
||||
// they are on opposite sides, get point of intersection
|
||||
t = d1 / (d1 - d2);
|
||||
y = (p2.y - p1.y)*t + p1.y;
|
||||
if (y >= -1.0f && y <= 1.0f && t <= shortest) {
|
||||
out.x = 1.0f;
|
||||
out.y = y;
|
||||
edge = 1;
|
||||
shortest = t;
|
||||
}
|
||||
if (show) {
|
||||
float left = x - SCREEN_SCALE_X(12.0f);
|
||||
float top = y - SCREEN_SCALE_Y(2.0f);
|
||||
float right = SCREEN_SCALE_X(12.0) + x;
|
||||
float bottom = y - SCREEN_SCALE_Y(26.0f);
|
||||
CentreSprite.Draw(CRect(left, top, right, bottom), CRGBA(255, 255, 255, 255));
|
||||
}
|
||||
|
||||
// clip against top edge, y = -1.0
|
||||
d1 = -1.0f - p1.y;
|
||||
d2 = -1.0f - p2.y;
|
||||
if (d1 * d2 < 0.0f) {
|
||||
// they are on opposite sides, get point of intersection
|
||||
t = d1 / (d1 - d2);
|
||||
x = (p2.x - p1.x)*t + p1.x;
|
||||
if (x >= -1.0f && x <= 1.0f && t <= shortest) {
|
||||
out.y = -1.0f;
|
||||
out.x = x;
|
||||
edge = 0;
|
||||
shortest = t;
|
||||
}
|
||||
}
|
||||
|
||||
// clip against bottom edge, y = 1.0
|
||||
d1 = p1.y - 1.0f;
|
||||
d2 = p2.y - 1.0f;
|
||||
if (d1 * d2 < 0.0f) {
|
||||
// they are on opposite sides, get point of intersection
|
||||
t = d1 / (d1 - d2);
|
||||
x = (p2.x - p1.x)*t + p1.x;
|
||||
if (x >= -1.0f && x <= 1.0f && t <= shortest) {
|
||||
out.y = 1.0f;
|
||||
out.x = x;
|
||||
edge = 2;
|
||||
shortest = t;
|
||||
}
|
||||
}
|
||||
|
||||
return edge;
|
||||
MapLegendList[MapLegendCounter++] = RADAR_SPRITE_CENTRE;
|
||||
}
|
||||
|
||||
void
|
||||
CRadar::ToggleTargetMarker(float x, float y)
|
||||
{
|
||||
if (TargetMarkerId == -1) {
|
||||
int nextBlip;
|
||||
for (nextBlip = 0; nextBlip < NUMRADARBLIPS; nextBlip++) {
|
||||
if (!ms_RadarTrace[nextBlip].m_bInUse)
|
||||
break;
|
||||
}
|
||||
ms_RadarTrace[nextBlip].m_eBlipType = BLIP_COORD;
|
||||
ms_RadarTrace[nextBlip].m_nColor = 0x333333FF;
|
||||
ms_RadarTrace[nextBlip].m_bDim = 1;
|
||||
ms_RadarTrace[nextBlip].m_bInUse = 1;
|
||||
ms_RadarTrace[nextBlip].m_Radius = 1.0f;
|
||||
CVector pos(x, y, CWorld::FindGroundZForCoord(x,y));
|
||||
ms_RadarTrace[nextBlip].m_vec2DPos = pos;
|
||||
ms_RadarTrace[nextBlip].m_vecPos = pos;
|
||||
ms_RadarTrace[nextBlip].m_nEntityHandle = 0;
|
||||
ms_RadarTrace[nextBlip].m_wScale = 5;
|
||||
ms_RadarTrace[nextBlip].m_eBlipDisplay = BLIP_DISPLAY_BLIP_ONLY;
|
||||
ms_RadarTrace[nextBlip].m_eRadarSprite = RADAR_SPRITE_NONE;
|
||||
TargetMarkerId = CRadar::GetNewUniqueBlipIndex(nextBlip);
|
||||
} else {
|
||||
ClearBlip(TargetMarkerId);
|
||||
TargetMarkerId = -1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x4A3EF0, CRadar::Initialise, PATCH_JUMP);
|
||||
InjectHook(0x4A3F60, CRadar::Shutdown, PATCH_JUMP);
|
||||
@ -1291,8 +1486,14 @@ STARTPATCHES
|
||||
InjectHook(0x4A5C60, CRadar::SetRadarMarkerState, PATCH_JUMP);
|
||||
InjectHook(0x4A5D10, CRadar::DrawRotatingRadarSprite, PATCH_JUMP);
|
||||
InjectHook(0x4A5EF0, CRadar::DrawRadarSprite, PATCH_JUMP);
|
||||
InjectHook(0x4A6020, ClipRadarTileCoords, PATCH_JUMP);
|
||||
InjectHook(0x4A6060, RequestMapSection, PATCH_JUMP);
|
||||
InjectHook(0x4A60A0, RemoveMapSection, PATCH_JUMP);
|
||||
InjectHook(0x4A60E0, CRadar::RemoveRadarSections, PATCH_JUMP);
|
||||
InjectHook(0x4A6100, (void (*)(int32, int32))&CRadar::StreamRadarSections, PATCH_JUMP);
|
||||
InjectHook(0x4A6160, IsPointInsideRadar, PATCH_JUMP);
|
||||
InjectHook(0x4A61C0, GetTextureCorners, PATCH_JUMP);
|
||||
InjectHook(0x4A6250, LineRadarBoxCollision, PATCH_JUMP);
|
||||
InjectHook(0x4A64A0, CRadar::ClipRadarPoly, PATCH_JUMP);
|
||||
InjectHook(0x4A67E0, CRadar::DrawRadarSection, PATCH_JUMP);
|
||||
InjectHook(0x4A69C0, CRadar::DrawRadarMask, PATCH_JUMP);
|
||||
@ -1300,8 +1501,6 @@ STARTPATCHES
|
||||
InjectHook(0x4A6C20, CRadar::DrawRadarMap, PATCH_JUMP);
|
||||
InjectHook(0x4A6E30, CRadar::SaveAllRadarBlips, PATCH_JUMP);
|
||||
InjectHook(0x4A6F30, CRadar::LoadAllRadarBlips, PATCH_JUMP);
|
||||
|
||||
InjectHook(0x4A61C0, CRadar::GetTextureCorners, PATCH_JUMP);
|
||||
InjectHook(0x4A6160, CRadar::IsPointInsideRadar, PATCH_JUMP);
|
||||
InjectHook(0x4A6250, CRadar::LineRadarBoxCollision, PATCH_JUMP);
|
||||
//InjectHook(0x4A7000, `global constructor keyed to'Radar.cpp, PATCH_JUMP);
|
||||
//InjectHook(0x4A7260, sRadarTrace::sRadarTrace, PATCH_JUMP);
|
||||
ENDPATCHES
|
@ -21,6 +21,10 @@ enum eBlipDisplay
|
||||
|
||||
enum eRadarSprite
|
||||
{
|
||||
#ifdef MENU_MAP
|
||||
RADAR_SPRITE_ENTITY_BLIP = -2,
|
||||
RADAR_SPRITE_COORD_BLIP = -1,
|
||||
#endif
|
||||
RADAR_SPRITE_NONE = 0,
|
||||
RADAR_SPRITE_ASUKA = 1,
|
||||
RADAR_SPRITE_BOMB = 2,
|
||||
@ -52,7 +56,7 @@ enum
|
||||
BLIP_MODE_SQUARE,
|
||||
};
|
||||
|
||||
struct CBlip
|
||||
struct sRadarTrace
|
||||
{
|
||||
uint32 m_nColor;
|
||||
uint32 m_eBlipType; // eBlipType
|
||||
@ -65,9 +69,9 @@ struct CBlip
|
||||
float m_Radius;
|
||||
int16 m_wScale;
|
||||
uint16 m_eBlipDisplay; // eBlipDisplay
|
||||
uint16 m_IconID; // eRadarSprite
|
||||
uint16 m_eRadarSprite; // eRadarSprite
|
||||
};
|
||||
static_assert(sizeof(CBlip) == 0x30, "CBlip: error");
|
||||
static_assert(sizeof(sRadarTrace) == 0x30, "sRadarTrace: error");
|
||||
|
||||
// Values for screen space
|
||||
#define RADAR_LEFT (40.0f)
|
||||
@ -79,7 +83,7 @@ class CRadar
|
||||
{
|
||||
public:
|
||||
static float &m_radarRange;
|
||||
static CBlip (&ms_RadarTrace)[NUMRADARBLIPS];
|
||||
static sRadarTrace (&ms_RadarTrace)[NUMRADARBLIPS];
|
||||
static CSprite2d AsukaSprite;
|
||||
static CSprite2d BombSprite;
|
||||
static CSprite2d CatSprite;
|
||||
@ -101,8 +105,20 @@ public:
|
||||
static CSprite2d TonySprite;
|
||||
static CSprite2d WeaponSprite;
|
||||
static CSprite2d *RadarSprites[21];
|
||||
static float cachedCos;
|
||||
static float cachedSin;
|
||||
#ifdef MENU_MAP
|
||||
#define NUM_MAP_LEGENDS 75
|
||||
static CRGBA ArrowBlipColour1;
|
||||
static CRGBA ArrowBlipColour2;
|
||||
static uint16 MapLegendList[NUM_MAP_LEGENDS];
|
||||
static uint16 MapLegendCounter;
|
||||
static int TargetMarkerId;
|
||||
|
||||
public:
|
||||
static void InitFrontEndMap();
|
||||
static void DrawYouAreHereSprite(float, float);
|
||||
static void ToggleTargetMarker(float, float);
|
||||
#endif
|
||||
static uint8 CalculateBlipAlpha(float dist);
|
||||
static void ChangeBlipBrightness(int32 i, int32 bright);
|
||||
static void ChangeBlipColour(int32 i, int32);
|
||||
@ -128,7 +144,6 @@ public:
|
||||
static void LoadAllRadarBlips(uint8 *buf, uint32 size);
|
||||
static void LoadTextures();
|
||||
static void RemoveRadarSections();
|
||||
static void RequestMapSection(int32 x, int32 y);
|
||||
static void SaveAllRadarBlips(uint8*, uint32*);
|
||||
static void SetBlipSprite(int32 i, int32 icon);
|
||||
static int32 SetCoordBlip(eBlipType type, CVector pos, int32, eBlipDisplay);
|
||||
@ -146,8 +161,5 @@ public:
|
||||
static void TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D &in);
|
||||
|
||||
// no in CRadar in the game:
|
||||
static void GetTextureCorners(int32 x, int32 y, CVector2D *out);
|
||||
static void ClipRadarTileCoords(int32 &x, int32 &y);
|
||||
static bool IsPointInsideRadar(const CVector2D &);
|
||||
static int LineRadarBoxCollision(CVector2D &, const CVector2D &, const CVector2D &);
|
||||
static void CalculateCachedSinCos();
|
||||
};
|
||||
|
@ -1,140 +0,0 @@
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable : 4005)
|
||||
#define DIRECTINPUT_VERSION 0x0800
|
||||
#include <dinput.h>
|
||||
#pragma warning( pop )
|
||||
#include "common.h"
|
||||
#include "win.h"
|
||||
#include "patcher.h"
|
||||
#include "Timer.h"
|
||||
|
||||
float &texLoadTime = *(float*)0x8F1B50;
|
||||
int32 &texNumLoaded = *(int32*)0x8F252C;
|
||||
|
||||
RwTexture*
|
||||
RwTextureGtaStreamRead(RwStream *stream)
|
||||
{
|
||||
RwUInt32 size, version;
|
||||
RwTexture *tex;
|
||||
|
||||
if(!RwStreamFindChunk(stream, rwID_TEXTURENATIVE, &size, &version))
|
||||
return nil;
|
||||
|
||||
float preloadTime = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond();
|
||||
|
||||
if(!RWSRCGLOBAL(stdFunc[rwSTANDARDNATIVETEXTUREREAD](stream, &tex, size)))
|
||||
return nil;
|
||||
|
||||
if (gGameState == GS_INIT_PLAYING_GAME) {
|
||||
texLoadTime = (texNumLoaded * texLoadTime + (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond() - preloadTime) / (float)(texNumLoaded+1);
|
||||
texNumLoaded++;
|
||||
}
|
||||
return tex;
|
||||
}
|
||||
|
||||
RwTexture*
|
||||
destroyTexture(RwTexture *texture, void *data)
|
||||
{
|
||||
RwTextureDestroy(texture);
|
||||
return texture;
|
||||
}
|
||||
|
||||
RwTexDictionary*
|
||||
RwTexDictionaryGtaStreamRead(RwStream *stream)
|
||||
{
|
||||
RwUInt32 size, version;
|
||||
RwInt32 numTextures;
|
||||
RwTexDictionary *texDict;
|
||||
RwTexture *tex;
|
||||
|
||||
if(!RwStreamFindChunk(stream, rwID_STRUCT, &size, &version))
|
||||
return nil;
|
||||
assert(size == 4);
|
||||
if(RwStreamRead(stream, &numTextures, size) != size)
|
||||
return nil;
|
||||
|
||||
texDict = RwTexDictionaryCreate();
|
||||
if(texDict == nil)
|
||||
return nil;
|
||||
|
||||
while(numTextures--){
|
||||
tex = RwTextureGtaStreamRead(stream);
|
||||
if(tex == nil){
|
||||
RwTexDictionaryForAllTextures(texDict, destroyTexture, nil);
|
||||
RwTexDictionaryDestroy(texDict);
|
||||
return nil;
|
||||
}
|
||||
RwTexDictionaryAddTexture(texDict, tex);
|
||||
}
|
||||
|
||||
return texDict;
|
||||
}
|
||||
|
||||
static int32 numberTextures = -1;
|
||||
static int32 streamPosition;
|
||||
|
||||
RwTexDictionary*
|
||||
RwTexDictionaryGtaStreamRead1(RwStream *stream)
|
||||
{
|
||||
RwUInt32 size, version;
|
||||
RwInt32 numTextures;
|
||||
RwTexDictionary *texDict;
|
||||
RwTexture *tex;
|
||||
|
||||
numberTextures = 0;
|
||||
if(!RwStreamFindChunk(stream, rwID_STRUCT, &size, &version))
|
||||
return nil;
|
||||
assert(size == 4);
|
||||
if(RwStreamRead(stream, &numTextures, size) != size)
|
||||
return nil;
|
||||
|
||||
texDict = RwTexDictionaryCreate();
|
||||
if(texDict == nil)
|
||||
return nil;
|
||||
|
||||
numberTextures = numTextures/2;
|
||||
|
||||
while(numTextures > numberTextures){
|
||||
numTextures--;
|
||||
|
||||
tex = RwTextureGtaStreamRead(stream);
|
||||
if(tex == nil){
|
||||
RwTexDictionaryForAllTextures(texDict, destroyTexture, nil);
|
||||
RwTexDictionaryDestroy(texDict);
|
||||
return nil;
|
||||
}
|
||||
RwTexDictionaryAddTexture(texDict, tex);
|
||||
}
|
||||
|
||||
numberTextures = numTextures;
|
||||
streamPosition = stream->Type.memory.position;
|
||||
|
||||
return texDict;
|
||||
}
|
||||
|
||||
RwTexDictionary*
|
||||
RwTexDictionaryGtaStreamRead2(RwStream *stream, RwTexDictionary *texDict)
|
||||
{
|
||||
RwTexture *tex;
|
||||
|
||||
RwStreamSkip(stream, streamPosition - stream->Type.memory.position);
|
||||
|
||||
while(numberTextures--){
|
||||
tex = RwTextureGtaStreamRead(stream);
|
||||
if(tex == nil){
|
||||
RwTexDictionaryForAllTextures(texDict, destroyTexture, nil);
|
||||
RwTexDictionaryDestroy(texDict);
|
||||
return nil;
|
||||
}
|
||||
RwTexDictionaryAddTexture(texDict, tex);
|
||||
}
|
||||
|
||||
return texDict;
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x592380, RwTextureGtaStreamRead, PATCH_JUMP);
|
||||
InjectHook(0x5924A0, RwTexDictionaryGtaStreamRead, PATCH_JUMP);
|
||||
InjectHook(0x592550, RwTexDictionaryGtaStreamRead1, PATCH_JUMP);
|
||||
InjectHook(0x592650, RwTexDictionaryGtaStreamRead2, PATCH_JUMP);
|
||||
ENDPATCHES
|
@ -1,18 +1,18 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "Stats.h"
|
||||
|
||||
WRAPPER void CStats::SaveStats(uint8 *buf, uint32 *size) { EAXJMP(0x4ab3e0); }
|
||||
#include "Text.h"
|
||||
#include "World.h"
|
||||
|
||||
int32 &CStats::DaysPassed = *(int32*)0x8F2BB8;
|
||||
int32 &CStats::HeadsPopped = *(int32*)0x8F647C;
|
||||
bool& CStats::CommercialPassed = *(bool*)0x8F4334;
|
||||
bool& CStats::IndustrialPassed = *(bool*)0x8E2A68;
|
||||
bool& CStats::SuburbanPassed = *(bool*)0x8F2740;
|
||||
int32& CStats::CommercialPassed = *(int32*)0x8F4334;
|
||||
int32& CStats::IndustrialPassed = *(int32*)0x8E2A68;
|
||||
int32& CStats::SuburbanPassed = *(int32*)0x8F2740;
|
||||
int32 &CStats::NumberKillFrenziesPassed = *(int32*)0x8E287C;
|
||||
int32 &CStats::PeopleKilledByOthers = *(int32*)0x8E2C50;
|
||||
int32 &CStats::HelisDestroyed = *(int32*)0x8E2A64;
|
||||
int32 *CStats::PedsKilledOfThisType = (int32*)0x880DBC;
|
||||
int32(&CStats::PedsKilledOfThisType)[NUM_PEDTYPES] = *(int32(*)[NUM_PEDTYPES]) * (uintptr*)0x880DBC;
|
||||
int32 &CStats::TimesDied = *(int32*)0x8E2BDC;
|
||||
int32 &CStats::TimesArrested = *(int32*)0x8E2BEC;
|
||||
int32 &CStats::KillsSinceLastCheckpoint = *(int32*)0x8F2C8C;
|
||||
@ -48,11 +48,73 @@ int32& CStats::LongestFlightInDodo = *(int32*)0x8F5FE4;
|
||||
int32& CStats::TimeTakenDefuseMission = *(int32*)0x880E24;
|
||||
int32& CStats::TotalNumberKillFrenzies = *(int32*)0x8E2884;
|
||||
int32& CStats::TotalNumberMissions = *(int32*)0x8E2820;
|
||||
int32& CStats::KgOfExplosivesUsed = *(int32*)0x8F2510;
|
||||
int32& CStats::RoundsFiredByPlayer = *(int32*)0x8E2BE8;
|
||||
int32& CStats::KgsOfExplosivesUsed = *(int32*)0x8F2510;
|
||||
int32& CStats::InstantHitsFiredByPlayer = *(int32*)0x943070;
|
||||
int32& CStats::InstantHitsHitByPlayer = *(int32*)0x95CB8C;
|
||||
int32& CStats::BestTimeBombDefusal = *(int32*)0x880E24;
|
||||
int32& CStats::mmRain = *(int32*)0x8F2C98;
|
||||
int32& CStats::CarsCrushed = *(int32*)0x943050;
|
||||
int32(&CStats::FastestTimes)[CStats::TOTAL_FASTEST_TIMES] = *(int32(*)[CStats::TOTAL_FASTEST_TIMES])*(uintptr*)0x6E9128;
|
||||
int32(&CStats::HighestScores)[CStats::TOTAL_HIGHEST_SCORES] = *(int32(*)[CStats::TOTAL_HIGHEST_SCORES]) * (uintptr*)0x8622B0;
|
||||
|
||||
void CStats::Init()
|
||||
{
|
||||
PeopleKilledByOthers = 0;
|
||||
PeopleKilledByPlayer = 0;
|
||||
RoundsFiredByPlayer = 0;
|
||||
CarsExploded = 0;
|
||||
HelisDestroyed = 0;
|
||||
ProgressMade = 0;
|
||||
KgsOfExplosivesUsed = 0;
|
||||
InstantHitsFiredByPlayer = 0;
|
||||
InstantHitsHitByPlayer = 0;
|
||||
CarsCrushed = 0;
|
||||
HeadsPopped = 0;
|
||||
TimesArrested = 0;
|
||||
TimesDied = 0;
|
||||
DaysPassed = 0;
|
||||
NumberOfUniqueJumpsFound = 0;
|
||||
mmRain = 0;
|
||||
MaximumJumpFlips = 0;
|
||||
MaximumJumpSpins = 0;
|
||||
MaximumJumpDistance = 0;
|
||||
MaximumJumpHeight = 0;
|
||||
BestStuntJump = 0;
|
||||
TotalNumberOfUniqueJumps = 0;
|
||||
Record4x4One = 0;
|
||||
LongestFlightInDodo = 0;
|
||||
Record4x4Two = 0;
|
||||
PassengersDroppedOffWithTaxi = 0;
|
||||
Record4x4Three = 0;
|
||||
MoneyMadeWithTaxi = 0;
|
||||
Record4x4Mayhem = 0;
|
||||
LivesSavedWithAmbulance = 0;
|
||||
ElBurroTime = 0;
|
||||
CriminalsCaught = 0;
|
||||
MissionsGiven = 0;
|
||||
HighestLevelAmbulanceMission = 0;
|
||||
MissionsPassed = 0;
|
||||
FiresExtinguished = 0;
|
||||
DistanceTravelledOnFoot = 0;
|
||||
TimeTakenDefuseMission = 0;
|
||||
NumberKillFrenziesPassed = 0;
|
||||
DistanceTravelledInVehicle = 0;
|
||||
TotalNumberKillFrenzies = 0;
|
||||
TotalNumberMissions = 0;
|
||||
KillsSinceLastCheckpoint = 0;
|
||||
TotalLegitimateKills = 0;
|
||||
for (int i = 0; i < TOTAL_FASTEST_TIMES; i++)
|
||||
FastestTimes[i] = 0;
|
||||
for (int i = 0; i < TOTAL_HIGHEST_SCORES; i++)
|
||||
HighestScores[i] = 0;
|
||||
for (int i = 0; i < NUM_PEDTYPES; i++)
|
||||
PedsKilledOfThisType[i] = 0;
|
||||
IndustrialPassed = 0;
|
||||
CommercialPassed = 0;
|
||||
SuburbanPassed = 0;
|
||||
}
|
||||
|
||||
void CStats::RegisterFastestTime(int32 index, int32 time)
|
||||
{
|
||||
assert(index >= 0 && index < TOTAL_FASTEST_TIMES);
|
||||
@ -138,4 +200,229 @@ void CStats::SetTotalNumberMissions(int32 total)
|
||||
TotalNumberMissions = total;
|
||||
}
|
||||
|
||||
WRAPPER void CStats::Init() { EAXJMP(0x4AAC60); }
|
||||
wchar *CStats::FindCriminalRatingString()
|
||||
{
|
||||
int rating = FindCriminalRatingNumber();
|
||||
|
||||
if (rating < 10) return TheText.Get("RATNG1");
|
||||
if (rating < 25) return TheText.Get("RATNG2");
|
||||
if (rating < 70) return TheText.Get("RATNG3");
|
||||
if (rating < 150) return TheText.Get("RATNG4");
|
||||
if (rating < 250) return TheText.Get("RATNG5");
|
||||
if (rating < 450) return TheText.Get("RATNG6");
|
||||
if (rating < 700) return TheText.Get("RATNG7");
|
||||
if (rating < 1000) return TheText.Get("RATNG8");
|
||||
if (rating < 1400) return TheText.Get("RATNG9");
|
||||
if (rating < 1900) return TheText.Get("RATNG10");
|
||||
if (rating < 2500) return TheText.Get("RATNG11");
|
||||
if (rating < 3200) return TheText.Get("RATNG12");
|
||||
if (rating < 4000) return TheText.Get("RATNG13");
|
||||
if (rating < 5000) return TheText.Get("RATNG14");
|
||||
return TheText.Get("RATNG15");
|
||||
}
|
||||
|
||||
int32 CStats::FindCriminalRatingNumber()
|
||||
{
|
||||
int32 rating;
|
||||
|
||||
rating = FiresExtinguished + 10 * HighestLevelAmbulanceMission + CriminalsCaught + LivesSavedWithAmbulance
|
||||
+ 30 * HelisDestroyed + TotalLegitimateKills - 3 * TimesArrested - 3 * TimesDied
|
||||
+ CWorld::Players[CWorld::PlayerInFocus].m_nMoney / 5000;
|
||||
if (rating <= 0) rating = 0;
|
||||
|
||||
if (InstantHitsFiredByPlayer > 100)
|
||||
rating += (float)CStats::InstantHitsHitByPlayer / (float)CStats::InstantHitsFiredByPlayer * 500.0f;
|
||||
if (TotalProgressInGame)
|
||||
rating += (float)CStats::ProgressMade / (float)CStats::TotalProgressInGame * 1000.0f;
|
||||
if (!IndustrialPassed && rating >= 3521)
|
||||
rating = 3521;
|
||||
if (!CommercialPassed && rating >= 4552)
|
||||
rating = 4552;
|
||||
return rating;
|
||||
}
|
||||
|
||||
void CStats::SaveStats(uint8 *buf, uint32 *size)
|
||||
{
|
||||
CheckPointReachedSuccessfully();
|
||||
uint8 *buf_start = buf;
|
||||
*size = sizeof(PeopleKilledByPlayer) +
|
||||
sizeof(PeopleKilledByOthers) +
|
||||
sizeof(CarsExploded) +
|
||||
sizeof(RoundsFiredByPlayer) +
|
||||
sizeof(PedsKilledOfThisType) +
|
||||
sizeof(HelisDestroyed) +
|
||||
sizeof(ProgressMade) +
|
||||
sizeof(TotalProgressInGame) +
|
||||
sizeof(KgsOfExplosivesUsed) +
|
||||
sizeof(InstantHitsFiredByPlayer) +
|
||||
sizeof(InstantHitsHitByPlayer) +
|
||||
sizeof(CarsCrushed) +
|
||||
sizeof(HeadsPopped) +
|
||||
sizeof(TimesArrested) +
|
||||
sizeof(TimesDied) +
|
||||
sizeof(DaysPassed) +
|
||||
sizeof(mmRain) +
|
||||
sizeof(MaximumJumpDistance) +
|
||||
sizeof(MaximumJumpHeight) +
|
||||
sizeof(MaximumJumpFlips) +
|
||||
sizeof(MaximumJumpSpins) +
|
||||
sizeof(BestStuntJump) +
|
||||
sizeof(NumberOfUniqueJumpsFound) +
|
||||
sizeof(TotalNumberOfUniqueJumps) +
|
||||
sizeof(MissionsGiven) +
|
||||
sizeof(MissionsPassed) +
|
||||
sizeof(PassengersDroppedOffWithTaxi) +
|
||||
sizeof(MoneyMadeWithTaxi) +
|
||||
sizeof(IndustrialPassed) +
|
||||
sizeof(CommercialPassed) +
|
||||
sizeof(SuburbanPassed) +
|
||||
sizeof(ElBurroTime) +
|
||||
sizeof(DistanceTravelledOnFoot) +
|
||||
sizeof(DistanceTravelledInVehicle) +
|
||||
sizeof(Record4x4One) +
|
||||
sizeof(Record4x4Two) +
|
||||
sizeof(Record4x4Three) +
|
||||
sizeof(Record4x4Mayhem) +
|
||||
sizeof(LivesSavedWithAmbulance) +
|
||||
sizeof(CriminalsCaught) +
|
||||
sizeof(HighestLevelAmbulanceMission) +
|
||||
sizeof(FiresExtinguished) +
|
||||
sizeof(LongestFlightInDodo) +
|
||||
sizeof(TimeTakenDefuseMission) +
|
||||
sizeof(NumberKillFrenziesPassed) +
|
||||
sizeof(TotalNumberKillFrenzies) +
|
||||
sizeof(TotalNumberMissions) +
|
||||
sizeof(FastestTimes) +
|
||||
sizeof(HighestScores) +
|
||||
sizeof(KillsSinceLastCheckpoint) +
|
||||
sizeof(TotalLegitimateKills) +
|
||||
sizeof(LastMissionPassedName);
|
||||
|
||||
#define CopyToBuf(buf, data) memcpy(buf, &data, sizeof(data)); buf += sizeof(data);
|
||||
CopyToBuf(buf, PeopleKilledByPlayer);
|
||||
CopyToBuf(buf, PeopleKilledByOthers);
|
||||
CopyToBuf(buf, CarsExploded);
|
||||
CopyToBuf(buf, RoundsFiredByPlayer);
|
||||
CopyToBuf(buf, PedsKilledOfThisType);
|
||||
CopyToBuf(buf, HelisDestroyed);
|
||||
CopyToBuf(buf, ProgressMade);
|
||||
CopyToBuf(buf, TotalProgressInGame);
|
||||
CopyToBuf(buf, KgsOfExplosivesUsed);
|
||||
CopyToBuf(buf, InstantHitsFiredByPlayer);
|
||||
CopyToBuf(buf, InstantHitsHitByPlayer);
|
||||
CopyToBuf(buf, CarsCrushed);
|
||||
CopyToBuf(buf, HeadsPopped);
|
||||
CopyToBuf(buf, TimesArrested);
|
||||
CopyToBuf(buf, TimesDied);
|
||||
CopyToBuf(buf, DaysPassed);
|
||||
CopyToBuf(buf, mmRain);
|
||||
CopyToBuf(buf, MaximumJumpDistance);
|
||||
CopyToBuf(buf, MaximumJumpHeight);
|
||||
CopyToBuf(buf, MaximumJumpFlips);
|
||||
CopyToBuf(buf, MaximumJumpSpins);
|
||||
CopyToBuf(buf, BestStuntJump);
|
||||
CopyToBuf(buf, NumberOfUniqueJumpsFound);
|
||||
CopyToBuf(buf, TotalNumberOfUniqueJumps);
|
||||
CopyToBuf(buf, MissionsGiven);
|
||||
CopyToBuf(buf, MissionsPassed);
|
||||
CopyToBuf(buf, PassengersDroppedOffWithTaxi);
|
||||
CopyToBuf(buf, MoneyMadeWithTaxi);
|
||||
CopyToBuf(buf, IndustrialPassed);
|
||||
CopyToBuf(buf, CommercialPassed);
|
||||
CopyToBuf(buf, SuburbanPassed);
|
||||
CopyToBuf(buf, ElBurroTime);
|
||||
CopyToBuf(buf, DistanceTravelledOnFoot);
|
||||
CopyToBuf(buf, DistanceTravelledInVehicle);
|
||||
CopyToBuf(buf, Record4x4One);
|
||||
CopyToBuf(buf, Record4x4Two);
|
||||
CopyToBuf(buf, Record4x4Three);
|
||||
CopyToBuf(buf, Record4x4Mayhem);
|
||||
CopyToBuf(buf, LivesSavedWithAmbulance);
|
||||
CopyToBuf(buf, CriminalsCaught);
|
||||
CopyToBuf(buf, HighestLevelAmbulanceMission);
|
||||
CopyToBuf(buf, FiresExtinguished);
|
||||
CopyToBuf(buf, LongestFlightInDodo);
|
||||
CopyToBuf(buf, TimeTakenDefuseMission);
|
||||
CopyToBuf(buf, NumberKillFrenziesPassed);
|
||||
CopyToBuf(buf, TotalNumberKillFrenzies);
|
||||
CopyToBuf(buf, TotalNumberMissions);
|
||||
CopyToBuf(buf, FastestTimes);
|
||||
CopyToBuf(buf, HighestScores);
|
||||
CopyToBuf(buf, KillsSinceLastCheckpoint);
|
||||
CopyToBuf(buf, TotalLegitimateKills);
|
||||
CopyToBuf(buf, LastMissionPassedName);
|
||||
|
||||
assert(buf - buf_start == *size);
|
||||
#undef CopyToBuf
|
||||
}
|
||||
|
||||
void CStats::LoadStats(uint8 *buf, uint32 size)
|
||||
{
|
||||
uint8* buf_start = buf;
|
||||
|
||||
#define CopyFromBuf(buf, data) memcpy(&data, buf, sizeof(data)); buf += sizeof(data);
|
||||
|
||||
CopyFromBuf(buf, PeopleKilledByPlayer);
|
||||
CopyFromBuf(buf, PeopleKilledByOthers);
|
||||
CopyFromBuf(buf, CarsExploded);
|
||||
CopyFromBuf(buf, RoundsFiredByPlayer);
|
||||
CopyFromBuf(buf, PedsKilledOfThisType);
|
||||
CopyFromBuf(buf, HelisDestroyed);
|
||||
CopyFromBuf(buf, ProgressMade);
|
||||
CopyFromBuf(buf, TotalProgressInGame);
|
||||
CopyFromBuf(buf, KgsOfExplosivesUsed);
|
||||
CopyFromBuf(buf, InstantHitsFiredByPlayer);
|
||||
CopyFromBuf(buf, InstantHitsHitByPlayer);
|
||||
CopyFromBuf(buf, CarsCrushed);
|
||||
CopyFromBuf(buf, HeadsPopped);
|
||||
CopyFromBuf(buf, TimesArrested);
|
||||
CopyFromBuf(buf, TimesDied);
|
||||
CopyFromBuf(buf, DaysPassed);
|
||||
CopyFromBuf(buf, mmRain);
|
||||
CopyFromBuf(buf, MaximumJumpDistance);
|
||||
CopyFromBuf(buf, MaximumJumpHeight);
|
||||
CopyFromBuf(buf, MaximumJumpFlips);
|
||||
CopyFromBuf(buf, MaximumJumpSpins);
|
||||
CopyFromBuf(buf, BestStuntJump);
|
||||
CopyFromBuf(buf, NumberOfUniqueJumpsFound);
|
||||
CopyFromBuf(buf, TotalNumberOfUniqueJumps);
|
||||
CopyFromBuf(buf, MissionsGiven);
|
||||
CopyFromBuf(buf, MissionsPassed);
|
||||
CopyFromBuf(buf, PassengersDroppedOffWithTaxi);
|
||||
CopyFromBuf(buf, MoneyMadeWithTaxi);
|
||||
CopyFromBuf(buf, IndustrialPassed);
|
||||
CopyFromBuf(buf, CommercialPassed);
|
||||
CopyFromBuf(buf, SuburbanPassed);
|
||||
CopyFromBuf(buf, ElBurroTime);
|
||||
CopyFromBuf(buf, DistanceTravelledOnFoot);
|
||||
CopyFromBuf(buf, DistanceTravelledInVehicle);
|
||||
CopyFromBuf(buf, Record4x4One);
|
||||
CopyFromBuf(buf, Record4x4Two);
|
||||
CopyFromBuf(buf, Record4x4Three);
|
||||
CopyFromBuf(buf, Record4x4Mayhem);
|
||||
CopyFromBuf(buf, LivesSavedWithAmbulance);
|
||||
CopyFromBuf(buf, CriminalsCaught);
|
||||
CopyFromBuf(buf, HighestLevelAmbulanceMission);
|
||||
CopyFromBuf(buf, FiresExtinguished);
|
||||
CopyFromBuf(buf, LongestFlightInDodo);
|
||||
CopyFromBuf(buf, TimeTakenDefuseMission);
|
||||
CopyFromBuf(buf, NumberKillFrenziesPassed);
|
||||
CopyFromBuf(buf, TotalNumberKillFrenzies);
|
||||
CopyFromBuf(buf, TotalNumberMissions);
|
||||
CopyFromBuf(buf, FastestTimes);
|
||||
CopyFromBuf(buf, HighestScores);
|
||||
CopyFromBuf(buf, KillsSinceLastCheckpoint);
|
||||
CopyFromBuf(buf, TotalLegitimateKills);
|
||||
CopyFromBuf(buf, LastMissionPassedName);
|
||||
|
||||
assert(buf - buf_start == size);
|
||||
#undef CopyFromBuf
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x48C5A3, CStats::Init, PATCH_JUMP); // CGame::ReInitGameObjectVariables
|
||||
InjectHook(0x4AB3E0, CStats::SaveStats, PATCH_JUMP);
|
||||
InjectHook(0x4AB670, CStats::LoadStats, PATCH_JUMP);
|
||||
InjectHook(0x4AB090, CStats::FindCriminalRatingString, PATCH_JUMP);
|
||||
InjectHook(0x4AB2A0, CStats::FindCriminalRatingNumber, PATCH_JUMP);
|
||||
ENDPATCHES
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "PedType.h"
|
||||
|
||||
class CStats
|
||||
{
|
||||
public:
|
||||
@ -8,14 +10,14 @@ public:
|
||||
TOTAL_HIGHEST_SCORES = 16
|
||||
};
|
||||
static int32 &DaysPassed;
|
||||
static int32 &HeadsPopped;
|
||||
static bool& CommercialPassed;
|
||||
static bool& IndustrialPassed;
|
||||
static bool& SuburbanPassed;
|
||||
static int32 &HeadsPopped;
|
||||
static int32& CommercialPassed;
|
||||
static int32& IndustrialPassed;
|
||||
static int32& SuburbanPassed;
|
||||
static int32 &NumberKillFrenziesPassed;
|
||||
static int32 &PeopleKilledByOthers;
|
||||
static int32 &HelisDestroyed;
|
||||
static int32 *PedsKilledOfThisType; //[NUM_PEDTYPES]
|
||||
static int32(&PedsKilledOfThisType)[ePedType::NUM_PEDTYPES];
|
||||
static int32 &TimesDied;
|
||||
static int32 &TimesArrested;
|
||||
static int32 &KillsSinceLastCheckpoint;
|
||||
@ -50,32 +52,39 @@ public:
|
||||
static int32 &LongestFlightInDodo;
|
||||
static int32 &TimeTakenDefuseMission;
|
||||
static int32 &TotalNumberKillFrenzies;
|
||||
static int32 &TotalNumberMissions;
|
||||
static int32 &TotalNumberMissions;
|
||||
static int32 &RoundsFiredByPlayer;
|
||||
static int32 &KgsOfExplosivesUsed;
|
||||
static int32 &InstantHitsFiredByPlayer;
|
||||
static int32 &InstantHitsHitByPlayer;
|
||||
static int32 &BestTimeBombDefusal;
|
||||
static int32 &mmRain;
|
||||
static int32 &CarsCrushed;
|
||||
static int32(&FastestTimes)[TOTAL_FASTEST_TIMES];
|
||||
static int32(&HighestScores)[TOTAL_HIGHEST_SCORES];
|
||||
static int32 &KgOfExplosivesUsed;
|
||||
static int32 &CarsCrushed;
|
||||
|
||||
public:
|
||||
static void Init(void);
|
||||
static void RegisterFastestTime(int32, int32);
|
||||
static void RegisterHighestScore(int32, int32);
|
||||
static void AnotherKillFrenzyPassed();
|
||||
static void AnotherLifeSavedWithAmbulance();
|
||||
static void AnotherCriminalCaught();
|
||||
static void RegisterLevelAmbulanceMission(int32);
|
||||
static void AnotherFireExtinguished();
|
||||
static void RegisterElBurroTime(int32);
|
||||
static void Register4x4OneTime(int32);
|
||||
static void Register4x4TwoTime(int32);
|
||||
static void Register4x4ThreeTime(int32);
|
||||
static void Register4x4MayhemTime(int32);
|
||||
static void AnotherLifeSavedWithAmbulance();
|
||||
static void AnotherCriminalCaught();
|
||||
static void RegisterLevelAmbulanceMission(int32);
|
||||
static void AnotherFireExtinguished();
|
||||
static wchar *FindCriminalRatingString();
|
||||
static void RegisterLongestFlightInDodo(int32);
|
||||
static void RegisterTimeTakenDefuseMission(int32);
|
||||
static void AnotherKillFrenzyPassed();
|
||||
static void SetTotalNumberKillFrenzies(int32);
|
||||
static void SetTotalNumberMissions(int32);
|
||||
static void CheckPointReachedUnsuccessfully() { KillsSinceLastCheckpoint = 0; };
|
||||
static void CheckPointReachedSuccessfully() { TotalLegitimateKills += KillsSinceLastCheckpoint; KillsSinceLastCheckpoint = 0; };
|
||||
static void RegisterElBurroTime(int32);
|
||||
static void CheckPointReachedUnsuccessfully() { KillsSinceLastCheckpoint = 0; };
|
||||
static int32 FindCriminalRatingNumber();
|
||||
static void SaveStats(uint8 *buf, uint32 *size);
|
||||
|
||||
static void Init(void);
|
||||
static void LoadStats(uint8 *buf, uint32 size);
|
||||
};
|
||||
|
@ -1247,8 +1247,8 @@ CStreaming::StreamVehiclesAndPeds(void)
|
||||
static int timeBeforeNextLoad = 0;
|
||||
static int modelQualityClass = 0;
|
||||
|
||||
if(CRecordDataForGame::RecordingState == RECORDSTATE_1 ||
|
||||
CRecordDataForGame::RecordingState == RECORDSTATE_2)
|
||||
if(CRecordDataForGame::IsRecording() ||
|
||||
CRecordDataForGame::IsPlayingBack())
|
||||
return;
|
||||
|
||||
if(FindPlayerPed()->m_pWanted->AreSwatRequired()){
|
||||
|
@ -34,6 +34,10 @@ LARGE_INTEGER &perfSuspendCounter = *(LARGE_INTEGER*)0x62A318;
|
||||
//UInt32 suspendDepth;
|
||||
uint32 &suspendDepth = *(uint32*)0x62A320;
|
||||
|
||||
#ifdef FIX_BUGS
|
||||
double frameTime;
|
||||
#endif
|
||||
|
||||
void CTimer::Initialise(void)
|
||||
{
|
||||
debug("Initialising CTimer...\n");
|
||||
@ -90,17 +94,21 @@ void CTimer::Update(void)
|
||||
|
||||
float updInCyclesScaled = updInCycles * ms_fTimeScale;
|
||||
|
||||
double upd = updInCyclesScaled / (double)_nCyclesPerMS;
|
||||
// We need that real frame time to fix transparent menu bug.
|
||||
#ifndef FIX_BUGS
|
||||
double
|
||||
#endif
|
||||
frameTime = updInCyclesScaled / (double)_nCyclesPerMS;
|
||||
|
||||
m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + upd;
|
||||
m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime;
|
||||
|
||||
if ( GetIsPaused() )
|
||||
ms_fTimeStep = 0.0f;
|
||||
else
|
||||
{
|
||||
m_snTimeInMilliseconds = m_snTimeInMilliseconds + upd;
|
||||
m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + upd;
|
||||
ms_fTimeStep = updInCyclesScaled / (double)_nCyclesPerMS / 20.0f;
|
||||
m_snTimeInMilliseconds = m_snTimeInMilliseconds + frameTime;
|
||||
m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + frameTime;
|
||||
ms_fTimeStep = frameTime / 1000.0f * 50.0f;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -109,19 +117,23 @@ void CTimer::Update(void)
|
||||
|
||||
uint32 updInMs = timer - oldPcTimer;
|
||||
|
||||
double upd = (double)updInMs * ms_fTimeScale;
|
||||
// We need that real frame time to fix transparent menu bug.
|
||||
#ifndef FIX_BUGS
|
||||
double
|
||||
#endif
|
||||
frameTime = (double)updInMs * ms_fTimeScale;
|
||||
|
||||
oldPcTimer = timer;
|
||||
|
||||
m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + upd;
|
||||
m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime;
|
||||
|
||||
if ( GetIsPaused() )
|
||||
ms_fTimeStep = 0.0f;
|
||||
else
|
||||
{
|
||||
m_snTimeInMilliseconds = m_snTimeInMilliseconds + upd;
|
||||
m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + upd;
|
||||
ms_fTimeStep = upd / 1000.0f * 50.0f;
|
||||
m_snTimeInMilliseconds = m_snTimeInMilliseconds + frameTime;
|
||||
m_snTimeInMillisecondsNonClipped = m_snTimeInMillisecondsNonClipped + frameTime;
|
||||
ms_fTimeStep = frameTime / 1000.0f * 50.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,7 +142,7 @@ void CTimer::Update(void)
|
||||
|
||||
ms_fTimeStepNonClipped = ms_fTimeStep;
|
||||
|
||||
if ( CRecordDataForGame::RecordingState != RECORDSTATE_2 )
|
||||
if ( !CRecordDataForGame::IsPlayingBack() )
|
||||
{
|
||||
ms_fTimeStep = min(3.0f, ms_fTimeStep);
|
||||
|
||||
@ -138,7 +150,7 @@ void CTimer::Update(void)
|
||||
m_snTimeInMilliseconds = m_snPreviousTimeInMilliseconds + 60;
|
||||
}
|
||||
|
||||
if ( CRecordDataForChase::Status == RECORDSTATE_1 )
|
||||
if ( CRecordDataForChase::IsRecording() )
|
||||
{
|
||||
ms_fTimeStep = 1.0f;
|
||||
m_snTimeInMilliseconds = m_snPreviousTimeInMilliseconds + 16;
|
||||
|
@ -21,6 +21,7 @@ public:
|
||||
static float GetTimeStepInMilliseconds() { return ms_fTimeStep / 50.0f * 1000.0f; }
|
||||
static const float &GetTimeStepNonClipped(void) { return ms_fTimeStepNonClipped; }
|
||||
static float GetTimeStepNonClippedInSeconds(void) { return ms_fTimeStepNonClipped / 50.0f; }
|
||||
static float GetTimeStepNonClippedInMilliseconds(void) { return ms_fTimeStepNonClipped / 50.0f * 1000.0f; }
|
||||
static void SetTimeStepNonClipped(float ts) { ms_fTimeStepNonClipped = ts; }
|
||||
static const uint32 &GetFrameCounter(void) { return m_FrameCounter; }
|
||||
static void SetFrameCounter(uint32 fc) { m_FrameCounter = fc; }
|
||||
@ -52,4 +53,11 @@ public:
|
||||
static void Stop(void);
|
||||
static void StartUserPause(void);
|
||||
static void EndUserPause(void);
|
||||
|
||||
friend bool GenericLoad(void);
|
||||
friend bool GenericSave(int file);
|
||||
};
|
||||
|
||||
#ifdef FIX_BUGS
|
||||
extern double frameTime;
|
||||
#endif
|
||||
|
@ -56,6 +56,8 @@ WRAPPER void CWorld::FindMissionEntitiesIntersectingCube(const CVector&, const C
|
||||
WRAPPER void CWorld::ClearCarsFromArea(float, float, float, float, float, float) { EAXJMP(0x4B50E0); }
|
||||
WRAPPER void CWorld::ClearPedsFromArea(float, float, float, float, float, float) { EAXJMP(0x4B52B0); }
|
||||
WRAPPER void CWorld::CallOffChaseForArea(float, float, float, float) { EAXJMP(0x4B5530); }
|
||||
WRAPPER void CWorld::TriggerExplosion(const CVector& a1, float a2, float a3, CEntity *a4, bool a5) { EAXJMP(0x4B1140); }
|
||||
WRAPPER void CWorld::SetPedsOnFire(float, float, float, float, CEntity*) { EAXJMP(0x4B3D30); }
|
||||
|
||||
void
|
||||
CWorld::Initialise()
|
||||
|
@ -132,6 +132,7 @@ public:
|
||||
static void SetAllCarsCanBeDamaged(bool);
|
||||
static void ExtinguishAllCarFiresInArea(CVector, float);
|
||||
static void SetCarsOnFire(float, float, float, float, CEntity*);
|
||||
static void SetPedsOnFire(float, float, float, float, CEntity*);
|
||||
|
||||
static void Initialise();
|
||||
static void AddParticles();
|
||||
@ -140,6 +141,7 @@ public:
|
||||
static void RepositionCertainDynamicObjects();
|
||||
static void RemoveStaticObjects();
|
||||
static void Process();
|
||||
static void TriggerExplosion(const CVector &, float, float, CEntity*, bool);
|
||||
};
|
||||
|
||||
extern CColPoint *gaTempSphereColPoints;
|
||||
|
@ -74,9 +74,11 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
|
||||
}
|
||||
|
||||
|
||||
#ifndef RWLIBS
|
||||
// little hack
|
||||
extern void **rwengine;
|
||||
#define RwEngineInstance (*rwengine)
|
||||
#endif
|
||||
|
||||
#include "skeleton.h"
|
||||
#include "Draw.h"
|
||||
@ -84,12 +86,14 @@ extern void **rwengine;
|
||||
#define DEFAULT_SCREEN_WIDTH (640)
|
||||
#define DEFAULT_SCREEN_HEIGHT (448)
|
||||
#define DEFAULT_ASPECT_RATIO (4.0f/3.0f)
|
||||
#define DEFAULT_VIEWWINDOW (0.7f)
|
||||
|
||||
// game uses maximumWidth/Height, but this probably won't work
|
||||
// with RW windowed mode
|
||||
#define SCREEN_WIDTH ((float)RsGlobal.width)
|
||||
#define SCREEN_HEIGHT ((float)RsGlobal.height)
|
||||
#define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio())
|
||||
#define SCREEN_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetFOV() * 0.5f)))
|
||||
|
||||
// This scales from PS2 pixel coordinates to the real resolution
|
||||
#define SCREEN_STRETCH_X(a) ((a) * (float) SCREEN_WIDTH / DEFAULT_SCREEN_WIDTH)
|
||||
@ -105,10 +109,8 @@ extern void **rwengine;
|
||||
|
||||
#ifdef ASPECT_RATIO_SCALE
|
||||
#define SCREEN_SCALE_AR(a) ((a) * DEFAULT_ASPECT_RATIO / SCREEN_ASPECT_RATIO)
|
||||
#define SCREEN_SCALE_AR2(a) ((a) / (DEFAULT_ASPECT_RATIO / SCREEN_ASPECT_RATIO))
|
||||
#else
|
||||
#define SCREEN_SCALE_AR(a) (a)
|
||||
#define SCREEN_SCALE_AR2(a) (a)
|
||||
#endif
|
||||
|
||||
#include "maths.h"
|
||||
|
@ -73,9 +73,13 @@ enum Config {
|
||||
NUMCORONAS = 56,
|
||||
NUMPOINTLIGHTS = 32,
|
||||
NUM3DMARKERS = 32,
|
||||
NUMBRIGHTLIGHTS = 32,
|
||||
NUMSHINYTEXTS = 32,
|
||||
NUMMONEYMESSAGES = 16,
|
||||
NUMPICKUPMESSAGES = 16,
|
||||
NUMBULLETTRACES = 16,
|
||||
NUMMBLURSTREAKS = 4,
|
||||
NUMSKIDMARKS = 32,
|
||||
|
||||
NUMONSCREENTIMERENTRIES = 1,
|
||||
NUMRADARBLIPS = 32,
|
||||
@ -83,6 +87,7 @@ enum Config {
|
||||
NUMSCRIPTEDPICKUPS = 16,
|
||||
NUMPICKUPS = NUMGENERALPICKUPS + NUMSCRIPTEDPICKUPS,
|
||||
NUMCOLLECTEDPICKUPS = 20,
|
||||
NUMPACMANPICKUPS = 256,
|
||||
NUMEVENTS = 64,
|
||||
|
||||
NUM_CARGENS = 160,
|
||||
@ -120,7 +125,11 @@ enum Config {
|
||||
NUM_AUDIO_REFLECTIONS = 5,
|
||||
NUM_SCRIPT_MAX_ENTITIES = 40,
|
||||
|
||||
NUM_GARAGE_STORED_CARS = 6
|
||||
NUM_GARAGE_STORED_CARS = 6,
|
||||
|
||||
NUM_CRANES = 8,
|
||||
|
||||
NUM_EXPLOSIONS = 48,
|
||||
};
|
||||
|
||||
// We'll use this once we're ready to become independent of the game
|
||||
@ -145,6 +154,7 @@ enum Config {
|
||||
//#define MASTER
|
||||
|
||||
#if defined GTA_PS2
|
||||
# define GTA_PS2_STUFF
|
||||
# define RANDOMSPLASH
|
||||
#elif defined GTA_PC
|
||||
# define GTA3_1_1_PATCH
|
||||
@ -183,13 +193,17 @@ enum Config {
|
||||
// Pad
|
||||
#define XINPUT
|
||||
#define KANGAROO_CHEAT
|
||||
#define REGISTER_START_BUTTON // currently only in menu sadly. resumes the game
|
||||
#define REGISTER_START_BUTTON
|
||||
|
||||
// Hud, frontend and radar
|
||||
#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
|
||||
#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
|
||||
#define PS2_SAVE_DIALOG // PS2 style save dialog with transparent black box
|
||||
// #define PS2_LIKE_MENU // An effort to recreate PS2 menu, cycling through tabs, different bg etc.
|
||||
#define MENU_MAP // VC-like menu map. Make sure you have new menu.txd
|
||||
#define SCROLLABLE_STATS_PAGE // only draggable by mouse atm
|
||||
#define TRIANGLE_BACK_BUTTON
|
||||
// #define CIRCLE_BACK_BUTTON
|
||||
|
||||
// Script
|
||||
#define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default
|
||||
|
2083
src/core/main.cpp
2083
src/core/main.cpp
File diff suppressed because it is too large
Load Diff
@ -21,10 +21,15 @@
|
||||
#include "Particle.h"
|
||||
#include "Console.h"
|
||||
#include "Debug.h"
|
||||
#include "Hud.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
#ifndef RWLIBS
|
||||
void **rwengine = *(void***)0x5A10E1;
|
||||
#else
|
||||
extern "C" int vsprintf(char* const _Buffer, char const* const _Format, va_list _ArgList);
|
||||
#endif
|
||||
|
||||
DebugMenuAPI gDebugMenuAPI;
|
||||
|
||||
@ -144,19 +149,6 @@ SpawnCar(int id)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
LetThemFollowYou(void) {
|
||||
CPed *player = (CPed*) FindPlayerPed();
|
||||
for (int i = 0; i < player->m_numNearPeds; i++) {
|
||||
CPed *nearPed = player->m_nearPeds[i];
|
||||
if (nearPed && !nearPed->IsPlayer()) {
|
||||
nearPed->SetObjective(OBJECTIVE_FOLLOW_PED_IN_FORMATION, (void*)player);
|
||||
nearPed->m_pedFormation = (eFormation)(1 + (rand() & 7));
|
||||
nearPed->bScriptObjectiveCompleted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
FixCar(void)
|
||||
{
|
||||
@ -337,7 +329,9 @@ DebugMenuPopulate(void)
|
||||
DebugMenuAddCmd("Spawn", "Spawn Dodo", [](){ SpawnCar(MI_DODO); });
|
||||
DebugMenuAddCmd("Spawn", "Spawn Rhino", [](){ SpawnCar(MI_RHINO); });
|
||||
DebugMenuAddCmd("Spawn", "Spawn Firetruck", [](){ SpawnCar(MI_FIRETRUCK); });
|
||||
DebugMenuAddCmd("Spawn", "Spawn Predator", [](){ SpawnCar(MI_PREDATOR); });
|
||||
|
||||
DebugMenuAddVarBool8("Debug", "Draw hud", (int8*)&CHud::m_Wants_To_Draw_Hud, nil);
|
||||
DebugMenuAddVar("Debug", "Engine Status", &engineStatus, nil, 1, 0, 226, nil);
|
||||
DebugMenuAddCmd("Debug", "Set Engine Status", SetEngineStatus);
|
||||
DebugMenuAddCmd("Debug", "Fix Car", FixCar);
|
||||
@ -350,6 +344,9 @@ DebugMenuPopulate(void)
|
||||
DebugMenuAddCmd("Debug", "Catalina Fly Away", CHeli::MakeCatalinaHeliFlyAway);
|
||||
DebugMenuAddVarBool8("Debug", "Script Heli On", (int8*)0x95CD43, nil);
|
||||
|
||||
DebugMenuAddVarBool8("Debug", "Show Ped Paths", (int8*)&gbShowPedPaths, nil);
|
||||
DebugMenuAddVarBool8("Debug", "Show Car Paths", (int8*)&gbShowCarPaths, nil);
|
||||
DebugMenuAddVarBool8("Debug", "Show Car Path Links", (int8*)&gbShowCarPathsLinks, nil);
|
||||
DebugMenuAddVarBool8("Debug", "Show Ped Road Groups", (int8*)&gbShowPedRoadGroups, nil);
|
||||
DebugMenuAddVarBool8("Debug", "Show Car Road Groups", (int8*)&gbShowCarRoadGroups, nil);
|
||||
DebugMenuAddVarBool8("Debug", "Show Collision Lines", (int8*)&gbShowCollisionLines, nil);
|
||||
@ -359,8 +356,6 @@ DebugMenuPopulate(void)
|
||||
DebugMenuAddVarBool8("Debug", "Don't render Peds", (int8*)&gbDontRenderPeds, nil);
|
||||
DebugMenuAddVarBool8("Debug", "Don't render Vehicles", (int8*)&gbDontRenderVehicles, nil);
|
||||
DebugMenuAddVarBool8("Debug", "Don't render Objects", (int8*)&gbDontRenderObjects, nil);
|
||||
|
||||
DebugMenuAddCmd("Debug", "Make peds follow you in formation", LetThemFollowYou);
|
||||
#ifdef TOGGLEABLE_BETA_FEATURES
|
||||
DebugMenuAddVarBool8("Debug", "Toggle banned particles", (int8*)&CParticle::bEnableBannedParticles, nil);
|
||||
DebugMenuAddVarBool8("Debug", "Toggle popping heads on headshot", (int8*)&CPed::bPopHeadsOnHeadshot, nil);
|
||||
@ -458,7 +453,7 @@ void re3_debug(const char *format, ...)
|
||||
vsprintf_s(re3_buff, re3_buffsize, format, va);
|
||||
va_end(va);
|
||||
|
||||
// printf("%s", re3_buff);
|
||||
printf("%s", re3_buff);
|
||||
CDebug::DebugAddText(re3_buff);
|
||||
}
|
||||
|
||||
|
@ -62,11 +62,11 @@ CEntity::CEntity(void)
|
||||
bRemoveFromWorld = false;
|
||||
bHasHitWall = false;
|
||||
bImBeingRendered = false;
|
||||
m_flagD8 = false;
|
||||
bTouchingWater = false;
|
||||
bIsSubway = false;
|
||||
bDrawLast = false;
|
||||
bNoBrightHeadLights = false;
|
||||
m_flagD80 = false;
|
||||
bDoNotRender = false;
|
||||
|
||||
bDistanceFade = false;
|
||||
m_flagE2 = false;
|
||||
@ -275,9 +275,9 @@ CEntity::CreateRwObject(void)
|
||||
if(IsBuilding())
|
||||
gBuildings++;
|
||||
if(RwObjectGetType(m_rwObject) == rpATOMIC)
|
||||
m_matrix.AttachRW(RwFrameGetMatrix(RpAtomicGetFrame(m_rwObject)), false);
|
||||
m_matrix.AttachRW(RwFrameGetMatrix(RpAtomicGetFrame((RpAtomic*)m_rwObject)), false);
|
||||
else if(RwObjectGetType(m_rwObject) == rpCLUMP)
|
||||
m_matrix.AttachRW(RwFrameGetMatrix(RpClumpGetFrame(m_rwObject)), false);
|
||||
m_matrix.AttachRW(RwFrameGetMatrix(RpClumpGetFrame((RpClump*)m_rwObject)), false);
|
||||
mi->AddRef();
|
||||
}
|
||||
}
|
||||
@ -290,7 +290,7 @@ CEntity::DeleteRwObject(void)
|
||||
m_matrix.Detach();
|
||||
if(m_rwObject){
|
||||
if(RwObjectGetType(m_rwObject) == rpATOMIC){
|
||||
f = RpAtomicGetFrame(m_rwObject);
|
||||
f = RpAtomicGetFrame((RpAtomic*)m_rwObject);
|
||||
RpAtomicDestroy((RpAtomic*)m_rwObject);
|
||||
RwFrameDestroy(f);
|
||||
}else if(RwObjectGetType(m_rwObject) == rpCLUMP)
|
||||
@ -307,9 +307,9 @@ CEntity::UpdateRwFrame(void)
|
||||
{
|
||||
if(m_rwObject){
|
||||
if(RwObjectGetType(m_rwObject) == rpATOMIC)
|
||||
RwFrameUpdateObjects(RpAtomicGetFrame(m_rwObject));
|
||||
RwFrameUpdateObjects(RpAtomicGetFrame((RpAtomic*)m_rwObject));
|
||||
else if(RwObjectGetType(m_rwObject) == rpCLUMP)
|
||||
RwFrameUpdateObjects(RpClumpGetFrame(m_rwObject));
|
||||
RwFrameUpdateObjects(RpClumpGetFrame((RpClump*)m_rwObject));
|
||||
}
|
||||
}
|
||||
|
||||
@ -394,13 +394,13 @@ CEntity::PreRender(void)
|
||||
}else if(GetModelIndex() == MI_GRENADE){
|
||||
CMotionBlurStreaks::RegisterStreak((uintptr)this,
|
||||
100, 100, 100,
|
||||
TheCamera.GetPosition() - 0.07f*TheCamera.GetRight(),
|
||||
TheCamera.GetPosition() + 0.07f*TheCamera.GetRight());
|
||||
GetPosition() - 0.07f*TheCamera.GetRight(),
|
||||
GetPosition() + 0.07f*TheCamera.GetRight());
|
||||
}else if(GetModelIndex() == MI_MOLOTOV){
|
||||
CMotionBlurStreaks::RegisterStreak((uintptr)this,
|
||||
0, 100, 0,
|
||||
TheCamera.GetPosition() - 0.07f*TheCamera.GetRight(),
|
||||
TheCamera.GetPosition() + 0.07f*TheCamera.GetRight());
|
||||
GetPosition() - 0.07f*TheCamera.GetRight(),
|
||||
GetPosition() + 0.07f*TheCamera.GetRight());
|
||||
}
|
||||
}else if(GetModelIndex() == MI_MISSILE){
|
||||
CVector pos = GetPosition();
|
||||
@ -482,9 +482,9 @@ CEntity::AttachToRwObject(RwObject *obj)
|
||||
m_rwObject = obj;
|
||||
if(m_rwObject){
|
||||
if(RwObjectGetType(m_rwObject) == rpATOMIC)
|
||||
m_matrix.Attach(RwFrameGetMatrix(RpAtomicGetFrame(m_rwObject)), false);
|
||||
m_matrix.Attach(RwFrameGetMatrix(RpAtomicGetFrame((RpAtomic*)m_rwObject)), false);
|
||||
else if(RwObjectGetType(m_rwObject) == rpCLUMP)
|
||||
m_matrix.Attach(RwFrameGetMatrix(RpClumpGetFrame(m_rwObject)), false);
|
||||
m_matrix.Attach(RwFrameGetMatrix(RpClumpGetFrame((RpClump*)m_rwObject)), false);
|
||||
CModelInfo::GetModelInfo(m_modelIndex)->AddRef();
|
||||
}
|
||||
}
|
||||
|
@ -73,11 +73,11 @@ public:
|
||||
uint32 bRemoveFromWorld : 1;
|
||||
uint32 bHasHitWall : 1;
|
||||
uint32 bImBeingRendered : 1;
|
||||
uint32 m_flagD8 : 1; // used by cBuoyancy::ProcessBuoyancy
|
||||
uint32 bTouchingWater : 1; // used by cBuoyancy::ProcessBuoyancy
|
||||
uint32 bIsSubway : 1; // set when subway, but maybe different meaning?
|
||||
uint32 bDrawLast : 1;
|
||||
uint32 bNoBrightHeadLights : 1;
|
||||
uint32 m_flagD80 : 1; // CObject visibility?
|
||||
uint32 bDoNotRender : 1;
|
||||
|
||||
// flagsE
|
||||
uint32 bDistanceFade : 1;
|
||||
@ -90,6 +90,7 @@ public:
|
||||
CReference *m_pFirstReference;
|
||||
|
||||
CColModel *GetColModel(void) { return CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(); }
|
||||
uint32* GetAddressOfEntityProperties() { /* AWFUL */ return (uint32*)((char*)&m_rwObject + sizeof(m_rwObject)); }
|
||||
|
||||
CEntity(void);
|
||||
~CEntity(void);
|
||||
|
@ -21,7 +21,7 @@ CPhysical::CPhysical(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
fForceMultiplier = 1.0f;
|
||||
m_fForceMultiplier = 1.0f;
|
||||
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
|
||||
m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
|
||||
m_vecMoveFriction = CVector(0.0f, 0.0f, 0.0f);
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
CVector m_vecTurnSpeedAvg;
|
||||
float m_fMass;
|
||||
float m_fTurnMass; // moment of inertia
|
||||
float fForceMultiplier;
|
||||
float m_fForceMultiplier;
|
||||
float m_fAirResistance;
|
||||
float m_fElasticity;
|
||||
float m_fBuoyancy;
|
||||
|
@ -243,6 +243,17 @@ public:
|
||||
m_matrix.pos.y = 0.0f;
|
||||
m_matrix.pos.z = 0.0f;
|
||||
}
|
||||
void ResetOrientation(void) {
|
||||
m_matrix.right.x = 1.0f;
|
||||
m_matrix.right.y = 0.0f;
|
||||
m_matrix.right.z = 0.0f;
|
||||
m_matrix.up.x = 0.0f;
|
||||
m_matrix.up.y = 1.0f;
|
||||
m_matrix.up.z = 0.0f;
|
||||
m_matrix.at.x = 0.0f;
|
||||
m_matrix.at.y = 0.0f;
|
||||
m_matrix.at.z = 1.0f;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
return x == right.x && y == right.y && z == right.z;
|
||||
}
|
||||
|
||||
bool IsZero(void) { return x == 0.0f && y == 0.0f && z == 0.0f; }
|
||||
bool IsZero(void) const { return x == 0.0f && y == 0.0f && z == 0.0f; }
|
||||
};
|
||||
|
||||
inline CVector operator+(const CVector &left, const CVector &right)
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include "Collision.h"
|
||||
|
||||
#define MAX_MODEL_NAME (24)
|
||||
|
||||
enum ModeInfoType : uint8
|
||||
{
|
||||
MITYPE_NA = 0,
|
||||
@ -21,7 +23,7 @@ class CBaseModelInfo
|
||||
{
|
||||
protected:
|
||||
// TODO?: make more things protected
|
||||
char m_name[24];
|
||||
char m_name[MAX_MODEL_NAME];
|
||||
CColModel *m_colModel;
|
||||
C2dEffect *m_twodEffects;
|
||||
int16 m_objectId;
|
||||
|
@ -234,12 +234,6 @@ CModelInfo::RemoveColModelsFromOtherLevels(eLevelName level)
|
||||
}
|
||||
}
|
||||
|
||||
CStore<CInstance, MLOINSTANCESIZE>&
|
||||
CModelInfo::GetMloInstanceStore()
|
||||
{
|
||||
return CModelInfo::ms_mloInstanceStore;
|
||||
}
|
||||
|
||||
void
|
||||
CModelInfo::ConstructMloClumps()
|
||||
{
|
||||
@ -247,6 +241,17 @@ CModelInfo::ConstructMloClumps()
|
||||
ms_mloModelStore.store[i].ConstructClump();
|
||||
}
|
||||
|
||||
void
|
||||
CModelInfo::ReInit2dEffects()
|
||||
{
|
||||
ms_2dEffectStore.clear();
|
||||
|
||||
for (int i = 0; i < MODELINFOSIZE; i++) {
|
||||
if (ms_modelInfoPtrs[i])
|
||||
ms_modelInfoPtrs[i]->Init2dEffects();
|
||||
}
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x50B310, CModelInfo::Initialise, PATCH_JUMP);
|
||||
InjectHook(0x50B5B0, CModelInfo::ShutDown, PATCH_JUMP);
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
static CVehicleModelInfo *AddVehicleModel(int id);
|
||||
|
||||
static CStore<C2dEffect, TWODFXSIZE> &Get2dEffectStore(void) { return ms_2dEffectStore; }
|
||||
static CStore<CInstance, MLOINSTANCESIZE> &GetMloInstanceStore();
|
||||
static CStore<CInstance, MLOINSTANCESIZE> &GetMloInstanceStore(void) { return ms_mloInstanceStore; }
|
||||
|
||||
static CBaseModelInfo *GetModelInfo(const char *name, int *id);
|
||||
static CBaseModelInfo *GetModelInfo(int id){
|
||||
@ -47,4 +47,5 @@ public:
|
||||
static bool IsBikeModel(int32 id);
|
||||
static void RemoveColModelsFromOtherLevels(eLevelName level);
|
||||
static void ConstructMloClumps();
|
||||
static void ReInit2dEffects();
|
||||
};
|
||||
|
@ -216,7 +216,7 @@ CPedModelInfo::AnimatePedColModel(CColModel* colmodel, RwFrame* frame)
|
||||
RwMatrixCopy(mat, RwFrameGetMatrix(f));
|
||||
|
||||
for (f = RwFrameGetParent(f); f; f = RwFrameGetParent(f)) {
|
||||
RwMatrixTransform(mat, &f->modelling, rwCOMBINEPOSTCONCAT);
|
||||
RwMatrixTransform(mat, RwFrameGetMatrix(f), rwCOMBINEPOSTCONCAT);
|
||||
if (RwFrameGetParent(f) == frame)
|
||||
break;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "World.h"
|
||||
#include "Vehicle.h"
|
||||
#include "Automobile.h"
|
||||
#include "Boat.h"
|
||||
#include "Train.h"
|
||||
#include "Plane.h"
|
||||
#include "Heli.h"
|
||||
@ -80,9 +81,9 @@ RwObjectNameIdAssocation carIds[] = {
|
||||
};
|
||||
|
||||
RwObjectNameIdAssocation boatIds[] = {
|
||||
{ "boat_moving_hi", 1, VEHICLE_FLAG_COLLAPSE },
|
||||
{ "boat_rudder_hi", 3, VEHICLE_FLAG_COLLAPSE },
|
||||
{ "windscreen", 2, VEHICLE_FLAG_WINDSCREEN | VEHICLE_FLAG_COLLAPSE },
|
||||
{ "boat_moving_hi", BOAT_MOVING, VEHICLE_FLAG_COLLAPSE },
|
||||
{ "boat_rudder_hi", BOAT_RUDDER, VEHICLE_FLAG_COLLAPSE },
|
||||
{ "windscreen", BOAT_WINDSCREEN, VEHICLE_FLAG_WINDSCREEN | VEHICLE_FLAG_COLLAPSE },
|
||||
{ "ped_frontseat", BOAT_POS_FRONTSEAT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
|
||||
{ nil, 0, 0 }
|
||||
};
|
||||
@ -707,7 +708,7 @@ RpMaterial*
|
||||
CVehicleModelInfo::GetEditableMaterialListCB(RpMaterial *material, void *data)
|
||||
{
|
||||
static RwRGBA white = { 255, 255, 255, 255 };
|
||||
RwRGBA *col;
|
||||
const RwRGBA *col;
|
||||
editableMatCBData *cbdata;
|
||||
|
||||
cbdata = (editableMatCBData*)data;
|
||||
@ -758,8 +759,8 @@ CVehicleModelInfo::SetVehicleColour(uint8 c1, uint8 c2)
|
||||
col = ms_vehicleColourTable[c1];
|
||||
coltex = ms_colourTextureTable[c1];
|
||||
for(matp = m_materials1; *matp; matp++){
|
||||
if(RpMaterialGetTexture(*matp) && RpMaterialGetTexture(*matp)->name[0] != '@'){
|
||||
colp = RpMaterialGetColor(*matp);
|
||||
if(RpMaterialGetTexture(*matp) && RwTextureGetName(RpMaterialGetTexture(*matp))[0] != '@'){
|
||||
colp = (RwRGBA*)RpMaterialGetColor(*matp); // get rid of const
|
||||
colp->red = col.red;
|
||||
colp->green = col.green;
|
||||
colp->blue = col.blue;
|
||||
@ -773,8 +774,8 @@ CVehicleModelInfo::SetVehicleColour(uint8 c1, uint8 c2)
|
||||
col = ms_vehicleColourTable[c2];
|
||||
coltex = ms_colourTextureTable[c2];
|
||||
for(matp = m_materials2; *matp; matp++){
|
||||
if(RpMaterialGetTexture(*matp) && RpMaterialGetTexture(*matp)->name[0] != '@'){
|
||||
colp = RpMaterialGetColor(*matp);
|
||||
if(RpMaterialGetTexture(*matp) && RwTextureGetName(RpMaterialGetTexture(*matp))[0] != '@'){
|
||||
colp = (RwRGBA*)RpMaterialGetColor(*matp); // get rid of const
|
||||
colp->red = col.red;
|
||||
colp->green = col.green;
|
||||
colp->blue = col.blue;
|
||||
@ -861,7 +862,7 @@ CreateCarColourTexture(uint8 r, uint8 g, uint8 b)
|
||||
RwImageDestroy(img);
|
||||
RwFree(pixels);
|
||||
tex = RwTextureCreate(ras);
|
||||
tex->name[0] = '@';
|
||||
RwTextureGetName(tex)[0] = '@';
|
||||
return tex;
|
||||
}
|
||||
|
||||
@ -1058,7 +1059,7 @@ CVehicleModelInfo::LoadEnvironmentMaps(void)
|
||||
}
|
||||
if(gpWhiteTexture == nil){
|
||||
gpWhiteTexture = RwTextureRead("white", nil);
|
||||
gpWhiteTexture->name[0] = '@';
|
||||
RwTextureGetName(gpWhiteTexture)[0] = '@';
|
||||
RwTextureSetFilterMode(gpWhiteTexture, rwFILTERLINEAR);
|
||||
}
|
||||
CTxdStore::PopCurrentTxd();
|
||||
|
@ -20,7 +20,7 @@ CCutsceneHead::CCutsceneHead(CObject *obj)
|
||||
m_pHeadNode = RpAnimBlendClumpFindFrame((RpClump*)obj->m_rwObject, "Shead")->frame;
|
||||
atm = (RpAtomic*)GetFirstObject(m_pHeadNode);
|
||||
if(atm){
|
||||
assert(RwObjectGetType(atm) == rpATOMIC);
|
||||
assert(RwObjectGetType((RwObject*)atm) == rpATOMIC);
|
||||
RpAtomicSetFlags(atm, RpAtomicGetFlags(atm) & ~rpATOMICRENDER);
|
||||
}
|
||||
}
|
||||
|
@ -6,12 +6,11 @@
|
||||
#include "Radar.h"
|
||||
#include "Object.h"
|
||||
#include "DummyObject.h"
|
||||
|
||||
WRAPPER void CObject::ObjectDamage(float amount) { EAXJMP(0x4BB240); }
|
||||
WRAPPER void CObject::DeleteAllTempObjectInArea(CVector, float) { EAXJMP(0x4BBED0); }
|
||||
WRAPPER void CObject::Init(void) { EAXJMP(0x4BAEC0); }
|
||||
WRAPPER void CObject::ProcessControl(void) { EAXJMP(0x4BB040); }
|
||||
WRAPPER void CObject::Teleport(CVector) { EAXJMP(0x4BBDA0); }
|
||||
#include "Particle.h"
|
||||
#include "General.h"
|
||||
#include "ObjectData.h"
|
||||
#include "World.h"
|
||||
#include "Floater.h"
|
||||
|
||||
int16 &CObject::nNoTempObjects = *(int16*)0x95CCA2;
|
||||
int16 &CObject::nBodyCastHealth = *(int16*)0x5F7D4C; // 1000
|
||||
@ -28,13 +27,13 @@ CObject::CObject(void)
|
||||
m_nCollisionDamageEffect = 0;
|
||||
m_nSpecialCollisionResponseCases = COLLRESPONSE_NONE;
|
||||
m_bCameraToAvoidThisObject = false;
|
||||
ObjectCreatedBy = 0;
|
||||
ObjectCreatedBy = UNKNOWN_OBJECT;
|
||||
m_nEndOfLifeTime = 0;
|
||||
// m_nRefModelIndex = -1; // duplicate
|
||||
// bUseVehicleColours = false; // duplicate
|
||||
m_colour2 = 0;
|
||||
m_colour1 = m_colour2;
|
||||
field_172 = 0;
|
||||
m_nBonusValue = 0;
|
||||
bIsPickup = false;
|
||||
m_obj_flag2 = false;
|
||||
bOutOfStock = false;
|
||||
@ -82,10 +81,46 @@ CObject::~CObject(void)
|
||||
nNoTempObjects--;
|
||||
}
|
||||
|
||||
void
|
||||
CObject::ProcessControl(void)
|
||||
{
|
||||
CVector point, impulse;
|
||||
if (m_nCollisionDamageEffect)
|
||||
ObjectDamage(m_fDamageImpulse);
|
||||
CPhysical::ProcessControl();
|
||||
if (mod_Buoyancy.ProcessBuoyancy(this, m_fBuoyancy, &point, &impulse)) {
|
||||
bIsInWater = true;
|
||||
bIsStatic = false;
|
||||
ApplyMoveForce(impulse);
|
||||
ApplyTurnForce(impulse, point);
|
||||
float fTimeStep = Pow(0.97f, CTimer::GetTimeStep());
|
||||
m_vecMoveSpeed *= fTimeStep;
|
||||
m_vecTurnSpeed *= fTimeStep;
|
||||
}
|
||||
if ((m_modelIndex == MI_EXPLODINGBARREL || m_modelIndex == MI_PETROLPUMP) && bHasBeenDamaged && bIsVisible
|
||||
&& (CGeneral::GetRandomNumber() & 0x1F) == 10) {
|
||||
bExplosionProof = true;
|
||||
bIsVisible = false;
|
||||
bUsesCollision = false;
|
||||
bAffectedByGravity = false;
|
||||
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CObject::Teleport(CVector vecPos)
|
||||
{
|
||||
CWorld::Remove(this);
|
||||
m_matrix.GetPosition() = vecPos;
|
||||
m_matrix.UpdateRW();
|
||||
UpdateRwFrame();
|
||||
CWorld::Add(this);
|
||||
}
|
||||
|
||||
void
|
||||
CObject::Render(void)
|
||||
{
|
||||
if(m_flagD80)
|
||||
if(bDoNotRender)
|
||||
return;
|
||||
|
||||
if(m_nRefModelIndex != -1 && ObjectCreatedBy == TEMP_OBJECT && bUseVehicleColours){
|
||||
@ -117,6 +152,152 @@ CObject::RemoveLighting(bool reset)
|
||||
WorldReplaceScorchedLightsWithNormal(Scene.world);
|
||||
}
|
||||
|
||||
void
|
||||
CObject::ObjectDamage(float amount)
|
||||
{
|
||||
if (!m_nCollisionDamageEffect || !bUsesCollision)
|
||||
return;
|
||||
static int8 nFrameGen = 0;
|
||||
bool bBodyCastDamageEffect = false;
|
||||
if (m_modelIndex == MI_BODYCAST){
|
||||
if (amount > 50.0f)
|
||||
nBodyCastHealth = (int16)(nBodyCastHealth - 0.5f * amount);
|
||||
if (nBodyCastHealth < 0)
|
||||
nBodyCastHealth = 0;
|
||||
if (nBodyCastHealth < 200)
|
||||
bBodyCastDamageEffect = true;
|
||||
amount = 0.0f;
|
||||
}
|
||||
if ((amount * m_fCollisionDamageMultiplier > 150.0f || bBodyCastDamageEffect) && m_nCollisionDamageEffect) {
|
||||
const CVector& vecPos = m_matrix.GetPosition();
|
||||
const float fDirectionZ = 0.0002f * amount;
|
||||
switch (m_nCollisionDamageEffect)
|
||||
{
|
||||
case COLDAMAGE_EFFECT_CHANGE_MODEL:
|
||||
bRenderDamaged = true;
|
||||
break;
|
||||
case COLDAMAGE_EFFECT_SPLIT_MODEL:
|
||||
break;
|
||||
case COLDAMAGE_EFFECT_SMASH_COMPLETELY:
|
||||
bIsVisible = false;
|
||||
bUsesCollision = false;
|
||||
bIsStatic = true;
|
||||
bExplosionProof = true;
|
||||
SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
||||
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
||||
break;
|
||||
case COLDAMAGE_EFFECT_CHANGE_THEN_SMASH:
|
||||
if (!bRenderDamaged) {
|
||||
bRenderDamaged = true;
|
||||
}
|
||||
else {
|
||||
bIsVisible = false;
|
||||
bUsesCollision = false;
|
||||
bIsStatic = true;
|
||||
bExplosionProof = true;
|
||||
SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
||||
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
break;
|
||||
case COLDAMAGE_EFFECT_SMASH_CARDBOX_COMPLETELY: {
|
||||
bIsVisible = false;
|
||||
bUsesCollision = false;
|
||||
bIsStatic = true;
|
||||
bExplosionProof = true;
|
||||
SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
||||
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
||||
const RwRGBA color = { 96, 48, 0, 255 };
|
||||
for (int32 i = 0; i < 25; i++) {
|
||||
CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
|
||||
CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
|
||||
CGeneral::GetRandomNumberInRange(0.1f, 0.15f) + fDirectionZ);
|
||||
++nFrameGen;
|
||||
int32 currentFrame = nFrameGen & 3;
|
||||
float fRandom = CGeneral::GetRandomNumberInRange(0.01f, 1.0f);
|
||||
RwRGBA randomColor = { color.red * fRandom, color.green * fRandom , color.blue, color.alpha };
|
||||
float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
|
||||
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
|
||||
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0);
|
||||
}
|
||||
PlayOneShotScriptObject(_SCRSOUND_CARDBOARD_BOX_SMASH, vecPos);
|
||||
break;
|
||||
}
|
||||
case COLDAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY: {
|
||||
bIsVisible = false;
|
||||
bUsesCollision = false;
|
||||
bIsStatic = true;
|
||||
bExplosionProof = true;
|
||||
SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
||||
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
||||
const RwRGBA color = { 128, 128, 128, 255 };
|
||||
for (int32 i = 0; i < 45; i++) {
|
||||
CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
|
||||
CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
|
||||
CGeneral::GetRandomNumberInRange(0.1f, 0.15f) + fDirectionZ);
|
||||
++nFrameGen;
|
||||
int32 currentFrame = nFrameGen & 3;
|
||||
float fRandom = CGeneral::GetRandomNumberInRange(0.5f, 0.5f);
|
||||
RwRGBA randomColor = { color.red * fRandom, color.green * fRandom , color.blue * fRandom, color.alpha };
|
||||
float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
|
||||
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
|
||||
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0);
|
||||
}
|
||||
PlayOneShotScriptObject(_SCRSOUND_WOODEN_BOX_SMASH, vecPos);
|
||||
break;
|
||||
}
|
||||
case COLDAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY: {
|
||||
bIsVisible = false;
|
||||
bUsesCollision = false;
|
||||
bIsStatic = true;
|
||||
bExplosionProof = true;
|
||||
SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
||||
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
||||
const RwRGBA color1 = { 200, 0, 0, 255 };
|
||||
const RwRGBA color2 = { 200, 200, 200, 255 };
|
||||
for (int32 i = 0; i < 10; i++) {
|
||||
CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
|
||||
CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
|
||||
CGeneral::GetRandomNumberInRange(0.1f, 0.15f) + fDirectionZ);
|
||||
++nFrameGen;
|
||||
int32 currentFrame = nFrameGen & 3;
|
||||
RwRGBA color = color2;
|
||||
if (nFrameGen & 1)
|
||||
color = color1;
|
||||
float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
|
||||
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
|
||||
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, color, nRotationSpeed, 0, currentFrame, 0);
|
||||
}
|
||||
PlayOneShotScriptObject(_SCRSOUND_TYRE_BUMP, vecPos);
|
||||
break;
|
||||
}
|
||||
case COLDAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY: {
|
||||
bIsVisible = false;
|
||||
bUsesCollision = false;
|
||||
bIsStatic = true;
|
||||
bExplosionProof = true;
|
||||
SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
||||
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
||||
const RwRGBA color1 = { 200, 0, 0, 255 };
|
||||
const RwRGBA color2 = { 200, 200, 200, 255 };
|
||||
for (int32 i = 0; i < 32; i++) {
|
||||
CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
|
||||
CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
|
||||
CGeneral::GetRandomNumberInRange(0.1f, 0.15f) + fDirectionZ);
|
||||
++nFrameGen;
|
||||
int32 currentFrame = nFrameGen & 3;
|
||||
RwRGBA color = color2;
|
||||
if (nFrameGen & 1)
|
||||
color = color1;
|
||||
float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
|
||||
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
|
||||
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, color, nRotationSpeed, 0, currentFrame, 0);
|
||||
}
|
||||
PlayOneShotScriptObject(_SCRSOUND_COL_CAR, vecPos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CObject::RefModelInfo(int32 modelId)
|
||||
@ -125,6 +306,39 @@ CObject::RefModelInfo(int32 modelId)
|
||||
CModelInfo::GetModelInfo(modelId)->AddRef();
|
||||
}
|
||||
|
||||
void
|
||||
CObject::Init(void)
|
||||
{
|
||||
m_type = ENTITY_TYPE_OBJECT;;
|
||||
CObjectData::SetObjectData(m_modelIndex, *this);
|
||||
m_nEndOfLifeTime = 0;
|
||||
ObjectCreatedBy = GAME_OBJECT;
|
||||
bIsStatic = true;
|
||||
bIsPickup = false;
|
||||
m_obj_flag2 = false;
|
||||
bOutOfStock = false;
|
||||
bGlassCracked = false;
|
||||
bGlassBroken = false;
|
||||
bHasBeenDamaged = false;
|
||||
bUseVehicleColours = false;
|
||||
m_nRefModelIndex = -1;
|
||||
m_colour1 = 0;
|
||||
m_colour2 = 0;
|
||||
m_nBonusValue = 0;
|
||||
m_pCollidingEntity = nil;
|
||||
CColPoint point;
|
||||
CEntity* outEntity = nil;
|
||||
const CVector& vecPos = m_matrix.GetPosition();
|
||||
if (CWorld::ProcessVerticalLine(vecPos, vecPos.z - 10.0f, point, outEntity, true, false, false, false, false, false, nil))
|
||||
m_pCurSurface = outEntity;
|
||||
else
|
||||
m_pCurSurface = nil;
|
||||
if (m_modelIndex == MI_BODYCAST)
|
||||
nBodyCastHealth = 1000;
|
||||
else if (m_modelIndex == MI_BUOY)
|
||||
bTouchingWater = true;
|
||||
}
|
||||
|
||||
bool
|
||||
CObject::CanBeDeleted(void)
|
||||
{
|
||||
@ -142,6 +356,45 @@ CObject::CanBeDeleted(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CObject::DeleteAllMissionObjects()
|
||||
{
|
||||
CObjectPool* objectPool = CPools::GetObjectPool();
|
||||
for (int32 i = 0; i < objectPool->GetSize(); i++) {
|
||||
CObject* pObject = objectPool->GetSlot(i);
|
||||
if (pObject && pObject->ObjectCreatedBy == MISSION_OBJECT) {
|
||||
CWorld::Remove(pObject);
|
||||
delete pObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CObject::DeleteAllTempObjects()
|
||||
{
|
||||
CObjectPool* objectPool = CPools::GetObjectPool();
|
||||
for (int32 i = 0; i < objectPool->GetSize(); i++) {
|
||||
CObject* pObject = objectPool->GetSlot(i);
|
||||
if (pObject && pObject->ObjectCreatedBy == TEMP_OBJECT) {
|
||||
CWorld::Remove(pObject);
|
||||
delete pObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CObject::DeleteAllTempObjectInArea(CVector point, float fRadius)
|
||||
{
|
||||
CObjectPool *objectPool = CPools::GetObjectPool();
|
||||
for (int32 i = 0; i < objectPool->GetSize(); i++) {
|
||||
CObject *pObject = objectPool->GetSlot(i);
|
||||
if (pObject && pObject->ObjectCreatedBy == TEMP_OBJECT && fRadius * fRadius > pObject->GetPosition().MagnitudeSqr()) {
|
||||
CWorld::Remove(pObject);
|
||||
delete pObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include <new>
|
||||
|
||||
class CObject_ : public CObject
|
||||
@ -152,6 +405,9 @@ public:
|
||||
CObject *ctor(CDummyObject *dummy) { return ::new (this) CObject(dummy); }
|
||||
void dtor(void) { CObject::~CObject(); }
|
||||
void Render_(void) { CObject::Render(); }
|
||||
void ProcessControl_(void) { CObject::ProcessControl(); }
|
||||
bool SetupLighting_(void) { return CObject::SetupLighting(); }
|
||||
void RemoveLighting_(bool reset) { CObject::RemoveLighting(reset); }
|
||||
};
|
||||
|
||||
STARTPATCHES
|
||||
@ -159,5 +415,16 @@ STARTPATCHES
|
||||
InjectHook(0x4BACE0, (CObject* (CObject::*)(int32, bool)) &CObject_::ctor, PATCH_JUMP);
|
||||
InjectHook(0x4BAD50, (CObject* (CObject::*)(CDummyObject*)) &CObject_::ctor, PATCH_JUMP);
|
||||
InjectHook(0x4BAE00, &CObject_::dtor, PATCH_JUMP);
|
||||
InjectHook(0x4BB040, &CObject_::ProcessControl_, PATCH_JUMP);
|
||||
InjectHook(0x4BBDA0, &CObject::Teleport, PATCH_JUMP);
|
||||
InjectHook(0x4BB1E0, &CObject_::Render_, PATCH_JUMP);
|
||||
InjectHook(0x4A7C90, &CObject_::SetupLighting_, PATCH_JUMP);
|
||||
InjectHook(0x4A7CD0, &CObject_::RemoveLighting_, PATCH_JUMP);
|
||||
InjectHook(0x4BB240, &CObject::ObjectDamage, PATCH_JUMP);
|
||||
InjectHook(0x4BBD80, &CObject::RefModelInfo, PATCH_JUMP);
|
||||
InjectHook(0x4BAEC0, &CObject::Init, PATCH_JUMP);
|
||||
InjectHook(0x4BB010, &CObject::CanBeDeleted, PATCH_JUMP);
|
||||
InjectHook(0x4BBE60, &CObject::DeleteAllMissionObjects, PATCH_JUMP);
|
||||
InjectHook(0x4BBDF0, &CObject::DeleteAllTempObjects, PATCH_JUMP);
|
||||
InjectHook(0x4BBED0, &CObject::DeleteAllTempObjectInArea, PATCH_JUMP);
|
||||
ENDPATCHES
|
||||
|
@ -3,12 +3,25 @@
|
||||
#include "Physical.h"
|
||||
|
||||
enum {
|
||||
UNKNOWN_OBJECT = 0,
|
||||
GAME_OBJECT = 1,
|
||||
MISSION_OBJECT = 2,
|
||||
TEMP_OBJECT = 3,
|
||||
CUTSCENE_OBJECT = 4,
|
||||
};
|
||||
|
||||
enum {
|
||||
COLDAMAGE_EFFECT_NONE = 0,
|
||||
COLDAMAGE_EFFECT_CHANGE_MODEL = 1,
|
||||
COLDAMAGE_EFFECT_SPLIT_MODEL = 2,
|
||||
COLDAMAGE_EFFECT_SMASH_COMPLETELY = 3,
|
||||
COLDAMAGE_EFFECT_CHANGE_THEN_SMASH = 4,
|
||||
COLDAMAGE_EFFECT_SMASH_CARDBOX_COMPLETELY = 50,
|
||||
COLDAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY = 60,
|
||||
COLDAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY = 70,
|
||||
COLDAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY = 80,
|
||||
};
|
||||
|
||||
enum {
|
||||
COLLRESPONSE_NONE,
|
||||
COLLRESPONSE_CHANGE_MODEL,
|
||||
@ -41,21 +54,21 @@ public:
|
||||
int8 bHasBeenDamaged : 1;
|
||||
int8 bUseVehicleColours : 1;
|
||||
int8 m_obj_flag80 : 1;
|
||||
int8 field_172; // car for a bonus pickup?
|
||||
int8 field_173;
|
||||
int8 m_nBonusValue;
|
||||
int8 field_173;
|
||||
float m_fCollisionDamageMultiplier;
|
||||
uint8 m_nCollisionDamageEffect;
|
||||
uint8 m_nSpecialCollisionResponseCases;
|
||||
bool m_bCameraToAvoidThisObject;
|
||||
int8 field_17B;
|
||||
int8 field_17C;
|
||||
int8 field_17D;
|
||||
int8 field_17E;
|
||||
int8 field_17F;
|
||||
int8 field_17B;
|
||||
int8 field_17C;
|
||||
int8 field_17D;
|
||||
int8 field_17E;
|
||||
int8 field_17F;
|
||||
uint32 m_nEndOfLifeTime;
|
||||
int16 m_nRefModelIndex;
|
||||
int8 field_186;
|
||||
int8 field_187;
|
||||
int8 field_186;
|
||||
int8 field_187;
|
||||
CEntity *m_pCurSurface;
|
||||
CEntity *m_pCollidingEntity;
|
||||
int8 m_colour1, m_colour2;
|
||||
@ -74,7 +87,7 @@ public:
|
||||
~CObject(void);
|
||||
|
||||
void ProcessControl(void);
|
||||
void Teleport(CVector);
|
||||
void Teleport(CVector vecPos);
|
||||
void Render(void);
|
||||
bool SetupLighting(void);
|
||||
void RemoveLighting(bool reset);
|
||||
@ -84,6 +97,8 @@ public:
|
||||
void Init(void);
|
||||
bool CanBeDeleted(void);
|
||||
|
||||
static void DeleteAllTempObjectInArea(CVector, float);
|
||||
static void DeleteAllMissionObjects();
|
||||
static void DeleteAllTempObjects();
|
||||
static void DeleteAllTempObjectInArea(CVector point, float fRadius);
|
||||
};
|
||||
static_assert(sizeof(CObject) == 0x198, "CObject: error");
|
||||
|
@ -154,7 +154,7 @@ CParticleObject::AddObject(uint16 type, CVector const &pos, CVector const &targe
|
||||
pobj->m_nRemoveTimer = 0;
|
||||
|
||||
if ( color.alpha != 0 )
|
||||
RwRGBAAssign(&pobj->m_Color, &color);
|
||||
pobj->m_Color = color;
|
||||
else
|
||||
pobj->m_Color.alpha = 0;
|
||||
|
||||
|
@ -28,10 +28,8 @@ CCivilianPed::CivilianAI(void)
|
||||
return;
|
||||
|
||||
if (m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS) {
|
||||
if (m_pedInObjective) {
|
||||
if (m_pedInObjective->IsPlayer())
|
||||
return;
|
||||
}
|
||||
if (m_pedInObjective && m_pedInObjective->IsPlayer())
|
||||
return;
|
||||
}
|
||||
if (CTimer::GetTimeInMilliseconds() <= m_lookTimer)
|
||||
return;
|
||||
@ -75,7 +73,7 @@ CCivilianPed::CivilianAI(void)
|
||||
} else {
|
||||
SetMoveState(PEDMOVE_WALK);
|
||||
}
|
||||
} else if (threatPed->IsPlayer() && FindPlayerPed()->m_pWanted->m_CurrentCops) {
|
||||
} else if (threatPed->IsPlayer() && FindPlayerPed()->m_pWanted->m_CurrentCops != 0) {
|
||||
SetFindPathAndFlee(m_threatEntity, 5000);
|
||||
if (threatDistSqr < sq(10.0f)) {
|
||||
SetMoveState(PEDMOVE_RUN);
|
||||
@ -170,8 +168,8 @@ CCivilianPed::CivilianAI(void)
|
||||
if (m_threatEntity && m_threatEntity->IsPed()) {
|
||||
CPed *threatPed = (CPed*)m_threatEntity;
|
||||
if (m_pedStats->m_fear <= 100 - threatPed->m_pedStats->m_temper && threatPed->m_nPedType != PEDTYPE_COP) {
|
||||
if (threatPed->GetWeapon()->IsTypeMelee() || !GetWeapon()->IsTypeMelee()) {
|
||||
if (threatPed->IsPlayer() && FindPlayerPed()->m_pWanted->m_CurrentCops) {
|
||||
if (threatPed->GetWeapon(m_currentWeapon).IsTypeMelee() || !GetWeapon()->IsTypeMelee()) {
|
||||
if (threatPed->IsPlayer() && FindPlayerPed()->m_pWanted->m_CurrentCops != 0) {
|
||||
if (m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS) {
|
||||
SetFindPathAndFlee(m_threatEntity, 10000);
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include "Gangs.h"
|
||||
#include "Weapon.h"
|
||||
|
||||
//CGangInfo(&CGangs::Gang)[NUM_GANGS] = *(CGangInfo(*)[NUM_GANGS])*(uintptr*)0x6EDF78;
|
||||
CGangInfo CGangs::Gang[NUM_GANGS];
|
||||
|
||||
CGangInfo::CGangInfo() :
|
||||
@ -70,7 +69,6 @@ void CGangs::LoadAllGangData(uint8 *buf, uint32 size)
|
||||
Initialise();
|
||||
|
||||
INITSAVEBUF
|
||||
// original: SkipSaveBuf(buf, SAVE_HEADER_SIZE);
|
||||
CheckSaveHeader(buf, 'G','N','G','\0', size - SAVE_HEADER_SIZE);
|
||||
|
||||
for (int i = 0; i < NUM_GANGS; i++)
|
@ -676,7 +676,7 @@ RemoveAllModelCB(RwObject *object, void *data)
|
||||
{
|
||||
RpAtomic *atomic = (RpAtomic*)object;
|
||||
if (CVisibilityPlugins::GetAtomicModelInfo(atomic)) {
|
||||
RpClumpRemoveAtomic(atomic->clump, atomic);
|
||||
RpClumpRemoveAtomic(RpAtomicGetClump(atomic), atomic);
|
||||
RpAtomicDestroy(atomic);
|
||||
}
|
||||
return object;
|
||||
@ -902,7 +902,7 @@ static RwObject*
|
||||
SetPedAtomicVisibilityCB(RwObject* object, void* data)
|
||||
{
|
||||
if (data == nil)
|
||||
RpAtomicSetFlags(object, 0);
|
||||
RpAtomicSetFlags((RpAtomic*)object, 0);
|
||||
return object;
|
||||
}
|
||||
|
||||
@ -2733,7 +2733,6 @@ CPed::SetObjective(eObjective newObj, void *entity)
|
||||
}
|
||||
|
||||
#ifdef VC_PED_PORTS
|
||||
SetObjectiveTimer(0);
|
||||
ClearPointGunAt();
|
||||
#endif
|
||||
bObjectiveCompleted = false;
|
||||
@ -15027,7 +15026,7 @@ CPed::ProcessBuoyancy(void)
|
||||
#endif
|
||||
|
||||
if (mod_Buoyancy.ProcessBuoyancy(this, GRAVITY * m_fMass * buoyancyLevel, &buoyancyPoint, &buoyancyImpulse)) {
|
||||
m_flagD8 = true;
|
||||
bTouchingWater = true;
|
||||
CEntity *entity;
|
||||
CColPoint point;
|
||||
if (CWorld::ProcessVerticalLine(GetPosition(), GetPosition().z - 3.0f, point, entity, false, true, false, false, false, false, false)
|
||||
@ -15093,7 +15092,7 @@ CPed::ProcessBuoyancy(void)
|
||||
} else
|
||||
return;
|
||||
} else
|
||||
m_flagD8 = false;
|
||||
bTouchingWater = false;
|
||||
|
||||
if (nGenerateWaterCircles && CTimer::GetTimeInMilliseconds() >= nGenerateWaterCircles) {
|
||||
CVector pos = GetPosition();
|
||||
|
@ -340,7 +340,7 @@ CPedIK::RestoreLookAt(void)
|
||||
}
|
||||
|
||||
void
|
||||
CPedIK::ExtractYawAndPitchWorld(RwMatrixTag *mat, float *yaw, float *pitch)
|
||||
CPedIK::ExtractYawAndPitchWorld(RwMatrix *mat, float *yaw, float *pitch)
|
||||
{
|
||||
float f = clamp(DotProduct(mat->up, CVector(0.0f, 1.0f, 0.0f)), -1.0f, 1.0f);
|
||||
*yaw = Acos(f);
|
||||
@ -352,7 +352,7 @@ CPedIK::ExtractYawAndPitchWorld(RwMatrixTag *mat, float *yaw, float *pitch)
|
||||
}
|
||||
|
||||
void
|
||||
CPedIK::ExtractYawAndPitchLocal(RwMatrixTag *mat, float *yaw, float *pitch)
|
||||
CPedIK::ExtractYawAndPitchLocal(RwMatrix *mat, float *yaw, float *pitch)
|
||||
{
|
||||
float f = clamp(DotProduct(mat->at, CVector(0.0f, 0.0f, 1.0f)), -1.0f, 1.0f);
|
||||
*yaw = Acos(f);
|
||||
|
@ -54,8 +54,8 @@ public:
|
||||
void GetComponentPosition(RwV3d *pos, uint32 node);
|
||||
static RwMatrix *GetWorldMatrix(RwFrame *source, RwMatrix *destination);
|
||||
void RotateTorso(AnimBlendFrameData* animBlend, LimbOrientation* limb, bool changeRoll);
|
||||
void ExtractYawAndPitchLocal(RwMatrixTag *mat, float *yaw, float *pitch);
|
||||
void ExtractYawAndPitchWorld(RwMatrixTag *mat, float *yaw, float *pitch);
|
||||
void ExtractYawAndPitchLocal(RwMatrix *mat, float *yaw, float *pitch);
|
||||
void ExtractYawAndPitchWorld(RwMatrix *mat, float *yaw, float *pitch);
|
||||
LimbMoveStatus MoveLimb(LimbOrientation &limb, float approxPhi, float approxTheta, LimbMovementInfo &moveInfo);
|
||||
bool RestoreGunPosn(void);
|
||||
bool LookInDirection(float phi, float theta);
|
||||
|
@ -85,6 +85,7 @@ public:
|
||||
static uint32 GetFlag(int type) { return ms_apPedType[type]->m_flag; }
|
||||
static uint32 GetAvoid(int type) { return ms_apPedType[type]->m_avoid; }
|
||||
static uint32 GetThreats(int type) { return ms_apPedType[type]->m_threats; }
|
||||
static void SetThreats(int type, uint32 threat) { ms_apPedType[type]->m_threats = threat; }
|
||||
static void AddThreat(int type, int threat) { ms_apPedType[type]->m_threats |= threat; }
|
||||
static void RemoveThreat(int type, int threat) { ms_apPedType[type]->m_threats &= ~threat; }
|
||||
static bool IsThreat(int type, int threat) { return ms_apPedType[type]->m_threats & threat; }
|
||||
|
@ -29,39 +29,54 @@
|
||||
#define PED_REMOVE_DIST (MIN_CREATION_DIST + CREATION_RANGE + 1.0f)
|
||||
#define PED_REMOVE_DIST_SPECIAL (MIN_CREATION_DIST + CREATION_RANGE + 15.0f) // for peds with bCullExtraFarAway flag
|
||||
|
||||
// TO-DO: These are hard-coded, reverse them.
|
||||
// More clearly they're transition areas between zones.
|
||||
RegenerationPoint (&aSafeZones)[8] = *(RegenerationPoint(*)[8]) * (uintptr*)0x5FA578;
|
||||
// Transition areas between zones
|
||||
const RegenerationPoint aSafeZones[] = {
|
||||
{ LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 400.0f, 814.0f, -954.0f, -903.0f, 30.0f, 100.0f,
|
||||
CVector(790.0f, -917.0f, 39.0f), CVector(775.0f, -921.0f, 39.0f), CVector(424.0f, -942.0f, 38.0f), CVector(439.0f, -938.0f, 38.0f) },
|
||||
{ LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 555.0f, 711.0f, 118.0f, 186.0f, -30.0f, -10.0f,
|
||||
CVector(698.0f, 182.0f, -20.0f), CVector(681.0f, 178.0f, -20.0f), CVector(586.0f, 144.0f, -20.0f), CVector(577.0f, 135.0f, -20.0f) },
|
||||
{ LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 26.0f, 44.0f, 124.0f, 87.0f, 20.0f, 6.0f,
|
||||
CVector(736.0f, -117.0f, -13.0f), CVector(730.0f, -115.0f, -13.0f), CVector(635.0f, -93.0f, -12.5f), CVector(650.0f, -89.0f, -12.5f) },
|
||||
{ LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 45.0f, 34.0f, 780.0f, 750.0f, 25.0f, 6.0f,
|
||||
CVector(729.0f, -764.0f, -18.0f), CVector(720.0f, -769.0f, -17.0f), CVector(652.0f, -774.0f, -10.5f), CVector(659.0f, -770.0f, -10.5f) },
|
||||
{ LEVEL_COMMERCIAL, LEVEL_SUBURBAN, 532.0f, 136.0f, 668.0f, 599.0f, 4.0f, 0.0f,
|
||||
CVector(-172.0f, -619.0f, 44.0f), CVector(-183.0f, -623.0f, 44.0f), CVector(-511.0f, -645.0f, 41.0f), CVector(-493.0f, -639.0f, 41.5f) },
|
||||
{ LEVEL_COMMERCIAL, LEVEL_SUBURBAN, 325.0f, 175.0f, 7.0f, 5.0f, 30.0f, 10.0f,
|
||||
CVector(-185.0f, 40.8f, -20.5f), CVector(-202.0f, 37.0f, -20.5f), CVector(-315.0f, 65.5f, -20.5f), CVector(-306.0f, 62.4f, -20.5f) },
|
||||
{ LEVEL_COMMERCIAL, LEVEL_SUBURBAN, 410.0f, 310.0f, 1055.0f, 1030.0f, 20.0f, 6.0f,
|
||||
CVector(-321.0f, -1043.0f, -13.2f), CVector(-328.0f, -1045.0f, -13.2f), CVector(-398.0f, -1044.0f, -13.5f), CVector(-390.0f, -1040.5f, -13.5f) },
|
||||
{ LEVEL_COMMERCIAL, LEVEL_SUBURBAN, 425.0f, 280.0f, 471.0f, 447.0f, 20.0f, 5.0f,
|
||||
CVector(-292.0f, -457.0f, -11.6f), CVector(-310.0f, -461.0f, -11.6f), CVector(-413.0f, -461.0f, -11.5f), CVector(-399.0f, -457.0f, -11.3f) }
|
||||
}; // *(RegenerationPoint(*)[8]) * (uintptr*)0x5FA578;
|
||||
|
||||
//PedGroup (&CPopulation::ms_pPedGroups)[NUMPEDGROUPS] = *(PedGroup(*)[NUMPEDGROUPS]) * (uintptr*)0x6E9248;
|
||||
PedGroup CPopulation::ms_pPedGroups[NUMPEDGROUPS];
|
||||
bool &CPopulation::ms_bGivePedsWeapons = *(bool*)0x95CCF6;
|
||||
int32 &CPopulation::m_AllRandomPedsThisType = *(int32*)0x5FA570;
|
||||
float &CPopulation::PedDensityMultiplier = *(float*)0x5FA56C;
|
||||
uint32 &CPopulation::ms_nTotalMissionPeds = *(uint32*)0x8F5F70;
|
||||
int32 &CPopulation::MaxNumberOfPedsInUse = *(int32*)0x5FA574;
|
||||
uint32& CPopulation::ms_nNumCivMale = *(uint32*)0x8F2548;
|
||||
uint32& CPopulation::ms_nNumCivFemale = *(uint32*)0x8F5F44;
|
||||
uint32& CPopulation::ms_nNumCop = *(uint32*)0x885AFC;
|
||||
bool& CPopulation::bZoneChangeHasHappened = *(bool*)0x95CD79;
|
||||
uint32& CPopulation::ms_nNumEmergency = *(uint32*)0x94071C;
|
||||
int8& CPopulation::m_CountDownToPedsAtStart = *(int8*)0x95CD4F;
|
||||
uint32& CPopulation::ms_nNumGang1 = *(uint32*)0x8F1B1C;
|
||||
uint32& CPopulation::ms_nNumGang2 = *(uint32*)0x8F1B14;
|
||||
uint32& CPopulation::ms_nTotalPeds = *(uint32*)0x95CB50;
|
||||
uint32& CPopulation::ms_nNumGang3 = *(uint32*)0x8F2548;
|
||||
uint32& CPopulation::ms_nTotalGangPeds = *(uint32*)0x885AF0;
|
||||
uint32& CPopulation::ms_nNumGang4 = *(uint32*)0x8F1B2C;
|
||||
uint32& CPopulation::ms_nTotalCivPeds = *(uint32*)0x8F2C3C;
|
||||
uint32& CPopulation::ms_nNumGang5 = *(uint32*)0x8F1B30;
|
||||
uint32& CPopulation::ms_nNumDummy = *(uint32*)0x8F1A98;
|
||||
uint32& CPopulation::ms_nNumGang6 = *(uint32*)0x8F1B20;
|
||||
uint32& CPopulation::ms_nNumGang9 = *(uint32*)0x8F1B10;
|
||||
uint32& CPopulation::ms_nNumGang7 = *(uint32*)0x8F1B28;
|
||||
uint32& CPopulation::ms_nNumGang8 = *(uint32*)0x8F1B0C;
|
||||
CVector &CPopulation::RegenerationPoint_a = *(CVector*)0x8E2AA4;
|
||||
CVector &CPopulation::RegenerationPoint_b = *(CVector*)0x8E2A98;
|
||||
CVector &CPopulation::RegenerationForward = *(CVector*)0x8F1AD4;
|
||||
PedGroup CPopulation::ms_pPedGroups[NUMPEDGROUPS]; // = *(PedGroup(*)[NUMPEDGROUPS]) * (uintptr*)0x6E9248;
|
||||
bool CPopulation::ms_bGivePedsWeapons; // = *(bool*)0x95CCF6;
|
||||
int32 CPopulation::m_AllRandomPedsThisType = -1; // = *(int32*)0x5FA570;
|
||||
float CPopulation::PedDensityMultiplier = 1.0f; // = *(float*)0x5FA56C;
|
||||
uint32 CPopulation::ms_nTotalMissionPeds; // = *(uint32*)0x8F5F70;
|
||||
int32 CPopulation::MaxNumberOfPedsInUse = 25; // *(int32*)0x5FA574;
|
||||
uint32 CPopulation::ms_nNumCivMale; // = *(uint32*)0x8F2548;
|
||||
uint32 CPopulation::ms_nNumCivFemale; // = *(uint32*)0x8F5F44;
|
||||
uint32 CPopulation::ms_nNumCop; // = *(uint32*)0x885AFC;
|
||||
bool CPopulation::bZoneChangeHasHappened; // = *(bool*)0x95CD79;
|
||||
uint32 CPopulation::ms_nNumEmergency; // = *(uint32*)0x94071C;
|
||||
int8 CPopulation::m_CountDownToPedsAtStart; // = *(int8*)0x95CD4F;
|
||||
uint32 CPopulation::ms_nNumGang1; // = *(uint32*)0x8F1B1C;
|
||||
uint32 CPopulation::ms_nNumGang2; // = *(uint32*)0x8F1B14;
|
||||
uint32 CPopulation::ms_nTotalPeds; // = *(uint32*)0x95CB50;
|
||||
uint32 CPopulation::ms_nNumGang3; // = *(uint32*)0x8F2548;
|
||||
uint32 CPopulation::ms_nTotalGangPeds; // = *(uint32*)0x885AF0;
|
||||
uint32 CPopulation::ms_nNumGang4; // = *(uint32*)0x8F1B2C;
|
||||
uint32 CPopulation::ms_nTotalCivPeds; // = *(uint32*)0x8F2C3C;
|
||||
uint32 CPopulation::ms_nNumGang5; // = *(uint32*)0x8F1B30;
|
||||
uint32 CPopulation::ms_nNumDummy; // = *(uint32*)0x8F1A98;
|
||||
uint32 CPopulation::ms_nNumGang6; // = *(uint32*)0x8F1B20;
|
||||
uint32 CPopulation::ms_nNumGang9; // = *(uint32*)0x8F1B10;
|
||||
uint32 CPopulation::ms_nNumGang7; // = *(uint32*)0x8F1B28;
|
||||
uint32 CPopulation::ms_nNumGang8; // = *(uint32*)0x8F1B0C;
|
||||
CVector CPopulation::RegenerationPoint_a; // = *(CVector*)0x8E2AA4;
|
||||
CVector CPopulation::RegenerationPoint_b; // = *(CVector*)0x8E2A98;
|
||||
CVector CPopulation::RegenerationForward; // = *(CVector*)0x8F1AD4;
|
||||
|
||||
void
|
||||
CPopulation::Initialise()
|
||||
@ -704,12 +719,15 @@ CPopulation::AddToPopulation(float minDist, float maxDist, float minDistOffScree
|
||||
if (i != 0) {
|
||||
// Gang member
|
||||
newPed->SetLeader(gangLeader);
|
||||
#ifndef FIX_BUGS
|
||||
// seems to be a miami leftover (this code is not on PS2) but gang peds end up just being frozen
|
||||
newPed->m_nPedState = PED_UNKNOWN;
|
||||
gangLeader->m_nPedState = PED_UNKNOWN;
|
||||
newPed->m_fRotationCur = CGeneral::GetRadianAngleBetweenPoints(
|
||||
gangLeader->GetPosition().x, gangLeader->GetPosition().y,
|
||||
newPed->GetPosition().x, newPed->GetPosition().y);
|
||||
newPed->m_fRotationDest = newPed->m_fRotationCur;
|
||||
#endif
|
||||
} else {
|
||||
gangLeader = newPed;
|
||||
}
|
||||
@ -964,7 +982,7 @@ CPopulation::ConvertToRealObject(CDummyObject *dummy)
|
||||
} else if (obj->m_modelIndex == MI_BUOY) {
|
||||
obj->bIsStatic = false;
|
||||
obj->m_vecMoveSpeed = CVector(0.0f, 0.0f, -0.001f);
|
||||
obj->m_flagD8 = true;
|
||||
obj->bTouchingWater = true;
|
||||
obj->AddToMovingList();
|
||||
}
|
||||
}
|
||||
|
@ -34,33 +34,33 @@ class CPopulation
|
||||
{
|
||||
public:
|
||||
static PedGroup ms_pPedGroups[NUMPEDGROUPS];
|
||||
static bool &ms_bGivePedsWeapons;
|
||||
static int32 &m_AllRandomPedsThisType;
|
||||
static float &PedDensityMultiplier;
|
||||
static uint32 &ms_nTotalMissionPeds;
|
||||
static int32 &MaxNumberOfPedsInUse;
|
||||
static uint32& ms_nNumCivMale;
|
||||
static uint32 &ms_nNumCivFemale;
|
||||
static uint32 &ms_nNumCop;
|
||||
static bool &bZoneChangeHasHappened;
|
||||
static uint32 &ms_nNumEmergency;
|
||||
static int8& m_CountDownToPedsAtStart;
|
||||
static uint32& ms_nNumGang1;
|
||||
static uint32& ms_nNumGang2;
|
||||
static uint32& ms_nTotalPeds;
|
||||
static uint32& ms_nNumGang3;
|
||||
static uint32& ms_nTotalGangPeds;
|
||||
static uint32& ms_nNumGang4;
|
||||
static uint32& ms_nTotalCivPeds;
|
||||
static uint32& ms_nNumGang5;
|
||||
static uint32& ms_nNumDummy;
|
||||
static uint32& ms_nNumGang6;
|
||||
static uint32& ms_nNumGang9;
|
||||
static uint32& ms_nNumGang7;
|
||||
static uint32& ms_nNumGang8;
|
||||
static CVector& RegenerationPoint_a;
|
||||
static CVector& RegenerationPoint_b;
|
||||
static CVector& RegenerationForward;
|
||||
static bool ms_bGivePedsWeapons;
|
||||
static int32 m_AllRandomPedsThisType;
|
||||
static float PedDensityMultiplier;
|
||||
static uint32 ms_nTotalMissionPeds;
|
||||
static int32 MaxNumberOfPedsInUse;
|
||||
static uint32 ms_nNumCivMale;
|
||||
static uint32 ms_nNumCivFemale;
|
||||
static uint32 ms_nNumCop;
|
||||
static bool bZoneChangeHasHappened;
|
||||
static uint32 ms_nNumEmergency;
|
||||
static int8 m_CountDownToPedsAtStart;
|
||||
static uint32 ms_nNumGang1;
|
||||
static uint32 ms_nNumGang2;
|
||||
static uint32 ms_nTotalPeds;
|
||||
static uint32 ms_nNumGang3;
|
||||
static uint32 ms_nTotalGangPeds;
|
||||
static uint32 ms_nNumGang4;
|
||||
static uint32 ms_nTotalCivPeds;
|
||||
static uint32 ms_nNumGang5;
|
||||
static uint32 ms_nNumDummy;
|
||||
static uint32 ms_nNumGang6;
|
||||
static uint32 ms_nNumGang9;
|
||||
static uint32 ms_nNumGang7;
|
||||
static uint32 ms_nNumGang8;
|
||||
static CVector RegenerationPoint_a;
|
||||
static CVector RegenerationPoint_b;
|
||||
static CVector RegenerationForward;
|
||||
|
||||
static void Initialise();
|
||||
static void Update(void);
|
||||
|
@ -87,7 +87,7 @@ CClouds::Render(void)
|
||||
RwV3d pos = { 0.0f, -100.0f, 15.0f };
|
||||
RwV3dAdd(&worldpos, &campos, &pos);
|
||||
if(CSprite::CalcScreenCoors(worldpos, &screenpos, &szx, &szy, false)){
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, gpCoronaTexture[2]->raster);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCoronaTexture[2]));
|
||||
if(CCoronas::bSmallMoon){
|
||||
szx *= 4.0f;
|
||||
szy *= 4.0f;
|
||||
@ -116,7 +116,7 @@ CClouds::Render(void)
|
||||
static float StarCoorsY[9] = { 0.0f, 0.45f, 0.9f, 1.0f, 0.85f, 0.52f, 0.48f, 0.35f, 0.2f };
|
||||
static float StarSizes[9] = { 1.0f, 1.4f, 0.9f, 1.0f, 0.6f, 1.5f, 1.3f, 1.0f, 0.8f };
|
||||
int brightness = (1.0f - coverage) * starintens;
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, gpCoronaTexture[0]->raster);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCoronaTexture[0]));
|
||||
for(i = 0; i < 11; i++){
|
||||
RwV3d pos = { 100.0f, 0.0f, 10.0f };
|
||||
if(i >= 9) pos.x = -pos.x;
|
||||
@ -132,7 +132,7 @@ CClouds::Render(void)
|
||||
CSprite::FlushSpriteBuffer();
|
||||
|
||||
// *
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, gpCoronaTexture[0]->raster);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCoronaTexture[0]));
|
||||
RwV3d pos = { 100.0f, 0.0f, 10.0f };
|
||||
RwV3dAdd(&worldpos, &campos, &pos);
|
||||
worldpos.y -= 90.0f;
|
||||
@ -156,7 +156,7 @@ CClouds::Render(void)
|
||||
int b = CTimeCycle::GetLowCloudsBlue() * lowcloudintensity;
|
||||
for(int cloudtype = 0; cloudtype < 3; cloudtype++){
|
||||
for(i = cloudtype; i < 12; i += 3){
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, gpCloudTex[cloudtype]->raster);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCloudTex[cloudtype]));
|
||||
RwV3d pos = { 800.0f*LowCloudsX[i], 800.0f*LowCloudsY[i], 60.0f*LowCloudsZ[i] };
|
||||
worldpos.x = campos.x + pos.x;
|
||||
worldpos.y = campos.y + pos.y;
|
||||
@ -202,7 +202,7 @@ CClouds::Render(void)
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, gpCloudTex[4]->raster);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCloudTex[4]));
|
||||
for(i = 0; i < 37; i++){
|
||||
RwV3d pos = { 2.0f*CoorsOffsetX[i], 2.0f*CoorsOffsetY[i], 40.0f*CoorsOffsetZ[i] + 40.0f };
|
||||
worldpos.x = pos.x*rot_cos + pos.y*rot_sin + campos.x;
|
||||
@ -244,7 +244,7 @@ CClouds::Render(void)
|
||||
// Highlights
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, gpCloudTex[3]->raster);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCloudTex[3]));
|
||||
|
||||
for(i = 0; i < 37; i++){
|
||||
RwV3d pos = { 2.0f*CoorsOffsetX[i], 2.0f*CoorsOffsetY[i], 40.0f*CoorsOffsetZ[i] + 40.0f };
|
||||
@ -269,7 +269,7 @@ CClouds::Render(void)
|
||||
static uint8 BowRed[6] = { 30, 30, 30, 10, 0, 15 };
|
||||
static uint8 BowGreen[6] = { 0, 15, 30, 30, 0, 0 };
|
||||
static uint8 BowBlue[6] = { 0, 0, 0, 10, 30, 30 };
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, gpCoronaTexture[0]->raster);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCoronaTexture[0]));
|
||||
for(i = 0; i < 6; i++){
|
||||
RwV3d pos = { i*1.5f, 100.0f, 5.0f };
|
||||
RwV3dAdd(&worldpos, &campos, &pos);
|
||||
|
@ -320,7 +320,7 @@ CCoronas::Render(void)
|
||||
|
||||
CSprite::RenderOneXLUSprite(spriteCoors.x, spriteCoors.y, spriteCoors.z,
|
||||
spritew * aCoronas[i].size * wscale,
|
||||
spriteh * SCREEN_SCALE_AR2(aCoronas[i].size * fogscale * hscale),
|
||||
spriteh * aCoronas[i].size * fogscale * hscale,
|
||||
CCoronas::aCoronas[i].red / fogscale,
|
||||
CCoronas::aCoronas[i].green / fogscale,
|
||||
CCoronas::aCoronas[i].blue / fogscale,
|
||||
@ -331,7 +331,7 @@ CCoronas::Render(void)
|
||||
CSprite::RenderOneXLUSprite_Rotate_Aspect(
|
||||
spriteCoors.x, spriteCoors.y, spriteCoors.z,
|
||||
spritew * aCoronas[i].size * fogscale,
|
||||
spriteh * SCREEN_SCALE_AR2(aCoronas[i].size * fogscale),
|
||||
spriteh * aCoronas[i].size * fogscale,
|
||||
CCoronas::aCoronas[i].red / fogscale,
|
||||
CCoronas::aCoronas[i].green / fogscale,
|
||||
CCoronas::aCoronas[i].blue / fogscale,
|
||||
|
@ -755,14 +755,14 @@ void CTowerClock::Render()
|
||||
&TempV[1],
|
||||
m_Position.x + Sin(angleMinute) * m_fScale * m_Size.x,
|
||||
m_Position.y + Sin(angleMinute) * m_fScale * m_Size.y,
|
||||
m_Position.z + Cos(angleMinute) * m_fScale;
|
||||
m_Position.z + Cos(angleMinute) * m_fScale
|
||||
);
|
||||
RwIm3DVertexSetPos(&TempV[2], m_Position.x, m_Position.y, m_Position.z);
|
||||
RwIm3DVertexSetPos(
|
||||
&TempV[3],
|
||||
m_Position.x + Sin(angleHour) * 0.75f * m_fScale * m_Size.x,
|
||||
m_Position.y + Sin(angleHour) * 0.75f * m_fScale * m_Size.y,
|
||||
m_Position.z + Cos(angleHour) * 0.75f * m_fScale;
|
||||
m_Position.z + Cos(angleHour) * 0.75f * m_fScale
|
||||
);
|
||||
|
||||
LittleTest();
|
||||
|
@ -23,55 +23,47 @@
|
||||
|
||||
//wchar *CHud::m_HelpMessage = (wchar*)0x86B888;
|
||||
//wchar *CHud::m_LastHelpMessage = (wchar*)0x6E8F28;
|
||||
wchar CHud::m_HelpMessage[256];
|
||||
wchar CHud::m_LastHelpMessage[256];
|
||||
|
||||
int32 &CHud::m_HelpMessageState = *(int32*)0x880E1C;
|
||||
int32 &CHud::m_HelpMessageTimer = *(int32*)0x880FA4;
|
||||
int32 &CHud::m_HelpMessageFadeTimer = *(int32*)0x8F6258;
|
||||
wchar *CHud::m_HelpMessageToPrint = (wchar*)0x664480;
|
||||
float &CHud::m_HelpMessageDisplayTime = *(float*)0x8E2C28;
|
||||
float &CHud::m_fTextBoxNumLines = *(float*)0x8E2C28;
|
||||
float &CHud::m_fHelpMessageTime = *(float *)0x8E2C28;
|
||||
bool &CHud::m_HelpMessageQuick = *(bool *)0x95CCF7;
|
||||
int32 CHud::m_ZoneState = *(int32*)0x8F29AC;
|
||||
wchar CHud::m_HelpMessageToPrint[256]; // = (wchar*)0x664480;
|
||||
float CHud::m_fHelpMessageTime; // *(float *)0x8E2C28;
|
||||
bool CHud::m_HelpMessageQuick; // = *(bool*)0x95CCF7;
|
||||
uint32 CHud::m_ZoneState; // = *(int32*)0x8F29AC;
|
||||
int32 CHud::m_ZoneFadeTimer;
|
||||
int32 CHud::m_ZoneNameTimer = *(int32*)0x8F1A50;
|
||||
wchar *&CHud::m_pZoneName = *(wchar **)0x8E2C2C;
|
||||
wchar *CHud::m_pLastZoneName = (wchar*)0x8F432C;
|
||||
uint32 CHud::m_ZoneNameTimer; // = *(int32*)0x8F1A50;
|
||||
wchar *CHud::m_pZoneName; // = *(wchar**)0x8E2C2C;
|
||||
wchar *CHud::m_pLastZoneName; // = (wchar*)0x8F432C;
|
||||
wchar *CHud::m_ZoneToPrint;
|
||||
int32 CHud::m_VehicleState = *(int32*)0x940560;
|
||||
uint32 CHud::m_VehicleState; // = *(int32*)0x940560;
|
||||
int32 CHud::m_VehicleFadeTimer;
|
||||
int32 CHud::m_VehicleNameTimer = *(int32*)0x8F2A14;
|
||||
wchar *&CHud::m_VehicleName = *(wchar **)0x942FB4;
|
||||
wchar *CHud::m_pLastVehicleName = *(wchar **)0x8E2DD8;
|
||||
uint32 CHud::m_VehicleNameTimer; // = *(int32*)0x8F2A14;
|
||||
wchar *CHud::m_VehicleName; // = *(wchar**)0x942FB4;
|
||||
wchar *CHud::m_pLastVehicleName; // = *(wchar**)0x8E2DD8;
|
||||
wchar *CHud::m_pVehicleNameToPrint;
|
||||
wchar *CHud::m_Message = (wchar*)0x72E318;
|
||||
wchar *CHud::m_PagerMessage = (wchar*)0x878840;
|
||||
bool &CHud::m_Wants_To_Draw_Hud = *(bool*)0x95CD89;
|
||||
bool &CHud::m_Wants_To_Draw_3dMarkers = *(bool*)0x95CD62;
|
||||
wchar(&CHud::m_BigMessage)[6][128] = *(wchar(*)[6][128])*(uintptr*)0x664CE0;
|
||||
int16 &CHud::m_ItemToFlash = *(int16*)0x95CC82;
|
||||
wchar CHud::m_Message[256];// = (wchar*)0x72E318;
|
||||
wchar CHud::m_PagerMessage[256]; // = (wchar*)0x878840;
|
||||
bool CHud::m_Wants_To_Draw_Hud; // (bool*)0x95CD89;
|
||||
bool CHud::m_Wants_To_Draw_3dMarkers; // = *(bool*)0x95CD62;
|
||||
wchar CHud::m_BigMessage[6][128]; // = *(wchar(*)[6][128]) * (uintptr*)0x664CE0;
|
||||
int16 CHud::m_ItemToFlash; // = *(int16*)0x95CC82;
|
||||
|
||||
// These aren't really in CHud
|
||||
float CHud::BigMessageInUse[6];
|
||||
float CHud::BigMessageAlpha[6];
|
||||
float CHud::BigMessageX[6];
|
||||
float &CHud::OddJob2OffTimer = *(float*)0x942FA0;
|
||||
int8 &CHud::CounterOnLastFrame = *(int8*)0x95CD67;
|
||||
float &CHud::OddJob2XOffset = *(float*)0x8F1B5C;
|
||||
int16 &CHud::CounterFlashTimer = *(int16*)0x95CC20;
|
||||
int16 &CHud::OddJob2Timer = *(int16*)0x95CC52;
|
||||
int8 &CHud::TimerOnLastFrame = *(int8*)0x95CDA7;
|
||||
int16 &CHud::OddJob2On = *(int16*)0x95CC78;
|
||||
int16 &CHud::TimerFlashTimer = *(int16*)0x95CC6C;
|
||||
int16 &CHud::PagerSoundPlayed = *(int16*)0x95CC4A;
|
||||
int32 &CHud::SpriteBrightness = *(int32*)0x95CC54;
|
||||
float &CHud::PagerXOffset = *(float*)0x941590;
|
||||
int16 &CHud::PagerTimer = *(int16*)0x95CC3A;
|
||||
int16 &CHud::PagerOn = *(int16*)0x95CCA0;
|
||||
float CHud::OddJob2OffTimer; // = *(float*)0x942FA0;
|
||||
bool CHud::CounterOnLastFrame; // = *(int8*)0x95CD67;
|
||||
float CHud::OddJob2XOffset; // = *(float*)0x8F1B5C;
|
||||
uint16 CHud::CounterFlashTimer; // = *(int16*)0x95CC20;
|
||||
uint16 CHud::OddJob2Timer; // = *(int16*)0x95CC52;
|
||||
bool CHud::TimerOnLastFrame; //= *(int8*)0x95CDA7;
|
||||
int16 CHud::OddJob2On; //= *(int16*)0x95CC78;
|
||||
uint16 CHud::TimerFlashTimer; //= *(int16*)0x95CC6C;
|
||||
int16 CHud::PagerSoundPlayed; //= *(int16*)0x95CC4A;
|
||||
int32 CHud::SpriteBrightness; //= *(int32*)0x95CC54;
|
||||
float CHud::PagerXOffset; //= *(float*)0x941590;
|
||||
int16 CHud::PagerTimer; //= *(int16*)0x95CC3A;
|
||||
int16 CHud::PagerOn; //= *(int16*)0x95CCA0;
|
||||
|
||||
CSprite2d *CHud::Sprites = (CSprite2d*)0x95CB9C;
|
||||
CSprite2d CHud::Sprites[NUM_HUD_SPRITES]; // = (CSprite2d*)0x95CB9C;
|
||||
|
||||
struct
|
||||
{
|
||||
@ -93,14 +85,14 @@ struct
|
||||
{"detonator", "detonator_mask"},
|
||||
{"", ""},
|
||||
{"", ""},
|
||||
{"radardisc", "radardiscm"},
|
||||
{"radardisc", "radardisc"},
|
||||
{"pager", "pagerm"},
|
||||
{"", ""},
|
||||
{"", ""},
|
||||
{"bleeder", ""},
|
||||
{"sitesniper", "sitesniperm"},
|
||||
{"siteM16", "siteM16m"},
|
||||
{"siterocket", "siterocketm"}
|
||||
{"siterocket", "siterocket"}
|
||||
};
|
||||
|
||||
RwTexture *&gpSniperSightTex = *(RwTexture**)0x8F5834;
|
||||
@ -418,7 +410,7 @@ void CHud::Draw()
|
||||
DrawZoneName
|
||||
*/
|
||||
if (m_pZoneName) {
|
||||
float fZoneAlpha = 0.0f;
|
||||
float fZoneAlpha = 255.0f;
|
||||
|
||||
if (m_pZoneName != m_pLastZoneName) {
|
||||
switch (m_ZoneState) {
|
||||
@ -432,7 +424,7 @@ void CHud::Draw()
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
m_ZoneNameTimer = 0;
|
||||
m_ZoneNameTimer = 5;
|
||||
m_ZoneState = 4;
|
||||
break;
|
||||
default:
|
||||
@ -444,6 +436,7 @@ void CHud::Draw()
|
||||
if (m_ZoneState) {
|
||||
switch (m_ZoneState) {
|
||||
case 1:
|
||||
m_ZoneFadeTimer = 1000;
|
||||
if (m_ZoneNameTimer > 10000) {
|
||||
m_ZoneFadeTimer = 1000;
|
||||
m_ZoneState = 3;
|
||||
@ -471,7 +464,6 @@ void CHud::Draw()
|
||||
if (m_ZoneFadeTimer < 0) {
|
||||
m_ZoneFadeTimer = 0;
|
||||
m_ZoneToPrint = m_pLastZoneName;
|
||||
m_ZoneNameTimer = 0;
|
||||
m_ZoneState = 2;
|
||||
}
|
||||
fZoneAlpha = m_ZoneFadeTimer * 0.001f * 255.0f;
|
||||
@ -503,12 +495,6 @@ void CHud::Draw()
|
||||
}
|
||||
}
|
||||
}
|
||||
/*else {
|
||||
m_pLastZoneName = nil;
|
||||
m_ZoneState = 0;
|
||||
m_ZoneFadeTimer = 0;
|
||||
m_ZoneNameTimer = 0;
|
||||
}*/
|
||||
|
||||
/*
|
||||
DrawVehicleName
|
||||
@ -636,9 +622,9 @@ void CHud::Draw()
|
||||
wchar sTimer[16];
|
||||
|
||||
if (!CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerProcessed)
|
||||
TimerOnLastFrame = 0;
|
||||
TimerOnLastFrame = false;
|
||||
if (!CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterProcessed)
|
||||
CounterOnLastFrame = 0;
|
||||
CounterOnLastFrame = false;
|
||||
|
||||
#ifdef FIX_BUGS
|
||||
#define TIMER_RIGHT_OFFSET 34.0f // Taken from VC frenzy timer
|
||||
@ -650,7 +636,7 @@ void CHud::Draw()
|
||||
if (!TimerOnLastFrame)
|
||||
TimerFlashTimer = 1;
|
||||
|
||||
TimerOnLastFrame = 1;
|
||||
TimerOnLastFrame = true;
|
||||
|
||||
if (TimerFlashTimer) {
|
||||
if (++TimerFlashTimer > 50)
|
||||
@ -688,7 +674,7 @@ void CHud::Draw()
|
||||
if (!CounterOnLastFrame)
|
||||
CounterFlashTimer = 1;
|
||||
|
||||
CounterOnLastFrame = 1;
|
||||
CounterOnLastFrame = true;
|
||||
|
||||
if (CounterFlashTimer) {
|
||||
if (++CounterFlashTimer > 50)
|
||||
@ -742,11 +728,9 @@ void CHud::Draw()
|
||||
/*
|
||||
DrawPager
|
||||
*/
|
||||
if (!m_PagerMessage[0]) {
|
||||
if (PagerOn == 1) {
|
||||
PagerSoundPlayed = false;
|
||||
PagerOn = 2;
|
||||
}
|
||||
if (!m_PagerMessage[0] && PagerOn == 1) {
|
||||
PagerSoundPlayed = false;
|
||||
PagerOn = 2;
|
||||
}
|
||||
if (m_PagerMessage[0] || PagerOn == 2) {
|
||||
if (!PagerOn) {
|
||||
@ -755,7 +739,7 @@ void CHud::Draw()
|
||||
}
|
||||
if (PagerOn == 1) {
|
||||
if (PagerXOffset > 0.0f) {
|
||||
float fStep = PagerXOffset * 0.05f;
|
||||
float fStep = PagerXOffset * 0.1f;
|
||||
if (fStep > 10.0f)
|
||||
fStep = 10.0f;
|
||||
PagerXOffset -= fStep * CTimer::GetTimeStep();
|
||||
@ -766,10 +750,10 @@ void CHud::Draw()
|
||||
}
|
||||
}
|
||||
else if (PagerOn == 2) {
|
||||
float fStep = PagerXOffset * 0.05f;
|
||||
float fStep = PagerXOffset * 0.1f;
|
||||
if (fStep < 2.0f)
|
||||
fStep = 2.0f;
|
||||
PagerXOffset += fStep * CTimer::GetTimeStep();
|
||||
PagerXOffset += fStep;
|
||||
if (PagerXOffset > 150.0f) {
|
||||
PagerXOffset = 150.0f;
|
||||
PagerOn = 0;
|
||||
@ -818,9 +802,7 @@ void CHud::Draw()
|
||||
DrawScriptText
|
||||
*/
|
||||
if (!CTimer::GetIsUserPaused()) {
|
||||
CTextLine* IntroText = CTheScripts::IntroTextLines;
|
||||
|
||||
for (int i = 0; i < MAX_NUM_INTRO_TEXT_LINES; i++) {
|
||||
for (int i = 0; i < ARRAY_SIZE(CTheScripts::IntroTextLines); i++) {
|
||||
if (CTheScripts::IntroTextLines[i].m_Text[0] && CTheScripts::IntroTextLines[i].m_bTextBeforeFade) {
|
||||
CFont::SetScale(SCREEN_SCALE_X(CTheScripts::IntroTextLines[i].m_fScaleX), SCREEN_SCALE_Y(CTheScripts::IntroTextLines[i].m_fScaleY * 0.5f));
|
||||
CFont::SetColor(CTheScripts::IntroTextLines[i].m_sColor);
|
||||
@ -861,31 +843,31 @@ void CHud::Draw()
|
||||
CFont::SetPropOff();
|
||||
|
||||
CFont::SetFontStyle(FONTJAP(CTheScripts::IntroTextLines[i].m_nFont));
|
||||
CFont::PrintString(SCREEN_SCALE_X(640.0f - CTheScripts::IntroTextLines[i].m_fAtX), SCREEN_SCALE_Y(448.0f - CTheScripts::IntroTextLines[i].m_fAtY), IntroText->m_Text);
|
||||
CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - CTheScripts::IntroTextLines[i].m_fAtX), SCREEN_SCALE_Y(DEFAULT_SCREEN_HEIGHT - CTheScripts::IntroTextLines[i].m_fAtY), CTheScripts::IntroTextLines[i].m_Text);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < ARRAY_SIZE(CTheScripts::IntroRectangles); i++) {
|
||||
intro_script_rectangle &IntroRect = CTheScripts::IntroRectangles[i];
|
||||
|
||||
CScriptRectangle* IntroRect = CTheScripts::IntroRectangles;
|
||||
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if (CTheScripts::IntroRectangles[i].m_bIsUsed && CTheScripts::IntroRectangles[i].m_bBeforeFade) {
|
||||
if (CTheScripts::IntroRectangles[i].m_nTextureId >= 0) {
|
||||
// Yeah, top and bottom changed place. R* vision
|
||||
if (IntroRect.m_bIsUsed && IntroRect.m_bBeforeFade) {
|
||||
if (IntroRect.m_nTextureId >= 0) {
|
||||
CRect rect = {
|
||||
CTheScripts::IntroRectangles[i].m_sRect.left,
|
||||
CTheScripts::IntroRectangles[i].m_sRect.bottom,
|
||||
CTheScripts::IntroRectangles[i].m_sRect.right,
|
||||
CTheScripts::IntroRectangles[i].m_sRect.bottom };
|
||||
IntroRect.m_sRect.left,
|
||||
IntroRect.m_sRect.top,
|
||||
IntroRect.m_sRect.right,
|
||||
IntroRect.m_sRect.bottom };
|
||||
|
||||
CTheScripts::ScriptSprites[CTheScripts::IntroRectangles[i].m_nTextureId].Draw(rect, IntroRect->m_sColor);
|
||||
CTheScripts::ScriptSprites[IntroRect.m_nTextureId].Draw(rect, IntroRect.m_sColor);
|
||||
}
|
||||
else {
|
||||
CRect rect = {
|
||||
CTheScripts::IntroRectangles[i].m_sRect.left,
|
||||
CTheScripts::IntroRectangles[i].m_sRect.bottom,
|
||||
CTheScripts::IntroRectangles[i].m_sRect.right,
|
||||
CTheScripts::IntroRectangles[i].m_sRect.bottom };
|
||||
IntroRect.m_sRect.left,
|
||||
IntroRect.m_sRect.top,
|
||||
IntroRect.m_sRect.right,
|
||||
IntroRect.m_sRect.bottom };
|
||||
|
||||
CSprite2d::DrawRect(rect, IntroRect->m_sColor);
|
||||
CSprite2d::DrawRect(rect, IntroRect.m_sColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -931,7 +913,7 @@ void CHud::Draw()
|
||||
CFont::SetCentreSize(SCREEN_SCALE_X(615.0f));
|
||||
CFont::SetFontStyle(FONT_HEADING);
|
||||
|
||||
if (BigMessageX[0] >= (SCREEN_WIDTH - 20)) {
|
||||
if (BigMessageX[0] >= SCREEN_SCALE_FROM_RIGHT(20.0f)) {
|
||||
BigMessageInUse[0] += CTimer::GetTimeStep();
|
||||
|
||||
if (BigMessageInUse[0] >= 120.0f) {
|
||||
@ -948,7 +930,7 @@ void CHud::Draw()
|
||||
BigMessageX[0] += (CTimer::GetTimeStepInMilliseconds() * 0.3f);
|
||||
BigMessageAlpha[0] += (CTimer::GetTimeStepInMilliseconds() * 0.3f);
|
||||
|
||||
if (BigMessageAlpha[0] >= 255.0f)
|
||||
if (BigMessageAlpha[0] > 255.0f)
|
||||
BigMessageAlpha[0] = 255.0f;
|
||||
}
|
||||
|
||||
@ -992,7 +974,7 @@ void CHud::Draw()
|
||||
CFont::SetFontStyle(FONT_HEADING);
|
||||
|
||||
CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[2]));
|
||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f + 4.0f), SCREEN_SCALE_FROM_BOTTOM(78.0f), m_BigMessage[2]);
|
||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f - 4.0f), SCREEN_SCALE_FROM_BOTTOM(78.0f), m_BigMessage[2]);
|
||||
|
||||
CFont::SetColor(CRGBA(170, 123, 87, BigMessageAlpha[2]));
|
||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(82.0f), m_BigMessage[2]);
|
||||
@ -1021,7 +1003,7 @@ void CHud::DrawAfterFade()
|
||||
m_HelpMessageState = 2;
|
||||
m_HelpMessageTimer = 0;
|
||||
CMessages::WideStringCopy(m_HelpMessageToPrint, m_HelpMessage, 256);
|
||||
m_HelpMessageDisplayTime = CMessages::GetWideStringLength(m_HelpMessage) * 0.05f + 3.0f;
|
||||
m_fHelpMessageTime = CMessages::GetWideStringLength(m_HelpMessage) * 0.05f + 3.0f;
|
||||
|
||||
if (TheCamera.m_ScreenReductionPercentage == 0.0f)
|
||||
DMAudio.PlayFrontEndSound(SOUND_A0, 0);
|
||||
@ -1039,14 +1021,14 @@ void CHud::DrawAfterFade()
|
||||
CMessages::WideStringCopy(m_LastHelpMessage, m_HelpMessage, 256);
|
||||
}
|
||||
|
||||
float fAlpha = 255.0f;
|
||||
float fAlpha = 225.0f;
|
||||
|
||||
if (m_HelpMessageState) {
|
||||
if (m_HelpMessageState != 0) {
|
||||
switch (m_HelpMessageState) {
|
||||
case 1:
|
||||
fAlpha = 255.0f;
|
||||
fAlpha = 225.0f;
|
||||
m_HelpMessageFadeTimer = 600;
|
||||
if (m_HelpMessageTimer > m_fHelpMessageTime * 1000 || m_HelpMessageQuick && m_HelpMessageTimer > 1500) {
|
||||
if (m_HelpMessageTimer > m_fHelpMessageTime * 1000.0f || m_HelpMessageQuick && m_HelpMessageTimer > 1500.0f) {
|
||||
m_HelpMessageFadeTimer = 600;
|
||||
m_HelpMessageState = 3;
|
||||
}
|
||||
@ -1057,24 +1039,24 @@ void CHud::DrawAfterFade()
|
||||
m_HelpMessageState = 1;
|
||||
m_HelpMessageFadeTimer = 0;
|
||||
}
|
||||
fAlpha = m_HelpMessageFadeTimer * 0.001f * 255.0f;
|
||||
fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
|
||||
break;
|
||||
case 3:
|
||||
m_HelpMessageFadeTimer -= 2 * CTimer::GetTimeStepInMilliseconds();
|
||||
if (m_HelpMessageFadeTimer >= 0) {
|
||||
if (m_HelpMessageFadeTimer < 0) {
|
||||
m_HelpMessageState = 0;
|
||||
m_HelpMessageFadeTimer = 0;
|
||||
}
|
||||
fAlpha = m_HelpMessageFadeTimer * 0.001f * 255.0f;
|
||||
fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
|
||||
break;
|
||||
case 4:
|
||||
m_HelpMessageFadeTimer -= 2 * CTimer::GetTimeStepInMilliseconds();
|
||||
if (m_HelpMessageFadeTimer >= 0) {
|
||||
if (m_HelpMessageFadeTimer < 0) {
|
||||
m_HelpMessageState = 2;
|
||||
m_HelpMessageFadeTimer = 0;
|
||||
CMessages::WideStringCopy(m_HelpMessageToPrint, m_LastHelpMessage, 400);
|
||||
CMessages::WideStringCopy(m_HelpMessageToPrint, m_LastHelpMessage, 256);
|
||||
}
|
||||
fAlpha = m_HelpMessageFadeTimer * 0.001f * 255.0f;
|
||||
fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -1093,6 +1075,7 @@ void CHud::DrawAfterFade()
|
||||
else
|
||||
CFont::SetScale(SCREEN_SCALE_X(0.52f), SCREEN_SCALE_Y(1.1f));
|
||||
|
||||
CFont::SetColor(CRGBA(175, 175, 175, 255));
|
||||
CFont::SetJustifyOff();
|
||||
if (CFont::LanguageSet == FONT_LANGSET_JAPANESE)
|
||||
CFont::SetWrapx(SCREEN_SCALE_X(229.0f + 26.0f - 4.0f));
|
||||
@ -1101,14 +1084,69 @@ void CHud::DrawAfterFade()
|
||||
CFont::SetFontStyle(FONTJAP(FONT_BANK));
|
||||
CFont::SetBackgroundOn();
|
||||
CFont::SetBackGroundOnlyTextOff();
|
||||
CFont::SetBackgroundColor(CRGBA(0, 0, 0, fAlpha * 0.8f));
|
||||
CFont::SetColor(CRGBA(175, 175, 175, 255));
|
||||
CFont::SetBackgroundColor(CRGBA(0, 0, 0, fAlpha * 0.9f));
|
||||
CFont::PrintString(SCREEN_SCALE_X(26.0f), SCREEN_SCALE_Y(28.0f + (150.0f - PagerXOffset) * 0.6f), CHud::m_HelpMessageToPrint);
|
||||
CFont::SetAlphaFade(255.0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
m_HelpMessageState = 0;
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(CTheScripts::IntroTextLines); i++) {
|
||||
intro_text_line &line = CTheScripts::IntroTextLines[i];
|
||||
if (line.m_Text[0] != '\0' && !line.m_bTextBeforeFade) {
|
||||
CFont::SetScale(SCREEN_SCALE_X(line.m_fScaleX), SCREEN_SCALE_Y(line.m_fScaleY) / 2);
|
||||
|
||||
CFont::SetColor(line.m_sColor);
|
||||
if (line.m_bJustify)
|
||||
CFont::SetJustifyOn();
|
||||
else
|
||||
CFont::SetJustifyOff();
|
||||
|
||||
if (line.m_bRightJustify)
|
||||
CFont::SetRightJustifyOn();
|
||||
else
|
||||
CFont::SetRightJustifyOff();
|
||||
|
||||
if (line.m_bCentered)
|
||||
CFont::SetCentreOn();
|
||||
else
|
||||
CFont::SetCentreOff();
|
||||
|
||||
CFont::SetWrapx(SCREEN_SCALE_X(line.m_fWrapX));
|
||||
CFont::SetCentreSize(SCREEN_SCALE_X(line.m_fCenterSize));
|
||||
if (line.m_bBackground)
|
||||
CFont::SetBackgroundOn();
|
||||
else
|
||||
CFont::SetBackgroundOff();
|
||||
|
||||
CFont::SetBackgroundColor(line.m_sBackgroundColor);
|
||||
if (line.m_bBackgroundOnly)
|
||||
CFont::SetBackGroundOnlyTextOn();
|
||||
else
|
||||
CFont::SetBackGroundOnlyTextOff();
|
||||
|
||||
if (line.m_bTextProportional)
|
||||
CFont::SetPropOn();
|
||||
else
|
||||
CFont::SetPropOff();
|
||||
|
||||
CFont::SetFontStyle(line.m_nFont);
|
||||
CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - line.m_fAtX), SCREEN_SCALE_Y(DEFAULT_SCREEN_HEIGHT - line.m_fAtY), line.m_Text);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < ARRAY_SIZE(CTheScripts::IntroRectangles); i++) {
|
||||
intro_script_rectangle &rectangle = CTheScripts::IntroRectangles[i];
|
||||
if (rectangle.m_bIsUsed && !rectangle.m_bBeforeFade) {
|
||||
|
||||
// Yeah, top and bottom changed place. R* vision
|
||||
if (rectangle.m_nTextureId >= 0) {
|
||||
CTheScripts::ScriptSprites[rectangle.m_nTextureId].Draw(CRect(rectangle.m_sRect.left, rectangle.m_sRect.bottom,
|
||||
rectangle.m_sRect.right, rectangle.m_sRect.top), rectangle.m_sColor);
|
||||
} else {
|
||||
CSprite2d::DrawRect(CRect(rectangle.m_sRect.left, rectangle.m_sRect.bottom,
|
||||
rectangle.m_sRect.right, rectangle.m_sRect.top), rectangle.m_sColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
DrawBigMessage2
|
||||
@ -1150,10 +1188,9 @@ void CHud::DrawAfterFade()
|
||||
if (OddJob2OffTimer > 0)
|
||||
OddJob2OffTimer -= CTimer::GetTimeStepInMilliseconds();
|
||||
|
||||
static float fStep;
|
||||
float fStep;
|
||||
if (m_BigMessage[5][0] && OddJob2OffTimer <= 0.0f) {
|
||||
if (OddJob2On <= 3) {
|
||||
switch (OddJob2On) {
|
||||
switch (OddJob2On) {
|
||||
case 0:
|
||||
OddJob2On = 1;
|
||||
OddJob2XOffset = 380.0f;
|
||||
@ -1164,9 +1201,7 @@ void CHud::DrawAfterFade()
|
||||
OddJob2On = 2;
|
||||
}
|
||||
else {
|
||||
fStep = 40.0f;
|
||||
if ((OddJob2XOffset / 6.0f) <= 40.0f)
|
||||
fStep = OddJob2XOffset / 6.0f;
|
||||
fStep = min(40.0f, OddJob2XOffset / 6.0f);
|
||||
OddJob2XOffset = OddJob2XOffset - fStep;
|
||||
}
|
||||
break;
|
||||
@ -1177,9 +1212,7 @@ void CHud::DrawAfterFade()
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
fStep = 30.0f;
|
||||
if ((OddJob2XOffset / 5.0f) >= 30.0f)
|
||||
fStep = OddJob2XOffset / 5.0f;
|
||||
fStep = max(30.0f, OddJob2XOffset / 5.0f);
|
||||
|
||||
OddJob2XOffset = OddJob2XOffset - fStep;
|
||||
|
||||
@ -1190,7 +1223,6 @@ void CHud::DrawAfterFade()
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_BigMessage[1][0]) {
|
||||
@ -1224,10 +1256,10 @@ void CHud::DrawAfterFade()
|
||||
CFont::SetScale(SCREEN_SCALE_X(1.04f), SCREEN_SCALE_Y(1.6f));
|
||||
|
||||
CFont::SetPropOn();
|
||||
CFont::SetRightJustifyWrap(-500.0f);
|
||||
CFont::SetRightJustifyWrap(SCREEN_SCALE_X(-500.0f));
|
||||
CFont::SetRightJustifyOn();
|
||||
CFont::SetFontStyle(FONT_HEADING);
|
||||
if (BigMessageX[1] >= (SCREEN_WIDTH - 20)) {
|
||||
if (BigMessageX[1] >= SCREEN_SCALE_FROM_RIGHT(20.0f)) {
|
||||
BigMessageInUse[1] += CTimer::GetTimeStep();
|
||||
|
||||
if (BigMessageInUse[1] >= 120.0f) {
|
||||
@ -1238,12 +1270,11 @@ void CHud::DrawAfterFade()
|
||||
m_BigMessage[1][0] = 0;
|
||||
BigMessageAlpha[1] = 0.0f;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
BigMessageX[1] += (CTimer::GetTimeStepInMilliseconds() * 0.3f);
|
||||
BigMessageAlpha[1] += (CTimer::GetTimeStepInMilliseconds() * 0.3f);
|
||||
|
||||
if (BigMessageAlpha[1] >= 255.0f)
|
||||
if (BigMessageAlpha[1] > 255.0f)
|
||||
BigMessageAlpha[1] = 255.0f;
|
||||
}
|
||||
|
||||
@ -1281,7 +1312,7 @@ void CHud::GetRidOfAllHudMessages()
|
||||
m_HelpMessageFadeTimer = 0;
|
||||
m_HelpMessageState = 0;
|
||||
m_HelpMessageQuick = 0;
|
||||
m_HelpMessageDisplayTime = 1.0f;
|
||||
m_fHelpMessageTime = 1.0f;
|
||||
m_VehicleName = nil;
|
||||
m_pLastVehicleName = nil;
|
||||
m_pVehicleNameToPrint = nil;
|
||||
@ -1311,7 +1342,7 @@ void CHud::Initialise()
|
||||
CTxdStore::PopCurrentTxd();
|
||||
CTxdStore::SetCurrentTxd(HudTXD);
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(WeaponFilenames); i++) {
|
||||
for (int i = 0; i < NUM_HUD_SPRITES; i++) {
|
||||
Sprites[i].SetTexture(WeaponFilenames[i].name, WeaponFilenames[i].mask);
|
||||
}
|
||||
|
||||
@ -1322,14 +1353,14 @@ void CHud::Initialise()
|
||||
if (gpRocketSightTex == nil)
|
||||
gpRocketSightTex = RwTextureRead("siterocket", nil);
|
||||
|
||||
CounterOnLastFrame = 0;
|
||||
CounterOnLastFrame = false;
|
||||
m_ItemToFlash = ITEM_NONE;
|
||||
OddJob2Timer = 0;
|
||||
OddJob2OffTimer = 0.0f;
|
||||
OddJob2On = 0;
|
||||
OddJob2XOffset = 0.0f;
|
||||
CounterFlashTimer = 0;
|
||||
TimerOnLastFrame = 0;
|
||||
TimerOnLastFrame = false;
|
||||
TimerFlashTimer = 0;
|
||||
SpriteBrightness = 0;
|
||||
PagerOn = 0;
|
||||
@ -1346,14 +1377,14 @@ void CHud::ReInitialise() {
|
||||
|
||||
GetRidOfAllHudMessages();
|
||||
|
||||
CounterOnLastFrame = 0;
|
||||
CounterOnLastFrame = false;
|
||||
m_ItemToFlash = ITEM_NONE;
|
||||
OddJob2Timer = 0;
|
||||
OddJob2OffTimer = 0.0f;
|
||||
OddJob2On = 0;
|
||||
OddJob2XOffset = 0.0f;
|
||||
CounterFlashTimer = 0;
|
||||
TimerOnLastFrame = 0;
|
||||
TimerOnLastFrame = false;
|
||||
TimerFlashTimer = 0;
|
||||
SpriteBrightness = 0;
|
||||
PagerOn = 0;
|
||||
@ -1443,7 +1474,7 @@ void CHud::SetZoneName(wchar *name)
|
||||
|
||||
void CHud::Shutdown()
|
||||
{
|
||||
for (int i = 0; i < ARRAY_SIZE(WeaponFilenames); ++i) {
|
||||
for (int i = 0; i < NUM_HUD_SPRITES; ++i) {
|
||||
Sprites[i].Delete();
|
||||
}
|
||||
|
||||
|
@ -27,59 +27,60 @@ enum eSprites
|
||||
HUD_RADARDISC = 15,
|
||||
HUD_PAGER = 16,
|
||||
HUD_SITESNIPER = 20,
|
||||
HUD_SITEM16 = 21
|
||||
HUD_SITEM16,
|
||||
HUD_SITEROCKET,
|
||||
NUM_HUD_SPRITES,
|
||||
};
|
||||
|
||||
class CHud
|
||||
{
|
||||
public:
|
||||
static CSprite2d *Sprites;
|
||||
static int32 &SpriteBrightness;
|
||||
static CSprite2d Sprites[NUM_HUD_SPRITES];
|
||||
static wchar m_HelpMessage[256];
|
||||
static wchar m_LastHelpMessage[256];
|
||||
static int32 &m_HelpMessageState;
|
||||
static int32 &m_HelpMessageTimer;
|
||||
static int32 &m_HelpMessageFadeTimer;
|
||||
static wchar *m_HelpMessageToPrint;
|
||||
static uint32 m_HelpMessageState;
|
||||
static uint32 m_HelpMessageTimer;
|
||||
static int32 m_HelpMessageFadeTimer;
|
||||
static wchar m_HelpMessageToPrint[256];
|
||||
static float &m_HelpMessageDisplayTime;
|
||||
static float &m_fTextBoxNumLines;
|
||||
static float &m_fHelpMessageTime;
|
||||
static bool &m_HelpMessageQuick;
|
||||
static int32 m_ZoneState;
|
||||
static float m_fHelpMessageTime;
|
||||
static bool m_HelpMessageQuick;
|
||||
static uint32 m_ZoneState;
|
||||
static int32 m_ZoneFadeTimer;
|
||||
static int32 m_ZoneNameTimer;
|
||||
static wchar *&m_pZoneName;
|
||||
static uint32 m_ZoneNameTimer;
|
||||
static wchar *m_pZoneName;
|
||||
static wchar *m_pLastZoneName;
|
||||
static wchar *m_ZoneToPrint;
|
||||
static wchar *&m_VehicleName;
|
||||
static wchar *m_VehicleName;
|
||||
static wchar *m_pLastVehicleName;
|
||||
static wchar *m_pVehicleNameToPrint;
|
||||
static int32 m_VehicleState;
|
||||
static uint32 m_VehicleState;
|
||||
static int32 m_VehicleFadeTimer;
|
||||
static int32 m_VehicleNameTimer;
|
||||
static wchar *m_Message;
|
||||
static wchar *m_PagerMessage;
|
||||
static bool &m_Wants_To_Draw_Hud;
|
||||
static bool &m_Wants_To_Draw_3dMarkers;
|
||||
static wchar(&m_BigMessage)[6][128];
|
||||
static int16 &m_ItemToFlash;
|
||||
static uint32 m_VehicleNameTimer;
|
||||
static wchar m_Message[256];
|
||||
static wchar m_PagerMessage[256];
|
||||
static bool m_Wants_To_Draw_Hud;
|
||||
static bool m_Wants_To_Draw_3dMarkers;
|
||||
static wchar m_BigMessage[6][128];
|
||||
static int16 m_ItemToFlash;
|
||||
|
||||
// These aren't really in CHud
|
||||
static float BigMessageInUse[6];
|
||||
static float BigMessageAlpha[6];
|
||||
static float BigMessageX[6];
|
||||
static float &OddJob2OffTimer;
|
||||
static int8 &CounterOnLastFrame;
|
||||
static float &OddJob2XOffset;
|
||||
static int16 &CounterFlashTimer;
|
||||
static int16 &OddJob2Timer;
|
||||
static int8 &TimerOnLastFrame;
|
||||
static int16 &OddJob2On;
|
||||
static int16 &TimerFlashTimer;
|
||||
static int16 &PagerSoundPlayed;
|
||||
static float &PagerXOffset;
|
||||
static int16 &PagerTimer;
|
||||
static int16 &PagerOn;
|
||||
static float OddJob2OffTimer;
|
||||
static bool CounterOnLastFrame;
|
||||
static float OddJob2XOffset;
|
||||
static uint16 CounterFlashTimer;
|
||||
static uint16 OddJob2Timer;
|
||||
static bool TimerOnLastFrame;
|
||||
static int16 OddJob2On;
|
||||
static uint16 TimerFlashTimer;
|
||||
static int16 PagerSoundPlayed;
|
||||
static int32 SpriteBrightness;
|
||||
static float PagerXOffset;
|
||||
static int16 PagerTimer;
|
||||
static int16 PagerOn;
|
||||
|
||||
public:
|
||||
static void Draw();
|
||||
|
@ -4,12 +4,13 @@
|
||||
#include "Camera.h"
|
||||
#include "MBlur.h"
|
||||
|
||||
// Originally taken from RW example 'mblur'
|
||||
|
||||
RwRaster *&CMBlur::pFrontBuffer = *(RwRaster**)0x8E2C48;
|
||||
bool &CMBlur::ms_bJustInitialised = *(bool*)0x95CDAB;
|
||||
bool &CMBlur::BlurOn = *(bool*)0x95CDAD;
|
||||
|
||||
static RwIm2DVertex Vertex[4];
|
||||
//static RwIm2DVertex *Vertex = (RwIm2DVertex*)0x62F780;
|
||||
static RwImVertexIndex Index[6] = { 0, 1, 2, 0, 2, 3 };
|
||||
|
||||
void
|
||||
|
@ -15,6 +15,9 @@
|
||||
#include "Timer.h"
|
||||
#include "Lights.h"
|
||||
|
||||
RpClump *gpPlayerClump;
|
||||
float gOldFov;
|
||||
|
||||
int CPlayerSkin::m_txdSlot;
|
||||
|
||||
void
|
||||
@ -92,7 +95,7 @@ CPlayerSkin::GetSkinTexture(const char *texName)
|
||||
CTxdStore::SetCurrentTxd(m_txdSlot);
|
||||
tex = RwTextureRead(texName, NULL);
|
||||
CTxdStore::PopCurrentTxd();
|
||||
if (tex) return tex;
|
||||
if (tex != nil) return tex;
|
||||
|
||||
if (strcmp(DEFAULT_SKIN_NAME, texName) == 0)
|
||||
sprintf(gString, "models\\generic\\player.bmp");
|
||||
@ -106,7 +109,9 @@ CPlayerSkin::GetSkinTexture(const char *texName)
|
||||
|
||||
tex = RwTextureCreate(raster);
|
||||
RwTextureSetName(tex, texName);
|
||||
#ifdef FIX_BUGS
|
||||
RwTextureSetFilterMode(tex, rwFILTERLINEAR); // filtering bugfix from VC
|
||||
#endif
|
||||
RwTexDictionaryAddTexture(CTxdStore::GetSlot(m_txdSlot)->texDict, tex);
|
||||
|
||||
RwImageDestroy(image);
|
||||
@ -137,15 +142,11 @@ CPlayerSkin::RenderFrontendSkinEdit(void)
|
||||
{
|
||||
static float rotation = 0.0f;
|
||||
RwRGBAReal AmbientColor = { 0.65f, 0.65f, 0.65f, 1.0f };
|
||||
RwV3d pos = { 1.35f, 0.35f, 7.725f };
|
||||
const RwV3d pos = { 1.35f, 0.35f, 7.725f };
|
||||
const RwV3d axis1 = { 1.0f, 0.0f, 0.0f };
|
||||
const RwV3d axis2 = { 0.0f, 0.0f, 1.0f };
|
||||
static uint32 LastFlash = 0;
|
||||
|
||||
#ifdef ASPECT_RATIO_SCALE
|
||||
pos.x = 1.35f * (SCREEN_ASPECT_RATIO / DEFAULT_ASPECT_RATIO);
|
||||
#endif
|
||||
|
||||
RwFrame *frame = RpClumpGetFrame(gpPlayerClump);
|
||||
|
||||
if (CTimer::GetTimeInMillisecondsPauseMode() - LastFlash > 7) {
|
@ -2,12 +2,6 @@
|
||||
|
||||
#define DEFAULT_SKIN_NAME "$$\"\""
|
||||
|
||||
static RpClump *gpPlayerClump;// = *(RpClump**)0x660FF8;
|
||||
static float gOldFov;// = *(float*)0x660FFC;
|
||||
|
||||
void LoadPlayerDff(void);
|
||||
void FindPlayerDff(uint32 &offset, uint32 &size);
|
||||
|
||||
class CPlayerSkin
|
||||
{
|
||||
static int m_txdSlot;
|
@ -29,7 +29,7 @@ class CRenderer
|
||||
static CVehicle *&m_pFirstPersonVehicle;
|
||||
|
||||
public:
|
||||
static float &ms_lodDistScale; // defined in Frontend.cpp
|
||||
static float ms_lodDistScale; // defined in Frontend.cpp
|
||||
static bool &m_loadingPriority;
|
||||
|
||||
static void Init(void);
|
||||
|
@ -1,10 +1,420 @@
|
||||
#include "common.h"
|
||||
#include "main.h"
|
||||
#include "patcher.h"
|
||||
#include "General.h"
|
||||
#include "Timer.h"
|
||||
#include "Weather.h"
|
||||
#include "Camera.h"
|
||||
#include "World.h"
|
||||
#include "Vehicle.h"
|
||||
#include "ZoneCull.h"
|
||||
#include "TxdStore.h"
|
||||
#include "RenderBuffer.h"
|
||||
#include "Rubbish.h"
|
||||
|
||||
WRAPPER void CRubbish::Render(void) { EAXJMP(0x512190); }
|
||||
WRAPPER void CRubbish::StirUp(CVehicle *veh) { EAXJMP(0x512690); }
|
||||
WRAPPER void CRubbish::Update(void) { EAXJMP(0x511B90); }
|
||||
WRAPPER void CRubbish::SetVisibility(bool) { EAXJMP(0x512AA0); }
|
||||
WRAPPER void CRubbish::Init(void) { EAXJMP(0x511940); }
|
||||
WRAPPER void CRubbish::Shutdown(void) { EAXJMP(0x511B50); }
|
||||
#define RUBBISH_MAX_DIST (18.0f)
|
||||
#define RUBBISH_FADE_DIST (16.5f)
|
||||
|
||||
RwTexture *gpRubbishTexture[4];
|
||||
RwImVertexIndex RubbishIndexList[6];
|
||||
RwImVertexIndex RubbishIndexList2[6]; // unused
|
||||
RwIm3DVertex RubbishVertices[4];
|
||||
bool CRubbish::bRubbishInvisible;
|
||||
int CRubbish::RubbishVisibility;
|
||||
COneSheet CRubbish::aSheets[NUM_RUBBISH_SHEETS];
|
||||
COneSheet CRubbish::StartEmptyList;
|
||||
COneSheet CRubbish::EndEmptyList;
|
||||
COneSheet CRubbish::StartStaticsList;
|
||||
COneSheet CRubbish::EndStaticsList;
|
||||
COneSheet CRubbish::StartMoversList;
|
||||
COneSheet CRubbish::EndMoversList;
|
||||
|
||||
|
||||
void
|
||||
COneSheet::AddToList(COneSheet *list)
|
||||
{
|
||||
this->m_next = list->m_next;
|
||||
this->m_prev = list;
|
||||
list->m_next = this;
|
||||
this->m_next->m_prev = this;
|
||||
}
|
||||
|
||||
void
|
||||
COneSheet::RemoveFromList(void)
|
||||
{
|
||||
m_next->m_prev = m_prev;
|
||||
m_prev->m_next = m_next;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CRubbish::Render(void)
|
||||
{
|
||||
int type;
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
|
||||
|
||||
for(type = 0; type < 4; type++){
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpRubbishTexture[type]));
|
||||
|
||||
TempBufferIndicesStored = 0;
|
||||
TempBufferVerticesStored = 0;
|
||||
|
||||
COneSheet *sheet;
|
||||
for(sheet = &aSheets[type*NUM_RUBBISH_SHEETS / 4];
|
||||
sheet < &aSheets[(type+1)*NUM_RUBBISH_SHEETS / 4];
|
||||
sheet++){
|
||||
if(sheet->m_state == 0)
|
||||
continue;
|
||||
|
||||
uint32 alpha = 128;
|
||||
CVector pos;
|
||||
if(sheet->m_state == 1){
|
||||
pos = sheet->m_basePos;
|
||||
if(!sheet->m_isVisible)
|
||||
alpha = 0;
|
||||
}else{
|
||||
pos = sheet->m_animatedPos;
|
||||
// Not fully visible during animation, calculate current alpha
|
||||
if(!sheet->m_isVisible || !sheet->m_targetIsVisible){
|
||||
float t = (float)(CTimer::GetTimeInMilliseconds() - sheet->m_moveStart)/sheet->m_moveDuration;
|
||||
float f1 = sheet->m_isVisible ? 1.0f-t : 0.0f;
|
||||
float f2 = sheet->m_targetIsVisible ? t : 0.0f;
|
||||
alpha = 128 * (f1+f2);
|
||||
}
|
||||
}
|
||||
|
||||
float camDist = (pos - TheCamera.GetPosition()).Magnitude2D();
|
||||
if(camDist < RUBBISH_MAX_DIST){
|
||||
if(camDist >= RUBBISH_FADE_DIST)
|
||||
alpha -= alpha*(camDist-RUBBISH_FADE_DIST)/(RUBBISH_MAX_DIST-RUBBISH_FADE_DIST);
|
||||
alpha = (RubbishVisibility*alpha)/256;
|
||||
|
||||
float vx = Sin(sheet->m_angle) * 0.4f;
|
||||
float vy = Cos(sheet->m_angle) * 0.4f;
|
||||
|
||||
int v = TempBufferVerticesStored;
|
||||
RwIm3DVertexSetPos(&TempBufferRenderVertices[v+0], pos.x + vx, pos.y + vy, pos.z);
|
||||
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[v+0], 255, 255, 255, alpha);
|
||||
RwIm3DVertexSetPos(&TempBufferRenderVertices[v+1], pos.x - vy, pos.y + vx, pos.z);
|
||||
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[v+1], 255, 255, 255, alpha);
|
||||
RwIm3DVertexSetPos(&TempBufferRenderVertices[v+2], pos.x + vy, pos.y - vx, pos.z);
|
||||
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[v+2], 255, 255, 255, alpha);
|
||||
RwIm3DVertexSetPos(&TempBufferRenderVertices[v+3], pos.x - vx, pos.y - vy, pos.z);
|
||||
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[v+3], 255, 255, 255, alpha);
|
||||
RwIm3DVertexSetU(&TempBufferRenderVertices[v+0], 0.0f);
|
||||
RwIm3DVertexSetV(&TempBufferRenderVertices[v+0], 0.0f);
|
||||
RwIm3DVertexSetU(&TempBufferRenderVertices[v+1], 1.0f);
|
||||
RwIm3DVertexSetV(&TempBufferRenderVertices[v+1], 0.0f);
|
||||
RwIm3DVertexSetU(&TempBufferRenderVertices[v+2], 0.0f);
|
||||
RwIm3DVertexSetV(&TempBufferRenderVertices[v+2], 1.0f);
|
||||
RwIm3DVertexSetU(&TempBufferRenderVertices[v+3], 1.0f);
|
||||
RwIm3DVertexSetV(&TempBufferRenderVertices[v+3], 1.0f);
|
||||
|
||||
int i = TempBufferIndicesStored;
|
||||
TempBufferRenderIndexList[i+0] = RubbishIndexList[0] + TempBufferVerticesStored;
|
||||
TempBufferRenderIndexList[i+1] = RubbishIndexList[1] + TempBufferVerticesStored;
|
||||
TempBufferRenderIndexList[i+2] = RubbishIndexList[2] + TempBufferVerticesStored;
|
||||
TempBufferRenderIndexList[i+3] = RubbishIndexList[3] + TempBufferVerticesStored;
|
||||
TempBufferRenderIndexList[i+4] = RubbishIndexList[4] + TempBufferVerticesStored;
|
||||
TempBufferRenderIndexList[i+5] = RubbishIndexList[5] + TempBufferVerticesStored;
|
||||
TempBufferVerticesStored += 4;
|
||||
TempBufferIndicesStored += 6;
|
||||
}
|
||||
}
|
||||
|
||||
if(TempBufferIndicesStored != 0){
|
||||
LittleTest();
|
||||
if(RwIm3DTransform(TempBufferRenderVertices, TempBufferVerticesStored, nil, rwIM3D_VERTEXUV)){
|
||||
RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TempBufferRenderIndexList, TempBufferIndicesStored);
|
||||
RwIm3DEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
CRubbish::StirUp(CVehicle *veh)
|
||||
{
|
||||
if((CTimer::GetFrameCounter() ^ (veh->m_randomSeed&3)) == 0)
|
||||
return;
|
||||
|
||||
if(Abs(veh->GetPosition().x - TheCamera.GetPosition().x) < 20.0f &&
|
||||
Abs(veh->GetPosition().y - TheCamera.GetPosition().y) < 20.0f)
|
||||
if(Abs(veh->GetMoveSpeed().x) > 0.05f || Abs(veh->GetMoveSpeed().y) > 0.05f){
|
||||
float speed = veh->GetMoveSpeed().Magnitude2D();
|
||||
if(speed > 0.05f){
|
||||
bool movingForward = DotProduct2D(veh->GetMoveSpeed(), veh->GetForward()) > 0.0f;
|
||||
COneSheet *sheet = StartStaticsList.m_next;
|
||||
CVector2D size = veh->GetColModel()->boundingBox.max;
|
||||
|
||||
// Check all static sheets
|
||||
while(sheet != &EndStaticsList){
|
||||
COneSheet *next = sheet->m_next;
|
||||
CVector2D carToSheet = sheet->m_basePos - veh->GetPosition();
|
||||
float distFwd = DotProduct2D(carToSheet, veh->GetForward());
|
||||
|
||||
// sheet has to be a bit behind car
|
||||
if(movingForward && distFwd < -0.5f*size.y && distFwd > -1.5f*size.y ||
|
||||
!movingForward && distFwd > 0.5f*size.y && distFwd < 1.5f*size.y){
|
||||
float distSide = Abs(DotProduct2D(carToSheet, veh->GetRight()));
|
||||
if(distSide < 1.5*size.x){
|
||||
// Check with higher speed for sheet directly behind car
|
||||
float speedToCheck = distSide < size.x ? speed : speed*0.5f;
|
||||
if(speedToCheck > 0.05f){
|
||||
sheet->m_state = 2;
|
||||
if(speedToCheck > 0.15f)
|
||||
sheet->m_animationType = 2;
|
||||
else
|
||||
sheet->m_animationType = 1;
|
||||
sheet->m_moveDuration = 2000;
|
||||
sheet->m_xDist = veh->GetMoveSpeed().x;
|
||||
sheet->m_yDist = veh->GetMoveSpeed().y;
|
||||
float dist = Sqrt(SQR(sheet->m_xDist)+SQR(sheet->m_yDist));
|
||||
sheet->m_xDist *= 25.0f*speed/dist;
|
||||
sheet->m_yDist *= 25.0f*speed/dist;
|
||||
sheet->m_animHeight = 3.0f*speed;
|
||||
sheet->m_moveStart = CTimer::GetTimeInMilliseconds();
|
||||
float tx = sheet->m_basePos.x + sheet->m_xDist;
|
||||
float ty = sheet->m_basePos.y + sheet->m_yDist;
|
||||
float tz = sheet->m_basePos.z + 3.0f;
|
||||
sheet->m_targetZ = CWorld::FindGroundZFor3DCoord(tx, ty, tz, nil) + 0.1f;
|
||||
sheet->RemoveFromList();
|
||||
sheet->AddToList(&StartMoversList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sheet = next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static float aAnimations[3][34] = {
|
||||
{ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
|
||||
|
||||
// Normal move
|
||||
{ 0.0f, 0.05f, 0.12f, 0.25f, 0.42f, 0.57f, 0.68f, 0.8f, 0.86f, 0.9f, 0.93f, 0.95f, 0.96f, 0.97f, 0.98f, 0.99f, 1.0f, // XY movemnt
|
||||
0.15f, 0.35f, 0.6f, 0.9f, 1.2f, 1.25f, 1.3f, 1.2f, 1.1f, 0.95f, 0.8f, 0.6f, 0.45f, 0.3f, 0.2f, 0.1f, 0 }, // Z movement
|
||||
|
||||
// Stirred up by fast vehicle
|
||||
{ 0.0f, 0.05f, 0.12f, 0.25f, 0.42f, 0.57f, 0.68f, 0.8f, 0.95f, 1.1f, 1.15f, 1.18f, 1.15f, 1.1f, 1.05f, 1.03f, 1.0f,
|
||||
0.15f, 0.35f, 0.6f, 0.9f, 1.2f, 1.25f, 1.3f, 1.2f, 1.1f, 0.95f, 0.8f, 0.6f, 0.45f, 0.3f, 0.2f, 0.1f, 0 }
|
||||
};
|
||||
|
||||
void
|
||||
CRubbish::Update(void)
|
||||
{
|
||||
bool foundGround;
|
||||
|
||||
// FRAMETIME
|
||||
if(bRubbishInvisible)
|
||||
RubbishVisibility = max(RubbishVisibility-5, 0);
|
||||
else
|
||||
RubbishVisibility = min(RubbishVisibility+5, 255);
|
||||
|
||||
// Spawn a new sheet
|
||||
COneSheet *sheet = StartEmptyList.m_next;
|
||||
if(sheet != &EndEmptyList){
|
||||
float spawnDist;
|
||||
float spawnAngle;
|
||||
|
||||
spawnDist = (CGeneral::GetRandomNumber()&0xFF)/256.0f + RUBBISH_MAX_DIST;
|
||||
uint8 r = CGeneral::GetRandomNumber();
|
||||
if(r&1)
|
||||
spawnAngle = (CGeneral::GetRandomNumber()&0xFF)/256.0f * 6.28f;
|
||||
else
|
||||
spawnAngle = (r-128)/160.0f + TheCamera.Orientation;
|
||||
sheet->m_basePos.x = TheCamera.GetPosition().x + spawnDist*Sin(spawnAngle);
|
||||
sheet->m_basePos.y = TheCamera.GetPosition().y + spawnDist*Cos(spawnAngle);
|
||||
sheet->m_basePos.z = CWorld::FindGroundZFor3DCoord(sheet->m_basePos.x, sheet->m_basePos.y, TheCamera.GetPosition().z, &foundGround) + 0.1f;
|
||||
if(foundGround){
|
||||
// Found ground, so add to statics list
|
||||
sheet->m_angle = (CGeneral::GetRandomNumber()&0xFF)/256.0f * 6.28f;
|
||||
sheet->m_state = 1;
|
||||
if(CCullZones::FindAttributesForCoors(sheet->m_basePos, nil) & ATTRZONE_NORAIN)
|
||||
sheet->m_isVisible = false;
|
||||
else
|
||||
sheet->m_isVisible = true;
|
||||
sheet->RemoveFromList();
|
||||
sheet->AddToList(&StartStaticsList);
|
||||
}
|
||||
}
|
||||
|
||||
// Process animation
|
||||
sheet = StartMoversList.m_next;
|
||||
while(sheet != &EndMoversList){
|
||||
uint32 currentTime = CTimer::GetTimeInMilliseconds() - sheet->m_moveStart;
|
||||
if(currentTime < sheet->m_moveDuration){
|
||||
// Animation
|
||||
int step = 16 * currentTime / sheet->m_moveDuration; // 16 steps in animation
|
||||
int stepTime = sheet->m_moveDuration/16; // time in each step
|
||||
float s = (float)(currentTime - stepTime*step) / stepTime; // position on step
|
||||
float t = (float)currentTime / sheet->m_moveDuration; // position on total animation
|
||||
// factors for xy and z-movment
|
||||
float fxy = aAnimations[sheet->m_animationType][step]*(1.0f-s) + aAnimations[sheet->m_animationType][step+1]*s;
|
||||
float fz = aAnimations[sheet->m_animationType][step+17]*(1.0f-s) + aAnimations[sheet->m_animationType][step+1+17]*s;
|
||||
sheet->m_animatedPos.x = sheet->m_basePos.x + fxy*sheet->m_xDist;
|
||||
sheet->m_animatedPos.y = sheet->m_basePos.y + fxy*sheet->m_yDist;
|
||||
sheet->m_animatedPos.z = (1.0f-t)*sheet->m_basePos.z + t*sheet->m_targetZ + fz*sheet->m_animHeight;
|
||||
sheet->m_angle += CTimer::GetTimeStep()*0.04f;
|
||||
if(sheet->m_angle > 6.28f)
|
||||
sheet->m_angle -= 6.28f;
|
||||
sheet = sheet->m_next;
|
||||
}else{
|
||||
// End of animation, back into statics list
|
||||
sheet->m_basePos.x += sheet->m_xDist;
|
||||
sheet->m_basePos.y += sheet->m_yDist;
|
||||
sheet->m_basePos.z = sheet->m_targetZ;
|
||||
sheet->m_state = 1;
|
||||
sheet->m_isVisible = sheet->m_targetIsVisible;
|
||||
|
||||
COneSheet *next = sheet->m_next;
|
||||
sheet->RemoveFromList();
|
||||
sheet->AddToList(&StartStaticsList);
|
||||
sheet = next;
|
||||
}
|
||||
}
|
||||
|
||||
// Stir up a sheet by wind
|
||||
// FRAMETIME
|
||||
int freq;
|
||||
if(CWeather::Wind < 0.1f)
|
||||
freq = 31;
|
||||
else if(CWeather::Wind < 0.4f)
|
||||
freq = 7;
|
||||
else if(CWeather::Wind < 0.7f)
|
||||
freq = 1;
|
||||
else
|
||||
freq = 0;
|
||||
if((CTimer::GetFrameCounter() & freq) == 0){
|
||||
// Pick a random sheet and set animation state if static
|
||||
int i = CGeneral::GetRandomNumber() % NUM_RUBBISH_SHEETS;
|
||||
if(aSheets[i].m_state == 1){
|
||||
aSheets[i].m_moveStart = CTimer::GetTimeInMilliseconds();
|
||||
aSheets[i].m_moveDuration = CWeather::Wind*1500.0f + 1000.0f;
|
||||
aSheets[i].m_animHeight = 0.2f;
|
||||
aSheets[i].m_xDist = 3.0f*CWeather::Wind;
|
||||
aSheets[i].m_yDist = 3.0f*CWeather::Wind;
|
||||
// Check if target position is ok
|
||||
float tx = aSheets[i].m_basePos.x + aSheets[i].m_xDist;
|
||||
float ty = aSheets[i].m_basePos.y + aSheets[i].m_yDist;
|
||||
float tz = aSheets[i].m_basePos.z + 3.0f;
|
||||
aSheets[i].m_targetZ = CWorld::FindGroundZFor3DCoord(tx, ty, tz, &foundGround) + 0.1f;
|
||||
if(CCullZones::FindAttributesForCoors(CVector(tx, ty, aSheets[i].m_targetZ), nil) & ATTRZONE_NORAIN)
|
||||
aSheets[i].m_targetIsVisible = false;
|
||||
else
|
||||
aSheets[i].m_targetIsVisible = true;
|
||||
if(foundGround){
|
||||
// start animation
|
||||
aSheets[i].m_state = 2;
|
||||
aSheets[i].m_animationType = 1;
|
||||
aSheets[i].RemoveFromList();
|
||||
aSheets[i].AddToList(&StartMoversList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove sheets that are too far away
|
||||
int i = (CTimer::GetFrameCounter()%(NUM_RUBBISH_SHEETS/4))*4;
|
||||
int last = ((CTimer::GetFrameCounter()%(NUM_RUBBISH_SHEETS/4)) + 1)*4;
|
||||
for(; i < last; i++){
|
||||
if(aSheets[i].m_state == 1 &&
|
||||
(aSheets[i].m_basePos - TheCamera.GetPosition()).MagnitudeSqr2D() > SQR(RUBBISH_MAX_DIST+1.0f)){
|
||||
aSheets[i].m_state = 0;
|
||||
aSheets[i].RemoveFromList();
|
||||
aSheets[i].AddToList(&StartEmptyList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CRubbish::SetVisibility(bool visible)
|
||||
{
|
||||
bRubbishInvisible = !visible;
|
||||
}
|
||||
|
||||
void
|
||||
CRubbish::Init(void)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < NUM_RUBBISH_SHEETS; i++){
|
||||
aSheets[i].m_state = 0;
|
||||
if(i < NUM_RUBBISH_SHEETS-1)
|
||||
aSheets[i].m_next = &aSheets[i+1];
|
||||
else
|
||||
aSheets[i].m_next = &EndEmptyList;
|
||||
if(i > 0)
|
||||
aSheets[i].m_prev = &aSheets[i-1];
|
||||
else
|
||||
aSheets[i].m_prev = &StartEmptyList;
|
||||
}
|
||||
|
||||
StartEmptyList.m_next = &aSheets[0];
|
||||
StartEmptyList.m_prev = nil;
|
||||
EndEmptyList.m_next = nil;
|
||||
EndEmptyList.m_prev = &aSheets[NUM_RUBBISH_SHEETS-1];
|
||||
|
||||
StartStaticsList.m_next = &EndStaticsList;
|
||||
StartStaticsList.m_prev = nil;
|
||||
EndStaticsList.m_next = nil;
|
||||
EndStaticsList.m_prev = &StartStaticsList;
|
||||
|
||||
StartMoversList.m_next = &EndMoversList;
|
||||
StartMoversList.m_prev = nil;
|
||||
EndMoversList.m_next = nil;
|
||||
EndMoversList.m_prev = &StartMoversList;
|
||||
|
||||
// unused
|
||||
RwIm3DVertexSetU(&RubbishVertices[0], 0.0f);
|
||||
RwIm3DVertexSetV(&RubbishVertices[0], 0.0f);
|
||||
RwIm3DVertexSetU(&RubbishVertices[1], 1.0f);
|
||||
RwIm3DVertexSetV(&RubbishVertices[1], 0.0f);
|
||||
RwIm3DVertexSetU(&RubbishVertices[2], 0.0f);
|
||||
RwIm3DVertexSetV(&RubbishVertices[2], 1.0f);
|
||||
RwIm3DVertexSetU(&RubbishVertices[3], 1.0f);
|
||||
RwIm3DVertexSetV(&RubbishVertices[3], 1.0f);
|
||||
|
||||
// unused
|
||||
RubbishIndexList2[0] = 0;
|
||||
RubbishIndexList2[1] = 2;
|
||||
RubbishIndexList2[2] = 1;
|
||||
RubbishIndexList2[3] = 1;
|
||||
RubbishIndexList2[4] = 2;
|
||||
RubbishIndexList2[5] = 3;
|
||||
|
||||
RubbishIndexList[0] = 0;
|
||||
RubbishIndexList[1] = 1;
|
||||
RubbishIndexList[2] = 2;
|
||||
RubbishIndexList[3] = 1;
|
||||
RubbishIndexList[4] = 3;
|
||||
RubbishIndexList[5] = 2;
|
||||
|
||||
CTxdStore::PushCurrentTxd();
|
||||
int slot = CTxdStore::FindTxdSlot("particle");
|
||||
CTxdStore::SetCurrentTxd(slot);
|
||||
gpRubbishTexture[0] = RwTextureRead("gameleaf01_64", nil);
|
||||
gpRubbishTexture[1] = RwTextureRead("gameleaf02_64", nil);
|
||||
gpRubbishTexture[2] = RwTextureRead("newspaper01_64", nil);
|
||||
gpRubbishTexture[3] = RwTextureRead("newspaper02_64", nil);
|
||||
CTxdStore::PopCurrentTxd();
|
||||
RubbishVisibility = 255;
|
||||
bRubbishInvisible = false;
|
||||
}
|
||||
|
||||
void
|
||||
CRubbish::Shutdown(void)
|
||||
{
|
||||
RwTextureDestroy(gpRubbishTexture[0]);
|
||||
RwTextureDestroy(gpRubbishTexture[1]);
|
||||
RwTextureDestroy(gpRubbishTexture[2]);
|
||||
RwTextureDestroy(gpRubbishTexture[3]);
|
||||
}
|
||||
|
@ -2,13 +2,50 @@
|
||||
|
||||
class CVehicle;
|
||||
|
||||
enum {
|
||||
// NB: not all values are allowed, check the code
|
||||
NUM_RUBBISH_SHEETS = 64
|
||||
};
|
||||
|
||||
class COneSheet
|
||||
{
|
||||
public:
|
||||
CVector m_basePos;
|
||||
CVector m_animatedPos;
|
||||
float m_targetZ;
|
||||
int8 m_state;
|
||||
int8 m_animationType;
|
||||
uint32 m_moveStart;
|
||||
uint32 m_moveDuration;
|
||||
float m_animHeight;
|
||||
float m_xDist;
|
||||
float m_yDist;
|
||||
float m_angle;
|
||||
bool m_isVisible;
|
||||
bool m_targetIsVisible;
|
||||
COneSheet *m_next;
|
||||
COneSheet *m_prev;
|
||||
|
||||
void AddToList(COneSheet *list);
|
||||
void RemoveFromList(void);
|
||||
};
|
||||
|
||||
class CRubbish
|
||||
{
|
||||
static bool bRubbishInvisible;
|
||||
static int RubbishVisibility;
|
||||
static COneSheet aSheets[NUM_RUBBISH_SHEETS];
|
||||
static COneSheet StartEmptyList;
|
||||
static COneSheet EndEmptyList;
|
||||
static COneSheet StartStaticsList;
|
||||
static COneSheet EndStaticsList;
|
||||
static COneSheet StartMoversList;
|
||||
static COneSheet EndMoversList;
|
||||
public:
|
||||
static void Render(void);
|
||||
static void StirUp(CVehicle *veh); // CAutomobile on PS2
|
||||
static void Update(void);
|
||||
static void SetVisibility(bool);
|
||||
static void SetVisibility(bool visible);
|
||||
static void Init(void);
|
||||
static void Shutdown(void);
|
||||
};
|
||||
|
@ -175,11 +175,18 @@ public:
|
||||
static void RenderIndicatorShadow (uint32 nID, uint8 ShadowType, RwTexture *pTexture, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity);
|
||||
};
|
||||
|
||||
extern RwTexture *&gpBloodPoolTex;
|
||||
extern RwTexture *&gpShadowCarTex;
|
||||
extern RwTexture *&gpShadowPedTex;
|
||||
extern RwTexture *&gpShadowHeliTex;
|
||||
extern RwTexture *&gpShadowExplosionTex;
|
||||
extern RwTexture *&gpShadowHeadLightsTex;
|
||||
extern RwTexture *&gpGoalTex;
|
||||
extern RwTexture *&gpOutline1Tex;
|
||||
extern RwTexture *&gpOutline2Tex;
|
||||
extern RwTexture *&gpOutline3Tex;
|
||||
extern RwTexture *&gpBloodPoolTex;
|
||||
extern RwTexture *&gpReflectionTex;
|
||||
extern RwTexture *&gpGoalMarkerTex;
|
||||
extern RwTexture *&gpWalkDontTex;
|
||||
extern RwTexture *&gpCrackedGlassTex;
|
||||
extern RwTexture *&gpPostShadowTex;
|
||||
extern RwTexture *&gpGoalTex;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user