Merge pull request #49 from gennariarmando/master

Initial commit for Frontend.
This commit is contained in:
aap 2019-06-25 07:22:27 +02:00 committed by GitHub
commit b50440a6f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 2489 additions and 551 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,43 @@
#include "Sprite2d.h" #include "Sprite2d.h"
#define HEADER_POS_X 35.0f
#define HEADER_POS_Y 93.0f
#define HEADER_WIDTH 0.84f
#define HEADER_HEIGHT 1.6f
#define ACTION_POS_X 20.0f
#define ACTION_POS_Y 37.5f
#define ACTION_WIDTH 0.675f
#define ACTION_HEIGHT 0.81f
#define COLUMN_POS_X HEADER_POS_X + 16.0f
#define COLUMN_MAX_Y 149.0f
#define COLUMN_MID_Y 100.0f
#define COLUMN_MIN_Y 110.0f
#define COLUMN_PAUSE_Y 25.0f
#define COLUMN_START_Y 9.0f
#define COLUMN_FEDS 139.0f
#define COLUMN_SAVE_X 121.0f
#define COLUMN_SAVE_Y 111.0f
#define COLUMN_SPACING_MAX 24.0f
#define COLUMN_SPACING_MIN 20.0f
#define SELECT_BOX_MAX 20.5f
#define SELECT_BOX_MIN 17.0f
#define FE_RADIO_ICON_X 31.5f
#define FE_RADIO_ICON_Y 29.5f
#define FE_RADIO_ICON_W 60.0f
#define FE_RADIO_ICON_H 60.0f
#define DROP_COLOR_A 150
#define DROP_COLOR_SIZE -1
#define SLIDER_X 306.0f
enum { enum {
LANGUAGE_AMERICAN, LANGUAGE_AMERICAN,
LANGUAGE_FRENCH, LANGUAGE_FRENCH,
@ -10,6 +47,70 @@ enum {
LANGUAGE_SPANISH, LANGUAGE_SPANISH,
}; };
enum eFrontendSprites {
FE2_MAINPANEL_UL,
FE2_MAINPANEL_UR,
FE2_MAINPANEL_DL,
FE2_MAINPANEL_DR,
FE2_MAINPANEL_DR2,
FE2_TABACTIVE,
FE_ICONBRIEF,
FE_ICONSTATS,
FE_ICONCONTROLS,
FE_ICONSAVE,
FE_ICONAUDIO,
FE_ICONDISPLAY,
FE_ICONLANGUAGE,
FE_CONTROLLER,
FE_CONTROLLERSH,
FE_ARROWS1,
FE_ARROWS2,
FE_ARROWS3,
FE_ARROWS4,
FE_RADIO1,
FE_RADIO2,
FE_RADIO3,
FE_RADIO4,
FE_RADIO5,
FE_RADIO6,
FE_RADIO7,
FE_RADIO8,
FE_RADIO9,
};
enum eMenuSprites {
MENU_CONNECTION,
MENU_FINDGAME,
MENU_HOSTGAME,
MENU_MAINMENU,
MENU_PLAYERSET,
MENU_SINGLEPLAYER,
MENU_MULTIPLAYER,
MENU_DMALOGO,
MENU_GTALOGO,
MENU_RSTARLOGO,
MENU_GAMESPY,
MENU_MOUSE,
MENU_MOUSET,
MENU_MP3LOGO,
MENU_DOWNOFF,
MENU_UPOFF,
MENU_DOWNON,
MENU_UPON,
MENU_GTA3LOGO,
};
enum eMenuActions {
MENU_ACTION_SAVE_1 = 1,
MENU_ACTION_SAVE_2,
MENU_ACTION_SAVE_3,
MENU_ACTION_SAVE_4,
MENU_ACTION_SAVE_5,
MENU_ACTION_SAVE_6,
MENU_ACTION_SAVE_7,
MENU_ACTION_SAVE_8,
};
enum eMenuScreen { enum eMenuScreen {
MENU_NONE = 0, MENU_NONE = 0,
MENU_STATS = 1, MENU_STATS = 1,
@ -72,6 +173,11 @@ enum eMenuScreen {
MENU_58 = 58, MENU_58 = 58,
}; };
enum eCheckHover {
ACTIVATE_OPTION = 2,
IGNORE_OPTION = 42,
};
struct tSkinInfo struct tSkinInfo
{ {
int field_0; int field_0;
@ -81,6 +187,20 @@ struct tSkinInfo
int field_304; int field_304;
}; };
struct CMenuScreen {
char m_ScreenName[8];
int32 m_PreviousPage[3]; //
int32 m_ParentEntry[2];
struct CMenuEntry
{
int32 m_Action;
char m_EntryName[8];
int32 m_ActionSlot;
int32 m_TargetMenu;
} m_aEntries[18];
};
class CMenuManager class CMenuManager
{ {
public: public:
@ -136,10 +256,10 @@ public:
int m_nHelperTextAlpha; int m_nHelperTextAlpha;
int m_nMouseOldPosX; int m_nMouseOldPosX;
int m_nMouseOldPosY; int m_nMouseOldPosY;
int field_544; int m_nHoverOption;
int m_nCurrScreen; int m_nCurrScreen;
int m_nCurrOption; int m_nCurrOption;
int field_550; int m_nCurrentInput;
int m_nPrevScreen; int m_nPrevScreen;
int field_558; int field_558;
int m_nCurrSaveSlot; int m_nCurrSaveSlot;
@ -165,17 +285,56 @@ public:
static int8 &m_bFrontEnd_ReloadObrTxtGxt; static int8 &m_bFrontEnd_ReloadObrTxtGxt;
static int32 &m_PrefsMusicVolume; static int32 &m_PrefsMusicVolume;
static int32 &m_PrefsSfxVolume; static int32 &m_PrefsSfxVolume;
static bool &m_bStartUpFrontEndRequested;
static bool &m_bShutDownFrontEndRequested;
static bool &m_PrefsAllowNastyGame; static bool &m_PrefsAllowNastyGame;
static bool &m_bStartUpFrontEndRequested;
void Process(void); private:
void DrawFrontEnd(void); enum eColumns { L, R, COLUMNS, };
void UnloadTextures(void);
void LoadAllTextures(void); public:
void LoadSettings(void); void BuildStatLine(char *, void *, uint16, void *);
void WaitForUserCD(void); static void CentreMousePointer();
void CheckCodesForControls(int, int);
bool CheckHover(int x1, int x2, int y1, int y2);
int CostructStatLine(int);
void DisplayHelperText();
float DisplaySlider(float, float, float, float, float, float);
void DoSettingsBeforeStartingAGame();
void Draw();
void DrawControllerBound(int, int, int, uint8);
void DrawControllerScreenExtraText(int, int, int);
void DrawControllerSetupScreen();
void DrawFrontEnd();
void DrawFrontEndNormal();
void DrawPlayerSetupScreen();
int FadeIn(int alpha); int FadeIn(int alpha);
void FilterOutColorMarkersFromString(uint16, CRGBA &);
int GetStartOptionsCntrlConfigScreens();
static void InitialiseChangedLanguageSettings();
void LoadAllTextures();
void LoadSettings();
static void MessageScreen(char *);
static void PickNewPlayerColour();
void PrintBriefs();
static void PrintErrorMessage();
void PrintStats();
void Process();
void ProcessButtonPresses();
void ProcessOnOffMenuOptions();
static void RequestFrontEndShutdown();
static void RequestFrontEndStartUp();
void ResetHelperText();
void SaveLoadFileError_SetUpErrorScreen();
void SaveSettings();
void SetHelperText(int text);
void ShutdownJustMenu();
static float StretchX(float);
static float StretchY(float );
void SwitchMenuOnAndOff();
void UnloadTextures();
void WaitForUserCD();
}; };
static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error"); static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error");

View File

@ -4,4 +4,9 @@
#include "PCSave.h" #include "PCSave.h"
WRAPPER void C_PcSave::SetSaveDirectory(const char *path) { EAXJMP(0x591EA0); } WRAPPER void C_PcSave::SetSaveDirectory(const char *path) { EAXJMP(0x591EA0); }
WRAPPER wchar *GetNameOfSavedGame(int counter) { EAXJMP(0x591B60); }
WRAPPER wchar *GetSavedGameDateAndTime(int counter) { EAXJMP(0x591B50); }
int *Slots = (int*)0x728040;
int *SlotFileName = (int*)0x6F07C8;
int *SlotSaveDate = (int*)0x72B858;

View File

@ -5,3 +5,10 @@ class C_PcSave
public: public:
static void SetSaveDirectory(const char *path); static void SetSaveDirectory(const char *path);
}; };
extern wchar *GetNameOfSavedGame(int counter);
extern wchar *GetSavedGameDateAndTime(int counter);
extern int *Slots;
extern int *SlotFileName;
extern int *SlotSaveDate;

