From 6c693e3bbfe46cb445e4664eb91ef85c811a6240 Mon Sep 17 00:00:00 2001 From: _AG Date: Tue, 2 Jul 2019 13:59:19 +0200 Subject: Implemented frontend inputs. Fixed #66 and few other stuff. --- src/render/Draw.cpp | 65 +++++++++++++++++++++++++++++++++++++---------------- src/render/Draw.h | 12 ++++++++++ src/render/Hud.cpp | 18 +++++++++++++-- 3 files changed, 74 insertions(+), 21 deletions(-) (limited to 'src/render') diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp index 90875299..f1b2147f 100644 --- a/src/render/Draw.cpp +++ b/src/render/Draw.cpp @@ -16,43 +16,70 @@ uint8 &CDraw::FadeRed = *(uint8*)0x95CD90; uint8 &CDraw::FadeGreen = *(uint8*)0x95CD71; uint8 &CDraw::FadeBlue = *(uint8*)0x95CD53; -void -CDraw::CalculateAspectRatio() +void CDraw::CalculateAspectRatio() { SetScreenMult(DEFAULT_SCALE); - if(FrontEndMenuManager.m_PrefsUseWideScreen) - ms_fAspectRatio = 16.0f/9.0f; +#ifndef HOR_PLUS + if (FrontEndMenuManager.m_PrefsUseWideScreen) + ms_fAspectRatio = 16.0f / 9.0f; else - ms_fAspectRatio = 4.0f/3.0f; + ms_fAspectRatio = 4.0f / 3.0f; +#else + switch (FrontEndMenuManager.m_PrefsUseWideScreen) { + case AR_AUTO: + ms_fAspectRatio = (float)SCREEN_WIDTH / (float)SCREEN_HEIGHT; + return; + case AR_3_2: + ms_fAspectRatio = 3.0f / 2.0f; + return; + case AR_4_3: + ms_fAspectRatio = 4.0f / 3.0f; + return; + case AR_5_3: + ms_fAspectRatio = 5.0f / 3.0f; + return; + case AR_5_4: + ms_fAspectRatio = 5.0f / 4.0f; + return; + case AR_15_9: + ms_fAspectRatio = 15.0f / 9.0f; + return; + case AR_16_9: + ms_fAspectRatio = 16.0f / 9.0f; + return; + case AR_16_10: + ms_fAspectRatio = 16.0f / 10.0f; + return; + case AR_64_27: + ms_fAspectRatio = 64.0f / 27.0f; + return; + }; + +#endif } -static float hFov2vFov(float hfov) +float +HorToVert(float hfov) { - float w = SCREENW; - float h = SCREENH; - - // => tan(hFOV/2) = tan(vFOV/2)*aspectRatio - // => tan(vFOV/2) = tan(hFOV/2)/aspectRatio - float ar1 = 4.0/3.0; - float ar2 = w/h; - hfov = DEGTORAD(hfov); - float vfov = atan(tan(hfov/2) / ar1) *2; - hfov = atan(tan(vfov/2) * ar2) *2; - return RADTODEG(hfov); + float vfov = atan(tan(DEGTORAD(hfov) / 2) / (4.0 / 3.0)) * 2; + return RADTODEG(hfov = atan(tan(vfov / 2) * CDraw::GetAspectRatio()) * 2); } void CDraw::SetFOV(float fov) { -// TODO: fix FOV here or somewhere else? -// ms_fFOV = hFov2vFov(fov); +#ifndef HOR_PLUS ms_fFOV = fov; +#else + ms_fFOV = HorToVert(fov); +#endif } STARTPATCHES InjectHook(0x4FE7B0, CDraw::SetFOV, PATCH_JUMP); + // Some patches to fix aiming offset on "CCamera::Find3rdPersonCamTargetVector". Nop(0x46B618, 2); Patch(0x5F0A64, 1.3333334f); ENDPATCHES diff --git a/src/render/Draw.h b/src/render/Draw.h index 1fcb5212..9e334d02 100644 --- a/src/render/Draw.h +++ b/src/render/Draw.h @@ -3,6 +3,18 @@ #define HUD_SCALE 0.8f #define DEFAULT_SCALE 1.0f +enum eAspectRatio { + AR_AUTO, + AR_3_2, + AR_4_3, + AR_5_3, + AR_5_4, + AR_15_9, + AR_16_9, + AR_16_10, + AR_64_27, +}; + class CDraw { private: diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 2547ab2b..4b6094f1 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -125,6 +125,15 @@ WRAPPER void CHud::Draw(void) { EAXJMP(0x5052A0); } #else void CHud::Draw() { + RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE); + RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); + RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); + RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); + RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSMIRROR); + RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)FALSE); + RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT); + RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR); + if (CReplay::IsPlayingBack()) return; @@ -168,6 +177,7 @@ void CHud::Draw() float fMultBright = SpriteBrightness * 0.03f * (0.25f * fStep + 0.75f); CRect rect; +#ifndef HOR_PLUS float fWidescreenOffset[2] = { 0.0f, 0.0f }; if (FrontEndMenuManager.m_PrefsUseWideScreen) { @@ -178,7 +188,11 @@ void CHud::Draw() if (Mode_RunAround && TheCamera.Cams->Using3rdPersonMouseCam()) { float f3rdX = SCREENW * TheCamera.m_f3rdPersonCHairMultX + fWidescreenOffset[0]; float f3rdY = SCREENH * TheCamera.m_f3rdPersonCHairMultY - fWidescreenOffset[1]; - +#else + if (Mode_RunAround && TheCamera.Cams->Using3rdPersonMouseCam()) { + float f3rdX = (((TheCamera.m_f3rdPersonCHairMultX - 0.5f) / ((CDraw::GetAspectRatio()) / (4.0f / 3.0f))) + 0.5f) * SCREENW; + float f3rdY = SCREENH * TheCamera.m_f3rdPersonCHairMultY; +#endif if (CWorld::Players[CWorld::PlayerInFocus].m_pPed && WeaponType == WEAPONTYPE_M16) { rect.left = f3rdX - SCREEN_SCALE_X(32.0f * 0.6f); rect.top = f3rdY - SCREEN_SCALE_Y(32.0f * 0.6f); @@ -1443,7 +1457,7 @@ STARTPATCHES InjectHook(0x5048F0, &CHud::Initialise, PATCH_JUMP); InjectHook(0x504CC0, &CHud::ReInitialise, PATCH_JUMP); InjectHook(0x50A250, &CHud::SetBigMessage, PATCH_JUMP); - InjectHook(0x5051E0, &CHud::SetHelpMessage, PATCH_JUMP); + //InjectHook(0x5051E0, &CHud::SetHelpMessage, PATCH_JUMP); InjectHook(0x50A210, &CHud::SetMessage, PATCH_JUMP); InjectHook(0x50A320, &CHud::SetPagerMessage, PATCH_JUMP); InjectHook(0x505290, &CHud::SetVehicleName, PATCH_JUMP); -- cgit v1.2.3 From e8215cf560318fdd77817cea485af50fca827552 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 2 Jul 2019 22:05:11 +0200 Subject: Revert "Implemented frontend inputs." --- src/render/Draw.cpp | 65 ++++++++++++++++------------------------------------- src/render/Draw.h | 12 ---------- src/render/Hud.cpp | 18 ++------------- 3 files changed, 21 insertions(+), 74 deletions(-) (limited to 'src/render') diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp index f1b2147f..90875299 100644 --- a/src/render/Draw.cpp +++ b/src/render/Draw.cpp @@ -16,70 +16,43 @@ uint8 &CDraw::FadeRed = *(uint8*)0x95CD90; uint8 &CDraw::FadeGreen = *(uint8*)0x95CD71; uint8 &CDraw::FadeBlue = *(uint8*)0x95CD53; -void CDraw::CalculateAspectRatio() +void +CDraw::CalculateAspectRatio() { SetScreenMult(DEFAULT_SCALE); -#ifndef HOR_PLUS - if (FrontEndMenuManager.m_PrefsUseWideScreen) - ms_fAspectRatio = 16.0f / 9.0f; + if(FrontEndMenuManager.m_PrefsUseWideScreen) + ms_fAspectRatio = 16.0f/9.0f; else - ms_fAspectRatio = 4.0f / 3.0f; -#else - switch (FrontEndMenuManager.m_PrefsUseWideScreen) { - case AR_AUTO: - ms_fAspectRatio = (float)SCREEN_WIDTH / (float)SCREEN_HEIGHT; - return; - case AR_3_2: - ms_fAspectRatio = 3.0f / 2.0f; - return; - case AR_4_3: - ms_fAspectRatio = 4.0f / 3.0f; - return; - case AR_5_3: - ms_fAspectRatio = 5.0f / 3.0f; - return; - case AR_5_4: - ms_fAspectRatio = 5.0f / 4.0f; - return; - case AR_15_9: - ms_fAspectRatio = 15.0f / 9.0f; - return; - case AR_16_9: - ms_fAspectRatio = 16.0f / 9.0f; - return; - case AR_16_10: - ms_fAspectRatio = 16.0f / 10.0f; - return; - case AR_64_27: - ms_fAspectRatio = 64.0f / 27.0f; - return; - }; - -#endif + ms_fAspectRatio = 4.0f/3.0f; } -float -HorToVert(float hfov) +static float hFov2vFov(float hfov) { - float vfov = atan(tan(DEGTORAD(hfov) / 2) / (4.0 / 3.0)) * 2; - return RADTODEG(hfov = atan(tan(vfov / 2) * CDraw::GetAspectRatio()) * 2); + float w = SCREENW; + float h = SCREENH; + + // => tan(hFOV/2) = tan(vFOV/2)*aspectRatio + // => tan(vFOV/2) = tan(hFOV/2)/aspectRatio + float ar1 = 4.0/3.0; + float ar2 = w/h; + hfov = DEGTORAD(hfov); + float vfov = atan(tan(hfov/2) / ar1) *2; + hfov = atan(tan(vfov/2) * ar2) *2; + return RADTODEG(hfov); } void CDraw::SetFOV(float fov) { -#ifndef HOR_PLUS +// TODO: fix FOV here or somewhere else? +// ms_fFOV = hFov2vFov(fov); ms_fFOV = fov; -#else - ms_fFOV = HorToVert(fov); -#endif } STARTPATCHES InjectHook(0x4FE7B0, CDraw::SetFOV, PATCH_JUMP); - // Some patches to fix aiming offset on "CCamera::Find3rdPersonCamTargetVector". Nop(0x46B618, 2); Patch(0x5F0A64, 1.3333334f); ENDPATCHES diff --git a/src/render/Draw.h b/src/render/Draw.h index 9e334d02..1fcb5212 100644 --- a/src/render/Draw.h +++ b/src/render/Draw.h @@ -3,18 +3,6 @@ #define HUD_SCALE 0.8f #define DEFAULT_SCALE 1.0f -enum eAspectRatio { - AR_AUTO, - AR_3_2, - AR_4_3, - AR_5_3, - AR_5_4, - AR_15_9, - AR_16_9, - AR_16_10, - AR_64_27, -}; - class CDraw { private: diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 4b6094f1..2547ab2b 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -125,15 +125,6 @@ WRAPPER void CHud::Draw(void) { EAXJMP(0x5052A0); } #else void CHud::Draw() { - RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE); - RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); - RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); - RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); - RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSMIRROR); - RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)FALSE); - RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT); - RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR); - if (CReplay::IsPlayingBack()) return; @@ -177,7 +168,6 @@ void CHud::Draw() float fMultBright = SpriteBrightness * 0.03f * (0.25f * fStep + 0.75f); CRect rect; -#ifndef HOR_PLUS float fWidescreenOffset[2] = { 0.0f, 0.0f }; if (FrontEndMenuManager.m_PrefsUseWideScreen) { @@ -188,11 +178,7 @@ void CHud::Draw() if (Mode_RunAround && TheCamera.Cams->Using3rdPersonMouseCam()) { float f3rdX = SCREENW * TheCamera.m_f3rdPersonCHairMultX + fWidescreenOffset[0]; float f3rdY = SCREENH * TheCamera.m_f3rdPersonCHairMultY - fWidescreenOffset[1]; -#else - if (Mode_RunAround && TheCamera.Cams->Using3rdPersonMouseCam()) { - float f3rdX = (((TheCamera.m_f3rdPersonCHairMultX - 0.5f) / ((CDraw::GetAspectRatio()) / (4.0f / 3.0f))) + 0.5f) * SCREENW; - float f3rdY = SCREENH * TheCamera.m_f3rdPersonCHairMultY; -#endif + if (CWorld::Players[CWorld::PlayerInFocus].m_pPed && WeaponType == WEAPONTYPE_M16) { rect.left = f3rdX - SCREEN_SCALE_X(32.0f * 0.6f); rect.top = f3rdY - SCREEN_SCALE_Y(32.0f * 0.6f); @@ -1457,7 +1443,7 @@ STARTPATCHES InjectHook(0x5048F0, &CHud::Initialise, PATCH_JUMP); InjectHook(0x504CC0, &CHud::ReInitialise, PATCH_JUMP); InjectHook(0x50A250, &CHud::SetBigMessage, PATCH_JUMP); - //InjectHook(0x5051E0, &CHud::SetHelpMessage, PATCH_JUMP); + InjectHook(0x5051E0, &CHud::SetHelpMessage, PATCH_JUMP); InjectHook(0x50A210, &CHud::SetMessage, PATCH_JUMP); InjectHook(0x50A320, &CHud::SetPagerMessage, PATCH_JUMP); InjectHook(0x505290, &CHud::SetVehicleName, PATCH_JUMP); -- cgit v1.2.3 From 25865e68c4c87cfe3cf63c8721f3d0ec8dfca35c Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 3 Jul 2019 13:13:55 +0200 Subject: cleaned up to be closer to original game --- src/render/Draw.cpp | 34 +++++++++++++------------- src/render/Draw.h | 20 ++++++++++------ src/render/Hud.cpp | 4 ++-- src/render/Sprite.cpp | 66 +++++++++++++++++++++++++-------------------------- 4 files changed, 66 insertions(+), 58 deletions(-) (limited to 'src/render') diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp index 90875299..922d96d4 100644 --- a/src/render/Draw.cpp +++ b/src/render/Draw.cpp @@ -4,8 +4,9 @@ #include "Frontend.h" #include "Camera.h" -float CDraw::ms_fAspectRatio; -float CDraw::ms_fScreenMultiplier; +#ifdef ASPECT_RATIO_SCALE +float CDraw::ms_fAspectRatio = DEFAULT_ASPECT_RATIO; +#endif float &CDraw::ms_fNearClipZ = *(float*)0x8E2DC4; float &CDraw::ms_fFarClipZ = *(float*)0x9434F0; @@ -16,26 +17,25 @@ uint8 &CDraw::FadeRed = *(uint8*)0x95CD90; uint8 &CDraw::FadeGreen = *(uint8*)0x95CD71; uint8 &CDraw::FadeBlue = *(uint8*)0x95CD53; -void -CDraw::CalculateAspectRatio() +float +CDraw::FindAspectRatio(void) { - SetScreenMult(DEFAULT_SCALE); - if(FrontEndMenuManager.m_PrefsUseWideScreen) - ms_fAspectRatio = 16.0f/9.0f; + return 16.0f/9.0f; else - ms_fAspectRatio = 4.0f/3.0f; + return 4.0f/3.0f; } -static float hFov2vFov(float hfov) +// convert a 4:3 hFOV to vFOV, +// then convert that vFOV to hFOV for our aspect ratio, +// i.e. HOR+ +float +CDraw::ConvertFOV(float hfov) { - float w = SCREENW; - float h = SCREENH; - // => tan(hFOV/2) = tan(vFOV/2)*aspectRatio // => tan(vFOV/2) = tan(hFOV/2)/aspectRatio - float ar1 = 4.0/3.0; - float ar2 = w/h; + float ar1 = DEFAULT_ASPECT_RATIO; + float ar2 = GetAspectRatio(); hfov = DEGTORAD(hfov); float vfov = atan(tan(hfov/2) / ar1) *2; hfov = atan(tan(vfov/2) * ar2) *2; @@ -45,9 +45,11 @@ static float hFov2vFov(float hfov) void CDraw::SetFOV(float fov) { -// TODO: fix FOV here or somewhere else? -// ms_fFOV = hFov2vFov(fov); +#ifdef ASPECT_RATIO_SCALE + ms_fFOV = ConvertFOV(fov); +#else ms_fFOV = fov; +#endif } STARTPATCHES diff --git a/src/render/Draw.h b/src/render/Draw.h index 1fcb5212..3349c6c9 100644 --- a/src/render/Draw.h +++ b/src/render/Draw.h @@ -1,16 +1,18 @@ #pragma once -#define HUD_SCALE 0.8f -#define DEFAULT_SCALE 1.0f - class CDraw { private: static float &ms_fNearClipZ; static float &ms_fFarClipZ; static float &ms_fFOV; + static float ms_fLODDistance; // unused + +#ifdef ASPECT_RATIO_SCALE + // we use this variable to scale a lot of 2D elements + // so better cache it static float ms_fAspectRatio; - static float ms_fScreenMultiplier; +#endif public: static uint8 &FadeValue; @@ -26,8 +28,12 @@ public: static void SetFOV(float fov); static float GetFOV(void) { return ms_fFOV; } - static void CalculateAspectRatio(); + static float FindAspectRatio(void); +#ifdef ASPECT_RATIO_SCALE + static float ConvertFOV(float fov); static float GetAspectRatio(void) { return ms_fAspectRatio; } - static void SetScreenMult(float mult) { ms_fScreenMultiplier = mult; }; - static float GetScreenMult(void) { return ms_fScreenMultiplier; }; + static void SetAspectRatio(float ratio) { ms_fAspectRatio = ratio; } +#else + static float GetAspectRatio(void) { return FindAspectRatio(); } +#endif }; diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 2547ab2b..e5a44221 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -787,8 +787,8 @@ void CHud::Draw() if (m_ItemToFlash == ITEM_RADAR && CTimer::GetFrameCounter() & 8 || m_ItemToFlash != ITEM_RADAR) { CRadar::DrawMap(); CRect rect(0.0f, 0.0f, SCREEN_SCALE_X(RADAR_WIDTH), SCREEN_SCALE_Y(RADAR_HEIGHT)); - // FIX: game doesn't scale RADAR_LEFT here - rect.Translate(SCREEN_SCALE_X(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT)); + // FIX? scale RADAR_LEFT here somehow + rect.Translate(RADAR_LEFT, SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT)); rect.Grow(4.0f); Sprites[HUD_RADARDISC].Draw(rect, CRGBA(0, 0, 0, 255)); CRadar::DrawBlips(); diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp index 57a8a22f..d917117a 100644 --- a/src/render/Sprite.cpp +++ b/src/render/Sprite.cpp @@ -16,7 +16,7 @@ CSprite::CalcHorizonCoors(void) CVector p = TheCamera.GetPosition() + CVector(TheCamera.CamFrontXNorm, TheCamera.CamFrontYNorm, 0.0f)*3000.0f; p.z = 0.0f; p = TheCamera.m_viewMatrix * p; - return p.y * RsGlobal.maximumHeight / p.z; + return p.y * SCREEN_HEIGHT / p.z; } bool @@ -27,13 +27,13 @@ CSprite::CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh, if(out->z <= CDraw::GetNearClipZ() + 1.0f) return false; if(out->z >= CDraw::GetFarClipZ() && farclip) return false; float recip = 1.0f/out->z; - out->x *= RsGlobal.maximumWidth * recip; - out->y *= RsGlobal.maximumHeight * recip; + out->x *= SCREEN_WIDTH * recip; + out->y *= SCREEN_HEIGHT * recip; // What is this? size? *outw = 70.0f/CDraw::GetFOV(); *outh = 70.0f/CDraw::GetFOV(); - *outw *= RsGlobal.maximumWidth * recip; - *outh *= RsGlobal.maximumHeight * recip; + *outw *= SCREEN_WIDTH * recip; + *outh *= SCREEN_HEIGHT * recip; return true; } @@ -99,17 +99,17 @@ CSprite::RenderOneXLUSprite(float x, float y, float z, float w, float h, uint8 r us[i] = -xs[i] / (2.0f*w); xs[i] = 0.0f; } - if(xs[i] > RsGlobal.maximumWidth){ - us[i] = 1.0f - (xs[i]-RsGlobal.maximumWidth) / (2.0f*w); - xs[i] = RsGlobal.maximumWidth; + if(xs[i] > SCREEN_WIDTH){ + us[i] = 1.0f - (xs[i]-SCREEN_WIDTH) / (2.0f*w); + xs[i] = SCREEN_WIDTH; } if(ys[i] < 0.0f){ vs[i] = -ys[i] / (2.0f*h); ys[i] = 0.0f; } - if(ys[i] > RsGlobal.maximumHeight){ - vs[i] = 1.0f - (ys[i]-RsGlobal.maximumHeight) / (2.0f*h); - ys[i] = RsGlobal.maximumHeight; + if(ys[i] > SCREEN_HEIGHT){ + vs[i] = 1.0f - (ys[i]-SCREEN_HEIGHT) / (2.0f*h); + ys[i] = SCREEN_HEIGHT; } } @@ -169,10 +169,10 @@ CSprite::RenderOneXLUSprite_Rotate_Aspect(float x, float y, float z, float w, fl // No clipping, just culling if(xs[0] < 0.0f && xs[1] < 0.0f && xs[2] < 0.0f && xs[3] < 0.0f) return; if(ys[0] < 0.0f && ys[1] < 0.0f && ys[2] < 0.0f && ys[3] < 0.0f) return; - if(xs[0] > RsGlobal.maximumWidth && xs[1] > RsGlobal.maximumWidth && - xs[2] > RsGlobal.maximumWidth && xs[3] > RsGlobal.maximumWidth) return; - if(ys[0] > RsGlobal.maximumHeight && ys[1] > RsGlobal.maximumHeight && - ys[2] > RsGlobal.maximumHeight && ys[3] > RsGlobal.maximumHeight) return; + if(xs[0] > SCREEN_WIDTH && xs[1] > SCREEN_WIDTH && + xs[2] > SCREEN_WIDTH && xs[3] > SCREEN_WIDTH) return; + if(ys[0] > SCREEN_HEIGHT && ys[1] > SCREEN_HEIGHT && + ys[2] > SCREEN_HEIGHT && ys[3] > SCREEN_HEIGHT) return; float screenz = m_f2DNearScreenZ + (z-CDraw::GetNearClipZ())*(m_f2DFarScreenZ-m_f2DNearScreenZ)*CDraw::GetFarClipZ() / @@ -221,17 +221,17 @@ CSprite::RenderBufferedOneXLUSprite(float x, float y, float z, float w, float h, us[i] = -xs[i] / (2.0f*w); xs[i] = 0.0f; } - if(xs[i] > RsGlobal.maximumWidth){ - us[i] = 1.0f - (xs[i]-RsGlobal.maximumWidth) / (2.0f*w); - xs[i] = RsGlobal.maximumWidth; + if(xs[i] > SCREEN_WIDTH){ + us[i] = 1.0f - (xs[i]-SCREEN_WIDTH) / (2.0f*w); + xs[i] = SCREEN_WIDTH; } if(ys[i] < 0.0f){ vs[i] = -ys[i] / (2.0f*h); ys[i] = 0.0f; } - if(ys[i] > RsGlobal.maximumHeight){ - vs[i] = 1.0f - (ys[i]-RsGlobal.maximumHeight) / (2.0f*h); - ys[i] = RsGlobal.maximumHeight; + if(ys[i] > SCREEN_HEIGHT){ + vs[i] = 1.0f - (ys[i]-SCREEN_HEIGHT) / (2.0f*h); + ys[i] = SCREEN_HEIGHT; } } @@ -283,10 +283,10 @@ CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(float x, float y, float z, // No clipping, just culling if(xs[0] < 0.0f && xs[1] < 0.0f && xs[2] < 0.0f && xs[3] < 0.0f) return; if(ys[0] < 0.0f && ys[1] < 0.0f && ys[2] < 0.0f && ys[3] < 0.0f) return; - if(xs[0] > RsGlobal.maximumWidth && xs[1] > RsGlobal.maximumWidth && - xs[2] > RsGlobal.maximumWidth && xs[3] > RsGlobal.maximumWidth) return; - if(ys[0] > RsGlobal.maximumHeight && ys[1] > RsGlobal.maximumHeight && - ys[2] > RsGlobal.maximumHeight && ys[3] > RsGlobal.maximumHeight) return; + if(xs[0] > SCREEN_WIDTH && xs[1] > SCREEN_WIDTH && + xs[2] > SCREEN_WIDTH && xs[3] > SCREEN_WIDTH) return; + if(ys[0] > SCREEN_HEIGHT && ys[1] > SCREEN_HEIGHT && + ys[2] > SCREEN_HEIGHT && ys[3] > SCREEN_HEIGHT) return; float screenz = m_f2DNearScreenZ + (z-CDraw::GetNearClipZ())*(m_f2DFarScreenZ-m_f2DNearScreenZ)*CDraw::GetFarClipZ() / @@ -335,10 +335,10 @@ CSprite::RenderBufferedOneXLUSprite_Rotate_Aspect(float x, float y, float z, flo // No clipping, just culling if(xs[0] < 0.0f && xs[1] < 0.0f && xs[2] < 0.0f && xs[3] < 0.0f) return; if(ys[0] < 0.0f && ys[1] < 0.0f && ys[2] < 0.0f && ys[3] < 0.0f) return; - if(xs[0] > RsGlobal.maximumWidth && xs[1] > RsGlobal.maximumWidth && - xs[2] > RsGlobal.maximumWidth && xs[3] > RsGlobal.maximumWidth) return; - if(ys[0] > RsGlobal.maximumHeight && ys[1] > RsGlobal.maximumHeight && - ys[2] > RsGlobal.maximumHeight && ys[3] > RsGlobal.maximumHeight) return; + if(xs[0] > SCREEN_WIDTH && xs[1] > SCREEN_WIDTH && + xs[2] > SCREEN_WIDTH && xs[3] > SCREEN_WIDTH) return; + if(ys[0] > SCREEN_HEIGHT && ys[1] > SCREEN_HEIGHT && + ys[2] > SCREEN_HEIGHT && ys[3] > SCREEN_HEIGHT) return; float screenz = m_f2DNearScreenZ + (z-CDraw::GetNearClipZ())*(m_f2DFarScreenZ-m_f2DNearScreenZ)*CDraw::GetFarClipZ() / @@ -388,10 +388,10 @@ CSprite::RenderBufferedOneXLUSprite_Rotate_2Colours(float x, float y, float z, f // No clipping, just culling if(xs[0] < 0.0f && xs[1] < 0.0f && xs[2] < 0.0f && xs[3] < 0.0f) return; if(ys[0] < 0.0f && ys[1] < 0.0f && ys[2] < 0.0f && ys[3] < 0.0f) return; - if(xs[0] > RsGlobal.maximumWidth && xs[1] > RsGlobal.maximumWidth && - xs[2] > RsGlobal.maximumWidth && xs[3] > RsGlobal.maximumWidth) return; - if(ys[0] > RsGlobal.maximumHeight && ys[1] > RsGlobal.maximumHeight && - ys[2] > RsGlobal.maximumHeight && ys[3] > RsGlobal.maximumHeight) return; + if(xs[0] > SCREEN_WIDTH && xs[1] > SCREEN_WIDTH && + xs[2] > SCREEN_WIDTH && xs[3] > SCREEN_WIDTH) return; + if(ys[0] > SCREEN_HEIGHT && ys[1] > SCREEN_HEIGHT && + ys[2] > SCREEN_HEIGHT && ys[3] > SCREEN_HEIGHT) return; // Colour factors, cx/y is the direction in which colours change from rgb1 to rgb2 cf[0] = (cx*(-c-s) + cy*(-c+s))*0.5f + 0.5f; -- cgit v1.2.3 From 936a8e83517fb05c34bca673140172dfa624d7b1 Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 3 Jul 2019 14:06:26 +0200 Subject: fixed boat rendering --- src/render/Renderer.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/render') diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index d8b0bbe6..405b9bb2 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -222,16 +222,16 @@ CRenderer::RenderEverythingBarRoads(void) if(e->IsVehicle() || e->IsPed() && CVisibilityPlugins::GetClumpAlpha((RpClump*)e->m_rwObject) != 255){ if(e->IsVehicle() && ((CVehicle*)e)->IsBoat()){ + ei.ent = e; + dist = ms_vecCameraPosition - e->GetPosition(); + ei.sort = dist.MagnitudeSqr(); + gSortedVehiclesAndPeds.InsertSorted(ei); + }else{ dist = ms_vecCameraPosition - e->GetPosition(); if(!CVisibilityPlugins::InsertEntityIntoSortedList(e, dist.Magnitude())){ printf("Ran out of space in alpha entity list"); RenderOneNonRoad(e); } - }else{ - ei.ent = e; - dist = ms_vecCameraPosition - e->GetPosition(); - ei.sort = dist.MagnitudeSqr(); - gSortedVehiclesAndPeds.InsertSorted(ei); } }else RenderOneNonRoad(e); @@ -241,15 +241,17 @@ CRenderer::RenderEverythingBarRoads(void) void CRenderer::RenderVehiclesButNotBoats(void) { + // This function doesn't do anything + // because only boats are inserted into the list CLink *node; for(node = gSortedVehiclesAndPeds.tail.prev; node != &gSortedVehiclesAndPeds.head; node = node->prev){ + // only boats in this list CVehicle *v = (CVehicle*)node->item.ent; - if(v->IsVehicle() && v->IsBoat()) // BUG: IsVehicle missing in III - continue; - RenderOneNonRoad(v); + if(!v->IsBoat()) + RenderOneNonRoad(v); } } @@ -261,8 +263,9 @@ CRenderer::RenderBoats(void) for(node = gSortedVehiclesAndPeds.tail.prev; node != &gSortedVehiclesAndPeds.head; node = node->prev){ + // only boats in this list CVehicle *v = (CVehicle*)node->item.ent; - if(v->IsVehicle() && v->IsBoat()) // BUG: IsVehicle missing in III + if(v->IsBoat()) RenderOneNonRoad(v); } } -- cgit v1.2.3 From 69b5c9f1e0aff9bc32f903b39f5c1673b43a9b37 Mon Sep 17 00:00:00 2001 From: _AG Date: Wed, 3 Jul 2019 17:26:15 +0200 Subject: Update Frontend. --- src/render/Clouds.cpp | 46 +++++++++++++++++++++++----------------------- src/render/Credits.cpp | 8 ++++---- src/render/Draw.cpp | 13 +++++++++++++ src/render/Draw.h | 7 +++++++ src/render/Font.cpp | 6 +++--- src/render/Hud.cpp | 34 ++++++++++++++++++++-------------- src/render/MBlur.h | 1 + 7 files changed, 71 insertions(+), 44 deletions(-) (limited to 'src/render') diff --git a/src/render/Clouds.cpp b/src/render/Clouds.cpp index 6854c80c..bf572841 100644 --- a/src/render/Clouds.cpp +++ b/src/render/Clouds.cpp @@ -208,15 +208,15 @@ CClouds::Render(void) int br = CTimeCycle::GetFluffyCloudsBottomRed(); int bg = CTimeCycle::GetFluffyCloudsBottomGreen(); int bb = CTimeCycle::GetFluffyCloudsBottomBlue(); - if(sundist < SCREENW/2){ - hilight = (1.0f - coverage) * (1.0f - sundist/(SCREENW/2)); + if(sundist < SCREEN_WIDTH/2){ + hilight = (1.0f - coverage) * (1.0f - sundist/(SCREEN_WIDTH/2)); tr = tr*(1.0f-hilight) + 255*hilight; tg = tg*(1.0f-hilight) + 190*hilight; tb = tb*(1.0f-hilight) + 190*hilight; br = br*(1.0f-hilight) + 255*hilight; bg = bg*(1.0f-hilight) + 190*hilight; bb = bb*(1.0f-hilight) + 190*hilight; - if(sundist < SCREENW/10) + if(sundist < SCREEN_WIDTH/10) CCoronas::SunBlockedByClouds = true; }else hilight = 0.0f; @@ -317,16 +317,16 @@ CClouds::RenderBackground(int16 topred, int16 topgreen, int16 topblue, } } ms_colourBottom = ms_colourTop; - CRect r(0, 0, SCREENW, SCREENH); + CRect r(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); CSprite2d::DrawRect(r, ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop); }else{ ms_horizonZ = CSprite::CalcHorizonCoors(); // Draw top/bottom gradient - float gradheight = SCREENH/2.0f; + float gradheight = SCREEN_HEIGHT/2.0f; float topedge = ms_horizonZ - gradheight; float botpos, toppos; - if(ms_horizonZ > 0.0f && topedge < SCREENH){ + if(ms_horizonZ > 0.0f && topedge < SCREEN_HEIGHT){ ms_colourTop.r = topred; ms_colourTop.g = topgreen; ms_colourTop.b = topblue; @@ -336,14 +336,14 @@ CClouds::RenderBackground(int16 topred, int16 topgreen, int16 topblue, ms_colourBottom.b = botblue; ms_colourBottom.a = alpha; - if(ms_horizonZ < SCREENH) + if(ms_horizonZ < SCREEN_HEIGHT) botpos = ms_horizonZ; else{ - float f = (ms_horizonZ - SCREENH)/gradheight; + float f = (ms_horizonZ - SCREEN_HEIGHT)/gradheight; ms_colourBottom.r = topred*f + (1.0f-f)*botred; ms_colourBottom.g = topgreen*f + (1.0f-f)*botgreen; ms_colourBottom.b = topblue*f + (1.0f-f)*botblue; - botpos = SCREENH; + botpos = SCREEN_HEIGHT; } if(topedge >= 0.0f) toppos = topedge; @@ -354,17 +354,17 @@ CClouds::RenderBackground(int16 topred, int16 topgreen, int16 topblue, ms_colourTop.b = botblue*f + (1.0f-f)*topblue; toppos = 0.0f; } - CSprite2d::DrawRect(CRect(0, toppos, SCREENW, botpos), + CSprite2d::DrawRect(CRect(0, toppos, SCREEN_WIDTH, botpos), ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop); } // draw the small stripe (whatever it's supposed to be) - if(ms_horizonZ > -SMALLSTRIPHEIGHT && ms_horizonZ < SCREENH){ + if(ms_horizonZ > -SMALLSTRIPHEIGHT && ms_horizonZ < SCREEN_HEIGHT){ // Same colour as fog ms_colourTop.r = (topred + 2 * botred) / 3; ms_colourTop.g = (topgreen + 2 * botgreen) / 3; ms_colourTop.b = (topblue + 2 * botblue) / 3; - CSprite2d::DrawRect(CRect(0, ms_horizonZ, SCREENW, ms_horizonZ+SMALLSTRIPHEIGHT), + CSprite2d::DrawRect(CRect(0, ms_horizonZ, SCREEN_WIDTH, ms_horizonZ+SMALLSTRIPHEIGHT), ms_colourTop, ms_colourTop, ms_colourTop, ms_colourTop); } @@ -379,8 +379,8 @@ CClouds::RenderBackground(int16 topred, int16 topgreen, int16 topblue, ms_colourBottom.b = topblue; ms_colourBottom.a = alpha; - botpos = min(SCREENH, topedge); - CSprite2d::DrawRect(CRect(0, 0, SCREENW, botpos), + botpos = min(SCREEN_HEIGHT, topedge); + CSprite2d::DrawRect(CRect(0, 0, SCREEN_WIDTH, botpos), ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop); } @@ -403,22 +403,22 @@ CClouds::RenderHorizon(void) ms_colourBottom.a = 230; ms_colourTop.a = 80; - if(ms_horizonZ > SCREENH) + if(ms_horizonZ > SCREEN_HEIGHT) return; - float z1 = min(ms_horizonZ + SMALLSTRIPHEIGHT, SCREENH); - CSprite2d::DrawRectXLU(CRect(0, ms_horizonZ, SCREENW, z1), + float z1 = min(ms_horizonZ + SMALLSTRIPHEIGHT, SCREEN_HEIGHT); + CSprite2d::DrawRectXLU(CRect(0, ms_horizonZ, SCREEN_WIDTH, z1), ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop); // This is just weird - float a = SCREENH/400.0f * HORIZSTRIPHEIGHT + - SCREENH/300.0f * max(TheCamera.GetPosition().z, 0.0f); + float a = SCREEN_HEIGHT/400.0f * HORIZSTRIPHEIGHT + + SCREEN_HEIGHT/300.0f * max(TheCamera.GetPosition().z, 0.0f); float b = TheCamera.GetUp().z < 0.0f ? - SCREENH : - SCREENH * fabs(TheCamera.GetRight().z); + SCREEN_HEIGHT : + SCREEN_HEIGHT * fabs(TheCamera.GetRight().z); float z2 = z1 + (a + b)*TheCamera.LODDistMultiplier; - z2 = min(z2, SCREENH); - CSprite2d::DrawRect(CRect(0, z1, SCREENW, z2), + z2 = min(z2, SCREEN_HEIGHT); + CSprite2d::DrawRect(CRect(0, z1, SCREEN_WIDTH, z2), ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop); } diff --git a/src/render/Credits.cpp b/src/render/Credits.cpp index 8365d02b..6d20c1ff 100644 --- a/src/render/Credits.cpp +++ b/src/render/Credits.cpp @@ -39,11 +39,11 @@ CCredits::PrintCreditSpace(float space, uint32 &line) void CCredits::PrintCreditText(float scaleX, float scaleY, wchar *text, uint32 &lineoffset, float scrolloffset) { - float start = SCREENH + 50.0f; + float start = SCREEN_HEIGHT + 50.0f; float y = lineoffset + start - scrolloffset; if(y > -50.0f && y < start){ CFont::SetScale(scaleX, scaleY); - CFont::PrintString(SCREENW/2.0f, y, (uint16*)text); + CFont::PrintString(SCREEN_WIDTH/2.0f, y, (uint16*)text); } lineoffset += scaleY*25.0f; } @@ -62,7 +62,7 @@ CCredits::Render(void) scrolloffset = (CTimer::GetTimeInMilliseconds() - CreditsStartTime) / 24.0f; CFont::SetJustifyOff(); CFont::SetBackgroundOff(); - CFont::SetCentreSize(SCREENW - 20); + CFont::SetCentreSize(SCREEN_WIDTH - 20); CFont::SetCentreOn(); CFont::SetPropOn(); CFont::SetColor(CRGBA(220, 220, 220, 220)); @@ -489,7 +489,7 @@ CCredits::Render(void) if(TheCamera.m_WideScreenOn) TheCamera.DrawBordersForWideScreen(); - if(lineoffset + SCREENH - scrolloffset < -10.0f) + if(lineoffset + SCREEN_HEIGHT - scrolloffset < -10.0f) bCreditsGoing = false; } diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp index 922d96d4..f825ba42 100644 --- a/src/render/Draw.cpp +++ b/src/render/Draw.cpp @@ -20,12 +20,24 @@ uint8 &CDraw::FadeBlue = *(uint8*)0x95CD53; float CDraw::FindAspectRatio(void) { +#ifndef ASPECT_RATIO_SCALE if(FrontEndMenuManager.m_PrefsUseWideScreen) return 16.0f/9.0f; else return 4.0f/3.0f; +#else + switch (FrontEndMenuManager.m_PrefsUseWideScreen) { + case AR_AUTO: + return SCREEN_WIDTH / SCREEN_HEIGHT; + case AR_4_3: + return 4.0f / 3.0f; + case AR_16_9: + return 16.0f / 9.0f; + }; +#endif } +#ifdef ASPECT_RATIO_SCALE // convert a 4:3 hFOV to vFOV, // then convert that vFOV to hFOV for our aspect ratio, // i.e. HOR+ @@ -41,6 +53,7 @@ CDraw::ConvertFOV(float hfov) hfov = atan(tan(vfov/2) * ar2) *2; return RADTODEG(hfov); } +#endif void CDraw::SetFOV(float fov) diff --git a/src/render/Draw.h b/src/render/Draw.h index 3349c6c9..ad14e5a9 100644 --- a/src/render/Draw.h +++ b/src/render/Draw.h @@ -1,5 +1,12 @@ #pragma once +enum eAspectRatio +{ + AR_AUTO, + AR_4_3, + AR_16_9, +}; + class CDraw { private: diff --git a/src/render/Font.cpp b/src/render/Font.cpp index 2130fb95..59023960 100644 --- a/src/render/Font.cpp +++ b/src/render/Font.cpp @@ -83,7 +83,7 @@ CFont::Initialise(void) Sprite[1].SetTexture("pager", "pager_mask"); Sprite[2].SetTexture("font1", "font1_mask"); SetScale(1.0f, 1.0f); - SetSlantRefPoint(SCREENW, 0.0f); + SetSlantRefPoint(SCREEN_WIDTH, 0.0f); SetSlant(0.0); SetColor(CRGBA(0xFF, 0xFF, 0xFF, 0)); SetJustifyOff(); @@ -123,8 +123,8 @@ CFont::InitPerFrame(void) void CFont::PrintChar(float x, float y, uint16 c) { - if(x <= 0.0f || x >= SCREENW || - y <= 0.0f || y >= SCREENH) // BUG: game uses SCREENW again + if(x <= 0.0f || x >= SCREEN_WIDTH || + y <= 0.0f || y >= SCREEN_HEIGHT) // BUG: game uses SCREENW again return; float w = GetCharacterWidth(c) / 32.0f; diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index e5a44221..0e132392 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -125,6 +125,15 @@ WRAPPER void CHud::Draw(void) { EAXJMP(0x5052A0); } #else void CHud::Draw() { + RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE); + RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); + RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); + RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); + RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSMIRROR); + RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)FALSE); + RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT); + RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR); + if (CReplay::IsPlayingBack()) return; @@ -167,18 +176,15 @@ void CHud::Draw() float fStep = sin((CTimer::GetTimeInMilliseconds() & 1023) * 0.0061328127); float fMultBright = SpriteBrightness * 0.03f * (0.25f * fStep + 0.75f); CRect rect; - - float fWidescreenOffset[2] = { 0.0f, 0.0f }; - - if (FrontEndMenuManager.m_PrefsUseWideScreen) { - fWidescreenOffset[0] = 0.0f; - fWidescreenOffset[1] = SCREEN_SCALE_Y(18.0f); - } - +#ifndef ASPECT_RATIO_SCALE if (Mode_RunAround && TheCamera.Cams->Using3rdPersonMouseCam()) { - float f3rdX = SCREENW * TheCamera.m_f3rdPersonCHairMultX + fWidescreenOffset[0]; - float f3rdY = SCREENH * TheCamera.m_f3rdPersonCHairMultY - fWidescreenOffset[1]; - + float f3rdX = SCREEN_WIDTH * TheCamera.m_f3rdPersonCHairMultX; + float f3rdY = SCREEN_HEIGHT * TheCamera.m_f3rdPersonCHairMultY; +#else + if (Mode_RunAround && TheCamera.Cams->Using3rdPersonMouseCam()) { + float f3rdX = (((TheCamera.m_f3rdPersonCHairMultX - 0.5f) / ((CDraw::GetAspectRatio()) / (DEFAULT_ASPECT_RATIO))) + 0.5f) * SCREEN_WIDTH; + float f3rdY = SCREEN_HEIGHT * TheCamera.m_f3rdPersonCHairMultY + SCREEN_SCALE_Y(-2.0f); +#endif if (CWorld::Players[CWorld::PlayerInFocus].m_pPed && WeaponType == WEAPONTYPE_M16) { rect.left = f3rdX - SCREEN_SCALE_X(32.0f * 0.6f); rect.top = f3rdY - SCREEN_SCALE_Y(32.0f * 0.6f); @@ -654,7 +660,7 @@ void CHud::Draw() CFont::SetBackgroundOff(); CFont::SetBackGroundOnlyTextOn(); CFont::SetAlignment(ALIGN_RIGHT); - CFont::SetRightJustifyWrap(-SCREENW); + CFont::SetRightJustifyWrap(-SCREEN_WIDTH); CFont::SetFontStyle(FONT_HEADING); CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); @@ -917,7 +923,7 @@ void CHud::Draw() CFont::SetCentreSize(SCREEN_SCALE_X(615.0f)); CFont::SetFontStyle(FONT_HEADING); - if (BigMessageX[0] >= (SCREENW - 20)) { + if (BigMessageX[0] >= (SCREEN_WIDTH - 20)) { BigMessageInUse[0] += (CTimer::GetTimeStep() * 0.02f * 120.0f); if (BigMessageInUse[0] >= 120.0f) { @@ -1190,7 +1196,7 @@ void CHud::DrawAfterFade() CFont::SetRightJustifyWrap(-500); CFont::SetRightJustifyOn(); CFont::SetFontStyle(FONT_HEADING); - if (BigMessageX[1] >= (SCREENW - 20)) { + if (BigMessageX[1] >= (SCREEN_WIDTH - 20)) { BigMessageInUse[1] += (CTimer::GetTimeStep() * 0.02f * 120.0f); if (BigMessageInUse[1] >= 120.0f) { diff --git a/src/render/MBlur.h b/src/render/MBlur.h index baa82b80..42827f99 100644 --- a/src/render/MBlur.h +++ b/src/render/MBlur.h @@ -2,6 +2,7 @@ class CMBlur { +public: static RwRaster *&pFrontBuffer; static bool &ms_bJustInitialised; static bool &BlurOn; -- cgit v1.2.3 From 7fae683316db64e772fb82833d73860cc16cf03a Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Thu, 4 Jul 2019 01:16:24 +0300 Subject: Script stuff + bug fixes --- src/render/Hud.cpp | 2 +- src/render/Hud.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/render') diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 0e132392..d36675cf 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -47,7 +47,7 @@ wchar *CHud::m_PagerMessage = (wchar*)0x878840; bool &CHud::m_Wants_To_Draw_Hud = *(bool*)0x95CD89; bool &CHud::m_Wants_To_Draw_3dMarkers = *(bool*)0x95CD62; wchar(*CHud::m_BigMessage)[128] = (wchar(*)[128])0x664CE0; -int32 CHud::m_ItemToFlash = *(int32*)0x95CC82; +int32 &CHud::m_ItemToFlash = *(int32*)0x95CC82; // These aren't really in CHud float CHud::BigMessageInUse[6]; diff --git a/src/render/Hud.h b/src/render/Hud.h index 1c82b7df..df02b4d0 100644 --- a/src/render/Hud.h +++ b/src/render/Hud.h @@ -62,7 +62,7 @@ public: static bool &m_Wants_To_Draw_Hud; static bool &m_Wants_To_Draw_3dMarkers; static wchar(*m_BigMessage)[128]; - static int32 m_ItemToFlash; + static int32 &m_ItemToFlash; // These aren't really in CHud static float BigMessageInUse[6]; -- cgit v1.2.3 From 835b7cac2201d09d16b0ea5fcc34e101e8261c2d Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Thu, 4 Jul 2019 01:23:19 +0300 Subject: Fixed type of m_ItemToFlash --- src/render/Hud.cpp | 2 +- src/render/Hud.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/render') diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index d36675cf..081aaa64 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -47,7 +47,7 @@ wchar *CHud::m_PagerMessage = (wchar*)0x878840; bool &CHud::m_Wants_To_Draw_Hud = *(bool*)0x95CD89; bool &CHud::m_Wants_To_Draw_3dMarkers = *(bool*)0x95CD62; wchar(*CHud::m_BigMessage)[128] = (wchar(*)[128])0x664CE0; -int32 &CHud::m_ItemToFlash = *(int32*)0x95CC82; +int16 &CHud::m_ItemToFlash = *(int16*)0x95CC82; // These aren't really in CHud float CHud::BigMessageInUse[6]; diff --git a/src/render/Hud.h b/src/render/Hud.h index df02b4d0..1567abdc 100644 --- a/src/render/Hud.h +++ b/src/render/Hud.h @@ -62,7 +62,7 @@ public: static bool &m_Wants_To_Draw_Hud; static bool &m_Wants_To_Draw_3dMarkers; static wchar(*m_BigMessage)[128]; - static int32 &m_ItemToFlash; + static int16 &m_ItemToFlash; // These aren't really in CHud static float BigMessageInUse[6]; -- cgit v1.2.3