From f299e9ebd51cc26d30a40ee5edff7ddf2968b2ec Mon Sep 17 00:00:00 2001 From: _AG Date: Mon, 17 Jun 2019 02:10:55 +0200 Subject: Update HUD stuff, bug and format fixes. Added environment variables to premake5.lua. Update README.md --- src/control/Darkel.cpp | 3 ++- src/control/Garages.cpp | 64 ++++++++++++++++++++++++++++++++++++++++++++++++- src/control/Garages.h | 18 ++++++++++++++ 3 files changed, 83 insertions(+), 2 deletions(-) (limited to 'src/control') diff --git a/src/control/Darkel.cpp b/src/control/Darkel.cpp index e2d9fd72..aece455d 100644 --- a/src/control/Darkel.cpp +++ b/src/control/Darkel.cpp @@ -6,6 +6,7 @@ WRAPPER void CDarkel::DrawMessages(void) { EAXJMP(0x420920); } bool CDarkel::Status = *(bool*)0x95CCB4; -bool CDarkel::FrenzyOnGoing() { +bool CDarkel::FrenzyOnGoing() +{ return Status; } \ No newline at end of file diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index effc13d8..2994eb49 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -2,8 +2,29 @@ #include "patcher.h" #include "ModelIndices.h" #include "Garages.h" +#include "Timer.h" +#include "Font.h" +#include "Messages.h" +#include "Text.h" -WRAPPER void CGarages::PrintMessages(void) { EAXJMP(0x426310); } +//WRAPPER void CGarages::PrintMessages(void) { EAXJMP(0x426310); } + +int32 &CGarages::BankVansCollected = *(int32 *)0x8F1B34; +bool &CGarages::BombsAreFree = *(bool *)0x95CD7A; +bool &CGarages::RespraysAreFree = *(bool *)0x95CD1D; +int32 &CGarages::CarsCollected = *(int32 *)0x880E18; +int32 &CGarages::CarTypesCollected = *(int32 *)0x8E286C; +int32 &CGarages::CrushedCarId = *(int32 *)0x943060; +uint32 &CGarages::LastTimeHelpMessage = *(uint32 *)0x8F1B58; +int32 &CGarages::MessageNumberInString = *(int32 *)0x885BA8; +const char *CGarages::MessageIDString = (const char *)0x878358; +int32 &CGarages::MessageNumberInString2 = *(int32 *)0x8E2C14; +uint32 &CGarages::MessageStartTime = *(uint32 *)0x8F2530; +uint32 &CGarages::MessageEndTime = *(uint32 *)0x8F597C; +uint32 &CGarages::NumGarages = *(uint32 *)0x8F29F4; +bool &CGarages::PlayerInGarage = *(bool *)0x95CD83; +int32 &CGarages::PoliceCarsCollected = *(int32 *)0x941444; +uint32 &CGarages::GarageToBeTidied = *(uint32 *)0x623570; bool CGarages::IsModelIndexADoor(uint32 id) @@ -42,3 +63,44 @@ CGarages::IsModelIndexADoor(uint32 id) id == MI_CRUSHERBODY || id == MI_CRUSHERLID; } + +void CGarages::PrintMessages() +{ + if (CTimer::GetTimeInMilliseconds() > CGarages::MessageStartTime && CTimer::GetTimeInMilliseconds() < CGarages::MessageEndTime) { + CFont::SetScale(HUD_STRETCH_X(1.2f / 2), HUD_STRETCH_Y(1.5f / 2)); // BUG: game doesn't use macro here. + CFont::SetPropOn(); + CFont::SetJustifyOff(); + CFont::SetBackgroundOff(); + CFont::SetCentreSize(HUD_FROM_RIGHT(50.0f)); + CFont::SetCentreOn(); + CFont::SetFontStyle(FONT_BANK); + + if (CGarages::MessageNumberInString2 < 0) { + if (CGarages::MessageNumberInString < 0) { + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString((SCREEN_WIDTH/ 2) + HUD_STRETCH_X(2.0f), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f), TheText.Get(CGarages::MessageIDString)); + + CFont::SetColor(CRGBA(89, 115, 150, 255)); + CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f), TheText.Get(CGarages::MessageIDString)); + } + else { + CMessages::InsertNumberInString(TheText.Get(CGarages::MessageIDString), CGarages::MessageNumberInString, -1, -1, -1, -1, -1, gUString); + + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString((SCREEN_WIDTH / 2) + HUD_STRETCH_X(2.0f), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f + 2.0 - 40.0f), gUString); + + CFont::SetColor(CRGBA(89, 115, 150, 255)); + CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f - 40.0f), gUString); + } + } + else { + CMessages::InsertNumberInString(TheText.Get(CGarages::MessageIDString), CGarages::MessageNumberInString2, -1, -1, -1, -1, -1, gUString); + + CFont::SetColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString((SCREEN_WIDTH / 2) + HUD_STRETCH_X(2.0f), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f + 2.0 - 40.0f), gUString); + + CFont::SetColor(CRGBA(89, 115, 150, 255)); + CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(-84.0f - 40.0f), gUString); + } + } +} \ No newline at end of file diff --git a/src/control/Garages.h b/src/control/Garages.h index 87cf47fa..f018401c 100644 --- a/src/control/Garages.h +++ b/src/control/Garages.h @@ -2,6 +2,24 @@ class CGarages { +public: + static int32 &BankVansCollected; + static bool &BombsAreFree; + static bool &RespraysAreFree; + static int32 &CarsCollected; + static int32 &CarTypesCollected; + static int32 &CrushedCarId; + static uint32 &LastTimeHelpMessage; + static int32 &MessageNumberInString; + static const char *MessageIDString; + static int32 &MessageNumberInString2; + static uint32 &MessageStartTime; + static uint32 &MessageEndTime; + static uint32 &NumGarages; + static bool &PlayerInGarage; + static int32 &PoliceCarsCollected; + static uint32 &GarageToBeTidied; + public: static bool IsModelIndexADoor(uint32 id); static void PrintMessages(void); -- cgit v1.2.3