summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/ControllerConfig.cpp1
-rw-r--r--src/core/ControllerConfig.h3
-rw-r--r--src/core/Frontend.cpp336
-rw-r--r--src/core/Frontend.h36
-rw-r--r--src/core/MenuScreens.h4
-rw-r--r--src/core/PlayerInfo.cpp8
-rw-r--r--src/core/PlayerInfo.h6
-rw-r--r--src/core/Text.cpp2
-rw-r--r--src/core/Text.h1
9 files changed, 305 insertions, 92 deletions
diff --git a/src/core/ControllerConfig.cpp b/src/core/ControllerConfig.cpp
index d7567ac4..e3a586b2 100644
--- a/src/core/ControllerConfig.cpp
+++ b/src/core/ControllerConfig.cpp
@@ -21,6 +21,7 @@ WRAPPER void CControllerConfigManager::InitDefaultControlConfigJoyPad(unsigned i
WRAPPER void CControllerConfigManager::ClearSimButtonPressCheckers() { EAXJMP(0x58D220); }
WRAPPER void CControllerConfigManager::AffectPadFromKeyBoard() { EAXJMP(0x58D0C0); }
WRAPPER void CControllerConfigManager::AffectPadFromMouse() { EAXJMP(0x58D1A0); }
+WRAPPER void CControllerConfigManager::ClearSettingsAssociatedWithAction(int, int) { EAXJMP(0x58EB40); }
void CControllerConfigManager::LoadSettings(int32 file)
{
diff --git a/src/core/ControllerConfig.h b/src/core/ControllerConfig.h
index 581efe05..8a434245 100644
--- a/src/core/ControllerConfig.h
+++ b/src/core/ControllerConfig.h
@@ -50,7 +50,8 @@ public:
void ClearSimButtonPressCheckers();
void AffectPadFromKeyBoard();
void AffectPadFromMouse();
-
+ void ClearSettingsAssociatedWithAction(int, int);
+
};
VALIDATE_SIZE(CControllerConfigManager, 0x143C);
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 2fa9d8ea..17a5ad30 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -24,6 +24,8 @@
#include "Vehicle.h"
#include "MBlur.h"
#include "PlayerSkin.h"
+#include "PlayerInfo.h"
+#include "World.h"
int32 &CMenuManager::OS_Language = *(int32*)0x5F2F78;
int8 &CMenuManager::m_PrefsUseVibration = *(int8*)0x95CD92;
@@ -50,7 +52,9 @@ int8 &CMenuManager::m_bFrontEnd_ReloadObrTxtGxt = *(int8*)0x628CFC;
int32 &CMenuManager::m_PrefsMusicVolume = *(int32*)0x5F2E4C;
int32 &CMenuManager::m_PrefsSfxVolume = *(int32*)0x5F2E48;
-uint8 *CMenuManager::m_PrefsSkinFile = (uint8*)0x5F2E74;
+char *CMenuManager::m_PrefsSkinFile = (char*)0x5F2E74;
+
+int32 &CMenuManager::m_KeyPressedCode = *(int32*)0x5F2E70;
CMenuManager &FrontEndMenuManager = *(CMenuManager*)0x8F59D8;
@@ -59,11 +63,14 @@ float lodMultiplier = *(float*)0x5F726C;
// Stuff not in CMenuManager:
int VibrationTime;
-char* pEditString;
-int32 pControlEdit;
+char* pEditString = (char*)0x628D00;
+int32 &pControlEdit = *(int32*)0x628D08;
int8 DisplayComboButtonErrMsg;
-bool MouseButtonJustClicked;
-bool JoyButtonJustClicked;
+int8 MouseButtonJustClicked;
+int8 JoyButtonJustClicked;
+int32 &nTimeForSomething = *(int32*)0x628D54;
+int32 TypeOfControl = 0;
+int32 *pControlTemp = 0;
// Frontend inputs.
bool GetPadBack();
@@ -135,12 +142,28 @@ char *MenuFilenames[] = {
nil, nil
};
-#if 1
-WRAPPER void CMenuManager::BuildStatLine(char *, void *, uint16, void *) { EAXJMP(0x483870); }
+#if 0
+WRAPPER void CMenuManager::BuildStatLine(char *text, float *stat, bool aFloat, float* stat2) { EAXJMP(0x483870); }
#else
-void CMenuManager::BuildStatLine(char *, void *, uint16, void *)
+void CMenuManager::BuildStatLine(char *text, float *stat, bool aFloat, float* stat2)
{
+ if (!text)
+ return;
+ if (stat) {
+ if (aFloat)
+ sprintf(gString, "%.2f");
+ else
+ sprintf(gString, "%d");
+ }
+ else if (stat2) {
+ if (aFloat)
+ sprintf(gString, "%.2f %s %.2f", stat, UnicodeToAscii(TheText.Get("FEST_OO")), stat2);
+ else
+ sprintf(gString, "%d %s %d", stat, UnicodeToAscii(TheText.Get("FEST_OO")), stat2);
+ }
+
+ wcscpy((wchar_t*)gUString, (wchar_t*)TheText.Get(text));
}
#endif
@@ -164,11 +187,11 @@ void CMenuManager::CentreMousePointer()
#endif
#if 1
-WRAPPER void CMenuManager::CheckCodesForControls(int, int) { EAXJMP(0x48A950); }
+WRAPPER int CMenuManager::CheckCodesForControls(int32) { EAXJMP(0x48A950); }
#else
-void CMenuManager::CheckCodesForControls()
+void CMenuManager::CheckCodesForControls(int, int)
{
-
+ DisplayComboButtonErrMsg = 0;
}
#endif
@@ -719,9 +742,9 @@ void CMenuManager::Draw()
m_nPrevOption = m_nCurrOption;
if (GetMouseForward())
- m_nHoverOption = IGNORE_OPTION;
+ m_nHoverOption = HOVEROPTION_NULL;
else
- m_nHoverOption = ACTIVATE_OPTION;
+ m_nHoverOption = HOVEROPTION_DEFAULT;
}
}
}
@@ -1291,75 +1314,144 @@ WRAPPER void CMenuManager::Process(void) { EAXJMP(0x485100); }
#else
void CMenuManager::Process(void)
{
- if (m_bSaveMenuActive && TheCamera.GetScreenFadeStatus())
+ if (!m_bSaveMenuActive && TheCamera.GetScreenFadeStatus())
return;
- field_113 = 0;
+ field_112 = 0;
+ m_bLanguageLoaded = false;
+ m_bStartGameLoading = false;
InitialiseChangedLanguageSettings();
+ //
SwitchMenuOnAndOff();
- if (m_bMenuActive) {
- LoadAllTextures();
+ // Be able to re-open menu correctly.
+ if (!m_bMenuActive) {
+ if (GetPadExitEnter())
+ RequestFrontEndStartUp();
+
+ UnloadTextures();
+ field_452 = 0;
+ SwitchToNewScreen(MENUPAGE_NONE);
+ pEditString = 0;
+ field_113 = 0;
+ return;
+ }
- if (m_nCurrScreen == MENUPAGE_DELETING) {
- bool SlotPopulated = false;
+ // Load frontend textures.
+ LoadAllTextures();
- if (PcSaveHelper.DeleteSlot(m_nCurrSaveSlot)) {
- PcSaveHelper.PopulateSlotInfo();
- SlotPopulated = true;
- }
+ // Set save/delete game pages.
+ if (m_nCurrScreen == MENUPAGE_DELETING) {
+ bool SlotPopulated = false;
- if (SlotPopulated) {
- m_nPrevScreen = m_nCurrScreen;
- m_nCurrScreen = MENUPAGE_DELETE_SUCCESS;
- m_nCurrOption = 0;
- m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
- }
- else
- SaveLoadFileError_SetUpErrorScreen();
- }
- if (m_nCurrScreen == MENUPAGE_SAVING_IN_PROGRESS) {
- int8 SaveSlot = PcSaveHelper.SaveSlot(m_nCurrSaveSlot);
+ if (PcSaveHelper.DeleteSlot(m_nCurrSaveSlot)) {
PcSaveHelper.PopulateSlotInfo();
- if (SaveSlot) {
- m_nPrevScreen = m_nCurrScreen;
- m_nCurrScreen = MENUPAGE_SAVE_SUCCESSFUL;
- m_nCurrOption = 0;
- m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
- }
- else
- SaveLoadFileError_SetUpErrorScreen();
+ SlotPopulated = true;
}
- if (m_nCurrScreen == MENUPAGE_LOADING_IN_PROGRESS) {
- if (CheckSlotDataValid(m_nCurrSaveSlot)) {
- TheCamera.m_bUseMouse3rdPerson = m_ControlMethod == 0;
- if (m_PrefsVsyncDisp != m_PrefsVsync)
- m_PrefsVsync = m_PrefsVsyncDisp;
- DMAudio.Service();
- m_bStartGameLoading = 1;
- RequestFrontEndShutdown();
- m_bLoadingSavedGame = 1;
- b_FoundRecentSavedGameWantToLoad = 1;
- DMAudio.SetEffectsFadeVol(0);
- DMAudio.SetMusicFadeVol(0);
- DMAudio.ResetTimers(CTimer::GetTimeInMilliseconds());
- }
- else
- SaveLoadFileError_SetUpErrorScreen();
+
+ if (SlotPopulated) {
+ m_nPrevScreen = m_nCurrScreen;
+ m_nCurrScreen = MENUPAGE_DELETE_SUCCESS;
+ m_nCurrOption = 0;
+ m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
}
+ else
+ SaveLoadFileError_SetUpErrorScreen();
+ }
+ if (m_nCurrScreen == MENUPAGE_SAVING_IN_PROGRESS) {
+ int8 SaveSlot = PcSaveHelper.SaveSlot(m_nCurrSaveSlot);
+ PcSaveHelper.PopulateSlotInfo();
+ if (SaveSlot) {
+ m_nPrevScreen = m_nCurrScreen;
+ m_nCurrScreen = MENUPAGE_SAVE_SUCCESSFUL;
+ m_nCurrOption = 0;
+ m_nScreenChangeDelayTimer = CTimer::GetTimeInMillisecondsPauseMode();
+ }
+ else
+ SaveLoadFileError_SetUpErrorScreen();
+ }
+ if (m_nCurrScreen == MENUPAGE_LOADING_IN_PROGRESS) {
+ if (CheckSlotDataValid(m_nCurrSaveSlot)) {
+ TheCamera.m_bUseMouse3rdPerson = m_ControlMethod == 0;
+ if (m_PrefsVsyncDisp != m_PrefsVsync)
+ m_PrefsVsync = m_PrefsVsyncDisp;
+ DMAudio.Service();
+ m_bStartGameLoading = 1;
+ RequestFrontEndShutdown();
+ m_bLoadingSavedGame = 1;
+ b_FoundRecentSavedGameWantToLoad = 1;
+ DMAudio.SetEffectsFadeVol(0);
+ DMAudio.SetMusicFadeVol(0);
+ DMAudio.ResetTimers(CTimer::GetTimeInMilliseconds());
+ }
+ else
+ SaveLoadFileError_SetUpErrorScreen();
+ }
+
+ ProcessButtonPresses();
- ProcessButtonPresses();
+ // Set binding keys.
+ if (pEditString && !CPad::EditString(pEditString, 0)) {
+ if (!pEditString)
+ strcpy(pEditString, "NoName");
+ pEditString = 0;
+ SaveSettings();
}
- else {
- if (GetPadExitEnter())
- RequestFrontEndStartUp();
- UnloadTextures();
- m_nPrevScreen = MENUPAGE_NONE;
- m_nCurrScreen = m_nPrevScreen;
- m_nCurrOption = MENUROW_0;
+ if (field_113) {
+ if ((m_nCurrScreen == MENUPAGE_13 || m_nCurrScreen == MENUPAGE_16) && CTimer::GetTimeInMillisecondsPauseMode() > field_558)
+ SwitchToNewScreen(m_nPrevScreen);
+
+ // Reset pad shaking.
+ if (VibrationTime && CTimer::GetTimeInMillisecondsPauseMode() > VibrationTime) {
+ CPad::GetPad(0)->StopPadsShaking();
+ VibrationTime = 0;
+ }
+
+ if (m_bStartGameLoading) {
+ if (m_bGameNotLoaded)
+ DMAudio.Service();
+ }
+ }
+
+ if (!field_456) {
+ JoyButtonJustClicked = 0;
+ CPad::EditCodesForControls(&pControlEdit, 0);
+ MouseButtonJustClicked = 0;
+
+ if (GetMouseForward())
+ MouseButtonJustClicked = 1;
+ else {
+ if (GetMouseBack())
+ MouseButtonJustClicked = 3;
+ }
+
+ JoyButtonJustClicked = ControlsManager.GetJoyButtonJustDown();
+
+ if (JoyButtonJustClicked)
+ TypeOfControl = 3;
+ if (MouseButtonJustClicked)
+ TypeOfControl = 2;
+ if (pControlEdit != 1056)
+ TypeOfControl = 0;
+
+ if (field_534) {
+ if (!m_bKeyChangeNotProcessed) {
+ if (pControlEdit != 1056 || MouseButtonJustClicked || JoyButtonJustClicked)
+ CheckCodesForControls(TypeOfControl);
+
+ field_535 = 1;
+ return;
+ }
+ }
+ else {
+ pControlEdit = 0;
+ field_113 = 0;
+ m_KeyPressedCode = -1;
+ }
}
+ field_456 = 0;
}
#endif
@@ -1368,7 +1460,7 @@ WRAPPER void CMenuManager::ProcessButtonPresses() { EAXJMP(0x4856F0); }
#else
void CMenuManager::ProcessButtonPresses()
{
- // Update Mouse Position
+ // Update mouse position
m_nMouseOldPosX = m_nMousePosX;
m_nMouseOldPosY = m_nMousePosY;
@@ -1390,6 +1482,70 @@ void CMenuManager::ProcessButtonPresses()
else if (GetPadInput())
m_bShowMouse = false;
+ if (m_nCurrScreen == MENUPAGE_MULTIPLAYER_FIND_GAME || m_nCurrScreen == MENUPAGE_SKIN_SELECT || m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
+ if (m_nCurrScreen == MENUPAGE_SKIN_SELECT)
+ field_440 = m_nSkinsTotal;
+
+ if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
+ field_440 = m_ControlMethod ? 30 : 25;
+
+ if (field_44C > field_440)
+ field_44C = field_440 - 1;
+ }
+
+ if (!GetPadBack() || m_nCurrScreen != MENUPAGE_KEYBOARD_CONTROLS || field_535)
+ field_535 = 0;
+ else if (field_536 == 19) {
+ m_nHoverOption = 42;
+ field_113 = 1;
+ field_456 = 1;
+ m_bKeyChangeNotProcessed = 1;
+ //pControlEdit = m_KeyPressedCode;
+ }
+
+ if (GetPadForward()) {
+ switch (field_536) {
+ case 19:
+ if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
+ field_113 = 1;
+ field_456 = 1;
+ //pControlEdit = m_KeyPressedCode;
+ }
+ if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) {
+ strcpy(m_PrefsSkinFile, m_aSkinName);
+ CWorld::Players->SetPlayerSkin(m_PrefsSkinFile);
+ field_536 = 9;
+ }
+
+ m_nHoverOption = HOVEROPTION_NULL;
+ SaveSettings();
+ break;
+ case 21:
+ strcpy(m_PrefsSkinFile, m_aSkinName);
+ CWorld::Players->SetPlayerSkin(m_PrefsSkinFile);
+ field_536 = 9;
+ break;
+ default:
+ break;
+ };
+ }
+
+ bool once = false;
+ if (!once) {
+ once = true;
+ nTimeForSomething = 0;
+ }
+
+ if ((CTimer::GetTimeInMillisecondsPauseMode() - nTimeForSomething) > 200) {
+ field_520 = 0;
+ field_521 = 0;
+ field_522 = 0;
+ field_523 = 0;
+ field_524 = 0;
+ nTimeForSomething = CTimer::GetTimeInMillisecondsPauseMode();
+ }
+ }
+
// Get number of menu options.
uint8 NumberOfMenuOptions = GetNumberOfMenuOptions();
@@ -1436,6 +1592,14 @@ void CMenuManager::ProcessButtonPresses()
RequestFrontEndShutdown();
PlayEscSound = true;
break;
+ case MENUPAGE_KEYBOARD_CONTROLS:
+ if (!m_bKeyChangeNotProcessed) {
+ m_bKeyChangeNotProcessed = true;
+ field_534 = 0;
+ }
+ else
+ SwitchToNewScreen(aScreens[m_nCurrScreen].m_PreviousPage[0]);
+ break;
default:
SwitchToNewScreen(aScreens[m_nCurrScreen].m_PreviousPage[0]);
PlayEscSound = true;
@@ -1446,17 +1610,34 @@ void CMenuManager::ProcessButtonPresses()
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_EXIT, 0);
}
- // TODO: finish hover options.
- // Set mouse buttons.
+ // Set hover options, how it is supposed to be used isn't really clear yet.
if (GetMouseForward()) {
switch (m_nHoverOption) {
- case ACTIVATE_OPTION:
+ case HOVEROPTION_DEFAULT:
if (m_nCurrOption || m_nCurrScreen != MENUPAGE_PAUSE_MENU)
m_nCurrOption = m_nPrevOption;
- m_nHoverOption = ACTIVATE_OPTION;
+ m_nHoverOption = HOVEROPTION_DEFAULT;
+ break;
+ case HOVEROPTION_12:
+ m_nHoverOption = HOVEROPTION_14;
+ break;
+ case HOVEROPTION_13:
+ m_nHoverOption = HOVEROPTION_15;
+ break;
+ case HOVEROPTION_19:
+ m_nHoverOption = HOVEROPTION_20;
+ break;
+ case HOVEROPTION_CHANGESKIN:
+ if (m_nSkinsTotal > 0) {
+ m_pSelectedSkin = m_sSkin.field_304;
+ strcpy(m_PrefsSkinFile, m_aSkinName);
+ CWorld::Players->SetPlayerSkin(m_PrefsSkinFile);
+ SaveSettings();
+ }
break;
default:
+ m_nHoverOption = HOVEROPTION_NULL;
break;
};
}
@@ -1495,14 +1676,6 @@ void CMenuManager::ProcessButtonPresses()
default:
break;
};
-
- // Reset pad shaking.
- if (VibrationTime != 0) {
- if (CTimer::GetTimeInMillisecondsPauseMode() > VibrationTime) {
- CPad::GetPad(0)->StopShaking(0);
- VibrationTime = 0;
- }
- }
}
#endif
@@ -1683,6 +1856,9 @@ void CMenuManager::ProcessOnOffMenuOptions()
case MENUACTION_UPDATEMEMCARDSAVE:
RequestFrontEndShutdown();
break;
+ case MENUACTION_GETKEY:
+ //*pControlEdit = m_KeyPressedCode;
+ break;
case MENUACTION_INVVERT:
MousePointerStateHelper.bInvertVertically = MousePointerStateHelper.bInvertVertically == false;
return;
@@ -2204,7 +2380,7 @@ void CMenuManager::SetDefaultPreferences(int8 screen)
m_PrefsVsync = true;
m_PrefsLOD = 1.2f;
m_PrefsVsyncDisp = true;
- lodMultiplier = 1.2;
+ lodMultiplier = 1.2f;
CMBlur::BlurOn = true;
CMBlur::MotionBlurOpen(Scene.camera);
m_PrefsUseVibration = false;
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index 9b9377da..ede036d2 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -306,8 +306,29 @@ enum eMenuAction
enum eCheckHover
{
- ACTIVATE_OPTION = 2,
- IGNORE_OPTION = 42,
+ HOVEROPTION_0,
+ HOVEROPTION_1,
+ HOVEROPTION_DEFAULT,
+ HOVEROPTION_3,
+ HOVEROPTION_4,
+ HOVEROPTION_5,
+ HOVEROPTION_6,
+ HOVEROPTION_7,
+ HOVEROPTION_8,
+ HOVEROPTION_9,
+ HOVEROPTION_10,
+ HOVEROPTION_11,
+ HOVEROPTION_12,
+ HOVEROPTION_13,
+ HOVEROPTION_14,
+ HOVEROPTION_15,
+ HOVEROPTION_16,
+ HOVEROPTION_17,
+ HOVEROPTION_18,
+ HOVEROPTION_19,
+ HOVEROPTION_20,
+ HOVEROPTION_CHANGESKIN,
+ HOVEROPTION_NULL = 42,
};
enum eMenuColumns
@@ -348,7 +369,7 @@ struct tSkinInfo
char skinName[256];
char currSkinName[256];
char date[256];
- int field_304;
+ tSkinInfo *field_304;
};
struct CMenuScreen
@@ -388,7 +409,7 @@ public:
int32 m_nMouseTempPosX;
int32 m_nMouseTempPosY;
bool m_bShowMouse;
- tSkinInfo field_12C;
+ tSkinInfo m_sSkin;
tSkinInfo *m_pSelectedSkin;
tSkinInfo *field_438;
float field_43C;
@@ -450,16 +471,17 @@ public:
static int8 &m_bFrontEnd_ReloadObrTxtGxt;
static int32 &m_PrefsMusicVolume;
static int32 &m_PrefsSfxVolume;
- static uint8 *m_PrefsSkinFile;
+ static char *m_PrefsSkinFile;
+ static int32 &m_KeyPressedCode;
static bool &m_bStartUpFrontEndRequested;
static bool &m_bShutDownFrontEndRequested;
static bool &m_PrefsAllowNastyGame;
public:
- void BuildStatLine(char *, void *, uint16, void *);
+ void BuildStatLine(char *text, float *stat, bool aFloat, float* stat2);
static void CentreMousePointer();
- void CheckCodesForControls(int, int);
+ int CheckCodesForControls(int32);
bool CheckHover(int x1, int x2, int y1, int y2);
void CheckSliderMovement(int);
int CostructStatLine(int);
diff --git a/src/core/MenuScreens.h b/src/core/MenuScreens.h
index 2da81f1d..866dfc03 100644
--- a/src/core/MenuScreens.h
+++ b/src/core/MenuScreens.h
@@ -43,7 +43,7 @@ const CMenuScreen aScreens[] = {
{ "FET_DIS", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUROW_2, MENUROW_2,
MENUACTION_BRIGHTNESS, "FED_BRI", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_DRAWDIST, "FEM_LOD", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
- //MENUACTION_FRAMESYNC, "FEM_VSC", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
+ MENUACTION_FRAMESYNC, "FEM_VSC", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_FRAMELIMIT, "FEM_FRM", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_TRAILS, "FED_TRA", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_SUBTITLES, "FED_SUB", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
@@ -273,7 +273,7 @@ const CMenuScreen aScreens[] = {
MENUACTION_CHANGEMENU, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_CHANGEMENU, "FET_LAN", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
- //MENUACTION_CHANGEMENU, "FET_PSU", SAVESLOT_NONE, MENUPAGE_SKIN_SELECT,
+ MENUACTION_CHANGEMENU, "FET_PSU", SAVESLOT_NONE, MENUPAGE_SKIN_SELECT,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp
index 9d003e76..81c7a199 100644
--- a/src/core/PlayerInfo.cpp
+++ b/src/core/PlayerInfo.cpp
@@ -1,6 +1,14 @@
#include "common.h"
#include "patcher.h"
#include "PlayerInfo.h"
+#include "Frontend.h"
WRAPPER void CPlayerInfo::MakePlayerSafe(bool) { EAXJMP(0x4A1400); }
+WRAPPER void CPlayerInfo::LoadPlayerSkin() { EAXJMP(0x4A1700); }
WRAPPER void CPlayerInfo::AwardMoneyForExplosion(CVehicle *vehicle) { EAXJMP(0x4A15F0); }
+
+void CPlayerInfo::SetPlayerSkin(char *skin)
+{
+ strncpy(m_aSkinName, skin, 32);
+ LoadPlayerSkin();
+}
diff --git a/src/core/PlayerInfo.h b/src/core/PlayerInfo.h
index a9763766..d8128424 100644
--- a/src/core/PlayerInfo.h
+++ b/src/core/PlayerInfo.h
@@ -63,11 +63,13 @@ public:
bool m_bFastReload;
bool m_bGetOutOfJailFree;
bool m_bGetOutOfHospitalFree;
- uint8 m_aSkinName[32];
+ char m_aSkinName[32];
RwTexture *m_pSkinTexture;
void MakePlayerSafe(bool);
- void AwardMoneyForExplosion(CVehicle *vehicle);
+ void LoadPlayerSkin();
+ void AwardMoneyForExplosion(CVehicle *vehicle);
+ void SetPlayerSkin(char* skin);
};
static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerInfo: error");
diff --git a/src/core/Text.cpp b/src/core/Text.cpp
index d7d63467..b834a44d 100644
--- a/src/core/Text.cpp
+++ b/src/core/Text.cpp
@@ -210,6 +210,8 @@ AsciiToUnicode(const char *src, uint16 *dst)
while((*dst++ = *src++) != '\0');
}
+WRAPPER char UnicodeToAscii(wchar * src) { EAXJMP(0x52C2F0); }
+
void
TextCopy(wchar *dst, const wchar *src)
{
diff --git a/src/core/Text.h b/src/core/Text.h
index 2592e6b8..15ab7a8f 100644
--- a/src/core/Text.h
+++ b/src/core/Text.h
@@ -1,6 +1,7 @@
#pragma once
void AsciiToUnicode(const char *src, wchar *dst);
+char UnicodeToAscii(wchar *src);
void TextCopy(wchar *dst, const wchar *src);
struct CKeyEntry