summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md6
m---------librw0
-rw-r--r--src/core/config.h2
-rw-r--r--src/fakerw/fake.cpp2
-rw-r--r--src/render/Renderer.cpp25
-rw-r--r--src/vehicles/Plane.cpp42
-rw-r--r--src/vehicles/Plane.h9
7 files changed, 74 insertions, 12 deletions
diff --git a/README.md b/README.md
index e96afb58..114c5e19 100644
--- a/README.md
+++ b/README.md
@@ -30,8 +30,12 @@ Currently only building on VS2015/2017/2019 (Windows) and GCC (Linux) is tested.
- On Windows: one of the `premake-vsXXXX.cmd` variants on root folder
- On Linux: proceed to [Building on Linux](https://github.com/GTAmodding/re3/wiki/Building-on-Linux).
- There are various settings at the very bottom of [config.h](https://github.com/GTAmodding/re3/tree/master/src/core/config.h), you may want to take a look there. i.e. FIX_BUGS define fixes the bugs we've come across.
+- **If you use 64-bit D3D9**: We don't ship 64-bit Dx9 SDK. You need to download it from Microsoft if you don't have it(although it should come pre-installed after some Windows version)
-> :information_source: **Rendering engine** re3 uses completely homebrew RenderWare-replacement rendering engine; [librw](https://github.com/aap/librw/). librw comes as submodule of re3, but you also can use LIBRW enviorenment variable to specify path to your own librw.
+
+> :information_source: **If you choose OpenAL(OAL) on Windows** You must read [Running OAL build on Windows](https://github.com/GTAmodding/re3/wiki/Running-OAL-build-on-Windows).
+
+> :information_source: **Did you notice librw?** re3 uses completely homebrew RenderWare-replacement rendering engine; [librw](https://github.com/aap/librw/). librw comes as submodule of re3, but you also can use LIBRW enviorenment variable to specify path to your own librw.
## Contributing
diff --git a/librw b/librw
-Subproject 556f6af1b5a15d5ba1a2254a95076578cd16018
+Subproject 4883b03f2b8f060c04f054573e8f345878e93a1
diff --git a/src/core/config.h b/src/core/config.h
index 4110b131..e67db1a3 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -273,7 +273,7 @@ enum Config {
// Vehicles
#define EXPLODING_AIRTRAIN // can blow up jumbo jet with rocket launcher
-//#define REMOVE_TREADABLE_PATHFIND
+#define CPLANE_ROTORS // make the rotors of the NPC police heli rotate
// Pickups
//#define MONEY_MESSAGES
diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp
index 7a2b136e..0bc69abe 100644
--- a/src/fakerw/fake.cpp
+++ b/src/fakerw/fake.cpp
@@ -308,7 +308,7 @@ ConvertTexRaster(rw::Raster *ras)
Image *img = ras->toImage();
ras->destroy();
- img->unindex();
+ img->unpalettize();
ras = Raster::createFromImage(img);
img->destroy();
return ras;
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index bd8545ee..0640f25e 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -317,7 +317,11 @@ enum Visbility
VIS_STREAMME
};
+#ifdef FIX_BUGS
+#define LOD_DISTANCE (300.0f*TheCamera.LODDistMultiplier)
+#else
#define LOD_DISTANCE 300.0f
+#endif
#define FADE_DISTANCE 20.0f
#define STREAM_DISTANCE 30.0f
@@ -419,6 +423,8 @@ CRenderer::SetupEntityVisibility(CEntity *ent)
// whose draw dist is > LOD_DISTANCE-FADE_DISTANCE, i.e. 280
// because decreasing dist here makes the object visible above LOD_DISTANCE
// before fading normally once below LOD_DISTANCE.
+ // aha! this must be a workaround for the fact that we're not taking
+ // the LOD multiplier into account here anywhere
if(LOD_DISTANCE < dist && dist < mi->GetLargestLodDistance() + FADE_DISTANCE)
dist += mi->GetLargestLodDistance() - LOD_DISTANCE;
#endif
@@ -751,14 +757,7 @@ CRenderer::ScanWorld(void)
}else
#endif
{
- if(f <= LOD_DISTANCE){
- poly[0].x = CWorld::GetSectorX(vectors[CORNER_CAM].x);
- poly[0].y = CWorld::GetSectorY(vectors[CORNER_CAM].y);
- poly[1].x = CWorld::GetSectorX(vectors[CORNER_FAR_TOPLEFT].x);
- poly[1].y = CWorld::GetSectorY(vectors[CORNER_FAR_TOPLEFT].y);
- poly[2].x = CWorld::GetSectorX(vectors[CORNER_FAR_TOPRIGHT].x);
- poly[2].y = CWorld::GetSectorY(vectors[CORNER_FAR_TOPRIGHT].y);
- }else{
+ if(f > LOD_DISTANCE){
// priority
poly[0].x = CWorld::GetSectorX(vectors[CORNER_CAM].x);
poly[0].y = CWorld::GetSectorY(vectors[CORNER_CAM].y);
@@ -775,8 +774,16 @@ CRenderer::ScanWorld(void)
poly[1].y = CWorld::GetSectorY(vectors[CORNER_LOD_LEFT].y);
poly[2].x = CWorld::GetSectorX(vectors[CORNER_LOD_RIGHT].x);
poly[2].y = CWorld::GetSectorY(vectors[CORNER_LOD_RIGHT].y);
+ ScanSectorPoly(poly, 3, ScanSectorList);
+ }else{
+ poly[0].x = CWorld::GetSectorX(vectors[CORNER_CAM].x);
+ poly[0].y = CWorld::GetSectorY(vectors[CORNER_CAM].y);
+ poly[1].x = CWorld::GetSectorX(vectors[CORNER_FAR_TOPLEFT].x);
+ poly[1].y = CWorld::GetSectorY(vectors[CORNER_FAR_TOPLEFT].y);
+ poly[2].x = CWorld::GetSectorX(vectors[CORNER_FAR_TOPRIGHT].x);
+ poly[2].y = CWorld::GetSectorY(vectors[CORNER_FAR_TOPRIGHT].y);
+ ScanSectorPoly(poly, 3, ScanSectorList);
}
- ScanSectorPoly(poly, 3, ScanSectorList);
ScanBigBuildingList(CWorld::GetBigBuildingList(CGame::currLevel));
ScanBigBuildingList(CWorld::GetBigBuildingList(LEVEL_GENERIC));
diff --git a/src/vehicles/Plane.cpp b/src/vehicles/Plane.cpp
index a3754854..ffe9ffbf 100644
--- a/src/vehicles/Plane.cpp
+++ b/src/vehicles/Plane.cpp
@@ -16,6 +16,7 @@
#include "Fluff.h"
#include "World.h"
#include "HandlingMgr.h"
+#include "Heli.h"
#include "Plane.h"
//--MIAMI: file done
@@ -88,6 +89,9 @@ CPlane::CPlane(int32 id, uint8 CreatedBy)
m_level = LEVEL_GENERIC;
m_isFarAway = false;
+#ifdef CPLANE_ROTORS
+ m_fRotorRotation = 0.0f;
+#endif
}
CPlane::~CPlane()
@@ -99,6 +103,21 @@ void
CPlane::SetModelIndex(uint32 id)
{
CVehicle::SetModelIndex(id);
+#ifdef CPLANE_ROTORS
+ int i;
+ for(i = 0; i < NUM_PLANE_NODES; i++)
+ m_aPlaneNodes[i] = nil;
+ if(GetModelIndex() == MI_CHOPPER){
+ // This is surprisingly annoying...
+ RwFrame *heliNodes[NUM_HELI_NODES];
+ for(i = 0; i < NUM_HELI_NODES; i++)
+ heliNodes[i] = nil;
+ CClumpModelInfo::FillFrameArray(GetClump(), heliNodes);
+ m_aPlaneNodes[PLANE_TOPROTOR] = heliNodes[HELI_TOPROTOR];
+ m_aPlaneNodes[PLANE_BACKROTOR] = heliNodes[HELI_BACKROTOR];
+ }else
+ CClumpModelInfo::FillFrameArray(GetClump(), m_aPlaneNodes);
+#endif
}
void
@@ -629,6 +648,29 @@ CPlane::PreRender(void)
CCoronas::TYPE_NORMAL, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.0f);
}
+
+#ifdef CPLANE_ROTORS
+ CMatrix mat;
+ CVector pos;
+ m_fRotorRotation += 3.14f/6.5f;
+ if(m_fRotorRotation > 6.28f)
+ m_fRotorRotation -= 6.28f;
+
+ if(m_aPlaneNodes[PLANE_TOPROTOR]){
+ mat.Attach(RwFrameGetMatrix(m_aPlaneNodes[PLANE_TOPROTOR]));
+ pos = mat.GetPosition();
+ mat.SetRotateZ(m_fRotorRotation);
+ mat.Translate(pos);
+ mat.UpdateRW();
+ }
+ if(m_aPlaneNodes[PLANE_BACKROTOR]){
+ mat.Attach(RwFrameGetMatrix(m_aPlaneNodes[PLANE_BACKROTOR]));
+ pos = mat.GetPosition();
+ mat.SetRotateX(m_fRotorRotation);
+ mat.Translate(pos);
+ mat.UpdateRW();
+ }
+#endif
}
void
diff --git a/src/vehicles/Plane.h b/src/vehicles/Plane.h
index 5fb05468..c8f02048 100644
--- a/src/vehicles/Plane.h
+++ b/src/vehicles/Plane.h
@@ -4,6 +4,11 @@
enum ePlaneNodes
{
+#ifdef CPLANE_ROTORS
+ // for heli
+ PLANE_TOPROTOR,
+ PLANE_BACKROTOR,
+#endif
PLANE_WHEEL_FRONT = 2,
PLANE_WHEEL_READ,
NUM_PLANE_NODES
@@ -29,6 +34,10 @@ struct CPlaneInterpolationLine
class CPlane : public CVehicle
{
public:
+#ifdef CPLANE_ROTORS
+ RwFrame *m_aPlaneNodes[NUM_PLANE_NODES];
+ float m_fRotorRotation;
+#endif
int16 m_nPlaneId;
int16 m_isFarAway;
int16 m_nCurPathNode;