diff options
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/Clouds.cpp | 46 | ||||
-rw-r--r-- | src/render/Credits.cpp | 8 | ||||
-rw-r--r-- | src/render/Draw.cpp | 47 | ||||
-rw-r--r-- | src/render/Draw.h | 25 | ||||
-rw-r--r-- | src/render/Font.cpp | 6 | ||||
-rw-r--r-- | src/render/Hud.cpp | 40 | ||||
-rw-r--r-- | src/render/Hud.h | 2 | ||||
-rw-r--r-- | src/render/MBlur.h | 1 | ||||
-rw-r--r-- | src/render/Renderer.cpp | 21 | ||||
-rw-r--r-- | src/render/Sprite.cpp | 66 |
10 files changed, 150 insertions, 112 deletions
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 90875299..f825ba42 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,38 +17,52 @@ 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); - +#ifndef ASPECT_RATIO_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; +#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 } -static float hFov2vFov(float hfov) +#ifdef ASPECT_RATIO_SCALE +// 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; return RADTODEG(hfov); } +#endif 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..ad14e5a9 100644 --- a/src/render/Draw.h +++ b/src/render/Draw.h @@ -1,7 +1,11 @@ #pragma once -#define HUD_SCALE 0.8f -#define DEFAULT_SCALE 1.0f +enum eAspectRatio +{ + AR_AUTO, + AR_4_3, + AR_16_9, +}; class CDraw { @@ -9,8 +13,13 @@ 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 +35,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/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 2547ab2b..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]; @@ -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)); @@ -787,8 +793,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(); @@ -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/Hud.h b/src/render/Hud.h index 1c82b7df..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]; 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; 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<EntityInfo> *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); } } 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; |