Merge pull request #8 from GTAmodding/master

upd
This commit is contained in:
Fire_Head 2019-06-17 13:37:59 +03:00 committed by GitHub
commit 0bb8bf9d15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
80 changed files with 3839 additions and 714 deletions

View File

@ -1,5 +1,7 @@
image: Visual Studio 2017
configuration: ReleaseCI
configuration:
- DebugCI
- ReleaseCI
platform:
- Win32
environment:
@ -14,4 +16,5 @@ build:
project: c:\projects\re3\build\re3.sln
verbosity: minimal
artifacts:
- path: bin/ReleaseCI/re3.dll
path: bin/%CONFIGURATION%/re3.dll

View File

@ -4,8 +4,12 @@ The aim of this project is to reverse GTA III for PC by replacing
parts of the game [one by one](https://en.wikipedia.org/wiki/Ship_of_Theseus)
such that we have a working game at all times.
Apparently you can download a binary of the latest version
[here](https://ci.appveyor.com/api/projects/aap/re3/artifacts/bin%2FReleaseCI%2Fre3.dll?branch=master).
Apparently you can download a binary of the latest version here:
[Debug](https://ci.appveyor.com/api/projects/aap/re3/artifacts/bin/DebugCI/re3.dll?branch=master&job=Configuration%3A+DebugCI),
[Release](https://ci.appveyor.com/api/projects/aap/re3/artifacts/bin/ReleaseCI/re3.dll?branch=master&job=Configuration%3A+ReleaseCI).
Build status:
[![Build status](https://ci.appveyor.com/api/projects/status/hyiwgegks122h8jg?svg=true)](https://ci.appveyor.com/project/aap/re3/branch/master)
Re3 starts the script main_freeroam.scm by default. Make sure you copy it to your data directory.
@ -20,6 +24,7 @@ to reverse at the time, calling the original functions is acceptable.
This is a list of some things that have been reversed to some non-trivial extent.
Not everything is listed, check the code.
(TODO: keep this list at least a bit up to date...)
```
CPool
@ -48,6 +53,11 @@ CPathFind
CCam
CParticle
CParticleMgr
CPointLights
CCoronas
CAntennas
CClouds
CHud
```
# Low hanging fruit
@ -75,9 +85,12 @@ functionname(args)
if(a == b){
s1;
s2;
}else{
s3;
s4;
}
if(x != y)
s3;
s5;
}
type functionname(args)
@ -85,9 +98,12 @@ type functionname(args)
if (a == b) {
s1;
s2;
} else {
s3;
s4;
}
if (x != y)
s3;
s5;
}
```
@ -101,14 +117,31 @@ type functionname ( args )
s1;
s2;
}
if ( x != y )
else
{
s3;
s4;
}
if ( x != y )
{
s5;
}
}
```
Indentation is done with TABS.
i.e.
* Put the brace on the same line as control statements
* Put the brace on the next line after function definitions and structs/classes
* Put an `else` on the same line with the braces
* Don't put braces around single statements
* Put the function return type on a separate line
* Indent with TABS
As for the less cosmetic choices, here are some guidelines how the code should look:
@ -128,6 +161,8 @@ since `4` will be used in other places and you can't easily see where else the e
* don't even think about using win32 types (`BYTE`, `WORD`, &c.) unless you're writing win32 specific code
* declare pointers like `int *ptr;`, not `int* ptr;`
* As for variable names, the original gta source code was not written in a uniform style,
but here are some observations:
@ -142,3 +177,10 @@ but here are some observations:
* do *not* use `dw` for `DWORD` or so, we're not programming win32
* Generally, try to make the code look as if R* could have written it
# Environment Variables
Here you can find a list of variables that you might need to set in windows:
```
"GTA_III_RE_DIR" * path to "gta3_re" game folder usually where this plugin run.
"GTA_III_DIR)" * path to "GTAIII" game folder.
```

View File

@ -1,5 +1,5 @@
workspace "re3"
configurations { "ReleaseCI", "Release", "ReleaseFH", "Debug" }
configurations { "DebugCI", "ReleaseCI", "Release", "ReleaseFH", "Debug" }
location "build"
files { "src/*.*" }
@ -42,9 +42,9 @@ project "re3"
defines { "DEBUG" }
staticruntime "on"
symbols "On"
debugdir "C:/Users/aap/games/gta3_re"
debugcommand "C:/Users/aap/games/gta3_re/gta3.exe"
postbuildcommands "copy /y \"$(TargetPath)\" \"C:\\Users\\aap\\games\\gta3_re\\plugins\\re3.dll\""
debugdir "$(GTA_III_RE_DIR)"
debugcommand "$(GTA_III_RE_DIR)/gta3.exe"
postbuildcommands "copy /y \"$(TargetPath)\" \"$(GTA_III_RE_DIR)\\plugins\\re3.dll\""
filter "configurations:Release"
defines { "NDEBUG" }
@ -52,22 +52,21 @@ project "re3"
staticruntime "on"
debugdir "C:/Users/aap/games/gta3_re"
debugcommand "C:/Users/aap/games/gta3_re/gta3.exe"
postbuildcommands "copy /y \"$(TargetPath)\" \"C:\\Users\\aap\\games\\gta3_re\\plugins\\re3.dll\""
postbuildcommands "copy /y \"$(TargetPath)\" \"$(GTA_III_RE_DIR)\\plugins\\re3.dll\""
filter "configurations:ReleaseFH"
defines { "NDEBUG" }
symbols "Full"
optimize "off"
staticruntime "on"
debugdir "F:/Rockstar Games/GTAIII"
debugcommand "F:/Rockstar Games/GTAIII/gta3.exe"
debugdir "$(GTA_III_DIR)"
debugcommand "$(GTA_III_DIR)/gta3.exe"
targetextension ".asi"
targetdir "F:/Rockstar Games/GTAIII/scripts"
targetdir "$(GTA_III_DIR)/scripts"
filter "configurations:DebugCI"
defines { "DEBUG" }
symbols "On"
staticruntime "on"
filter "configurations:ReleaseCI"
defines { "NDEBUG" }
optimize "On"
staticruntime "on"
filter "configurations:DebugCI"
defines { "DEBUG" }
staticruntime "on"
symbols "On"

View File

@ -14,8 +14,7 @@
const float DefaultFOV = 80.0f; // actually 70.0f
CCamera &TheCamera = *(CCamera*)0x6FACF8;
WRAPPER Bool CCam::Using3rdPersonMouseCam() { EAXJMP(0x457460); }
bool &CCamera::m_bUseMouse3rdPerson = *(bool *)0x5F03D8;
WRAPPER void CCamera::DrawBordersForWideScreen(void) { EAXJMP(0x46B430); }
@ -1250,6 +1249,15 @@ CCam::FixCamWhenObscuredByVehicle(const CVector &TargetCoors)
Source.z += HeightFixerCarsObscuring;
}
bool CCam::Using3rdPersonMouseCam()
{
return CCamera::m_bUseMouse3rdPerson &&
(Mode == MODE_FOLLOWPED ||
TheCamera.m_bPlayerIsInGarage &&
FindPlayerPed() && FindPlayerPed()->m_nPedState != PED_DRIVING &&
Mode != MODE_TOPDOWN1 && this->CamTargetEntity == FindPlayerPed());
}
STARTPATCHES
InjectHook(0x42C760, &CCamera::IsSphereVisible, PATCH_JUMP);
InjectHook(0x46FD00, &CCamera::SetFadeColour, PATCH_JUMP);

View File

@ -161,7 +161,6 @@ struct CCam
CPed *m_pLastPedLookedAt;// So interpolation works
bool m_bFirstPersonRunAboutActive;
Bool Using3rdPersonMouseCam();
void GetVectorsReadyForRW(void);
CVector DoAverageOnVector(const CVector &vec);
@ -172,6 +171,7 @@ struct CCam
bool FixCamIfObscured(CVector &TargetCoors, float TargetHeight, float TargetOrientation);
void Cam_On_A_String_Unobscured(const CVector &TargetCoors, float BaseDist);
void FixCamWhenObscuredByVehicle(const CVector &TargetCoors);
bool Using3rdPersonMouseCam();
void Process_Debug(float *vec, float a, float b, float c);
void Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, float, float);
@ -439,6 +439,7 @@ int m_iModeObbeCamIsInForCar;
uint32 m_uiFadeTimeStarted;
uint32 m_uiFadeTimeStartedMusic;
static bool &m_bUseMouse3rdPerson;
CMatrix &GetCameraMatrix(void) { return m_cameraMatrix; }
CVector &GetGameCamPosition(void) { return m_vecGameCamPos; }

View File

@ -6,7 +6,7 @@
#include "Stats.h"
_TODO("gbFastTime");
Bool &gbFastTime = *(Bool*)0x95CDBB;
bool &gbFastTime = *(bool*)0x95CDBB;
uint8 &CClock::ms_nGameClockHours = *(uint8*)0x95CDA6;
uint8 &CClock::ms_nGameClockMinutes = *(uint8*)0x95CDC8;

View File

@ -16,19 +16,19 @@ WRAPPER void CControllerConfigManager::AffectControllerStateOn_ButtonUp(int butt
WRAPPER void CControllerConfigManager::MakeControllerActionsBlank() { EAXJMP(0x58B7A0); }
WRAPPER void CControllerConfigManager::InitDefaultControlConfiguration() { EAXJMP(0x58B930); }
WRAPPER void CControllerConfigManager::InitDefaultControlConfigMouse(CMouseControllerState const &mousestate) { EAXJMP(0x58BD00); }
WRAPPER Int32 CControllerConfigManager::GetJoyButtonJustDown() { EAXJMP(0x58B7D0); }
WRAPPER int32 CControllerConfigManager::GetJoyButtonJustDown() { EAXJMP(0x58B7D0); }
WRAPPER void CControllerConfigManager::InitDefaultControlConfigJoyPad(unsigned int buttons) { EAXJMP(0x58BD90); }
WRAPPER void CControllerConfigManager::ClearSimButtonPressCheckers() { EAXJMP(0x58D220); }
WRAPPER void CControllerConfigManager::AffectPadFromKeyBoard() { EAXJMP(0x58D0C0); }
WRAPPER void CControllerConfigManager::AffectPadFromMouse() { EAXJMP(0x58D1A0); }
void CControllerConfigManager::LoadSettings(Int32 file)
void CControllerConfigManager::LoadSettings(int32 file)
{
Bool bValid = true;
bool bValid = true;
if ( file )
{
Char buff[29];
char buff[29];
CFileMgr::Read(file, buff, sizeof(buff));
if ( !strncmp(buff, "THIS FILE IS NOT VALID YET", sizeof(buff) - 3) )
@ -45,7 +45,7 @@ void CControllerConfigManager::LoadSettings(Int32 file)
{
for ( int j = 0; j < 41; j++ )
{
CFileMgr::Read(file, (Char *)&ControlsManager.m_aSettings[j][i], sizeof(tControllerConfigBind));
CFileMgr::Read(file, (char *)&ControlsManager.m_aSettings[j][i], sizeof(tControllerConfigBind));
}
}
}

View File

@ -19,19 +19,19 @@ public:
struct tControllerConfigBind
{
RsKeyCodes m_Key;
Int32 m_ContSetOrder;
int32 m_ContSetOrder;
};
Bool field_0;
bool field_0;
char _pad0[3];
DIJOYSTATE2 m_OldState;
DIJOYSTATE2 m_NewState;
WChar m_aActionNames[41][40];
Bool m_aButtonStates[17];
wchar m_aActionNames[41][40];
bool m_aButtonStates[17];
char _pad1[3];
tControllerConfigBind m_aSettings[41][4];
UInt8 m_aSimCheckers[4][4];
Bool m_bMouseAssociated;
uint8 m_aSimCheckers[4][4];
bool m_bMouseAssociated;
char _pad2[3];
void UpdateJoyButtonState(int padnumber);
@ -40,8 +40,8 @@ public:
void UpdateJoyInConfigMenus_ButtonUp(int button, int padnumber);
void AffectControllerStateOn_ButtonUp(int button, int padnumber);
Int32 GetJoyButtonJustDown();
void LoadSettings(Int32 file);
int32 GetJoyButtonJustDown();
void LoadSettings(int32 file);
void MakeControllerActionsBlank();
void InitDefaultControlConfiguration();
void InitDefaultControlConfigMouse(CMouseControllerState const &mousestate);

View File

@ -6,6 +6,7 @@
#include "Timer.h"
#include "Camera.h"
#include "World.h"
#include "FileMgr.h"
#include "CullZones.h"
int32 &CCullZones::NumCullZones = *(int*)0x8F2564;
@ -45,6 +46,27 @@ CCullZones::Init(void)
aPointersToBigBuildingsForTreadables[i] = -1;
}
void
CCullZones::ResolveVisibilities(void)
{
int fd;
CFileMgr::SetDir("");
fd = CFileMgr::OpenFile("DATA\\cullzone.dat", "rb");
if(fd > 0){
CFileMgr::Read(fd, (char*)&NumCullZones, 4);
CFileMgr::Read(fd, (char*)aZones, NUMCULLZONES*sizeof(CCullZone));
CFileMgr::Read(fd, (char*)&NumAttributeZones, 4);
CFileMgr::Read(fd, (char*)aAttributeZones, NUMATTRIBZONES*sizeof(CAttributeZone));
CFileMgr::Read(fd, (char*)aIndices, NUMZONEINDICES*2);
CFileMgr::Read(fd, (char*)aPointersToBigBuildingsForBuildings, NUMBUILDINGS*2);
CFileMgr::Read(fd, (char*)aPointersToBigBuildingsForTreadables, NUMTREADABLES*2);
CFileMgr::CloseFile(fd);
}else{
// TODO: implement code from mobile to generate data here
}
}
void
CCullZones::Update(void)
{
@ -311,6 +333,7 @@ CCullZone::DoStuffEnteringZone_OneTreadable(uint16 i)
STARTPATCHES
InjectHook(0x524BC0, &CCullZones::Init, PATCH_JUMP);
InjectHook(0x524EC0, &CCullZones::ResolveVisibilities, PATCH_JUMP);
InjectHook(0x524F80, &CCullZones::Update, PATCH_JUMP);
InjectHook(0x525370, &CCullZones::AddCullZone, PATCH_JUMP);
InjectHook(0x5250D0, &CCullZones::ForceCullZoneCoors, PATCH_JUMP);

View File

@ -71,6 +71,7 @@ public:
static bool &bCullZonesDisabled;
static void Init(void);
static void ResolveVisibilities(void);
static void Update(void);
static void ForceCullZoneCoors(CVector coors);
static int32 FindCullZoneForCoors(CVector coors);

View File

@ -2,15 +2,30 @@
#include "patcher.h"
#include "Frontend.h"
int &CMenuManager::OS_Language = *(int*)0x5F2F78;
int &CMenuManager::m_PrefsBrightness = *(int*)0x5F2E50;
int &CMenuManager::m_PrefsLanguage = *(int*)0x941238;
bool &CMenuManager::m_PrefsUseWideScreen = *(bool*)0x95CD23;
Bool &CMenuManager::m_PrefsVsync = *(Bool*)0x5F2E58;
Bool &CMenuManager::m_PrefsAllowNastyGame = *(Bool*)0x5F2E64;
Bool &CMenuManager::m_bStartUpFrontEndRequested = *(Bool*)0x95CCF4;
Bool &CMenuManager::m_PrefsFrameLimiter = *(Bool*)0x5F2E60;
Bool &CMenuManager::m_PrefsUseVibration = *(Bool*)0x95CD92;
int32 &CMenuManager::OS_Language = *(int32*)0x5F2F78;
int8 &CMenuManager::m_PrefsUseVibration = *(int8*)0x95CD92;
int8 &CMenuManager::m_DisplayControllerOnFoot = *(int8*)0x95CD8D;
int8 &CMenuManager::m_PrefsVsync = *(int8*)0x5F2E58;
int8 &CMenuManager::m_PrefsVsyncDisp = *(int8*)0x5F2E5C;
int8 &CMenuManager::m_PrefsFrameLimiter = *(int8*)0x5F2E60;
int8 &CMenuManager::BlurOn = *(int8*)0x95CDAD;
int8 &CMenuManager::m_PrefsShowSubtitles = *(int8*)0x5F2E54;
int8 &CMenuManager::m_PrefsSpeakers = *(int8*)0x95CD7E;
int8 &CMenuManager::m_ControlMethod = *(int8*)0x8F5F7C;
int8 &CMenuManager::m_PrefsDMA = *(int8*)0x5F2F74;
int8 &CMenuManager::m_PrefsLanguage = *(int8*)0x941238;
bool &CMenuManager::m_PrefsAllowNastyGame = *(bool*)0x5F2E64;
bool &CMenuManager::m_bStartUpFrontEndRequested = *(bool*)0x95CCF4;
int8 &CMenuManager::m_PrefsUseWideScreen = *(int8*)0x95CD23;
int8 &CMenuManager::m_PrefsRadioStation = *(int8*)0x95CDA4;
int8 &CMenuManager::m_bDisableMouseSteering = *(int8*)0x60252C;
int32 &CMenuManager::m_PrefsBrightness = *(int32*)0x5F2E50;
float &CMenuManager::m_PrefsLOD = *(float*)0x8F42C4;
int8 &CMenuManager::m_bFrontEnd_ReloadObrTxtGxt = *(int8*)0x628CFC;
int32 &CMenuManager::m_PrefsMusicVolume = *(int32*)0x5F2E4C;
int32 &CMenuManager::m_PrefsSfxVolume = *(int32*)0x5F2E48;
CMenuManager &FrontEndMenuManager = *(CMenuManager*)0x8F59D8;
@ -20,3 +35,19 @@ WRAPPER void CMenuManager::UnloadTextures(void) { EAXJMP(0x47A440); }
WRAPPER void CMenuManager::LoadAllTextures(void) { EAXJMP(0x47A230); }
WRAPPER void CMenuManager::LoadSettings(void) { EAXJMP(0x488EE0); }
WRAPPER void CMenuManager::WaitForUserCD(void) { EAXJMP(0x48ADD0); }
int CMenuManager::FadeIn(int alpha) {
if (m_nCurrScreen == MENU_LOADING_IN_PROGRESS ||
m_nCurrScreen == MENU_SAVING_IN_PROGRESS ||
m_nCurrScreen == MENU_DELETING)
return alpha;
if (m_nMenuFadeAlpha >= alpha)
return alpha;
return m_nMenuFadeAlpha;
}
STARTPATCHES
InjectHook(0x48AC60, &CMenuManager::FadeIn, PATCH_JUMP);
ENDPATCHES

View File

@ -10,6 +10,68 @@ enum {
LANGUAGE_SPANISH,
};
enum eMenuScreen {
MENU_NONE = 0,
MENU_STATS = 1,
MENU_NEW_GAME = 2,
MENU_BRIEFS = 3,
MENU_CONTROLLER_SETTINGS = 4,
MENU_SOUND_SETTINGS = 5,
MENU_GRAPHICS_SETTINGS = 6,
MENU_LANGUAGE_SETTINGS = 7,
MENU_CHOOSE_LOAD_SLOT = 8,
MENU_CHOOSE_DELETE_SLOT = 9,
MENU_NEW_GAME_RELOAD = 10,
MENU_LOAD_SLOT_CONFIRM = 11,
MENU_DELETE_SLOT_CONFIRM = 12,
MENU_13 = 13,
MENU_LOADING_IN_PROGRESS = 14,
MENU_DELETING_IN_PROGRESS = 15,
MENU_16 = 16,
MENU_DELETE_FAILED = 17,
MENU_DEBUG_MENU = 18,
MENU_MEMORY_CARD_1 = 19,
MENU_MEMORY_CARD_2 = 20,
MENU_MULTIPLAYER_MAIN = 21,
MENU_SAVE_FAILED_1 = 22,
MENU_SAVE_FAILED_2 = 23,
MENU_SAVE = 24,
MENU_NO_MEMORY_CARD = 25,
MENU_CHOOSE_SAVE_SLOT = 26,
MENU_SAVE_OVERWRITE_CONFIRM = 27,
MENU_MULTIPLAYER_MAP = 28,
MENU_MULTIPLAYER_CONNECTION = 29,
MENU_MULTIPLAYER_FIND_GAME = 30,
MENU_MULTIPLAYER_MODE = 31,
MENU_MULTIPLAYER_CREATE = 32,
MENU_MULTIPLAYER_START = 33,
MENU_SKIN_SELECT_OLD = 34,
MENU_CONTROLLER_PC = 35,
MENU_CONTROLLER_PC_OLD1 = 36,
MENU_CONTROLLER_PC_OLD2 = 37,
MENU_CONTROLLER_PC_OLD3 = 38,
MENU_CONTROLLER_PC_OLD4 = 39,
MENU_CONTROLLER_DEBUG = 40,
MENU_OPTIONS = 41,
MENU_EXIT = 42,
MENU_SAVING_IN_PROGRESS = 43,
MENU_SAVE_SUCCESSFUL = 44,
MENU_DELETING = 45,
MENU_DELETE_SUCCESS = 46,
MENU_SAVE_FAILED = 47,
MENU_LOAD_FAILED = 48,
MENU_LOAD_FAILED_2 = 49,
MENU_FILTER_GAME = 50,
MENU_START_MENU = 51,
MENU_PAUSE_MENU = 52,
MENU_CHOOSE_MODE = 53,
MENU_SKIN_SELECT = 54,
MENU_KEYBOARD_CONTROLS = 55,
MENU_MOUSE_CONTROLS = 56,
MENU_57 = 57,
MENU_58 = 58,
};
struct tSkinInfo
{
int field_0;
@ -83,15 +145,29 @@ public:
int m_nCurrSaveSlot;
int m_nScreenChangeDelayTimer;
static int &OS_Language;
static int &m_PrefsBrightness;
static int &m_PrefsLanguage;
static bool &m_PrefsUseWideScreen;
static Bool &m_PrefsVsync;
static Bool &m_PrefsAllowNastyGame;
static Bool &m_bStartUpFrontEndRequested;
static Bool &m_PrefsFrameLimiter;
static Bool &m_PrefsUseVibration;
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 &BlurOn;
static int8 &m_PrefsShowSubtitles;
static int8 &m_PrefsSpeakers;
static int8 &m_ControlMethod;
static int8 &m_PrefsDMA;
static int8 &m_PrefsLanguage;
static int8 &m_bDisableMouseSteering;
static int32 &m_PrefsBrightness;
static float &m_PrefsLOD;
static int8 &m_bFrontEnd_ReloadObrTxtGxt;
static int32 &m_PrefsMusicVolume;
static int32 &m_PrefsSfxVolume;
static bool &m_PrefsAllowNastyGame;
static bool &m_bStartUpFrontEndRequested;
void Process(void);
void DrawFrontEnd(void);
@ -99,7 +175,9 @@ public:
void LoadAllTextures(void);
void LoadSettings(void);
void WaitForUserCD(void);
int FadeIn(int alpha);
};
static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error");
extern CMenuManager &FrontEndMenuManager;

View File

@ -11,11 +11,11 @@ bool &CGame::noProstitutes = *(bool*)0x95CDCF;
bool &CGame::playingIntro = *(bool*)0x95CDC2;
WRAPPER void CGame::Process(void) { EAXJMP(0x48C850); }
WRAPPER Bool CGame::InitialiseOnceBeforeRW(void) { EAXJMP(0x48BB80); }
WRAPPER Bool CGame::InitialiseRenderWare(void) { EAXJMP(0x48BBA0); }
WRAPPER bool CGame::InitialiseOnceBeforeRW(void) { EAXJMP(0x48BB80); }
WRAPPER bool CGame::InitialiseRenderWare(void) { EAXJMP(0x48BBA0); }
WRAPPER void CGame::ShutdownRenderWare(void) { EAXJMP(0x48BCB0); }
WRAPPER void CGame::FinalShutdown(void) { EAXJMP(0x48BEC0); }
WRAPPER void CGame::ShutDown(void) { EAXJMP(0x48C3A0); }
WRAPPER void CGame::ShutDownForRestart(void) { EAXJMP(0x48C6B0); }
WRAPPER void CGame::InitialiseWhenRestarting(void) { EAXJMP(0x48C740); }
WRAPPER Bool CGame::InitialiseOnceAfterRW(void) { EAXJMP(0x48BD50); }
WRAPPER bool CGame::InitialiseOnceAfterRW(void) { EAXJMP(0x48BD50); }

View File

@ -20,12 +20,12 @@ public:
static bool &playingIntro;
static void Process(void);
static Bool InitialiseOnceBeforeRW(void);
static Bool InitialiseRenderWare(void);
static bool InitialiseOnceBeforeRW(void);
static bool InitialiseRenderWare(void);
static void ShutdownRenderWare(void);
static void FinalShutdown(void);
static void ShutDown(void);
static void ShutDownForRestart(void);
static void InitialiseWhenRestarting(void);
static Bool InitialiseOnceAfterRW(void);
static bool InitialiseOnceAfterRW(void);
};

View File

@ -47,6 +47,6 @@ public:
static float GetRandomNumberInRange(float low, float high)
{ return low + (high - low)*(GetRandomNumber()/float(MYRAND_MAX + 1)); }
static Int32 GetRandomNumberInRange(Int32 low, Int32 high)
static int32 GetRandomNumberInRange(int32 low, int32 high)
{ return low + (high - low)*(GetRandomNumber()/float(MYRAND_MAX + 1)); }
};

View File

@ -4,3 +4,12 @@
WRAPPER void CMessages::Display(void) { EAXJMP(0x529800); }
WRAPPER void CMessages::ClearAllMessagesDisplayedByGame(void) { EAXJMP(0x52B670); }
WRAPPER int CMessages::WideStringCopy(wchar* dst, wchar* src, unsigned short size) { EAXJMP(0x5294B0); }
WRAPPER char CMessages::WideStringCompare(wchar* str1, wchar* str2, unsigned short size) { EAXJMP(0x529510); }
WRAPPER void CMessages::InsertNumberInString(wchar* src, int n1, int n2, int n3, int n4, int n5, int n6, wchar* dst) { EAXJMP(0x52A1A0); }
WRAPPER void CMessages::InsertPlayerControlKeysInString(wchar* src) { EAXJMP(0x52A490); }
WRAPPER int CMessages::GetWideStringLength(wchar* src) { EAXJMP(0x529490); }
tPreviousBrief *CMessages::PreviousBriefs = (tPreviousBrief *)0x713C08;
tMessage *CMessages::BriefMessages = (tMessage *)0x8786E0;
tBigMessage *CMessages::BIGMessages = (tBigMessage *)0x773628;

View File

@ -1,8 +1,44 @@
#pragma once
struct tMessage
{
wchar *m_pText;
uint16 m_nFlag;
private:
int8 _pad6[2];
public:
uint32 m_nTime;
uint32 m_nStartTime;
int32 m_nNumber[6];
wchar *m_pString;
};
struct tBigMessage
{
tMessage m_Current;
tMessage m_Stack[3];
};
struct tPreviousBrief
{
wchar *m_pText;
int32 m_nNumber[6];
wchar *m_pString;
};
class CMessages
{
public:
static tPreviousBrief *PreviousBriefs;
static tMessage *BriefMessages;
static tBigMessage *BIGMessages;
public:
static void Display(void);
static void ClearAllMessagesDisplayedByGame(void);
static int WideStringCopy(wchar* dst, wchar* src, unsigned short size);
static char WideStringCompare(wchar* str1, wchar* str2, unsigned short size);
static void InsertNumberInString(wchar* src, int n1, int n2, int n3, int n4, int n5, int n6, wchar* dst);
static void InsertPlayerControlKeysInString(wchar* src);
static int GetWideStringLength(wchar *src);
};

View File

@ -3,5 +3,5 @@
#include "Frontend.h"
#include "PCSave.h"
WRAPPER void C_PcSave::SetSaveDirectory(const Char *path) { EAXJMP(0x591EA0); }
WRAPPER void C_PcSave::SetSaveDirectory(const char *path) { EAXJMP(0x591EA0); }

View File

@ -3,5 +3,5 @@
class C_PcSave
{
public:
static void SetSaveDirectory(const Char *path);
static void SetSaveDirectory(const char *path);
};

View File

@ -28,22 +28,22 @@
CPad *Pads = (CPad*)0x6F0360; // [2]
CMousePointerStateHelper &MousePointerStateHelper = *(CMousePointerStateHelper*)0x95CC8C;
Bool &CPad::bDisplayNoControllerMessage = *(Bool *)0x95CD52;
Bool &CPad::bObsoleteControllerMessage = *(Bool *)0x95CDB8;
Bool &CPad::m_bMapPadOneToPadTwo = *(Bool *)0x95CD48;
bool &CPad::bDisplayNoControllerMessage = *(bool *)0x95CD52;
bool &CPad::bObsoleteControllerMessage = *(bool *)0x95CDB8;
bool &CPad::m_bMapPadOneToPadTwo = *(bool *)0x95CD48;
CKeyboardState &CPad::OldKeyState = *(CKeyboardState*)0x6F1E70;
CKeyboardState &CPad::NewKeyState = *(CKeyboardState*)0x6E60D0;
CKeyboardState &CPad::TempKeyState = *(CKeyboardState*)0x774DE8;
Char CPad::KeyBoardCheatString[18];
char CPad::KeyBoardCheatString[18];
CMouseControllerState &CPad::OldMouseControllerState = *(CMouseControllerState*)0x8472A0;
CMouseControllerState &CPad::NewMouseControllerState = *(CMouseControllerState*)0x8809F0;
CMouseControllerState &CPad::PCTempMouseControllerState = *(CMouseControllerState*)0x6F1E60;
_TODO("gbFastTime");
extern Bool &gbFastTime;
extern bool &gbFastTime;
WRAPPER void WeaponCheat() { EAXJMP(0x490D90); }
WRAPPER void HealthCheat() { EAXJMP(0x490E70); }
@ -84,10 +84,10 @@ CControllerState::Clear(void)
void CKeyboardState::Clear()
{
for ( Int32 i = 0; i < 12; i++ )
for ( int32 i = 0; i < 12; i++ )
F[i] = 0;
for ( Int32 i = 0; i < 256; i++ )
for ( int32 i = 0; i < 256; i++ )
VK_KEYS[i] = 0;
ESC = INS = DEL = HOME = END = PGUP = PGDN = 0;
@ -111,7 +111,7 @@ void CKeyboardState::Clear()
LWIN = RWIN = APPS = 0;
}
void CPad::Clear(Bool bResetPlayerControls)
void CPad::Clear(bool bResetPlayerControls)
{
NewState.Clear();
OldState.Clear();
@ -138,12 +138,12 @@ void CPad::Clear(Bool bResetPlayerControls)
bApplyBrakes = false;
for ( Int32 i = 0; i < _TODOCONST(5); i++ )
for ( int32 i = 0; i < _TODOCONST(5); i++ )
bHornHistory[i] = false;
iCurrHornHistory = 0;
for ( Int32 i = 0; i < _TODOCONST(12); i++ )
for ( int32 i = 0; i < _TODOCONST(12); i++ )
_unk[i] = ' ';
LastTimeTouched = CTimer::GetTimeInMilliseconds();
@ -235,8 +235,8 @@ void CPad::UpdateMouse()
if ( PSGLOBAL(mouse) != NULL && SUCCEEDED(_InputGetMouseState(&state)) )
{
Int32 signX = 1;
Int32 signy = 1;
int32 signX = 1;
int32 signy = 1;
if ( !FrontEndMenuManager.m_bMenuActive )
{
@ -248,8 +248,8 @@ void CPad::UpdateMouse()
PCTempMouseControllerState.Clear();
PCTempMouseControllerState.x = (Float)(signX * state.lX);
PCTempMouseControllerState.y = (Float)(signy * state.lY);
PCTempMouseControllerState.x = (float)(signX * state.lX);
PCTempMouseControllerState.y = (float)(signy * state.lY);
PCTempMouseControllerState.LMB = state.rgbButtons[0] & 128;
PCTempMouseControllerState.RMB = state.rgbButtons[1] & 128;
PCTempMouseControllerState.MMB = state.rgbButtons[2] & 128;
@ -329,7 +329,7 @@ CControllerState CPad::ReconcileTwoControllersInput(CControllerState const &Stat
#undef _FIX_RECON_DIR
}
void CPad::StartShake(Int16 nDur, UInt8 nFreq)
void CPad::StartShake(int16 nDur, uint8 nFreq)
{
if ( !CMenuManager::m_PrefsUseVibration )
return;
@ -351,7 +351,7 @@ void CPad::StartShake(Int16 nDur, UInt8 nFreq)
}
}
void CPad::StartShake_Distance(Int16 nDur, UInt8 nFreq, Float fX, Float fY, Float fZ)
void CPad::StartShake_Distance(int16 nDur, uint8 nFreq, float fX, float fY, float fZ)
{
if ( !CMenuManager::m_PrefsUseVibration )
return;
@ -359,7 +359,7 @@ void CPad::StartShake_Distance(Int16 nDur, UInt8 nFreq, Float fX, Float fY, Floa
if ( CCutsceneMgr::IsRunning() || CGame::playingIntro )
return;
Float fDist = ( TheCamera.GetPosition() - CVector(fX, fY, fZ) ).Magnitude();
float fDist = ( TheCamera.GetPosition() - CVector(fX, fY, fZ) ).Magnitude();
if ( fDist < 70.0f )
{
@ -378,7 +378,7 @@ void CPad::StartShake_Distance(Int16 nDur, UInt8 nFreq, Float fX, Float fY, Floa
}
}
void CPad::StartShake_Train(Float fX, Float fY)
void CPad::StartShake_Train(float fX, float fY)
{
if ( !CMenuManager::m_PrefsUseVibration )
return;
@ -389,11 +389,11 @@ void CPad::StartShake_Train(Float fX, Float fY)
if (FindPlayerVehicle() != NULL && FindPlayerVehicle()->IsTrain() )
return;
Float fDist = ( TheCamera.GetPosition() - CVector(fX, fY, 0.0f) ).Magnitude2D();
float fDist = ( TheCamera.GetPosition() - CVector(fX, fY, 0.0f) ).Magnitude2D();
if ( fDist < 70.0f )
{
Int32 freq = (Int32)((70.0f - fDist) * 70.0f / 70.0f + 30.0f);
int32 freq = (int32)((70.0f - fDist) * 70.0f / 70.0f + 30.0f);
if ( ShakeDur < 100 )
{
@ -403,9 +403,9 @@ void CPad::StartShake_Train(Float fX, Float fY)
}
}
void CPad::AddToPCCheatString(Char c)
void CPad::AddToPCCheatString(char c)
{
for ( Int32 i = ARRAY_SIZE(KeyBoardCheatString); i >= 0; i-- )
for ( int32 i = ARRAY_SIZE(KeyBoardCheatString); i >= 0; i-- )
KeyBoardCheatString[i + 1] = KeyBoardCheatString[i];
KeyBoardCheatString[0] = c;
@ -515,7 +515,7 @@ void CPad::AddToPCCheatString(Char c)
void CPad::UpdatePads(void)
{
Bool bUpdate = true;
bool bUpdate = true;
GetPad(0)->UpdateMouse();
CapturePad(0);
@ -545,7 +545,7 @@ void CPad::ProcessPCSpecificStuff(void)
;
}
void CPad::Update(Int16 unk)
void CPad::Update(int16 unk)
{
OldState = NewState;
@ -573,7 +573,7 @@ void CPad::DoCheats(void)
GetPad(0)->DoCheats(0);
}
void CPad::DoCheats(Int16 unk)
void CPad::DoCheats(int16 unk)
{
#ifdef PS2
if ( GetTriangleJustDown() )
@ -619,17 +619,17 @@ void CPad::StopPadsShaking(void)
GetPad(0)->StopShaking(0);
}
void CPad::StopShaking(Int16 unk)
void CPad::StopShaking(int16 unk)
{
;
}
CPad *CPad::GetPad(Int32 pad)
CPad *CPad::GetPad(int32 pad)
{
return &Pads[pad];
}
Int16 CPad::GetSteeringLeftRight(void)
int16 CPad::GetSteeringLeftRight(void)
{
if ( DisablePlayerControls )
return 0;
@ -639,8 +639,8 @@ Int16 CPad::GetSteeringLeftRight(void)
case 0:
case 2:
{
Int16 axis = NewState.LeftStickX;
Int16 dpad = (NewState.DPadRight - NewState.DPadLeft) / 2;
int16 axis = NewState.LeftStickX;
int16 dpad = (NewState.DPadRight - NewState.DPadLeft) / 2;
if ( abs(axis) > abs(dpad) )
return axis;
@ -662,7 +662,7 @@ Int16 CPad::GetSteeringLeftRight(void)
return 0;
}
Int16 CPad::GetSteeringUpDown(void)
int16 CPad::GetSteeringUpDown(void)
{
if ( DisablePlayerControls )
return 0;
@ -672,8 +672,8 @@ Int16 CPad::GetSteeringUpDown(void)
case 0:
case 2:
{
Int16 axis = NewState.LeftStickY;
Int16 dpad = (NewState.DPadUp - NewState.DPadDown) / 2;
int16 axis = NewState.LeftStickY;
int16 dpad = (NewState.DPadUp - NewState.DPadDown) / 2;
if ( abs(axis) > abs(dpad) )
return axis;
@ -695,7 +695,7 @@ Int16 CPad::GetSteeringUpDown(void)
return 0;
}
Int16 CPad::GetCarGunUpDown(void)
int16 CPad::GetCarGunUpDown(void)
{
if ( DisablePlayerControls )
return 0;
@ -722,7 +722,7 @@ Int16 CPad::GetCarGunUpDown(void)
return 0;
}
Int16 CPad::GetCarGunLeftRight(void)
int16 CPad::GetCarGunLeftRight(void)
{
if ( DisablePlayerControls )
return 0;
@ -749,7 +749,7 @@ Int16 CPad::GetCarGunLeftRight(void)
return 0;
}
Int16 CPad::GetPedWalkLeftRight(void)
int16 CPad::GetPedWalkLeftRight(void)
{
if ( DisablePlayerControls )
return 0;
@ -759,8 +759,8 @@ Int16 CPad::GetPedWalkLeftRight(void)
case 0:
case 2:
{
Int16 axis = NewState.LeftStickX;
Int16 dpad = (NewState.DPadRight - NewState.DPadLeft) / 2;
int16 axis = NewState.LeftStickX;
int16 dpad = (NewState.DPadRight - NewState.DPadLeft) / 2;
if ( abs(axis) > abs(dpad) )
return axis;
@ -783,7 +783,7 @@ Int16 CPad::GetPedWalkLeftRight(void)
}
Int16 CPad::GetPedWalkUpDown(void)
int16 CPad::GetPedWalkUpDown(void)
{
if ( DisablePlayerControls )
return 0;
@ -793,8 +793,8 @@ Int16 CPad::GetPedWalkUpDown(void)
case 0:
case 2:
{
Int16 axis = NewState.LeftStickY;
Int16 dpad = (NewState.DPadDown - NewState.DPadUp) / 2;
int16 axis = NewState.LeftStickY;
int16 dpad = (NewState.DPadDown - NewState.DPadUp) / 2;
if ( abs(axis) > abs(dpad) )
return axis;
@ -816,15 +816,15 @@ Int16 CPad::GetPedWalkUpDown(void)
return 0;
}
Int16 CPad::GetAnalogueUpDown(void)
int16 CPad::GetAnalogueUpDown(void)
{
switch ( Mode )
{
case 0:
case 2:
{
Int16 axis = NewState.LeftStickY;
Int16 dpad = (NewState.DPadDown - NewState.DPadUp) / 2;
int16 axis = NewState.LeftStickY;
int16 dpad = (NewState.DPadDown - NewState.DPadUp) / 2;
if ( abs(axis) > abs(dpad) )
return axis;
@ -846,7 +846,7 @@ Int16 CPad::GetAnalogueUpDown(void)
return 0;
}
Bool CPad::GetLookLeft(void)
bool CPad::GetLookLeft(void)
{
if ( DisablePlayerControls )
return false;
@ -854,7 +854,7 @@ Bool CPad::GetLookLeft(void)
return !!(NewState.LeftShoulder2 && !NewState.RightShoulder2);
}
Bool CPad::GetLookRight(void)
bool CPad::GetLookRight(void)
{
if ( DisablePlayerControls )
return false;
@ -863,7 +863,7 @@ Bool CPad::GetLookRight(void)
}
Bool CPad::GetLookBehindForCar(void)
bool CPad::GetLookBehindForCar(void)
{
if ( DisablePlayerControls )
return false;
@ -871,7 +871,7 @@ Bool CPad::GetLookBehindForCar(void)
return !!(NewState.RightShoulder2 && NewState.LeftShoulder2);
}
Bool CPad::GetLookBehindForPed(void)
bool CPad::GetLookBehindForPed(void)
{
if ( DisablePlayerControls )
return false;
@ -879,7 +879,7 @@ Bool CPad::GetLookBehindForPed(void)
return !!NewState.RightShock;
}
Bool CPad::GetHorn(void)
bool CPad::GetHorn(void)
{
if ( DisablePlayerControls )
return false;
@ -918,7 +918,7 @@ Bool CPad::GetHorn(void)
return false;
}
Bool CPad::HornJustDown(void)
bool CPad::HornJustDown(void)
{
if ( DisablePlayerControls )
return false;
@ -958,7 +958,7 @@ Bool CPad::HornJustDown(void)
}
Bool CPad::GetCarGunFired(void)
bool CPad::GetCarGunFired(void)
{
if ( DisablePlayerControls )
return false;
@ -985,7 +985,7 @@ Bool CPad::GetCarGunFired(void)
return false;
}
Bool CPad::CarGunJustDown(void)
bool CPad::CarGunJustDown(void)
{
if ( DisablePlayerControls )
return false;
@ -1012,7 +1012,7 @@ Bool CPad::CarGunJustDown(void)
return false;
}
Int16 CPad::GetHandBrake(void)
int16 CPad::GetHandBrake(void)
{
if ( DisablePlayerControls )
return 0;
@ -1045,7 +1045,7 @@ Int16 CPad::GetHandBrake(void)
return 0;
}
Int16 CPad::GetBrake(void)
int16 CPad::GetBrake(void)
{
if ( DisablePlayerControls )
return 0;
@ -1069,7 +1069,7 @@ Int16 CPad::GetBrake(void)
case 3:
{
Int16 axis = 2 * NewState.RightStickY;
int16 axis = 2 * NewState.RightStickY;
if ( axis < 0 )
return 0;
@ -1083,7 +1083,7 @@ Int16 CPad::GetBrake(void)
return 0;
}
Bool CPad::GetExitVehicle(void)
bool CPad::GetExitVehicle(void)
{
if ( DisablePlayerControls )
return false;
@ -1110,7 +1110,7 @@ Bool CPad::GetExitVehicle(void)
return false;
}
Bool CPad::ExitVehicleJustDown(void)
bool CPad::ExitVehicleJustDown(void)
{
if ( DisablePlayerControls )
return false;
@ -1137,7 +1137,7 @@ Bool CPad::ExitVehicleJustDown(void)
return false;
}
Int32 CPad::GetWeapon(void)
int32 CPad::GetWeapon(void)
{
if ( DisablePlayerControls )
return false;
@ -1170,7 +1170,7 @@ Int32 CPad::GetWeapon(void)
return false;
}
Bool CPad::WeaponJustDown(void)
bool CPad::WeaponJustDown(void)
{
if ( DisablePlayerControls )
return false;
@ -1203,7 +1203,7 @@ Bool CPad::WeaponJustDown(void)
return false;
}
Int16 CPad::GetAccelerate(void)
int16 CPad::GetAccelerate(void)
{
if ( DisablePlayerControls )
return 0;
@ -1227,7 +1227,7 @@ Int16 CPad::GetAccelerate(void)
case 3:
{
Int16 axis = -2 * NewState.RightStickY;
int16 axis = -2 * NewState.RightStickY;
if ( axis < 0 )
return 0;
@ -1241,7 +1241,7 @@ Int16 CPad::GetAccelerate(void)
return 0;
}
Bool CPad::CycleCameraModeUpJustDown(void)
bool CPad::CycleCameraModeUpJustDown(void)
{
switch ( Mode )
{
@ -1265,7 +1265,7 @@ Bool CPad::CycleCameraModeUpJustDown(void)
return false;
}
Bool CPad::CycleCameraModeDownJustDown(void)
bool CPad::CycleCameraModeDownJustDown(void)
{
switch ( Mode )
{
@ -1289,7 +1289,7 @@ Bool CPad::CycleCameraModeDownJustDown(void)
return false;
}
Bool CPad::ChangeStationJustDown(void)
bool CPad::ChangeStationJustDown(void)
{
if ( DisablePlayerControls )
return false;
@ -1329,7 +1329,7 @@ Bool CPad::ChangeStationJustDown(void)
}
Bool CPad::CycleWeaponLeftJustDown(void)
bool CPad::CycleWeaponLeftJustDown(void)
{
if ( DisablePlayerControls )
return false;
@ -1337,7 +1337,7 @@ Bool CPad::CycleWeaponLeftJustDown(void)
return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2);
}
Bool CPad::CycleWeaponRightJustDown(void)
bool CPad::CycleWeaponRightJustDown(void)
{
if ( DisablePlayerControls )
return false;
@ -1345,7 +1345,7 @@ Bool CPad::CycleWeaponRightJustDown(void)
return !!(NewState.RightShoulder2 && !OldState.RightShoulder2);
}
Bool CPad::GetTarget(void)
bool CPad::GetTarget(void)
{
if ( DisablePlayerControls )
return false;
@ -1372,7 +1372,7 @@ Bool CPad::GetTarget(void)
return false;
}
Bool CPad::TargetJustDown(void)
bool CPad::TargetJustDown(void)
{
if ( DisablePlayerControls )
return false;
@ -1399,7 +1399,7 @@ Bool CPad::TargetJustDown(void)
return false;
}
Bool CPad::JumpJustDown(void)
bool CPad::JumpJustDown(void)
{
if ( DisablePlayerControls )
return false;
@ -1407,7 +1407,7 @@ Bool CPad::JumpJustDown(void)
return !!(NewState.Square && !OldState.Square);
}
Bool CPad::GetSprint(void)
bool CPad::GetSprint(void)
{
if ( DisablePlayerControls )
return false;
@ -1434,7 +1434,7 @@ Bool CPad::GetSprint(void)
return false;
}
Bool CPad::ShiftTargetLeftJustDown(void)
bool CPad::ShiftTargetLeftJustDown(void)
{
if ( DisablePlayerControls )
return false;
@ -1442,7 +1442,7 @@ Bool CPad::ShiftTargetLeftJustDown(void)
return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2);
}
Bool CPad::ShiftTargetRightJustDown(void)
bool CPad::ShiftTargetRightJustDown(void)
{
if ( DisablePlayerControls )
return false;
@ -1450,11 +1450,11 @@ Bool CPad::ShiftTargetRightJustDown(void)
return !!(NewState.RightShoulder2 && !OldState.RightShoulder2);
}
Bool CPad::GetAnaloguePadUp(void)
bool CPad::GetAnaloguePadUp(void)
{
static Int16 oldfStickY = 0;
static int16 oldfStickY = 0;
Int16 Y = CPad::GetPad(0)->GetAnalogueUpDown();
int16 Y = CPad::GetPad(0)->GetAnalogueUpDown();
if ( Y < 0 && oldfStickY >= 0 )
{
@ -1468,11 +1468,11 @@ Bool CPad::GetAnaloguePadUp(void)
}
}
Bool CPad::GetAnaloguePadDown(void)
bool CPad::GetAnaloguePadDown(void)
{
static Int16 oldfStickY = 0;
static int16 oldfStickY = 0;
Int16 Y = CPad::GetPad(0)->GetAnalogueUpDown();
int16 Y = CPad::GetPad(0)->GetAnalogueUpDown();
if ( Y > 0 && oldfStickY <= 0 )
{
@ -1486,11 +1486,11 @@ Bool CPad::GetAnaloguePadDown(void)
}
}
Bool CPad::GetAnaloguePadLeft(void)
bool CPad::GetAnaloguePadLeft(void)
{
static Int16 oldfStickX = 0;
static int16 oldfStickX = 0;
Int16 X = CPad::GetPad(0)->GetPedWalkLeftRight();
int16 X = CPad::GetPad(0)->GetPedWalkLeftRight();
if ( X < 0 && oldfStickX >= 0 )
{
@ -1504,11 +1504,11 @@ Bool CPad::GetAnaloguePadLeft(void)
}
}
Bool CPad::GetAnaloguePadRight(void)
bool CPad::GetAnaloguePadRight(void)
{
static Int16 oldfStickX = 0;
static int16 oldfStickX = 0;
Int16 X = CPad::GetPad(0)->GetPedWalkLeftRight();
int16 X = CPad::GetPad(0)->GetPedWalkLeftRight();
if ( X > 0 && oldfStickX <= 0 )
{
@ -1522,11 +1522,11 @@ Bool CPad::GetAnaloguePadRight(void)
}
}
Bool CPad::GetAnaloguePadLeftJustUp(void)
bool CPad::GetAnaloguePadLeftJustUp(void)
{
static Int16 oldfStickX = 0;
static int16 oldfStickX = 0;
Int16 X = GetPad(0)->GetPedWalkLeftRight();
int16 X = GetPad(0)->GetPedWalkLeftRight();
if ( X == 0 && oldfStickX < 0 )
{
@ -1542,11 +1542,11 @@ Bool CPad::GetAnaloguePadLeftJustUp(void)
}
}
Bool CPad::GetAnaloguePadRightJustUp(void)
bool CPad::GetAnaloguePadRightJustUp(void)
{
static Int16 oldfStickX = 0;
static int16 oldfStickX = 0;
Int16 X = GetPad(0)->GetPedWalkLeftRight();
int16 X = GetPad(0)->GetPedWalkLeftRight();
if ( X == 0 && oldfStickX > 0 )
{
@ -1562,7 +1562,7 @@ Bool CPad::GetAnaloguePadRightJustUp(void)
}
}
Bool CPad::ForceCameraBehindPlayer(void)
bool CPad::ForceCameraBehindPlayer(void)
{
if ( DisablePlayerControls )
return false;
@ -1595,7 +1595,7 @@ Bool CPad::ForceCameraBehindPlayer(void)
return false;
}
Bool CPad::SniperZoomIn(void)
bool CPad::SniperZoomIn(void)
{
if ( DisablePlayerControls )
return false;
@ -1622,7 +1622,7 @@ Bool CPad::SniperZoomIn(void)
return false;
}
Bool CPad::SniperZoomOut(void)
bool CPad::SniperZoomOut(void)
{
if ( DisablePlayerControls )
return false;
@ -1650,10 +1650,10 @@ Bool CPad::SniperZoomOut(void)
}
Int16 CPad::SniperModeLookLeftRight(void)
int16 CPad::SniperModeLookLeftRight(void)
{
Int16 axis = NewState.LeftStickX;
Int16 dpad = (NewState.DPadRight - NewState.DPadLeft) / 2;
int16 axis = NewState.LeftStickX;
int16 dpad = (NewState.DPadRight - NewState.DPadLeft) / 2;
if ( abs(axis) > abs(dpad) )
return axis;
@ -1661,10 +1661,10 @@ Int16 CPad::SniperModeLookLeftRight(void)
return dpad;
}
Int16 CPad::SniperModeLookUpDown(void)
int16 CPad::SniperModeLookUpDown(void)
{
Int16 axis = NewState.LeftStickY;
Int16 dpad = (NewState.DPadUp - NewState.DPadDown) / 2;
int16 axis = NewState.LeftStickY;
int16 dpad = (NewState.DPadUp - NewState.DPadDown) / 2;
if ( abs(axis) > abs(dpad) )
return axis;
@ -1672,31 +1672,31 @@ Int16 CPad::SniperModeLookUpDown(void)
return dpad;
}
Int16 CPad::LookAroundLeftRight(void)
int16 CPad::LookAroundLeftRight(void)
{
Float axis = GetPad(0)->NewState.RightStickX;
float axis = GetPad(0)->NewState.RightStickX;
if ( fabs(axis) > 85 && !GetLookBehindForPed() )
return (Int16) ( (axis + ( axis > 0 ) ? -85 : 85)
return (int16) ( (axis + ( axis > 0 ) ? -85 : 85)
* (127.0f / 32.0f) ); // 3.96875f
else if ( TheCamera.Cams[0].Using3rdPersonMouseCam() && fabs(axis) > 10 )
return (Int16) ( (axis + ( axis > 0 ) ? -10 : 10)
return (int16) ( (axis + ( axis > 0 ) ? -10 : 10)
* (127.0f / 64.0f) ); // 1.984375f
return 0;
}
Int16 CPad::LookAroundUpDown(void)
int16 CPad::LookAroundUpDown(void)
{
Int16 axis = GetPad(0)->NewState.RightStickY;
int16 axis = GetPad(0)->NewState.RightStickY;
if ( abs(axis) > 85 && !GetLookBehindForPed() )
return (Int16) ( (axis + ( axis > 0 ) ? -85 : 85)
return (int16) ( (axis + ( axis > 0 ) ? -85 : 85)
* (127.0f / 32.0f) ); // 3.96875f
else if ( TheCamera.Cams[0].Using3rdPersonMouseCam() && abs(axis) > 40 )
return (Int16) ( (axis + ( axis > 0 ) ? -40 : 40)
return (int16) ( (axis + ( axis > 0 ) ? -40 : 40)
* (127.0f / 64.0f) ); // 1.984375f
return 0;
@ -1750,7 +1750,7 @@ void CPad::PrintErrorMessage(void)
void LittleTest(void)
{
static Int32 Cunt = 0;
static int32 Cunt = 0;
Cunt++; // ???
}
@ -1775,12 +1775,12 @@ void CPad::ResetCheats(void)
CTimer::SetTimeScale(1.0f);
}
Char *CPad::EditString(Char *pStr, Int32 nSize)
char *CPad::EditString(char *pStr, int32 nSize)
{
Int32 pos = strlen(pStr);
int32 pos = strlen(pStr);
// letters
for ( Int32 i = 0; i < ('Z' - 'A' + 1); i++ )
for ( int32 i = 0; i < ('Z' - 'A' + 1); i++ )
{
if ( GetPad(0)->GetCharJustDown(i + 'A') && pos < nSize - 1 )
{
@ -1796,7 +1796,7 @@ Char *CPad::EditString(Char *pStr, Int32 nSize)
}
// numbers
for ( Int32 i = 0; i < ('0' - '9' + 1); i++ )
for ( int32 i = 0; i < ('0' - '9' + 1); i++ )
{
if ( GetPad(0)->GetCharJustDown(i + '0') && pos < nSize - 1 )
{
@ -1827,17 +1827,17 @@ Char *CPad::EditString(Char *pStr, Int32 nSize)
return pStr;
}
Int32 *CPad::EditCodesForControls(Int32 *pRsKeys, Int32 nSize)
int32 *CPad::EditCodesForControls(int32 *pRsKeys, int32 nSize)
{
*pRsKeys = rsNULL;
for ( Int32 i = 0; i < 255; i++ )
for ( int32 i = 0; i < 255; i++ )
{
if ( GetPad(0)->GetCharJustDown(i) )
*pRsKeys = i;
}
for ( Int32 i = 0; i < 255; i++ )
for ( int32 i = 0; i < 12; i++ )
{
if ( GetPad(0)->GetFJustDown(i) )
*pRsKeys = i + rsF1;
@ -1996,7 +1996,7 @@ STARTPATCHES
InjectHook(0x492C60, &CPad::ProcessPCSpecificStuff, PATCH_JUMP);
InjectHook(0x492C70, &CPad::Update, PATCH_JUMP);
InjectHook(0x492F00, (void (*)())CPad::DoCheats, PATCH_JUMP);
InjectHook(0x492F20, (void (CPad::*)(Int16))&CPad::DoCheats, PATCH_JUMP);
InjectHook(0x492F20, (void (CPad::*)(int16))&CPad::DoCheats, PATCH_JUMP);
InjectHook(0x492F30, CPad::StopPadsShaking, PATCH_JUMP);
InjectHook(0x492F50, &CPad::StopShaking, PATCH_JUMP);
InjectHook(0x492F60, CPad::GetPad, PATCH_JUMP);

368
src/Pad.h
View File

@ -78,16 +78,16 @@ class CMouseControllerState
public:
//uint32 btns; // bit 0-2 button 1-3
Bool LMB;
Bool RMB;
Bool MMB;
Bool WHEELUP;
Bool WHEELDN;
Bool MXB1;
Bool MXB2;
bool LMB;
bool RMB;
bool MMB;
bool WHEELUP;
bool WHEELDN;
bool MXB1;
bool MXB2;
char _pad0;
Float x, y;
float x, y;
CMouseControllerState();
void Clear();
@ -98,8 +98,8 @@ VALIDATE_SIZE(CMouseControllerState, 0x10);
class CMousePointerStateHelper
{
public:
Bool bInvertHorizontally;
Bool bInvertVertically;
bool bInvertHorizontally;
bool bInvertVertically;
CMouseControllerState GetMouseSetUp();
};
@ -112,52 +112,52 @@ extern CMousePointerStateHelper &MousePointerStateHelper;
class CKeyboardState
{
public:
Int16 F[12];
Int16 VK_KEYS[256];
Int16 ESC;
Int16 INS;
Int16 DEL;
Int16 HOME;
Int16 END;
Int16 PGUP;
Int16 PGDN;
Int16 UP;
Int16 DOWN;
Int16 LEFT;
Int16 RIGHT;
Int16 SCROLLLOCK;
Int16 PAUSE;
Int16 NUMLOCK;
Int16 DIV;
Int16 MUL;
Int16 SUB;
Int16 ADD;
Int16 ENTER;
Int16 DECIMAL;
Int16 NUM1;
Int16 NUM2;
Int16 NUM3;
Int16 NUM4;
Int16 NUM5;
Int16 NUM6;
Int16 NUM7;
Int16 NUM8;
Int16 NUM9;
Int16 NUM0;
Int16 BACKSP;
Int16 TAB;
Int16 CAPSLOCK;
Int16 EXTENTER;
Int16 LSHIFT;
Int16 RSHIFT;
Int16 SHIFT;
Int16 LCTRL;
Int16 RCTRL;
Int16 LALT;
Int16 RALT;
Int16 LWIN;
Int16 RWIN;
Int16 APPS;
int16 F[12];
int16 VK_KEYS[256];
int16 ESC;
int16 INS;
int16 DEL;
int16 HOME;
int16 END;
int16 PGUP;
int16 PGDN;
int16 UP;
int16 DOWN;
int16 LEFT;
int16 RIGHT;
int16 SCROLLLOCK;
int16 PAUSE;
int16 NUMLOCK;
int16 DIV;
int16 MUL;
int16 SUB;
int16 ADD;
int16 ENTER;
int16 DECIMAL;
int16 NUM1;
int16 NUM2;
int16 NUM3;
int16 NUM4;
int16 NUM5;
int16 NUM6;
int16 NUM7;
int16 NUM8;
int16 NUM9;
int16 NUM0;
int16 BACKSP;
int16 TAB;
int16 CAPSLOCK;
int16 EXTENTER;
int16 LSHIFT;
int16 RSHIFT;
int16 SHIFT;
int16 LCTRL;
int16 RCTRL;
int16 LALT;
int16 RALT;
int16 LWIN;
int16 RWIN;
int16 APPS;
void Clear();
};
@ -185,12 +185,12 @@ public:
int16 Phase;
int16 Mode;
int16 ShakeDur;
UInt8 ShakeFreq;
uint8 ShakeFreq;
int8 bHornHistory[5];
UInt8 iCurrHornHistory;
Bool DisablePlayerControls;
uint8 iCurrHornHistory;
bool DisablePlayerControls;
int8 bApplyBrakes;
Char _unk[12]; //int32 unk[3];
char _unk[12]; //int32 unk[3];
char _pad0[3];
int32 LastTimeTouched;
int32 AverageWeapon;
@ -199,14 +199,14 @@ public:
CPad() { }
~CPad() { }
static Bool &bDisplayNoControllerMessage;
static Bool &bObsoleteControllerMessage;
static Bool &m_bMapPadOneToPadTwo;
static bool &bDisplayNoControllerMessage;
static bool &bObsoleteControllerMessage;
static bool &m_bMapPadOneToPadTwo;
static CKeyboardState &OldKeyState;
static CKeyboardState &NewKeyState;
static CKeyboardState &TempKeyState;
static Char KeyBoardCheatString[18];
static char KeyBoardCheatString[18];
static CMouseControllerState &OldMouseControllerState;
static CMouseControllerState &NewMouseControllerState;
static CMouseControllerState &PCTempMouseControllerState;
@ -214,150 +214,150 @@ public:
void Clear(Bool bResetPlayerControls);
void Clear(bool bResetPlayerControls);
void ClearMouseHistory();
void UpdateMouse();
CControllerState ReconcileTwoControllersInput(CControllerState const &State1, CControllerState const &State2);
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);
void AddToPCCheatString(Char c);
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);
void AddToPCCheatString(char c);
static void UpdatePads(void);
void ProcessPCSpecificStuff(void);
void Update(Int16 unk);
void Update(int16 unk);
static void DoCheats(void);
void DoCheats(Int16 unk);
void DoCheats(int16 unk);
static void StopPadsShaking(void);
void StopShaking(Int16 unk);
void StopShaking(int16 unk);
static CPad *GetPad(Int32 pad);
static CPad *GetPad(int32 pad);
Int16 GetSteeringLeftRight(void);
Int16 GetSteeringUpDown(void);
Int16 GetCarGunUpDown(void);
Int16 GetCarGunLeftRight(void);
Int16 GetPedWalkLeftRight(void);
Int16 GetPedWalkUpDown(void);
Int16 GetAnalogueUpDown(void);
Bool GetLookLeft(void);
Bool GetLookRight(void);
Bool GetLookBehindForCar(void);
Bool GetLookBehindForPed(void);
Bool GetHorn(void);
Bool HornJustDown(void);
Bool GetCarGunFired(void);
Bool CarGunJustDown(void);
Int16 GetHandBrake(void);
Int16 GetBrake(void);
Bool GetExitVehicle(void);
Bool ExitVehicleJustDown(void);
Int32 GetWeapon(void);
Bool WeaponJustDown(void);
Int16 GetAccelerate(void);
Bool CycleCameraModeUpJustDown(void);
Bool CycleCameraModeDownJustDown(void);
Bool ChangeStationJustDown(void);
Bool CycleWeaponLeftJustDown(void);
Bool CycleWeaponRightJustDown(void);
Bool GetTarget(void);
Bool TargetJustDown(void);
Bool JumpJustDown(void);
Bool GetSprint(void);
Bool ShiftTargetLeftJustDown(void);
Bool ShiftTargetRightJustDown(void);
Bool GetAnaloguePadUp(void);
Bool GetAnaloguePadDown(void);
Bool GetAnaloguePadLeft(void);
Bool GetAnaloguePadRight(void);
Bool GetAnaloguePadLeftJustUp(void);
Bool GetAnaloguePadRightJustUp(void);
Bool ForceCameraBehindPlayer(void);
Bool SniperZoomIn(void);
Bool SniperZoomOut(void);
Int16 SniperModeLookLeftRight(void);
Int16 SniperModeLookUpDown(void);
Int16 LookAroundLeftRight(void);
Int16 LookAroundUpDown(void);
int16 GetSteeringLeftRight(void);
int16 GetSteeringUpDown(void);
int16 GetCarGunUpDown(void);
int16 GetCarGunLeftRight(void);
int16 GetPedWalkLeftRight(void);
int16 GetPedWalkUpDown(void);
int16 GetAnalogueUpDown(void);
bool GetLookLeft(void);
bool GetLookRight(void);
bool GetLookBehindForCar(void);
bool GetLookBehindForPed(void);
bool GetHorn(void);
bool HornJustDown(void);
bool GetCarGunFired(void);
bool CarGunJustDown(void);
int16 GetHandBrake(void);
int16 GetBrake(void);
bool GetExitVehicle(void);
bool ExitVehicleJustDown(void);
int32 GetWeapon(void);
bool WeaponJustDown(void);
int16 GetAccelerate(void);
bool CycleCameraModeUpJustDown(void);
bool CycleCameraModeDownJustDown(void);
bool ChangeStationJustDown(void);
bool CycleWeaponLeftJustDown(void);
bool CycleWeaponRightJustDown(void);
bool GetTarget(void);
bool TargetJustDown(void);
bool JumpJustDown(void);
bool GetSprint(void);
bool ShiftTargetLeftJustDown(void);
bool ShiftTargetRightJustDown(void);
bool GetAnaloguePadUp(void);
bool GetAnaloguePadDown(void);
bool GetAnaloguePadLeft(void);
bool GetAnaloguePadRight(void);
bool GetAnaloguePadLeftJustUp(void);
bool GetAnaloguePadRightJustUp(void);
bool ForceCameraBehindPlayer(void);
bool SniperZoomIn(void);
bool SniperZoomOut(void);
int16 SniperModeLookLeftRight(void);
int16 SniperModeLookUpDown(void);
int16 LookAroundLeftRight(void);
int16 LookAroundUpDown(void);
void ResetAverageWeapon(void);
static void PrintErrorMessage(void);
static void ResetCheats(void);
static Char *EditString(Char *pStr, Int32 nSize);
static Int32 *EditCodesForControls(Int32 *pRsKeys, Int32 nSize);
static char *EditString(char *pStr, int32 nSize);
static int32 *EditCodesForControls(int32 *pRsKeys, int32 nSize);
// mouse
inline Bool GetLeftMouseJustDown() { return !!(NewMouseControllerState.LMB && !OldMouseControllerState.LMB); }
inline bool GetLeftMouseJustDown() { return !!(NewMouseControllerState.LMB && !OldMouseControllerState.LMB); }
// keyboard
inline Bool GetCharJustDown(Char c) { return !!(NewKeyState.VK_KEYS[c] && !OldKeyState.VK_KEYS[c]); }
inline Bool GetFJustDown(Int32 n) { return !!(NewKeyState.F[n] && !OldKeyState.F[n]); }
inline Bool GetEscapeJustDown() { return !!(NewKeyState.ESC && !OldKeyState.ESC); }
inline Bool GetInsertJustDown() { return !!(NewKeyState.INS && !OldKeyState.INS); }
inline Bool GetDeleteJustDown() { return !!(NewKeyState.DEL && !OldKeyState.DEL); }
inline Bool GetHomeJustDown() { return !!(NewKeyState.HOME && !OldKeyState.HOME); }
inline Bool GetEndJustDown() { return !!(NewKeyState.END && !OldKeyState.END); }
inline Bool GetPageUpJustDown() { return !!(NewKeyState.PGUP && !OldKeyState.PGUP); }
inline Bool GetPageDownJustDown() { return !!(NewKeyState.PGDN && !OldKeyState.PGDN); }
inline Bool GetUpJustDown() { return !!(NewKeyState.UP && !OldKeyState.UP); }
inline Bool GetDownJustDown() { return !!(NewKeyState.DOWN && !OldKeyState.DOWN); }
inline Bool GetLeftJustDown() { return !!(NewKeyState.LEFT && !OldKeyState.LEFT); }
inline Bool GetRightJustDown() { return !!(NewKeyState.RIGHT && !OldKeyState.RIGHT); }
inline Bool GetScrollLockJustDown() { return !!(NewKeyState.SCROLLLOCK && !OldKeyState.SCROLLLOCK); }
inline Bool GetPauseJustDown() { return !!(NewKeyState.PAUSE && !OldKeyState.PAUSE); }
inline Bool GetNumLockJustDown() { return !!(NewKeyState.NUMLOCK && !OldKeyState.NUMLOCK); }
inline Bool GetDivideJustDown() { return !!(NewKeyState.DIV && !OldKeyState.DIV); }
inline Bool GetTimesJustDown() { return !!(NewKeyState.MUL && !OldKeyState.MUL); }
inline Bool GetMinusJustDown() { return !!(NewKeyState.SUB && !OldKeyState.SUB); }
inline Bool GetPlusJustDown() { return !!(NewKeyState.ADD && !OldKeyState.ADD); }
inline Bool GetPadEnterJustDown() { return !!(NewKeyState.ENTER && !OldKeyState.ENTER); } // GetEnterJustDown
inline Bool GetPadDelJustDown() { return !!(NewKeyState.DECIMAL && !OldKeyState.DECIMAL); }
inline Bool GetPad1JustDown() { return !!(NewKeyState.NUM1 && !OldKeyState.NUM1); }
inline Bool GetPad2JustDown() { return !!(NewKeyState.NUM2 && !OldKeyState.NUM2); }
inline Bool GetPad3JustDown() { return !!(NewKeyState.NUM3 && !OldKeyState.NUM3); }
inline Bool GetPad4JustDown() { return !!(NewKeyState.NUM4 && !OldKeyState.NUM4); }
inline Bool GetPad5JustDown() { return !!(NewKeyState.NUM5 && !OldKeyState.NUM5); }
inline Bool GetPad6JustDown() { return !!(NewKeyState.NUM6 && !OldKeyState.NUM6); }
inline Bool GetPad7JustDown() { return !!(NewKeyState.NUM7 && !OldKeyState.NUM7); }
inline Bool GetPad8JustDown() { return !!(NewKeyState.NUM8 && !OldKeyState.NUM8); }
inline Bool GetPad9JustDown() { return !!(NewKeyState.NUM9 && !OldKeyState.NUM9); }
inline Bool GetPad0JustDown() { return !!(NewKeyState.NUM0 && !OldKeyState.NUM0); }
inline Bool GetBackspaceJustDown() { return !!(NewKeyState.BACKSP && !OldKeyState.BACKSP); }
inline Bool GetTabJustDown() { return !!(NewKeyState.TAB && !OldKeyState.TAB); }
inline Bool GetCapsLockJustDown() { return !!(NewKeyState.CAPSLOCK && !OldKeyState.CAPSLOCK); }
inline Bool GetEnterJustDown() { return !!(NewKeyState.EXTENTER && !OldKeyState.EXTENTER); }
inline Bool GetLeftShiftJustDown() { return !!(NewKeyState.LSHIFT && !OldKeyState.LSHIFT); }
inline Bool GetShiftJustDown() { return !!(NewKeyState.SHIFT && !OldKeyState.SHIFT); }
inline Bool GetRightShiftJustDown() { return !!(NewKeyState.RSHIFT && !OldKeyState.RSHIFT); }
inline Bool GetLeftCtrlJustDown() { return !!(NewKeyState.LCTRL && !OldKeyState.LCTRL); }
inline Bool GetRightCtrlJustDown() { return !!(NewKeyState.RCTRL && !OldKeyState.RCTRL); }
inline Bool GetLeftAltJustDown() { return !!(NewKeyState.LALT && !OldKeyState.LALT); }
inline Bool GetRightAltJustDown() { return !!(NewKeyState.RALT && !OldKeyState.RALT); }
inline Bool GetLeftWinJustDown() { return !!(NewKeyState.LWIN && !OldKeyState.LWIN); }
inline Bool GetRightWinJustDown() { return !!(NewKeyState.RWIN && !OldKeyState.RWIN); }
inline Bool GetAppsJustDown() { return !!(NewKeyState.APPS && !OldKeyState.APPS); }
inline bool GetCharJustDown(char c) { return !!(NewKeyState.VK_KEYS[c] && !OldKeyState.VK_KEYS[c]); }
inline bool GetFJustDown(int32 n) { return !!(NewKeyState.F[n] && !OldKeyState.F[n]); }
inline bool GetEscapeJustDown() { return !!(NewKeyState.ESC && !OldKeyState.ESC); }
inline bool GetInsertJustDown() { return !!(NewKeyState.INS && !OldKeyState.INS); }
inline bool GetDeleteJustDown() { return !!(NewKeyState.DEL && !OldKeyState.DEL); }
inline bool GetHomeJustDown() { return !!(NewKeyState.HOME && !OldKeyState.HOME); }
inline bool GetEndJustDown() { return !!(NewKeyState.END && !OldKeyState.END); }
inline bool GetPageUpJustDown() { return !!(NewKeyState.PGUP && !OldKeyState.PGUP); }
inline bool GetPageDownJustDown() { return !!(NewKeyState.PGDN && !OldKeyState.PGDN); }
inline bool GetUpJustDown() { return !!(NewKeyState.UP && !OldKeyState.UP); }
inline bool GetDownJustDown() { return !!(NewKeyState.DOWN && !OldKeyState.DOWN); }
inline bool GetLeftJustDown() { return !!(NewKeyState.LEFT && !OldKeyState.LEFT); }
inline bool GetRightJustDown() { return !!(NewKeyState.RIGHT && !OldKeyState.RIGHT); }
inline bool GetScrollLockJustDown() { return !!(NewKeyState.SCROLLLOCK && !OldKeyState.SCROLLLOCK); }
inline bool GetPauseJustDown() { return !!(NewKeyState.PAUSE && !OldKeyState.PAUSE); }
inline bool GetNumLockJustDown() { return !!(NewKeyState.NUMLOCK && !OldKeyState.NUMLOCK); }
inline bool GetDivideJustDown() { return !!(NewKeyState.DIV && !OldKeyState.DIV); }
inline bool GetTimesJustDown() { return !!(NewKeyState.MUL && !OldKeyState.MUL); }
inline bool GetMinusJustDown() { return !!(NewKeyState.SUB && !OldKeyState.SUB); }
inline bool GetPlusJustDown() { return !!(NewKeyState.ADD && !OldKeyState.ADD); }
inline bool GetPadEnterJustDown() { return !!(NewKeyState.ENTER && !OldKeyState.ENTER); } // GetEnterJustDown
inline bool GetPadDelJustDown() { return !!(NewKeyState.DECIMAL && !OldKeyState.DECIMAL); }
inline bool GetPad1JustDown() { return !!(NewKeyState.NUM1 && !OldKeyState.NUM1); }
inline bool GetPad2JustDown() { return !!(NewKeyState.NUM2 && !OldKeyState.NUM2); }
inline bool GetPad3JustDown() { return !!(NewKeyState.NUM3 && !OldKeyState.NUM3); }
inline bool GetPad4JustDown() { return !!(NewKeyState.NUM4 && !OldKeyState.NUM4); }
inline bool GetPad5JustDown() { return !!(NewKeyState.NUM5 && !OldKeyState.NUM5); }
inline bool GetPad6JustDown() { return !!(NewKeyState.NUM6 && !OldKeyState.NUM6); }
inline bool GetPad7JustDown() { return !!(NewKeyState.NUM7 && !OldKeyState.NUM7); }
inline bool GetPad8JustDown() { return !!(NewKeyState.NUM8 && !OldKeyState.NUM8); }
inline bool GetPad9JustDown() { return !!(NewKeyState.NUM9 && !OldKeyState.NUM9); }
inline bool GetPad0JustDown() { return !!(NewKeyState.NUM0 && !OldKeyState.NUM0); }
inline bool GetBackspaceJustDown() { return !!(NewKeyState.BACKSP && !OldKeyState.BACKSP); }
inline bool GetTabJustDown() { return !!(NewKeyState.TAB && !OldKeyState.TAB); }
inline bool GetCapsLockJustDown() { return !!(NewKeyState.CAPSLOCK && !OldKeyState.CAPSLOCK); }
inline bool GetEnterJustDown() { return !!(NewKeyState.EXTENTER && !OldKeyState.EXTENTER); }
inline bool GetLeftShiftJustDown() { return !!(NewKeyState.LSHIFT && !OldKeyState.LSHIFT); }
inline bool GetShiftJustDown() { return !!(NewKeyState.SHIFT && !OldKeyState.SHIFT); }
inline bool GetRightShiftJustDown() { return !!(NewKeyState.RSHIFT && !OldKeyState.RSHIFT); }
inline bool GetLeftCtrlJustDown() { return !!(NewKeyState.LCTRL && !OldKeyState.LCTRL); }
inline bool GetRightCtrlJustDown() { return !!(NewKeyState.RCTRL && !OldKeyState.RCTRL); }
inline bool GetLeftAltJustDown() { return !!(NewKeyState.LALT && !OldKeyState.LALT); }
inline bool GetRightAltJustDown() { return !!(NewKeyState.RALT && !OldKeyState.RALT); }
inline bool GetLeftWinJustDown() { return !!(NewKeyState.LWIN && !OldKeyState.LWIN); }
inline bool GetRightWinJustDown() { return !!(NewKeyState.RWIN && !OldKeyState.RWIN); }
inline bool GetAppsJustDown() { return !!(NewKeyState.APPS && !OldKeyState.APPS); }
// pad
inline Bool GetTriangleJustDown() { return !!(NewState.Triangle && !OldState.Triangle); }
inline Bool GetCircleJustDown() { return !!(NewState.Circle && !OldState.Circle); }
inline Bool GetCrossJustDown() { return !!(NewState.Cross && !OldState.Cross); }
inline Bool GetSquareJustDown() { return !!(NewState.Square && !OldState.Square); }
inline Bool GetDPadUpJustDown() { return !!(NewState.DPadUp && !OldState.DPadUp); }
inline Bool GetDPadDownJustDown() { return !!(NewState.DPadDown && !OldState.DPadDown); }
inline Bool GetDPadLeftJustDown() { return !!(NewState.DPadLeft && !OldState.DPadLeft); }
inline Bool GetDPadRightJustDown() { return !!(NewState.DPadRight && !OldState.DPadRight); }
inline Bool GetLeftShoulder1JustDown() { return !!(NewState.LeftShoulder1 && !OldState.LeftShoulder1); }
inline Bool GetLeftShoulder2JustDown() { return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2); }
inline Bool GetRightShoulder1JustDown() { return !!(NewState.RightShoulder1 && !OldState.RightShoulder1); }
inline Bool GetRightShoulder2JustDown() { return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); }
inline bool GetTriangleJustDown() { return !!(NewState.Triangle && !OldState.Triangle); }
inline bool GetCircleJustDown() { return !!(NewState.Circle && !OldState.Circle); }
inline bool GetCrossJustDown() { return !!(NewState.Cross && !OldState.Cross); }
inline bool GetSquareJustDown() { return !!(NewState.Square && !OldState.Square); }
inline bool GetDPadUpJustDown() { return !!(NewState.DPadUp && !OldState.DPadUp); }
inline bool GetDPadDownJustDown() { return !!(NewState.DPadDown && !OldState.DPadDown); }
inline bool GetDPadLeftJustDown() { return !!(NewState.DPadLeft && !OldState.DPadLeft); }
inline bool GetDPadRightJustDown() { return !!(NewState.DPadRight && !OldState.DPadRight); }
inline bool GetLeftShoulder1JustDown() { return !!(NewState.LeftShoulder1 && !OldState.LeftShoulder1); }
inline bool GetLeftShoulder2JustDown() { return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2); }
inline bool GetRightShoulder1JustDown() { return !!(NewState.RightShoulder1 && !OldState.RightShoulder1); }
inline bool GetRightShoulder2JustDown() { return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); }
inline Int32 GetLeftShoulder1(void) { return NewState.LeftShoulder1; }
inline Int32 GetLeftShoulder2(void) { return NewState.LeftShoulder2; }
inline Int32 GetRightShoulder1(void) { return NewState.RightShoulder1; }
inline Int32 GetRightShoulder2(void) { return NewState.RightShoulder2; }
inline int32 GetLeftShoulder1(void) { return NewState.LeftShoulder1; }
inline int32 GetLeftShoulder2(void) { return NewState.LeftShoulder2; }
inline int32 GetRightShoulder1(void) { return NewState.RightShoulder1; }
inline int32 GetRightShoulder2(void) { return NewState.RightShoulder2; }
};
VALIDATE_SIZE(CPad, 0xFC);

17
src/PedStat.h Normal file
View File

@ -0,0 +1,17 @@
#pragma once
struct PedStat
{
uint32 m_id;
char m_name[24];
int32 m_fleeDistance;
int32 m_headingChangeRate;
int8 m_fear;
int8 m_temper;
int8 m_lawfulness;
int8 m_sexiness;
int32 m_attackStrength;
int32 m_defendWeakness;
int16 m_flags;
};
static_assert(sizeof(PedStat) == 0x34, "PedStat: error");

View File

@ -1,5 +1,48 @@
#include "common.h"
#include "patcher.h"
#include "Radar.h"
#include "Camera.h"
#include "Hud.h"
#include "World.h"
#include "Frontend.h"
WRAPPER void CRadar::ClearBlipForEntity(eBlipType type, int32 id) { EAXJMP(0x4A56C0); }
WRAPPER void CRadar::Draw3dMarkers() { EAXJMP(0x4A4C70); }
//WRAPPER void CRadar::DrawMap () { EAXJMP(0x4A4200); }
WRAPPER void CRadar::DrawBlips() { EAXJMP(0x4A42F0); }
WRAPPER void CRadar::DrawRadarMap() { EAXJMP(0x4A6C20); }
float &CRadar::m_RadarRange = *(float*)0x8E281C;
CVector2D &CRadar::vec2DRadarOrigin = *(CVector2D*)0x6299B8;
void CRadar::DrawMap()
{
if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) {
if (FindPlayerVehicle()) {
if (FindPlayerVehicle()->GetSpeed().Magnitude() > 0.3f) {
if (FindPlayerVehicle()->GetSpeed().Magnitude() > 0.9f)
CRadar::m_RadarRange = 350.0f;
else
CRadar::m_RadarRange = (FindPlayerVehicle()->GetSpeed().Magnitude() + 0.3f) * 200.0f;
}
else
CRadar::m_RadarRange = 120.0f;
}
else
CRadar::m_RadarRange = 120.0f;
vec2DRadarOrigin.x = FindPlayerCentreOfWorld_NoSniperShift().x;
vec2DRadarOrigin.y = FindPlayerCentreOfWorld_NoSniperShift().y;
CRadar::DrawRadarMap();
}
}
void CRadar::TransformRadarPointToScreenSpace(CVector2D *out, CVector2D *in)
{
out->x = in->x * HUD_STRETCH_X(47.0f) + HUD_STRETCH_X(47.0f + 20.0f);
out->y = (HUD_STRETCH_Y(76.0f)) * 0.5f + SCREEN_HEIGHT - (HUD_STRETCH_Y(123.0f)) - in->y * (HUD_STRETCH_Y(76.0f)) * 0.5f;
}
STARTPATCHES
InjectHook(0x4A5040, CRadar::TransformRadarPointToScreenSpace, PATCH_JUMP);
ENDPATCHES

View File

@ -1,4 +1,5 @@
#pragma once
#include "Sprite2d.h"
enum eBlipType
{
@ -12,6 +13,15 @@ enum eBlipType
class CRadar
{
public:
static float &m_RadarRange;
static CVector2D &vec2DRadarOrigin;
public:
static void ClearBlipForEntity(eBlipType type, int32 id);
static void Draw3dMarkers();
static void DrawMap();
static void TransformRadarPointToScreenSpace(CVector2D * out, CVector2D * in);
static void DrawBlips();
static void DrawRadarMap();
};

View File

@ -6,6 +6,9 @@ RwObject *GetFirstObject(RwFrame *frame);
RpAtomic *GetFirstAtomic(RpClump *clump);
RwTexDictionary *RwTexDictionaryGtaStreamRead(RwStream *stream);
RwTexDictionary *RwTexDictionaryGtaStreamRead1(RwStream *stream);
RwTexDictionary *RwTexDictionaryGtaStreamRead2(RwStream *stream, RwTexDictionary *texDict);
bool RpClumpGtaStreamRead1(RwStream *stream);
RpClump *RpClumpGtaStreamRead2(RwStream *stream);
void RpClumpGtaCancelStream(void);

View File

@ -1,4 +1,5 @@
#include "common.h"
#include "Stats.h"
Int32 &CStats::DaysPassed = *(Int32*)0x8F2BB8;
int32 &CStats::DaysPassed = *(int32*)0x8F2BB8;
int32 &CStats::HeadShots = *(int32*)0x8F647C;

View File

@ -3,5 +3,6 @@
class CStats
{
public:
static Int32 &DaysPassed;
static int32 &DaysPassed;
static int32 &HeadShots;
};

View File

@ -17,13 +17,13 @@ bool &CTimer::m_UserPause = *(bool*)0x95CD7C;
bool &CTimer::m_CodePause = *(bool*)0x95CDB1;
//UInt32 oldPcTimer;
UInt32 &oldPcTimer = *(UInt32*)0x9434F4;
uint32 &oldPcTimer = *(uint32*)0x9434F4;
//UInt32 suspendPcTimer;
UInt32 &suspendPcTimer = *(UInt32*)0x62A308;
uint32 &suspendPcTimer = *(uint32*)0x62A308;
//UInt32 _nCyclesPerMS = 1;
UInt32 &_nCyclesPerMS = *(UInt32*)0x5F7610;
uint32 &_nCyclesPerMS = *(uint32*)0x5F7610;
//LARGE_INTEGER _oldPerfCounter;
LARGE_INTEGER &_oldPerfCounter = *(LARGE_INTEGER*)0x62A310;
@ -32,7 +32,7 @@ LARGE_INTEGER &_oldPerfCounter = *(LARGE_INTEGER*)0x62A310;
LARGE_INTEGER &perfSuspendCounter = *(LARGE_INTEGER*)0x62A318;
//UInt32 suspendDepth;
UInt32 &suspendDepth = *(UInt32*)0x62A320;
uint32 &suspendDepth = *(uint32*)0x62A320;
void CTimer::Initialise(void)
{
@ -51,7 +51,7 @@ void CTimer::Initialise(void)
if ( QueryPerformanceFrequency(&perfFreq) )
{
OutputDebugString("Performance counter available\n");
_nCyclesPerMS = UInt32(perfFreq.QuadPart / 1000);
_nCyclesPerMS = uint32(perfFreq.QuadPart / 1000);
QueryPerformanceCounter(&_oldPerfCounter);
}
else
@ -82,18 +82,18 @@ void CTimer::Update(void)
{
m_snPreviousTimeInMilliseconds = m_snTimeInMilliseconds;
if ( (Double)_nCyclesPerMS != 0.0 )
if ( (double)_nCyclesPerMS != 0.0 )
{
LARGE_INTEGER pc;
QueryPerformanceCounter(&pc);
Int32 updInCycles = (pc.LowPart - _oldPerfCounter.LowPart) & 0x7FFFFFFF;
int32 updInCycles = (pc.LowPart - _oldPerfCounter.LowPart) & 0x7FFFFFFF;
_oldPerfCounter = pc;
Double updInCyclesScaled = (Double)updInCycles * ms_fTimeScale;
double updInCyclesScaled = (double)updInCycles * ms_fTimeScale;
Double upd = updInCyclesScaled / (Double)_nCyclesPerMS;
double upd = updInCyclesScaled / (double)_nCyclesPerMS;
m_snTimeInMillisecondsPauseMode = (Int64)(m_snTimeInMillisecondsPauseMode + upd);
@ -103,16 +103,16 @@ void CTimer::Update(void)
{
m_snTimeInMilliseconds = (Int64)(m_snTimeInMilliseconds + upd);
m_snTimeInMillisecondsNonClipped = (Int64)(m_snTimeInMillisecondsNonClipped + upd);
ms_fTimeStep = updInCyclesScaled / (Double)_nCyclesPerMS / 20.0;
ms_fTimeStep = updInCyclesScaled / (double)_nCyclesPerMS / 20.0;
}
}
else
{
UInt32 timer = RsTimer();
uint32 timer = RsTimer();
UInt32 updInMs = timer - oldPcTimer;
uint32 updInMs = timer - oldPcTimer;
Double upd = (Double)updInMs * ms_fTimeScale;
double upd = (double)updInMs * ms_fTimeScale;
oldPcTimer = timer;
@ -156,7 +156,7 @@ void CTimer::Suspend(void)
if ( ++suspendDepth > 1 )
return;
if ( (Double)_nCyclesPerMS != 0.0 )
if ( (double)_nCyclesPerMS != 0.0 )
QueryPerformanceCounter(&perfSuspendCounter);
else
suspendPcTimer = RsTimer();
@ -167,7 +167,7 @@ void CTimer::Resume(void)
if ( --suspendDepth != 0 )
return;
if ( (Double)_nCyclesPerMS != 0.0 )
if ( (double)_nCyclesPerMS != 0.0 )
{
LARGE_INTEGER pc;
QueryPerformanceCounter(&pc);
@ -178,7 +178,7 @@ void CTimer::Resume(void)
oldPcTimer += RsTimer() - suspendPcTimer;
}
UInt32 CTimer::GetCyclesPerMillisecond(void)
uint32 CTimer::GetCyclesPerMillisecond(void)
{
if (_nCyclesPerMS != 0)
return _nCyclesPerMS;
@ -186,7 +186,7 @@ UInt32 CTimer::GetCyclesPerMillisecond(void)
return 1;
}
UInt32 CTimer::GetCurrentTimeInCycles(void)
uint32 CTimer::GetCurrentTimeInCycles(void)
{
if ( _nCyclesPerMS != 0 )
{
@ -198,7 +198,7 @@ UInt32 CTimer::GetCurrentTimeInCycles(void)
return RsTimer() - oldPcTimer;
}
Bool CTimer::GetIsSlowMotionActive(void)
bool CTimer::GetIsSlowMotionActive(void)
{
return ms_fTimeScale < 1.0f;
}

View File

@ -19,17 +19,18 @@ public:
static uint32 GetFrameCounter(void) { return m_FrameCounter; }
static uint32 GetTimeInMilliseconds(void) { return m_snTimeInMilliseconds; }
static inline Bool GetIsPaused() { return m_UserPause || m_CodePause; }
static inline void SetTimeScale(Float ts) { ms_fTimeScale = ts; }
static inline bool GetIsPaused() { return m_UserPause || m_CodePause; }
static inline bool GetIsUserPaused() { return m_UserPause; }
static inline void SetTimeScale(float ts) { ms_fTimeScale = ts; }
static void Initialise(void);
static void Shutdown(void);
static void Update(void);
static void Suspend(void);
static void Resume(void);
static UInt32 GetCyclesPerMillisecond(void);
static UInt32 GetCurrentTimeInCycles(void);
static Bool GetIsSlowMotionActive(void);
static uint32 GetCyclesPerMillisecond(void);
static uint32 GetCurrentTimeInCycles(void);
static bool GetIsSlowMotionActive(void);
static void Stop(void);
static void StartUserPause(void);
static void EndUserPause(void);

View File

@ -22,6 +22,18 @@ CTxdStore::Shutdown(void)
delete ms_pTxdPool;
}
void
CTxdStore::GameShutdown(void)
{
int i;
for(i = 0; i < TXDSTORESIZE; i++){
TxdDef *def = GetSlot(i);
if(def && GetNumRefs(i) == 0)
RemoveTxdSlot(i);
}
}
int
CTxdStore::AddTxdSlot(const char *name)
{
@ -89,6 +101,12 @@ CTxdStore::Create(int slot)
GetSlot(slot)->texDict = RwTexDictionaryCreate();
}
int
CTxdStore::GetNumRefs(int slot)
{
return GetSlot(slot)->refCount;
}
void
CTxdStore::AddRef(int slot)
{
@ -137,6 +155,27 @@ CTxdStore::LoadTxd(int slot, const char *filename)
return ret;
}
bool
CTxdStore::StartLoadTxd(int slot, RwStream *stream)
{
TxdDef *def = GetSlot(slot);
if(RwStreamFindChunk(stream, rwID_TEXDICTIONARY, nil, nil)){
def->texDict = RwTexDictionaryGtaStreamRead1(stream);
return def->texDict != nil;
}else{
printf("Failed to load TXD\n");
return nil;
}
}
bool
CTxdStore::FinishLoadTxd(int slot, RwStream *stream)
{
TxdDef *def = GetSlot(slot);
def->texDict = RwTexDictionaryGtaStreamRead2(stream, def->texDict);
return def->texDict != nil;
}
void
CTxdStore::RemoveTxd(int slot)
{
@ -146,15 +185,10 @@ CTxdStore::RemoveTxd(int slot)
def->texDict = nil;
}
//bool
//CTxdStore::isTxdLoaded(int slot)
//{
// return GetSlot(slot)->texDict != nil;
//}
STARTPATCHES
InjectHook(0x527440, CTxdStore::Initialize, PATCH_JUMP);
InjectHook(0x527470, CTxdStore::Shutdown, PATCH_JUMP);
InjectHook(0x527490, CTxdStore::GameShutdown, PATCH_JUMP);
InjectHook(0x5274E0, CTxdStore::AddTxdSlot, PATCH_JUMP);
InjectHook(0x5275D0, CTxdStore::FindTxdSlot, PATCH_JUMP);
InjectHook(0x527590, CTxdStore::GetTxdName, PATCH_JUMP);
@ -162,8 +196,13 @@ STARTPATCHES
InjectHook(0x527910, CTxdStore::PopCurrentTxd, PATCH_JUMP);
InjectHook(0x5278C0, CTxdStore::SetCurrentTxd, PATCH_JUMP);
InjectHook(0x527830, CTxdStore::Create, PATCH_JUMP);
InjectHook(0x527A00, CTxdStore::GetNumRefs, PATCH_JUMP);
InjectHook(0x527930, CTxdStore::AddRef, PATCH_JUMP);
InjectHook(0x527970, CTxdStore::RemoveRef, PATCH_JUMP);
InjectHook(0x5279C0, CTxdStore::RemoveRefWithoutDelete, PATCH_JUMP);
InjectHook(0x527700, (bool (*)(int, RwStream*))CTxdStore::LoadTxd, PATCH_JUMP);
InjectHook(0x5276B0, (bool (*)(int, const char*))CTxdStore::LoadTxd, PATCH_JUMP);
InjectHook(0x527770, CTxdStore::StartLoadTxd, PATCH_JUMP);
InjectHook(0x5277E0, CTxdStore::FinishLoadTxd, PATCH_JUMP);
InjectHook(0x527870, CTxdStore::RemoveTxd, PATCH_JUMP);
ENDPATCHES

View File

@ -15,6 +15,7 @@ class CTxdStore
public:
static void Initialize(void);
static void Shutdown(void);
static void GameShutdown(void);
static int AddTxdSlot(const char *name);
static void RemoveTxdSlot(int slot);
static int FindTxdSlot(const char *name);
@ -23,13 +24,21 @@ public:
static void PopCurrentTxd(void);
static void SetCurrentTxd(int slot);
static void Create(int slot);
static int GetNumRefs(int slot);
static void AddRef(int slot);
static void RemoveRef(int slot);
static void RemoveRefWithoutDelete(int slot);
static bool LoadTxd(int slot, RwStream *stream);
static bool LoadTxd(int slot, const char *filename);
static bool StartLoadTxd(int slot, RwStream *stream);
static bool FinishLoadTxd(int slot, RwStream *stream);
static void RemoveTxd(int slot);
static TxdDef *GetSlot(int slot) { return ms_pTxdPool->GetSlot(slot); }
static TxdDef *GetSlot(int slot) {
assert(slot >= 0);
assert(ms_pTxdPool);
assert(slot < ms_pTxdPool->GetSize());
return ms_pTxdPool->GetSlot(slot);
}
static bool isTxdLoaded(int slot);
};

3
src/Wanted.cpp Normal file
View File

@ -0,0 +1,3 @@
#include "common.h"
#include "patcher.h"
#include "Wanted.h"

85
src/Wanted.h Normal file
View File

@ -0,0 +1,85 @@
#pragma once
#include "Entity.h"
#include "math/Vector.h"
enum eCrimeType
{
CRIME_NONE,
CRIME_SHOT_FIRED,
CRIME_PED_FIGHT,
CRIME_COP_FIGHT,
CRIME_DAMAGED_PED,
CRIME_DAMAGED_COP,
CRIME_CAR_THEFT,
CRIME_CRIME7,
CRIME_COP_EVASIVE_DIVE,
CRIME_COP_EVASIVE_DIVE2,
CRIME_PED_RUN_OVER,
CRIME_COP_RUN_OVER,
CRIME_DESTROYED_HELI,
CRIME_PED_BURNED,
CRIME_COP_BURNED,
CRIME_VEHICLE_BURNED,
CRIME_DESTROYED_CESSNA,
};
enum eCopType
{
COP_STREET = 0,
COP_FBI = 1,
COP_SWAT = 2,
COP_ARMY = 3,
};
class CCrime {
public:
eCrimeType m_eCrimeType;
CEntity *m_pVictim;
int32 m_nCrimeTime;
CVector m_vecCrimePos;
int8 m_bReported;
int8 m_bMultiplier;
int8 pad_20[2];
};
class CCopPed {
public:
int16 m_wRoadblockNode;
int8 field_1342;
int8 field_1343;
float m_fDistanceToTarget;
int8 m_bIsInPursuit;
int8 m_bIsDisabledCop;
int8 field_1350;
int8 field_1351;
int8 m_bZoneDisabledButClose;
int8 m_bZoneDisabled;
int8 field_1354;
int8 field_1355;
int32 field_1356;
eCopType m_nCopType;
int8 field_1364;
int8 field_1365;
int8 field_1366;
int8 field_1367;
};
class CWanted {
public:
int32 m_nChaos;
int32 m_nLastUpdateTime;
int32 m_nLastWantedLevelChange;
float m_fCrimeSensitivity;
uint8 m_bCurrentCops;
uint8 m_bMaxCops;
uint8 m_bMaximumLawEnforcerVehicles;
int8 field_19;
int16 m_wRoadblockDensity;
uint8 m_bFlags;
int8 field_23;
int32 m_nWantedLevel;
CCrime m_sCrimes[16];
CCopPed *m_pCops[10];
};
static_assert(sizeof(CWanted) == 0x204, "CWanted: error");

View File

@ -12,6 +12,8 @@ CPtrList &CWorld::ms_listMovingEntityPtrs = *(CPtrList*)0x8F433C;
CSector (*CWorld::ms_aSectors)[NUMSECTORS_X] = (CSector (*)[NUMSECTORS_Y])0x665608;
uint16 &CWorld::ms_nCurrentScanCode = *(uint16*)0x95CC64;
uint8 &CWorld::PlayerInFocus = *(uint8 *)0x95CD61;
CPlayerInfo *CWorld::Players = (CPlayerInfo *)0x9412F0;
bool &CWorld::bNoMoreCollisionTorque = *(bool*)0x95CDCC;
CEntity *&CWorld::pIgnoreEntity = *(CEntity**)0x8F6494;
bool &CWorld::bIncludeDeadPeds = *(bool*)0x95CD8F;
@ -588,3 +590,6 @@ WRAPPER CPed *FindPlayerPed(void) { EAXJMP(0x4A1150); }
WRAPPER CVector &FindPlayerCoors(CVector &v) { EAXJMP(0x4A1030); }
WRAPPER CVehicle *FindPlayerVehicle(void) { EAXJMP(0x4A10C0); }
WRAPPER CVehicle *FindPlayerTrain(void) { EAXJMP(0x4A1120); }
WRAPPER CVector FindPlayerSpeed(void) { EAXJMP(0x4A1090); }
WRAPPER CVector FindPlayerCentreOfWorld_NoSniperShift(void) { EAXJMP(0x4A11C0); }

View File

@ -2,6 +2,7 @@
#include "Game.h"
#include "Lists.h"
#include "PlayerInfo.h"
/* Sectors span from -2000 to 2000 in x and y.
* With 100x100 sectors, each is 40x40 units. */
@ -45,6 +46,8 @@ class CWorld
static uint16 &ms_nCurrentScanCode;
public:
static uint8 &PlayerInFocus;
static CPlayerInfo *Players;
static CEntity *&pIgnoreEntity;
static bool &bIncludeDeadPeds;
static bool &bNoMoreCollisionTorque;
@ -95,3 +98,5 @@ CPed *FindPlayerPed(void);
CVector &FindPlayerCoors(CVector &v);
CVehicle *FindPlayerVehicle(void);
CVehicle *FindPlayerTrain(void);
CVector FindPlayerSpeed(void);
CVector FindPlayerCentreOfWorld_NoSniperShift(void);

View File

@ -1,7 +1,7 @@
#include "common.h"
#include "AudioScriptObject.h"
void PlayOneShotScriptObject(UInt8 id, CVector const &pos)
void PlayOneShotScriptObject(uint8 id, CVector const &pos)
{
((void (__cdecl *)(UInt8, CVector const &))0x57C5F0)(id, pos);
((void (__cdecl *)(uint8, CVector const &))0x57C5F0)(id, pos);
}

View File

@ -128,4 +128,4 @@ enum /*eSounds*/
_SOUND_BULLET_SHELL_HIT_GROUND_2 = 123,
};
extern void PlayOneShotScriptObject(UInt8 id, CVector const &pos);
extern void PlayOneShotScriptObject(uint8 id, CVector const &pos);

View File

@ -10,10 +10,10 @@ WRAPPER void cDMAudio::ReacquireDigitalHandle(void) { EAXJMP(0x57CA30); }
WRAPPER void cDMAudio::Service(void) { EAXJMP(0x57C7A0); }
WRAPPER void cDMAudio::ReportCollision(CEntity *A, CEntity *B, uint8 surfA, uint8 surfB, float impulse, float speed) { EAXJMP(0x57CBE0); }
WRAPPER void cDMAudio::ResetTimers(UInt32 timerval) { EAXJMP(0x57CCD0); }
WRAPPER Bool cDMAudio::IsAudioInitialised() { EAXJMP(0x57CAB0); }
WRAPPER Char cDMAudio::GetCDAudioDriveLetter() { EAXJMP(0x57CA90); }
WRAPPER Bool cDMAudio::CheckForAnAudioFileOnCD() { EAXJMP(0x57CA70); }
WRAPPER void cDMAudio::ChangeMusicMode(UInt8 mode) { EAXJMP(0x57CCF0); }
WRAPPER void cDMAudio::ResetTimers(uint32 timerval) { EAXJMP(0x57CCD0); }
WRAPPER bool cDMAudio::IsAudioInitialised() { EAXJMP(0x57CAB0); }
WRAPPER char cDMAudio::GetCDAudioDriveLetter() { EAXJMP(0x57CA90); }
WRAPPER bool cDMAudio::CheckForAnAudioFileOnCD() { EAXJMP(0x57CA70); }
WRAPPER void cDMAudio::ChangeMusicMode(uint8 mode) { EAXJMP(0x57CCF0); }
WRAPPER void cDMAudio::PlayFrontEndSound(uint32, uint32) { EAXJMP(0x57CC20); }

View File

@ -1,5 +1,177 @@
#pragma once
enum eSound
{
SOUND_CAR_DOOR_CLOSE_BONNET = 0,
SOUND_CAR_DOOR_CLOSE_BUMPER = 1,
SOUND_CAR_DOOR_CLOSE_FRONT_LEFT = 2,
SOUND_CAR_DOOR_CLOSE_FRONT_RIGHT = 3,
SOUND_CAR_DOOR_CLOSE_BACK_LEFT = 4,
SOUND_CAR_DOOR_CLOSE_BACK_RIGHT = 5,
SOUND_CAR_DOOR_OPEN_BONNET = 6,
SOUND_CAR_DOOR_OPEN_BUMPER = 7,
SOUND_CAR_DOOR_OPEN_FRONT_LEFT = 8,
SOUND_CAR_DOOR_OPEN_FRONT_RIGHT = 9,
SOUND_CAR_DOOR_OPEN_BACK_LEFT = 10,
SOUND_CAR_DOOR_OPEN_BACK_RIGHT = 11,
SOUND_CAR_WINDSHIELD_CRACK = 12,
SOUND_CAR_JUMP = 13,
SOUND_E = 14,
SOUND_F = 15,
SOUND_CAR_ENGINE_START = 16,
SOUND_CAR_LIGHT_BREAK = 17,
SOUND_CAR_HYDRALIC_1 = 18,
SOUND_CAR_HYDRALIC_2 = 19,
SOUND_CAR_HYDRALIC_3 = 20,
SOUND_CAR_JERK = 21,
SOUND_CAR_SPLASH = 22,
SOUND_17 = 23,
SOUND_18 = 24,
SOUND_19 = 25,
SOUND_CAR_TANK_TURRET_ROTATE = 26,
SOUND_CAR_BOMB_TICK = 27,
SOUND_PLANE_ON_GROUND = 28,
SOUND_STEP_START = 29,
SOUND_STEP_END = 30,
SOUND_FALL_LAND = 31,
SOUND_FALL_COLLAPSE = 32,
SOUND_21 = 33,
SOUND_22 = 34,
SOUND_23 = 35,
SOUND_24 = 36,
SOUND_25 = 37,
SOUND_26 = 38,
SOUND_WEAPON_PUNCH_ATTACK = 39,
SOUND_28 = 40,
SOUND_29 = 41,
SOUND_2A = 42,
SOUND_2B = 43,
SOUND_2C = 44,
SOUND_2D = 45,
SOUND_WEAPON_BAT_ATTACK = 46,
SOUND_WEAPON_SHOT_FIRED = 47,
SOUND_WEAPON_RELOAD = 48,
SOUND_31 = 49,
SOUND_32 = 50,
SOUND_33 = 51,
SOUND_WEAPON_FLAMETHROWER_FIRE = 52,
SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM = 53,
SOUND_WEAPON_ROCKET_SHOT_NO_ZOOM = 54,
SOUND_WEAPON_HIT_PED = 55,
SOUND_WEAPON_HIT_VEHICLE = 56,
SOUND_GARAGE_NO_MONEY = 57,
SOUND_GARAGE_BAD_VEHICLE = 58,
SOUND_GARAGE_OPENING = 59,
SOUND_3C = 60,
SOUND_GARAGE_BOMB1_SET = 61,
SOUND_GARAGE_BOMB2_SET = 62,
SOUND_GARAGE_BOMB3_SET = 63,
SOUND_40 = 64,
SOUND_41 = 65,
SOUND_GARAGE_VEHICLE_DECLINED = 66,
SOUND_GARAGE_VEHICLE_ACCEPTED = 67,
SOUND_GARAGE_DOOR_CLOSED = 68,
SOUND_GARAGE_DOOR_OPENED = 69,
SOUND_CRANE_PICKUP = 70,
SOUND_PICKUP_WEAPON_BOUGHT = 71,
SOUND_PICKUP_WEAPON = 72,
SOUND_PICKUP_HEALTH = 73,
SOUND_4A = 74,
SOUND_4B = 75,
SOUND_PICKUP_ADRENALINE = 76,
SOUND_PICKUP_ARMOUR = 77,
SOUND_PICKUP_BONUS = 78,
SOUND_PICKUP_MONEY = 79,
SOUND_PICKUP_HIDDEN_PACKAGE = 80,
SOUND_PICKUP_PACMAN_PILL = 81,
SOUND_PICKUP_PACMAN_PACKAGE = 82,
SOUND_PICKUP_FLOAT_PACKAGE = 83,
SOUND_BOMB_TIMED_ACTIVATED = 84,
SOUND_55 = 85,
SOUND_BOMB_ONIGNITION_ACTIVATED = 86,
SOUND_BOMB_TICK = 87,
SOUND_RAMPAGE_START = 88,
SOUND_RAMPAGE_ONGOING = 89,
SOUND_RAMPAGE_PASSED = 90,
SOUND_RAMPAGE_FAILED = 91,
SOUND_RAMPAGE_KILL = 92,
SOUND_RAMPAGE_CAR_BLOWN = 93,
_SOUND_EVIDENCE_PICKUP = 94,
_SOUND_UNLOAD_GOLD = 95,
SOUND_PAGER = 96,
SOUND_PED_DEATH = 97,
SOUND_PED_DAMAGE = 98,
SOUND_PED_63 = 99,
SOUND_PED_LAND = 100,
SOUND_PED_BULLET_HIT = 101,
SOUND_PED_BOMBER = 102,
SOUND_PED_BURNING = 103,
SOUND_PED_ARREST_FBI = 104,
SOUND_PED_ARREST_SWAT = 105,
SOUND_PED_ARREST_COP = 106,
SOUND_PED_HELI_PLAYER_FOUND = 107,
SOUND_PED_HANDS_UP = 108,
SOUND_PED_HANDS_COWER = 109,
SOUND_PED_FLEE_SPRINT = 110,
SOUND_PED_CAR_JACKING = 111,
SOUND_PED_MUGGING = 112,
SOUND_PED_CAR_JACKED = 113,
SOUND_PED_ROBBED = 114,
SOUND_PED_TAXI_WAIT = 115,
SOUND_PED_ATTACK = 116,
SOUND_PED_DEFEND = 117,
SOUND_PED_PURSUIT_ARMY = 118,
SOUND_PED_PURSUIT_FBI = 119,
SOUND_PED_PURSUIT_SWAT = 120,
SOUND_PED_PURSUIT_COP = 121,
SOUND_PED_HEALING = 122,
SOUND_PED_7B = 123,
SOUND_PED_LEAVE_VEHICLE = 124,
SOUND_PED_EVADE = 125,
SOUND_PED_FLEE_RUN = 126,
SOUND_PED_CAR_COLLISION = 127,
SOUND_PED_SOLICIT = 128,
SOUND_PED_EXTINGUISHING_FIRE = 129,
SOUND_PED_WAIT_DOUBLEBACK = 130,
SOUND_PED_CHAT_SEXY = 131,
SOUND_PED_CHAT_EVENT = 132,
SOUND_PED_CHAT = 133,
SOUND_PED_BODYCAST_HIT = 134,
SOUND_PED_TAXI_CALL = 135,
SOUND_INJURED_PED_MALE_OUCH = 136,
SOUND_INJURED_PED_FEMALE = 137,
SOUND_8A = 138,
_SOUND_RACE_START_3 = 139,
_SOUND_RACE_START_2 = 140,
_SOUND_RACE_START_1 = 141,
_SOUND_RACE_START_GO = 142,
SOUND_SPLASH = 143,
SOUND_WATER_FALL = 144,
SOUND_SPLATTER = 145,
SOUND_CAR_PED_COLLISION = 146,
SOUND_CLOCK_TICK = 147,
_SOUND_PART_MISSION_COMPLETE = 148,
SOUND_FRONTEND_MENU_STARTING = 149,
SOUND_FRONTEND_MENU_COMPLETED = 150,
SOUND_FRONTEND_MENU_DENIED = 151,
SOUND_FRONTEND_MENU_SUCCESS = 152,
SOUND_FRONTEND_EXIT = 153,
SOUND_9A = 154,
SOUND_9B = 155,
SOUND_FRONTEND_AUDIO_TEST = 156,
SOUND_FRONTEND_FAIL = 157,
SOUND_FRONTEND_NO_RADIO = 158,
SOUND_FRONTEND_RADIO_CHANGE = 159,
SOUND_A0 = 160,
SOUND_AMMUNATION_WELCOME_1 = 161,
SOUND_AMMUNATION_WELCOME_2 = 162,
SOUND_AMMUNATION_WELCOME_3 = 163,
SOUND_LIGHTNING = 164,
SOUND_A5 = 165,
SOUND_TOTAL_SOUNDS = 166,
SOUND_TOTAL_PED_SOUNDS = 167,
};
class CEntity;
class cDMAudio
@ -9,13 +181,12 @@ public:
void ReleaseDigitalHandle(void);
void ReacquireDigitalHandle(void);
void Service(void);
void ReportCollision(CEntity* A, CEntity* B, uint8 surfA, uint8 surfB,
float impulse, float speed);
void ResetTimers(UInt32 timerval);
Bool IsAudioInitialised(void);
Char GetCDAudioDriveLetter(void);
Bool CheckForAnAudioFileOnCD(void);
void ChangeMusicMode(UInt8 mode);
void ReportCollision(CEntity* A, CEntity* B, uint8 surfA, uint8 surfB, float impulse, float speed);
void ResetTimers(uint32 timerval);
bool IsAudioInitialised(void);
char GetCDAudioDriveLetter(void);
bool CheckForAnAudioFileOnCD(void);
void ChangeMusicMode(uint8 mode);
void PlayFrontEndSound(uint32, uint32);
};
extern cDMAudio &DMAudio;

View File

@ -1,7 +1,141 @@
#include "common.h"
#include "patcher.h"
#include "MusicManager.h"
#include "Font.h"
#include "Hud.h"
#include "Text.h"
#include "Timer.h"
#include "Camera.h"
#include "World.h"
#include "ModelIndices.h"
#include "SampleManager.h"
cMusicManager &MusicManager = *(cMusicManager*)0x8F3964;
int &gNumRetunePresses = *(int*)0x650B80;
int &gRetuneCounter = *(int*)0x650B84;
WRAPPER void cMusicManager::DisplayRadioStationName(void) { EAXJMP(0x57E6D0); }
//WRAPPER void cMusicManager::DisplayRadioStationName(void) { EAXJMP(0x57E6D0); }
bool cMusicManager::PlayerInCar()
{
if (!FindPlayerVehicle())
return false;
else {
int32 State = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_nPedState;
if (State == PED_DRAG_FROM_CAR || State == PED_EXIT_CAR || State == PED_ARRESTED)
return false;
switch (FindPlayerVehicle()->m_modelIndex) {
case MI_FIRETRUCK:
case MI_AMBULAN:
case MI_MRWHOOP:
case MI_PREDATOR:
case MI_TRAIN:
case MI_SPEEDER:
case MI_REEFER:
case MI_GHOST:
return false;
default:
return true;
}
}
}
void cMusicManager::DisplayRadioStationName()
{
wchar *RadioName = nullptr;
uint32 RadioStation = gNumRetunePresses + MusicManager.m_nCurrentStreamedSound;
switch (RadioStation) {
case HEAD_RADIO:
RadioName = TheText.Get("FEA_FM0");
break;
case DOUBLE_CLEF:
RadioName = TheText.Get("FEA_FM1");
break;
case JAH_RADIO:
RadioName = TheText.Get("FEA_FM2");
break;
case RISE_FM:
RadioName = TheText.Get("FEA_FM3");
break;
case LIPS_106:
RadioName = TheText.Get("FEA_FM4");
break;
case GAME_FM:
RadioName = TheText.Get("FEA_FM5");
break;
case MSX_FM:
RadioName = TheText.Get("FEA_FM6");
break;
case FLASHBACK:
RadioName = TheText.Get("FEA_FM7");
break;
case CHATTERBOX:
RadioName = TheText.Get("FEA_FM8");
break;
case USERTRACK:
RadioName = TheText.Get("FEA_FM9");
break;
default:
RadioName = nullptr;
break;
}
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f));
CFont::SetPropOn();
CFont::SetFontStyle(FONT_HEADING);
CFont::SetCentreOn();
CFont::SetCentreSize(HUD_STRETCH_X(640.0f));;
static int32 nTime = 0;
if (!CTimer::GetIsPaused() && !TheCamera.m_WideScreenOn && MusicManager.PlayerInCar()) {
if (gNumRetunePresses || (MusicManager.m_bPlayerInCar && !MusicManager.m_bPreviousPlayerInCar))
nTime = CTimer::GetTimeInMilliseconds() + 2000;
if (CTimer::GetTimeInMilliseconds() < nTime) {
if (RadioStation) {
if (MusicManager.m_nCurrentStreamedSound == STREAMED_SOUND_WATER_AMBIENT ||
MusicManager.m_nCurrentStreamedSound == STREAMED_SOUND_RADIO_POLICE ||
MusicManager.m_nCurrentStreamedSound == STREAMED_SOUND_WATER_AMBIENT ||
MusicManager.m_nCurrentStreamedSound == STREAMED_SOUND_CITY_AMBIENT)
RadioStation = RADIO_OFF;
else {
if (RadioStation > HEAD_RADIO) {
if (cSampleManager.IsMP3RadioChannelAvailable()) {
if (RadioStation > USERTRACK) {
RadioStation = RADIO_OFF;
return;
}
}
else {
if (RadioStation > CHATTERBOX) {
RadioStation = RADIO_OFF;
return;
}
}
}
else
RadioStation = RADIO_OFF;
}
}
if (RadioName) {
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString(SCREEN_WIDTH / 2, HUD_STRETCH_Y(23.0f), RadioName);
if (gNumRetunePresses)
CFont::SetColor(CRGBA(102, 133, 143, 255));
else
CFont::SetColor(CRGBA(147, 196, 211, 255));
CFont::PrintString(SCREEN_WIDTH / 2, HUD_STRETCH_Y(22.0f), RadioName);
CFont::DrawFonts();
}
}
}
}

View File

@ -1,8 +1,273 @@
#pragma once
enum eRadioStation
{
HEAD_RADIO,
DOUBLE_CLEF,
JAH_RADIO,
RISE_FM,
LIPS_106,
GAME_FM,
MSX_FM,
FLASHBACK,
CHATTERBOX,
USERTRACK,
POLICE_RADIO,
RADIO_OFF,
};
enum eStreamedSounds
{
STREAMED_SOUND_RADIO_HEAD = 0,
STREAMED_SOUND_RADIO_CLASSIC = 1,
STREAMED_SOUND_RADIO_KJAH = 2,
STREAMED_SOUND_RADIO_RISE = 3,
STREAMED_SOUND_RADIO_LIPS = 4,
STREAMED_SOUND_RADIO_GAME = 5,
STREAMED_SOUND_RADIO_MSX = 6,
STREAMED_SOUND_RADIO_FLASH = 7,
STREAMED_SOUND_RADIO_CHAT = 8,
STREAMED_SOUND_RADIO_MP3_PLAYER = 9,
STREAMED_SOUND_RADIO_POLICE = 10,
STREAMED_SOUND_CITY_AMBIENT = 11,
STREAMED_SOUND_WATER_AMBIENT = 12,
STREAMED_SOUND_ANNOUNCE_COMMERCIAL_OPEN = 13,
STREAMED_SOUND_ANNOUNCE_SUBURBAN_OPEN = 14,
STREAMED_SOUND_NEWS_INTRO = 15,
STREAMED_SOUND_BANK_INTRO = 16,
STREAMED_SOUND_CUTSCENE_LUIGI1_LG = 17,
STREAMED_SOUND_CUTSCENE_LUIGI2_DSB = 18,
STREAMED_SOUND_CUTSCENE_LUIGI3_DM = 19,
STREAMED_SOUND_CUTSCENE_LUIGI4_PAP = 20,
STREAMED_SOUND_CUTSCENE_LUIGI5_TFB = 21,
STREAMED_SOUND_CUTSCENE_JOEY0_DM2 = 22,
STREAMED_SOUND_CUTSCENE_JOEY1_LFL = 23,
STREAMED_SOUND_CUTSCENE_JOEY2_KCL = 24,
STREAMED_SOUND_CUTSCENE_JOEY3_VH = 25,
STREAMED_SOUND_CUTSCENE_JOEY4_ETH = 26,
STREAMED_SOUND_CUTSCENE_JOEY5_DST = 27,
STREAMED_SOUND_CUTSCENE_JOEY6_TBJ = 28,
STREAMED_SOUND_CUTSCENE_TONI1_TOL = 29,
STREAMED_SOUND_CUTSCENE_TONI2_TPU = 30,
STREAMED_SOUND_CUTSCENE_TONI3_MAS = 31,
STREAMED_SOUND_CUTSCENE_TONI4_TAT = 32,
STREAMED_SOUND_CUTSCENE_TONI5_BF = 33,
STREAMED_SOUND_CUTSCENE_SAL0_MAS = 34,
STREAMED_SOUND_CUTSCENE_SAL1_PF = 35,
STREAMED_SOUND_CUTSCENE_SAL2_CTG = 36,
STREAMED_SOUND_CUTSCENE_SAL3_RTC = 37,
STREAMED_SOUND_CUTSCENE_SAL5_LRQ = 38,
STREAMED_SOUND_CUTSCENE_SAL4_BDBA = 39,
STREAMED_SOUND_CUTSCENE_SAL4_BDBB = 40,
STREAMED_SOUND_CUTSCENE_SAL2_CTG2 = 41,
STREAMED_SOUND_CUTSCENE_SAL4_BDBD = 42,
STREAMED_SOUND_CUTSCENE_SAL5_LRQB = 43,
STREAMED_SOUND_CUTSCENE_SAL5_LRQC = 44,
STREAMED_SOUND_CUTSCENE_ASUKA_1_SSO = 45,
STREAMED_SOUND_CUTSCENE_ASUKA_2_PP = 46,
STREAMED_SOUND_CUTSCENE_ASUKA_3_SS = 47,
STREAMED_SOUND_CUTSCENE_ASUKA_4_PDR = 48,
STREAMED_SOUND_CUTSCENE_ASUKA_5_K2FT = 49,
STREAMED_SOUND_CUTSCENE_KENJI1_KBO = 50,
STREAMED_SOUND_CUTSCENE_KENJI2_GIS = 51,
STREAMED_SOUND_CUTSCENE_KENJI3_DS = 52,
STREAMED_SOUND_CUTSCENE_KENJI4_SHI = 53,
STREAMED_SOUND_CUTSCENE_KENJI5_SD = 54,
STREAMED_SOUND_CUTSCENE_RAY0_PDR2 = 55,
STREAMED_SOUND_CUTSCENE_RAY1_SW = 56,
STREAMED_SOUND_CUTSCENE_RAY2_AP = 57,
STREAMED_SOUND_CUTSCENE_RAY3_ED = 58,
STREAMED_SOUND_CUTSCENE_RAY4_GF = 59,
STREAMED_SOUND_CUTSCENE_RAY5_PB = 60,
STREAMED_SOUND_CUTSCENE_RAY6_MM = 61,
STREAMED_SOUND_CUTSCENE_DONALD1_STOG = 62,
STREAMED_SOUND_CUTSCENE_DONALD2_KK = 63,
STREAMED_SOUND_CUTSCENE_DONALD3_ADO = 64,
STREAMED_SOUND_CUTSCENE_DONALD5_ES = 65,
STREAMED_SOUND_CUTSCENE_DONALD7_MLD = 66,
STREAMED_SOUND_CUTSCENE_DONALD4_GTA = 67,
STREAMED_SOUND_CUTSCENE_DONALD4_GTA2 = 68,
STREAMED_SOUND_CUTSCENE_DONALD6_STS = 69,
STREAMED_SOUND_CUTSCENE_ASUKA6_BAIT = 70,
STREAMED_SOUND_CUTSCENE_ASUKA7_ETG = 71,
STREAMED_SOUND_CUTSCENE_ASUKA8_PS = 72,
STREAMED_SOUND_CUTSCENE_ASUKA9_ASD = 73,
STREAMED_SOUND_CUTSCENE_KENJI4_SHI2 = 74,
STREAMED_SOUND_CUTSCENE_CATALINA1_TEX = 75,
STREAMED_SOUND_CUTSCENE_ELBURRO1_PH1 = 76,
STREAMED_SOUND_CUTSCENE_ELBURRO2_PH2 = 77,
STREAMED_SOUND_CUTSCENE_ELBURRO3_PH3 = 78,
STREAMED_SOUND_CUTSCENE_ELBURRO4_PH4 = 79,
STREAMED_SOUND_CUTSCENE_YARDIE_PH1 = 80,
STREAMED_SOUND_CUTSCENE_YARDIE_PH2 = 81,
STREAMED_SOUND_CUTSCENE_YARDIE_PH3 = 82,
STREAMED_SOUND_CUTSCENE_YARDIE_PH4 = 83,
STREAMED_SOUND_CUTSCENE_HOODS_PH1 = 84,
STREAMED_SOUND_CUTSCENE_HOODS_PH2 = 85,
STREAMED_SOUND_CUTSCENE_HOODS_PH3 = 86,
STREAMED_SOUND_CUTSCENE_HOODS_PH4 = 87,
STREAMED_SOUND_CUTSCENE_HOODS_PH5 = 88,
STREAMED_SOUND_CUTSCENE_MARTY_PH1 = 89,
STREAMED_SOUND_CUTSCENE_MARTY_PH2 = 90,
STREAMED_SOUND_CUTSCENE_MARTY_PH3 = 91,
STREAMED_SOUND_CUTSCENE_MARTY_PH4 = 92,
STREAMED_SOUND_MISSION_COMPLETED = 93,
STREAMED_SOUND_GAME_COMPLETED = 94,
STREAMED_SOUND_MISSION_LIB_A1 = 95,
STREAMED_SOUND_MISSION_LIB_A2 = 96,
STREAMED_SOUND_MISSION_LIB_A = 97,
STREAMED_SOUND_MISSION_LIB_B = 98,
STREAMED_SOUND_MISSION_LIB_C = 99,
STREAMED_SOUND_MISSION_LIB_D = 100,
STREAMED_SOUND_MISSION_L2_A = 101,
STREAMED_SOUND_MISSION_J4T_1 = 102,
STREAMED_SOUND_MISSION_J4T_2 = 103,
STREAMED_SOUND_MISSION_J4T_3 = 104,
STREAMED_SOUND_MISSION_J4T_4 = 105,
STREAMED_SOUND_MISSION_J4_A = 106,
STREAMED_SOUND_MISSION_J4_B = 107,
STREAMED_SOUND_MISSION_J4_C = 108,
STREAMED_SOUND_MISSION_J4_D = 109,
STREAMED_SOUND_MISSION_J4_E = 110,
STREAMED_SOUND_MISSION_J4_F = 111,
STREAMED_SOUND_MISSION_J6_1 = 112,
STREAMED_SOUND_MISSION_J6_A = 113,
STREAMED_SOUND_MISSION_J6_B = 114,
STREAMED_SOUND_MISSION_J6_C = 115,
STREAMED_SOUND_MISSION_J6_D = 116,
STREAMED_SOUND_MISSION_T4_A = 117,
STREAMED_SOUND_MISSION_S1_A = 118,
STREAMED_SOUND_MISSION_S1_A1 = 119,
STREAMED_SOUND_MISSION_S1_B = 120,
STREAMED_SOUND_MISSION_S1_C = 121,
STREAMED_SOUND_MISSION_S1_C1 = 122,
STREAMED_SOUND_MISSION_S1_D = 123,
STREAMED_SOUND_MISSION_S1_E = 124,
STREAMED_SOUND_MISSION_S1_F = 125,
STREAMED_SOUND_MISSION_S1_G = 126,
STREAMED_SOUND_MISSION_S1_H = 127,
STREAMED_SOUND_MISSION_S1_I = 128,
STREAMED_SOUND_MISSION_S1_J = 129,
STREAMED_SOUND_MISSION_S1_K = 130,
STREAMED_SOUND_MISSION_S1_L = 131,
STREAMED_SOUND_MISSION_S3_A = 132,
STREAMED_SOUND_MISSION_S3_B = 133,
STREAMED_SOUND_MISSION_EL3_A = 134,
STREAMED_SOUND_MISSION_MF1_A = 135,
STREAMED_SOUND_MISSION_MF2_A = 136,
STREAMED_SOUND_MISSION_MF3_A = 137,
STREAMED_SOUND_MISSION_MF3_B = 138,
STREAMED_SOUND_MISSION_MF3_B1 = 139,
STREAMED_SOUND_MISSION_MF3_C = 140,
STREAMED_SOUND_MISSION_MF4_A = 141,
STREAMED_SOUND_MISSION_MF4_B = 142,
STREAMED_SOUND_MISSION_MF4_C = 143,
STREAMED_SOUND_MISSION_A1_A = 144,
STREAMED_SOUND_MISSION_A3_A = 145,
STREAMED_SOUND_MISSION_A5_A = 146,
STREAMED_SOUND_MISSION_A4_A = 147,
STREAMED_SOUND_MISSION_A4_B = 148,
STREAMED_SOUND_MISSION_A4_C = 149,
STREAMED_SOUND_MISSION_A4_D = 150,
STREAMED_SOUND_MISSION_K1_A = 151,
STREAMED_SOUND_MISSION_K3_A = 152,
STREAMED_SOUND_MISSION_R1_A = 153,
STREAMED_SOUND_MISSION_R2_A = 154,
STREAMED_SOUND_MISSION_R2_B = 155,
STREAMED_SOUND_MISSION_R2_C = 156,
STREAMED_SOUND_MISSION_R2_D = 157,
STREAMED_SOUND_MISSION_R2_E = 158,
STREAMED_SOUND_MISSION_R2_F = 159,
STREAMED_SOUND_MISSION_R2_G = 160,
STREAMED_SOUND_MISSION_R2_H = 161,
STREAMED_SOUND_MISSION_R5_A = 162,
STREAMED_SOUND_MISSION_R6_A = 163,
STREAMED_SOUND_MISSION_R6_A1 = 164,
STREAMED_SOUND_MISSION_R6_B = 165,
STREAMED_SOUND_MISSION_LO2_A = 166,
STREAMED_SOUND_MISSION_LO6_A = 167,
STREAMED_SOUND_MISSION_YD2_A = 168,
STREAMED_SOUND_MISSION_YD2_B = 169,
STREAMED_SOUND_MISSION_YD2_C = 170,
STREAMED_SOUND_MISSION_YD2_C1 = 171,
STREAMED_SOUND_MISSION_YD2_D = 172,
STREAMED_SOUND_MISSION_YD2_E = 173,
STREAMED_SOUND_MISSION_YD2_F = 174,
STREAMED_SOUND_MISSION_YD2_G = 175,
STREAMED_SOUND_MISSION_YD2_H = 176,
STREAMED_SOUND_MISSION_YD2_ASS = 177,
STREAMED_SOUND_MISSION_YD2_OK = 178,
STREAMED_SOUND_MISSION_H5_A = 179,
STREAMED_SOUND_MISSION_H5_B = 180,
STREAMED_SOUND_MISSION_H5_C = 181,
STREAMED_SOUND_MISSION_AMMU_A = 182,
STREAMED_SOUND_MISSION_AMMU_B = 183,
STREAMED_SOUND_MISSION_AMMU_C = 184,
STREAMED_SOUND_MISSION_DOOR_1 = 185,
STREAMED_SOUND_MISSION_DOOR_2 = 186,
STREAMED_SOUND_MISSION_DOOR_3 = 187,
STREAMED_SOUND_MISSION_DOOR_4 = 188,
STREAMED_SOUND_MISSION_DOOR_5 = 189,
STREAMED_SOUND_MISSION_DOOR_6 = 190,
STREAMED_SOUND_MISSION_T3_A = 191,
STREAMED_SOUND_MISSION_T3_B = 192,
STREAMED_SOUND_MISSION_T3_C = 193,
STREAMED_SOUND_MISSION_K1_B = 194,
STREAMED_SOUND_MISSION_CAT1 = 195,
TOTAL_STREAMED_SOUNDS = 196,
NO_STREAMED_SOUND = 197,
};
class tMP3Sample
{
public:
uint32 m_nLength;
uint32 m_nPosition;
uint32 m_nLastPosCheckTimer;
};
class cMusicManager
{
public:
void DisplayRadioStationName(void);
bool m_bIsInitialised;
uint8 field_1;
uint8 m_nMusicMode;
uint8 m_nCurrentStreamedSound;
uint8 m_nPreviousStreamedSound;
uint8 field_5;
uint8 field_6;
uint8 field_7;
bool m_bAnnouncement;
bool m_bPreviousPlayerInCar;
bool m_bPlayerInCar;
bool m_bAnnouncementInProgress;
tMP3Sample m_asMP3Samples[196];
uint8 field_2364;
uint8 field_2365;
uint8 field_2366;
uint8 field_2367;
uint32 field_2368;
uint32 field_2372;
uint32 field_2376;
uint8 field_2380;
uint8 field_2381;
uint8 field_2382;
bool m_bRadioSetByScript;
uint8 m_nRadioStation;
uint8 field_2385;
uint8 field_2386;
uint8 field_2387;
uint32 m_nRadioPosition;
bool m_bRadioInCar;
uint8 field_2393;
uint8 field_2394;
uint8 field_2395;
public:
bool PlayerInCar();
void DisplayRadioStationName();
};
static_assert(sizeof(cMusicManager) == 0x95C, "cMusicManager: error");
extern cMusicManager &MusicManager;

View File

@ -0,0 +1,9 @@
#include "common.h"
#include "SampleManager.h"
CSampleManager &cSampleManager = *(CSampleManager *)0x7341E0;
uint32 &CSampleManager::nNumOfMp3Files = *(uint32*)0x95CC00;
bool CSampleManager::IsMP3RadioChannelAvailable() {
return nNumOfMp3Files != 0;
}

11
src/audio/SampleManager.h Normal file
View File

@ -0,0 +1,11 @@
#pragma once
class CSampleManager {
public:
static uint32 &nNumOfMp3Files;
public:
bool IsMP3RadioChannelAvailable();
};
extern CSampleManager &cSampleManager;

View File

@ -31,22 +31,17 @@
#undef near
#endif
typedef uint8_t uint8, UInt8;
typedef int8_t int8, Int8;
typedef uint16_t uint16, UInt16;
typedef int16_t int16, Int16;
typedef uint32_t uint32, UInt32;
typedef int32_t int32, Int32;
typedef uint8_t uint8;
typedef int8_t int8;
typedef uint16_t uint16;
typedef int16_t int16;
typedef uint32_t uint32;
typedef int32_t int32;
typedef uintptr_t uintptr;
typedef uint64_t uint64, UInt64;
typedef int64_t int64, Int64;
typedef uint64_t uint64;
typedef int64_t int64;
// hardcode ucs-2
typedef uint16_t wchar, WChar;
typedef float Float;
typedef double Double;
typedef bool Bool;
typedef char Char;
typedef uint16_t wchar;
#define nil NULL
@ -59,18 +54,27 @@ extern void **rwengine;
#define RwEngineInstance (*rwengine)
#include "skel\skeleton.h"
#include "Draw.h"
#define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio())
#define SCREENW (RsGlobal.maximumWidth)
#define SCREENH (RsGlobal.maximumHeight)
#define DEFAULT_SCREEN_WIDTH (640)
#define DEFAULT_SCREEN_HEIGHT (448)
#define SCREEN_WIDTH Float(RsGlobal.width)
#define SCREEN_HEIGHT Float(RsGlobal.height)
#define SCREEN_STRETCH_X(a) Float((a) * (SCREEN_WIDTH / Float(DEFAULT_SCREEN_WIDTH)))
#define SCREEN_STRETCH_Y(a) Float((a) * (SCREEN_HEIGHT / Float(DEFAULT_SCREEN_HEIGHT)))
#define SCREEN_FROM_RIGHT(a) Float(SCREEN_WIDTH - SCREEN_STRETCH_X(a))
#define SCREEN_FROM_BOTTOM(a) Float(SCREEN_HEIGHT - SCREEN_STRETCH_Y(a))
#define SCREEN_WIDTH float(RsGlobal.width)
#define SCREEN_HEIGHT float(RsGlobal.height)
#define SCREEN_STRETCH_X(a) float((a) * (SCREEN_WIDTH / float(DEFAULT_SCREEN_WIDTH)))
#define SCREEN_STRETCH_X_AR(a) float((a) * (SCREEN_WIDTH / float(DEFAULT_SCREEN_WIDTH)) * (4.0/3.0f)/SCREEN_ASPECT_RATIO)
#define SCREEN_STRETCH_Y(a) float((a) * (SCREEN_HEIGHT / float(DEFAULT_SCREEN_HEIGHT)))
#define SCREEN_FROM_RIGHT(a) float(SCREEN_WIDTH - SCREEN_STRETCH_X(a))
#define SCREEN_FROM_BOTTOM(a) float(SCREEN_HEIGHT - SCREEN_STRETCH_Y(a))
#define HUD_STRETCH_X SCREEN_STRETCH_X_AR
#define HUD_STRETCH_Y SCREEN_STRETCH_Y
#define HUD_FROM_RIGHT(a) (SCREEN_WIDTH - HUD_STRETCH_X(a))
#define HUD_FROM_BOTTOM(a) (SCREEN_HEIGHT - HUD_STRETCH_Y(a))
struct GlobalScene
{
@ -134,6 +138,7 @@ void mysrand(unsigned int seed);
extern uint8 work_buff[55000];
extern char gString[256];
extern wchar *gUString;
void re3_debug(char *format, ...);
void re3_trace(const char *filename, unsigned int lineno, const char *func, char *format, ...);
@ -154,6 +159,6 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
#define VALIDATE_SIZE(struc, size) static_assert(sizeof(struc) == size, "Invalid structure size of " #struc)
#define VALIDATE_OFFSET(struc, member, offset) static_assert(offsetof(struc, member) == offset, "The offset of " #member " in " #struc " is not " #offset "...")
#define PERCENT(x, p) ((Float(x) * (Float(p) / 100.0f)))
#define PERCENT(x, p) ((float(x) * (float(p) / 100.0f)))
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
#define BIT(num) (1<<(num))

View File

@ -3,3 +3,10 @@
#include "Darkel.h"
WRAPPER void CDarkel::DrawMessages(void) { EAXJMP(0x420920); }
bool CDarkel::Status = *(bool*)0x95CCB4;
bool CDarkel::FrenzyOnGoing()
{
return Status;
}

View File

@ -2,6 +2,10 @@
class CDarkel
{
private:
static bool Status;
public:
static void DrawMessages(void);
static bool FrenzyOnGoing();
};

View File

@ -2,8 +2,29 @@
#include "patcher.h"
#include "ModelIndices.h"
#include "Garages.h"
#include "Timer.h"
#include "Font.h"
#include "Messages.h"
#include "Text.h"
WRAPPER void CGarages::PrintMessages(void) { EAXJMP(0x426310); }
//WRAPPER void CGarages::PrintMessages(void) { EAXJMP(0x426310); }
int32 &CGarages::BankVansCollected = *(int32 *)0x8F1B34;
bool &CGarages::BombsAreFree = *(bool *)0x95CD7A;
bool &CGarages::RespraysAreFree = *(bool *)0x95CD1D;
int32 &CGarages::CarsCollected = *(int32 *)0x880E18;
int32 &CGarages::CarTypesCollected = *(int32 *)0x8E286C;
int32 &CGarages::CrushedCarId = *(int32 *)0x943060;
uint32 &CGarages::LastTimeHelpMessage = *(uint32 *)0x8F1B58;
int32 &CGarages::MessageNumberInString = *(int32 *)0x885BA8;
const char *CGarages::MessageIDString = (const char *)0x878358;
int32 &CGarages::MessageNumberInString2 = *(int32 *)0x8E2C14;
uint32 &CGarages::MessageStartTime = *(uint32 *)0x8F2530;
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;
bool
CGarages::IsModelIndexADoor(uint32 id)
@ -42,3 +63,44 @@ CGarages::IsModelIndexADoor(uint32 id)
id == MI_CRUSHERBODY ||
id == MI_CRUSHERLID;
}
void CGarages::PrintMessages()
{
if (CTimer::GetTimeInMilliseconds() > CGarages::MessageStartTime && CTimer::GetTimeInMilliseconds() < CGarages::MessageEndTime) {
CFont::SetScale(HUD_STRETCH_X(1.2f / 2), HUD_STRETCH_Y(1.5f / 2)); // BUG: game doesn't use macro here.
CFont::SetPropOn();
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
CFont::SetCentreSize(HUD_FROM_RIGHT(50.0f));
CFont::SetCentreOn();
CFont::SetFontStyle(FONT_BANK);
if (CGarages::MessageNumberInString2 < 0) {
if (CGarages::MessageNumberInString < 0) {
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString((SCREEN_WIDTH/ 2) + HUD_STRETCH_X(2.0f), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f), TheText.Get(CGarages::MessageIDString));
CFont::SetColor(CRGBA(89, 115, 150, 255));
CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f), TheText.Get(CGarages::MessageIDString));
}
else {
CMessages::InsertNumberInString(TheText.Get(CGarages::MessageIDString), CGarages::MessageNumberInString, -1, -1, -1, -1, -1, gUString);
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString((SCREEN_WIDTH / 2) + HUD_STRETCH_X(2.0f), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f + 2.0 - 40.0f), gUString);
CFont::SetColor(CRGBA(89, 115, 150, 255));
CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f - 40.0f), gUString);
}
}
else {
CMessages::InsertNumberInString(TheText.Get(CGarages::MessageIDString), CGarages::MessageNumberInString2, -1, -1, -1, -1, -1, gUString);
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString((SCREEN_WIDTH / 2) + HUD_STRETCH_X(2.0f), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f + 2.0 - 40.0f), gUString);
CFont::SetColor(CRGBA(89, 115, 150, 255));
CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f - 40.0f), gUString);
}
}
}

View File

@ -2,6 +2,24 @@
class CGarages
{
public:
static int32 &BankVansCollected;
static bool &BombsAreFree;
static bool &RespraysAreFree;
static int32 &CarsCollected;
static int32 &CarTypesCollected;
static int32 &CrushedCarId;
static uint32 &LastTimeHelpMessage;
static int32 &MessageNumberInString;
static const char *MessageIDString;
static int32 &MessageNumberInString2;
static uint32 &MessageStartTime;
static uint32 &MessageEndTime;
static uint32 &NumGarages;
static bool &PlayerInGarage;
static int32 &PoliceCarsCollected;
static uint32 &GarageToBeTidied;
public:
static bool IsModelIndexADoor(uint32 id);
static void PrintMessages(void);

View File

@ -1,4 +1,4 @@
#include "common.h"
#include "Population.h"
Bool &CPopulation::ms_bGivePedsWeapons = *(Bool*)0x95CCF6;
bool &CPopulation::ms_bGivePedsWeapons = *(bool*)0x95CCF6;

View File

@ -3,5 +3,5 @@
class CPopulation
{
public:
static Bool &ms_bGivePedsWeapons;
static bool &ms_bGivePedsWeapons;
};

View File

@ -1,6 +1,6 @@
#include "common.h"
#include "Record.h"
UInt16 &CRecordDataForGame::RecordingState = *(UInt16*)0x95CC24;
uint16 &CRecordDataForGame::RecordingState = *(uint16*)0x95CC24;
UInt8 &CRecordDataForChase::Status = *(UInt8*)0x95CDCE;
uint8 &CRecordDataForChase::Status = *(uint8*)0x95CDCE;

View File

@ -3,11 +3,11 @@
class CRecordDataForGame
{
public:
static UInt16 &RecordingState;
static uint16 &RecordingState;
};
class CRecordDataForChase
{
public:
static UInt8 &Status;
static uint8 &Status;
};

View File

@ -3,6 +3,6 @@
#include "Replay.h"
uint8 &CReplay::Mode = *(uint8*)0x95CD5B;
Bool &CReplay::bPlayingBackFromFile = *(Bool*)0x95CD58;
bool &CReplay::bPlayingBackFromFile = *(bool*)0x95CD58;
WRAPPER void CReplay::Display(void) { EAXJMP(0x595EE0); }

View File

@ -3,11 +3,12 @@
class CReplay
{
public:
static void Display(void);
enum {
MODE_1
MODE_1 = 1
};
static uint8 &Mode;
static Bool &bPlayingBackFromFile;
static bool &bPlayingBackFromFile;
static void Display(void);
};

View File

@ -4,3 +4,6 @@
#include "Script.h"
uint8 *CTheScripts::ScriptSpace = (uint8*)0x74B248;
CTextLine* CTheScripts::IntroTextLines = (CTextLine*)0x70EA74;
CScriptRectangle* CTheScripts::IntroRectangles = (CScriptRectangle*)0x72D109;
CSprite2d* CTheScripts::ScriptSprites = (CSprite2d*)0x72B090;

View File

@ -1,7 +1,42 @@
#pragma once
#include "Sprite2d.h"
struct CScriptRectangle
{
bool m_bIsUsed;
bool m_bIsAntialiased;
uint16 m_wTextureId;
CRect m_sRect;
CRGBA m_sColor;
};
struct CTextLine
{
float m_fScaleX;
float m_fScaleY;
CRGBA m_sColor;
bool m_bJustify;
bool m_bCentered;
bool m_bBackground;
bool m_bBackgroundOnly;
float m_fWrapX;
float m_fCenterSize;
CRGBA m_sBackgroundColor;
bool m_bTextProportional;
int32 field_29;
bool m_bRightJustify;
int32 field_31;
int32 m_nFont;
float field_36;
float field_40;
wchar m_awText[500];
};
class CTheScripts
{
public:
static uint8 *ScriptSpace;//[160*1024]
static CTextLine* IntroTextLines;
static CScriptRectangle* IntroRectangles;
static CSprite2d* ScriptSprites;
};

View File

@ -1,16 +1,24 @@
#include "common.h"
#include "patcher.h"
#include "Ped.h"
#include "Pools.h"
#include "Particle.h"
#include "Stats.h"
#include "World.h"
#include "PedStat.h"
#include "DMaudio.h"
#include "Ped.h"
Bool &CPed::bNastyLimbsCheat = *(Bool*)0x95CD44;
Bool &CPed::bPedCheat2 = *(Bool*)0x95CD5A;
Bool &CPed::bPedCheat3 = *(Bool*)0x95CD59;
bool &CPed::bNastyLimbsCheat = *(bool*)0x95CD44;
bool &CPed::bPedCheat2 = *(bool*)0x95CD5A;
bool &CPed::bPedCheat3 = *(bool*)0x95CD59;
void *CPed::operator new(size_t sz) { return CPools::GetPedPool()->New(); }
void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); }
WRAPPER void CPed::KillPedWithCar(CVehicle *veh, float impulse) { EAXJMP(0x4EC430); }
WRAPPER void CPed::Say(uint16 audio) { EAXJMP(0x4E5A10); }
WRAPPER void CPed::SetDie(AnimationId anim, float arg1, float arg2) { EAXJMP(0x4D37D0); }
WRAPPER void CPed::SpawnFlyingComponent(int, int8) { EAXJMP(0x4EB060); }
static char ObjectiveText[34][28] = {
"No Obj",
@ -175,3 +183,227 @@ CPed::UseGroundColModel(void)
m_nPedState == PED_DIE ||
m_nPedState == PED_DEAD;
}
void
CPed::AddWeaponModel(int id)
{
RpAtomic* atm;
if (id != -1) {
atm = (RpAtomic*)CModelInfo::GetModelInfo(id)->CreateInstance();
RwFrameDestroy(RpAtomicGetFrame(atm));
RpAtomicSetFrame(atm, GetNodeFrame(PED_HANDR));
RpClumpAddAtomic((RpClump*)m_rwObject, atm);
m_wepModelID = id;
}
}
void
CPed::AimGun()
{
RwV3d pos;
CVector vector;
if (m_pSeekTarget) {
if (m_pSeekTarget->m_status == STATUS_PHYSICS) {
m_pSeekTarget->m_pedIK.GetComponentPosition(&pos, 1);
vector.x = pos.x;
vector.y = pos.y;
vector.z = pos.z;
} else {
vector = *(m_pSeekTarget->GetPosition());
}
CPed::Say(SOUND_PED_ATTACK);
m_ped_flagB2 = m_pedIK.PointGunAtPosition(&vector);
if (m_pPedFight != m_pSeekTarget) {
CPed::SetLookFlag(m_pSeekTarget, 1);
}
} else {
if (CPed::IsPlayer()) {
m_ped_flagB2 = m_pedIK.PointGunInDirection(m_fLookDirection, ((CPlayerPed*)this)->m_fFPSMoveHeading);
} else {
m_ped_flagB2 = m_pedIK.PointGunInDirection(m_fLookDirection, 0.0f);
}
}
}
// After I finished this I realized it's only for SCM opcode...
void
CPed::ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer)
{
CVector pos2 = CVector(
pos.x,
pos.y,
pos.z + 0.1f
);
if (!CPed::IsPlayer() || evenOnPlayer) {
++CStats::HeadShots;
// BUG: This condition will always return true.
if (m_nPedState != PED_PASSENGER || m_nPedState != PED_TAXI_PASSENGER) {
CPed::SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f);
}
m_ped_flagC20 = 1;
m_nPedStateTimer = CTimer::GetTimeInMilliseconds() + 150;
CParticle::AddParticle(PARTICLE_TEST, pos2,
CVector(0.0f, 0.0f, 0.0f), nil, 0.2f, 0, 0, 0, 0);
if (CEntity::GetIsOnScreen()) {
for(int i=0; i < 32; i++) {
CParticle::AddParticle(PARTICLE_BLOOD_SMALL,
pos2, CVector(0.0f, 0.0f, 0.03f),
nil, 0.0f, 0, 0, 0, 0);
}
for (int i = 0; i < 16; i++) {
CParticle::AddParticle(PARTICLE_DEBRIS2,
pos2,
CVector(0.0f, 0.0f, 0.01f),
nil, 0.0f, 0, 0, 0, 0);
}
}
}
}
void
CPed::RemoveBodyPart(PedNode nodeId, int8 unk)
{
RwFrame *frame;
RwFrame *fp;
RwV3d zero;
frame = GetNodeFrame(nodeId);
if (frame) {
if (CGame::nastyGame) {
if (nodeId != PED_HEAD)
CPed::SpawnFlyingComponent(nodeId, unk);
RecurseFrameChildrenVisibilityCB(frame, 0);
zero.x = 0.0f;
zero.z = 0.0f;
zero.y = 0.0f;
for (fp = RwFrameGetParent(frame); fp; fp = RwFrameGetParent(frame))
RwV3dTransformPoints(&zero, &zero, 1, &fp->modelling);
if (CEntity::GetIsOnScreen()) {
CParticle::AddParticle(PARTICLE_TEST, zero,
CVector(0.0f, 0.0f, 0.0f),
nil, 0.2f, 0, 0, 0, 0);
for (int i = 0; i < 16; i++) {
CParticle::AddParticle(PARTICLE_BLOOD_SMALL,
zero,
CVector(0.0f, 0.0f, 0.03f),
nil, 0.0f, 0, 0, 0, 0);
}
}
m_ped_flagC20 = 1;
m_bodyPartBleeding = nodeId;
}
} else {
printf("Trying to remove ped component");
}
}
RwObject*
CPed::SetPedAtomicVisibilityCB(RwObject *object, void *data)
{
if (data == 0)
RpAtomicSetFlags(object, 0);
return object;
}
RwFrame*
CPed::RecurseFrameChildrenVisibilityCB(RwFrame *frame, void *data)
{
RwFrameForAllObjects(frame, SetPedAtomicVisibilityCB, data);
RwFrameForAllChildren(frame, RecurseFrameChildrenVisibilityCB, 0);
return frame;
}
void
CPed::SetLookFlag(CPed *to, bool set)
{
if (m_lookTimer < CTimer::GetTimeInMilliseconds()) {
m_ped_flagA10 = 1;
m_ped_flagA40 = 0;
m_pPedFight = to;
m_pPedFight->RegisterReference((CEntity**)&m_pPedFight);
m_fLookDirection = 999999.0f;
m_lookTimer = 0;
m_ped_flagA20_look = set;
if (m_nPedState != PED_DRIVING) {
m_pedIK.m_flags &= ~CPedIK::FLAG_4;
}
}
}
void
CPed::SetLookFlag(float angle, bool set)
{
if (m_lookTimer < CTimer::GetTimeInMilliseconds()) {
m_ped_flagA10 = 1;
m_ped_flagA40 = 0;
m_pPedFight = 0;
m_fLookDirection = angle;
m_lookTimer = 0;
m_ped_flagA20_look = set;
if (m_nPedState != PED_DRIVING) {
m_pedIK.m_flags &= ~CPedIK::FLAG_4;
}
}
}
void
CPed::SetLookTimer(int time)
{
if (CTimer::GetTimeInMilliseconds() > m_lookTimer) {
m_lookTimer = CTimer::GetTimeInMilliseconds() + time;
}
}
bool
CPed::OurPedCanSeeThisOne(CEntity* who)
{
float xDiff;
float yDiff;
float distance;
CColPoint colpoint;
CEntity* ent;
CVector ourPos;
CVector itsPos;
ourPos = this->GetPosition();
itsPos = who->GetPosition();
xDiff = itsPos.x - ourPos.x;
yDiff = itsPos.y - ourPos.y;
if ((yDiff * this->GetUp().y) + (xDiff * this->GetUp().x) < 0.0f)
return 0;
distance = sqrt(yDiff * yDiff + xDiff * xDiff);
if (distance < 40.0f)
return 0;
ourPos.z += 1.0f;
return !CWorld::ProcessLineOfSight(ourPos, itsPos, colpoint, ent, 1, 0, 0, 0, 0, 0, 0);
}
STARTPATCHES
InjectHook(0x4CF8F0, &CPed::AddWeaponModel, PATCH_JUMP);
InjectHook(0x4C6AA0, &CPed::AimGun, PATCH_JUMP);
InjectHook(0x4EB470, &CPed::ApplyHeadShot, PATCH_JUMP);
InjectHook(0x4EAEE0, &CPed::RemoveBodyPart, PATCH_JUMP);
InjectHook(0x4C6460, (void (CPed::*)(CPed*, bool)) &CPed::SetLookFlag, PATCH_JUMP);
InjectHook(0x4C63E0, (void (CPed::*)(float, bool)) &CPed::SetLookFlag, PATCH_JUMP);
InjectHook(0x4D12E0, &CPed::SetLookTimer, PATCH_JUMP);
InjectHook(0x4C5700, &CPed::OurPedCanSeeThisOne, PATCH_JUMP);
ENDPATCHES

View File

@ -2,6 +2,12 @@
#include "Physical.h"
#include "Weapon.h"
#include "PedIK.h"
#include "AnimManager.h"
#include "AnimBlendClumpData.h"
struct PedStat;
struct CPathNode;
enum {
PED_MAX_WEAPONS = 13
@ -92,7 +98,7 @@ public:
uint8 m_ped_flagA4 : 1;
uint8 m_ped_flagA8 : 1;
uint8 m_ped_flagA10 : 1;
uint8 m_ped_flagA20 : 1;
uint8 m_ped_flagA20_look : 1;
uint8 m_ped_flagA40 : 1;
uint8 m_ped_flagA80 : 1;
uint8 m_ped_flagB1 : 1;
@ -159,39 +165,99 @@ public:
uint8 m_ped_flagI20 : 1;
uint8 m_ped_flagI40 : 1;
uint8 m_ped_flagI80 : 1;
uint8 stuff1[199];
uint8 stuff10[15];
int32 m_field_16C;
uint8 stuff12[44];
int32 m_pEventEntity;
float m_fAngleToEvent;
AnimBlendFrameData *m_pFrames[PED_NODE_MAX];
int32 m_animGroup;
int32 m_pVehicleAnim;
CVector2D m_vecAnimMoveDelta;
CVector m_vecOffsetSeek;
CPedIK m_pedIK;
uint8 stuff1[8];
uint32 m_nPedStateTimer;
int32 m_nPedState;
int32 m_nLastPedState;
int32 m_nMoveState;
uint8 stuff2[188];
int32 m_nStoredActionState;
int32 m_nPrevActionState;
int32 m_nWaitState;
int32 m_nWaitTimer;
private:
uint32 stuff0[28];
public:
uint16 m_nPathNodes;
uint8 m_nCurPathNode;
int8 m_nPathState;
private:
int8 _pad2B5[3];
public:
CPathNode *m_pNextPathNode;
CPathNode *m_pLastPathNode;
float m_fHealth;
float m_fArmour;
uint8 stuff2[34];
CEntity *m_pCurrentPhysSurface;
CVector m_vecOffsetFromPhysSurface;
CEntity *m_pCurSurface;
uint8 stuff3[16];
uint8 stuff3[12];
CPed* m_pSeekTarget;
CVehicle *m_pMyVehicle;
bool bInVehicle;
uint8 stuff4[23];
int32 m_nPedType;
uint8 stuff5[28];
PedStat *m_pedStats;
uint8 stuff5[24];
CEntity *m_pCollidingEntity;
uint8 stuff6[12];
CWeapon m_weapons[PED_MAX_WEAPONS];
int32 stuff7;
uint8 m_currentWeapon;
uint8 stuff[163];
uint8 stuff[3];
int32 m_pPointGunAt;
CVector m_vecHitLastPos;
uint8 stuff8[12];
CPed *m_pPedFight;
float m_fLookDirection;
int32 m_wepModelID;
uint32 m_leaveCarTimer;
uint32 m_getUpTimer;
uint32 m_lookTimer;
uint8 stuff9[34];
uint8 m_bodyPartBleeding;
uint8 m_field_4F3;
CPed *m_nearPeds[10];
uint8 stuff11[32];
static void *operator new(size_t);
static void operator delete(void*, size_t);
// TODO: enum!
bool IsPlayer(void) { return m_nPedType == 0 || m_nPedType== 1 || m_nPedType == 2 || m_nPedType == 3; }
bool UseGroundColModel(void);
void AddWeaponModel(int id);
void AimGun();
void KillPedWithCar(CVehicle *veh, float impulse);
CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; }
void Say(uint16 audio);
void SetLookFlag(CPed *to, bool set);
void SetLookFlag(float angle, bool set);
void SetLookTimer(int time);
void SetDie(AnimationId anim, float arg1, float arg2);
void ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer);
void RemoveBodyPart(PedNode nodeId, int8 unknown);
void SpawnFlyingComponent(int, int8 unknown);
bool OurPedCanSeeThisOne(CEntity* who);
static RwObject *SetPedAtomicVisibilityCB(RwObject *object, void *data);
static RwFrame *RecurseFrameChildrenVisibilityCB(RwFrame *frame, void *data);
static Bool &bNastyLimbsCheat;
static Bool &bPedCheat2;
static Bool &bPedCheat3;
CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; }
RwFrame *GetNodeFrame(int nodeId) { return m_pFrames[nodeId]->frame; }
static bool &bNastyLimbsCheat;
static bool &bPedCheat2;
static bool &bPedCheat3;
};
static_assert(offsetof(CPed, m_nPedState) == 0x224, "CPed: error");
static_assert(offsetof(CPed, m_pCurSurface) == 0x2FC, "CPed: error");
@ -200,4 +266,8 @@ static_assert(offsetof(CPed, m_nPedType) == 0x32C, "CPed: error");
static_assert(offsetof(CPed, m_pCollidingEntity) == 0x34C, "CPed: error");
static_assert(offsetof(CPed, m_weapons) == 0x35C, "CPed: error");
static_assert(offsetof(CPed, m_currentWeapon) == 0x498, "CPed: error");
static_assert(offsetof(CPed, m_lookTimer) == 0x4CC, "CPed: error");
static_assert(offsetof(CPed, m_bodyPartBleeding) == 0x4F2, "CPed: error");
static_assert(offsetof(CPed, m_field_16C) == 0x16C, "CPed: error");
static_assert(offsetof(CPed, m_pEventEntity) == 0x19C, "CPed: error");
static_assert(sizeof(CPed) == 0x53C, "CPed: error");

7
src/entities/PedIK.cpp Normal file
View File

@ -0,0 +1,7 @@
#include "common.h"
#include "patcher.h"
#include "Ped.h"
WRAPPER void CPedIK::GetComponentPosition(RwV3d* pos, int id) { EAXJMP(0x4ED0F0); }
WRAPPER bool CPedIK::PointGunInDirection(float phi, float theta) { EAXJMP(0x4ED9B0); }
WRAPPER bool CPedIK::PointGunAtPosition(CVector* position) { EAXJMP(0x4ED920); }

33
src/entities/PedIK.h Normal file
View File

@ -0,0 +1,33 @@
#pragma once
#include "common.h"
struct LimbOrientation
{
float phi;
float theta;
};
class CPed;
class CPedIK
{
public:
// TODO
enum {
FLAG_1,
FLAG_2,
FLAG_4,
};
CPed* m_ped;
LimbOrientation m_headOrient;
LimbOrientation m_torsoOrient;
LimbOrientation m_upperArmOrient;
LimbOrientation m_lowerArmOrient;
int32 m_flags;
void GetComponentPosition(RwV3d* pos, int id);
bool PointGunInDirection(float phi, float theta);
bool PointGunAtPosition(CVector* position);
};
static_assert(sizeof(CPedIK) == 0x28, "CPedIK: error");

View File

@ -0,0 +1,3 @@
#include "common.h"
#include "patcher.h"
#include "PlayerInfo.h"

74
src/entities/PlayerInfo.h Normal file
View File

@ -0,0 +1,74 @@
#pragma once
#include "Automobile.h"
#include "PlayerPed.h"
enum eWastedBustedState
{
WBSTATE_PLAYING,
WBSTATE_WASTED,
WBSTATE_BUSTED,
WBSTATE_FAILED_CRITICAL_MISSION,
};
struct CCivilianPed
{
};
class CPlayerInfo
{
public:
CPlayerPed *m_pPed;
CVehicle *m_pRemoteVehicle;
CColModel m_ColModel;
CVehicle *m_pVehicleEx;
char m_aszPlayerName[70];
private:
int8 _pad0[2];
public:
int32 m_nMoney;
int32 m_nVisibleMoney;
int32 m_nCollectedPackages;
int32 m_nTotalPackages;
int32 field_188;
int32 m_nSwitchTaxiTime;
bool m_bSwitchTaxi;
int8 field_197;
int8 field_198;
int8 field_199;
int32 m_nNextSexFrequencyUpdateTime;
int32 m_nNextSexMoneyUpdateTime;
int32 m_nSexFrequency;
CCivilianPed *m_pHooker;
int8 m_bWBState; // eWastedBustedState
int8 field_217;
int8 field_218;
int8 field_219;
int32 m_nWBTime;
bool m_bInRemoteMode;
int8 field_225;
int8 field_226;
int8 field_227;
int32 m_nTimeLostRemoteCar;
int32 m_nTimeLastHealthLoss;
int32 m_nTimeLastArmourLoss;
int32 field_240;
int32 m_nUpsideDownCounter;
int32 field_248;
int16 m_nTrafficMultiplier;
int8 field_254;
int8 field_255;
float m_fRoadDensity;
int32 m_nPreviousTimeRewardedForExplosion;
int32 m_nExplosionsSinceLastReward;
int32 field_268;
int32 field_272;
bool m_bInfiniteSprint;
bool m_bFastReload;
bool m_bGetOutOfJailFree;
bool m_bGetOutOfHospitalFree;
uint8 m_aSkinName[32];
RwTexture *m_pSkinTexture;
};
static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerPed: error");

View File

@ -1,11 +1,43 @@
#pragma once
#include "Ped.h"
#include "Wanted.h"
class CPlayerPed : public CPed
{
public:
// 0x53C
uint8 stuff[180];
CWanted *m_pWanted;
CCopPed *m_pArrestingCop;
float m_fMoveSpeed;
float m_fCurrentStamina;
float m_fMaxStamina;
float m_fStaminaProgress;
bool m_bWeaponSlot;
bool m_bSpeedTimerFlag;
bool m_bShouldEvade;
int8 field_1367;
int32 m_nSpeedTimer;
int32 m_nShotDelay;
float field_1376;
int8 field_1380;
int8 field_1381;
int8 field_1382;
int8 field_1383;
CEntity *m_pEvadingFrom;
int32 m_nTargettableObjects[4];
bool m_bAdrenalineActive;
bool m_bHasLockOnTarget;
int8 field_1406;
int8 field_1407;
bool m_bAdrenalineTime;
bool m_bCanBeDamaged;
int8 field_1413;
int8 field_1414;
int8 field_1415;
CVector field_1416[6];
int32 field_1488[6];
float field_1512;
float m_fFPSMoveHeading;
};
static_assert(sizeof(CPlayerPed) == 0x5F0, "CPlayerPed: error");

View File

@ -3,11 +3,11 @@
#include "Vehicle.h"
#include "Pools.h"
Bool &CVehicle::bWheelsOnlyCheat = *(Bool *)0x95CD78;
Bool &CVehicle::bAllDodosCheat = *(Bool *)0x95CD75;
Bool &CVehicle::bCheat3 = *(Bool *)0x95CD66;
Bool &CVehicle::bCheat4 = *(Bool *)0x95CD65;
Bool &CVehicle::bCheat5 = *(Bool *)0x95CD64;
bool &CVehicle::bWheelsOnlyCheat = *(bool *)0x95CD78;
bool &CVehicle::bAllDodosCheat = *(bool *)0x95CD75;
bool &CVehicle::bCheat3 = *(bool *)0x95CD66;
bool &CVehicle::bCheat4 = *(bool *)0x95CD65;
bool &CVehicle::bCheat5 = *(bool *)0x95CD64;
void *CVehicle::operator new(size_t sz) { return CPools::GetVehiclePool()->New(); }
void CVehicle::operator delete(void *p, size_t sz) { CPools::GetVehiclePool()->Delete((CVehicle*)p); }

View File

@ -63,11 +63,11 @@ uint8 m_extra2;
bool IsHeli(void) { return m_vehType == VEHICLE_TYPE_HELI; }
bool IsPlane(void) { return m_vehType == VEHICLE_TYPE_PLANE; }
static Bool &bWheelsOnlyCheat;
static Bool &bAllDodosCheat;
static Bool &bCheat3;
static Bool &bCheat4;
static Bool &bCheat5;
static bool &bWheelsOnlyCheat;
static bool &bAllDodosCheat;
static bool &bCheat3;
static bool &bCheat4;
static bool &bCheat5;
};
static_assert(sizeof(CVehicle) == 0x288, "CVehicle: error");
static_assert(offsetof(CVehicle, m_pCurSurface) == 0x1E0, "CVehicle: error");

