1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-22 19:50:00 +00:00

implemented some higher level functions; added lots of stubs; switched top and bottom in CRect

This commit is contained in:
aap 2019-05-30 21:24:47 +02:00
parent d434c88606
commit 188aab4196
65 changed files with 791 additions and 169 deletions

View file

@ -14,6 +14,8 @@ const float DefaultFOV = 80.0f; // actually 70.0f
CCamera &TheCamera = *(CCamera*)0x6FACF8;
WRAPPER void CCamera::DrawBordersForWideScreen(void) { EAXJMP(0x46B430); }
bool
CCamera::IsSphereVisible(const CVector &center, float radius, const CMatrix *mat)
{
@ -66,6 +68,18 @@ CCamera::IsBoxVisible(RwV3d *box, const CMatrix *mat)
return true;
}
WRAPPER void CCamera::Fade(float timeout, int16 direction) { EAXJMP(0x46B3A0); }
WRAPPER void CCamera::ProcessFade(void) { EAXJMP(0x46F080); }
WRAPPER void CCamera::ProcessMusicFade(void) { EAXJMP(0x46F1E0); }
void
CCamera::SetFadeColour(uint8 r, uint8 g, uint8 b)
{
m_FadeTargetIsSplashScreen = r == 0 && g == 0 && b == 0;
CDraw::FadeRed = r;
CDraw::FadeGreen = g;
CDraw::FadeBlue = b;
}
/*
*
@ -1186,6 +1200,8 @@ CCam::FixCamWhenObscuredByVehicle(const CVector &TargetCoors)
STARTPATCHES
InjectHook(0x42C760, &CCamera::IsSphereVisible, PATCH_JUMP);
InjectHook(0x46FD00, &CCamera::SetFadeColour, PATCH_JUMP);
InjectHook(0x456F40, WellBufferMe, PATCH_JUMP);
InjectHook(0x4582F0, &CCam::GetVectorsReadyForRW, PATCH_JUMP);
InjectHook(0x457710, &CCam::DoAverageOnVector, PATCH_JUMP);

View file

@ -49,8 +49,8 @@ struct CCam
MODE_SPECIALFIXEDFORSYPHON,
MODE_FIGHT,
MODE_TOPDOWNPED,
MODE_FIRSTPERSONPEDONPC_38,
MODE_FIRSTPERSONPEDONPC_39,
MODE_SNIPER_RUN_AROUND,
MODE_ROCKET_RUN_AROUND,
MODE_FIRSTPERSONPEDONPC_40,
MODE_FIRSTPERSONPEDONPC_41,
MODE_FIRSTPERSONPEDONPC_42,
@ -419,6 +419,13 @@ int m_iModeObbeCamIsInForCar;
bool IsPointVisible(const CVector &center, const CMatrix *mat);
bool IsSphereVisible(const CVector &center, float radius, const CMatrix *mat);
bool IsBoxVisible(RwV3d *box, const CMatrix *mat);
void Fade(float timeout, int16 direction);
void ProcessFade(void);
void ProcessMusicFade(void);
void SetFadeColour(uint8 r, uint8 g, uint8 b);
void DrawBordersForWideScreen(void);
};
static_assert(offsetof(CCamera, m_WideScreenOn) == 0x70, "CCamera: error");
static_assert(offsetof(CCamera, WorldViewerBeingUsed) == 0x75, "CCamera: error");

8
src/Frontend.cpp Normal file
View file

@ -0,0 +1,8 @@
#include "common.h"
#include "patcher.h"
#include "Frontend.h"
int &CMenuManager::m_PrefsBrightness = *(int*)0x5F2E50;
CMenuManager &FrontEndMenuManager = *(CMenuManager*)0x8F59D8;
WRAPPER void CMenuManager::DrawFrontEnd(void) { EAXJMP(0x47A540); }

85
src/Frontend.h Normal file
View file

@ -0,0 +1,85 @@
#pragma
#include "Sprite2d.h"
struct tSkinInfo
{
int field_0;
char skinName[256];
char currSkinName[256];
char date[256];
int field_304;
};
class CMenuManager
{
public:
int32 m_nPrefsVideoMode;
int32 m_nDisplayVideoMode;
int8 m_nPrefsAudio3DProviderIndex;
bool m_bKeyChangeNotProcessed;
char m_aSkinName[256];
int32 m_nHelperTextMsgId;
bool m_bLanguageLoaded;
bool m_bMenuActive;
char field_112;
char field_113;
bool m_bStartGameLoading;
bool m_bFirstTime;
bool m_bGameNotLoaded;
int32 m_nMousePosX;
int32 m_nMousePosY;
int32 m_nMouseTempPosX;
int32 m_nMouseTempPosY;
bool m_bShowMouse;
tSkinInfo field_12C;
tSkinInfo *m_pSelectedSkin;
tSkinInfo *field_438;
float field_43C;
int field_440;
int m_nSkinsTotal;
char _unk0[4];
int field_44C;
bool m_bSkinsFound;
bool m_bQuitGameNoCD;
char field_452;
bool m_bSaveMenuActive;
bool m_bLoadingSavedGame;
char field_455;
char field_456;
bool m_bSpritesLoaded;
CSprite2d m_aFrontEndSprites[28];
CSprite2d m_aMenuSprites[20];
int field_518;
int m_nMenuFadeAlpha;
char field_520;
char field_521;
char field_522;
char field_523;
char field_524;
int m_CurrCntrlAction;
char _unk1[4];
int field_530;
char field_534;
char field_535;
int8 field_536;
int m_nHelperTextAlpha;
int m_nMouseOldPosX;
int m_nMouseOldPosY;
int field_544;
int m_nCurrScreen;
int m_nCurrOption;
int field_550;
int m_nPrevScreen;
int field_558;
int m_nCurrSaveSlot;
int m_nScreenChangeDelayTimer;
static int &m_PrefsBrightness;
void DrawFrontEnd(void);
};
static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error");
extern CMenuManager &FrontEndMenuManager;

View file

@ -1,4 +0,0 @@
#include "common.h"
#include "MenuManager.h"
int &CMenuManager::m_PrefsBrightness = *(int*)0x5F2E50;

View file

@ -1,5 +0,0 @@
class CMenuManager
{
public:
static int &m_PrefsBrightness;
};

5
src/Messages.cpp Normal file
View file

@ -0,0 +1,5 @@
#include "common.h"
#include "patcher.h"
#include "Messages.h"
WRAPPER void CMessages::Display(void) { EAXJMP(0x529800); }

7
src/Messages.h Normal file
View file

@ -0,0 +1,7 @@
#pragma once
class CMessages
{
public:
static void Display(void);
};

View file

@ -1,4 +1,5 @@
#include "common.h"
#include "patcher.h"
#include "Pad.h"
CPad *CPad::Pads = (CPad*)0x6F0360;
@ -11,6 +12,8 @@ CMouseControllerState &CPad::OldMouseControllerState = *(CMouseControllerState*)
CMouseControllerState &CPad::NewMouseControllerState = *(CMouseControllerState*)0x8809F0;
CMouseControllerState &CPad::PCTempMouseControllerState = *(CMouseControllerState*)0x6F1E60;
WRAPPER void CPad::PrintErrorMessage(void) { EAXJMP(0x4942B0); }
void
CControllerState::Clear(void)
{

View file

@ -121,6 +121,7 @@ public:
bool GetLookRight(void);
static CPad *GetPad(int n) { return &Pads[n]; }
static void PrintErrorMessage(void);
};
static_assert(sizeof(CPad) == 0xFC, "CPad: error");

View file

@ -110,5 +110,4 @@ public:
static int GetFogRed(void) { return m_nCurrentFogColourRed; }
static int GetFogGreen(void) { return m_nCurrentFogColourGreen; }
static int GetFogBlue(void) { return m_nCurrentFogColourBlue; }
};

10
src/User.cpp Normal file
View file

@ -0,0 +1,10 @@
#include "common.h"
#include "patcher.h"
#include "User.h"
CPlaceName &CUserDisplay::PlaceName = *(CPlaceName*)0x8F29BC;
COnscreenTimer &CUserDisplay::OnscnTimer = *(COnscreenTimer*)0x862238;
CPager &CUserDisplay::Pager = *(CPager*)0x8F2744;
CCurrentVehicle &CUserDisplay::CurrentVehicle = *(CCurrentVehicle*)0x8F5FE8;
WRAPPER void COnscreenTimer::ProcessForDisplay(void) { EAXJMP(0x4292E0); }

28
src/User.h Normal file
View file

@ -0,0 +1,28 @@
#pragma once
class COnscreenTimer
{
public:
void ProcessForDisplay(void);
};
class CPlaceName
{
};
class CCurrentVehicle
{
};
class CPager
{
};
class CUserDisplay
{
public:
static CPlaceName &PlaceName;
static COnscreenTimer &OnscnTimer;
static CPager &Pager;
static CCurrentVehicle &CurrentVehicle;
};

View file

@ -1,4 +1,5 @@
#include "common.h"
#include "patcher.h"
#include "Weather.h"
int32 &CWeather::SoundHandle = *(int32*)0x5FFBC4;
@ -25,3 +26,5 @@ float &CWeather::Rainbow = *(float*)0x940598;
bool &CWeather::bScriptsForceRain = *(bool*)0x95CD7D;
bool &CWeather::Stored_StateStored = *(bool*)0x95CDC1;
WRAPPER void CWeather::RenderRainStreaks(void) { EAXJMP(0x524550); }

View file

@ -32,4 +32,6 @@ public:
static bool &bScriptsForceRain;
static bool &Stored_StateStored;
static void RenderRainStreaks(void);
};

View file

@ -0,0 +1,7 @@
#include "common.h"
#include "patcher.h"
#include "MusicManager.h"
cMusicManager &MusicManager = *(cMusicManager*)0x8F3964;
WRAPPER void cMusicManager::DisplayRadioStationName(void) { EAXJMP(0x57E6D0); }

8
src/audio/MusicManager.h Normal file
View file

@ -0,0 +1,8 @@
#pragma once
class cMusicManager
{
public:
void DisplayRadioStationName(void);
};
extern cMusicManager &MusicManager;

5
src/control/Darkel.cpp Normal file
View file

@ -0,0 +1,5 @@
#include "common.h"
#include "patcher.h"
#include "Darkel.h"
WRAPPER void CDarkel::DrawMessages(void) { EAXJMP(0x420920); }

7
src/control/Darkel.h Normal file
View file

@ -0,0 +1,7 @@
#pragma once
class CDarkel
{
public:
static void DrawMessages(void);
};

View file

@ -3,6 +3,8 @@
#include "ModelIndices.h"
#include "Garages.h"
WRAPPER void CGarages::PrintMessages(void) { EAXJMP(0x426310); }
bool
CGarages::IsModelIndexADoor(uint32 id)
{

View file

@ -4,4 +4,5 @@ class CGarages
{
public:
static bool IsModelIndexADoor(uint32 id);
static void PrintMessages(void);
};

7
src/control/Pickups.cpp Normal file
View file

@ -0,0 +1,7 @@
#include "common.h"
#include "patcher.h"
#include "Pickups.h"
WRAPPER void CPickups::RenderPickUpText(void) { EAXJMP(0x432440); }
WRAPPER void CPacManPickups::Render(void) { EAXJMP(0x432F60); }

13
src/control/Pickups.h Normal file
View file

@ -0,0 +1,13 @@
#pragma once
class CPickups
{
public:
static void RenderPickUpText(void);
};
class CPacManPickups
{
public:
static void Render(void);
};

5
src/control/Replay.cpp Normal file
View file

@ -0,0 +1,5 @@
#include "common.h"
#include "patcher.h"
#include "Replay.h"
WRAPPER void CReplay::Display(void) { EAXJMP(0x595EE0); }

7
src/control/Replay.h Normal file
View file

@ -0,0 +1,7 @@
#pragma once
class CReplay
{
public:
static void Display(void);
};

View file

@ -45,28 +45,28 @@ CEntity::GetIsOnScreenComplex(void)
float minz = z + colmodel->boundingBox.min.z;
float maxz = z + colmodel->boundingBox.max.z;
boundBox[0].x = rect.left;
boundBox[0].y = rect.top;
boundBox[0].y = rect.bottom;
boundBox[0].z = minz;
boundBox[1].x = rect.left;
boundBox[1].y = rect.bottom;
boundBox[1].y = rect.top;
boundBox[1].z = minz;
boundBox[2].x = rect.right;
boundBox[2].y = rect.top;
boundBox[2].y = rect.bottom;
boundBox[2].z = minz;
boundBox[3].x = rect.right;
boundBox[3].y = rect.bottom;
boundBox[3].y = rect.top;
boundBox[3].z = minz;
boundBox[4].x = rect.left;
boundBox[4].y = rect.top;
boundBox[4].y = rect.bottom;
boundBox[4].z = maxz;
boundBox[5].x = rect.left;
boundBox[5].y = rect.bottom;
boundBox[5].y = rect.top;
boundBox[5].z = maxz;
boundBox[6].x = rect.right;
boundBox[6].y = rect.top;
boundBox[6].y = rect.bottom;
boundBox[6].z = maxz;
boundBox[7].x = rect.right;
boundBox[7].y = rect.bottom;
boundBox[7].y = rect.top;
boundBox[7].z = maxz;
return TheCamera.IsBoxVisible(boundBox, &TheCamera.GetCameraMatrix());
@ -84,9 +84,9 @@ CEntity::Add(void)
xstart = CWorld::GetSectorIndexX(bounds.left);
xend = CWorld::GetSectorIndexX(bounds.right);
xmid = CWorld::GetSectorIndexX((bounds.left + bounds.right)/2.0f);
ystart = CWorld::GetSectorIndexY(bounds.bottom);
yend = CWorld::GetSectorIndexY(bounds.top);
ymid = CWorld::GetSectorIndexY((bounds.bottom + bounds.top)/2.0f);
ystart = CWorld::GetSectorIndexY(bounds.top);
yend = CWorld::GetSectorIndexY(bounds.bottom);
ymid = CWorld::GetSectorIndexY((bounds.top + bounds.bottom)/2.0f);
assert(xstart >= 0);
assert(xend < NUMSECTORS_X);
assert(ystart >= 0);
@ -144,9 +144,9 @@ CEntity::Remove(void)
xstart = CWorld::GetSectorIndexX(bounds.left);
xend = CWorld::GetSectorIndexX(bounds.right);
xmid = CWorld::GetSectorIndexX((bounds.left + bounds.right)/2.0f);
ystart = CWorld::GetSectorIndexY(bounds.bottom);
yend = CWorld::GetSectorIndexY(bounds.top);
ymid = CWorld::GetSectorIndexY((bounds.bottom + bounds.top)/2.0f);
ystart = CWorld::GetSectorIndexY(bounds.top);
yend = CWorld::GetSectorIndexY(bounds.bottom);
ymid = CWorld::GetSectorIndexY((bounds.top + bounds.bottom)/2.0f);
assert(xstart >= 0);
assert(xend < NUMSECTORS_X);
assert(ystart >= 0);

View file

@ -27,9 +27,9 @@ CPhysical::Add(void)
xstart = CWorld::GetSectorIndexX(bounds.left);
xend = CWorld::GetSectorIndexX(bounds.right);
xmid = CWorld::GetSectorIndexX((bounds.left + bounds.right)/2.0f);
ystart = CWorld::GetSectorIndexY(bounds.bottom);
yend = CWorld::GetSectorIndexY(bounds.top);
ymid = CWorld::GetSectorIndexY((bounds.bottom + bounds.top)/2.0f);
ystart = CWorld::GetSectorIndexY(bounds.top);
yend = CWorld::GetSectorIndexY(bounds.bottom);
ymid = CWorld::GetSectorIndexY((bounds.top + bounds.bottom)/2.0f);
assert(xstart >= 0);
assert(xend < NUMSECTORS_X);
assert(ystart >= 0);
@ -92,9 +92,9 @@ CPhysical::RemoveAndAdd(void)
xstart = CWorld::GetSectorIndexX(bounds.left);
xend = CWorld::GetSectorIndexX(bounds.right);
xmid = CWorld::GetSectorIndexX((bounds.left + bounds.right)/2.0f);
ystart = CWorld::GetSectorIndexY(bounds.bottom);
yend = CWorld::GetSectorIndexY(bounds.top);
ymid = CWorld::GetSectorIndexY((bounds.bottom + bounds.top)/2.0f);
ystart = CWorld::GetSectorIndexY(bounds.top);
yend = CWorld::GetSectorIndexY(bounds.bottom);
ymid = CWorld::GetSectorIndexY((bounds.top + bounds.bottom)/2.0f);
assert(xstart >= 0);
assert(xend < NUMSECTORS_X);
assert(ystart >= 0);

View file

@ -1,112 +1,256 @@
#include <direct.h>
#include <Windows.h>
#include "common.h"
#include "patcher.h"
#include "RwHelper.h"
#include "Clouds.h"
#include "Draw.h"
#include "Sprite2d.h"
#include "Renderer.h"
#include "debugmenu_public.h"
#include "Coronas.h"
#include "WaterLevel.h"
#include "Weather.h"
#include "Glass.h"
#include "WaterCannon.h"
#include "SpecialFX.h"
#include "Shadows.h"
#include "Skidmarks.h"
#include "Antennas.h"
#include "Rubbish.h"
#include "Particle.h"
#include "Pickups.h"
#include "WeaponEffects.h"
#include "PointLights.h"
#include "Fluff.h"
#include "Replay.h"
#include "Camera.h"
#include "World.h"
#include "Ped.h"
#include "Font.h"
#include "Pad.h"
#include "Hud.h"
#include "User.h"
#include "Messages.h"
#include "Darkel.h"
#include "Garages.h"
#include "MusicManager.h"
#include "Frontend.h"
void **rwengine = *(void***)0x5A10E1;
RsGlobalType &RsGlobal = *(RsGlobalType*)0x8F4360;
GlobalScene &Scene = *(GlobalScene*)0x726768;
DebugMenuAPI gDebugMenuAPI;
WRAPPER void *gtanew(uint32 sz) { EAXJMP(0x5A0690); }
WRAPPER void gtadelete(void *p) { EAXJMP(0x5A07E0); }
// overload our own new/delete with GTA's functions
void *operator new(size_t sz) { return gtanew(sz); }
void operator delete(void *ptr) noexcept { gtadelete(ptr); }
// Use our own implementation of rand, stolen from PS2
unsigned __int64 myrand_seed = 1;
int
myrand(void)
// This is certainly a very useful function
void
DoRWRenderHorizon(void)
{
myrand_seed = 0x5851F42D4C957F2D * myrand_seed + 1;
return ((myrand_seed >> 32) & 0x7FFFFFFF);
CClouds::RenderHorizon();
}
void
mysrand(unsigned int seed)
RenderScene(void)
{
myrand_seed = seed;
}
// platform stuff
char*
GetUserDirectory(void)
{
static char path[MAX_PATH];
strcpy(path, "userfiles");
mkdir(path);
return path;
}
int (*open_script_orig)(const char *path, const char *mode);
int
open_script(const char *path, const char *mode)
{
if(GetAsyncKeyState('D') & 0x8000)
return open_script_orig("main_d.scm", mode);
// if(GetAsyncKeyState('R') & 0x8000)
return open_script_orig("main_freeroam.scm", mode);
return open_script_orig(path, mode);
}
int gDbgSurf;
int (*RsEventHandler_orig)(int a, int b);
int
delayedPatches10(int a, int b)
{
if(DebugMenuLoad()){
DebugMenuAddVarBool8("Debug", "Show Ped Road Groups", (int8*)&gbShowPedRoadGroups, nil);
DebugMenuAddVarBool8("Debug", "Show Car Road Groups", (int8*)&gbShowCarRoadGroups, nil);
DebugMenuAddVarBool8("Debug", "Show Collision Polys", (int8*)&gbShowCollisionPolys, nil);
DebugMenuAddVarBool8("Debug", "Don't render Buildings", (int8*)&gbDontRenderBuildings, nil);
DebugMenuAddVarBool8("Debug", "Don't render Big Buildings", (int8*)&gbDontRenderBigBuildings, nil);
DebugMenuAddVarBool8("Debug", "Don't render Peds", (int8*)&gbDontRenderPeds, nil);
DebugMenuAddVarBool8("Debug", "Don't render Objects", (int8*)&gbDontRenderObjects, nil);
DebugMenuAddVar("Debug", "Dbg Surface", &gDbgSurf, nil, 1, 0, 34, nil);
}
return RsEventHandler_orig(a, b);
CClouds::Render();
DoRWRenderHorizon();
CRenderer::RenderRoads();
CCoronas::RenderReflections();
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
CRenderer::RenderEverythingBarRoads();
CRenderer::RenderBoats();
DefinedState();
CWaterLevel::RenderWater();
CRenderer::RenderFadingInEntities();
CRenderer::RenderVehiclesButNotBoats();
CWeather::RenderRainStreaks();
}
void
patch()
RenderDebugShit(void)
{
StaticPatcher::Apply();
Patch<float>(0x46BC61+6, 1.0f); // car distance
InjectHook(0x59E460, printf, PATCH_JUMP);
InterceptCall(&open_script_orig, open_script, 0x438869);
InterceptCall(&RsEventHandler_orig, delayedPatches10, 0x58275E);
// CTheScripts::RenderTheScriptDebugLines()
}
BOOL WINAPI
DllMain(HINSTANCE hInst, DWORD reason, LPVOID)
void
RenderEffects(void)
{
if(reason == DLL_PROCESS_ATTACH){
CGlass::Render();
CWaterCannons::Render();
CSpecialFX::Render();
CShadows::RenderStaticShadows();
CShadows::RenderStoredShadows();
CSkidmarks::Render();
CAntennas::Render();
CRubbish::Render();
CCoronas::Render();
CParticle::Render();
CPacManPickups::Render();
CWeaponEffects::Render();
CPointLights::RenderFogEffect();
CMovingThings::Render();
CRenderer::RenderFirstPersonVehicle();
}
AllocConsole();
freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
void
Render2dStuff(void)
{
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
if (*(DWORD*)0x5C1E75 == 0xB85548EC) // 1.0
patch();
else
return FALSE;
CReplay::Display();
CPickups::RenderPickUpText();
if(TheCamera.m_WideScreenOn)
TheCamera.DrawBordersForWideScreen();
CPed *player = FindPlayerPed();
int weaponType = 0;
if(player)
weaponType = player->GetWeapon()->m_eWeaponType;
bool firstPersonWeapon = false;
int cammode = TheCamera.Cams[TheCamera.ActiveCam].Mode;
if(cammode == CCam::MODE_SNIPER ||
cammode == CCam::MODE_SNIPER_RUN_AROUND ||
cammode == CCam::MODE_ROCKET ||
cammode == CCam::MODE_ROCKET_RUN_AROUND)
firstPersonWeapon = true;
// Draw black border for sniper and rocket launcher
if((weaponType == WEAPONTYPE_SNIPERRIFLE || weaponType == WEAPONTYPE_ROCKETLAUNCHER) && firstPersonWeapon){
CRGBA black(0, 0, 0, 255);
// 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/2 - SCREEN_STRETCH_X(210), SCREENH), black);
CSprite2d::DrawRect(CRect(SCREENW/2 + SCREEN_STRETCH_X(210), 0.0f, SCREENW, SCREENH), black);
}
return TRUE;
MusicManager.DisplayRadioStationName();
// TheConsole.Display();
/*
if(CSceneEdit::m_bEditOn)
CSceneEdit::Draw();
else
*/
CHud::Draw();
CUserDisplay::OnscnTimer.ProcessForDisplay();
CMessages::Display();
CDarkel::DrawMessages();
CGarages::PrintMessages();
CPad::PrintErrorMessage();
CFont::DrawFonts();
}
void
RenderMenus(void)
{
if(FrontEndMenuManager.m_bMenuActive)
FrontEndMenuManager.DrawFrontEnd();
}
bool &JustLoadedDontFadeInYet = *(bool*)0x95CDB4;
bool &StillToFadeOut = *(bool*)0x95CD99;
int32 &TimeStartedCountingForFade = *(int32*)0x9430EC;
int32 &TimeToStayFadedBeforeFadeOut = *(int32*)0x611564;
void
DoFade(void)
{
if(CTimer::GetIsPaused())
return;
if(JustLoadedDontFadeInYet){
JustLoadedDontFadeInYet = false;
TimeStartedCountingForFade = CTimer::GetTimeInMilliseconds();
}
if(StillToFadeOut){
if(CTimer::GetTimeInMilliseconds() - TimeStartedCountingForFade > TimeToStayFadedBeforeFadeOut){
StillToFadeOut = false;
TheCamera.Fade(3.0f, 1);
TheCamera.ProcessFade();
TheCamera.ProcessMusicFade();
}else{
TheCamera.SetFadeColour(0, 0, 0);
TheCamera.Fade(0.0f, 0);
TheCamera.ProcessFade();
}
}
if(CDraw::FadeValue != 0 || CMenuManager::m_PrefsBrightness < 256){
// LoadSplash
CRGBA fadeColor;
CRect rect;
int fadeValue = CDraw::FadeValue;
float brightness = min(CMenuManager::m_PrefsBrightness, 256);
if(brightness <= 50)
brightness = 50;
if(FrontEndMenuManager.m_bMenuActive)
brightness = 256;
if(TheCamera.m_FadeTargetIsSplashScreen)
fadeValue = 0;
float fade = fadeValue + 256 - brightness;
if(fade == 0){
fadeColor.r = 0;
fadeColor.g = 0;
fadeColor.b = 0;
fadeColor.a = 0;
}else{
fadeColor.r = fadeValue * CDraw::FadeRed / fade;
fadeColor.g = fadeValue * CDraw::FadeGreen / fade;
fadeColor.b = fadeValue * CDraw::FadeBlue / fade;
int alpha = 255 - brightness*(256 - fadeValue)/256;
if(alpha < 0)
alpha = 0;
fadeColor.a = alpha;
}
if(TheCamera.m_WideScreenOn){
// what's this?
float y = SCREENH/2 * TheCamera.m_ScreenReductionPercentage/100.0f;
rect.left = 0.0f;
rect.right = SCREENW;
rect.top = y - 8.0f;
rect.bottom = SCREENH - y - 8.0f;
}else{
rect.left = 0.0f;
rect.right = SCREENW;
rect.top = 0.0f;
rect.bottom = SCREENH;
}
CSprite2d::DrawRect(rect, fadeColor);
if(CDraw::FadeValue != 0 && TheCamera.m_FadeTargetIsSplashScreen){
fadeColor.r = 255;
fadeColor.g = 255;
fadeColor.b = 255;
fadeColor.a = CDraw::FadeValue;
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW, SCREENH), fadeColor, fadeColor, fadeColor, fadeColor);
}
}
}
void
Render2dStuffAfterFade(void)
{
CHud::DrawAfterFade();
CFont::DrawFonts();
}
STARTPATCHES
InjectHook(0x48E030, RenderScene, PATCH_JUMP);
InjectHook(0x48E080, RenderDebugShit, PATCH_JUMP);
InjectHook(0x48E090, RenderEffects, PATCH_JUMP);
InjectHook(0x48E0E0, Render2dStuff, PATCH_JUMP);
InjectHook(0x48E450, RenderMenus, PATCH_JUMP);
InjectHook(0x48D120, DoFade, PATCH_JUMP);
InjectHook(0x48E470, Render2dStuffAfterFade, PATCH_JUMP);
ENDPATCHES