File diff suppressed because it is too large Load Diff

View File

@ -96,32 +96,51 @@ public:
static CSprite2d *RadarSprites[21]; static CSprite2d *RadarSprites[21];
public: public:
static void ClearBlipForEntity(eBlipType type, int32 id);
static void Draw3dMarkers();
static void DrawMap();
static void StreamRadarSections(int x, int y);
static int ClipRadarPoly(CVector2D *out, const CVector2D *in);
static void DrawRadarSection(int x, int y);
static void RequestMapSection(int x, int y);
static void RemoveMapSection(int x, int y);
static void DrawBlips();
static int CalculateBlipAlpha(float dist); static int CalculateBlipAlpha(float dist);
static CRGBA GetRadarTraceColour(uint32 color, bool bright); static void ChangeBlipBrightness(int32 i, int32 bright);
static void ChangeBlipColour(int32 i);
static void ChangeBlipDisplay(int32 i, int16 flag);
static void ChangeBlipScale(int32 i, int16 scale);
static void ClearBlip(int32 i);
static void ClearBlipForEntity(int16 type, int32 id);
static int ClipRadarPoly(CVector2D *out, const CVector2D *in);
static bool DisplayThisBlip(int32 i);
static void Draw3dMarkers();
static void DrawBlips();
static void DrawMap();
static void DrawRadarMap(); static void DrawRadarMap();
static void DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int alpha);
static float LimitRadarPoint(CVector2D &point);
static void DrawRadarSprite(int sprite, float x, float y, int alpha);
static void ShowRadarMarker(CVector pos, CRGBA color, float radius);
static void ShowRadarTrace(float x, float y, uint32 size, uint32 red, uint32 green, uint32 blue, uint32 alpha);
static void DrawRadarMask(); static void DrawRadarMask();
static void SetRadarMarkerState(int counter, int flag); static void DrawRadarSection(int32 x, int32 y);
static bool DisplayThisBlip(int counter); static void DrawRadarSprite(int32 sprite, float x, float y, int32 alpha);
static void TransformRealWorldToTexCoordSpace(CVector2D &out, const CVector2D &in, int x, int y); static void DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int32 alpha);
static int32 GetActualBlipArray(int32 i);
static int32 GetNewUniqueBlipIndex(int32 i);
static int32 GetRadarTraceColour(int32 color, bool bright);
static void Initialise();
static float LimitRadarPoint(CVector2D &point);
static void LoadAllRadarBlips(int32);
static void LoadTextures();
static void RemoveRadarSections();
static void RemoveMapSection(int32 x, int32 y);
static void RequestMapSection(int32 x, int32 y);
static void SaveAllRadarBlips(int32);
static void SetBlipSprite(int32 i, int32 icon);
static int SetCoordBlip(int32 type, CVector pos, int32 flag);
static int SetEntityBlip(int32 type, CVector pos, int32 color, int32 flag);
static void SetRadarMarkerState(int32 i, int32 flag);
static void ShowRadarMarker(CVector pos, int16 color, float radius);
static void ShowRadarTrace(float x, float y, uint32 size, uint32 red, uint32 green, uint32 blue, uint32 alpha);
static void Shutdown();
static void StreamRadarSections(CVector posn);
static void StreamRadarSections(int32 x, int32 y);
static void TransformRealWorldToTexCoordSpace(CVector2D &out, const CVector2D &in, int32 x, int32 y);
static void TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D &in); static void TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D &in);
static void TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &in); static void TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &in);
static void TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D &in); static void TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D &in);
// no in CRadar in the game: // no in CRadar in the game:
static void GetTextureCorners(int x, int y, CVector2D *out); static void GetTextureCorners(int32 x, int32 y, CVector2D *out);
static void ClipRadarTileCoords(int &x, int &y); static void ClipRadarTileCoords(int32 &x, int32 &y);
static bool IsPointInsideRadar(const CVector2D &);
static int LineRadarBoxCollision(CVector2D &, const CVector2D &, const CVector2D &);
}; };