View File

@ -57,6 +57,7 @@
uint8 work_buff[55000];
char gString[256];
wchar *gUString = (wchar*)0x74B018;
bool &b_FoundRecentSavedGameWantToLoad = *(bool*)0x95CDA8;
@ -140,8 +141,8 @@ Idle(void *arg)
Render2dStuff();
}else{
float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f));
// ASPECT
CameraSize(Scene.camera, nil, viewWindow, 4.0f/3.0f);
CDraw::CalculateAspectRatio();
CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
if(!RsCameraBeginUpdate(Scene.camera))
@ -172,8 +173,8 @@ FrontendIdle(void)
return;
float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f));
// ASPECT
CameraSize(Scene.camera, nil, viewWindow, 4.0f/3.0f);
CDraw::CalculateAspectRatio();
CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
if(!RsCameraBeginUpdate(Scene.camera))
@ -194,9 +195,8 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
CRGBA BottomColor(BottomRed, BottomGreen, BottomBlue, Alpha);
float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f));
// ASPECT
float aspectRatio = CMenuManager::m_PrefsUseWideScreen ? 16.0f/9.0f : 4.0f/3.0f;
CameraSize(Scene.camera, nil, viewWindow, aspectRatio);
CDraw::CalculateAspectRatio();
CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
@ -215,9 +215,8 @@ bool
DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha)
{
float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f));
// ASPECT
float aspectRatio = CMenuManager::m_PrefsUseWideScreen ? 16.0f/9.0f : 4.0f/3.0f;
CameraSize(Scene.camera, nil, viewWindow, aspectRatio);
CDraw::CalculateAspectRatio();
CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
@ -325,14 +324,15 @@ Render2dStuff(void)
// top and bottom strips
if (weaponType == WEAPONTYPE_ROCKETLAUNCHER) {
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW, SCREENH/2 - SCREEN_STRETCH_Y(180)), black);
CSprite2d::DrawRect(CRect(0.0f, SCREENH/2 + SCREEN_STRETCH_Y(170), SCREENW, SCREENH), black);
}else{
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW, SCREENH/2 - SCREEN_STRETCH_Y(210)), black);
CSprite2d::DrawRect(CRect(0.0f, SCREENH/2 + SCREEN_STRETCH_Y(210), SCREENW, SCREENH), black);
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW, SCREENH / 2 - HUD_STRETCH_Y(180)), black);
CSprite2d::DrawRect(CRect(0.0f, SCREENH / 2 + HUD_STRETCH_Y(170), SCREENW, SCREENH), black);
}
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW/2 - SCREEN_STRETCH_X(210), SCREENH), black);
CSprite2d::DrawRect(CRect(SCREENW/2 + SCREEN_STRETCH_X(210), 0.0f, SCREENW, SCREENH), black);
else {
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW, SCREENH / 2 - HUD_STRETCH_Y(210)), black);
CSprite2d::DrawRect(CRect(0.0f, SCREENH / 2 + HUD_STRETCH_Y(210), SCREENW, SCREENH), black);
}
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW / 2 - HUD_STRETCH_X(210), SCREENH), black);
CSprite2d::DrawRect(CRect(SCREENW / 2 + HUD_STRETCH_X(210), 0.0f, SCREENW, SCREENH), black);
}
MusicManager.DisplayRadioStationName();