View file

@ -1,31 +1,29 @@
#pragma once
#pragma once
class CRect
{
public:
float left; // x min
float top; // y max
float bottom; // y max
float right; // x max
float bottom; // y min
float top; // y min
CRect(void){
left = 1000000.0f;
bottom = 1000000.0f;
top = 1000000.0f;
right = -1000000.0f;
top = -1000000.0f;
bottom = -1000000.0f;
}
CRect(float l, float b, float r, float t){
CRect(float l, float t, float r, float b){
left = l;
bottom = b;
right = r;
top = t;
right = r;
bottom = b;
}
void ContainPoint(CVector const &v){
if(v.x < left) left = v.x;
if(v.x > right) right = v.x;
if(v.y < bottom) bottom = v.y;
if(v.y > top) top = v.y;
if(v.y < top) top = v.y;
if(v.y > bottom) bottom = v.y;
}
};

View file

@ -101,6 +101,11 @@ inline CVector operator*(const CVector &left, float right)
return CVector(left.x * right, left.y * right, left.z * right);
}
inline CVector operator*(float left, const CVector &right)
{
return CVector(left * right.x, left * right.y, left * right.z);
}
inline CVector operator/(const CVector &left, float right)
{
return CVector(left.x / right, left.y / right, left.z / right);

112
src/re3.cpp Normal file
View file

@ -0,0 +1,112 @@
#include <direct.h>
#include <Windows.h>
#include "common.h"
#include "patcher.h"
#include "Renderer.h"
#include "debugmenu_public.h"
void **rwengine = *(void***)0x5A10E1;
RsGlobalType &RsGlobal = *(RsGlobalType*)0x8F4360;
GlobalScene &Scene = *(GlobalScene*)0x726768;
DebugMenuAPI gDebugMenuAPI;
WRAPPER void *gtanew(uint32 sz) { EAXJMP(0x5A0690); }
WRAPPER void gtadelete(void *p) { EAXJMP(0x5A07E0); }
// overload our own new/delete with GTA's functions
void *operator new(size_t sz) { return gtanew(sz); }
void operator delete(void *ptr) noexcept { gtadelete(ptr); }
// Use our own implementation of rand, stolen from PS2
unsigned __int64 myrand_seed = 1;
int
myrand(void)
{
myrand_seed = 0x5851F42D4C957F2D * myrand_seed + 1;
return ((myrand_seed >> 32) & 0x7FFFFFFF);
}
void
mysrand(unsigned int seed)
{
myrand_seed = seed;
}
// platform stuff
char*
GetUserDirectory(void)
{
static char path[MAX_PATH];
strcpy(path, "userfiles");
mkdir(path);
return path;
}
int (*open_script_orig)(const char *path, const char *mode);
int
open_script(const char *path, const char *mode)
{
if(GetAsyncKeyState('D') & 0x8000)
return open_script_orig("main_d.scm", mode);
// if(GetAsyncKeyState('R') & 0x8000)
return open_script_orig("main_freeroam.scm", mode);
return open_script_orig(path, mode);
}
int gDbgSurf;
int (*RsEventHandler_orig)(int a, int b);
int
delayedPatches10(int a, int b)
{
if(DebugMenuLoad()){
DebugMenuAddVarBool8("Debug", "Show Ped Road Groups", (int8*)&gbShowPedRoadGroups, nil);
DebugMenuAddVarBool8("Debug", "Show Car Road Groups", (int8*)&gbShowCarRoadGroups, nil);
DebugMenuAddVarBool8("Debug", "Show Collision Polys", (int8*)&gbShowCollisionPolys, nil);
DebugMenuAddVarBool8("Debug", "Don't render Buildings", (int8*)&gbDontRenderBuildings, nil);
DebugMenuAddVarBool8("Debug", "Don't render Big Buildings", (int8*)&gbDontRenderBigBuildings, nil);
DebugMenuAddVarBool8("Debug", "Don't render Peds", (int8*)&gbDontRenderPeds, nil);
DebugMenuAddVarBool8("Debug", "Don't render Objects", (int8*)&gbDontRenderObjects, nil);
DebugMenuAddVar("Debug", "Dbg Surface", &gDbgSurf, nil, 1, 0, 34, nil);
}
return RsEventHandler_orig(a, b);
}
void
patch()
{
StaticPatcher::Apply();
Patch<float>(0x46BC61+6, 1.0f); // car distance
InjectHook(0x59E460, printf, PATCH_JUMP);
InterceptCall(&open_script_orig, open_script, 0x438869);
InterceptCall(&RsEventHandler_orig, delayedPatches10, 0x58275E);
}
BOOL WINAPI
DllMain(HINSTANCE hInst, DWORD reason, LPVOID)
{
if(reason == DLL_PROCESS_ATTACH){
AllocConsole();
freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
if (*(DWORD*)0x5C1E75 == 0xB85548EC) // 1.0
patch();
else
return FALSE;
}
return TRUE;
}

View file

@ -1,4 +1,5 @@
#include "common.h"
#include "patcher.h"
#include "Coronas.h"
RwTexture **gpCoronaTexture = (RwTexture**)0x5FAF44; //[9]
@ -8,3 +9,6 @@ float &CCoronas::SunScreenX = *(float*)0x8F4358;
float &CCoronas::SunScreenY = *(float*)0x8F4354;
bool &CCoronas::bSmallMoon = *(bool*)0x95CD49;
bool &CCoronas::SunBlockedByClouds = *(bool*)0x95CD73;
WRAPPER void CCoronas::Render(void) { EAXJMP(0x4F8FB0); }
WRAPPER void CCoronas::RenderReflections(void) { EAXJMP(0x4F9B40); }

View file

@ -10,4 +10,7 @@ public:
static float &SunScreenX;
static bool &bSmallMoon;
static bool &SunBlockedByClouds;
static void Render(void);
static void RenderReflections(void);
};

