summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
Diffstat (limited to 'src/render')
-rw-r--r--src/render/Antennas.cpp4
-rw-r--r--src/render/Clouds.cpp13
-rw-r--r--src/render/Coronas.cpp14
-rw-r--r--src/render/Credits.cpp3
-rw-r--r--src/render/Draw.cpp36
-rw-r--r--src/render/Draw.h6
-rw-r--r--src/render/Fluff.cpp2
-rw-r--r--src/render/Font.cpp49
-rw-r--r--src/render/Font.h25
-rw-r--r--src/render/Glass.cpp4
-rw-r--r--src/render/Hud.cpp23
-rw-r--r--src/render/MBlur.cpp3
-rw-r--r--src/render/Occlusion.cpp4
-rw-r--r--src/render/Particle.cpp38
-rw-r--r--src/render/ParticleMgr.cpp4
-rw-r--r--src/render/PointLights.cpp4
-rw-r--r--src/render/Renderer.cpp37
-rw-r--r--src/render/Rubbish.cpp4
-rw-r--r--src/render/Shadows.cpp14
-rw-r--r--src/render/Skidmarks.cpp4
-rw-r--r--src/render/SpecialFX.cpp2
-rw-r--r--src/render/WaterCannon.cpp4
-rw-r--r--src/render/WaterLevel.cpp43
-rw-r--r--src/render/Weather.cpp2
24 files changed, 254 insertions, 88 deletions
diff --git a/src/render/Antennas.cpp b/src/render/Antennas.cpp
index 452069a0..5e30aca2 100644
--- a/src/render/Antennas.cpp
+++ b/src/render/Antennas.cpp
@@ -1,5 +1,6 @@
#include "common.h"
+#include "main.h"
#include "Antennas.h"
CAntenna CAntennas::aAntennas[NUMANTENNAS];
@@ -70,6 +71,7 @@ CAntennas::Render(void)
{
int i, j;
+ PUSH_RENDERGROUP("CAntennas::Render");
for(i = 0; i < NUMANTENNAS; i++){
if(!aAntennas[i].active)
continue;
@@ -101,6 +103,8 @@ CAntennas::Render(void)
}
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
+
+ POP_RENDERGROUP();
}
void
diff --git a/src/render/Clouds.cpp b/src/render/Clouds.cpp
index e3a8c86e..9cd32c5f 100644
--- a/src/render/Clouds.cpp
+++ b/src/render/Clouds.cpp
@@ -1,5 +1,6 @@
#include "common.h"
+#include "main.h"
#include "Sprite.h"
#include "Sprite2d.h"
#include "General.h"
@@ -119,6 +120,8 @@ CClouds::Render(void)
if(!CGame::CanSeeOutSideFromCurrArea())
return;
+ PUSH_RENDERGROUP("CClouds::Render");
+
CCoronas::SunBlockedByClouds = false;
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
@@ -301,6 +304,8 @@ CClouds::Render(void)
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
+
+ POP_RENDERGROUP();
}
bool
@@ -313,6 +318,8 @@ void
CClouds::RenderBackground(int16 topred, int16 topgreen, int16 topblue,
int16 botred, int16 botgreen, int16 botblue, int16 alpha)
{
+ PUSH_RENDERGROUP("CClouds::RenderBackground");
+
CVector right = CrossProduct(TheCamera.GetUp(), TheCamera.GetForward());
right.Normalise();
float c = right.Magnitude2D();
@@ -415,6 +422,8 @@ CClouds::RenderBackground(int16 topred, int16 topgreen, int16 topblue,
ms_colourBottom.g = fogg;
ms_colourBottom.b = fogb;
}
+
+ POP_RENDERGROUP();
}
void
@@ -423,6 +432,8 @@ CClouds::RenderHorizon(void)
if(UseDarkBackground())
return;
+ PUSH_RENDERGROUP("CClouds::RenderHorizon");
+
ms_colourBottom.a = 230;
ms_colourTop.a = 80;
@@ -457,4 +468,6 @@ CClouds::RenderHorizon(void)
CSprite2d::DrawAnyRect(0.0f, topleft, SCREEN_WIDTH, topright, 0.0f, botleft, SCREEN_WIDTH, botright,
ms_colourBkGrd, ms_colourBkGrd, ms_colourBkGrd, ms_colourBkGrd);
+
+ POP_RENDERGROUP();
}
diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp
index e3d3416c..1ac3263c 100644
--- a/src/render/Coronas.cpp
+++ b/src/render/Coronas.cpp
@@ -249,6 +249,8 @@ CCoronas::Render(void)
int i, j;
int screenw, screenh;
+ PUSH_RENDERGROUP("CCoronas::Render");
+
screenw = RwRasterGetWidth(RwCameraGetRaster(Scene.camera));
screenh = RwRasterGetHeight(RwCameraGetRaster(Scene.camera));
@@ -432,6 +434,8 @@ CCoronas::Render(void)
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
+
+ POP_RENDERGROUP();
}
void
@@ -442,6 +446,8 @@ CCoronas::RenderReflections(void)
CEntity *entity;
if(CWeather::WetRoads > 0.0f){
+ PUSH_RENDERGROUP("CCoronas::RenderReflections");
+
CSprite::InitSpriteBuffer();
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
@@ -517,6 +523,8 @@ CCoronas::RenderReflections(void)
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
+
+ POP_RENDERGROUP();
}else{
for(i = 0; i < NUMCORONAS; i++)
aCoronas[i].renderReflection = false;
@@ -905,9 +913,9 @@ CEntity::ProcessLightsForEntity(void)
effect->light.shadowSize, 0.0f,
0.0f, -effect->light.shadowSize,
128,
- effect->col.r*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f,
- effect->col.g*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f,
- effect->col.b*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f,
+ effect->col.r,
+ effect->col.g,
+ effect->col.b,
15.0f, 1.0f, 40.0f, false, 0.0f);
}else if(lightFlickering){
CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE,
diff --git a/src/render/Credits.cpp b/src/render/Credits.cpp
index 883ad2f2..81e76625 100644
--- a/src/render/Credits.cpp
+++ b/src/render/Credits.cpp
@@ -798,6 +798,9 @@ CCredits::Render(void)
PrintCreditSpace(1.5f, lineoffset);
PrintCreditSpace(1.5f, lineoffset);
CFont::DrawFonts();
+#ifdef CUTSCENE_BORDERS_SWITCH
+ if (CMenuManager::m_PrefsCutsceneBorders)
+#endif
if(TheCamera.m_WideScreenOn)
TheCamera.DrawBordersForWideScreen();
diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp
index 13cbd1b3..9c5921c3 100644
--- a/src/render/Draw.cpp
+++ b/src/render/Draw.cpp
@@ -30,28 +30,48 @@ bool CDraw::ms_bFixRadar = true;
bool CDraw::ms_bFixSprites = true;
#endif
+#ifdef ASPECT_RATIO_SCALE
+float
+FindAspectRatio(void)
+{
+ switch (FrontEndMenuManager.m_PrefsUseWideScreen) {
+ case AR_AUTO:
+ return SCREEN_WIDTH / SCREEN_HEIGHT;
+ default:
+ case AR_4_3:
+ return 4.0f / 3.0f;
+ case AR_5_4:
+ return 5.0f / 4.0f;
+ case AR_16_10:
+ return 16.0f / 10.0f;
+ case AR_16_9:
+ return 16.0f / 9.0f;
+ case AR_21_9:
+ return 21.0f / 9.0f;
+ };
+}
+#endif
+
float
CDraw::CalculateAspectRatio(void)
{
- if (FrontEndMenuManager.m_PrefsUseWideScreen) {
#ifdef ASPECT_RATIO_SCALE
- if (TheCamera.m_WideScreenOn)
- CDraw::ms_fAspectRatio = FrontEndMenuManager.m_PrefsUseWideScreen == AR_AUTO ?
- (5.f / 3.f) * (SCREEN_WIDTH / SCREEN_HEIGHT) / (16.f / 9.f) :
- 5.f / 3.f; // It's used on theatrical showings according to Wiki
- else
- CDraw::ms_fAspectRatio = FrontEndMenuManager.m_PrefsUseWideScreen == AR_AUTO ? SCREEN_WIDTH / SCREEN_HEIGHT : 16.f / 9.f;
+ if (TheCamera.m_WideScreenOn)
+ CDraw::ms_fAspectRatio = (5.f / 3.f) * FindAspectRatio() / (16.f / 9.f); // It's used on theatrical showings according to Wiki
+ else
+ CDraw::ms_fAspectRatio = FindAspectRatio();
#else
+ if(FrontEndMenuManager.m_PrefsUseWideScreen) {
if (TheCamera.m_WideScreenOn)
CDraw::ms_fAspectRatio = 5.f / 3.f; // It's used on theatrical showings according to Wiki
else
CDraw::ms_fAspectRatio = 16.f / 9.f;
-#endif
} else if (TheCamera.m_WideScreenOn) {
CDraw::ms_fAspectRatio = 5.f/4.f;
} else {
CDraw::ms_fAspectRatio = 4.f/3.f;
}
+#endif
return CDraw::ms_fAspectRatio;
}
diff --git a/src/render/Draw.h b/src/render/Draw.h
index e67ab42b..b96fa813 100644
--- a/src/render/Draw.h
+++ b/src/render/Draw.h
@@ -4,10 +4,14 @@ enum eAspectRatio
{
// Make sure these work the same as FrontEndMenuManager.m_PrefsUseWideScreen
// without widescreen support
+ AR_AUTO,
AR_4_3,
+ AR_5_4,
+ AR_16_10,
AR_16_9,
+ AR_21_9,
- AR_AUTO,
+ AR_MAX,
};
class CDraw
diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp
index e28ebc8e..ef167708 100644
--- a/src/render/Fluff.cpp
+++ b/src/render/Fluff.cpp
@@ -460,6 +460,7 @@ void CMovingThings::Update()
void CMovingThings::Render()
{
+ PUSH_RENDERGROUP("CMovingThings::Render");
CSmokeTrails::Update();
int i;
@@ -472,6 +473,7 @@ void CMovingThings::Render()
CPlaneTrails::Render();
CSmokeTrails::Render();
CPlaneBanners::Render();
+ POP_RENDERGROUP();
}
void CMovingThings::RegisterOne(CEntity *pEnt, uint16 nType) {
diff --git a/src/render/Font.cpp b/src/render/Font.cpp
index 45ea9ac2..b38b0efd 100644
--- a/src/render/Font.cpp
+++ b/src/render/Font.cpp
@@ -176,11 +176,26 @@ CFont::Initialise(void)
}
*/
+#if !defined(GAMEPAD_MENU) && defined(BUTTON_ICONS)
+ // loaded in CMenuManager with GAMEPAD_MENU defined
+ LoadButtons("MODELS/X360BTNS.TXD");
+#endif
+}
+
#ifdef BUTTON_ICONS
- if (int file = CFileMgr::OpenFile("MODELS/X360BTNS.TXD")) {
+void
+CFont::LoadButtons(const char *txdPath)
+{
+ if (int file = CFileMgr::OpenFile(txdPath)) {
CFileMgr::CloseFile(file);
- ButtonsSlot = CTxdStore::AddTxdSlot("buttons");
- CTxdStore::LoadTxd(ButtonsSlot, "MODELS/X360BTNS.TXD");
+ if (ButtonsSlot == -1)
+ ButtonsSlot = CTxdStore::AddTxdSlot("buttons");
+ else {
+ for (int i = 0; i < MAX_BUTTON_ICONS; i++)
+ ButtonSprite[i].Delete();
+ CTxdStore::RemoveTxd(ButtonsSlot);
+ }
+ CTxdStore::LoadTxd(ButtonsSlot, txdPath);
CTxdStore::AddRef(ButtonsSlot);
CTxdStore::PushCurrentTxd();
CTxdStore::SetCurrentTxd(ButtonsSlot);
@@ -198,12 +213,22 @@ CFont::Initialise(void)
ButtonSprite[BUTTON_R1].SetTexture("r1");
ButtonSprite[BUTTON_R2].SetTexture("r2");
ButtonSprite[BUTTON_R3].SetTexture("r3");
+ ButtonSprite[BUTTON_RSTICK_UP].SetTexture("thumbryu");
+ ButtonSprite[BUTTON_RSTICK_DOWN].SetTexture("thumbryd");
ButtonSprite[BUTTON_RSTICK_LEFT].SetTexture("thumbrxl");
ButtonSprite[BUTTON_RSTICK_RIGHT].SetTexture("thumbrxr");
CTxdStore::PopCurrentTxd();
}
-#endif // BUTTON_ICONS
+ else {
+ if (ButtonsSlot != -1) {
+ for (int i = 0; i < MAX_BUTTON_ICONS; i++)
+ ButtonSprite[i].Delete();
+ CTxdStore::RemoveTxdSlot(ButtonsSlot);
+ ButtonsSlot = -1;
+ }
+ }
}
+#endif // BUTTON_ICONS
#ifdef MORE_LANGUAGES
void
@@ -257,6 +282,7 @@ CFont::Shutdown(void)
for (int i = 0; i < MAX_BUTTON_ICONS; i++)
ButtonSprite[i].Delete();
CTxdStore::RemoveTxdSlot(ButtonsSlot);
+ ButtonsSlot = -1;
}
#endif
Sprite[0].Delete();
@@ -296,16 +322,19 @@ CFont::DrawButton(float x, float y)
if (PS2Symbol != BUTTON_NONE) {
CRect rect;
rect.left = x;
- rect.top = Details.scaleY + Details.scaleY + y;
- rect.right = Details.scaleY * 17.0f + x;
- rect.bottom = Details.scaleY * 19.0f + y;
+ rect.top = RenderState.scaleY + RenderState.scaleY + y;
+ rect.right = RenderState.scaleY * 17.0f + x;
+ rect.bottom = RenderState.scaleY * 19.0f + y;
int vertexAlphaState;
void *raster;
RwRenderStateGet(rwRENDERSTATEVERTEXALPHAENABLE, &vertexAlphaState);
RwRenderStateGet(rwRENDERSTATETEXTURERASTER, &raster);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE);
- ButtonSprite[PS2Symbol].Draw(rect, CRGBA(255, 255, 255, Details.color.a));
+ if (RenderState.bIsShadow)
+ ButtonSprite[PS2Symbol].Draw(rect, RenderState.color);
+ else
+ ButtonSprite[PS2Symbol].Draw(rect, CRGBA(255, 255, 255, RenderState.color.a));
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, raster);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)vertexAlphaState);
}
@@ -455,7 +484,7 @@ CFont::RenderFontBuffer()
#ifdef BUTTON_ICONS
if(PS2Symbol != BUTTON_NONE) {
DrawButton(textPosX, textPosY);
- textPosX += Details.scaleY * 17.0f;
+ textPosX += RenderState.scaleY * 17.0f;
PS2Symbol = BUTTON_NONE;
}
#endif
@@ -1254,6 +1283,8 @@ CFont::ParseToken(wchar* str, CRGBA &color, bool &flash, bool &bold)
case 'J': PS2Symbol = BUTTON_R1; break;
case 'V': PS2Symbol = BUTTON_R2; break;
case 'C': PS2Symbol = BUTTON_R3; break;
+ case 'H': PS2Symbol = BUTTON_RSTICK_UP; break;
+ case 'L': PS2Symbol = BUTTON_RSTICK_DOWN; break;
case '(': PS2Symbol = BUTTON_RSTICK_LEFT; break;
case ')': PS2Symbol = BUTTON_RSTICK_RIGHT; break;
#endif
diff --git a/src/render/Font.h b/src/render/Font.h
index 4046ebb5..fdf5f3f2 100644
--- a/src/render/Font.h
+++ b/src/render/Font.h
@@ -114,6 +114,8 @@ enum
BUTTON_R1,
BUTTON_R2,
BUTTON_R3,
+ BUTTON_RSTICK_UP,
+ BUTTON_RSTICK_DOWN,
BUTTON_RSTICK_LEFT,
BUTTON_RSTICK_RIGHT,
MAX_BUTTON_ICONS
@@ -124,7 +126,7 @@ enum
class CFont
{
#ifdef MORE_LANGUAGES
- static int16 Size[LANGSET_MAX][MAX_FONTS][193];
+ static int16 Size[LANGSET_MAX][MAX_FONTS][210];
static uint8 LanguageSet;
static int32 Slot;
#else
@@ -140,7 +142,8 @@ public:
static int32 ButtonsSlot;
static CSprite2d ButtonSprite[MAX_BUTTON_ICONS];
static int PS2Symbol;
-
+
+ static void LoadButtons(const char *txdPath);
static void DrawButton(float x, float y);
#endif // BUTTON_ICONS
@@ -155,11 +158,11 @@ public:
#endif
static int GetNumberLines(float xstart, float ystart, wchar *s);
static void GetTextRect(CRect *rect, float xstart, float ystart, wchar *s);
-#ifdef MORE_LANGUAGES
- static bool PrintString(float x, float y, wchar *start, wchar* &end, float spwidth, float japX);
-#else
+//#ifdef MORE_LANGUAGES
+// static bool PrintString(float x, float y, wchar *start, wchar* &end, float spwidth, float japX);
+//#else
static void PrintString(float x, float y, uint32, wchar *start, wchar *end, float spwidth);
-#endif
+//#endif
static void PrintStringFromBottom(float x, float y, wchar *str);
static float GetCharacterWidth(wchar c, bool forceProportional = false);
static float GetCharacterSize(wchar c);
@@ -168,12 +171,12 @@ public:
static float GetStringWidth_Jap(wchar* s);
#endif
static uint16 *GetNextSpace(wchar *s);
-#ifdef MORE_LANGUAGES
- static uint16 *ParseToken(wchar *s, bool japShit = false);
-#else
+//#ifdef MORE_LANGUAGES
+// static uint16 *ParseToken(wchar *s, bool japShit = false);
+//#else
static uint16 *ParseToken(wchar *s);
static uint16 *ParseToken(wchar *s, CRGBA &color, bool &flash, bool &bold);
-#endif
+//#endif
static void DrawFonts(void);
static void RenderFontBuffer(void);
static uint16 character_code(uint8 c);
@@ -218,6 +221,6 @@ public:
static bool IsAnsiCharacter(wchar* s);
static bool IsJapanesePunctuation(wchar* str);
static bool IsJapanese() { return LanguageSet == FONT_LANGSET_JAPANESE; }
- static bool IsJapaneseFont() { return IsJapanese() && (Details.style == FONT_JAPANESE || Details.style == FONT_PAGER); }
+ static bool IsJapaneseFont() { return IsJapanese() && (Details.style == FONT_JAPANESE); }
#endif
};
diff --git a/src/render/Glass.cpp b/src/render/Glass.cpp
index c6d02755..3409a058 100644
--- a/src/render/Glass.cpp
+++ b/src/render/Glass.cpp
@@ -276,6 +276,8 @@ CGlass::Render(void)
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE);
+ PUSH_RENDERGROUP("CGlass::Render");
+
for ( int32 i = 0; i < NUM_GLASSPANES; i++ )
{
if ( aGlassPanes[i].m_bActive )
@@ -285,6 +287,8 @@ CGlass::Render(void)
for ( uint32 i = 0; i < NumGlassEntities; i++ )
RenderEntityInGlass(apEntitiesToBeRendered[i]);
+ POP_RENDERGROUP();
+
NumGlassEntities = 0;
RenderHiLightPolys();
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 12bfd040..2efa7b64 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -1107,18 +1107,18 @@ void CHud::Draw()
if (IntroRect.m_nTextureId >= 0) {
CRect rect (
IntroRect.m_sRect.left,
- IntroRect.m_sRect.top,
+ IntroRect.m_sRect.bottom,
IntroRect.m_sRect.right,
- IntroRect.m_sRect.bottom );
+ IntroRect.m_sRect.top );
CTheScripts::ScriptSprites[IntroRect.m_nTextureId].Draw(rect, IntroRect.m_sColor);
}
else {
CRect rect (
IntroRect.m_sRect.left,
- IntroRect.m_sRect.top,
+ IntroRect.m_sRect.bottom,
IntroRect.m_sRect.right,
- IntroRect.m_sRect.bottom );
+ IntroRect.m_sRect.top );
CSprite2d::DrawRect(rect, IntroRect.m_sColor);
}
@@ -1139,7 +1139,14 @@ void CHud::Draw()
CFont::SetBackgroundColor(CRGBA(0, 0, 0, 128));
CFont::SetCentreOn();
CFont::SetPropOn();
- CFont::SetDropShadowPosition(0);
+#ifdef CUTSCENE_BORDERS_SWITCH
+ if (!FrontEndMenuManager.m_PrefsCutsceneBorders) {
+ CFont::SetDropColor(CRGBA(0, 0, 0, 255));
+ CFont::SetDropShadowPosition(2);
+ }
+ else
+#endif
+ CFont::SetDropShadowPosition(0);
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetColor(CRGBA(225, 225, 225, 255));
@@ -1149,10 +1156,6 @@ void CHud::Draw()
onceItWasWidescreen = true;
if (FrontEndMenuManager.m_PrefsShowSubtitles || !CCutsceneMgr::IsRunning()) {
-#ifdef CUTSCENE_BORDERS_SWITCH
- if (!FrontEndMenuManager.m_PrefsCutsceneBorders)
- CFont::SetDropShadowPosition(0);
-#endif
CFont::SetCentreSize(SCREEN_WIDTH - SCREEN_SCALE_X(60.0f));
CFont::SetScale(SCREEN_SCALE_X(0.58f), SCREEN_SCALE_Y(1.2f));
CFont::PrintString(SCREEN_WIDTH / 2.f, SCREEN_SCALE_FROM_BOTTOM(80.0f), m_Message);
@@ -1191,7 +1194,7 @@ void CHud::Draw()
m_HelpMessageDisplayTime = CMessages::GetWideStringLength(m_HelpMessage) * 0.05f + 3.0f;
if (TheCamera.m_ScreenReductionPercentage == 0.0f)
- DMAudio.PlayFrontEndSound(SOUND_HUD_SOUND, 0);
+ DMAudio.PlayFrontEndSound(SOUND_HUD, 0);
break;
case 1:
case 2:
diff --git a/src/render/MBlur.cpp b/src/render/MBlur.cpp
index ab77bf9b..dc88164b 100644
--- a/src/render/MBlur.cpp
+++ b/src/render/MBlur.cpp
@@ -6,6 +6,7 @@
#include <d3d8caps.h>
#endif
+#include "main.h"
#include "General.h"
#include "RwHelper.h"
#include "Camera.h"
@@ -333,6 +334,7 @@ CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, u
#ifdef EXTENDED_COLOURFILTER
CPostFX::Render(cam, red, green, blue, blur, type, bluralpha);
#else
+ PUSH_RENDERGROUP("CMBlur::MotionBlurRender");
RwRGBA color = { (RwUInt8)red, (RwUInt8)green, (RwUInt8)blue, (RwUInt8)blur };
#ifdef GTA_PS2
if( pFrontBuffer )
@@ -348,6 +350,7 @@ CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, u
RwRasterPopContext();
}
#endif
+ POP_RENDERGROUP();
#endif
}
diff --git a/src/render/Occlusion.cpp b/src/render/Occlusion.cpp
index 3ea5678c..ec7101a6 100644
--- a/src/render/Occlusion.cpp
+++ b/src/render/Occlusion.cpp
@@ -513,8 +513,8 @@ bool CEntity::IsEntityOccluded(void) {
}
if (COcclusion::aActiveOccluders[i].IsPointWithinOcclusionArea(coors.x, coors.y, 0.0f)) {
- CVector min = m_matrix * CModelInfo::GetModelInfo(GetModelIndex())->GetColModel()->boundingBox.min;
- CVector max = m_matrix * CModelInfo::GetModelInfo(GetModelIndex())->GetColModel()->boundingBox.max;
+ CVector min = m_matrix * CModelInfo::GetColModel(m_modelIndex)->boundingBox.min;
+ CVector max = m_matrix * CModelInfo::GetColModel(m_modelIndex)->boundingBox.max;
if (CalcScreenCoors(min, &coors) && !COcclusion::aActiveOccluders[i].IsPointWithinOcclusionArea(coors.x, coors.y, 0.0f)) continue;
if (CalcScreenCoors(CVector(max.x, max.y, min.z), &coors) && !COcclusion::aActiveOccluders[i].IsPointWithinOcclusionArea(coors.x, coors.y, 0.0f)) continue;
diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp
index 660ed5c2..2e709f42 100644
--- a/src/render/Particle.cpp
+++ b/src/render/Particle.cpp
@@ -1,5 +1,6 @@
#include "common.h"
+#include "main.h"
#include "General.h"
#include "Timer.h"
#include "TxdStore.h"
@@ -50,6 +51,8 @@
#define MAX_RAINDRIP_FILES (2)
+#define MAX_LEAF_FILES (2)
+
const char SmokeFiles[][6+1] =
{
@@ -166,7 +169,7 @@ RwTexture *gpFlame1Tex;
RwTexture *gpFlame5Tex;
RwTexture *gpRainDropSmallTex;
RwTexture *gpBloodTex;
-RwTexture *gpLeafTex;
+RwTexture *gpLeafTex[MAX_LEAF_FILES];
RwTexture *gpCloudTex1;
RwTexture *gpCloudTex4;
RwTexture *gpBloodSmallTex;
@@ -194,7 +197,7 @@ RwRaster *gpFlame1Raster;
RwRaster *gpFlame5Raster;
RwRaster *gpRainDropSmallRaster;
RwRaster *gpBloodRaster;
-RwRaster *gpLeafRaster;
+RwRaster *gpLeafRaster[MAX_LEAF_FILES];
RwRaster *gpCloudRaster1;
RwRaster *gpCloudRaster4;
RwRaster *gpBloodSmallRaster;
@@ -207,9 +210,6 @@ RwRaster *gpPointlightRaster;
RwTexture *gpRainDropTex;
RwRaster *gpRainDropRaster;
-RwTexture *gpLetterTex;
-RwRaster *gpLetterRaster;
-
RwTexture *gpSparkTex;
RwTexture *gpNewspaperTex;
RwTexture *gpGunSmokeTex;
@@ -430,13 +430,13 @@ void CParticle::Initialise()
ASSERT(gpBloodTex != nil);
gpBloodRaster = RwTextureGetRaster(gpBloodTex);
- gpLeafTex = RwTextureRead("gameleaf01_64", nil);
- ASSERT(gpLeafTex != nil);
- gpLeafRaster = RwTextureGetRaster(gpLeafTex);
+ gpLeafTex[0] = RwTextureRead("gameleaf01_64", nil);
+ ASSERT(gpLeafTex[0] != nil);
+ gpLeafRaster[0] = RwTextureGetRaster(gpLeafTex[0]);
- gpLetterTex = RwTextureRead("letter", nil);
- ASSERT(gpLetterTex != nil);
- gpLetterRaster = RwTextureGetRaster(gpLetterTex);
+ gpLeafTex[1] = RwTextureRead("letter", nil);
+ ASSERT(gpLeafTex[1] != nil);
+ gpLeafRaster[1] = RwTextureGetRaster(gpLeafTex[1]);
gpCloudTex1 = RwTextureRead("cloud3", nil);
ASSERT(gpCloudTex1 != nil);
@@ -555,7 +555,7 @@ void CParticle::Initialise()
break;
case PARTICLE_DEBRIS:
- entry->m_ppRaster = &gpLeafRaster;
+ entry->m_ppRaster = gpLeafRaster;
break;
case PARTICLE_DEBRIS2:
@@ -750,7 +750,7 @@ void CParticle::Initialise()
break;
case PARTICLE_TREE_LEAVES:
- entry->m_ppRaster = &gpLeafRaster;
+ entry->m_ppRaster = gpLeafRaster;
break;
case PARTICLE_CARCOLLISION_DUST:
@@ -929,11 +929,11 @@ void CParticle::Shutdown()
RwTextureDestroy(gpBloodTex);
gpBloodTex = nil;
- RwTextureDestroy(gpLeafTex);
- gpLeafTex = nil;
+ RwTextureDestroy(gpLeafTex[0]);
+ gpLeafTex[0] = nil;
- RwTextureDestroy(gpLetterTex);
- gpLetterTex = nil;
+ RwTextureDestroy(gpLeafTex[1]);
+ gpLeafTex[1] = nil;
RwTextureDestroy(gpCloudTex1);
gpCloudTex1 = nil;
@@ -1750,6 +1750,8 @@ void CParticle::Update()
void CParticle::Render()
{
+ PUSH_RENDERGROUP("CParticle::Render");
+
RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void *)rwTEXTUREADDRESSWRAP);
RwRenderStateSet(rwRENDERSTATETEXTUREPERSPECTIVE, (void *)TRUE);
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void *)FALSE);
@@ -2106,6 +2108,8 @@ void CParticle::Render()
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void *)TRUE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDINVSRCALPHA);
+
+ POP_RENDERGROUP();
}
void CParticle::RemovePSystem(tParticleType type)
diff --git a/src/render/ParticleMgr.cpp b/src/render/ParticleMgr.cpp
index 263c4ae1..04f42c82 100644
--- a/src/render/ParticleMgr.cpp
+++ b/src/render/ParticleMgr.cpp
@@ -17,12 +17,12 @@ cParticleSystemMgr::cParticleSystemMgr()
#endif
}
+#ifdef FIX_BUGS
cParticleSystemMgr::~cParticleSystemMgr()
{
-#ifdef FIX_BUGS
delete [] m_aParticles;
-#endif
}
+#endif
void cParticleSystemMgr::Initialise()
{
diff --git a/src/render/PointLights.cpp b/src/render/PointLights.cpp
index 3e73c57f..13872401 100644
--- a/src/render/PointLights.cpp
+++ b/src/render/PointLights.cpp
@@ -159,6 +159,8 @@ CPointLights::RenderFogEffect(void)
if(CCutsceneMgr::IsRunning())
return;
+ PUSH_RENDERGROUP("CPointLights::RenderFogEffect");
+
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
@@ -302,6 +304,8 @@ CPointLights::RenderFogEffect(void)
}
CSprite::FlushSpriteBuffer();
+
+ POP_RENDERGROUP();
}
bool
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 65fec400..85c52032 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -135,8 +135,13 @@ CRenderer::RenderOneRoad(CEntity *e)
return;
if(gbShowCollisionPolys)
CCollision::DrawColModel_Coloured(e->GetMatrix(), *CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel(), e->GetModelIndex());
- else
+ else{
+ PUSH_RENDERGROUP(CModelInfo::GetModelInfo(e->GetModelIndex())->GetModelName());
+
e->Render();
+
+ POP_RENDERGROUP();
+ }
}
void
@@ -183,6 +188,8 @@ CRenderer::RenderOneNonRoad(CEntity *e)
}
#endif
+ PUSH_RENDERGROUP(CModelInfo::GetModelInfo(e->GetModelIndex())->GetModelName());
+
resetLights = e->SetupLighting();
if(e->IsVehicle()){
@@ -211,6 +218,8 @@ CRenderer::RenderOneNonRoad(CEntity *e)
}
e->RemoveLighting(resetLights);
+
+ POP_RENDERGROUP();
}
void
@@ -236,6 +245,7 @@ CRenderer::RenderRoads(void)
int i;
CEntity *e;
+ PUSH_RENDERGROUP("CRenderer::RenderRoads");
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
SetCullMode(rwCULLMODECULLBACK);
@@ -247,6 +257,7 @@ CRenderer::RenderRoads(void)
if(IsRoad(e))
RenderOneRoad(e);
}
+ POP_RENDERGROUP();
}
inline bool PutIntoSortedVehicleList(CVehicle *veh)
@@ -269,6 +280,7 @@ CRenderer::RenderEverythingBarRoads(void)
CEntity *e;
EntityInfo ei;
+ PUSH_RENDERGROUP("CRenderer::RenderEverythingBarRoads");
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
SetCullMode(rwCULLMODECULLBACK);
@@ -300,6 +312,7 @@ CRenderer::RenderEverythingBarRoads(void)
}else
RenderOneNonRoad(e);
}
+ POP_RENDERGROUP();
}
void
@@ -307,6 +320,7 @@ CRenderer::RenderBoats(void)
{
CLink<EntityInfo> *node;
+ PUSH_RENDERGROUP("CRenderer::RenderBoats");
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
SetCullMode(rwCULLMODECULLBACK);
@@ -335,6 +349,7 @@ CRenderer::RenderBoats(void)
CVehicle *v = (CVehicle*)node->item.ent;
RenderOneNonRoad(v);
}
+ POP_RENDERGROUP();
}
#ifdef NEW_RENDERER
@@ -438,6 +453,7 @@ CRenderer::RenderWorld(int pass)
switch(pass){
case 0:
// Roads
+ PUSH_RENDERGROUP("CRenderer::RenderWorld - Roads");
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
for(i = 0; i < ms_nNoOfVisibleBuildings; i++){
e = ms_aVisibleBuildingPtrs[i];
@@ -451,9 +467,11 @@ CRenderer::RenderWorld(int pass)
if(e->bIsBIGBuilding || IsRoad(e))
RenderOneBuilding(e, node->item.sort);
}
+ POP_RENDERGROUP();
break;
case 1:
// Opaque
+ PUSH_RENDERGROUP("CRenderer::RenderWorld - Opaque");
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
for(i = 0; i < ms_nNoOfVisibleBuildings; i++){
e = ms_aVisibleBuildingPtrs[i];
@@ -474,14 +492,17 @@ CRenderer::RenderWorld(int pass)
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE);
WorldRender::RenderBlendPass(PASS_NOZ);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
+ POP_RENDERGROUP();
break;
case 2:
// Transparent
+ PUSH_RENDERGROUP("CRenderer::RenderWorld - Transparent");
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
WorldRender::RenderBlendPass(PASS_ADD);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
WorldRender::RenderBlendPass(PASS_BLEND);
+ POP_RENDERGROUP();
break;
}
}
@@ -492,11 +513,13 @@ CRenderer::RenderPeds(void)
int i;
CEntity *e;
+ PUSH_RENDERGROUP("CRenderer::RenderPeds");
for(i = 0; i < ms_nNoOfVisibleVehicles; i++){
e = ms_aVisibleVehiclePtrs[i];
if(e->IsPed())
RenderOneNonRoad(e);
}
+ POP_RENDERGROUP();
}
void
@@ -507,6 +530,7 @@ CRenderer::RenderVehicles(void)
EntityInfo ei;
CLink<EntityInfo> *node;
+ PUSH_RENDERGROUP("CRenderer::RenderVehicles");
// not the real thing
for(i = 0; i < ms_nNoOfVisibleVehicles; i++){
e = ms_aVisibleVehiclePtrs[i];
@@ -525,6 +549,7 @@ CRenderer::RenderVehicles(void)
RenderOneNonRoad(node->item.ent);
CFerry::RenderAllRemaning();
+ POP_RENDERGROUP();
}
void
@@ -533,6 +558,7 @@ CRenderer::RenderTransparentWater(void)
int i;
CEntity *e;
+ PUSH_RENDERGROUP("CRenderer::RenderTransparentWater");
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
@@ -556,6 +582,7 @@ CRenderer::RenderTransparentWater(void)
CWaterLevel::RenderTransparentWater();
SetStencilState(0);
+ POP_RENDERGROUP();
}
void
@@ -576,20 +603,24 @@ CRenderer::ClearForFrame(void)
void
CRenderer::RenderFadingInEntities(void)
{
+ PUSH_RENDERGROUP("CRenderer::RenderFadingInEntities");
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
SetCullMode(rwCULLMODECULLBACK);
DeActivateDirectional();
SetAmbientColours();
CVisibilityPlugins::RenderFadingEntities();
+ POP_RENDERGROUP();
}
void
CRenderer::RenderFadingInUnderwaterEntities(void)
{
+ PUSH_RENDERGROUP("CRenderer::RenderFadingInUnderwaterEntities");
DeActivateDirectional();
SetAmbientColours();
CVisibilityPlugins::RenderFadingUnderwaterEntities();
+ POP_RENDERGROUP();
}
void
@@ -1401,6 +1432,10 @@ CRenderer::ScanSectorPoly(RwV2d *poly, int32 numVertices, void (*scanfunc)(CPtrL
void
CRenderer::InsertEntityIntoList(CEntity *ent)
{
+#ifdef FIX_BUGS
+ if (!ent->m_rwObject) return;
+#endif
+
#ifdef NEW_RENDERER
// TODO: there are more flags being checked here
if(gbNewRenderer && (ent->IsVehicle() || ent->IsPed()))
diff --git a/src/render/Rubbish.cpp b/src/render/Rubbish.cpp
index bd69f875..147c97b1 100644
--- a/src/render/Rubbish.cpp
+++ b/src/render/Rubbish.cpp
@@ -54,6 +54,8 @@ CRubbish::Render(void)
if(RubbishVisibility == 0)
return;
+ PUSH_RENDERGROUP("CRubbish::Render");
+
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
@@ -150,6 +152,8 @@ CRubbish::Render(void)
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+
+ POP_RENDERGROUP();
}
void
diff --git a/src/render/Shadows.cpp b/src/render/Shadows.cpp
index ba902bae..ae4cf724 100644
--- a/src/render/Shadows.cpp
+++ b/src/render/Shadows.cpp
@@ -28,8 +28,8 @@
#include "VarConsole.h"
#ifdef DEBUGMENU
-SETTWEAKPATH("Shadows");
-TWEAKBOOL(gbPrintShite);
+//SETTWEAKPATH("Shadows");
+//TWEAKBOOL(gbPrintShite);
#endif
RwImVertexIndex ShadowIndexList[24];
@@ -1068,6 +1068,8 @@ CShadows::SetRenderModeForShadowType(uint8 ShadowType)
void
CShadows::RenderStoredShadows(void)
{
+ PUSH_RENDERGROUP("CShadows::RenderStoredShadows");
+
RenderBuffer::ClearRenderBuffer();
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)FALSE);
@@ -1241,12 +1243,16 @@ CShadows::RenderStoredShadows(void)
RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void *)rwTEXTUREADDRESSWRAP);
ShadowsStoredToBeRendered = 0;
+
+ POP_RENDERGROUP();
}
void
CShadows::RenderStaticShadows(void)
{
+ PUSH_RENDERGROUP("CShadows::RenderStaticShadows");
+
RenderBuffer::ClearRenderBuffer();
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)FALSE);
@@ -1313,6 +1319,8 @@ CShadows::RenderStaticShadows(void)
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)FALSE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)TRUE);
+
+ POP_RENDERGROUP();
}
@@ -1398,7 +1406,7 @@ CShadows::CastShadowSectorList(CPtrList &PtrList, float fStartX, float fStartY,
{
pEntity->m_scanCode = CWorld::GetCurrentScanCode();
- if ( pEntity->bUsesCollision && !pEntity->m_flagE2 )
+ if ( pEntity->bUsesCollision && !pEntity->bDontCastShadowsOn)
{
if ( IsAreaVisible(pEntity->m_area) )
{
diff --git a/src/render/Skidmarks.cpp b/src/render/Skidmarks.cpp
index 07039c17..08df330d 100644
--- a/src/render/Skidmarks.cpp
+++ b/src/render/Skidmarks.cpp
@@ -96,6 +96,8 @@ CSkidmarks::Render(void)
{
int i, j;
+ PUSH_RENDERGROUP("CSkidmarks::Render");
+
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
@@ -152,6 +154,8 @@ CSkidmarks::Render(void)
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
+
+ POP_RENDERGROUP();
}
void
diff --git a/src/render/SpecialFX.cpp b/src/render/SpecialFX.cpp
index 161bf168..e27a783e 100644
--- a/src/render/SpecialFX.cpp
+++ b/src/render/SpecialFX.cpp
@@ -164,6 +164,7 @@ CSpecialFX::Shutdown(void)
void
CSpecialFX::Render(void)
{
+ PUSH_RENDERGROUP("CSpecialFX::Render");
CMotionBlurStreaks::Render();
CBulletTraces::Render();
CBrightLights::Render();
@@ -173,6 +174,7 @@ CSpecialFX::Render(void)
if(!(gbNewRenderer && FredIsInFirstPersonCam()))
#endif
C3dMarkers::Render();
+ POP_RENDERGROUP();
}
void
diff --git a/src/render/WaterCannon.cpp b/src/render/WaterCannon.cpp
index 65d8b388..4aaa8d6f 100644
--- a/src/render/WaterCannon.cpp
+++ b/src/render/WaterCannon.cpp
@@ -266,7 +266,7 @@ void CWaterCannon::PushPeds(void)
ped->m_vecMoveSpeed.x *= (0.2f / pedSpeed2D);
ped->m_vecMoveSpeed.y *= (0.2f / pedSpeed2D);
}
- ped->SetFall(2000, (AnimationId)(localDir + ANIM_KO_SKID_FRONT), 0);
+ ped->SetFall(2000, (AnimationId)(localDir + ANIM_STD_HIGHIMPACT_FRONT), 0);
CParticle::AddParticle(PARTICLE_STEAM_NY_SLOWMOTION, ped->GetPosition(), ped->m_vecMoveSpeed * 0.3f, 0, 0.5f);
CParticle::AddParticle(PARTICLE_CAR_SPLASH, ped->GetPosition(), ped->m_vecMoveSpeed * -0.3f + CVector(0.f, 0.f, 0.5f), 0, 0.5f,
CGeneral::GetRandomNumberInRange(0.f, 10.f), CGeneral::GetRandomNumberInRange(0.f, 90.f), 1);
@@ -331,9 +331,11 @@ void CWaterCannons::Update(void)
void CWaterCannons::Render(void)
{
+ PUSH_RENDERGROUP("CWaterCannons::Render");
for ( int32 i = 0; i < NUM_WATERCANNONS; i++ )
{
if ( aCannons[i].m_nId != 0 )
aCannons[i].Render();
}
+ POP_RENDERGROUP();
}
diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp
index 6247c611..759a3595 100644
--- a/src/render/WaterLevel.cpp
+++ b/src/render/WaterLevel.cpp
@@ -73,7 +73,7 @@ RwRaster *gpWaterEnvBaseRaster;
RwRaster *gpWaterWakeRaster;
bool _bSeaLife;
-float _fWaterZOffset = 0.5f;
+float _fWaterZOffset = WATER_Z_OFFSET;
#ifdef PC_WATER
float fEnvScale = 0.25f;
@@ -318,6 +318,7 @@ CWaterLevel::Shutdown()
_DELETE_TEXTURE(gpWaterTex);
_DELETE_TEXTURE(gpWaterEnvTex);
+ _DELETE_TEXTURE(gpWaterWakeTex);
_DELETE_TEXTURE(gpWaterEnvBaseTex);
#undef _DELETE_TEXTURE
@@ -610,14 +611,14 @@ CWaterLevel::TestVisibilityForFineWaterBlocks(const CVector &worldPos)
if ((lineEnd.x > WORLD_MIN_X && lineEnd.x < WORLD_MAX_X) && (lineEnd.y > WORLD_MIN_Y && lineEnd.y < WORLD_MAX_Y))
{
- if (!CWorld::ProcessLineOfSight(lineStart, lineEnd, col, entity, true, false, false, false, true, false, nil))
+ if (!CWorld::ProcessLineOfSight(lineStart, lineEnd, col, entity, true, false, false, false, true, false))
{
lineStart.x += 0.4f;
lineStart.y += 0.4f;
lineEnd.x += 0.4f;
lineEnd.y += 0.4f;
- if (!CWorld::ProcessLineOfSight(lineStart, lineEnd, col, entity, true, false, false, false, true, false, nil))
+ if (!CWorld::ProcessLineOfSight(lineStart, lineEnd, col, entity, true, false, false, false, true, false))
{
return false;
}
@@ -714,9 +715,9 @@ CWaterLevel::GetWaterLevel(float fX, float fY, float fZ, float *pfOutLevel, bool
if ( y < 0 || y >= MAX_SMALL_SECTORS ) return false;
#endif
- uint8 nBlock = aWaterFineBlockList[x][y];
+ int8 nBlock = aWaterFineBlockList[x][y];
- if ( nBlock == 0x80 )
+ if ( nBlock == NO_WATER )
return false;
ASSERT( pfOutLevel != nil );
@@ -756,9 +757,9 @@ CWaterLevel::GetWaterLevelNoWaves(float fX, float fY, float fZ, float *pfOutLeve
if ( y < 0 || y >= MAX_SMALL_SECTORS ) return false;
#endif
- uint8 nBlock = aWaterFineBlockList[x][y];
+ int8 nBlock = aWaterFineBlockList[x][y];
- if ( nBlock == 0x80 )
+ if ( nBlock == NO_WATER )
return false;
ASSERT( pfOutLevel != nil );
@@ -1013,7 +1014,7 @@ CWaterLevel::RenderWater()
if ( fHugeSectorMaxRenderDistSqr > fHugeSectorDistToCamSqr )
{
- if ( TheCamera.IsSphereVisible(CVector(vecHugeSectorCentre.x, vecHugeSectorCentre.y, 0.0f), SectorRadius(HUGE_SECTOR_SIZE), &TheCamera.GetCameraMatrix()) )
+ if ( TheCamera.IsSphereVisible(CVector(vecHugeSectorCentre.x, vecHugeSectorCentre.y, 0.0f), SectorRadius(HUGE_SECTOR_SIZE)) )
{
#ifndef PC_WATER
WavesCalculatedThisFrame = true;
@@ -1076,7 +1077,7 @@ CWaterLevel::RenderWater()
{
for ( int32 y = 0; y < 5; y++ )
{
- float fX = WATER_SIGN_X(float(x) * EXTRAHUGE_SECTOR_SIZE) - 1280.0f - 400.0f;
+ float fX = WATER_SIGN_X(float(x) * EXTRAHUGE_SECTOR_SIZE) - 1280.0f - WATER_X_OFFSET;
float fY = WATER_SIGN_Y(float(y) * EXTRAHUGE_SECTOR_SIZE) - 1280.0f;
if ( !bUseCamStartY )
@@ -1087,7 +1088,7 @@ CWaterLevel::RenderWater()
if ( fCamDistToSector < fHugeSectorMaxRenderDistSqr )
{
- if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.y, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE), &TheCamera.GetCameraMatrix()) )
+ if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.y, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE)) )
{
RenderOneFlatExtraHugeWaterPoly(
vecExtraHugeSectorCentre.x - EXTRAHUGE_SECTOR_SIZE/2,
@@ -1106,7 +1107,7 @@ CWaterLevel::RenderWater()
if ( fCamDistToSector < fHugeSectorMaxRenderDistSqr )
{
- if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.y, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE), &TheCamera.GetCameraMatrix()) )
+ if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.y, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE)) )
{
RenderOneFlatExtraHugeWaterPoly(
vecExtraHugeSectorCentre.x - EXTRAHUGE_SECTOR_SIZE/2,
@@ -1135,7 +1136,7 @@ CWaterLevel::RenderWater()
if ( fCamDistToSector < fHugeSectorMaxRenderDistSqr )
{
- if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.y, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE), &TheCamera.GetCameraMatrix()) )
+ if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.y, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE)) )
{
RenderOneFlatExtraHugeWaterPoly(
vecExtraHugeSectorCentre.x - EXTRAHUGE_SECTOR_SIZE/2,
@@ -1154,7 +1155,7 @@ CWaterLevel::RenderWater()
if ( fCamDistToSector < fHugeSectorMaxRenderDistSqr )
{
- if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.x, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE), &TheCamera.GetCameraMatrix()) )
+ if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.x, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE)) )
{
RenderOneFlatExtraHugeWaterPoly(
vecExtraHugeSectorCentre.x - EXTRAHUGE_SECTOR_SIZE/2,
@@ -1201,6 +1202,8 @@ CWaterLevel::RenderTransparentWater(void)
if ( !CGame::CanSeeWaterFromCurrArea() )
return;
+ PUSH_RENDERGROUP("CWaterLevel::RenderTransparentWater");
+
float fWaterDrawDist = _GetWavyDrawDist();
float fWaterDrawDistLarge = fWaterDrawDist + 90.0f;
float fWavySectorMaxRenderDistSqr = SQR(fWaterDrawDist);
@@ -1284,7 +1287,7 @@ CWaterLevel::RenderTransparentWater(void)
if ( fHugeSectorMaxRenderDistSqr > fHugeSectorDistToCamSqr )
{
- if ( TheCamera.IsSphereVisible(CVector(vecHugeSectorCentre.x, vecHugeSectorCentre.y, 0.0f), SectorRadius(HUGE_SECTOR_SIZE), &TheCamera.GetCameraMatrix()) )
+ if ( TheCamera.IsSphereVisible(CVector(vecHugeSectorCentre.x, vecHugeSectorCentre.y, 0.0f), SectorRadius(HUGE_SECTOR_SIZE)) )
{
if ( fHugeSectorDistToCamSqr >= SQR(500.0f) )
{
@@ -1308,7 +1311,7 @@ CWaterLevel::RenderTransparentWater(void)
if ( fLargeSectorDistToCamSqr < fHugeSectorMaxRenderDistSqr )
{
- if ( TheCamera.IsSphereVisible(CVector(vecLargeSectorCentre.x, vecLargeSectorCentre.y, 0.0f), SectorRadius(LARGE_SECTOR_SIZE), &TheCamera.GetCameraMatrix()) )
+ if ( TheCamera.IsSphereVisible(CVector(vecLargeSectorCentre.x, vecLargeSectorCentre.y, 0.0f), SectorRadius(LARGE_SECTOR_SIZE)) )
{
// Render four small(32x32) sectors, or one large(64x64).
@@ -1462,7 +1465,7 @@ CWaterLevel::RenderTransparentWater(void)
int32 nBlock;
- int32 BlockX = WATER_TO_SMALL_SECTOR_X(fCamX + 400.0f) + 1;
+ int32 BlockX = WATER_TO_SMALL_SECTOR_X(fCamX + WATER_X_OFFSET) + 1;
int32 BlockY = WATER_TO_SMALL_SECTOR_Y(fCamY) + 1;
if (_IsColideWithBlock(BlockX, BlockY, nBlock))
@@ -1472,7 +1475,7 @@ CWaterLevel::RenderTransparentWater(void)
float fMaskX = Floor(fCamX / 2.0f) * 2.0f;
float fMaskY = Floor(fCamY / 2.0f) * 2.0f;
float fWaterZ = CWaterLevel::ms_aWaterZs[nBlock];
- float fSectorX = WATER_FROM_SMALL_SECTOR_X(BlockX) - 400.0f;
+ float fSectorX = WATER_FROM_SMALL_SECTOR_X(BlockX) - WATER_X_OFFSET;
float fSectorY = WATER_FROM_SMALL_SECTOR_Y(BlockY);
RenderWavyMask(fMaskX, fMaskY, fWaterZ,
@@ -1484,6 +1487,8 @@ CWaterLevel::RenderTransparentWater(void)
DefinedState();
#endif
+
+ POP_RENDERGROUP();
}
void CWaterLevel::RenderOneFlatSmallWaterPoly(float fX, float fY, float fZ, RwRGBA const &color)
@@ -3193,7 +3198,7 @@ CWaterLevel::HandleBeachToysStuff(void)
vecPos.x += (fCos - fSin) * fAngle;
vecPos.y += (fSin + fCos) * fAngle;
- if ( TheCamera.IsSphereVisible(vecPos, 1.0f, &TheCamera.GetCameraMatrix()) )
+ if ( TheCamera.IsSphereVisible(vecPos, 1.0f) )
{
float fWaterLevel;
@@ -3237,7 +3242,7 @@ CWaterLevel::HandleBeachToysStuff(void)
vecPos.x += (fCos - fSin) * fAngle;
vecPos.y += (fSin + fCos) * fAngle;
- if ( TheCamera.IsSphereVisible(vecPos, 2.0f, &TheCamera.GetCameraMatrix()) )
+ if ( TheCamera.IsSphereVisible(vecPos, 2.0f) )
{
float fWaterLevel;
diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp
index 65343a61..8718e1c6 100644
--- a/src/render/Weather.cpp
+++ b/src/render/Weather.cpp
@@ -142,7 +142,7 @@ void CWeather::Init(void)
ForcedWeatherType = WEATHER_RANDOM;
SoundHandle = DMAudio.CreateEntity(AUDIOTYPE_WEATHER, (void*)1);
if (SoundHandle >= 0)
- DMAudio.SetEntityStatus(SoundHandle, true);
+ DMAudio.SetEntityStatus(SoundHandle, TRUE);
}
void CWeather::Update(void)