View File

@ -202,16 +202,118 @@ enum
MI_FEMALE03,
MI_FATFEMALE01,
MI_FATFEMALE02,
MI_FIRETRUCK = 97,
MI_PREDATOR = 120,
MI_RHINO = 122,
MI_TRAIN = 124,
MI_COACH = 127,
MI_RCBANDIT = 131,
MI_SPEEDER = 142,
MI_REEFER = 143,
MI_GHOST = 150,
MI_PROSTITUTE,
MI_PROSTITUTE2,
MI_P_MAN1,
MI_P_MAN2,
MI_P_WOM1,
MI_P_WOM2,
MI_CT_MAN1,
MI_CT_MAN2,
MI_CT_WOM1,
MI_CT_WOM2,
MI_LI_MAN1,
MI_LI_MAN2,
MI_LI_WOM1,
MI_LI_WOM2,
MI_DOCKER1,
MI_DOCKER2,
MI_SCUM_MAN,
MI_SCUM_WOM,
MI_WORKER1,
MI_WORKER2,
MI_B_MAN1,
MI_B_MAN2,
MI_B_MAN3,
MI_B_WOM1,
MI_B_WOM2,
MI_B_WOM3,
MI_MOD_MAN,
MI_MOD_WOM,
MI_ST_MAN,
MI_ST_WOM,
MI_FAN_MAN1,
MI_FAN_MAN2,
MI_FAN_WOM,
MI_HOS_MAN,
MI_HOS_WOM,
MI_CONST1,
MI_CONST2,
MI_SHOPPER1,
MI_SHOPPER2,
MI_SHOPPER3,
MI_STUD_MAN,
MI_STUD_WOM,
MI_CAS_MAN,
MI_CAS_WOM,
MI_BUSKER1,
MI_BUSKER2,
MI_BUSKER3,
MI_BUSKER4,
MI_PED87,
MI_PED88,
MI_PED89,
MI_LANDSTAL,
MI_IDAHO,
MI_STINGER,
MI_LINERUN,
MI_PEREN,
MI_SENTINEL,
MI_PATRIOT,
MI_FIRETRUCK,
MI_TRASH,
MI_STRETCH,
MI_MANANA,
MI_INFERNUS,
MI_BLISTA,
MI_PONY,
MI_MULE,
MI_CHEETAH,
MI_AMBULAN,
MI_FBICAR,
MI_MOONBEAM,
MI_ESPERANT,
MI_TAXI,
MI_KURUMA,
MI_BOBCAT,
MI_MRWHOOP,
MI_BFINJECT,
MI_CORPSE,
MI_POLICE,
MI_ENFORCER,
MI_SECURICA,
MI_BANSHEE,
MI_PREDATOR,
MI_BUS,
MI_RHINO,
MI_BARRACKS,
MI_TRAIN,
MI_CHOPPER,
MI_DODO,
MI_COACH,
MI_CABBIE,
MI_STALLION,
MI_RUMPO,
MI_RCBANDIT,
MI_BELLYUP,
MI_MRWONGS,
MI_MAFIA,
MI_YARDIE,
MI_YAKUZA,
MI_DIABLOS,
MI_COLUMB ,
MI_HOODS,
MI_AIRTRAIN,
MI_DEADDODO,
MI_SPEEDER,
MI_REEFER,
MI_PANLANT,
MI_FLATBED,
MI_YANKEE,
MI_ESCAPE,
MI_BORGNINE,
MI_TOYZ,
MI_GHOST,
MI_CAR_DOOR = 190,
MI_CAR_BUMPER,

