diff --git a/saco/game/address.h b/saco/game/address.h index 0f7b354..ddcec5e 100644 --- a/saco/game/address.h +++ b/saco/game/address.h @@ -18,4 +18,6 @@ #define ADDR_RENDERWARE_GETD3D_USA10 0x7F9D50 #define ADDR_RENDERWARE_GETD3D_EU10 0x7F9D90 +#define ADDR_ENABLE_HUD 0xBA6769 + #define ADDR_CAMERA 0xB6F99C diff --git a/saco/game/game.cpp b/saco/game/game.cpp index cbf6e23..518fb1f 100644 --- a/saco/game/game.cpp +++ b/saco/game/game.cpp @@ -242,6 +242,160 @@ BOOL CGame::IsGameLoaded() //----------------------------------------------------------- +void CGame::RequestModel(int iModelID, int iLoadingStream) +{ + /* + _asm push iLoadingStream + _asm push iModelID + _asm mov edx, 0x4087E0 + _asm call edx + _asm pop edx + _asm pop edx*/ + + ScriptCommand(&request_model,iModelID); +} + +//----------------------------------------------------------- + +void CGame::LoadRequestedModels() +{ + /* + _asm push 0 + _asm mov edx, 0x40EA10 + _asm call edx + _asm add esp, 4*/ + + ScriptCommand(&load_requested_models); +} + +//----------------------------------------------------------- + +BOOL CGame::IsModelLoaded(int iModelID) +{ + if(iModelID > 20000 || iModelID < 0) return TRUE; + + return ScriptCommand(&is_model_available,iModelID); +} + +//----------------------------------------------------------- + +void CGame::SetWorldWeather(int iWeatherID) +{ + *(DWORD*)(0xC81318) = iWeatherID; + + if(!field_69) { + *(DWORD*)(0xC8131C) = iWeatherID; + *(DWORD*)(0xC81320) = iWeatherID; + } +} + +//----------------------------------------------------------- + +int CGame::GetWorldWeather() +{ + return *(int*)0xC81318; +} + +//----------------------------------------------------------- + +BYTE CGame::IsHudEnabled() +{ + return *(BYTE*)ADDR_ENABLE_HUD; +} + +//----------------------------------------------------------- + +void CGame::SetFrameLimiterOn(BOOL bLimiter) +{ + +} + +//----------------------------------------------------------- + +BOOL CGame::IsFrameLimiterEnabled() +{ + if(*(PBYTE)0xBA6794) return TRUE; + return FALSE; +} + +//----------------------------------------------------------- + +void CGame::EnableFrameLimiter() +{ + *(BYTE*)0xBA6794 = 1; +} + +//----------------------------------------------------------- + +void CGame::SetFrameLimit(DWORD dwLimit) +{ + field_5D = dwLimit; + + UnFuck(0xC1704C,4); + *(DWORD*)0xC1704C = 200; +} + +//----------------------------------------------------------- + +void CGame::SetMaxStats() +{ + // driving stat + _asm mov eax, 0x4399D0 + _asm call eax + + // weapon stats + _asm mov eax, 0x439940 + _asm call eax + + UnFuck(0x55A070,1); + *(BYTE*)0x55A070 = 0xC3; +} + +//----------------------------------------------------------- + +void CGame::DisableTrainTraffic() +{ + ScriptCommand(&enable_train_traffic,0); +} + +//----------------------------------------------------------- + +void CGame::RefreshStreamingAt(float x, float y) +{ + ScriptCommand(&refresh_streaming_at,x,y); +} + +//----------------------------------------------------------- + +void CGame::RequestAnimation(char *szAnimFile) +{ + ScriptCommand(&request_animation, szAnimFile); +} + +//----------------------------------------------------------- + +int CGame::IsAnimationLoaded(char *szAnimFile) +{ + return ScriptCommand(&is_animation_loaded,szAnimFile); +} + +//----------------------------------------------------------- + +void CGame::ReleaseAnimation(char *szAnimFile) +{ + if (IsAnimationLoaded(szAnimFile)) + ScriptCommand(&release_animation,szAnimFile); +} + +//----------------------------------------------------------- + +void CGame::ToggleRadar(int iToggle) +{ + *(PBYTE)0xBAA3FB = (BYTE)!iToggle; +} + +//----------------------------------------------------------- + //----------------------------------------------------------- DWORD CGame::GetD3DDevice() diff --git a/saco/game/game.h b/saco/game/game.h index 1e9eebf..f64635b 100644 --- a/saco/game/game.h +++ b/saco/game/game.h @@ -26,7 +26,7 @@ private: char gap51[4]; int field_55; int field_59; - int field_5D; + DWORD field_5D; int field_61; int field_65; int field_69; @@ -37,6 +37,26 @@ public: BOOL IsGameLoaded(); + void RequestModel(int iModelID, int iLoadingStream = 2); + void LoadRequestedModels(); + BOOL IsModelLoaded(int iModelID); + + void SetWorldWeather(int iWeatherID); + int GetWorldWeather(); + void DisplayHud(BOOL bDisp); + BYTE IsHudEnabled(); + void SetFrameLimiterOn(BOOL bLimiter); + BOOL IsFrameLimiterEnabled(); + void EnableFrameLimiter(); + void SetFrameLimit(DWORD dwLimit); + void SetMaxStats(); + void DisableTrainTraffic(); + void RefreshStreamingAt(float x, float y); + void RequestAnimation(char *szAnimFile); + int IsAnimationLoaded(char *szAnimFile); + void ReleaseAnimation(char *szAnimFile); + void ToggleRadar(int iToggle); + void SetGravity(float fGravity); void SetWantedLevel(BYTE byteLevel); diff --git a/saco/game/scripting.h b/saco/game/scripting.h index 47e807e..55ae445 100644 --- a/saco/game/scripting.h +++ b/saco/game/scripting.h @@ -18,7 +18,12 @@ struct SCRIPT_COMMAND // Params int ScriptCommand(const SCRIPT_COMMAND* pScriptCommand, ...); // The main scripting function. See notes. +const SCRIPT_COMMAND request_model = { 0x0247, "i" }; // (CAR_*|BIKE_*|BOAT_*|WEAPON_*|OBJECT_*) +const SCRIPT_COMMAND load_requested_models = { 0x038B, "" }; // -/- + const SCRIPT_COMMAND fade = { 0x016A, "ii" }; // (time in ms), FADE_* +const SCRIPT_COMMAND is_model_available = { 0x0248, "i" }; // #MODEL + const SCRIPT_COMMAND set_camera_behind_player = { 0x0373, "" }; // -/- const SCRIPT_COMMAND point_camera = { 0x0160, "fffi" }; // x, y, z, type const SCRIPT_COMMAND restore_camera_jumpcut = { 0x02EB, "" }; // -/- @@ -26,6 +31,14 @@ const SCRIPT_COMMAND set_camera_position = { 0x015F, "ffffff" }; // x, y, z, const SCRIPT_COMMAND set_actor_can_be_decapitated = { 0x0446, "ii" }; +const SCRIPT_COMMAND enable_train_traffic = { 0x06d7, "i" }; + +const SCRIPT_COMMAND refresh_streaming_at = { 0x04E4, "ff" }; + +const SCRIPT_COMMAND request_animation = { 0x04ED, "s" }; +const SCRIPT_COMMAND is_animation_loaded = { 0x04EE, "s" }; +const SCRIPT_COMMAND release_animation = { 0x04EF, "s" }; + const SCRIPT_COMMAND set_actor_weapon_droppable = { 0x087e, "ii" }; const SCRIPT_COMMAND restore_camera_to_user_defined = { 0x925, "" };