summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/render/Draw.h5
-rw-r--r--src/render/Fluff.cpp827
-rw-r--r--src/render/Fluff.h86
-rw-r--r--src/render/Hud.cpp2
-rw-r--r--src/render/Lines.cpp74
-rw-r--r--src/render/Lines.h7
-rw-r--r--src/render/Renderer.cpp21
-rw-r--r--src/render/Renderer.h6
-rw-r--r--src/render/Rubbish.cpp1
-rw-r--r--src/render/Rubbish.h3
-rw-r--r--src/render/WaterLevel.cpp8
-rw-r--r--src/render/WaterLevel.h1
12 files changed, 1033 insertions, 8 deletions
diff --git a/src/render/Draw.h b/src/render/Draw.h
index ad14e5a9..75b2b75f 100644
--- a/src/render/Draw.h
+++ b/src/render/Draw.h
@@ -2,9 +2,12 @@
enum eAspectRatio
{
- AR_AUTO,
+ // Make sure these work the same as FrontEndMenuManager.m_PrefsUseWideScreen
+ // without widescreen support
AR_4_3,
AR_16_9,
+
+ AR_AUTO,
};
class CDraw
diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp
index b1b8aa92..7c35319f 100644
--- a/src/render/Fluff.cpp
+++ b/src/render/Fluff.cpp
@@ -1,5 +1,830 @@
#include "common.h"
+#include "main.h"
#include "patcher.h"
#include "Fluff.h"
+#include "Camera.h"
+#include "Sprite.h"
+#include "Coronas.h"
+#include "General.h"
+#include "Timer.h"
+#include "Clock.h"
+#include "Weather.h"
+#include "Stats.h"
+#include "math/maths.h"
+#include "Frontend.h"
-WRAPPER void CMovingThings::Render(void) { EAXJMP(0x4FF210); }
+uint8 ScrollCharSet[59][5] = {
+ { 0x00, 0x00, 0x00, 0x00, 0x00 }, // ' '
+ { 0x00, 0x00, 0x1D, 0x00, 0x00 }, // '!'
+ { 0x00, 0x00, 0x00, 0x00, 0x00 }, // '"'
+ { 0x0A, 0x1F, 0x0A, 0x1F, 0x0A }, // '#'
+ { 0x00, 0x09, 0x1F, 0x12, 0x00 }, // '$'
+ { 0x18, 0x18, 0x00, 0x03, 0x03 }, // '%'
+ { 0x00, 0x00, 0x00, 0x00, 0x00 }, // '&'
+ { 0x00, 0x00, 0x00, 0x00, 0x00 }, // '''
+ { 0x01, 0x02, 0x04, 0x08, 0x10 }, // '('
+ { 0x00, 0x00, 0x18, 0x00, 0x00 }, // ')'
+ { 0x15, 0x04, 0x1F, 0x04, 0x15 }, // '*'
+ { 0x00, 0x04, 0x0E, 0x04, 0x00 }, // '+'
+ { 0x00, 0x00, 0x03, 0x00, 0x00 }, // ','
+ { 0x00, 0x04, 0x04, 0x04, 0x00 }, // '-'
+ { 0x00, 0x00, 0x01, 0x00, 0x00 }, // '.'
+ { 0x00, 0x00, 0x00, 0x00, 0x00 }, // '/'
+ { 0x0E, 0x11, 0x11, 0x11, 0x0E }, // '0'
+ { 0x01, 0x09, 0x1F, 0x01, 0x01 }, // '1'
+ { 0x03, 0x15, 0x15, 0x15, 0x09 }, // '2'
+ { 0x11, 0x11, 0x15, 0x15, 0x0A }, // '3'
+ { 0x02, 0x06, 0x0A, 0x1F, 0x02 }, // '4'
+ { 0x1D, 0x15, 0x15, 0x15, 0x12 }, // '5'
+ { 0x0E, 0x15, 0x15, 0x15, 0x12 }, // '6'
+ { 0x18, 0x10, 0x13, 0x14, 0x18 }, // '7'
+ { 0x0A, 0x15, 0x15, 0x15, 0x0A }, // '8'
+ { 0x08, 0x15, 0x15, 0x15, 0x0E }, // '9'
+ { 0x00, 0x00, 0x0A, 0x00, 0x00 }, // ':'
+ { 0x18, 0x18, 0x00, 0x03, 0x03 }, // ';'
+ { 0x04, 0x08, 0x1F, 0x08, 0x04 }, // '<'
+ { 0x00, 0x0A, 0x0A, 0x0A, 0x00 }, // '='
+ { 0x04, 0x02, 0x1F, 0x02, 0x04 }, // '>'
+ { 0x10, 0x10, 0x15, 0x14, 0x1D }, // '?'
+ { 0x00, 0x1C, 0x14, 0x1C, 0x00 }, // '@'
+ { 0x0F, 0x12, 0x12, 0x12, 0x0F }, // 'A'
+ { 0x1F, 0x15, 0x15, 0x15, 0x0A }, // 'B'
+ { 0x0E, 0x11, 0x11, 0x11, 0x0A }, // 'C'
+ { 0x1F, 0x11, 0x11, 0x11, 0x0E }, // 'D'
+ { 0x1F, 0x15, 0x15, 0x11, 0x11 }, // 'E'
+ { 0x1F, 0x14, 0x14, 0x10, 0x10 }, // 'F'
+ { 0x0E, 0x11, 0x15, 0x15, 0x06 }, // 'G'
+ { 0x1F, 0x04, 0x04, 0x04, 0x1F }, // 'H'
+ { 0x11, 0x11, 0x1F, 0x11, 0x11 }, // 'I'
+ { 0x02, 0x01, 0x01, 0x01, 0x1E }, // 'J'
+ { 0x1F, 0x04, 0x0C, 0x12, 0x01 }, // 'K'
+ { 0x1F, 0x01, 0x01, 0x01, 0x01 }, // 'L'
+ { 0x1F, 0x08, 0x06, 0x08, 0x1F }, // 'M'
+ { 0x1F, 0x08, 0x04, 0x02, 0x1F }, // 'N'
+ { 0x0E, 0x11, 0x11, 0x11, 0x0E }, // 'O'
+ { 0x1F, 0x12, 0x12, 0x12, 0x0C }, // 'P'
+ { 0x0C, 0x12, 0x12, 0x13, 0x0D }, // 'Q'
+ { 0x1F, 0x14, 0x14, 0x16, 0x09 }, // 'R'
+ { 0x09, 0x15, 0x15, 0x15, 0x02 }, // 'S'
+ { 0x10, 0x10, 0x1F, 0x10, 0x10 }, // 'T'
+ { 0x1E, 0x01, 0x01, 0x01, 0x1E }, // 'U'
+ { 0x1C, 0x02, 0x01, 0x02, 0x1C }, // 'V'
+ { 0x1E, 0x01, 0x06, 0x01, 0x1E }, // 'W'
+ { 0x11, 0x0A, 0x04, 0x0A, 0x11 }, // 'X'
+ { 0x18, 0x04, 0x03, 0x04, 0x18 }, // 'Y'
+ { 0x11, 0x13, 0x15, 0x19, 0x11 } // 'Z'
+};
+
+// ---------- CMovingThings ----------
+enum eScrollBarTypes
+{
+ SCROLL_BUSINESS,
+ SCROLL_TRAFFIC,
+ SCROLL_ENTERTAINMENT,
+ SCROLL_AIRPORT_DOORS,
+ SCROLL_AIRPORT_FRONT,
+ SCROLL_STORE,
+ SCROLL_USED_CARS
+};
+
+CScrollBar aScrollBars[11];
+CTowerClock aTowerClocks[2];
+CDigitalClock aDigitalClocks[3];
+
+void CMovingThings::Init()
+{
+ /*
+ * Some unused code about CMovingThing was here...
+ */
+
+ // Initialize scroll bars
+ aScrollBars[0].Init(CVector( 228.3f, -669.0f, 39.0f ), SCROLL_BUSINESS, 0.0, 0.5, 0.5, 255, 128, 0, 0.3);
+ aScrollBars[1].Init(CVector( 772.0f, 164.0f, -9.5f ), SCROLL_TRAFFIC, 0.0, 0.5, 0.25, 128, 255, 0, 0.3);
+ aScrollBars[2].Init(CVector(-1089.61f, -584.224f, 13.246f), SCROLL_AIRPORT_DOORS, 0.0, -0.1706, 0.107, 255, 0, 0, 0.11);
+ aScrollBars[3].Init(CVector(-1089.61f, -602.04602f, 13.246f), SCROLL_AIRPORT_DOORS, 0.0, -0.1706, 0.107, 0, 255, 0, 0.11);
+ aScrollBars[4].Init(CVector(-1089.61f, -619.81702f, 13.246f), SCROLL_AIRPORT_DOORS, 0.0, -0.1706, 0.107, 255, 128, 0, 0.11);
+ aScrollBars[5].Init(CVector(-754.578f, -633.50897f, 18.411f), SCROLL_AIRPORT_FRONT, 0.0, 0.591, 0.52, 100, 100, 255, 0.3);
+ aScrollBars[6].Init(CVector( -754.578f, -586.672f, 18.411f), SCROLL_AIRPORT_FRONT, 0.0, 0.591, 0.52, 100, 100, 255, 0.3);
+ aScrollBars[7].Init(CVector( 85.473f, -1069.512f, 30.5f ), SCROLL_STORE, 0.625, -0.3125, 0.727, 100, 100, 255, 0.5);
+ aScrollBars[8].Init(CVector( 74.823f, -1086.879f, 31.495f), SCROLL_ENTERTAINMENT, -0.2083, 0.1041, 0.5, 255, 255, 128, 0.3);
+ aScrollBars[9].Init(CVector( -36.459f, -1031.2371f, 32.534f), SCROLL_ENTERTAINMENT, -0.1442, 0.0721, 0.229, 150, 255, 50, 0.3);
+ aScrollBars[10].Init(CVector( 1208.0f, -62.208f, 19.157f), SCROLL_USED_CARS, 0.0642, -0.20365, 0.229, 255, 128, 0, 0.3);
+
+ // Initialize tower clocks
+ aTowerClocks[0].Init(CVector(59.4f, -1081.3f, 54.15f), -1.0f, 0.0f, 0, 0, 0, 80.0f, 2.0f);
+ aTowerClocks[1].Init(CVector(55.4f, -1083.6f, 54.15f), 0.0f, -1.0f, 0, 0, 0, 80.0f, 2.0f);
+
+ // Initialize digital clocks
+ CVector2D sz(3.7f, 2.144f);
+ sz.Normalise();
+ aDigitalClocks[0].Init(
+ CVector(54.485f - sz.x * 0.05f + sz.y * 0.3f, -1081.679f - sz.y * 0.05f - sz.x * 0.3f, 32.803f),
+ sz.y, -sz.x, 255, 0, 0, 100.0f, 0.8f
+ );
+ aDigitalClocks[1].Init(
+ CVector(60.564f + sz.x * 0.05f - sz.y * 0.3f, -1083.089f + sz.y * 0.05f + sz.x * 0.3f, 32.803f),
+ -sz.y, sz.x, 0, 0, 255, 100.0f, 0.8f
+ );
+ aDigitalClocks[2].Init(
+ CVector(58.145f - sz.y * 0.05f - sz.x * 0.3f, -1079.268f + sz.x * 0.05f - sz.y * 0.3f, 32.803f),
+ -sz.x, -sz.y, 0, 255, 0, 100.0f, 0.8f
+ );
+}
+
+void CMovingThings::Shutdown()
+{
+ int i;
+ for (i = 0; i < 11; ++i)
+ aScrollBars[i].SetVisibility(false);
+ for (i = 0; i < 2; ++i)
+ aTowerClocks[i].SetVisibility(false);
+ for (i = 0; i < 3; ++i)
+ aDigitalClocks[i].SetVisibility(false);
+}
+
+void CMovingThings::Update()
+{
+ /*
+ * Some unused code about CMovingThing was here...
+ */
+
+ int i;
+ for (i = 0; i < 11; ++i)
+ {
+ if (aScrollBars[i].IsVisible() || (CTimer::GetFrameCounter() + i) % 8 == 0)
+ aScrollBars[i].Update();
+ }
+ for (i = 0; i < 2; ++i)
+ {
+ if (aTowerClocks[i].IsVisible() || (CTimer::GetFrameCounter() + i) % 8 == 0)
+ aTowerClocks[i].Update();
+ }
+ for (i = 0; i < 3; ++i)
+ {
+ if (aDigitalClocks[i].IsVisible() || (CTimer::GetFrameCounter() + i) % 8 == 0)
+ aDigitalClocks[i].Update();
+ }
+}
+
+void CMovingThings::Render()
+{
+ int i;
+ for (i = 0; i < 11; ++i)
+ {
+ if (aScrollBars[i].IsVisible())
+ aScrollBars[i].Render();
+ }
+ for (i = 0; i < 2; ++i)
+ {
+ if (aTowerClocks[i].IsVisible())
+ aTowerClocks[i].Render();
+ }
+ for (i = 0; i < 3; ++i)
+ {
+ if (aDigitalClocks[i].IsVisible())
+ aDigitalClocks[i].Render();
+ }
+}
+
+// ---------- CMovingThing ----------
+WRAPPER void CMovingThing::Update() { EAXJMP(0x4FF290); }
+WRAPPER void CMovingThing::AddToList() { EAXJMP(0x4FF320); }
+WRAPPER void CMovingThing::RemoveFromList() { EAXJMP(0x4FF340); }
+
+// ---------- Find message functions ----------
+const char* FindTunnelMessage()
+{
+ if (CStats::CommercialPassed)
+ return "LIBERTY TUNNEL HAS BEEN OPENED TO ALL TRAFFIC . . . ";
+
+ if (CStats::IndustrialPassed)
+ return "FIRST PHASE LIBERTY TUNNEL HAS BEEN COMPLETED . . . ";
+
+ return "FIRST PHASE LIBERTY TUNNEL ABOUT TO BE COMPLETED . . . ";
+}
+
+const char* FindBridgeMessage()
+{
+ if (CStats::CommercialPassed)
+ return "STAUNTON LIFT BRIDGE IS OPERATIONAL AGAIN ";
+
+ if (CStats::IndustrialPassed)
+ return "LONG DELAYS BEHIND US AS CALLAHAN BRIDGE IS FIXED . . . STAUNTON LIFT BRIDGE STUCK OPEN ";
+
+ return "CHAOS AS CALLAHAN BRIDGE IS UNDER REPAIR. . . ";
+}
+
+char String_Time[] = "THE TIME IS 12:34 ";
+const char* FindTimeMessage()
+{
+ String_Time[12] = '0' + CClock::GetHours() / 10;
+ String_Time[13] = '0' + CClock::GetHours() % 10;
+ String_Time[15] = '0' + CClock::GetMinutes() / 10;
+ String_Time[16] = '0' + CClock::GetMinutes() % 10;
+ return String_Time;
+}
+
+char String_DigitalClock[] = "12:34";
+const char* FindDigitalClockMessage()
+{
+ if (((CTimer::GetTimeInMilliseconds() >> 10) & 7) < 6)
+ {
+ String_DigitalClock[0] = '0' + CClock::GetHours() / 10;
+ String_DigitalClock[1] = '0' + CClock::GetHours() % 10;
+ String_DigitalClock[2] = CTimer::GetTimeInMilliseconds() & 0x200 ? ':' : ' ';
+ String_DigitalClock[3] = '0' + CClock::GetMinutes() / 10;
+ String_DigitalClock[4] = '0' + CClock::GetMinutes() % 10;
+ }
+ else
+ {
+ int temperature = 13.0f - 6.0f * Cos((CClock::GetMinutes() + 60.0f * CClock::GetHours()) * 0.0043611112f - 1.0f);
+ String_DigitalClock[0] = '0' + temperature / 10;
+ if (String_DigitalClock[0] == '0')
+ String_DigitalClock[0] = ' ';
+ String_DigitalClock[1] = '0' + temperature % 10;
+ String_DigitalClock[2] = ' ';
+ String_DigitalClock[3] = '@';
+ String_DigitalClock[4] = 'C';
+ }
+ return String_DigitalClock;
+}
+
+// ---------- CScrollBar ----------
+void CScrollBar::Init(CVector position, uint8 type, float sizeX, float sizeY, float sizeZ, uint8 red, uint8 green, uint8 blue, float scale)
+{
+ for (int i = 0; i < 40; ++i)
+ m_MessageBar[i] = 0;
+
+ m_pMessage = ". ";
+ m_MessageCurrentChar = 0;
+ m_MessageLength = 2;
+
+ m_Counter = 0;
+ m_bVisible = false;
+ m_Position = position;
+ m_Type = type;
+ m_Size.x = sizeX;
+ m_Size.y = sizeY;
+ m_Size.z = sizeZ;
+ m_uRed = red;
+ m_uGreen = green;
+ m_uBlue = blue;
+ m_fScale = scale;
+}
+
+void CScrollBar::Update()
+{
+ float distanceFromCamera = (TheCamera.GetPosition() - m_Position).Magnitude();
+ if (distanceFromCamera > 100.0f)
+ {
+ m_bVisible = false;
+ return;
+ }
+
+ m_bVisible = true;
+
+ if (distanceFromCamera < 75.0f)
+ m_fIntensity = 1.0f;
+ else
+ m_fIntensity = 1.0f - 4.0f * (distanceFromCamera - 75.0f) / 100.0f;
+
+ m_Counter = (m_Counter + 1) % 8;
+
+ // if message is fully printed, load up the next one
+ if (m_Counter == 0 && ++m_MessageCurrentChar >= m_MessageLength)
+ {
+ const char* previousMessage = m_pMessage;
+ switch (m_Type)
+ {
+ case SCROLL_BUSINESS:
+ while (previousMessage == m_pMessage)
+ {
+ switch (CGeneral::GetRandomNumber() % 7)
+ {
+ case 0:
+ m_pMessage = "SHARES UYE<10% DWD<20% NDWE>22% . . . ";
+ break;
+ case 1:
+ m_pMessage = "CRIME WAVE HITS LIBERTY CITY . . . ";
+ break;
+ case 2:
+ m_pMessage = "SHARES OBR>29% MADD<76% LEZ<11% ADAMSKI>53% AAG>110%. . . ";
+ break;
+ case 3:
+ m_pMessage = FindTunnelMessage();
+ break;
+ case 4:
+ m_pMessage = FindBridgeMessage();
+ break;
+ case 5:
+ m_pMessage = FindTimeMessage();
+ break;
+ case 6:
+ if (CMenuManager::m_PrefsLanguage == LANGUAGE_FRENCH || CMenuManager::m_PrefsLanguage == LANGUAGE_GERMAN)
+ m_pMessage = FindTimeMessage();
+ else
+ m_pMessage = "WWW.GRANDTHEFTAUTO3.COM ";
+ break;
+ }
+ }
+ break;
+ case SCROLL_TRAFFIC:
+ while (previousMessage == m_pMessage)
+ {
+ switch (CGeneral::GetRandomNumber() % 8)
+ {
+ case 0:
+ m_pMessage = "DRIVE CAREFULLY . . . ";
+ break;
+ case 1:
+ m_pMessage = "RECENT WAVE OF CARJACKINGS. KEEP YOUR DOORS LOCKED !!! ";
+ break;
+ case 2:
+ m_pMessage = "CHECK YOUR SPEED . . . ";
+ break;
+ case 3:
+ m_pMessage = "KEEP YOUR EYES ON THE ROAD AND NOT ON THIS SIGN ";
+ break;
+ case 4:
+ if (CWeather::Foggyness > 0.5)
+ m_pMessage = "POOR VISIBILITY ! ";
+ else if (CWeather::WetRoads > 0.5)
+ m_pMessage = "ROADS ARE SLIPPERY ! ";
+ else
+ m_pMessage = "ENJOY YOUR TRIP ";
+ break;
+ case 5:
+ m_pMessage = FindTunnelMessage();
+ break;
+ case 6:
+ m_pMessage = FindBridgeMessage();
+ break;
+ case 7:
+ m_pMessage = FindTimeMessage();
+ break;
+ }
+ }
+ break;
+ case SCROLL_ENTERTAINMENT:
+ while (previousMessage == m_pMessage)
+ {
+ switch (CGeneral::GetRandomNumber() % 12)
+ {
+ case 0:
+ m_pMessage = " )69TH STREET) STILL HOLDS TOP POSITION THIS MONTH AT THE BOX-OFFICE WITH )MY FAIR LADYBOY) JUST CREEPING UP BEHIND. ";
+ break;
+ case 1:
+ m_pMessage = " TALKING OF )FANNIE). THERE IS STILL TIME TO CATCH THIS LOVELY FAMILY MUSICAL, ABOUT THE ORPHAN WHO IS SO EASILY TAKEN IN BY ANY MAN WITH LOADS OF MONEY. ";
+ break;
+ case 2:
+ m_pMessage = " DO NOT MISS )GTA3, THE MUSICAL) . . . ";
+ break;
+ case 3:
+ m_pMessage =
+ " STILL RUNNING ARE )RATS) AND )GUYS AND DOGS), BETWEEN THEN THEY SHOULD HAVE THE LEGS TO LAST TILL THE AND OF THE YEAR. . . "
+ " ALSO FOR FOUR LEGGED FANS, THE STAGE VERSION OF THE GRITTY REALISTIC )SATERDAY NIGHT BEAVER) OPENED LAST WEEKEND,"
+ " AND I FOR ONE CERTAINLY ENJOYED THAT. ";
+ break;
+ case 4:
+ m_pMessage =
+ " NOW SHOWING STATE-WIDE, ARNOLD STEELONE, HOLLYWOODS BEST LIVING SPECIAL EFFECT, APPEARS AGAIN AS A HALF_MAN,"
+ " HALF ANDROID IN THE HALF-BAKED ROMP, )TOP DOWN CITY). AN HOMAGE TO HIS EARLIER TWO MULTI_MILLION MAKING MOVIES,"
+ " IN WHICH HE PLAYED TWO-DEE, AN OUT OF CONTROL MONSTER, INTENT ON CORRUPTING CIVILISATION! ";
+ break;
+ case 5:
+ m_pMessage =
+ " ALSO APPEARING THIS WEEK )HALF-COCKED) SEES CHUCK SCHWARTZ UP TO HIS USUAL NONSENSE AS HE TAKES ON HALF OF LIBERTY CITY"
+ " IN AN ATTEMPT TO SAVE HIS CROSS-DRESSING LADY-BOY SIDEKICK, )MISS PING-PONG), FROM A GANG OF RUTHLESS COSMETIC SURGEONS. ";
+ break;
+ case 6:
+ m_pMessage =
+ " STILL SHOWING: )SOLDIERS OF MISFORTUNE), ATTROCIOUS ACTING WHICH SEES BOYZ 2 GIRLZ) TRANSITION FROM THE CHARTS TO THE BIG SCREEN,"
+ " AT LEAST THEY ALL DIE AT THE END. . . ";
+ break;
+ case 7:
+ m_pMessage =
+ " )BADFELLAS) IS STILL GOING STRONG WITH CROWDS ALMOST BEING PUSHED INTO CINEMAS TO SEE THIS ONE."
+ " ANOTHER ONE WORTH LOOKING INTO IS )THE TUNNEL). ";
+ break;
+ case 8:
+ m_pMessage = FindTunnelMessage();
+ break;
+ case 9:
+ m_pMessage = FindBridgeMessage();
+ break;
+ case 10:
+ m_pMessage = FindTimeMessage();
+ break;
+ case 11:
+ m_pMessage = "WWW.ROCKSTARGAMES.COM ";
+ break;
+ }
+ }
+ break;
+ case SCROLL_AIRPORT_DOORS:
+ while (previousMessage == m_pMessage)
+ {
+ switch (CGeneral::GetRandomNumber() % 4)
+ {
+ case 0:
+ m_pMessage = "WELCOME TO LIBERTY CITY . . . ";
+ break;
+ case 1:
+ m_pMessage = "PLEASE HAVE YOUR PASSPORT READY . . . ";
+ break;
+ case 2:
+ m_pMessage = "PLACE KEYS, FIREARMS, CHANGE AND OTHER METAL OBJECTS ON THE TRAY PLEASE . . . ";
+ break;
+ case 3:
+ m_pMessage = FindTimeMessage();
+ break;
+ }
+ }
+ break;
+ case SCROLL_AIRPORT_FRONT:
+ while (previousMessage == m_pMessage)
+ {
+ switch (CGeneral::GetRandomNumber() % 4)
+ {
+ case 0:
+ m_pMessage = "WELCOME TO FRANCIS INTERNATIONAL AIRPORT . . . ";
+ break;
+ case 1:
+ m_pMessage = "PLEASE DO NOT LEAVE LUGGAGE UNATTENDED . . . ";
+ break;
+ case 2:
+ m_pMessage = "FOLLOW 1 FOR LONG AND SHORT TERM PARKING ";
+ break;
+ case 3:
+ m_pMessage = FindTimeMessage();
+ break;
+ }
+ }
+ break;
+ case SCROLL_STORE:
+ while (previousMessage == m_pMessage)
+ {
+ switch (CGeneral::GetRandomNumber() % 10)
+ {
+ case 0:
+ m_pMessage = "WWW.ROCKSTARGAMES.COM ";
+ break;
+ case 1:
+ m_pMessage = "GTA3 OUT NOW . . . ";
+ break;
+ case 2:
+ m_pMessage = "OUR STUFF IS CHEAP CHEAP CHEAP ";
+ break;
+ case 3:
+ m_pMessage = "BUY 12 CDS GET ONE FREE . . . ";
+ break;
+ case 4:
+ m_pMessage = "APPEARING IN SHOP SOON, )THE BLOODY CHOPPERS), WITH THEIR NEW ALBUM, )IS THAT MY DAUGHTER?) ";
+ break;
+ case 5:
+ m_pMessage = "THIS MONTH IS OUR CRAZY CLEAROUT MONTH, EVERYTHING MUST GO, CDS, DVDS, STAFF, EVEN OUR CARPETS! ";
+ break;
+ case 6:
+ m_pMessage =
+ "OUT THIS WEEK: THE THEME TUNE TO )BOYS TO GIRLS) FIRST MOVIE )SOLDIERS OF MISFORTUNE), "
+ "THE SINGLE )LET ME IN YOU)RE BODY-BAG) IS TAKEN FROM THE SOUNDTRACK ALBUM, )BOOT CAMP BOYS). "
+ "ALSO INCLUDES THE SMASH SINGLE, )PRAY IT GOES OK). ";
+ break;
+ case 7:
+ m_pMessage =
+ "ALBUMS OUT THIS WEEK: MARYDANCING, )MUTHA O) CHRIST), FEATURING THE SINGLE )WASH HIM OFF), "
+ "ALSO CRAIG GRAYS) DEBUT, )FADE AWAY), INCLUDES THE SINGLE OF THE SAME NAME. . . ";
+ break;
+ case 8:
+ m_pMessage =
+ "ON THE FILM FRONT, A NELY COMPILED COMPILATION OF ARNOLD STEELONES GREATEST MOVIES ON DVD. "
+ "THE PACK INCLUDES THE EARLY )BY-CEP), THE CULT CLASSIC )FUTURE ANNHILATOR), AND THE HILARIOUS CROSS-DRESSING COMEDY )SISTERS). "
+ "ONE FOR ALL THE FAMILY. . . ";
+ break;
+ case 9:
+ m_pMessage = (char*)FindTimeMessage();
+ break;
+ }
+ }
+ break;
+ case SCROLL_USED_CARS:
+ while (previousMessage == m_pMessage)
+ {
+ switch (CGeneral::GetRandomNumber() % 11)
+ {
+ case 0:
+ m_pMessage = "QUICK, TAKE A LOOK AT OUR CURRENT STOCK )CAUSE THESE AUTOS ARE MOVIN) FAST . . . ";
+ break;
+ case 1:
+ m_pMessage = "THAT)S RIGHT, HERE AT )CAPITAL AUTO SALES) OUR VEHICLES ARE SO GOOD THAT THEY PRACTICALLY DRIVE THEMSELVES OFF OUR LOT . . . ";
+ break;
+ case 2:
+ m_pMessage = "EASY CREDIT ON ALL CARS . . . ";
+ break;
+ case 3:
+ m_pMessage = "FEEL LIKE A STUD IN ONE OF OUR STALLIONS OR TEST-DRIVE OUR BANSHEE, IT)S A REAL STEAL!!! ";
+ break;
+ case 4:
+ m_pMessage = "TRY OUR HARDY PERENNIAL, IT)LL LAST YOU THE WHOLE YEAR. OUR BOBCATS AIN)T NO PUSSIES EITHER!!! ";
+ break;
+ case 5:
+ m_pMessage = "IF IT)S A GUARANTEE YOU'RE AFTER, GO SOMEWHERE ELSE, )CAPITAL) CARS ARE THAT GOOD THEY DON)T NEED GUARANTEES!!! ";
+ break;
+ case 6:
+ m_pMessage = "TOP DOLLAR OFFERED FOR YOUR OLD WHEELS, NOT YOUR CAR, JUST IT)S WHEELS. . . ";
+ break;
+ case 7:
+ m_pMessage = "THAT)S RIGHT WE)RE CAR SILLY. TEST DRIVE ANY CAR, YOU WON)T WANT TO BRING IT BACK!!! ";
+ break;
+ case 8:
+ m_pMessage = "FREE FLUFFY DICE WITH ALL PURCHASES. . .";
+ break;
+ case 9:
+ if (CMenuManager::m_PrefsLanguage == LANGUAGE_FRENCH || CMenuManager::m_PrefsLanguage == LANGUAGE_GERMAN)
+ m_pMessage = "QUICK, TAKE A LOOK AT OUR CURRENT STOCK )CAUSE THESE AUTOS ARE MOVIN) FAST . . . ";
+ else
+ m_pMessage = "HTTP:((ROCKSTARGAMES.COM(GRANDTHEFTAUTO3(CAPITALAUTOS ";
+ break;
+ case 10:
+ m_pMessage = FindTimeMessage();
+ break;
+ }
+ }
+ break;
+ }
+
+ m_MessageLength = strlen(m_pMessage);
+ m_MessageCurrentChar = 0;
+ }
+
+ // Scroll
+ for (int i = 0; i < 39; i++)
+ m_MessageBar[i] = m_MessageBar[i + 1];
+ m_MessageBar[39] = m_Counter < 5 ? ScrollCharSet[m_pMessage[m_MessageCurrentChar] - ' '][m_Counter] : 0;
+
+ // Introduce some random displaying glitches; signs aren't supposed to be perfect :P
+ switch (CGeneral::GetRandomNumber() & 0xFF)
+ {
+ case 0x0D: m_MessageBar[39] = 0; break;
+ case 0xE3: m_MessageBar[39] = 0xE3; break;
+ case 0x64: m_MessageBar[39] = ~m_MessageBar[39]; break;
+ }
+}
+
+void CScrollBar::Render()
+{
+ if (!TheCamera.IsSphereVisible(m_Position, 2.0f * 20.0f * (ABS(m_Size.x) + ABS(m_Size.y))))
+ return;
+
+ CSprite::InitSpriteBuffer();
+
+ // Calculate intensity of colours
+ uint8 r = m_fIntensity * m_uRed;
+ uint8 g = m_fIntensity * m_uGreen;
+ uint8 b = m_fIntensity * m_uBlue;
+
+ // Set render states
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCoronaTexture[0]));
+ RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
+
+ CVector coronaCoord, screenCoord;
+ float screenW, screenH;
+ for (int i = 1; i < 40; ++i)
+ {
+ for (int j = 0; j < 5; ++j)
+ {
+ coronaCoord.x = m_Position.x + m_Size.x * i;
+ coronaCoord.y = m_Position.y + m_Size.y * i;
+ coronaCoord.z = m_Position.z + m_Size.z * j;
+
+ // Render main coronas
+ if (m_MessageBar[i] & (1 << j))
+ {
+ if (CSprite::CalcScreenCoors(coronaCoord, screenCoord, &screenW, &screenH, true))
+ {
+ CSprite::RenderBufferedOneXLUSprite(
+ screenCoord.x, screenCoord.y, screenCoord.z,
+ screenW * m_fScale, screenH * m_fScale,
+ r, g, b,
+ 255, 1.0f / screenCoord.z, 255);
+ }
+ }
+ // Render smaller and faded coronas for a trailing effect
+ else if (m_MessageBar[i - 1] & (1 << j))
+ {
+ if (CSprite::CalcScreenCoors(coronaCoord, screenCoord, &screenW, &screenH, true))
+ {
+ CSprite::RenderBufferedOneXLUSprite(
+ screenCoord.x, screenCoord.y, screenCoord.z,
+ screenW * m_fScale * 0.8f,
+ screenH * m_fScale * 0.8f,
+ r / 2,
+ g / 2,
+ b / 2,
+ 255, 1.0 / screenCoord.z, 255);
+ }
+ }
+ }
+ }
+
+ CSprite::FlushSpriteBuffer();
+}
+
+// ---------- CTowerClock ----------
+void CTowerClock::Init(CVector position, float sizeX, float sizeY, uint8 red, uint8 green, uint8 blue, float drawDistance, float scale)
+{
+ m_bVisible = false;
+ m_Position = position;
+ m_Size.x = sizeX;
+ m_Size.y = sizeY;
+ m_Size.z = 0.0f;
+ m_uRed = red;
+ m_uGreen = green;
+ m_uBlue = blue;
+ m_fDrawDistance = drawDistance;
+ m_fScale = scale;
+}
+
+void CTowerClock::Update()
+{
+ float distanceFromCamera = (TheCamera.GetPosition() - m_Position).Magnitude();
+ if (distanceFromCamera < m_fDrawDistance)
+ {
+ m_bVisible = true;
+ if (distanceFromCamera < 0.75f * m_fDrawDistance)
+ m_fIntensity = 1.0f;
+ else
+ m_fIntensity = 1.0f - (distanceFromCamera - 0.75f * m_fDrawDistance) * 4.0f / m_fDrawDistance;
+ }
+ else
+ m_bVisible = false;
+}
+
+RwIm3DVertex TempV[4];
+void CTowerClock::Render()
+{
+ if (TheCamera.IsSphereVisible(m_Position, m_fScale))
+ {
+ // Calculate angle for each clock index
+ float angleHour = 2.0f * (float)PI * (CClock::GetMinutes() + 60.0f * CClock::GetHours()) / 720.0f;
+ float angleMinute = 2.0f * (float)PI * (CClock::GetSeconds() + 60.0f * CClock::GetMinutes()) / 3600.0f;
+
+ // Prepare render states
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
+
+ // Set vertices colors
+ RwIm3DVertexSetRGBA(&TempV[0], m_uRed, m_uGreen, m_uBlue, (uint8)(m_fIntensity * 255.0f));
+ RwIm3DVertexSetRGBA(&TempV[1], m_uRed, m_uGreen, m_uBlue, (uint8)(m_fIntensity * 255.0f));
+ RwIm3DVertexSetRGBA(&TempV[2], m_uRed, m_uGreen, m_uBlue, (uint8)(m_fIntensity * 255.0f));
+ RwIm3DVertexSetRGBA(&TempV[3], m_uRed, m_uGreen, m_uBlue, (uint8)(m_fIntensity * 255.0f));
+
+ // Set vertices position
+ RwIm3DVertexSetPos(&TempV[0], m_Position.x, m_Position.y, m_Position.z);
+ RwIm3DVertexSetPos(
+ &TempV[1],
+ m_Position.x + Sin(angleMinute) * m_fScale * m_Size.x,
+ m_Position.y + Sin(angleMinute) * m_fScale * m_Size.y,
+ m_Position.z + Cos(angleMinute) * m_fScale;
+ );
+ RwIm3DVertexSetPos(&TempV[2], m_Position.x, m_Position.y, m_Position.z);
+ RwIm3DVertexSetPos(
+ &TempV[3],
+ m_Position.x + Sin(angleHour) * 0.75f * m_fScale * m_Size.x,
+ m_Position.y + Sin(angleHour) * 0.75f * m_fScale * m_Size.y,
+ m_Position.z + Cos(angleHour) * 0.75f * m_fScale;
+ );
+
+ LittleTest();
+
+ // Draw lines
+ if (RwIm3DTransform(TempV, 4, nil, 0))
+ {
+ RwIm3DRenderLine(0, 1);
+ RwIm3DRenderLine(2, 3);
+ RwIm3DEnd();
+ }
+ }
+}
+
+// ---------- CDigitalClock ----------
+void CDigitalClock::Init(CVector position, float sizeX, float sizeY, uint8 red, uint8 green, uint8 blue, float drawDistance, float scale)
+{
+ m_bVisible = false;
+ m_Position = position;
+ m_Size.x = sizeX;
+ m_Size.y = sizeY;
+ m_Size.z = 0.0f;
+ m_uRed = red;
+ m_uGreen = green;
+ m_uBlue = blue;
+ m_fDrawDistance = drawDistance;
+ m_fScale = scale;
+}
+
+void CDigitalClock::Update()
+{
+ float distanceFromCamera = (TheCamera.GetPosition() - m_Position).Magnitude();
+ if (distanceFromCamera < m_fDrawDistance)
+ {
+ m_bVisible = true;
+ if (distanceFromCamera < 0.75f * m_fDrawDistance)
+ m_fIntensity = 1.0f;
+ else
+ m_fIntensity = 1.0f - (distanceFromCamera - 0.75f * m_fDrawDistance) * 4.0f / m_fDrawDistance;
+ }
+ else
+ m_bVisible = false;
+}
+
+void CDigitalClock::Render()
+{
+ if (TheCamera.IsSphereVisible(m_Position, 5.0f * m_fScale))
+ {
+ CSprite::InitSpriteBuffer();
+
+ // Simulate flicker
+ float currentIntensity = m_fIntensity * CGeneral::GetRandomNumberInRange(0x300, 0x400) / 1024.0f;
+
+ uint8 r = currentIntensity * m_uRed;
+ uint8 g = currentIntensity * m_uGreen;
+ uint8 b = currentIntensity * m_uBlue;
+
+ // Set render states
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCoronaTexture[0]));
+ RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
+
+ const char* clockMessage = FindDigitalClockMessage();
+
+ CVector coronaCoord, screenCoord;
+ float screenW, screenH;
+ for (int c = 0; c < 5; ++c) // for each char to be displayed
+ {
+ for (int i = 0; i < 5; ++i) // for each column of coronas
+ {
+ for (int j = 0; j < 5; ++j) // for each row of coronas
+ {
+ if (ScrollCharSet[clockMessage[c] - ' '][i] & (1 << j))
+ {
+ coronaCoord.x = m_Position.x + (8 * c + i) * m_Size.x * m_fScale / 8.0f;
+ coronaCoord.y = m_Position.y + (8 * c + i) * m_Size.y * m_fScale / 8.0f;
+ coronaCoord.z = m_Position.z + j * m_fScale / 8.0f;
+
+ if (CSprite::CalcScreenCoors(coronaCoord, screenCoord, &screenW, &screenH, true))
+ {
+ CSprite::RenderBufferedOneXLUSprite(
+ screenCoord.x, screenCoord.y, screenCoord.z,
+ screenW * m_fScale * 0.12,
+ screenW * m_fScale * 0.12,
+ r, g, b,
+ 255,
+ 1.0 / screenCoord.z,
+ 255);
+ }
+ }
+ }
+ }
+ }
+
+ CSprite::FlushSpriteBuffer();
+ }
+}
+
+STARTPATCHES
+InjectHook(0x4FE7C0, &CMovingThings::Init, PATCH_JUMP);
+InjectHook(0x4FF020, &CMovingThings::Shutdown, PATCH_JUMP);
+InjectHook(0x4FF0D0, &CMovingThings::Update, PATCH_JUMP);
+InjectHook(0x4FF210, &CMovingThings::Render, PATCH_JUMP);
+
+InjectHook(0x4FF360, &FindTunnelMessage, PATCH_JUMP);
+InjectHook(0x4FF390, &FindBridgeMessage, PATCH_JUMP);
+InjectHook(0x4FF3C0, &FindTimeMessage, PATCH_JUMP);
+InjectHook(0x4FF450, &FindDigitalClockMessage, PATCH_JUMP);
+
+InjectHook(0x4FF610, &CScrollBar::Init, PATCH_JUMP);
+InjectHook(0x4FF6E0, &CScrollBar::Update, PATCH_JUMP);
+InjectHook(0x4FFCE0, &CScrollBar::Render, PATCH_JUMP);
+
+InjectHook(0x5000D0, &CTowerClock::Init, PATCH_JUMP);
+InjectHook(0x500130, &CTowerClock::Update, PATCH_JUMP);
+InjectHook(0x5001D0, &CTowerClock::Render, PATCH_JUMP);
+
+InjectHook(0x5004F0, &CDigitalClock::Init, PATCH_JUMP);
+InjectHook(0x500550, &CDigitalClock::Update, PATCH_JUMP);
+InjectHook(0x5005F0, &CDigitalClock::Render, PATCH_JUMP);
+ENDPATCHES \ No newline at end of file
diff --git a/src/render/Fluff.h b/src/render/Fluff.h
index 33532efa..f33b016e 100644
--- a/src/render/Fluff.h
+++ b/src/render/Fluff.h
@@ -1,7 +1,91 @@
#pragma once
+#include "common.h"
+#include "math/Vector.h"
class CMovingThings
{
public:
- static void Render(void);
+ static void Init();
+ static void Shutdown();
+ static void Update();
+ static void Render();
};
+
+class CMovingThing
+{
+public:
+ void Update();
+ void AddToList();
+ void RemoveFromList();
+};
+
+class CScrollBar
+{
+private:
+ uint8 m_Counter;
+ const char* m_pMessage;
+ CVector m_Position;
+ uint32 m_MessageCurrentChar;
+ uint32 m_MessageLength;
+ CVector m_Size;
+ float m_fIntensity;
+ uint8 m_MessageBar[40];
+ uint8 m_Type;
+ bool m_bVisible;
+ uint8 m_uRed;
+ uint8 m_uGreen;
+ uint8 m_uBlue;
+ float m_fScale;
+
+public:
+ void SetVisibility(bool visible) { m_bVisible = visible; }
+ bool IsVisible() { return m_bVisible; }
+
+ void Init(CVector, uint8, float, float, float, uint8, uint8, uint8, float);
+ void Update();
+ void Render();
+};
+
+class CTowerClock
+{
+private:
+ CVector m_Position;
+ CVector m_Size;
+ float m_fDrawDistance;
+ float m_fScale;
+ uint8 m_uRed;
+ uint8 m_uGreen;
+ uint8 m_uBlue;
+ bool m_bVisible;
+ float m_fIntensity;
+
+public:
+ void SetVisibility(bool visible) { m_bVisible = visible; }
+ bool IsVisible() { return m_bVisible; }
+
+ void Init(CVector, float, float, uint8, uint8, uint8, float, float);
+ void Update();
+ void Render();
+};
+
+class CDigitalClock
+{
+private:
+ CVector m_Position;
+ CVector m_Size;
+ float m_fDrawDistance;
+ float m_fScale;
+ uint8 m_uRed;
+ uint8 m_uGreen;
+ uint8 m_uBlue;
+ bool m_bVisible;
+ float m_fIntensity;
+
+public:
+ void SetVisibility(bool visible) { m_bVisible = visible; }
+ bool IsVisible() { return m_bVisible; }
+
+ void Init(CVector, float, float, uint8, uint8, uint8, float, float);
+ void Update();
+ void Render();
+}; \ No newline at end of file
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 81f27153..1db7b07c 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -325,7 +325,7 @@ void CHud::Draw()
else {
Clip = AmmoInClip;
- if (TotalAmmo - AmmoInClip > 9999)
+ if ((TotalAmmo - AmmoInClip) > 9999)
Ammo = 9999;
else
Ammo = TotalAmmo - AmmoInClip;
diff --git a/src/render/Lines.cpp b/src/render/Lines.cpp
new file mode 100644
index 00000000..ea433048
--- /dev/null
+++ b/src/render/Lines.cpp
@@ -0,0 +1,74 @@
+#include "common.h"
+#include "patcher.h"
+#include "main.h"
+#include "Lines.h"
+
+// This is super inefficient, why split the line into segments at all?
+void
+CLines::RenderLineWithClipping(float x1, float y1, float z1, float x2, float y2, float z2, uint32 c1, uint32 c2)
+{
+ static RwIm3DVertex v[2];
+#ifdef THIS_IS_STUPID
+ int i;
+ float f1, f2;
+ float len = sqrt(sq(x1-x2) + sq(y1-y2) + sq(z1-z2));
+ int numsegs = len/1.5f + 1.0f;
+
+ RwRGBA col1;
+ col1.red = c1>>24;
+ col1.green = c1>>16;
+ col1.blue = c1>>8;
+ col1.alpha = c1;
+ RwRGBA col2;
+ col2.red = c2>>24;
+ col2.green = c2>>16;
+ col2.blue = c2>>8;
+ col2.alpha = c2;
+
+ float dx = x2 - x1;
+ float dy = y2 - y1;
+ float dz = z2 - z1;
+ for(i = 0; i < numsegs; i++){
+ f1 = (float)i/numsegs;
+ f2 = (float)(i+1)/numsegs;
+
+ RwIm3DVertexSetRGBA(&v[0], (int)(col1.red + (col2.red-col1.red)*f1),
+ (int)(col1.green + (col2.green-col1.green)*f1),
+ (int)(col1.blue + (col2.blue-col1.blue)*f1),
+ (int)(col1.alpha + (col2.alpha-col1.alpha)*f1));
+ RwIm3DVertexSetRGBA(&v[1], (int)(col1.red + (col2.red-col1.red)*f2),
+ (int)(col1.green + (col2.green-col1.green)*f2),
+ (int)(col1.blue + (col2.blue-col1.blue)*f2),
+ (int)(col1.alpha + (col2.alpha-col1.alpha)*f2));
+ RwIm3DVertexSetPos(&v[0], x1 + dx*f1, y1 + dy*f1, z1 + dz*f1);
+ RwIm3DVertexSetPos(&v[1], x1 + dx*f2, y1 + dy*f2, z1 + dz*f2);
+
+ LittleTest();
+ if(RwIm3DTransform(v, 2, nil, 0)){
+ RwIm3DRenderLine(0, 1);
+ RwIm3DEnd();
+ }
+ }
+#else
+ RwRGBA col1;
+ col1.red = c1>>24;
+ col1.green = c1>>16;
+ col1.blue = c1>>8;
+ col1.alpha = c1;
+ RwRGBA col2;
+ col2.red = c2>>24;
+ col2.green = c2>>16;
+ col2.blue = c2>>8;
+ col2.alpha = c2;
+
+ RwIm3DVertexSetRGBA(&v[0], col1.red, col1.green, col1.blue, col1.alpha);
+ RwIm3DVertexSetRGBA(&v[1], col2.red, col2.green, col2.blue, col2.alpha);
+ RwIm3DVertexSetPos(&v[0], x1, y1, z1);
+ RwIm3DVertexSetPos(&v[1], x2, y2, z2);
+ LittleTest();
+ if(RwIm3DTransform(v, 2, nil, 0)){
+ RwIm3DRenderLine(0, 1);
+ RwIm3DEnd();
+ }
+#endif
+}
diff --git a/src/render/Lines.h b/src/render/Lines.h
new file mode 100644
index 00000000..f2694fc0
--- /dev/null
+++ b/src/render/Lines.h
@@ -0,0 +1,7 @@
+#pragma once
+
+class CLines
+{
+public:
+ static void RenderLineWithClipping(float x1, float y1, float z1, float x2, float y2, float z2, uint32 c1, uint32 c2);
+};
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 69df63ba..7bf4593f 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -23,11 +23,13 @@
bool gbShowPedRoadGroups;
bool gbShowCarRoadGroups;
bool gbShowCollisionPolys;
+bool gbShowCollisionLines;
bool gbDontRenderBuildings;
bool gbDontRenderBigBuildings;
bool gbDontRenderPeds;
bool gbDontRenderObjects;
+bool gbDontRenderVehicles;
struct EntityInfo
{
@@ -132,6 +134,10 @@ CRenderer::RenderOneNonRoad(CEntity *e)
else if(e->IsObject() || e->IsDummy()){
if(gbDontRenderObjects)
return;
+ }else if(e->IsVehicle()){
+ // re3 addition
+ if(gbDontRenderVehicles)
+ return;
}
#endif
@@ -285,6 +291,21 @@ CRenderer::RenderFadingInEntities(void)
CVisibilityPlugins::RenderFadingEntities();
}
+void
+CRenderer::RenderCollisionLines(void)
+{
+ int i;
+
+ // game doesn't draw fading in entities
+ // this should probably be fixed
+ for(i = 0; i < ms_nNoOfVisibleEntities; i++){
+ CEntity *e = ms_aVisibleEntityPtrs[i];
+ if(Abs(e->GetPosition().x - ms_vecCameraPosition.x) < 100.0f &&
+ Abs(e->GetPosition().y - ms_vecCameraPosition.y) < 100.0f)
+ CCollision::DrawColModel(e->GetMatrix(), *e->GetColModel());
+ }
+}
+
enum Visbility
{
VIS_INVISIBLE,
diff --git a/src/render/Renderer.h b/src/render/Renderer.h
index 4b96c775..817cdaae 100644
--- a/src/render/Renderer.h
+++ b/src/render/Renderer.h
@@ -5,11 +5,13 @@ class CEntity;
extern bool gbShowPedRoadGroups;
extern bool gbShowCarRoadGroups;
extern bool gbShowCollisionPolys;
+extern bool gbShowCollisionLines;
extern bool gbDontRenderBuildings;
extern bool gbDontRenderBigBuildings;
extern bool gbDontRenderPeds;
extern bool gbDontRenderObjects;
+extern bool gbDontRenderVehicles;
class CVehicle;
class CPtrList;
@@ -23,7 +25,9 @@ class CRenderer
static CVector &ms_vecCameraPosition;
static CVehicle *&m_pFirstPersonVehicle;
+
public:
+ static float &ms_lodDistScale; // defined in Frontend.cpp
static bool &m_loadingPriority;
static void Init(void);
@@ -39,6 +43,8 @@ public:
static void RenderOneNonRoad(CEntity *);
static void RenderFirstPersonVehicle(void);
+ static void RenderCollisionLines(void);
+
static int32 SetupEntityVisibility(CEntity *ent);
static int32 SetupBigBuildingVisibility(CEntity *ent);
diff --git a/src/render/Rubbish.cpp b/src/render/Rubbish.cpp
index 975f2554..c925df1c 100644
--- a/src/render/Rubbish.cpp
+++ b/src/render/Rubbish.cpp
@@ -3,3 +3,4 @@
#include "Rubbish.h"
WRAPPER void CRubbish::Render(void) { EAXJMP(0x512190); }
+WRAPPER void CRubbish::StirUp(CVehicle *veh) { EAXJMP(0x512690); }
diff --git a/src/render/Rubbish.h b/src/render/Rubbish.h
index f4f976e9..9f946dc2 100644
--- a/src/render/Rubbish.h
+++ b/src/render/Rubbish.h
@@ -1,7 +1,10 @@
#pragma once
+class CVehicle;
+
class CRubbish
{
public:
static void Render(void);
+ static void StirUp(CVehicle *veh); // CAutomobile on PS2
};
diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp
index 07c88d3e..247b9f3d 100644
--- a/src/render/WaterLevel.cpp
+++ b/src/render/WaterLevel.cpp
@@ -1,4 +1,5 @@
#include "common.h"
+#include "main.h"
#include "FileMgr.h"
#include "TxdStore.h"
#include "Timer.h"
@@ -172,9 +173,8 @@ CWaterLevel::CreateWavyAtomic()
{
wavyMorphTarget = RpGeometryGetMorphTarget(wavyGeometry, 0);
- wavyVert = RpMorphTargetGetVertices(wavyMorphTarget);
-
ASSERT(wavyMorphTarget != NULL);
+ wavyVert = RpMorphTargetGetVertices(wavyMorphTarget);
ASSERT(wavyVert != NULL);
for ( int32 i = 0; i < 9; i++ )
@@ -1148,10 +1148,10 @@ CWaterLevel::AllocateBoatWakeArray()
ASSERT(ms_pWavyAtomic != NULL );
RpGeometry *wavyGeometry = RpAtomicGetGeometry(ms_pWavyAtomic);
+ ASSERT(wavyGeometry != NULL );
RpMorphTarget *wavyMorphTarget = RpGeometryGetMorphTarget(wavyGeometry, 0);
RpMaterial *wavyMaterial = RpGeometryGetMaterial(wavyGeometry, 0);
- ASSERT(wavyGeometry != NULL );
ASSERT(wavyMorphTarget != NULL );
ASSERT(wavyMaterial != NULL );
@@ -1240,7 +1240,7 @@ STARTPATCHES
InjectHook(0x554FE0, &CWaterLevel::Shutdown, PATCH_JUMP);
InjectHook(0x555010, &CWaterLevel::CreateWavyAtomic, PATCH_JUMP);
InjectHook(0x5552A0, &CWaterLevel::DestroyWavyAtomic, PATCH_JUMP);
- InjectHook(0x5552C0, &CWaterLevel::GetWaterLevel, PATCH_JUMP);
+ InjectHook(0x5552C0, (bool (*)(float,float,float,float*,bool))&CWaterLevel::GetWaterLevel, PATCH_JUMP);
InjectHook(0x555440, &CWaterLevel::GetWaterLevelNoWaves, PATCH_JUMP);
InjectHook(0x5554E0, &CWaterLevel::RenderWater, PATCH_JUMP);
InjectHook(0x556C30, &CWaterLevel::RenderOneFlatSmallWaterPoly, PATCH_JUMP);
diff --git a/src/render/WaterLevel.h b/src/render/WaterLevel.h
index b8ec7a4d..afc6eac3 100644
--- a/src/render/WaterLevel.h
+++ b/src/render/WaterLevel.h
@@ -82,6 +82,7 @@ public:
static void CreateWavyAtomic();
static void DestroyWavyAtomic();
static bool GetWaterLevel(float fX, float fY, float fZ, float *pfOutLevel, bool bDontCheckZ);
+ static bool GetWaterLevel(CVector coors, float *pfOutLevel, bool bDontCheckZ) { return GetWaterLevel(coors.x, coors.y, coors.z, pfOutLevel, bDontCheckZ); }
static bool GetWaterLevelNoWaves(float fX, float fY, float fZ, float *pfOutLevel);
static void RenderWater();
static void RenderOneFlatSmallWaterPoly (float fX, float fY, float fZ, RwRGBA const &color);