From e14252914e9bd4cf7702479b5e0b050b935ba4aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Mon, 3 Aug 2020 04:00:12 +0300 Subject: Squeeze performance option, minor fixes Fixes are already in miami --- src/render/Fluff.cpp | 5 +++-- src/render/Font.h | 2 +- src/render/Renderer.cpp | 6 +++++- src/render/Rubbish.h | 4 ++++ src/render/Sprite2d.cpp | 9 +++++++++ 5 files changed, 22 insertions(+), 4 deletions(-) (limited to 'src/render') diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp index f86801bf..690a1d3f 100644 --- a/src/render/Fluff.cpp +++ b/src/render/Fluff.cpp @@ -152,9 +152,9 @@ void CMovingThings::Shutdown() void CMovingThings::Update() { - const int TIME_SPAN = 64; // frames to process all aMovingThings - int16 i; +#ifndef SQUEEZE_PERFORMANCE + const int TIME_SPAN = 64; // frames to process all aMovingThings int block = CTimer::GetFrameCounter() % TIME_SPAN; @@ -167,6 +167,7 @@ void CMovingThings::Update() if (aMovingThings[i].m_nHidden == 0) aMovingThings[i].Update(); } +#endif for (i = 0; i < ARRAY_SIZE(aScrollBars); ++i) { diff --git a/src/render/Font.h b/src/render/Font.h index 9b4e7132..48f5703d 100644 --- a/src/render/Font.h +++ b/src/render/Font.h @@ -68,8 +68,8 @@ class CFont static int16 Size[MAX_FONTS][193]; #endif static int16 NewLine; - static CSprite2d Sprite[MAX_FONTS]; public: + static CSprite2d Sprite[MAX_FONTS]; static CFontDetails Details; static void Initialise(void); diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 88d412c9..717021a7 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -73,8 +73,12 @@ CRenderer::PreRender(void) for(i = 0; i < ms_nNoOfVisibleEntities; i++) ms_aVisibleEntityPtrs[i]->PreRender(); - for(i = 0; i < ms_nNoOfInVisibleEntities; i++) + for (i = 0; i < ms_nNoOfInVisibleEntities; i++) { +#ifdef SQUEEZE_PERFORMANCE + if (ms_aInVisibleEntityPtrs[i]->IsVehicle() && ((CVehicle*)ms_aInVisibleEntityPtrs[i])->IsHeli()) +#endif ms_aInVisibleEntityPtrs[i]->PreRender(); + } for(node = CVisibilityPlugins::m_alphaEntityList.head.next; node != &CVisibilityPlugins::m_alphaEntityList.tail; diff --git a/src/render/Rubbish.h b/src/render/Rubbish.h index 2be592fe..37f895f3 100644 --- a/src/render/Rubbish.h +++ b/src/render/Rubbish.h @@ -4,7 +4,11 @@ class CVehicle; enum { // NB: not all values are allowed, check the code +#ifdef SQUEEZE_PERFORMANCE + NUM_RUBBISH_SHEETS = 32 +#else NUM_RUBBISH_SHEETS = 64 +#endif }; class COneSheet diff --git a/src/render/Sprite2d.cpp b/src/render/Sprite2d.cpp index 52b85018..453ed004 100644 --- a/src/render/Sprite2d.cpp +++ b/src/render/Sprite2d.cpp @@ -4,6 +4,7 @@ #include "Draw.h" #include "Camera.h" #include "Sprite2d.h" +#include "Font.h" RwIm2DVertex CSprite2d::maVertices[8]; float CSprite2d::RecipNearClip; @@ -27,14 +28,18 @@ CSprite2d::InitPerFrame(void) mCurrentBank = 0; for(i = 0; i < 10; i++) mCurrentSprite[i] = 0; +#ifndef SQUEEZE_PERFORMANCE for(i = 0; i < 10; i++) mpBankTextures[i] = nil; +#endif } int32 CSprite2d::GetBank(int32 n, RwTexture *tex) { +#ifndef SQUEEZE_PERFORMANCE mpBankTextures[mCurrentBank] = tex; +#endif mCurrentSprite[mCurrentBank] = 0; mBankStart[mCurrentBank+1] = mBankStart[mCurrentBank] + n; return mCurrentBank++; @@ -59,8 +64,12 @@ CSprite2d::DrawBank(int32 bank) { if(mCurrentSprite[bank] == 0) return; +#ifndef SQUEEZE_PERFORMANCE RwRenderStateSet(rwRENDERSTATETEXTURERASTER, mpBankTextures[bank] ? RwTextureGetRaster(mpBankTextures[bank]) : nil); +#else + CFont::Sprite[bank].SetRenderState(); +#endif RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR); RwIm2DRenderPrimitive(rwPRIMTYPETRILIST, &maBankVertices[6*mBankStart[bank]], 6*mCurrentSprite[bank]); -- cgit v1.2.3