summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-04-09 03:31:46 +0200
committerSergeanur <s.anureev@yandex.ua>2021-04-09 03:31:46 +0200
commit519218572a1303f6717bbc2cccc45d0c8a272d33 (patch)
tree50ae3120394891b6810ede249c8a71811c0591bc /src/core
parentMerge branch 'miami' into lcs (diff)
parentupdate librw (diff)
downloadre3-519218572a1303f6717bbc2cccc45d0c8a272d33.tar
re3-519218572a1303f6717bbc2cccc45d0c8a272d33.tar.gz
re3-519218572a1303f6717bbc2cccc45d0c8a272d33.tar.bz2
re3-519218572a1303f6717bbc2cccc45d0c8a272d33.tar.lz
re3-519218572a1303f6717bbc2cccc45d0c8a272d33.tar.xz
re3-519218572a1303f6717bbc2cccc45d0c8a272d33.tar.zst
re3-519218572a1303f6717bbc2cccc45d0c8a272d33.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/Game.cpp10
-rw-r--r--src/core/Pools.cpp2
-rw-r--r--src/core/Radar.cpp181
-rw-r--r--src/core/Streaming.cpp6
-rw-r--r--src/core/main.cpp9
-rw-r--r--src/core/re3.cpp5
6 files changed, 142 insertions, 71 deletions
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index edd4d7cf..8dee29e2 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -245,10 +245,16 @@ CGame::InitialiseRenderWare(void)
#ifdef LIBRW
#ifdef PS2_MATFX
- rw::MatFX::modulateEnvMap = true;
+ rw::MatFX::envMapApplyLight = true;
+ rw::MatFX::envMapUseMatColor = true;
+ rw::MatFX::envMapFlipU = true;
#else
- rw::MatFX::modulateEnvMap = false;
+ rw::MatFX::envMapApplyLight = false;
+ rw::MatFX::envMapUseMatColor = false;
+ rw::MatFX::envMapFlipU = false;
#endif
+ rw::RGBA envcol = { 64, 64, 64, 255 };
+ rw::MatFX::envMapColor = envcol;
#else
#ifdef PS2_MATFX
ReplaceMatFxCallback();
diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp
index bf35f8ef..d824d498 100644
--- a/src/core/Pools.cpp
+++ b/src/core/Pools.cpp
@@ -105,7 +105,7 @@ CPools::CheckPoolsEmpty()
printf("pools have been cleared\n");
}
-
+// Thankfully unused, it would break the game!
void
CPools::MakeSureSlotInObjectPoolIsEmpty(int32 slot)
{
diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp
index e17c01a1..1be7d2fa 100644
--- a/src/core/Radar.cpp
+++ b/src/core/Radar.cpp
@@ -239,6 +239,75 @@ void GetTextureCorners(int32 x, int32 y, CVector2D *out)
out[3].y = RADAR_TILE_SIZE * (y);
}
+uint8 CRadar::CalculateBlipAlpha(float dist)
+{
+ if (FrontEndMenuManager.m_bMenuMapActive)
+ return 255;
+
+ if (dist <= 1.0f)
+ return 255;
+
+ if (dist <= 10.0f)
+ return (128.0f * ((dist - 1.0f) / 9.0f)) + ((1.0f - (dist - 1.0f) / 9.0f) * 255.0f);
+
+ return 128;
+}
+
+void CRadar::ChangeBlipBrightness(int32 i, int32 bright)
+{
+ int index = GetActualBlipArrayIndex(i);
+ if (index != -1)
+ ms_RadarTrace[index].m_bDim = bright != 1;
+}
+
+void CRadar::ChangeBlipColour(int32 i, int32 color)
+{
+ int index = GetActualBlipArrayIndex(i);
+ if (index != -1)
+ ms_RadarTrace[index].m_nColor = color;
+}
+
+void CRadar::ChangeBlipDisplay(int32 i, eBlipDisplay display)
+{
+ int index = GetActualBlipArrayIndex(i);
+ if (index != -1)
+ ms_RadarTrace[index].m_eBlipDisplay = display;
+}
+
+void CRadar::ChangeBlipScale(int32 i, int32 scale)
+{
+ int index = GetActualBlipArrayIndex(i);
+ if (index != -1)
+ ms_RadarTrace[index].m_wScale = scale;
+}
+
+void CRadar::ClearBlip(int32 i)
+{
+ int index = GetActualBlipArrayIndex(i);
+ if (index != -1) {
+ SetRadarMarkerState(index, false);
+ ms_RadarTrace[index].m_bInUse = false;
+ ms_RadarTrace[index].m_eBlipType = BLIP_NONE;
+ ms_RadarTrace[index].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
+ ms_RadarTrace[index].m_eRadarSprite = RADAR_SPRITE_NONE;
+ }
+}
+
+void CRadar::ClearBlipForEntity(eBlipType type, int32 id)
+{
+ for (int i = 0; i < NUMRADARBLIPS; i++) {
+ if (type == ms_RadarTrace[i].m_eBlipType && id == ms_RadarTrace[i].m_nEntityHandle) {
+ SetRadarMarkerState(i, false);
+ ms_RadarTrace[i].m_bInUse = false;
+ ms_RadarTrace[i].m_eBlipType = BLIP_NONE;
+ ms_RadarTrace[i].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
+ ms_RadarTrace[i].m_eRadarSprite = RADAR_SPRITE_NONE;
+ }
+ };
+}
+
+// Why not a proper clipping algorithm?
+#ifdef THIS_IS_STUPID
bool IsPointInsideRadar(const CVector2D &point)
{
@@ -319,74 +388,6 @@ int LineRadarBoxCollision(CVector2D &out, const CVector2D &p1, const CVector2D &
return edge;
}
-uint8 CRadar::CalculateBlipAlpha(float dist)
-{
- if (FrontEndMenuManager.m_bMenuMapActive)
- return 255;
-
- if (dist <= 1.0f)
- return 255;
-
- if (dist <= 10.0f)
- return (128.0f * ((dist - 1.0f) / 9.0f)) + ((1.0f - (dist - 1.0f) / 9.0f) * 255.0f);
-
- return 128;
-}
-
-void CRadar::ChangeBlipBrightness(int32 i, int32 bright)
-{
- int index = GetActualBlipArrayIndex(i);
- if (index != -1)
- ms_RadarTrace[index].m_bDim = bright != 1;
-}
-
-void CRadar::ChangeBlipColour(int32 i, int32 color)
-{
- int index = GetActualBlipArrayIndex(i);
- if (index != -1)
- ms_RadarTrace[index].m_nColor = color;
-}
-
-void CRadar::ChangeBlipDisplay(int32 i, eBlipDisplay display)
-{
- int index = GetActualBlipArrayIndex(i);
- if (index != -1)
- ms_RadarTrace[index].m_eBlipDisplay = display;
-}
-
-void CRadar::ChangeBlipScale(int32 i, int32 scale)
-{
- int index = GetActualBlipArrayIndex(i);
- if (index != -1)
- ms_RadarTrace[index].m_wScale = scale;
-}
-
-void CRadar::ClearBlip(int32 i)
-{
- int index = GetActualBlipArrayIndex(i);
- if (index != -1) {
- SetRadarMarkerState(index, false);
- ms_RadarTrace[index].m_bInUse = false;
- ms_RadarTrace[index].m_eBlipType = BLIP_NONE;
- ms_RadarTrace[index].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
- ms_RadarTrace[index].m_eRadarSprite = RADAR_SPRITE_NONE;
- }
-}
-
-void CRadar::ClearBlipForEntity(eBlipType type, int32 id)
-{
- for (int i = 0; i < NUMRADARBLIPS; i++) {
- if (type == ms_RadarTrace[i].m_eBlipType && id == ms_RadarTrace[i].m_nEntityHandle) {
- SetRadarMarkerState(i, false);
- ms_RadarTrace[i].m_bInUse = false;
- ms_RadarTrace[i].m_eBlipType = BLIP_NONE;
- ms_RadarTrace[i].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
- ms_RadarTrace[i].m_eRadarSprite = RADAR_SPRITE_NONE;
- }
- };
-}
-
-// Why not a proper clipping algorithm?
int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect)
{
CVector2D corners[4] = {
@@ -465,6 +466,50 @@ int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect)
return n;
}
+#else
+
+int
+ClipPolyPlane(const CVector2D *in, int nin, CVector2D *out, CVector *plane)
+{
+ int j;
+ int nout;
+ int x1, x2;
+ float d1, d2, t;
+
+ nout = 0;
+ for(j = 0; j < nin; j++){
+ x1 = j;
+ x2 = (j+1) % nin;
+
+ d1 = plane->x*in[x1].x + plane->y*in[x1].y + plane->z;
+ d2 = plane->x*in[x2].x + plane->y*in[x2].y + plane->z;
+ if(d1*d2 < 0.0f){
+ t = d1/(d1 - d2);
+ out[nout++] = in[x1]*(1.0f-t) + in[x2]*t;
+ }
+ if(d2 >= 0.0f)
+ out[nout++] = in[x2];
+ }
+ return nout;
+}
+
+int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect)
+{
+ CVector planes[4] = {
+ CVector(-1.0f, 0.0f, 1.0f),
+ CVector( 1.0f, 0.0f, 1.0f),
+ CVector(0.0f, -1.0f, 1.0f),
+ CVector(0.0f, 1.0f, 1.0f)
+ };
+ CVector2D tmp[8];
+ int n;
+ if(n = ClipPolyPlane(rect, 4, tmp, &planes[0]), n == 0) return 0;
+ if(n = ClipPolyPlane(tmp, n, poly, &planes[1]), n == 0) return 0;
+ if(n = ClipPolyPlane(poly, n, tmp, &planes[2]), n == 0) return 0;
+ if(n = ClipPolyPlane(tmp, n, poly, &planes[3]), n == 0) return 0;
+ return n;
+}
+#endif
bool CRadar::DisplayThisBlip(int32 counter)
{
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index bff832c3..39443410 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -1763,7 +1763,13 @@ CStreaming::StreamVehiclesAndPeds(void)
for(i = 0; i < CCarCtrl::TOTAL_CUSTOM_CLASSES; i++){
if(CCarCtrl::NumRequestsOfCarRating[i] > maxReq &&
((i == 0 && zone.carThreshold[0] != 0) ||
+#ifdef FIX_BUGS
+ (i < CCarCtrl::NUM_CAR_CLASSES && zone.carThreshold[i] != zone.carThreshold[i-1]) ||
+ (i == CCarCtrl::NUM_CAR_CLASSES && zone.boatThreshold[i - CCarCtrl::NUM_CAR_CLASSES] != 0) ||
+ (i > CCarCtrl::NUM_CAR_CLASSES && i < CCarCtrl::TOTAL_CUSTOM_CLASSES && zone.boatThreshold[i - CCarCtrl::NUM_CAR_CLASSES] != zone.boatThreshold[i - CCarCtrl::NUM_CAR_CLASSES - 1]))) {
+#else
(i != 0 && zone.carThreshold[i] != zone.carThreshold[i-1]))) {
+#endif
maxReq = CCarCtrl::NumRequestsOfCarRating[i];
mostRequestedRating = i;
}
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 49c9a8e6..e8188cec 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -1297,10 +1297,12 @@ void
RenderEffects_new(void)
{
PUSH_RENDERGROUP("RenderEffects_new");
+/* // stupid to do this before the whole world is drawn!
CShadows::RenderStaticShadows();
CShadows::RenderStoredShadows();
CSkidmarks::Render();
CRubbish::Render();
+*/
// these aren't really effects
DefinedState();
@@ -1323,6 +1325,13 @@ if(gbRenderFadingInEntities)
CRenderer::RenderFadingInEntities();
// actual effects here
+
+ // from above
+ CShadows::RenderStaticShadows();
+ CShadows::RenderStoredShadows();
+ CSkidmarks::Render();
+ CRubbish::Render();
+
CGlass::Render();
// CMattRenderer::ResetRenderStates
DefinedState();
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 27382c98..34976822 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -1029,6 +1029,11 @@ extern bool gbRenderWorld2;
#ifndef MASTER
DebugMenuAddVarBool8("Render", "Occlusion debug", &bDispayOccDebugStuff, nil);
#endif
+#ifdef LIBRW
+ DebugMenuAddVarBool32("Render", "MatFX env map apply light", &rw::MatFX::envMapApplyLight, nil);
+ DebugMenuAddVarBool32("Render", "MatFX env map flip U", &rw::MatFX::envMapFlipU, nil);
+ DebugMenuAddVarBool32("Render", "MatFX env map use matcolor", &rw::MatFX::envMapUseMatColor, nil);
+#endif
#ifdef EXTENDED_PIPELINES
static const char *worldpipenames[] = { "PSP", "PS2", "Mobile" };
e = DebugMenuAddVar("Render", "World Rendering", &CustomPipes::WorldPipeSwitch, nil,