1
0
Fork 0
mirror of https://github.com/halpz/re3.git synced 2024-12-23 17:45:28 +00:00

CWeaponEffects(autoaim crosshair) done, CGame done. restored some original R* names

This commit is contained in:
Fire-Head 2020-03-28 23:55:23 +03:00
parent c056871e07
commit 194ddc5f40
30 changed files with 596 additions and 132 deletions

View file

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

View file

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

View file

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

View file

@ -30,10 +30,14 @@ uint32 &CGarages::GarageToBeTidied = *(uint32 *)0x623570;
CGarage(&CGarages::Garages)[NUM_GARAGES] = *(CGarage(*)[NUM_GARAGES])*(uintptr*)0x72BCD0;
WRAPPER void CGarages::Init(void) { EAXJMP(0x421C60); }
WRAPPER void CGarages::Shutdown(void) { EAXJMP(0x421E10); }
WRAPPER void CGarages::Update(void) { EAXJMP(0x421E40); }
WRAPPER void CGarages::Load(uint8* buf, uint32 size) { EAXJMP(0x428940); }
WRAPPER void CGarages::Save(uint8* buf, uint32 *size) { EAXJMP(0x4284e0); }
WRAPPER void CGarages::SetAllDoorsBackToOriginalHeight(void) { EAXJMP(0x4283D0); }
bool
CGarages::IsModelIndexADoor(uint32 id)
{

View file

@ -146,6 +146,7 @@ public:
static bool IsPointWithinAnyGarage(CVector&);
static void PlayerArrestedOrDied();
static void Init(void);
static void Shutdown(void);
static void Update(void);
static void Load(uint8 *buf, uint32 size);
static void Save(uint8 *buf, uint32 *size);
@ -167,4 +168,6 @@ public:
static bool IsThisCarWithinGarageArea(int16, CEntity*);
static int GetCarsCollectedIndexForGarageType(eGarageType type) { return type - GARAGE_COLLECTCARS_1; }
static void SetAllDoorsBackToOriginalHeight();
};

View file

@ -9819,7 +9819,7 @@ void CTheScripts::UndoBuildingSwaps()
}
}
void CTheScripts::UndoEntityVisibilitySettings()
void CTheScripts::UndoEntityInvisibilitySettings()
{
for (int i = 0; i < MAX_NUM_INVISIBILITY_SETTINGS; i++) {
if (InvisibilitySettingArray[i]) {
@ -11657,7 +11657,7 @@ InjectHook(0x439040, &CTheScripts::Process, PATCH_JUMP);
InjectHook(0x439400, &CTheScripts::StartTestScript, PATCH_JUMP);
InjectHook(0x439410, &CTheScripts::IsPlayerOnAMission, PATCH_JUMP);
InjectHook(0x44FD10, &CTheScripts::UndoBuildingSwaps, PATCH_JUMP);
InjectHook(0x44FD60, &CTheScripts::UndoEntityVisibilitySettings, PATCH_JUMP);
InjectHook(0x44FD60, &CTheScripts::UndoEntityInvisibilitySettings, PATCH_JUMP);
InjectHook(0x4534E0, &CTheScripts::ScriptDebugLine3D, PATCH_JUMP);
InjectHook(0x453550, &CTheScripts::RenderTheScriptDebugLines, PATCH_JUMP);
InjectHook(0x4535E0, &CTheScripts::SaveAllScripts, PATCH_JUMP);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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