Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Commit

Permalink
Add keys to switch mod loader mods page.
Browse files Browse the repository at this point in the history
  • Loading branch information
gennariarmando committed Feb 19, 2022
1 parent 4d23de6 commit 43a80f8
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 4 deletions.
2 changes: 2 additions & 0 deletions resources/VHud/text/english.ini
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,8 @@ H_DEL = Delete ~k~~MENU_DELETE_SAVE~
H_NOKEY = Unset ~k~~MENU_UNSETKEY~
HP_SEL = Select ~k~~PED_SPRINT~
HP_BAC = Back ~k~~VEHICLE_ENTER_EXIT~
H_MLPREV = Previous Page ~k~~MENU_ML_PREVPAGE~
H_MLNEXT = Next Page ~k~~MENU_ML_NEXTPAGE~

[VEHICLE]
NORMAL = Normal
Expand Down
2 changes: 2 additions & 0 deletions resources/VHud/text/italian.ini
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,8 @@ H_DEL = Elimina ~k~~MENU_DELETE_SAVE~
H_NOKEY = Rimuovi tasto ~k~~MENU_UNSETKEY~
HP_SEL = Seleziona ~k~~PED_SPRINT~
HP_BAC = Indietro ~k~~VEHICLE_ENTER_EXIT~
H_MLPREV = Pagina precedente ~k~~MENU_ML_PREVPAGE~
H_MLNEXT = Pagina successiva ~k~~MENU_ML_NEXTPAGE~
[VEHICLE]
NORMAL = Normal
Expand Down
3 changes: 2 additions & 1 deletion source/FontNew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,8 @@ void CFontNew::SetTokenToIgnore(char t1, char t2) {

int CFontNew::PrintString(float x, float y, const char* s) {
int n = 0;
if (*s != '*') {

if (s && *s != '*') {
if (Details.background) {
CRect rect;
x += Details.backgroundBorder.left;
Expand Down
23 changes: 21 additions & 2 deletions source/MenuNew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ auto HelpText_ShowHideLegend = []() { MenuNew.bShowLegend = MenuNew.bShowLegend
auto HelpText_DeleteSave = []() { MenuNew.SetMenuMessage(MENUMESSAGE_DELETE_GAME); Audio.PlayChunk(CHUNK_MENU_SELECT, 1.0f); };
auto HelpText_ApplyChanges = []() { if (MenuNew.nMenuAlert == MENUALERT_PENDINGCHANGES) MenuNew.ApplyGraphicsChanges(); Audio.PlayChunk(CHUNK_MENU_SELECT, 1.0f); };
auto HelpText_UnSetKey = []() { MenuNew.SetMenuMessage(MENUMESSAGE_SETKEYTONULL); Audio.PlayChunk(CHUNK_MENU_SELECT, 1.0f); };
auto HelpText_MLPrevPage = []() { MenuNew.ProcessOriginalOptions(MENUPAGE_MODLOADER_MODS, 11, false, true); MenuNew.SetInputTypeAndClear(MenuNew.nCurrentInputType); Audio.PlayChunk(CHUNK_MENU_SCROLL, 1.0f); };
auto HelpText_MLNextPage = []() { MenuNew.ProcessOriginalOptions(MENUPAGE_MODLOADER_MODS, 9, false, true); MenuNew.SetInputTypeAndClear(MenuNew.nCurrentInputType); Audio.PlayChunk(CHUNK_MENU_SCROLL, 1.0f); };

static LateStaticInit InstallHooks([]() {
patch::Set<BYTE>(0x53E797, 0xEB);
Expand Down Expand Up @@ -1737,6 +1739,10 @@ void CMenuNew::Process() {
}
[[fallthrough]];
default:
if (nCurrentInputType == MENUINPUT_ENTRY && !faststrcmp(MenuScreen[nCurrentScreen].Tab[nCurrentTabItem].tabName, "FE_MODS")) {
AppendHelpText("H_MLPREV", HelpText_MLPrevPage);
AppendHelpText("H_MLNEXT", HelpText_MLNextPage);
}
AppendHelpText("H_BAC", HelpText_GoBack);
AppendHelpText("H_SEL", HelpText_GoThrough);
break;
Expand Down Expand Up @@ -2357,14 +2363,23 @@ void CMenuNew::ProcessEntryStuff(int enter, int input) {
if (enter)
process = true;

if (process) {
if (process && nCurrentEntryItem < 9) {
page = MENUPAGE_MODLOADER_MODS;

nPreviousScreen = nCurrentScreen;
nCurrentScreen = MENUSCREEN_MODLOADER_MOD_OPTION;
bRequestScreenUpdate = true;
SetInputTypeAndClear(MENUINPUT_TAB);
}

if (input > 0) {
ProcessOriginalOptions(MENUPAGE_MODLOADER_MODS, 11, false, true);
SetInputTypeAndClear(nCurrentInputType);
}
else if (input < 0) {
ProcessOriginalOptions(MENUPAGE_MODLOADER_MODS, 9, false, true);
SetInputTypeAndClear(nCurrentInputType);
}
}
else if (!faststrcmp(MenuScreen[nCurrentScreen].Tab[nCurrentTabItem].tabName, "FE_MLSET")) {
process = true;
Expand Down Expand Up @@ -3206,7 +3221,11 @@ void CMenuNew::DrawDefault() {
const int entryType = MenuScreen[nCurrentScreen].Tab[nCurrentTabItem].Entries[i].type;
switch (entryType) {
case MENUENTRY_ORIGINAL:
leftText = OriginalLeftTextString[i];
if (char* str = OriginalLeftTextString[i]) {

if (str[0] != '\0')
leftText = OriginalLeftTextString[i];
}
break;
case MENUENTRY_LOADGAME:
leftText = nSaveSlots[i];
Expand Down
4 changes: 3 additions & 1 deletion source/PadNew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ CControls Controls[NUM_CONTROL_ACTIONS] = {
{ "MENU_APPLY_CHANGES", KEY(' '), GAMEPAD_SQUARE, GAMEPAD_SQUARE },
{ "MENU_BACK", KEY(rsESC), GAMEPAD_CIRCLE, GAMEPAD_CIRCLE },
{ "MENU_SELECT", KEY(rsENTER), GAMEPAD_CROSS, GAMEPAD_CROSS },
{ "MENU_UNSETKEY", KEY(' '), GAMEPAD_SQUARE, GAMEPAD_SQUARE }
{ "MENU_UNSETKEY", KEY(' '), GAMEPAD_SQUARE, GAMEPAD_SQUARE },
{ "MENU_ML_PREVPAGE", KEY(rsLEFT), GAMEPAD_DPADLEFT, GAMEPAD_DPADLEFT },
{ "MENU_ML_NEXTPAGE", KEY(rsRIGHT), GAMEPAD_DPADLEFT, GAMEPAD_DPADRIGHT }
};

const char* controlKeysStrings[62] = {
Expand Down
2 changes: 2 additions & 0 deletions source/PadNew.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ enum eControlsActions {
MENU_BACK,
MENU_SELECT,
MENU_UNSETKEY,
MENU_ML_PREVPAGE,
MENU_ML_NEXTPAGE,
NUM_CONTROL_ACTIONS
};

Expand Down

0 comments on commit 43a80f8

Please sign in to comment.