View File

@ -18,3 +18,5 @@ WRAPPER void cDMAudio::ChangeMusicMode(uint8 mode) { EAXJMP(0x57CCF0); }
WRAPPER void cDMAudio::PlayFrontEndSound(uint32, uint32) { EAXJMP(0x57CC20); } WRAPPER void cDMAudio::PlayFrontEndSound(uint32, uint32) { EAXJMP(0x57CC20); }
WRAPPER void cDMAudio::PlayOneShot(int, uint16, float) { EAXJMP(0x57C840); } WRAPPER void cDMAudio::PlayOneShot(int, uint16, float) { EAXJMP(0x57C840); }
WRAPPER int cDMAudio::GetRadioInCar() { EAXJMP(0x57CE40); }
WRAPPER uint8 cDMAudio::IsMP3RadioChannelAvailable() { EAXJMP(0x57C9F0); }

View File

@ -189,5 +189,7 @@ public:
void ChangeMusicMode(uint8 mode); void ChangeMusicMode(uint8 mode);
void PlayFrontEndSound(uint32, uint32); void PlayFrontEndSound(uint32, uint32);
void PlayOneShot(int, uint16, float); void PlayOneShot(int, uint16, float);
int GetRadioInCar();
uint8 IsMP3RadioChannelAvailable();
}; };
extern cDMAudio &DMAudio; extern cDMAudio &DMAudio;