View File

@ -15,8 +15,7 @@ enum PedNode {
PED_FOOTL,
PED_FOOTR,
PED_LOWERLEGR,
// This is not valid apparently
PED_LOWERLEGL,
PED_NODE_MAX// Not valid: PED_LOWERLEGL
};
class CPedModelInfo : public CClumpModelInfo

View File

@ -1,6 +1,10 @@
#include "common.h"
#include "patcher.h"
#include "Draw.h"
#include "Frontend.h"
#include "Camera.h"
float CDraw::ms_fAspectRatio;
float &CDraw::ms_fNearClipZ = *(float*)0x8E2DC4;
float &CDraw::ms_fFarClipZ = *(float*)0x9434F0;
@ -11,6 +15,17 @@ uint8 &CDraw::FadeRed = *(uint8*)0x95CD90;
uint8 &CDraw::FadeGreen = *(uint8*)0x95CD71;
uint8 &CDraw::FadeBlue = *(uint8*)0x95CD53;
void
CDraw::CalculateAspectRatio()
{
if(FrontEndMenuManager.m_PrefsUseWideScreen)
ms_fAspectRatio = 16.0f/9.0f;
else if(TheCamera.m_WideScreenOn)
ms_fAspectRatio = 1.25f;
else
ms_fAspectRatio = 4.0f/3.0f;
}
static float hFov2vFov(float hfov)
{
float w = SCREENW;
@ -36,4 +51,7 @@ CDraw::SetFOV(float fov)
STARTPATCHES
InjectHook(0x4FE7B0, CDraw::SetFOV, PATCH_JUMP);
Nop(0x46B618, 2);
Patch<float>(0x5F0A64, 1.3333334f);
ENDPATCHES

View File

@ -6,6 +6,8 @@ private:
static float &ms_fNearClipZ;
static float &ms_fFarClipZ;
static float &ms_fFOV;
static float ms_fAspectRatio;
public:
static uint8 &FadeValue;
static uint8 &FadeRed;
@ -16,6 +18,11 @@ public:
static float GetNearClipZ(void) { return ms_fNearClipZ; }
static void SetFarClipZ(float farclip) { ms_fFarClipZ = farclip; }
static float GetFarClipZ(void) { return ms_fFarClipZ; }
static void SetFOV(float fov);
static float GetFOV(void) { return ms_fFOV; }
static void CalculateAspectRatio();
static float GetAspectRatio(void) { return ms_fAspectRatio; }
};

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,95 @@
#pragma once
#include "Sprite2d.h"
enum eItems
{
ITEM_ARMOUR = 3,
ITEM_HEALTH = 4,
ITEM_RADAR = 8
};
enum eSprites
{
HUD_FIST,
HUD_BAT,
HUD_PISTOL,
HUD_UZI,
HUD_SHOTGUN,
HUD_AK47,
HUD_M16,
HUD_SNIPER,
HUD_ROCKET,
HUD_FLAME,
HUD_MOLOTOV,
HUD_GRENADE,
HUD_DETONATOR,
HUD_RADARDISC = 15,
HUD_PAGER = 16,
HUD_SITESNIPER = 20,
HUD_SITEM16 = 21
};
class CHud
{
public:
static void Draw(void);
static void DrawAfterFade(void);
static CSprite2d *Sprites;
static wchar *m_HelpMessage;
static wchar *m_LastHelpMessage;
static int32 &m_HelpMessageState;
static int32 &m_HelpMessageTimer;
static int32 &m_HelpMessageFadeTimer;
static wchar *m_HelpMessageToPrint;
static float &m_HelpMessageDisplayTime;
static float &m_fTextBoxNumLines;
static float &m_fHelpMessageTime;
static bool &m_bHelpMessageQuick;
static int32 m_ZoneState;
static int32 m_ZoneFadeTimer;
static int32 m_ZoneNameTimer;
static wchar *&m_pZoneName;
static wchar *m_pLastZoneName;
static wchar *m_ZoneToPrint;
static wchar *&m_pVehicleName;
static wchar *m_pLastVehicleName;
static wchar *m_pVehicleNameToPrint;
static int32 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)[128];
static float *BigMessageInUse;
static float *BigMessageAlpha;
static float *BigMessageX;
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 int32 &SpriteBrightness;
static float &PagerXOffset;
static int32 m_ItemToFlash;
static int16 &PagerTimer;
static int16 &PagerOn;
public:
static void Initialise();
static void Shutdown();
static void ReInitialise();
static void GetRidOfAllHudMessages();
static void SetZoneName(wchar *name);
static void SetHelpMessage(wchar *message, bool quick);
static void SetVehicleName(wchar *name);
static void Draw();
static void DrawAfterFade();
static void SetMessage(wchar *message);
static void SetBigMessage(wchar *message, int16 style);
static void SetPagerMessage(wchar *message);
};

