CPlayerPed & CMenuManager (#286)

Make Frontend great again!
This commit is contained in:
erorcun
2020-01-07 17:23:09 +03:00
committed by GitHub
parent 18de44e038
commit f9316d9cc3
13 changed files with 1046 additions and 815 deletions

File diff suppressed because it is too large Load Diff

View File

@ -7,8 +7,8 @@
#define MENUHEADER_WIDTH 0.84f
#define MENUHEADER_HEIGHT 1.6f
#define MENUACTION_POS_X 40.0f
#define MENUACTION_POS_Y 37.5f
#define MENUACTION_X_MARGIN 40.0f
#define MENUACTION_POS_Y 60.0f
#define MENUACTION_WIDTH 0.405f
#define MENUACTION_HEIGHT 0.63f
@ -41,7 +41,8 @@
#define MENUDROP_COLOR_A 150
#define MENUDROP_COLOR_SIZE -1
#define MENUSLIDER_X 306.0f
#define MENUSLIDER_X 256.0f
#define MENUSLIDER_UNK 256.0f
enum eLanguages
{
@ -326,7 +327,17 @@ enum eCheckHover
HOVEROPTION_19,
HOVEROPTION_20,
HOVEROPTION_CHANGESKIN,
HOVEROPTION_42 = 42,
HOVEROPTION_INCREASE_BRIGHTNESS = 32,
HOVEROPTION_DECREASE_BRIGHTNESS,
HOVEROPTION_INCREASE_DRAWDIST,
HOVEROPTION_DECREASE_DRAWDIST,
HOVEROPTION_INCREASE_MUSICVOLUME,
HOVEROPTION_DECREASE_MUSICVOLUME,
HOVEROPTION_INCREASE_SFXVOLUME,
HOVEROPTION_DECREASE_SFXVOLUME,
HOVEROPTION_INCREASE_MOUSESENS,
HOVEROPTION_DECREASE_MOUSESENS,
HOVEROPTION_42,
};
enum eMenuColumns
@ -404,7 +415,7 @@ public:
int m_nCurrExOption;
bool m_bSkinsFound;
bool m_bQuitGameNoCD;
char field_452;
bool m_bRenderGameInMenu;
bool m_bSaveMenuActive;
bool m_bLoadingSavedGame;
char field_455;
@ -467,9 +478,11 @@ public:
static bool &m_bShutDownFrontEndRequested;
static bool &m_PrefsAllowNastyGame;
static float &headingYStart;
static float &unkX;
static float &unkY;
static float &menuXYpadding;
static float &actionTextScaleX;
static float &actionTextScaleY;
static int &sthWithButtons;
static int &sthWithButtons2;
public:
static void BuildStatLine(char *text, void *stat, uint8 aFloat, void *stat2);
@ -479,7 +492,7 @@ public:
void CheckSliderMovement(int);
int CostructStatLine(int);
void DisplayHelperText();
float DisplaySlider(float, float, float, float, float, float);
int DisplaySlider(float, float, float, float, float, float);
void DoSettingsBeforeStartingAGame();
void Draw();
void DrawControllerBound(int, int, int, uint8);
@ -487,6 +500,9 @@ public:
void DrawControllerSetupScreen();
void DrawFrontEnd();
void DrawFrontEndNormal();
#ifdef PS2_SAVE_DIALOG
void DrawFrontEndSaveZone();
#endif
void DrawPlayerSetupScreen();
int FadeIn(int alpha);
void FilterOutColorMarkersFromString(uint16, CRGBA &);

View File

@ -4,8 +4,8 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_NONE = 0
{ "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, },
// MENUPAGE_STATS = 1
{ "FET_STA", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
// MENUPAGE_STATS = 1 - Both PrintStats and Draw were printing the page name, so deleted the string Draw looked for.
{ ""/*"FET_STA"*/, MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
@ -166,12 +166,21 @@ const CMenuScreen aScreens[] = {
MENUACTION_MEMCARDSAVECONFIRM, "JAILB_U", SAVESLOT_NONE, MENUPAGE_NONE,
},
// Unused in PC but anyway
// MENUPAGE_SAVE = 24
#ifdef PS2_SAVE_DIALOG
{ "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FES_SCG", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FESZ_SA", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
MENUACTION_UPDATEMEMCARDSAVE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
},
#else
{ "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FES_SCG", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_UPDATESAVE, "GMSAVE", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
MENUACTION_UPDATEMEMCARDSAVE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
},
#endif
// MENUPAGE_NO_MEMORY_CARD = 25
{ "FES_NOC", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,

View File

@ -158,6 +158,9 @@ void COnscreenTimerEntry::ProcessForDisplayClock() {
void COnscreenTimerEntry::ProcessForDisplayCounter() {
uint32 counter = *(uint32*)&CTheScripts::ScriptSpace[m_nCounterOffset];
assert(!m_nType || counter <= 100);
sprintf(m_bCounterBuffer, "%d", counter);
}

View File

@ -152,9 +152,10 @@ enum Config {
// Pad
#define KANGAROO_CHEAT
// Hud & radar
#define ASPECT_RATIO_SCALE
// Hud, frontend and radar
#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
#define PS2_SAVE_DIALOG // PS2 style save dialog with transparent black box
// Script
#define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default

View File

@ -141,9 +141,29 @@ Idle(void *arg)
CTimer::Update();
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
// We're basically merging FrontendIdle and Idle (just like TheGame on PS2)
#ifdef PS2_SAVE_DIALOG
// Only exists on PC FrontendIdle, probably some PS2 bug fix
if (FrontEndMenuManager.m_bMenuActive)
CSprite2d::SetRecipNearClip();
if (FrontEndMenuManager.m_bGameNotLoaded) {
CPad::UpdatePads();
FrontEndMenuManager.Process();
} else {
CPointLights::InitPerFrame();
CGame::Process();
DMAudio.Service();
}
if (RsGlobal.quit)
return;
#else
CPointLights::InitPerFrame();
CGame::Process();
DMAudio.Service();
#endif
if(CGame::bDemoMode && CTimer::GetTimeInMilliseconds() > (3*60 + 30)*1000 && !CCutsceneMgr::IsCutsceneProcessing()){
FrontEndMenuManager.m_bStartGameLoading = true;
@ -159,14 +179,16 @@ Idle(void *arg)
if(arg == nil)
return;
if((!FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.field_452 == 1) &&
if((!FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bRenderGameInMenu) &&
TheCamera.GetScreenFadeStatus() != FADE_2){
#ifdef GTA_PC
// This is from SA, but it's nice for windowed mode
RwV2d pos;
pos.x = SCREEN_WIDTH/2.0f;
pos.y = SCREEN_HEIGHT/2.0f;
RsMouseSetPos(&pos);
if (!FrontEndMenuManager.m_bRenderGameInMenu) {
// This is from SA, but it's nice for windowed mode
RwV2d pos;
pos.x = SCREEN_WIDTH / 2.0f;
pos.y = SCREEN_HEIGHT / 2.0f;
RsMouseSetPos(&pos);
}
#endif
CRenderer::ConstructRenderList();
CRenderer::PreRender();
@ -210,6 +232,10 @@ Idle(void *arg)
return;
}
#ifdef PS2_SAVE_DIALOG
if (FrontEndMenuManager.m_bMenuActive)
DefinedState();
#endif
RenderMenus();
DoFade();
Render2dStuffAfterFade();
@ -228,7 +254,7 @@ FrontendIdle(void)
#endif
CTimer::Update();
CSprite2d::SetRecipNearClip();
CSprite2d::SetRecipNearClip(); // this should be on InitialiseRenderWare according to PS2 asm. seems like a bug fix
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
CPad::UpdatePads();
@ -248,11 +274,11 @@ FrontendIdle(void)
if(!RsCameraBeginUpdate(Scene.camera))
return;
DefinedState();
DefinedState(); // seems redundant, but breaks resolution change.
RenderMenus();
DoFade();
Render2dStuffAfterFade();
CFont::DrawFonts();
// CFont::DrawFonts(); // redundant
DoRWStuffEndOfFrame();
}
@ -744,16 +770,16 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen)
#ifdef CHATTYSPLASH
// my attempt
static wchar tmpstr[80];
float scale = SCREEN_SCALE_Y(0.8f);
vpos -= 50*scale;
CFont::SetScale(scale, scale);
float yscale = SCREEN_SCALE_Y(0.9f);
vpos -= 45*yscale;
CFont::SetScale(SCREEN_SCALE_X(0.75f), yscale);
CFont::SetPropOn();
CFont::SetRightJustifyOff();
CFont::SetFontStyle(FONT_BANK);
CFont::SetColor(CRGBA(255, 255, 255, 255));
AsciiToUnicode(str1, tmpstr);
CFont::PrintString(hpos, vpos, tmpstr);
vpos += 25*scale;
vpos += 22*yscale;
AsciiToUnicode(str2, tmpstr);
CFont::PrintString(hpos, vpos, tmpstr);
#endif
@ -999,7 +1025,11 @@ AppEventHandler(RsEvent event, void *param)
case rsFRONTENDIDLE:
{
#ifdef PS2_SAVE_DIALOG
Idle((void*)1);
#else
FrontendIdle();
#endif
return rsEVENTPROCESSED;
}