View File

@ -16,6 +16,8 @@ int32 &gNumRetunePresses = *(int32*)0x650B80;
wchar *pCurrentStation = (wchar*)0x650B9C; wchar *pCurrentStation = (wchar*)0x650B9C;
uint8 &cDisplay = *(uint8*)0x650BA1; uint8 &cDisplay = *(uint8*)0x650BA1;
WRAPPER char* cMusicManager::Get3DProviderName(char) { EAXJMP(0x57A8C0); }
bool cMusicManager::PlayerInCar() bool cMusicManager::PlayerInCar()
{ {
if (!FindPlayerVehicle()) if (!FindPlayerVehicle())

View File

@ -264,6 +264,7 @@ public:
uint8 field_2395; uint8 field_2395;
public: public:
char *Get3DProviderName(char);
bool PlayerInCar(); bool PlayerInCar();
void DisplayRadioStationName(); void DisplayRadioStationName();
}; };

View File

@ -69,3 +69,4 @@ enum Config {
//#define NO_CDCHECK //#define NO_CDCHECK
#define NO_MOVIES #define NO_MOVIES
//#define USE_MY_DOCUMENTS //#define USE_MY_DOCUMENTS
#define NASTY_GAME

View File

@ -68,7 +68,7 @@ WRAPPER void CGarages::PrintMessages(void) { EAXJMP(0x426310); }
#else #else
void CGarages::PrintMessages() void CGarages::PrintMessages()
{ {
if (CTimer::GetTimeInMilliseconds() > CGarages::MessageStartTime && CTimer::GetTimeInMilliseconds() < CGarages::MessageEndTime) { if (CTimer::GetTimeInMilliseconds() > MessageStartTime && CTimer::GetTimeInMilliseconds() < MessageEndTime) {
CFont::SetScale(SCREEN_SCALE_X(1.2f / 2), SCREEN_SCALE_Y(1.5f / 2)); // BUG: game doesn't use macro here. CFont::SetScale(SCREEN_SCALE_X(1.2f / 2), SCREEN_SCALE_Y(1.5f / 2)); // BUG: game doesn't use macro here.
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetJustifyOff(); CFont::SetJustifyOff();
@ -77,16 +77,16 @@ void CGarages::PrintMessages()
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetFontStyle(FONT_BANK); CFont::SetFontStyle(FONT_BANK);
if (CGarages::MessageNumberInString2 < 0) { if (MessageNumberInString2 < 0) {
if (CGarages::MessageNumberInString < 0) { if (MessageNumberInString < 0) {
CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString((SCREEN_WIDTH/ 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(-84.0f), TheText.Get(CGarages::MessageIDString)); CFont::PrintString((SCREEN_WIDTH/ 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(-84.0f), TheText.Get(MessageIDString));
CFont::SetColor(CRGBA(89, 115, 150, 255)); CFont::SetColor(CRGBA(89, 115, 150, 255));
CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(-84.0f), TheText.Get(CGarages::MessageIDString)); CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(-84.0f), TheText.Get(MessageIDString));
} }
else { else {
CMessages::InsertNumberInString(TheText.Get(CGarages::MessageIDString), CGarages::MessageNumberInString, -1, -1, -1, -1, -1, gUString); CMessages::InsertNumberInString(TheText.Get(MessageIDString), MessageNumberInString, -1, -1, -1, -1, -1, gUString);
CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(-84.0f + 2.0 - 40.0f), gUString); CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(-84.0f + 2.0 - 40.0f), gUString);
@ -96,7 +96,7 @@ void CGarages::PrintMessages()
} }
} }
else { else {
CMessages::InsertNumberInString(TheText.Get(CGarages::MessageIDString), CGarages::MessageNumberInString2, -1, -1, -1, -1, -1, gUString); CMessages::InsertNumberInString(TheText.Get(MessageIDString), MessageNumberInString, MessageNumberInString2, -1, -1, -1, -1, gUString);
CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(-84.0f + 2.0 - 40.0f), gUString); CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(-84.0f + 2.0 - 40.0f), gUString);

View File

@ -11,6 +11,8 @@
#include "CutsceneMgr.h" #include "CutsceneMgr.h"
#include "Timer.h" #include "Timer.h"
#include "Weather.h" #include "Weather.h"
#include "Font.h"
#include "Text.h"
uint8 &CReplay::Mode = *(uint8*)0x95CD5B; uint8 &CReplay::Mode = *(uint8*)0x95CD5B;
CAddressInReplayBuffer &CReplay::Record = *(CAddressInReplayBuffer*)0x942F7C; CAddressInReplayBuffer &CReplay::Record = *(CAddressInReplayBuffer*)0x942F7C;
@ -223,7 +225,6 @@ WRAPPER bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buf
WRAPPER void CReplay::FinishPlayback(void) { EAXJMP(0x595B20); } WRAPPER void CReplay::FinishPlayback(void) { EAXJMP(0x595B20); }
WRAPPER void CReplay::Shutdown(void) { EAXJMP(0x595BD0); } WRAPPER void CReplay::Shutdown(void) { EAXJMP(0x595BD0); }
WRAPPER void CReplay::ProcessReplayCamera(void) { EAXJMP(0x595C40); } WRAPPER void CReplay::ProcessReplayCamera(void) { EAXJMP(0x595C40); }
WRAPPER void CReplay::Display(void) { EAXJMP(0x595EE0); }
WRAPPER void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float cam_z, bool load_scene) { EAXJMP(0x596030); } WRAPPER void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float cam_z, bool load_scene) { EAXJMP(0x596030); }
WRAPPER void CReplay::StoreStuffInMem(void) { EAXJMP(0x5961F0); } WRAPPER void CReplay::StoreStuffInMem(void) { EAXJMP(0x5961F0); }
WRAPPER void CReplay::RestoreStuffFromMem(void) { EAXJMP(0x5966E0); } WRAPPER void CReplay::RestoreStuffFromMem(void) { EAXJMP(0x5966E0); }
@ -238,6 +239,23 @@ WRAPPER bool CReplay::ShouldStandardCameraBeProcessed(void) { EAXJMP(0x597680);
WRAPPER void CReplay::ProcessLookAroundCam(void) { EAXJMP(0x5976C0); } WRAPPER void CReplay::ProcessLookAroundCam(void) { EAXJMP(0x5976C0); }
WRAPPER size_t CReplay::FindSizeOfPacket(uint8 type) { EAXJMP(0x597CC0); } WRAPPER size_t CReplay::FindSizeOfPacket(uint8 type) { EAXJMP(0x597CC0); }
#if 0
WRAPPER void CReplay::Display(void) { EAXJMP(0x595EE0); }
#else
void CReplay::Display()
{
if (CReplay::IsPlayingBack() && CTimer::GetFrameCounter() + 1 & 0x20) {
CFont::SetPropOn();
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(1.5f), SCREEN_SCALE_Y(1.5f));
CFont::SetAlignment(ALIGN_LEFT);
CFont::SetColor(CRGBA(255, 255, 200, 200));
CFont::SetFontStyle(FONT_BANK);
CFont::PrintString(SCREEN_SCALE_X(63.5f), SCREEN_SCALE_Y(30.0f), TheText.Get("REPLAY"));
}
}
#endif
STARTPATCHES STARTPATCHES
InjectHook(0x592FC0, PrintElementsInPtrList, PATCH_JUMP); InjectHook(0x592FC0, PrintElementsInPtrList, PATCH_JUMP);
InjectHook(0x592FE0, CReplay::Init, PATCH_JUMP); InjectHook(0x592FE0, CReplay::Init, PATCH_JUMP);

View File

@ -85,6 +85,7 @@ extern void (*DebugMenuProcess)(void);
extern void (*DebugMenuRender)(void); extern void (*DebugMenuRender)(void);
void DebugMenuInit(void); void DebugMenuInit(void);
void PrintGameVersion();
RwRGBA gColourTop; RwRGBA gColourTop;
@ -154,6 +155,7 @@ Idle(void *arg)
} }
RenderMenus(); RenderMenus();
PrintGameVersion();
DoFade(); DoFade();
Render2dStuffAfterFade(); Render2dStuffAfterFade();
CCredits::Render(); CCredits::Render();
@ -186,6 +188,7 @@ FrontendIdle(void)
DefinedState(); DefinedState();
RenderMenus(); RenderMenus();
PrintGameVersion();
DoFade(); DoFade();
Render2dStuffAfterFade(); Render2dStuffAfterFade();
CFont::DrawFonts(); CFont::DrawFonts();
@ -772,6 +775,25 @@ AppEventHandler(RsEvent event, void *param)
} }
} }
void PrintGameVersion()
{
CFont::SetPropOn();
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(0.7f), SCREEN_SCALE_Y(0.5f));
CFont::SetCentreOff();
CFont::SetRightJustifyOff();
CFont::SetBackGroundOnlyTextOff();
CFont::SetFontStyle(FONT_BANK);
CFont::SetWrapx(SCREEN_WIDTH);
CFont::SetDropShadowPosition(0);
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
CFont::SetColor(CRGBA(235, 170, 50, 255));
strcpy(gString, "RE3");
AsciiToUnicode(gString, gUString);
CFont::PrintString(SCREEN_SCALE_X(10.5f), SCREEN_SCALE_Y(8.0f), gUString);
}
STARTPATCHES STARTPATCHES
InjectHook(0x48E480, Idle, PATCH_JUMP); InjectHook(0x48E480, Idle, PATCH_JUMP);
InjectHook(0x48E700, FrontendIdle, PATCH_JUMP); InjectHook(0x48E700, FrontendIdle, PATCH_JUMP);