View File

@ -44,7 +44,7 @@
const Char SmokeFiles[][6+1] =
const char SmokeFiles[][6+1] =
{
"smoke1",
"smoke2",
@ -54,7 +54,7 @@ const Char SmokeFiles[][6+1] =
};
const Char Smoke2Files[][9+1] =
const char Smoke2Files[][9+1] =
{
"smokeII_1",
"smokeII_2",
@ -63,7 +63,7 @@ const Char Smoke2Files[][9+1] =
"smokeII_5"
};
const Char RubberFiles[][7+1] =
const char RubberFiles[][7+1] =
{
"rubber1",
"rubber2",
@ -72,7 +72,7 @@ const Char RubberFiles[][7+1] =
"rubber5"
};
const Char RainSplashFiles[][7+1] =
const char RainSplashFiles[][7+1] =
{
"splash1",
"splash2",
@ -81,14 +81,14 @@ const Char RainSplashFiles[][7+1] =
"splash5"
};
const Char WatersprayFiles[][11+1] =
const char WatersprayFiles[][11+1] =
{
"waterspray1",
"waterspray2",
"waterspray3"
};
const Char ExplosionMediumFiles[][7+1] =
const char ExplosionMediumFiles[][7+1] =
{
"explo01",
"explo02",
@ -98,7 +98,7 @@ const Char ExplosionMediumFiles[][7+1] =
"explo06"
};
const Char GunFlashFiles[][9+1] =
const char GunFlashFiles[][9+1] =
{
"gunflash1",
"gunflash2",
@ -106,7 +106,7 @@ const Char GunFlashFiles[][9+1] =
"gunflash4"
};
const Char RaindropFiles[][9+1] =
const char RaindropFiles[][9+1] =
{
"raindrop1",
"raindrop2",
@ -114,13 +114,13 @@ const Char RaindropFiles[][9+1] =
"raindrop4"
};
const Char RainSplashupFiles[][10+1] =
const char RainSplashupFiles[][10+1] =
{
"splash_up1",
"splash_up2"
};
const Char BirdfrontFiles[][8+1] =
const char BirdfrontFiles[][8+1] =
{
"birdf_01",
"birdf_02",
@ -128,7 +128,7 @@ const Char BirdfrontFiles[][8+1] =
"birdf_04"
};
const Char CardebrisFiles[][12+1] =
const char CardebrisFiles[][12+1] =
{
"cardebris_01",
"cardebris_02",
@ -136,7 +136,7 @@ const Char CardebrisFiles[][12+1] =
"cardebris_04"
};
const Char CarsplashFiles[][12+1] =
const char CarsplashFiles[][12+1] =
{
"carsplash_01",
"carsplash_02",
@ -210,7 +210,7 @@ RwTexture * (&gpRainDropTex)[MAX_RAINDROP_FILES] = *(RwTexture * (*)[MAX_RA
RwRaster *gpRainDropRaster[MAX_RAINDROP_FILES];
//Float CParticle::ms_afRandTable[CParticle::RAND_TABLE_SIZE]; //
Float (&CParticle::ms_afRandTable)[CParticle::RAND_TABLE_SIZE] = *(Float (*)[CParticle::RAND_TABLE_SIZE])*(int *)0x6E98C8;
float (&CParticle::ms_afRandTable)[CParticle::RAND_TABLE_SIZE] = *(float (*)[CParticle::RAND_TABLE_SIZE])*(int *)0x6E98C8;
CParticle *CParticle::m_pUnusedListHead;
@ -218,13 +218,13 @@ CParticle *CParticle::m_pUnusedListHead;
//Float CParticle::m_SinTable[CParticle::SIN_COS_TABLE_SIZE]; //
//Float CParticle::m_CosTable[CParticle::SIN_COS_TABLE_SIZE]; /
Float (&CParticle::m_SinTable)[CParticle::SIN_COS_TABLE_SIZE] = *(Float (*)[CParticle::SIN_COS_TABLE_SIZE])*(int *)0x877358;
Float (&CParticle::m_CosTable)[CParticle::SIN_COS_TABLE_SIZE] = *(Float (*)[CParticle::SIN_COS_TABLE_SIZE])*(int *)0x70DA18;
float (&CParticle::m_SinTable)[CParticle::SIN_COS_TABLE_SIZE] = *(float (*)[CParticle::SIN_COS_TABLE_SIZE])*(int *)0x877358;
float (&CParticle::m_CosTable)[CParticle::SIN_COS_TABLE_SIZE] = *(float (*)[CParticle::SIN_COS_TABLE_SIZE])*(int *)0x70DA18;
Int32 Randomizer;
int32 Randomizer;
Int32 nParticleCreationInterval = 1;
Float fParticleScaleLimit = 0.5f;
int32 nParticleCreationInterval = 1;
float fParticleScaleLimit = 0.5f;
@ -241,7 +241,7 @@ void CParticle::ReloadConfig()
m_pUnusedListHead = gParticleArray;
for ( Int32 i = 0; i < MAX_PARTICLES_ON_SCREEN; i++ )
for ( int32 i = 0; i < MAX_PARTICLES_ON_SCREEN; i++ )
{
if ( i == MAX_PARTICLES_ON_SCREEN - 1 )
gParticleArray[i].m_pNext = NULL;
@ -292,93 +292,93 @@ void CParticle::Initialise()
CParticleObject::Initialise();
Float randVal = -1.0f;
for ( Int32 i = 0; i < RAND_TABLE_SIZE; i++ )
float randVal = -1.0f;
for ( int32 i = 0; i < RAND_TABLE_SIZE; i++ )
{
ms_afRandTable[i] = randVal;
randVal += 0.1f;
}
for ( Int32 i = 0; i < SIN_COS_TABLE_SIZE; i++ )
for ( int32 i = 0; i < SIN_COS_TABLE_SIZE; i++ )
{
Float angle = DEGTORAD(Float(i) * Float(360.0f / SIN_COS_TABLE_SIZE));
float angle = DEGTORAD(float(i) * float(360.0f / SIN_COS_TABLE_SIZE));
m_SinTable[i] = sin(angle);
m_CosTable[i] = cos(angle);
}
Int32 slot = CTxdStore::FindTxdSlot("particle");
int32 slot = CTxdStore::FindTxdSlot("particle");
CTxdStore::PushCurrentTxd();
CTxdStore::SetCurrentTxd(slot);
for ( Int32 i = 0; i < MAX_SMOKE_FILES; i++ )
for ( int32 i = 0; i < MAX_SMOKE_FILES; i++ )
{
gpSmokeTex[i] = RwTextureRead(SmokeFiles[i], NULL);
gpSmokeRaster[i] = RwTextureGetRaster(gpSmokeTex[i]);
}
for ( Int32 i = 0; i < MAX_SMOKE2_FILES; i++ )
for ( int32 i = 0; i < MAX_SMOKE2_FILES; i++ )
{
gpSmoke2Tex[i] = RwTextureRead(Smoke2Files[i], NULL);
gpSmoke2Raster[i] = RwTextureGetRaster(gpSmoke2Tex[i]);
}
for ( Int32 i = 0; i < MAX_RUBBER_FILES; i++ )
for ( int32 i = 0; i < MAX_RUBBER_FILES; i++ )
{
gpRubberTex[i] = RwTextureRead(RubberFiles[i], NULL);
gpRubberRaster[i] = RwTextureGetRaster(gpRubberTex[i]);
}
for ( Int32 i = 0; i < MAX_RAINSPLASH_FILES; i++ )
for ( int32 i = 0; i < MAX_RAINSPLASH_FILES; i++ )
{
gpRainSplashTex[i] = RwTextureRead(RainSplashFiles[i], NULL);
gpRainSplashRaster[i] = RwTextureGetRaster(gpRainSplashTex[i]);
}
for ( Int32 i = 0; i < MAX_WATERSPRAY_FILES; i++ )
for ( int32 i = 0; i < MAX_WATERSPRAY_FILES; i++ )
{
gpWatersprayTex[i] = RwTextureRead(WatersprayFiles[i], NULL);
gpWatersprayRaster[i] = RwTextureGetRaster(gpWatersprayTex[i]);
}
for ( Int32 i = 0; i < MAX_EXPLOSIONMEDIUM_FILES; i++ )
for ( int32 i = 0; i < MAX_EXPLOSIONMEDIUM_FILES; i++ )
{
gpExplosionMediumTex[i] = RwTextureRead(ExplosionMediumFiles[i], NULL);
gpExplosionMediumRaster[i] = RwTextureGetRaster(gpExplosionMediumTex[i]);
}
for ( Int32 i = 0; i < MAX_GUNFLASH_FILES; i++ )
for ( int32 i = 0; i < MAX_GUNFLASH_FILES; i++ )
{
gpGunFlashTex[i] = RwTextureRead(GunFlashFiles[i], NULL);
gpGunFlashRaster[i] = RwTextureGetRaster(gpGunFlashTex[i]);
}
for ( Int32 i = 0; i < MAX_RAINDROP_FILES; i++ )
for ( int32 i = 0; i < MAX_RAINDROP_FILES; i++ )
{
gpRainDropTex[i] = RwTextureRead(RaindropFiles[i], NULL);
gpRainDropRaster[i] = RwTextureGetRaster(gpRainDropTex[i]);
}
for ( Int32 i = 0; i < MAX_RAINSPLASHUP_FILES; i++ )
for ( int32 i = 0; i < MAX_RAINSPLASHUP_FILES; i++ )
{
gpRainSplashupTex[i] = RwTextureRead(RainSplashupFiles[i], NULL);
gpRainSplashupRaster[i] = RwTextureGetRaster(gpRainSplashupTex[i]);
}
for ( Int32 i = 0; i < MAX_BIRDFRONT_FILES; i++ )
for ( int32 i = 0; i < MAX_BIRDFRONT_FILES; i++ )
{
gpBirdfrontTex[i] = RwTextureRead(BirdfrontFiles[i], NULL);
gpBirdfrontRaster[i] = RwTextureGetRaster(gpBirdfrontTex[i]);
}
for ( Int32 i = 0; i < MAX_CARDEBRIS_FILES; i++ )
for ( int32 i = 0; i < MAX_CARDEBRIS_FILES; i++ )
{
gpCarDebrisTex[i] = RwTextureRead(CardebrisFiles[i], NULL);
gpCarDebrisRaster[i] = RwTextureGetRaster(gpCarDebrisTex[i]);
}
for ( Int32 i = 0; i < MAX_CARSPLASH_FILES; i++ )
for ( int32 i = 0; i < MAX_CARSPLASH_FILES; i++ )
{
gpCarSplashTex[i] = RwTextureRead(CarsplashFiles[i], NULL);
gpCarSplashRaster[i] = RwTextureGetRaster(gpCarSplashTex[i]);
@ -429,7 +429,7 @@ void CParticle::Initialise()
CTxdStore::PopCurrentTxd();
for ( Int32 i = 0; i < MAX_PARTICLES; i++ )
for ( int32 i = 0; i < MAX_PARTICLES; i++ )
{
tParticleSystemData *entry = &mod_ParticleSystemManager.m_aParticles[i];
@ -584,7 +584,7 @@ void CParticle::Shutdown()
{
debug("Shutting down CParticle...");
for ( Int32 i = 0; i < MAX_SMOKE_FILES; i++ )
for ( int32 i = 0; i < MAX_SMOKE_FILES; i++ )
{
RwTextureDestroy(gpSmokeTex[i]);
#ifdef GTA3_1_1_PATCH
@ -592,7 +592,7 @@ void CParticle::Shutdown()
#endif
}
for ( Int32 i = 0; i < MAX_SMOKE2_FILES; i++ )
for ( int32 i = 0; i < MAX_SMOKE2_FILES; i++ )
{
RwTextureDestroy(gpSmoke2Tex[i]);
#ifdef GTA3_1_1_PATCH
@ -600,7 +600,7 @@ void CParticle::Shutdown()
#endif
}
for ( Int32 i = 0; i < MAX_RUBBER_FILES; i++ )
for ( int32 i = 0; i < MAX_RUBBER_FILES; i++ )
{
RwTextureDestroy(gpRubberTex[i]);
#ifdef GTA3_1_1_PATCH
@ -608,7 +608,7 @@ void CParticle::Shutdown()
#endif
}
for ( Int32 i = 0; i < MAX_RAINSPLASH_FILES; i++ )
for ( int32 i = 0; i < MAX_RAINSPLASH_FILES; i++ )
{
RwTextureDestroy(gpRainSplashTex[i]);
#ifdef GTA3_1_1_PATCH
@ -616,7 +616,7 @@ void CParticle::Shutdown()
#endif
}
for ( Int32 i = 0; i < MAX_WATERSPRAY_FILES; i++ )
for ( int32 i = 0; i < MAX_WATERSPRAY_FILES; i++ )
{
RwTextureDestroy(gpWatersprayTex[i]);
#ifdef GTA3_1_1_PATCH
@ -624,7 +624,7 @@ void CParticle::Shutdown()
#endif
}
for ( Int32 i = 0; i < MAX_EXPLOSIONMEDIUM_FILES; i++ )
for ( int32 i = 0; i < MAX_EXPLOSIONMEDIUM_FILES; i++ )
{
RwTextureDestroy(gpExplosionMediumTex[i]);
#ifdef GTA3_1_1_PATCH
@ -632,7 +632,7 @@ void CParticle::Shutdown()
#endif
}
for ( Int32 i = 0; i < MAX_GUNFLASH_FILES; i++ )
for ( int32 i = 0; i < MAX_GUNFLASH_FILES; i++ )
{
RwTextureDestroy(gpGunFlashTex[i]);
#ifdef GTA3_1_1_PATCH
@ -640,7 +640,7 @@ void CParticle::Shutdown()
#endif
}
for ( Int32 i = 0; i < MAX_RAINDROP_FILES; i++ )
for ( int32 i = 0; i < MAX_RAINDROP_FILES; i++ )
{
RwTextureDestroy(gpRainDropTex[i]);
#ifdef GTA3_1_1_PATCH
@ -648,7 +648,7 @@ void CParticle::Shutdown()
#endif
}
for ( Int32 i = 0; i < MAX_RAINSPLASHUP_FILES; i++ )
for ( int32 i = 0; i < MAX_RAINSPLASHUP_FILES; i++ )
{
RwTextureDestroy(gpRainSplashupTex[i]);
#ifdef GTA3_1_1_PATCH
@ -656,7 +656,7 @@ void CParticle::Shutdown()
#endif
}
for ( Int32 i = 0; i < MAX_BIRDFRONT_FILES; i++ )
for ( int32 i = 0; i < MAX_BIRDFRONT_FILES; i++ )
{
RwTextureDestroy(gpBirdfrontTex[i]);
#ifdef GTA3_1_1_PATCH
@ -664,7 +664,7 @@ void CParticle::Shutdown()
#endif
}
for ( Int32 i = 0; i < MAX_CARDEBRIS_FILES; i++ )
for ( int32 i = 0; i < MAX_CARDEBRIS_FILES; i++ )
{
RwTextureDestroy(gpCarDebrisTex[i]);
#ifdef GTA3_1_1_PATCH
@ -672,7 +672,7 @@ void CParticle::Shutdown()
#endif
}
for ( Int32 i = 0; i < MAX_CARSPLASH_FILES; i++ )
for ( int32 i = 0; i < MAX_CARSPLASH_FILES; i++ )
{
RwTextureDestroy(gpCarSplashTex[i]);
#ifdef GTA3_1_1_PATCH
@ -750,7 +750,7 @@ void CParticle::Shutdown()
gpPointlightTex = NULL;
#endif
Int32 slot;
int32 slot;
slot = CTxdStore::FindTxdSlot("particle");
CTxdStore::RemoveTxdSlot(slot);
@ -758,13 +758,13 @@ void CParticle::Shutdown()
debug("CParticle shut down");
}
CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, Float fSize, Int32 nRotationSpeed, Int32 nRotation, Int32 nCurFrame, Int32 nLifeSpan)
CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, float fSize, int32 nRotationSpeed, int32 nRotation, int32 nCurFrame, int32 nLifeSpan)
{
CRGBA color(0, 0, 0, 0);
return AddParticle(type, vecPos, vecDir, pEntity, fSize, color, nRotationSpeed, nRotation, nCurFrame, nLifeSpan);
}
CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, Float fSize, RwRGBA const &color, Int32 nRotationSpeed, Int32 nRotation, Int32 nCurFrame, Int32 nLifeSpan)
CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, float fSize, RwRGBA const &color, int32 nRotationSpeed, int32 nRotation, int32 nCurFrame, int32 nLifeSpan)
{
if ( CTimer::GetIsPaused() )
return NULL;
@ -833,8 +833,8 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
if ( psystem->m_InitialColorVariation != 0 )
{
Int32 ColorVariation = CGeneral::GetRandomNumberInRange(-psystem->m_InitialColorVariation, psystem->m_InitialColorVariation);
//Float ColorVariation = CGeneral::GetRandomNumberInRange((Float)-psystem->m_InitialColorVariation, (Float)psystem->m_InitialColorVariation);
int32 ColorVariation = CGeneral::GetRandomNumberInRange(-psystem->m_InitialColorVariation, psystem->m_InitialColorVariation);
//Float ColorVariation = CGeneral::GetRandomNumberInRange((float)-psystem->m_InitialColorVariation, (float)psystem->m_InitialColorVariation);
pParticle->m_Color.red = clamp(pParticle->m_Color.red +
PERCENT(pParticle->m_Color.red, ColorVariation),
@ -893,18 +893,18 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
if ( psystem->m_nLifeSpanErrorShape != 0 )
{
Float randVal = ms_afRandTable[CGeneral::GetRandomNumber() % RAND_TABLE_SIZE];
float randVal = ms_afRandTable[CGeneral::GetRandomNumber() % RAND_TABLE_SIZE];
if ( randVal > 0.0f )
pParticle->m_nTimeWhenWillBeDestroyed += Int32(Float(psystem->m_nLifeSpan) * randVal * Float(psystem->m_nLifeSpanErrorShape));
pParticle->m_nTimeWhenWillBeDestroyed += int32(float(psystem->m_nLifeSpan) * randVal * float(psystem->m_nLifeSpanErrorShape));
else
pParticle->m_nTimeWhenWillBeDestroyed += Int32(Float(psystem->m_nLifeSpan) * randVal / Float(psystem->m_nLifeSpanErrorShape));
pParticle->m_nTimeWhenWillBeDestroyed += int32(float(psystem->m_nLifeSpan) * randVal / float(psystem->m_nLifeSpanErrorShape));
}
if ( psystem->Flags & ZCHECK_FIRST )
{
static Bool bValidGroundFound = false;
static bool bValidGroundFound = false;
static CVector LastTestCoors;
static Float LastTestGroundZ;
static float LastTestGroundZ;
if ( bValidGroundFound
&& vecPos.x == LastTestCoors.x
@ -939,11 +939,11 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
if ( psystem->Flags & ZCHECK_BUMP )
{
static Float Z_Ground = 0.0f;
static float Z_Ground = 0.0f;
if ( psystem->Flags & ZCHECK_BUMP_FIRST )
{
Bool bZFound = false;
bool bZFound = false;
Z_Ground = CWorld::FindGroundZFor3DCoord(vecPos.x, vecPos.y, vecPos.z, (bool *)&bZFound);
@ -1000,21 +1000,21 @@ void CParticle::Update()
CRGBA color(0, 0, 0, 0);
Float fFricDeccel50 = pow(0.50f, CTimer::GetTimeStep());
Float fFricDeccel80 = pow(0.80f, CTimer::GetTimeStep());
Float fFricDeccel90 = pow(0.90f, CTimer::GetTimeStep());
Float fFricDeccel95 = pow(0.95f, CTimer::GetTimeStep());
Float fFricDeccel96 = pow(0.96f, CTimer::GetTimeStep());
Float fFricDeccel99 = pow(0.99f, CTimer::GetTimeStep());
float fFricDeccel50 = pow(0.50f, CTimer::GetTimeStep());
float fFricDeccel80 = pow(0.80f, CTimer::GetTimeStep());
float fFricDeccel90 = pow(0.90f, CTimer::GetTimeStep());
float fFricDeccel95 = pow(0.95f, CTimer::GetTimeStep());
float fFricDeccel96 = pow(0.96f, CTimer::GetTimeStep());
float fFricDeccel99 = pow(0.99f, CTimer::GetTimeStep());
CParticleObject::UpdateAll();
for ( Int32 i = 0; i < MAX_PARTICLES; i++ )
for ( int32 i = 0; i < MAX_PARTICLES; i++ )
{
tParticleSystemData *psystem = &mod_ParticleSystemManager.m_aParticles[i];
CParticle *particle = psystem->m_pParticles;
CParticle *prevParticle = NULL;
Bool bRemoveParticle;
bool bRemoveParticle;
if ( particle == NULL )
continue;
@ -1035,18 +1035,18 @@ void CParticle::Update()
{
if ( particle->m_nTimeWhenColorWillBeChanged > CTimer::GetTimeInMilliseconds() )
{
Float colorMul = 1.0f - Float(particle->m_nTimeWhenColorWillBeChanged - CTimer::GetTimeInMilliseconds()) / Float(psystem->m_ColorFadeTime);
float colorMul = 1.0f - float(particle->m_nTimeWhenColorWillBeChanged - CTimer::GetTimeInMilliseconds()) / float(psystem->m_ColorFadeTime);
particle->m_Color.red = clamp(
psystem->m_RenderColouring.red + Int32(Float(psystem->m_FadeDestinationColor.red - psystem->m_RenderColouring.red) * colorMul),
psystem->m_RenderColouring.red + int32(float(psystem->m_FadeDestinationColor.red - psystem->m_RenderColouring.red) * colorMul),
0, 255);
particle->m_Color.green = clamp(
psystem->m_RenderColouring.green + Int32(Float(psystem->m_FadeDestinationColor.green - psystem->m_RenderColouring.green) * colorMul),
psystem->m_RenderColouring.green + int32(float(psystem->m_FadeDestinationColor.green - psystem->m_RenderColouring.green) * colorMul),
0, 255);
particle->m_Color.blue = clamp(
psystem->m_RenderColouring.blue + Int32(Float(psystem->m_FadeDestinationColor.blue - psystem->m_RenderColouring.blue) * colorMul),
psystem->m_RenderColouring.blue + int32(float(psystem->m_FadeDestinationColor.blue - psystem->m_RenderColouring.blue) * colorMul),
0, 255);
}
else
@ -1063,7 +1063,7 @@ void CParticle::Update()
}
}
Float size = particle->m_fSize + particle->m_fExpansionRate;
float size = particle->m_fSize + particle->m_fExpansionRate;
if ( size < 0.0f )
{
@ -1147,7 +1147,7 @@ void CParticle::Update()
{
bRemoveParticle = true;
Int32 randVal = Int32(CGeneral::GetRandomNumber());
int32 randVal = int32(CGeneral::GetRandomNumber());
if ( randVal & 1 )
{
@ -1188,11 +1188,11 @@ void CParticle::Update()
vecPosn.z += 1.0f;
Randomizer++;
Int32 randVal = Int32(Randomizer & 7);
int32 randVal = int32(Randomizer & 7);
if ( randVal == 5 )
{
Int32 randTime = Int32(CGeneral::GetRandomNumber());
int32 randTime = int32(CGeneral::GetRandomNumber());
CShadows::AddPermanentShadow(1, gpBloodPoolTex, &vecPosn,
0.1f, 0.0f, 0.0f, -0.1f,
@ -1202,7 +1202,7 @@ void CParticle::Update()
}
else if ( randVal == 2 )
{
Int32 randTime = Int32(CGeneral::GetRandomNumber());
int32 randTime = int32(CGeneral::GetRandomNumber());
CShadows::AddPermanentShadow(1, gpBloodPoolTex, &vecPosn,
0.2f, 0.0f, 0.0f, -0.2f,
@ -1414,12 +1414,12 @@ void CParticle::Update()
if ( particle->m_fCurrentZRadius != 0.0f )
{
Int32 nSinCosIndex = particle->m_nCurrentZRotation % (SIN_COS_TABLE_SIZE - 1);
int32 nSinCosIndex = particle->m_nCurrentZRotation % (SIN_COS_TABLE_SIZE - 1);
Float fX = (m_CosTable[nSinCosIndex] - m_SinTable[nSinCosIndex])
float fX = (m_CosTable[nSinCosIndex] - m_SinTable[nSinCosIndex])
* particle->m_fCurrentZRadius;
Float fY = (m_SinTable[nSinCosIndex] + m_CosTable[nSinCosIndex])
float fY = (m_SinTable[nSinCosIndex] + m_CosTable[nSinCosIndex])
* particle->m_fCurrentZRadius;
moveStep -= particle->m_vecParticleMovementOffset;
@ -1446,15 +1446,15 @@ void CParticle::Render()
CSprite::InitSpriteBuffer2D();
UInt32 flags = DRAW_OPAQUE;
uint32 flags = DRAW_OPAQUE;
RwRaster *prevFrame = NULL;
for ( Int32 i = 0; i < MAX_PARTICLES; i++ )
for ( int32 i = 0; i < MAX_PARTICLES; i++ )
{
tParticleSystemData *psystem = &mod_ParticleSystemManager.m_aParticles[i];
Bool particleBanned = false;
bool particleBanned = false;
CParticle *particle = psystem->m_pParticles;
@ -1513,7 +1513,7 @@ void CParticle::Render()
while ( particle != NULL )
{
Bool canDraw = true;
bool canDraw = true;
if ( particle->m_nAlpha == 0 )
canDraw = false;
@ -1540,7 +1540,7 @@ void CParticle::Render()
particle->m_fSize * 63.0f,
particle->m_Color,
particle->m_nColorIntensity,
(Float)particle->m_nRotation,
(float)particle->m_nRotation,
particle->m_nAlpha);
}
else
@ -1561,8 +1561,8 @@ void CParticle::Render()
if ( canDraw )
{
CVector coors;
Float w;
Float h;
float w;
float h;
if ( CSprite::CalcScreenCoors(particle->m_vecPosition, coors, &w, &h, true) )
{
@ -1578,13 +1578,13 @@ void CParticle::Render()
particle->m_Color.blue,
particle->m_nColorIntensity,
1.0f / coors.z,
Float(particle->m_nRotation),
float(particle->m_nRotation),
particle->m_nAlpha);
}
else if ( psystem->Flags & SCREEN_TRAIL )
{
Float fRotation;
Float fTrailLength;
float fRotation;
float fTrailLength;
if ( particle->m_vecScreenPosition.x == 0.0f )
{
@ -1599,12 +1599,12 @@ void CParticle::Render()
coors.y - particle->m_vecScreenPosition.y
);
Float fDist = vecDist.Magnitude();
float fDist = vecDist.Magnitude();
fTrailLength = fDist;
//Float fRot = atan2( vecDist.x / fDist, sqrtf(1.0f - vecDist.x / fDist * (vecDist.x / fDist)) );
Float fRot = asinf(vecDist.x / fDist);
float fRot = asinf(vecDist.x / fDist);
fRotation = fRot;
@ -1616,9 +1616,9 @@ void CParticle::Render()
if ( fRotation < 0.0f )
fRotation += 360.0f;
Float fSpeed = particle->m_vecVelocity.Magnitude();
float fSpeed = particle->m_vecVelocity.Magnitude();
Float fNewTrailLength = fSpeed * CTimer::GetTimeStep() * w * 2.0f;
float fNewTrailLength = fSpeed * CTimer::GetTimeStep() * w * 2.0f;
if ( fDist > fNewTrailLength )
fTrailLength = fNewTrailLength;
@ -1640,8 +1640,8 @@ void CParticle::Render()
else if ( psystem->Flags & SPEED_TRAIL )
{
CVector vecPrevPos = particle->m_vecPosition - particle->m_vecVelocity;
Float fRotation;
Float fTrailLength;
float fRotation;
float fTrailLength;
if ( CSprite::CalcScreenCoors(vecPrevPos, particle->m_vecScreenPosition, &fTrailLength, &fRotation, true) )
{
@ -1651,12 +1651,12 @@ void CParticle::Render()
coors.y - particle->m_vecScreenPosition.y
);
Float fDist = vecDist.Magnitude();
float fDist = vecDist.Magnitude();
fTrailLength = fDist;
//Float fRot = atan2(vecDist.x / fDist, sqrt(1.0f - vecDist.x / fDist * (vecDist.x / fDist)));
Float fRot = asinf(vecDist.x / fDist);
float fRot = asinf(vecDist.x / fDist);
fRotation = fRot;
@ -1687,7 +1687,7 @@ void CParticle::Render()
}
else if ( psystem->Flags & VERT_TRAIL )
{
Float fTrailLength = fabsf(particle->m_vecVelocity.z * 10.0f);
float fTrailLength = fabsf(particle->m_vecVelocity.z * 10.0f);
CSprite::RenderBufferedOneXLUSprite(coors.x, coors.y, coors.z,
particle->m_fSize * w,
@ -1772,7 +1772,7 @@ void CParticle::RemoveParticle(CParticle *pParticle, CParticle *pPrevParticle, t
m_pUnusedListHead = pParticle;
}
void CParticle::AddJetExplosion(CVector const &vecPos, Float fPower, Float fSize)
void CParticle::AddJetExplosion(CVector const &vecPos, float fPower, float fSize)
{
CRGBA color(240, 240, 240, 255);
@ -1790,7 +1790,7 @@ void CParticle::AddJetExplosion(CVector const &vecPos, Float fPower, Float fSize
CVector vecStepPos = vecPos;
for ( Int32 i = 0; i < Int32(fPower * 4.0f); i++ )
for ( int32 i = 0; i < int32(fPower * 4.0f); i++ )
{
AddParticle(PARTICLE_EXPLOSION_MFAST,
vecStepPos,
@ -1837,7 +1837,7 @@ void CParticle::AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatr
CVector vecBasePos = matMatrix * (invMat * vecPos + CVector(0.0f, -1.0f, 0.5f));
for ( Int32 i = 0; i < 5; i++ )
for ( int32 i = 0; i < 5; i++ )
{
CVector pos = vecBasePos;

View File

@ -16,25 +16,25 @@ public:
CVector m_vecPosition;
CVector m_vecVelocity;
CVector m_vecScreenPosition;
UInt32 m_nTimeWhenWillBeDestroyed;
UInt32 m_nTimeWhenColorWillBeChanged;
Float m_fZGround;
uint32 m_nTimeWhenWillBeDestroyed;
uint32 m_nTimeWhenColorWillBeChanged;
float m_fZGround;
CVector m_vecParticleMovementOffset;
Int16 m_nCurrentZRotation;
UInt16 m_nZRotationTimer;
Float m_fCurrentZRadius;
UInt16 m_nZRadiusTimer;
int16 m_nCurrentZRotation;
uint16 m_nZRotationTimer;
float m_fCurrentZRadius;
uint16 m_nZRadiusTimer;
char _pad0[2];
Float m_fSize;
Float m_fExpansionRate;
UInt16 m_nFadeToBlackTimer;
UInt16 m_nFadeAlphaTimer;
UInt8 m_nColorIntensity;
UInt8 m_nAlpha;
UInt16 m_nCurrentFrame;
Int16 m_nAnimationSpeedTimer;
Int16 m_nRotationStep;
Int16 m_nRotation;
float m_fSize;
float m_fExpansionRate;
uint16 m_nFadeToBlackTimer;
uint16 m_nFadeAlphaTimer;
uint8 m_nColorIntensity;
uint8 m_nAlpha;
uint16 m_nCurrentFrame;
int16 m_nAnimationSpeedTimer;
int16 m_nRotationStep;
int16 m_nRotation;
RwRGBA m_Color;
char _pad1[2];
CParticle *m_pNext;
@ -49,24 +49,24 @@ public:
;
}
//static Float ms_afRandTable[RAND_TABLE_SIZE];
static Float (&ms_afRandTable)[RAND_TABLE_SIZE];
//static float ms_afRandTable[RAND_TABLE_SIZE];
static float (&ms_afRandTable)[RAND_TABLE_SIZE];
static CParticle *m_pUnusedListHead;
/*
static Float m_SinTable[SIN_COS_TABLE_SIZE];
static Float m_CosTable[SIN_COS_TABLE_SIZE];
static float m_SinTable[SIN_COS_TABLE_SIZE];
static float m_CosTable[SIN_COS_TABLE_SIZE];
*/
static Float (&m_SinTable)[SIN_COS_TABLE_SIZE];
static Float (&m_CosTable)[SIN_COS_TABLE_SIZE];
static float (&m_SinTable)[SIN_COS_TABLE_SIZE];
static float (&m_CosTable)[SIN_COS_TABLE_SIZE];
static void ReloadConfig();
static void Initialise();
static void Shutdown();
static CParticle *AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity = NULL, Float fSize = 0.0f, Int32 nRotationSpeed = 0, Int32 nRotation = 0, Int32 nCurFrame = 0, Int32 nLifeSpan = 0);
static CParticle *AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, Float fSize, RwRGBA const &color, Int32 nRotationSpeed = 0, Int32 nRotation = 0, Int32 nCurFrame = 0, Int32 nLifeSpan = 0);
static CParticle *AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity = NULL, float fSize = 0.0f, int32 nRotationSpeed = 0, int32 nRotation = 0, int32 nCurFrame = 0, int32 nLifeSpan = 0);
static CParticle *AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, float fSize, RwRGBA const &color, int32 nRotationSpeed = 0, int32 nRotation = 0, int32 nCurFrame = 0, int32 nLifeSpan = 0);
static void Update();
static void Render();
@ -74,7 +74,7 @@ public:
static void RemovePSystem(tParticleType type);
static void RemoveParticle(CParticle *pParticle, CParticle *pPrevParticle, tParticleSystemData *pPSystemData);
static inline void _Next(CParticle *&pParticle, CParticle *&pPrevParticle, tParticleSystemData *pPSystemData, Bool bRemoveParticle)
static inline void _Next(CParticle *&pParticle, CParticle *&pPrevParticle, tParticleSystemData *pPSystemData, bool bRemoveParticle)
{
if ( bRemoveParticle )
{
@ -92,7 +92,7 @@ public:
}
}
static void AddJetExplosion(CVector const &vecPos, Float fPower, Float fSize);
static void AddJetExplosion(CVector const &vecPos, float fPower, float fSize);
static void AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatrix);
};

View File

@ -5,7 +5,7 @@
cParticleSystemMgr mod_ParticleSystemManager;
const Char *ParticleFilename = "PARTICLE.CFG";
const char *ParticleFilename = "PARTICLE.CFG";
//cParticleSystemMgr::cParticleSystemMgr()
void cParticleSystemMgr::ctor()
@ -17,7 +17,7 @@ void cParticleSystemMgr::Initialise()
{
LoadParticleData();
for ( Int32 i = 0; i < MAX_PARTICLES; i++ )
for ( int32 i = 0; i < MAX_PARTICLES; i++ )
m_aParticles[i].m_pParticles = NULL;
}
@ -28,13 +28,13 @@ void cParticleSystemMgr::LoadParticleData()
CFileMgr::SetDir("");
tParticleSystemData *entry = NULL;
Int32 type = PARTICLE_FIRST;
int32 type = PARTICLE_FIRST;
Char *lineStart = (Char *)work_buff;
Char *lineEnd = lineStart + 1;
char *lineStart = (char *)work_buff;
char *lineEnd = lineStart + 1;
Char line[500];
Char delims[4];
char line[500];
char delims[4];
while ( true )
{
@ -44,7 +44,7 @@ void cParticleSystemMgr::LoadParticleData()
while ( *lineEnd != '\n' )
++lineEnd;
Int32 lineLength = lineEnd - lineStart;
int32 lineLength = lineEnd - lineStart;
ASSERT(lineLength < 500);
@ -57,11 +57,11 @@ void cParticleSystemMgr::LoadParticleData()
if ( *line != ';' )
{
Int32 param = CFG_PARAM_FIRST;
int32 param = CFG_PARAM_FIRST;
strcpy(delims, " \t");
Char *value = strtok(line, delims);
char *value = strtok(line, delims);
ASSERT(value != NULL);

View File

@ -100,42 +100,42 @@ enum
struct tParticleSystemData
{
tParticleType m_Type;
Char m_aName[20];
Float m_fCreateRange;
Float m_fDefaultInitialRadius;
Float m_fExpansionRate;
UInt16 m_nZRotationInitialAngle;
Int16 m_nZRotationAngleChangeAmount;
UInt16 m_nZRotationChangeTime;
UInt16 m_nZRadiusChangeTime;
Float m_fInitialZRadius;
Float m_fZRadiusChangeAmount;
UInt16 m_nFadeToBlackTime;
Int16 m_nFadeToBlackAmount;
UInt8 m_nFadeToBlackInitialIntensity;
UInt8 m_nFadeAlphaInitialIntensity;
UInt16 m_nFadeAlphaTime;
Int16 m_nFadeAlphaAmount;
UInt16 m_nStartAnimationFrame;
UInt16 m_nFinalAnimationFrame;
UInt16 m_nAnimationSpeed;
UInt16 m_nRotationSpeed;
char m_aName[20];
float m_fCreateRange;
float m_fDefaultInitialRadius;
float m_fExpansionRate;
uint16 m_nZRotationInitialAngle;
int16 m_nZRotationAngleChangeAmount;
uint16 m_nZRotationChangeTime;
uint16 m_nZRadiusChangeTime;
float m_fInitialZRadius;
float m_fZRadiusChangeAmount;
uint16 m_nFadeToBlackTime;
int16 m_nFadeToBlackAmount;
uint8 m_nFadeToBlackInitialIntensity;
uint8 m_nFadeAlphaInitialIntensity;
uint16 m_nFadeAlphaTime;
int16 m_nFadeAlphaAmount;
uint16 m_nStartAnimationFrame;
uint16 m_nFinalAnimationFrame;
uint16 m_nAnimationSpeed;
uint16 m_nRotationSpeed;
char _pad1[2];
Float m_fGravitationalAcceleration;
Int32 m_nFrictionDecceleration;
Int32 m_nLifeSpan;
Float m_fPositionRandomError;
Float m_fVelocityRandomError;
Float m_fExpansionRateError;
Int32 m_nRotationRateError;
UInt32 m_nLifeSpanErrorShape;
Float m_fTrailLengthMultiplier;
UInt32 Flags;
float m_fGravitationalAcceleration;
int32 m_nFrictionDecceleration;
int32 m_nLifeSpan;
float m_fPositionRandomError;
float m_fVelocityRandomError;
float m_fExpansionRateError;
int32 m_nRotationRateError;
uint32 m_nLifeSpanErrorShape;
float m_fTrailLengthMultiplier;
uint32 Flags;
RwRGBA m_RenderColouring;
UInt8 m_InitialColorVariation;
uint8 m_InitialColorVariation;
RwRGBA m_FadeDestinationColor;
char _pad2[3];
UInt32 m_ColorFadeTime;
uint32 m_ColorFadeTime;
RwRaster **m_ppRaster;
CParticle *m_pParticles;

View File

@ -48,6 +48,13 @@ CVisibilityPlugins::Initialise(void)
m_alphaEntityList.tail.item.sort = 100000000.0f;
}
void
CVisibilityPlugins::Shutdown(void)
{
m_alphaList.Shutdown();
m_alphaEntityList.Shutdown();
}
void
CVisibilityPlugins::InitAlphaEntityList(void)
{
@ -822,6 +829,7 @@ CVisibilityPlugins::GetClumpAlpha(RpClump *clump)
STARTPATCHES
InjectHook(0x527E50, CVisibilityPlugins::Initialise, PATCH_JUMP);
InjectHook(0x527EA0, CVisibilityPlugins::Shutdown, PATCH_JUMP);
InjectHook(0x528F90, CVisibilityPlugins::InitAlphaEntityList, PATCH_JUMP);
InjectHook(0x528FF0, CVisibilityPlugins::InsertEntityIntoSortedList, PATCH_JUMP);
InjectHook(0x528F80, CVisibilityPlugins::InitAlphaAtomicList, PATCH_JUMP);

View File

@ -35,6 +35,7 @@ public:
static float &ms_pedFadeDist;
static void Initialise(void);
static void Shutdown(void);
static void InitAlphaEntityList(void);
static bool InsertEntityIntoSortedList(CEntity *e, float dist);
static void InitAlphaAtomicList(void);

View File

@ -726,8 +726,8 @@ KeyboardHandler(RsEvent event, void *param)
static RsEventStatus
HandlePadButtonDown(RsPadButtonStatus *padButtonStatus)
{
Bool bPadTwo = false;
Int32 padNumber = padButtonStatus->padID;
bool bPadTwo = false;
int32 padNumber = padButtonStatus->padID;
CPad *pad = CPad::GetPad(padNumber);
@ -739,7 +739,7 @@ HandlePadButtonDown(RsPadButtonStatus *padButtonStatus)
ControlsManager.UpdateJoyButtonState(padNumber);
for ( Int32 i = 0; i < _TODOCONST(16); i++ )
for ( int32 i = 0; i < _TODOCONST(16); i++ )
{
RsPadButtons btn = rsPADNULL;
if ( ControlsManager.m_aButtonStates[i] == TRUE )
@ -761,8 +761,8 @@ HandlePadButtonDown(RsPadButtonStatus *padButtonStatus)
static RsEventStatus
HandlePadButtonUp(RsPadButtonStatus *padButtonStatus)
{
Bool bPadTwo = false;
Int32 padNumber = padButtonStatus->padID;
bool bPadTwo = false;
int32 padNumber = padButtonStatus->padID;
CPad *pad = CPad::GetPad(padNumber);
@ -772,14 +772,14 @@ HandlePadButtonUp(RsPadButtonStatus *padButtonStatus)
if ( padNumber == 1 )
bPadTwo = true;
Bool bCam = false;
Int16 mode = TheCamera.Cams[TheCamera.ActiveCam].Mode;
bool bCam = false;
int16 mode = TheCamera.Cams[TheCamera.ActiveCam].Mode;
if ( mode == CCam::MODE_FLYBY || mode == CCam::MODE_FIXED )
Bool bCam = true;
bool bCam = true;
ControlsManager.UpdateJoyButtonState(padNumber);
for ( Int32 i = 1; i < _TODOCONST(16); i++ )
for ( int32 i = 1; i < _TODOCONST(16); i++ )
{
RsPadButtons btn = rsPADNULL;
if ( ControlsManager.m_aButtonStates[i] == FALSE )

View File

@ -113,9 +113,9 @@ DWORD _dwMemAvailVideo;
DWORD &_dwOperatingSystemVersion = *(DWORD*)0x70F290;
RwUInt32 &gGameState = *(RwUInt32*)0x8F5838;
WRAPPER Bool InitialiseGame(void) { EAXJMP(0x48E7E0); }
WRAPPER bool InitialiseGame(void) { EAXJMP(0x48E7E0); }
WRAPPER const Char *GetLevelSplashScreen(Int32 number) { EAXJMP(0x48D750); }
WRAPPER const char *GetLevelSplashScreen(int32 number) { EAXJMP(0x48D750); }
//
void LoadingScreen(char const *msg1, char const *msg2, char const *screen);
@ -130,12 +130,12 @@ enum eJoypadState
struct tJoy
{
eJoypadState m_State;
Bool m_bInitialised;
Bool m_bHasAxisZ;
Bool m_bHasAxisR;
bool m_bInitialised;
bool m_bHasAxisZ;
bool m_bHasAxisR;
char _pad0;
Int32 m_nVendorID;
Int32 m_nProductID;
int32 m_nVendorID;
int32 m_nProductID;
};
class CJoySticks
@ -1210,7 +1210,7 @@ MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam)
PDEV_BROADCAST_VOLUME pVol = (PDEV_BROADCAST_VOLUME)pDev;
if ( pVol->dbcv_flags & DBTF_MEDIA )
{
Char c = DMAudio.GetCDAudioDriveLetter();
char c = DMAudio.GetCDAudioDriveLetter();
if ( c >= 'A' && pVol->dbcv_unitmask & (1 << (c - 'A')) )
{
@ -1578,7 +1578,7 @@ void InitialiseLanguage()
|| subLayout == SUBLANG_ENGLISH_AUS )
CGame::noProstitutes = true;
Int32 lang;
int32 lang;
switch ( primSystemLCID )
{
@ -1910,7 +1910,7 @@ _WinMain(HINSTANCE instance,
{
CFileMgr::SetDirMyDocuments();
Int32 gta3set = CFileMgr::OpenFile("gta3.set", "r");
int32 gta3set = CFileMgr::OpenFile("gta3.set", "r");
if ( gta3set )
{
@ -2112,10 +2112,10 @@ _WinMain(HINSTANCE instance,
case GS_PLAYING_GAME:
{
Float ms = (Float)CTimer::GetCurrentTimeInCycles() / (Float)CTimer::GetCyclesPerMillisecond();
float ms = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond();
if ( RwInitialised )
{
if (!CMenuManager::m_PrefsFrameLimiter || (1000.0f / (Float)RsGlobal.maxFPS) < ms)
if (!CMenuManager::m_PrefsFrameLimiter || (1000.0f / (float)RsGlobal.maxFPS) < ms)
RsEventHandler(rsIDLE, (void *)TRUE);
}
break;
@ -2335,16 +2335,16 @@ HRESULT CapturePad(RwInt32 padID)
RsPadEventHandler(rsPADBUTTONUP, (void *)&bs);
Bool deviceAvailable = pPad != NULL;
bool deviceAvailable = pPad != NULL;
if ( deviceAvailable )
{
leftStickPos.x = (Float)js.lX / (Float)((DEVICE_AXIS_MAX - DEVICE_AXIS_MIN) / 2);
leftStickPos.y = (Float)js.lY / (Float)((DEVICE_AXIS_MAX - DEVICE_AXIS_MIN) / 2);
leftStickPos.x = (float)js.lX / (float)((DEVICE_AXIS_MAX - DEVICE_AXIS_MIN) / 2);
leftStickPos.y = (float)js.lY / (float)((DEVICE_AXIS_MAX - DEVICE_AXIS_MIN) / 2);
if (LOWORD(js.rgdwPOV[0]) != -1)
{
Float angle = DEGTORAD((Float)js.rgdwPOV[0] / 100.0f);
float angle = DEGTORAD((float)js.rgdwPOV[0] / 100.0f);
leftStickPos.x = sin(angle);
leftStickPos.y = -cos(angle);
@ -2352,8 +2352,8 @@ HRESULT CapturePad(RwInt32 padID)
if ( AllValidWinJoys.m_aJoys[bs.padID].m_bHasAxisR && AllValidWinJoys.m_aJoys[bs.padID].m_bHasAxisZ )
{
rightStickPos.x = (Float)js.lZ / (Float)((DEVICE_AXIS_MAX - DEVICE_AXIS_MIN) / 2);
rightStickPos.y = (Float)js.lRz / (Float)((DEVICE_AXIS_MAX - DEVICE_AXIS_MIN) / 2);
rightStickPos.x = (float)js.lZ / (float)((DEVICE_AXIS_MAX - DEVICE_AXIS_MIN) / 2);
rightStickPos.y = (float)js.lRz / (float)((DEVICE_AXIS_MAX - DEVICE_AXIS_MIN) / 2);
}
}
@ -2372,16 +2372,16 @@ HRESULT CapturePad(RwInt32 padID)
CPad *pad = CPad::GetPad(bs.padID);
if ( fabs(leftStickPos.x) > 0.3f )
pad->PCTempJoyState.LeftStickX = (Int32)(leftStickPos.x * 128.0f);
pad->PCTempJoyState.LeftStickX = (int32)(leftStickPos.x * 128.0f);
if ( fabs(leftStickPos.y) > 0.3f )
pad->PCTempJoyState.LeftStickY = (Int32)(leftStickPos.y * 128.0f);
pad->PCTempJoyState.LeftStickY = (int32)(leftStickPos.y * 128.0f);
if ( fabs(rightStickPos.x) > 0.3f )
pad->PCTempJoyState.RightStickX = (Int32)(rightStickPos.x * 128.0f);
pad->PCTempJoyState.RightStickX = (int32)(rightStickPos.x * 128.0f);
if ( fabs(rightStickPos.y) > 0.3f )
pad->PCTempJoyState.RightStickY = (Int32)(rightStickPos.y * 128.0f);
pad->PCTempJoyState.RightStickY = (int32)(rightStickPos.y * 128.0f);
}
return S_OK;
@ -2392,7 +2392,7 @@ void _InputInitialiseJoys()
DIPROPDWORD prop;
DIDEVCAPS devCaps;
for ( Int32 i = 0; i < _TODOCONST(2); i++ )
for ( int32 i = 0; i < _TODOCONST(2); i++ )
AllValidWinJoys.ClearJoyInfo(i);
_InputAddJoys();