View file

@ -6,6 +6,11 @@ float &CDraw::ms_fNearClipZ = *(float*)0x8E2DC4;
float &CDraw::ms_fFarClipZ = *(float*)0x9434F0;
float &CDraw::ms_fFOV = *(float*)0x5FBC6C;
uint8 &CDraw::FadeValue = *(uint8*)0x95CD68;
uint8 &CDraw::FadeRed = *(uint8*)0x95CD90;
uint8 &CDraw::FadeGreen = *(uint8*)0x95CD71;
uint8 &CDraw::FadeBlue = *(uint8*)0x95CD53;
static float hFov2vFov(float hfov)
{
float w = SCREENW;

View file

@ -7,6 +7,11 @@ private:
static float &ms_fFarClipZ;
static float &ms_fFOV;
public:
static uint8 &FadeValue;
static uint8 &FadeRed;
static uint8 &FadeGreen;
static uint8 &FadeBlue;
static void SetNearClipZ(float nearclip) { ms_fNearClipZ = nearclip; }
static float GetNearClipZ(void) { return ms_fNearClipZ; }
static void SetFarClipZ(float farclip) { ms_fFarClipZ = farclip; }

5
src/render/Fluff.cpp Normal file
View file

@ -0,0 +1,5 @@
#include "common.h"
#include "patcher.h"
#include "Fluff.h"
WRAPPER void CMovingThings::Render(void) { EAXJMP(0x4FF210); }

7
src/render/Fluff.h Normal file
View file

@ -0,0 +1,7 @@
#pragma once
class CMovingThings
{
public:
static void Render(void);
};

View file

@ -341,22 +341,22 @@ CFont::GetTextRect(CRect *rect, float xstart, float ystart, uint16 *s)
if(Details.backgroundOnlyText){
rect->left = xstart - maxlength/2 - 4.0f;
rect->right = xstart + maxlength/2 + 4.0f;
rect->top = (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * numLines +
rect->bottom = (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * numLines +
ystart + 2.0f;
rect->bottom = ystart - 2.0f;
rect->top = ystart - 2.0f;
}else{
rect->left = xstart - Details.centreSize*0.5f - 4.0f;
rect->right = xstart + Details.centreSize*0.5f + 4.0f;
rect->top = (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * numLines +
rect->bottom = (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * numLines +
ystart + 2.0f;
rect->bottom = ystart - 2.0f;
rect->top = ystart - 2.0f;
}
}else{
rect->left = xstart - 4.0f;
rect->right = Details.wrapX;
// WTF?
rect->top = ystart - 4.0f + 4.0f;
rect->bottom = (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * numLines +
rect->bottom = ystart - 4.0f + 4.0f;
rect->top = (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * numLines +
ystart + 2.0f + 2.0f;
}
}

View file

@ -13,3 +13,5 @@ CGlass::WindowRespondsToSoftCollision(CEntity *ent, float amount)
{
EAXJMP(0x504630);
}
WRAPPER void CGlass::Render(void) { EAXJMP(0x502350); }

View file

@ -7,4 +7,5 @@ class CGlass
public:
static void WindowRespondsToCollision(CEntity *ent, float amount, CVector speed, CVector point, bool foo);
static void WindowRespondsToSoftCollision(CEntity *ent, float amount);
static void Render(void);
};

6
src/render/Hud.cpp Normal file
View file

@ -0,0 +1,6 @@
#include "common.h"
#include "patcher.h"
#include "Hud.h"
WRAPPER void CHud::Draw(void) { EAXJMP(0x5052A0); }
WRAPPER void CHud::DrawAfterFade(void) { EAXJMP(0x509030); }

8
src/render/Hud.h Normal file
View file

@ -0,0 +1,8 @@
#pragma once
class CHud
{
public:
static void Draw(void);
static void DrawAfterFade(void);
};

View file

@ -7,7 +7,7 @@
#include "Coronas.h"
#include "Weather.h"
#include "CullZones.h"
#include "MenuManager.h"
#include "Frontend.h"
RpLight *&pAmbient = *(RpLight**)0x885B6C;
RpLight *&pDirect = *(RpLight**)0x880F7C;

View file

@ -1853,18 +1853,18 @@ void CParticle::AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatr
}
STARTPATCHES
return; // causes crash, out temporarily
//InjectHook(0x50C410, &CParticle::ctor, PATCH_JUMP);
//InjectHook(0x50C420, &CParticle::dtor, PATCH_JUMP);
InjectHook(0x50C430, CParticle::ReloadConfig, PATCH_JUMP);
InjectHook(0x50C570, CParticle::Initialise, PATCH_JUMP);
InjectHook(0x50CF40, CParticle::Shutdown, PATCH_JUMP);
//InjectHook(0x50D140, CParticle::AddParticle, PATCH_JUMP);
InjectHook(0x50D190, (CParticle* (__cdecl *)(tParticleType, CVector const&, CVector const&, CEntity*, float, RwRGBA const&, int, int, int, int))CParticle::AddParticle, PATCH_JUMP);
InjectHook(0x50D190, (CParticle *(*)(tParticleType, CVector const&, CVector const&, CEntity*, float, RwRGBA const&, int, int, int, int))CParticle::AddParticle, PATCH_JUMP);
InjectHook(0x50DCF0, CParticle::Update, PATCH_JUMP);
InjectHook(0x50EE20, CParticle::Render, PATCH_JUMP);
InjectHook(0x50F6E0, CParticle::RemovePSystem, PATCH_JUMP);
InjectHook(0x50F720, CParticle::RemoveParticle, PATCH_JUMP);
InjectHook(0x50F760, CParticle::AddJetExplosion, PATCH_JUMP);
InjectHook(0x50FAA0, CParticle::AddYardieDoorSmoke, PATCH_JUMP);
ENDPATCHES
ENDPATCHES

View file

@ -0,0 +1,5 @@
#include "common.h"
#include "patcher.h"
#include "PointLights.h"
WRAPPER void CPointLights::RenderFogEffect(void) { EAXJMP(0x510C30); }

7
src/render/PointLights.h Normal file
View file

@ -0,0 +1,7 @@
#pragma once
class CPointLights
{
public:
static void RenderFogEffect(void);
};

View file

@ -602,9 +602,9 @@ CRenderer::ScanWorld(void)
if(x1 < 0) x1 = 0;
x2 = CWorld::GetSectorIndexX(rect.right);
if(x2 >= NUMSECTORS_X-1) x2 = NUMSECTORS_X-1;
y1 = CWorld::GetSectorIndexY(rect.bottom);
y1 = CWorld::GetSectorIndexY(rect.top);
if(y1 < 0) y1 = 0;
y2 = CWorld::GetSectorIndexY(rect.top);
y2 = CWorld::GetSectorIndexY(rect.bottom);
if(y2 >= NUMSECTORS_Y-1) y2 = NUMSECTORS_Y-1;
for(; x1 <= x2; x1++)
for(int y = y1; y <= y2; y++)
@ -713,9 +713,9 @@ CRenderer::RequestObjectsInFrustum(void)
if(x1 < 0) x1 = 0;
x2 = CWorld::GetSectorIndexX(rect.right);
if(x2 >= NUMSECTORS_X-1) x2 = NUMSECTORS_X-1;
y1 = CWorld::GetSectorIndexY(rect.bottom);
y1 = CWorld::GetSectorIndexY(rect.top);
if(y1 < 0) y1 = 0;
y2 = CWorld::GetSectorIndexY(rect.top);
y2 = CWorld::GetSectorIndexY(rect.bottom);
if(y2 >= NUMSECTORS_Y-1) y2 = NUMSECTORS_Y-1;
for(; x1 <= x2; x1++)
for(int y = y1; y <= y2; y++)

5
src/render/Rubbish.cpp Normal file
View file

@ -0,0 +1,5 @@
#include "common.h"
#include "patcher.h"
#include "Rubbish.h"
WRAPPER void CRubbish::Render(void) { EAXJMP(0x512190); }

7
src/render/Rubbish.h Normal file
View file

@ -0,0 +1,7 @@
#pragma once
class CRubbish
{
public:
static void Render(void);
};

View file

@ -1,7 +1,11 @@
#include "common.h"
#include "patcher.h"
#include "Shadows.h"
void CShadows::AddPermanentShadow(unsigned char ShadowType, RwTexture* pTexture, CVector* pPosn, float fX1, float fY1, float fX2, float fY2, short nTransparency, unsigned char nRed, unsigned char nGreen, unsigned char nBlue, float fZDistance, unsigned int nTime, float fScale)
{
((void (__cdecl *)(unsigned char, RwTexture*, CVector*, float, float, float, float, short, unsigned char, unsigned char, unsigned char, float, unsigned int, float))0x56EC50)(ShadowType, pTexture, pPosn, fX1, fY1, fX2, fY2, nTransparency, nRed, nGreen, nBlue, fZDistance, nTime, fScale);
}
WRAPPER void CShadows::RenderStaticShadows(void) { EAXJMP(0x5145F0); }
WRAPPER void CShadows::RenderStoredShadows(void) { EAXJMP(0x514010); }

View file

@ -5,5 +5,7 @@ struct RwTexture;
class CShadows
{
public:
static void AddPermanentShadow(unsigned char ShadowType, RwTexture* pTexture, CVector* pPosn, float fX1, float fY1, float fX2, float fY2, short nTransparency, unsigned char nRed, unsigned char nGreen, unsigned char nBlue, float fZDistance, unsigned int nTime, float fScale);
static void AddPermanentShadow(uint8 ShadowType, RwTexture* pTexture, CVector* pPosn, float fX1, float fY1, float fX2, float fY2, short nTransparency, uint8 nRed, uint8 nGreen, uint8 nBlue, float fZDistance, uint32 nTime, float fScale);
static void RenderStaticShadows(void);
static void RenderStoredShadows(void);
};

5
src/render/Skidmarks.cpp Normal file
View file

@ -0,0 +1,5 @@
#include "common.h"
#include "patcher.h"
#include "Skidmarks.h"
WRAPPER void CSkidmarks::Render(void) { EAXJMP(0x5182E0); }

7
src/render/Skidmarks.h Normal file
View file

@ -0,0 +1,7 @@
#pragma once
class CSkidmarks
{
public:
static void Render(void);
};

5
src/render/SpecialFX.cpp Normal file
View file

@ -0,0 +1,5 @@
#include "common.h"
#include "patcher.h"
#include "SpecialFX.h"
WRAPPER void CSpecialFX::Render(void) { EAXJMP(0x518DC0); }

7
src/render/SpecialFX.h Normal file
View file

@ -0,0 +1,7 @@
#pragma once
class CSpecialFX
{
public:
static void Render(void);
};

View file

@ -377,7 +377,7 @@ CSprite::Set6Vertices2D(RwIm2DVertex *verts, const CRect &r, const CRGBA &c0, co
recipz = m_fRecipNearClipPlane;
RwIm2DVertexSetScreenX(&verts[0], r.left);
RwIm2DVertexSetScreenY(&verts[0], r.bottom);
RwIm2DVertexSetScreenY(&verts[0], r.top);
RwIm2DVertexSetScreenZ(&verts[0], screenz);
RwIm2DVertexSetCameraZ(&verts[0], z);
RwIm2DVertexSetRecipCameraZ(&verts[0], recipz);
@ -386,7 +386,7 @@ CSprite::Set6Vertices2D(RwIm2DVertex *verts, const CRect &r, const CRGBA &c0, co
RwIm2DVertexSetV(&verts[0], 0.0f, recipz);
RwIm2DVertexSetScreenX(&verts[1], r.right);
RwIm2DVertexSetScreenY(&verts[1], r.bottom);
RwIm2DVertexSetScreenY(&verts[1], r.top);
RwIm2DVertexSetScreenZ(&verts[1], screenz);
RwIm2DVertexSetCameraZ(&verts[1], z);
RwIm2DVertexSetRecipCameraZ(&verts[1], recipz);
@ -395,7 +395,7 @@ CSprite::Set6Vertices2D(RwIm2DVertex *verts, const CRect &r, const CRGBA &c0, co
RwIm2DVertexSetV(&verts[1], 0.0f, recipz);
RwIm2DVertexSetScreenX(&verts[2], r.right);
RwIm2DVertexSetScreenY(&verts[2], r.top);
RwIm2DVertexSetScreenY(&verts[2], r.bottom);
RwIm2DVertexSetScreenZ(&verts[2], screenz);
RwIm2DVertexSetCameraZ(&verts[2], z);
RwIm2DVertexSetRecipCameraZ(&verts[2], recipz);
@ -404,7 +404,7 @@ CSprite::Set6Vertices2D(RwIm2DVertex *verts, const CRect &r, const CRGBA &c0, co
RwIm2DVertexSetV(&verts[2], 1.0f, recipz);
RwIm2DVertexSetScreenX(&verts[3], r.left);
RwIm2DVertexSetScreenY(&verts[3], r.top);
RwIm2DVertexSetScreenY(&verts[3], r.bottom);
RwIm2DVertexSetScreenZ(&verts[3], screenz);
RwIm2DVertexSetCameraZ(&verts[3], z);
RwIm2DVertexSetRecipCameraZ(&verts[3], recipz);
@ -413,7 +413,7 @@ CSprite::Set6Vertices2D(RwIm2DVertex *verts, const CRect &r, const CRGBA &c0, co
RwIm2DVertexSetV(&verts[3], 1.0f, recipz);
RwIm2DVertexSetScreenX(&verts[4], r.left);
RwIm2DVertexSetScreenY(&verts[4], r.bottom);
RwIm2DVertexSetScreenY(&verts[4], r.top);
RwIm2DVertexSetScreenZ(&verts[4], screenz);
RwIm2DVertexSetCameraZ(&verts[4], z);
RwIm2DVertexSetRecipCameraZ(&verts[4], recipz);
@ -422,7 +422,7 @@ CSprite::Set6Vertices2D(RwIm2DVertex *verts, const CRect &r, const CRGBA &c0, co
RwIm2DVertexSetV(&verts[4], 0.0f, recipz);
RwIm2DVertexSetScreenX(&verts[5], r.right);
RwIm2DVertexSetScreenY(&verts[5], r.top);
RwIm2DVertexSetScreenY(&verts[5], r.bottom);
RwIm2DVertexSetScreenZ(&verts[5], screenz);
RwIm2DVertexSetCameraZ(&verts[5], z);
RwIm2DVertexSetRecipCameraZ(&verts[5], recipz);

View file

@ -174,7 +174,7 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
// | / |
// 3---2
RwIm2DVertexSetScreenX(&maVertices[0], r.left);
RwIm2DVertexSetScreenY(&maVertices[0], r.bottom);
RwIm2DVertexSetScreenY(&maVertices[0], r.top);
RwIm2DVertexSetScreenZ(&maVertices[0], screenz);
RwIm2DVertexSetCameraZ(&maVertices[0], z);
RwIm2DVertexSetRecipCameraZ(&maVertices[0], recipz);
@ -183,7 +183,7 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
RwIm2DVertexSetV(&maVertices[0], 0.0f, recipz);
RwIm2DVertexSetScreenX(&maVertices[1], r.right);
RwIm2DVertexSetScreenY(&maVertices[1], r.bottom);
RwIm2DVertexSetScreenY(&maVertices[1], r.top);
RwIm2DVertexSetScreenZ(&maVertices[1], screenz);
RwIm2DVertexSetCameraZ(&maVertices[1], z);
RwIm2DVertexSetRecipCameraZ(&maVertices[1], recipz);
@ -192,7 +192,7 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
RwIm2DVertexSetV(&maVertices[1], 0.0f, recipz);
RwIm2DVertexSetScreenX(&maVertices[2], r.right);
RwIm2DVertexSetScreenY(&maVertices[2], r.top);
RwIm2DVertexSetScreenY(&maVertices[2], r.bottom);
RwIm2DVertexSetScreenZ(&maVertices[2], screenz);
RwIm2DVertexSetCameraZ(&maVertices[2], z);
RwIm2DVertexSetRecipCameraZ(&maVertices[2], recipz);
@ -201,7 +201,7 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
RwIm2DVertexSetV(&maVertices[2], 1.0f, recipz);
RwIm2DVertexSetScreenX(&maVertices[3], r.left);
RwIm2DVertexSetScreenY(&maVertices[3], r.top);
RwIm2DVertexSetScreenY(&maVertices[3], r.bottom);
RwIm2DVertexSetScreenZ(&maVertices[3], screenz);
RwIm2DVertexSetCameraZ(&maVertices[3], z);
RwIm2DVertexSetRecipCameraZ(&maVertices[3], recipz);
@ -225,7 +225,7 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
// | / |
// 3---2
RwIm2DVertexSetScreenX(&maVertices[0], r.left);
RwIm2DVertexSetScreenY(&maVertices[0], r.bottom);
RwIm2DVertexSetScreenY(&maVertices[0], r.top);
RwIm2DVertexSetScreenZ(&maVertices[0], screenz);
RwIm2DVertexSetCameraZ(&maVertices[0], z);
RwIm2DVertexSetRecipCameraZ(&maVertices[0], recipz);
@ -234,7 +234,7 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
RwIm2DVertexSetV(&maVertices[0], v0, recipz);
RwIm2DVertexSetScreenX(&maVertices[1], r.right);
RwIm2DVertexSetScreenY(&maVertices[1], r.bottom);
RwIm2DVertexSetScreenY(&maVertices[1], r.top);
RwIm2DVertexSetScreenZ(&maVertices[1], screenz);
RwIm2DVertexSetCameraZ(&maVertices[1], z);
RwIm2DVertexSetRecipCameraZ(&maVertices[1], recipz);
@ -243,7 +243,7 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
RwIm2DVertexSetV(&maVertices[1], v1, recipz);
RwIm2DVertexSetScreenX(&maVertices[2], r.right);
RwIm2DVertexSetScreenY(&maVertices[2], r.top);
RwIm2DVertexSetScreenY(&maVertices[2], r.bottom);
RwIm2DVertexSetScreenZ(&maVertices[2], screenz);
RwIm2DVertexSetCameraZ(&maVertices[2], z);
RwIm2DVertexSetRecipCameraZ(&maVertices[2], recipz);
@ -252,7 +252,7 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
RwIm2DVertexSetV(&maVertices[2], v2, recipz);
RwIm2DVertexSetScreenX(&maVertices[3], r.left);
RwIm2DVertexSetScreenY(&maVertices[3], r.top);
RwIm2DVertexSetScreenY(&maVertices[3], r.bottom);
RwIm2DVertexSetScreenZ(&maVertices[3], screenz);
RwIm2DVertexSetCameraZ(&maVertices[3], z);
RwIm2DVertexSetRecipCameraZ(&maVertices[3], recipz);
@ -358,7 +358,7 @@ CSprite2d::SetVertices(RwIm2DVertex *verts, const CRect &r, const CRGBA &c0, con
recipz = RecipNearClip;
RwIm2DVertexSetScreenX(&verts[0], r.left);
RwIm2DVertexSetScreenY(&verts[0], r.bottom);
RwIm2DVertexSetScreenY(&verts[0], r.top);
RwIm2DVertexSetScreenZ(&verts[0], screenz);
RwIm2DVertexSetCameraZ(&verts[0], z);
RwIm2DVertexSetRecipCameraZ(&verts[0], recipz);
@ -367,7 +367,7 @@ CSprite2d::SetVertices(RwIm2DVertex *verts, const CRect &r, const CRGBA &c0, con
RwIm2DVertexSetV(&verts[0], v0, recipz);
RwIm2DVertexSetScreenX(&verts[1], r.left);
RwIm2DVertexSetScreenY(&verts[1], r.top);
RwIm2DVertexSetScreenY(&verts[1], r.bottom);
RwIm2DVertexSetScreenZ(&verts[1], screenz);
RwIm2DVertexSetCameraZ(&verts[1], z);
RwIm2DVertexSetRecipCameraZ(&verts[1], recipz);
@ -376,7 +376,7 @@ CSprite2d::SetVertices(RwIm2DVertex *verts, const CRect &r, const CRGBA &c0, con
RwIm2DVertexSetV(&verts[1], v2, recipz);
RwIm2DVertexSetScreenX(&verts[2], r.right);
RwIm2DVertexSetScreenY(&verts[2], r.top);
RwIm2DVertexSetScreenY(&verts[2], r.bottom);
RwIm2DVertexSetScreenZ(&verts[2], screenz);
RwIm2DVertexSetCameraZ(&verts[2], z);
RwIm2DVertexSetRecipCameraZ(&verts[2], recipz);
@ -385,7 +385,7 @@ CSprite2d::SetVertices(RwIm2DVertex *verts, const CRect &r, const CRGBA &c0, con
RwIm2DVertexSetV(&verts[2], v3, recipz);
RwIm2DVertexSetScreenX(&verts[3], r.left);
RwIm2DVertexSetScreenY(&verts[3], r.bottom);
RwIm2DVertexSetScreenY(&verts[3], r.top);
RwIm2DVertexSetScreenZ(&verts[3], screenz);
RwIm2DVertexSetCameraZ(&verts[3], z);
RwIm2DVertexSetRecipCameraZ(&verts[3], recipz);
@ -394,7 +394,7 @@ CSprite2d::SetVertices(RwIm2DVertex *verts, const CRect &r, const CRGBA &c0, con
RwIm2DVertexSetV(&verts[3], v0, recipz);
RwIm2DVertexSetScreenX(&verts[4], r.right);
RwIm2DVertexSetScreenY(&verts[4], r.top);
RwIm2DVertexSetScreenY(&verts[4], r.bottom);
RwIm2DVertexSetScreenZ(&verts[4], screenz);
RwIm2DVertexSetCameraZ(&verts[4], z);
RwIm2DVertexSetRecipCameraZ(&verts[4], recipz);
@ -403,7 +403,7 @@ CSprite2d::SetVertices(RwIm2DVertex *verts, const CRect &r, const CRGBA &c0, con
RwIm2DVertexSetV(&verts[4], v3, recipz);
RwIm2DVertexSetScreenX(&verts[5], r.right);
RwIm2DVertexSetScreenY(&verts[5], r.bottom);
RwIm2DVertexSetScreenY(&verts[5], r.top);
RwIm2DVertexSetScreenZ(&verts[5], screenz);
RwIm2DVertexSetCameraZ(&verts[5], z);
RwIm2DVertexSetRecipCameraZ(&verts[5], recipz);

View file

@ -0,0 +1,5 @@
#include "common.h"
#include "patcher.h"
#include "WaterCannon.h"
WRAPPER void CWaterCannons::Render(void) { EAXJMP(0x522550); }

7
src/render/WaterCannon.h Normal file
View file

@ -0,0 +1,7 @@
#pragma once
class CWaterCannons
{
public:
static void Render(void);
};

View file

@ -0,0 +1,5 @@
#include "common.h"
#include "patcher.h"
#include "WaterLevel.h"
WRAPPER void CWaterLevel::RenderWater(void) { EAXJMP(0x5554E0); }

7
src/render/WaterLevel.h Normal file
View file

@ -0,0 +1,7 @@
#pragma once
class CWaterLevel
{
public:
static void RenderWater(void);
};

View file

@ -0,0 +1,5 @@
#include "common.h"
#include "patcher.h"
#include "WeaponEffects.h"
WRAPPER void CWeaponEffects::Render(void) { EAXJMP(0x564D70); }

View file

@ -0,0 +1,7 @@
#pragma once
class CWeaponEffects
{
public:
static void Render(void);
};