Initial commit for Frontend.

Bug fixes:
fix #40, fix #39, fix #38, fix #37, fix #21.
Code organization and cleanup...
This commit is contained in:
_AG
2019-06-25 02:34:29 +02:00
parent f07f411629
commit e765dfe90a
19 changed files with 2489 additions and 551 deletions

View File

@@ -2,6 +2,43 @@
#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 {
LANGUAGE_AMERICAN,
LANGUAGE_FRENCH,
@@ -10,6 +47,70 @@ enum {
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 {
MENU_NONE = 0,
MENU_STATS = 1,
@@ -72,6 +173,11 @@ enum eMenuScreen {
MENU_58 = 58,
};
enum eCheckHover {
ACTIVATE_OPTION = 2,
IGNORE_OPTION = 42,
};
struct tSkinInfo
{
int field_0;
@@ -81,6 +187,20 @@ struct tSkinInfo
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
{
public:
@@ -136,10 +256,10 @@ public:
int m_nHelperTextAlpha;
int m_nMouseOldPosX;
int m_nMouseOldPosY;
int field_544;
int m_nHoverOption;
int m_nCurrScreen;
int m_nCurrOption;
int field_550;
int m_nCurrentInput;
int m_nPrevScreen;
int field_558;
int m_nCurrSaveSlot;
@@ -165,17 +285,56 @@ public:
static int8 &m_bFrontEnd_ReloadObrTxtGxt;
static int32 &m_PrefsMusicVolume;
static int32 &m_PrefsSfxVolume;
static bool &m_bStartUpFrontEndRequested;
static bool &m_bShutDownFrontEndRequested;
static bool &m_PrefsAllowNastyGame;
static bool &m_bStartUpFrontEndRequested;
void Process(void);
void DrawFrontEnd(void);
void UnloadTextures(void);
void LoadAllTextures(void);
void LoadSettings(void);
void WaitForUserCD(void);
private:
enum eColumns { L, R, COLUMNS, };
public:
void BuildStatLine(char *, void *, uint16, 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);
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");