View File

@ -33,6 +33,12 @@ enum {
FONT_HEADING, FONT_HEADING,
}; };
enum {
ALIGN_LEFT,
ALIGN_CENTER,
ALIGN_RIGHT,
};
class CFont class CFont
{ {
static CFontDetails &Details; static CFontDetails &Details;
@ -56,6 +62,7 @@ public:
static void DrawFonts(void); static void DrawFonts(void);
static uint16 character_code(uint8 c); static uint16 character_code(uint8 c);
static CFontDetails GetDetails() { return Details; }
static void SetScale(float x, float y) { Details.scaleX = x; Details.scaleY = y; } static void SetScale(float x, float y) { Details.scaleX = x; Details.scaleY = y; }
static void SetSlantRefPoint(float x, float y) { Details.slantRefX = x; Details.slantRefY = y; } static void SetSlantRefPoint(float x, float y) { Details.slantRefX = x; Details.slantRefY = y; }
static void SetSlant(float s) { Details.slant = s; } static void SetSlant(float s) { Details.slant = s; }
@ -86,6 +93,23 @@ public:
static void SetCentreOff(void) { static void SetCentreOff(void) {
Details.centre = false; Details.centre = false;
} }
static void SetAlignment(uint8 alignment) {
if (alignment == ALIGN_LEFT) {
CFont::Details.justify = true;
CFont::Details.centre = false;
CFont::Details.rightJustify = false;
}
else if (alignment == ALIGN_CENTER) {
CFont::Details.justify = false;
CFont::Details.centre = true;
CFont::Details.rightJustify = false;
}
else if (alignment == ALIGN_RIGHT) {
CFont::Details.justify = false;
CFont::Details.centre = false;
CFont::Details.rightJustify = true;
}
}
static void SetWrapx(float x) { Details.wrapX = x; } static void SetWrapx(float x) { Details.wrapX = x; }
static void SetCentreSize(float s) { Details.centreSize = s; } static void SetCentreSize(float s) { Details.centreSize = s; }
static void SetBackgroundOn(void) { Details.background = true; } static void SetBackgroundOn(void) { Details.background = true; }

View File

@ -53,9 +53,9 @@ wchar *CHud::m_PagerMessage = (wchar*)0x878840;
bool &CHud::m_Wants_To_Draw_Hud = *(bool*)0x95CD89; bool &CHud::m_Wants_To_Draw_Hud = *(bool*)0x95CD89;
bool &CHud::m_Wants_To_Draw_3dMarkers = *(bool*)0x95CD62; bool &CHud::m_Wants_To_Draw_3dMarkers = *(bool*)0x95CD62;
wchar(*CHud::m_BigMessage)[128] = (wchar(*)[128])0x664CE0; wchar(*CHud::m_BigMessage)[128] = (wchar(*)[128])0x664CE0;
float *CHud::BigMessageInUse = (float*)0x862140; float CHud::BigMessageInUse[6];
float *CHud::BigMessageAlpha = (float*)0x862108; float CHud::BigMessageAlpha[6];
float *CHud::BigMessageX = (float*)0x773248; float CHud::BigMessageX[6];
float &CHud::OddJob2OffTimer = *(float*)0x942FA0; float &CHud::OddJob2OffTimer = *(float*)0x942FA0;
int8 &CHud::CounterOnLastFrame = *(int8*)0x95CD67; int8 &CHud::CounterOnLastFrame = *(int8*)0x95CD67;
@ -232,7 +232,7 @@ void CHud::Draw()
float fWidescreenOffset[2] = { 0.0f, 0.0f }; float fWidescreenOffset[2] = { 0.0f, 0.0f };
if (CMenuManager::m_PrefsUseWideScreen) { if (FrontEndMenuManager.m_PrefsUseWideScreen) {
fWidescreenOffset[0] = 0.0f; fWidescreenOffset[0] = 0.0f;
fWidescreenOffset[1] = SCREEN_SCALE_Y(18.0f); fWidescreenOffset[1] = SCREEN_SCALE_Y(18.0f);
} }
@ -362,25 +362,32 @@ void CHud::Draw()
/* /*
DrawAmmo DrawAmmo
*/ */
int16 AmmoAmount = CWeaponInfo::GetWeaponInfo(FindPlayerPed()->GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition;
int32 AmmoInClip = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoInClip; int32 AmmoInClip = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoInClip;
int32 TotalAmmo = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal; int32 TotalAmmo = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal;
int32 Ammo, Clip;
if (AmmoInClip <= 1 || AmmoInClip >= 1000) { if (AmmoAmount <= 1 || AmmoAmount >= 1000)
sprintf(sTemp, "%d", TotalAmmo); sprintf(sTemp, "%d", TotalAmmo);
}
else { else {
if (WeaponType == WEAPONTYPE_FLAMETHROWER) { if (WeaponType == WEAPONTYPE_FLAMETHROWER) {
int tot_min_clip_div_10 = (TotalAmmo - AmmoInClip) / 10; Clip = AmmoInClip / 10;
if (tot_min_clip_div_10 > 9999)
tot_min_clip_div_10 = 9999;
sprintf(sTemp, "%d-%d", tot_min_clip_div_10, AmmoInClip / 10); if ((TotalAmmo - AmmoInClip) / 10 <= 9999)
Ammo = (TotalAmmo - AmmoInClip) / 10;
else
Ammo = 9999;
} }
else { else {
if (AmmoInClip > 9999) Clip = AmmoInClip;
AmmoInClip = 9999;
sprintf(sTemp, "%d-%d", (TotalAmmo - AmmoInClip), AmmoInClip); if (TotalAmmo - AmmoInClip > 9999)
Ammo = 9999;
else
Ammo = TotalAmmo - AmmoInClip;
} }
sprintf(sTemp, "%d-%d", Ammo, Clip);
} }
AsciiToUnicode(sTemp, sPrint); AsciiToUnicode(sTemp, sPrint);
@ -580,7 +587,7 @@ void CHud::Draw()
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
if (CMenuManager::m_PrefsLanguage == 4) if (FrontEndMenuManager.m_PrefsLanguage == 4)
CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.8f), SCREEN_SCALE_Y(1.2f)); CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.8f), SCREEN_SCALE_Y(1.2f));
else else
CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f)); CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f));
@ -676,7 +683,7 @@ void CHud::Draw()
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
if (CMenuManager::m_PrefsLanguage != 3 && CMenuManager::m_PrefsLanguage != 4) if (FrontEndMenuManager.m_PrefsLanguage != 3 && FrontEndMenuManager.m_PrefsLanguage != 4)
CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f)); CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f));
else else
CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.85f), SCREEN_SCALE_Y(1.2f)); CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.85f), SCREEN_SCALE_Y(1.2f));
@ -976,7 +983,7 @@ void CHud::Draw()
DrawBigMessage DrawBigMessage
*/ */
// MissionCompleteFailedText // MissionCompleteFailedText
if (CHud::m_BigMessage[0][0]) { if (m_BigMessage[0][0]) {
if (BigMessageInUse[0] != 0.0f) { if (BigMessageInUse[0] != 0.0f) {
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
@ -1251,7 +1258,7 @@ void CHud::DrawAfterFade()
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
if (CGame::frenchGame || CMenuManager::m_PrefsLanguage == 4) if (CGame::frenchGame || FrontEndMenuManager.m_PrefsLanguage == 4)
CFont::SetScale(SCREEN_SCALE_X(0.884f), SCREEN_SCALE_Y(1.36f)); CFont::SetScale(SCREEN_SCALE_X(0.884f), SCREEN_SCALE_Y(1.36f));
else else
CFont::SetScale(SCREEN_SCALE_X(1.04f), SCREEN_SCALE_Y(1.6f)); CFont::SetScale(SCREEN_SCALE_X(1.04f), SCREEN_SCALE_Y(1.6f));

View File

@ -62,9 +62,9 @@ public:
static bool &m_Wants_To_Draw_Hud; static bool &m_Wants_To_Draw_Hud;
static bool &m_Wants_To_Draw_3dMarkers; static bool &m_Wants_To_Draw_3dMarkers;
static wchar(*m_BigMessage)[128]; static wchar(*m_BigMessage)[128];
static float *BigMessageInUse; static float BigMessageInUse[6];
static float *BigMessageAlpha; static float BigMessageAlpha[6];
static float *BigMessageX; static float BigMessageX[6];
static float &OddJob2OffTimer; static float &OddJob2OffTimer;
static int8 &CounterOnLastFrame; static int8 &CounterOnLastFrame;
static float &OddJob2XOffset; static float &OddJob2XOffset;

View File

@ -633,7 +633,9 @@ psInitialise(void)
C_PcSave::SetSaveDirectory(_psGetUserFilesFolder()); C_PcSave::SetSaveDirectory(_psGetUserFilesFolder());
InitialiseLanguage(); #ifndef NASTY_GAME
InitialiseLanguage();
#endif
FrontEndMenuManager.LoadSettings(); FrontEndMenuManager.LoadSettings();

View File

@ -78,6 +78,8 @@ RwBool _psSetVideoMode(RwInt32 subSystem, RwInt32 videoMode);
void CenterVideo(void); void CenterVideo(void);
void CloseClip(void); void CloseClip(void);
RwChar **_psGetVideoModeList();
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */