You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

6631 lines
243 KiB

#define FORCE_PC_SCALING
#define WITHWINDOWS
#define WITHDINPUT
#include "common.h"
#ifndef PS2_MENU
#include "crossplatform.h"
#include "platform.h"
#include "Frontend.h"
#include "Font.h"
#include "Pad.h"
#include "Text.h"
#include "main.h"
#include "RwHelper.h"
#include "Timer.h"
#include "Game.h"
#include "DMAudio.h"
#include "FileMgr.h"
#include "Streaming.h"
#include "TxdStore.h"
#include "General.h"
#include "GenericGameStorage.h"
#include "Script.h"
#include "Camera.h"
#include "ControllerConfig.h"
#include "Vehicle.h"
#include "MBlur.h"
#include "PlayerSkin.h"
#include "PlayerInfo.h"
#include "World.h"
#include "Renderer.h"
#include "CdStream.h"
#include "Radar.h"
#include "Stats.h"
#include "Messages.h"
#include "FileLoader.h"
#include "User.h"
#include "sampman.h"
// --LCS: changed a bit to have lcs feel, needs more work
// Similar story to Hud.cpp:
// Game has colors inlined in code.
// For easier modification we collect them here:
const CRGBA LABEL_COLOR(115, 173, 216, 255);
const CRGBA SELECTIONBORDER_COLOR(25, 130, 70, 255);
const CRGBA MENUOPTION_COLOR = LABEL_COLOR;
const CRGBA SELECTEDMENUOPTION_COLOR(255, 255, 255, 255);
const CRGBA HEADER_COLOR(197, 0, 0, 255);
const CRGBA DARKMENUOPTION_COLOR(115/2, 173/2, 216 / 2, 255);
const CRGBA SLIDERON_COLOR(97, 194, 247, 255);
const CRGBA SLIDEROFF_COLOR(27, 89, 130, 255);
const CRGBA LIST_BACKGROUND_COLOR(49, 101, 148, 130);
const CRGBA LIST_OPTION_COLOR(155, 155, 155, 255);
const CRGBA RADIO_SELECTOR_COLOR = SLIDEROFF_COLOR;
const CRGBA INACTIVE_RADIO_COLOR(100, 100, 255, 100);
const CRGBA SCROLLBAR_COLOR = LABEL_COLOR;
#if 0
// Mobile
#define DEFAULT_BRIGHTNESS 0x150
#define MIN_BRIGHTNESS 180
#define MAX_BRIGHTNESS 700
#else
// PS2, also PSP probably
// 8 bars (32 step)
#define DEFAULT_BRIGHTNESS 0x120
#define MIN_BRIGHTNESS 0x80
#define MAX_BRIGHTNESS 0x180
#endif
#define MAP_MIN_SIZE 162.f
#define MAP_SIZE_TO_ALLOW_X_MOVE 297.f
#define MAX_VISIBLE_LIST_ROW 30
#define SCROLLBAR_MAX_HEIGHT 263.0f // not in end result
#define SCROLLABLE_PAGES
#define hasNativeList(screen) (screen == MENUPAGE_SKIN_SELECT || screen == MENUPAGE_KEYBOARD_CONTROLS)
#ifdef SCROLLABLE_PAGES
#define MAX_VISIBLE_OPTION 12
#define MAX_VISIBLE_OPTION_ON_SCREEN (hasNativeList(m_nCurrScreen) ? MAX_VISIBLE_LIST_ROW : MAX_VISIBLE_OPTION)
#define SCREEN_HAS_AUTO_SCROLLBAR (m_nTotalListRow > MAX_VISIBLE_OPTION && !hasNativeList(m_nCurrScreen))
int GetOptionCount(int screen)
{
int i = 0;
for (; i < NUM_MENUROWS && aScreens[screen].m_aEntries[i].m_Action != MENUACTION_NOTHING; i++);
return i;
}
#define SETUP_SCROLLING(screen) \
if (!hasNativeList(screen)) { \
m_nTotalListRow = GetOptionCount(screen); \
if (m_nTotalListRow > MAX_VISIBLE_OPTION) { \
m_nSelectedListRow = 0; \
m_nFirstVisibleRowOnList = 0; \
m_nScrollbarTopMargin = 0; \
} \
}
#define MINUS_SCROLL_OFFSET - scrollOffset
#else
#define MAX_VISIBLE_OPTION_ON_SCREEN MAX_VISIBLE_LIST_ROW
#define SETUP_SCROLLING(screen)
#define MINUS_SCROLL_OFFSET
#endif
#ifdef TRIANGLE_BACK_BUTTON
#define GetBackJustUp GetTriangleJustUp
#define GetBackJustDown GetTriangleJustDown
#elif defined(CIRCLE_BACK_BUTTON)
#define GetBackJustUp GetCircleJustUp
#define GetBackJustDown GetCircleJustDown
#else
#define GetBackJustUp GetSquareJustUp
#define GetBackJustDown GetSquareJustDown
#endif
#ifdef MAP_ENHANCEMENTS
CVector2D mapCrosshair;
#endif
#ifdef CUTSCENE_BORDERS_SWITCH
bool CMenuManager::m_PrefsCutsceneBorders = true;
#endif
bool holdingScrollBar; // *(bool*)0x7039B9; // not original name
CMenuManager FrontEndMenuManager;
MenuTrapezoid menuBg(CGeneral::GetRandomNumber() % 40 + 65, CGeneral::GetRandomNumber() % 40 + 21,
CGeneral::GetRandomNumber() % 40 + 568, CGeneral::GetRandomNumber() % 40 + 44,
CGeneral::GetRandomNumber() % 40 + 36, CGeneral::GetRandomNumber() % 40 + 352,
CGeneral::GetRandomNumber() % 40 + 593, CGeneral::GetRandomNumber() % 40 + 312);
MenuTrapezoid menuOptionHighlight(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
#ifndef MASTER
bool CMenuManager::m_PrefsMarketing = false;
bool CMenuManager::m_PrefsDisableTutorials = false;
#endif // !MASTER
#ifdef GAMEPAD_MENU
uint32 TimeToStopPadShaking;
#endif
const char* FrontendFilenames[][2] = {
{"background", ""},
{"vc_logo", "vc_logom"},
{"mouse", "mousea"},
{"mapTop01", "mapTop01A"},
{"mapTop02", "mapTop02A"},
{"mapTop03", "mapTop03A"},
{"mapMid01", "mapMid01A"},
{"mapMid02", "mapMid02A"},
{"mapMid03", "mapMid03A"},
{"mapBot01", "mapBot01A"},
{"mapBot02", "mapBot02A"},
{"mapBot03", "mapBot03A"},
{"wildstyle", "wildstyleA"},
{"flash", "flashA"},
{"kchat", "kchatA"},
{"fever", "feverA"},
{"vrock", "vrockA"},
{"vcpr", "vcprA"},
{"espantoso", "espantosoA"},
{"emotion", "emotionA"},
{"wave103", "wave103A"},
{"mp3", "mp3A"},
{"downOff", "buttonA"},
{"downOn", "buttonA"},
{"upOff", "buttonA"},
{"upOn", "buttonA"},
#ifdef GAMEPAD_MENU
{"fe_controller", "" },
{"fe_arrows1", "" },
{"fe_arrows2", "" },
{"fe_arrows3", "" },
{"fe_arrows4", "" },
#endif
};
#define MENU_X_RIGHT_ALIGNED(x) SCALE_AND_CENTER_X(DEFAULT_SCREEN_WIDTH - (x))
#ifdef ASPECT_RATIO_SCALE
// All of the defines below replace the StretchX function. Otherwise use SCREEN_SCALE_X.
#define MENU_X_LEFT_ALIGNED(x) SCALE_AND_CENTER_X(x)
#define MENU_X(x) SCREEN_SCALE_X(x)
#define MENU_Y(y) SCREEN_SCALE_Y(y)
#else
#define MENU_X_LEFT_ALIGNED(x) StretchX(x)
#define MENU_X(x) StretchX(x)
#define MENU_Y(y) StretchY(y)
#endif
#ifdef XBOX_MESSAGE_SCREEN
bool CMenuManager::m_bDialogOpen = false;
uint32 CMenuManager::m_nDialogHideTimer = 0;
PauseModeTime CMenuManager::m_nDialogHideTimerPauseMode = 0;
bool CMenuManager::m_bSaveWasSuccessful = false;
wchar* CMenuManager::m_pDialogText = nil;
#endif
#define SET_FONT_FOR_MENU_HEADER \
CFont::SetRightJustifyOff(); \
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING)); \
CFont::SetScale(MENU_X(MENUHEADER_WIDTH), MENU_Y(MENUHEADER_HEIGHT)); \
CFont::SetDropShadowPosition(0);
#define SET_FONT_FOR_LIST_ITEM \
CFont::SetRightJustifyOff(); \
CFont::SetScale(MENU_X(LISTITEM_X_SCALE), MENU_Y(LISTITEM_Y_SCALE)); \
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
#define RESET_FONT_FOR_NEW_PAGE \
CFont::SetBackgroundOff(); \
CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT), MENU_Y(MENUACTION_SCALE_MULT)); \
CFont::SetPropOn(); \
CFont::SetCentreOff(); \
CFont::SetJustifyOn(); \
CFont::SetRightJustifyOff(); \
CFont::SetBackGroundOnlyTextOn(); \
CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENU_X_MARGIN)); \
CFont::SetRightJustifyWrap(MENU_X_LEFT_ALIGNED(MENU_X_MARGIN));
#define ProcessSlider(value, origY, increaseAction, decreaseAction, hoverEndX, onlyWhenHoveringRow) \
do { \
float y = origY MINUS_SCROLL_OFFSET; \
lastActiveBarX = DisplaySlider(MENU_X_LEFT_ALIGNED(MENUSLIDER_X), MENU_Y(y), MENU_Y(MENUSLIDER_SMALLEST_BAR), MENU_Y(MENUSLIDER_BIGGEST_BAR), MENU_X(MENUSLIDER_UNK), value, MENU_X(3.0f)); \
if (i != m_nCurrOption || !itemsAreSelectable) \
break; \
\
if (CheckHover(0, lastActiveBarX - MENU_X(3.0f), MENU_Y(y), MENU_Y(MENUSLIDER_BIGGEST_BAR + y))) { \
m_nHoverOption = decreaseAction; \
break; \
} \
if (!CheckHover(MENU_X(3.0f) + lastActiveBarX, hoverEndX, MENU_Y(y), MENU_Y(MENUSLIDER_BIGGEST_BAR + y))) { \
m_nHoverOption = HOVEROPTION_NOT_HOVERING; \
break; \
} \
m_nHoverOption = increaseAction; \
if (m_nMousePosX < MENU_X_LEFT_ALIGNED(MENUSLIDER_X)) \
m_nHoverOption = HOVEROPTION_NOT_HOVERING; \
\
if (onlyWhenHoveringRow && (m_nMousePosY < MENU_Y(y) || m_nMousePosY > MENU_Y(MENUSLIDER_BIGGEST_BAR + y))) \
m_nHoverOption = HOVEROPTION_NOT_HOVERING; \
} while(0)
// --- Functions not in the game/inlined starts
inline void
CMenuManager::ScrollUpListByOne()
{
if (m_nSelectedListRow == m_nFirstVisibleRowOnList) {
if (m_nFirstVisibleRowOnList > 0) {
m_nSelectedListRow--;
m_nFirstVisibleRowOnList--;
m_nScrollbarTopMargin -= SCROLLBAR_MAX_HEIGHT / m_nTotalListRow;
}
} else {
m_nSelectedListRow--;
}
}
inline void
CMenuManager::ScrollDownListByOne()
{
if (m_nSelectedListRow == m_nFirstVisibleRowOnList + MAX_VISIBLE_OPTION_ON_SCREEN - 1) {
if (m_nFirstVisibleRowOnList < m_nTotalListRow - MAX_VISIBLE_OPTION_ON_SCREEN) {
m_nSelectedListRow++;
m_nFirstVisibleRowOnList++;
m_nScrollbarTopMargin += SCROLLBAR_MAX_HEIGHT / m_nTotalListRow;
}
} else {
if (m_nSelectedListRow < m_nTotalListRow - 1) {
m_nSelectedListRow++;
}
}
}
inline void
CMenuManager::PageUpList(bool playSoundOnSuccess)
{
if (m_nTotalListRow > MAX_VISIBLE_OPTION_ON_SCREEN) {
if (m_nFirstVisibleRowOnList > 0) {
if(playSoundOnSuccess)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_HIGHLIGHT_OPTION, 0);
m_nFirstVisibleRowOnList = Max(0, m_nFirstVisibleRowOnList - MAX_VISIBLE_OPTION_ON_SCREEN);
m_nSelectedListRow = Min(m_nSelectedListRow, m_nFirstVisibleRowOnList + MAX_VISIBLE_OPTION_ON_SCREEN - 1);
} else {
m_nFirstVisibleRowOnList = 0;
m_nSelectedListRow = 0;
}
m_nScrollbarTopMargin = (SCROLLBAR_MAX_HEIGHT / m_nTotalListRow) * m_nFirstVisibleRowOnList;
}
}
inline void
CMenuManager::PageDownList(bool playSoundOnSuccess)
{
if (m_nTotalListRow > MAX_VISIBLE_OPTION_ON_SCREEN) {
if (m_nFirstVisibleRowOnList < m_nTotalListRow - MAX_VISIBLE_OPTION_ON_SCREEN) {
if(playSoundOnSuccess)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_HIGHLIGHT_OPTION, 0);
m_nFirstVisibleRowOnList = Min(m_nFirstVisibleRowOnList + MAX_VISIBLE_OPTION_ON_SCREEN, m_nTotalListRow - MAX_VISIBLE_OPTION_ON_SCREEN);
m_nSelectedListRow = Max(m_nSelectedListRow, m_nFirstVisibleRowOnList);
} else {
m_nFirstVisibleRowOnList = m_nTotalListRow - MAX_VISIBLE_OPTION_ON_SCREEN;
m_nSelectedListRow = m_nTotalListRow - 1;
}
m_nScrollbarTopMargin = (SCROLLBAR_MAX_HEIGHT / m_nTotalListRow) * m_nFirstVisibleRowOnList;
}
}
#ifdef CUSTOM_FRONTEND_OPTIONS
#define PLUS_LINE_HEIGHT_ON_SCREEN + (aScreens[m_nCurrScreen].layout ? aScreens[m_nCurrScreen].layout->lineHeight : MENU_DEFAULT_LINE_HEIGHT)
bool ScreenHasOption(int screen, const char* gxtKey)
{
for (int i = 0; i < NUM_MENUROWS; i++) {
if (strcmp(gxtKey, aScreens[screen].m_aEntries[i].m_EntryName) == 0)
return true;
}
return false;
}
inline void
CMenuManager::ThingsToDoBeforeLeavingPage()
{
if ((m_nCurrScreen == MENUPAGE_SKIN_SELECT) && strcmp(m_aSkinName, m_PrefsSkinFile) != 0) {
CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile);
} else if (m_nCurrScreen == MENUPAGE_SOUND_SETTINGS) {
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER)
m_nPrefsAudio3DProviderIndex = DMAudio.GetCurrent3DProviderIndex();
DMAudio.StopFrontEndTrack();
OutputDebugString("FRONTEND AUDIO TRACK STOPPED");
} else if (ScreenHasOption(m_nCurrScreen, "FED_RES")) {
m_nDisplayVideoMode = m_nPrefsVideoMode;
}
if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) {
CPlayerSkin::EndFrontendSkinEdit();
}
#ifdef SCROLLABLE_PAGES
if (SCREEN_HAS_AUTO_SCROLLBAR) {
m_nSelectedListRow = 0;
m_nFirstVisibleRowOnList = 0;
m_nScrollbarTopMargin = 0;
}
#endif
CMenuScreenCustom::CMenuEntry &option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption];
if (option.m_Action == MENUACTION_CFO_DYNAMIC)
if(option.m_CFODynamic->buttonPressFunc)
option.m_CFODynamic->buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS);
if (option.m_Action == MENUACTION_CFO_SELECT && option.m_CFOSelect->onlyApplyOnEnter && option.m_CFOSelect->lastSavedValue != option.m_CFOSelect->displayedValue)
option.m_CFOSelect->displayedValue = *option.m_CFO->value = option.m_CFOSelect->lastSavedValue;
if (aScreens[m_nCurrScreen].returnPrevPageFunc) {
aScreens[m_nCurrScreen].returnPrevPageFunc();
}
}
inline int8
CMenuManager::GetPreviousPageOption()
{
int8 prevPage = !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_PreviousPage :
(m_nCurrScreen == MENUPAGE_NEW_GAME || m_nCurrScreen == MENUPAGE_OPTIONS || m_nCurrScreen == MENUPAGE_EXIT ? MENUPAGE_START_MENU : aScreens[m_nCurrScreen].m_PreviousPage);
if (prevPage == -1) // Game also does same
return 0;
prevPage = prevPage == MENUPAGE_NONE ? (!m_bGameNotLoaded ? MENUPAGE_PAUSE_MENU : MENUPAGE_START_MENU) : prevPage;
for (int i = 0; i < NUM_MENUROWS; i++) {
if (aScreens[prevPage].m_aEntries[i].m_Action >= MENUACTION_NOTHING) { // CFO check
if (aScreens[prevPage].m_aEntries[i].m_TargetMenu == m_nCurrScreen) {
return i;
}
}
}
// This shouldn't happen
return 0;
}
#else
#define PLUS_LINE_HEIGHT_ON_SCREEN + MENU_DEFAULT_LINE_HEIGHT
inline void
CMenuManager::ThingsToDoBeforeLeavingPage()
{
switch (m_nCurrScreen) {
case MENUPAGE_SOUND_SETTINGS:
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER)
m_nPrefsAudio3DProviderIndex = DMAudio.GetCurrent3DProviderIndex();
DMAudio.StopFrontEndTrack();
OutputDebugString("FRONTEND AUDIO TRACK STOPPED");
break;
case MENUPAGE_DISPLAY_SETTINGS:
m_nDisplayVideoMode = m_nPrefsVideoMode;
break;
case MENUPAGE_SKIN_SELECT:
if (strcmp(m_aSkinName, m_PrefsSkinFile) != 0)
CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile);
CPlayerSkin::EndFrontendSkinEdit();
break;
}
#ifdef SCROLLABLE_PAGES
if (SCREEN_HAS_AUTO_SCROLLBAR) {
m_nSelectedListRow = 0;
m_nFirstVisibleRowOnList = 0;
m_nScrollbarTopMargin = 0;
}
#endif
}
inline int8
CMenuManager::GetPreviousPageOption()
{
return (!m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_ParentEntry :
(m_nCurrScreen == MENUPAGE_NEW_GAME ? 0 : (m_nCurrScreen == MENUPAGE_OPTIONS ? 1 : (m_nCurrScreen == MENUPAGE_EXIT ? 2 : aScreens[m_nCurrScreen].m_ParentEntry))));
}
#endif
// ------ Functions not in the game/inlined ends
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
void DoRWStuffEndOfFrame(void);
void
CMenuManager::SwitchToNewScreen(int8 screen)
{
bMenuChangeOngoing = true;
DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255);
DrawBackground(true);
DoRWStuffEndOfFrame();
DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255);
DrawBackground(true);
DoRWStuffEndOfFrame();
m_nPrevScreen = m_nCurrScreen;
m_ShowEmptyBindingError = false;
ResetHelperText();
ThingsToDoBeforeLeavingPage();
if (screen == -2) {
int oldScreen = aScreens[m_nCurrScreen].m_PreviousPage;
int oldOption = GetPreviousPageOption();
m_nCurrOption = oldOption;
m_nCurrScreen = oldScreen;
} else if (screen == 0) {
m_nCurrScreen = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu;
m_nCurrOption = 0;
} else {
m_nCurrOption = 0;
m_nCurrScreen = screen;
}
SETUP_SCROLLING(m_nCurrScreen)
if (hasNativeList(m_nPrevScreen))
m_nTotalListRow = 0;
if (m_nCurrScreen == MENUPAGE_CHOOSE_SAVE_SLOT)
m_nCurrOption = 8;
m_nMenuFadeAlpha = 0;
m_nOptionHighlightTransitionBlend = 0;
m_LastScreenSwitch = CTimer::GetTimeInMillisecondsPauseMode();
}
CMenuManager::CMenuManager()
{
m_StatsScrollSpeed = 150.0f;
m_StatsScrollDirection = 1;
m_PrefsSfxVolume = 49;
m_PrefsMusicVolume = 49;
m_PrefsRadioStation = 0;
m_PrefsStereoMono = 1;
m_PrefsBrightness = DEFAULT_BRIGHTNESS;
m_PrefsLOD = CRenderer::ms_lodDistScale;
m_KeyPressedCode = -1;
m_bFrontEnd_ReloadObrTxtGxt = false;
m_PrefsMP3BoostVolume = 0;
m_PrefsShowSubtitles = 0;
m_PrefsShowLegends = 1;
#ifdef ASPECT_RATIO_SCALE
m_PrefsUseWideScreen = AR_AUTO;
#else
m_PrefsUseWideScreen = 0;
#endif
m_PrefsVsync = 0;
m_PrefsVsyncDisp = 1;
m_PrefsFrameLimiter = 1;
m_PrefsLanguage = 0;
field_54 = 0;
m_PrefsAllowNastyGame = 1;
m_PrefsSpeakers = 0;
field_8 = 0;
m_PrefsUseVibration = 0;
m_PrefsShowHud = 1;
m_PrefsRadarMode = 0;
m_DisplayControllerOnFoot = false;
m_bShutDownFrontEndRequested = false;
m_bStartUpFrontEndRequested = false;
pEditString = nil;
pControlEdit = nil;
DisplayComboButtonErrMsg = false;
m_PrefsDMA = 1;
OS_Language = LANG_ENGLISH;
m_ControlMethod = CONTROL_STANDARD;
#ifdef PC_PLAYER_CONTROLS
CCamera::m_bUseMouse3rdPerson = true;
#else
CCamera::m_bUseMouse3rdPerson = false;
#endif
m_lastWorking3DAudioProvider = 0;
m_nFirstVisibleRowOnList = 0;
m_nScrollbarTopMargin = 0.0f;
m_nSelectedListRow = 0;
m_nSkinsTotal = 0;
m_nPrefsAudio3DProviderIndex = AUDIO_PROVIDER_NOT_DETERMINED;
m_bGameNotLoaded = true;
m_nMousePosX = m_nMouseTempPosX;
m_nMousePosY = m_nMouseTempPosY;
m_nMouseOldPosX = m_nMousePosX;
m_nMouseOldPosY = m_nMousePosY;
m_bShowMouse = true;
m_nHoverOption = HOVEROPTION_NOT_HOVERING;
DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
m_bMenuActive = false;
m_bActivateSaveMenu = false;
m_bWantToLoad = false;
m_nMenuFadeAlpha = 0;
m_OnlySaveMenu = false;
m_fMapSize = MENU_Y(162.0f); // Y because of HOR+
m_fMapCenterX = MENU_X_LEFT_ALIGNED(320.0f);
m_fMapCenterY = MENU_Y(225.0f);
DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume);
DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
#ifdef NO_ISLAND_LOADING
m_PrefsIslandLoading = ISLAND_LOADING_LOW;
#endif
#ifdef GAMEPAD_MENU
m_PrefsControllerType = CONTROLLER_XBOXONE;
#endif
}
void
CMenuManager::SetFrontEndRenderStates(void)
{
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
}
void
CMenuManager::Initialise(void)
{
DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255);
DoRWStuffEndOfFrame();
m_AllowNavigation = false;
m_firstStartCounter = -50; // to start from black
m_nMenuFadeAlpha = 0;
m_nCurrOption = 0;
m_nOptionHighlightTransitionBlend = 0;
CentreMousePointer();
m_bShowMouse = true;
m_fMapSize = MENU_Y(162.0f); // Y because of HOR+
m_fMapCenterX = MENU_X_LEFT_ALIGNED(320.0f);
m_fMapCenterY = MENU_Y(225.0f);
CPad::StopPadsShaking();
if (!m_OnlySaveMenu)
m_nCurrScreen = MENUPAGE_NONE;
DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND);
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_STARTING, 0);
DMAudio.Service();
DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume);
DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
#ifdef FIX_BUGS
static bool firstTime = true;
if (firstTime) {
DMAudio.SetRadioInCar(m_PrefsRadioStation);
firstTime = false;
} else
#endif
m_PrefsRadioStation = DMAudio.GetRadioInCar();
DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
if (DMAudio.IsMP3RadioChannelAvailable()) {
if (m_PrefsRadioStation < WILDSTYLE || m_PrefsRadioStation > USERTRACK)
m_PrefsRadioStation = CGeneral::GetRandomNumber() % (USERTRACK + 1);
} else if (m_PrefsRadioStation < WILDSTYLE || m_PrefsRadioStation > WAVE)
m_PrefsRadioStation = CGeneral::GetRandomNumber() % (WAVE + 1);
CFileMgr::SetDir("");
//CFileMgr::SetDir("");
PcSaveHelper.PopulateSlotInfo();
CTimer::StartUserPause();
}
void
CMenuManager::CentreMousePointer()
{
if (SCREEN_WIDTH * 0.5f != 0.0f && 0.0f != SCREEN_HEIGHT * 0.5f) {
#if defined RW_D3D9 || defined RWLIBS
tagPOINT Point;
Point.x = SCREEN_WIDTH / 2;
Point.y = SCREEN_HEIGHT / 2;
ClientToScreen(PSGLOBAL(window), &Point);
SetCursorPos(Point.x, Point.y);
#elif defined RW_GL3
glfwSetCursorPos(PSGLOBAL(window), SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2);
#endif
PSGLOBAL(lastMousePos.x) = SCREEN_WIDTH / 2;
PSGLOBAL(lastMousePos.y) = SCREEN_HEIGHT / 2;
}
}
void
CMenuManager::CheckCodesForControls(int typeOfControl)
{
DisplayComboButtonErrMsg = false;
bool invalidKey = false;
bool escPressed = false;
eControllerType typeToSave;
// GetStartOptionsCntrlConfigScreens();
e_ControllerAction action = (e_ControllerAction) m_CurrCntrlAction;
if (typeOfControl == KEYBOARD) {
if (*pControlEdit == rsESC) {
escPressed = true;
} else if (*pControlEdit != rsF1 && *pControlEdit != rsF2 && *pControlEdit != rsF3 && *pControlEdit != rsF9 &&
*pControlEdit != rsLWIN && *pControlEdit != rsRWIN && *pControlEdit != rsRALT) {
typeToSave = KEYBOARD;
if (ControlsManager.GetControllerKeyAssociatedWithAction(action, KEYBOARD) != rsNULL &&
*pControlEdit != ControlsManager.GetControllerKeyAssociatedWithAction(action, KEYBOARD)) {
typeToSave = OPTIONAL_EXTRA;
}
} else {
invalidKey = true;
}
} else if (typeOfControl == MOUSE) {
typeToSave = MOUSE;
} else if (typeOfControl == JOYSTICK) {
typeToSave = JOYSTICK;
if (ControlsManager.GetIsActionAButtonCombo(action))
DisplayComboButtonErrMsg = true;
}
#ifdef FIX_BUGS
if(!escPressed && !invalidKey)
#endif
ControlsManager.ClearSettingsAssociatedWithAction(action, typeToSave);
if (!DisplayComboButtonErrMsg && !escPressed && !invalidKey) {
if (typeOfControl == KEYBOARD) {
ControlsManager.DeleteMatchingActionInitiators(action, *pControlEdit, KEYBOARD);
ControlsManager.DeleteMatchingActionInitiators(action, *pControlEdit, OPTIONAL_EXTRA);
} else if (typeOfControl == MOUSE) {
ControlsManager.DeleteMatchingActionInitiators(action, MouseButtonJustClicked, MOUSE);
} else if (typeOfControl == JOYSTICK) {
ControlsManager.DeleteMatchingActionInitiators(action, JoyButtonJustClicked, JOYSTICK);
}
if (typeOfControl == KEYBOARD) {
ControlsManager.SetControllerKeyAssociatedWithAction(action, *pControlEdit, typeToSave);
} else if (typeOfControl == MOUSE) {
ControlsManager.SetControllerKeyAssociatedWithAction(action, MouseButtonJustClicked, typeToSave);
} else if (typeOfControl == JOYSTICK) {
ControlsManager.SetControllerKeyAssociatedWithAction(action, JoyButtonJustClicked, typeToSave);
}
pControlEdit = nil;
m_bWaitingForNewKeyBind = false;
m_KeyPressedCode = -1;
m_bStartWaitingForKeyBind = false;
#ifdef LOAD_INI_SETTINGS
SaveINIControllerSettings();
#else
SaveSettings();
#endif
}
}
bool
CMenuManager::CheckHover(int x1, int x2, int y1, int y2)
{
return m_nMousePosX > x1 && m_nMousePosX < x2 &&
m_nMousePosY > y1 && m_nMousePosY < y2;
}
void
CMenuManager::CheckSliderMovement(int value)
{
switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) {
case MENUACTION_BRIGHTNESS:
m_PrefsBrightness += value * 32.0f;
m_PrefsBrightness = clamp(m_PrefsBrightness, MIN_BRIGHTNESS, MAX_BRIGHTNESS);
break;
case MENUACTION_DRAWDIST:
if(value > 0)
m_PrefsLOD += ((1.8f - 0.925f) / 16.0f);
else
m_PrefsLOD -= ((1.8f - 0.925f) / 16.0f);
m_PrefsLOD = clamp(m_PrefsLOD, 0.925f, 1.8f);
CRenderer::ms_lodDistScale = m_PrefsLOD;
break;
case MENUACTION_MUSICVOLUME:
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
m_PrefsMusicVolume += value * (128 / 32);
m_PrefsMusicVolume = clamp(m_PrefsMusicVolume, 0, 65);
DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume);
}
break;
case MENUACTION_SFXVOLUME:
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
m_PrefsSfxVolume += value * (128 / 32);
m_PrefsSfxVolume = clamp(m_PrefsSfxVolume, 0, 65);
DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
}
break;
case MENUACTION_MP3VOLUMEBOOST:
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
if (DMAudio.IsMP3RadioChannelAvailable()) {
m_PrefsMP3BoostVolume += value * (128 / 32);
m_PrefsMP3BoostVolume = clamp(m_PrefsMP3BoostVolume, 0, 65);
DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
}
}
break;
case MENUACTION_MOUSESENS:
TheCamera.m_fMouseAccelHorzntl += value * 1.0f/200.0f/15.0f; // ???
TheCamera.m_fMouseAccelHorzntl = clamp(TheCamera.m_fMouseAccelHorzntl, 1.0f/3200.0f, 1.0f/200.0f);
#ifdef FIX_BUGS
TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl + 0.0005f;
#endif
break;
default:
return;
}
SaveSettings();
}
void
CMenuManager::DisplayHelperText(char *text)
{
if (m_nMenuFadeAlpha != 255)
return;
// there was a unused static bool
static PauseModeTime LastFlash = 0;
int32 alpha = 255;
CFont::SetRightJustifyOn();
CFont::SetScale(SCREEN_SCALE_X(SMALLESTTEXT_X_SCALE), SCREEN_SCALE_Y(SMALLESTTEXT_Y_SCALE));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetDropShadowPosition(0);
// We're using SCREEN_STRETCH_FROM_RIGHT, because we also stretch black borders
if (text) {
CFont::SetColor(CRGBA(255, 255, 255, 255));
CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(HELPER_TEXT_RIGHT_MARGIN), SCREEN_SCALE_FROM_BOTTOM(HELPER_TEXT_BOTTOM_MARGIN), TheText.Get(text));
return;
}
if (m_nHelperTextMsgId != 0 && m_nHelperTextMsgId != 1) {
if (CTimer::GetTimeInMillisecondsPauseMode() - LastFlash > 10) {
LastFlash = CTimer::GetTimeInMillisecondsPauseMode();
m_nHelperTextAlpha -= 2;
}
if (m_nHelperTextAlpha < 1)
ResetHelperText();
alpha = m_nHelperTextAlpha > 255 ? 255 : m_nHelperTextAlpha;
}
CFont::SetColor(CRGBA(255, 255, 255, alpha));
// TODO: name this cases?
switch (m_nHelperTextMsgId) {
case 1:
CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(HELPER_TEXT_RIGHT_MARGIN), SCREEN_SCALE_FROM_BOTTOM(HELPER_TEXT_BOTTOM_MARGIN), TheText.Get("FET_APP"));
break;
case 2:
CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(HELPER_TEXT_RIGHT_MARGIN), SCREEN_SCALE_FROM_BOTTOM(HELPER_TEXT_BOTTOM_MARGIN), TheText.Get("FET_HRD"));
break;
case 3:
CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(HELPER_TEXT_RIGHT_MARGIN), SCREEN_SCALE_FROM_BOTTOM(HELPER_TEXT_BOTTOM_MARGIN), TheText.Get("FET_RSO"));
break;
case 4:
CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(HELPER_TEXT_RIGHT_MARGIN), SCREEN_SCALE_FROM_BOTTOM(HELPER_TEXT_BOTTOM_MARGIN), TheText.Get("FET_STS"));
break;
case 5:
CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(HELPER_TEXT_RIGHT_MARGIN), SCREEN_SCALE_FROM_BOTTOM(HELPER_TEXT_BOTTOM_MARGIN), TheText.Get("FET_RSC"));
break;
default:
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_NO)
return;
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_MUSICVOLUME ||
aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_SFXVOLUME) {
CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(HELPER_TEXT_RIGHT_MARGIN), SCREEN_SCALE_FROM_BOTTOM(HELPER_TEXT_BOTTOM_MARGIN),
m_nPrefsAudio3DProviderIndex == NO_AUDIO_PROVIDER ? TheText.Get("FEH_NA") : TheText.Get("FET_MIG"));
return;
}
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_KEYBOARDCTRLS)
return;
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_SCREENRES) {
CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(HELPER_TEXT_RIGHT_MARGIN), SCREEN_SCALE_FROM_BOTTOM(HELPER_TEXT_BOTTOM_MARGIN),
m_bGameNotLoaded ? TheText.Get("FET_MIG") : TheText.Get("FEH_NA"));
return;
}
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_AUDIOHW ||
aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_SPEAKERCONF) {
CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(HELPER_TEXT_RIGHT_MARGIN), SCREEN_SCALE_FROM_BOTTOM(HELPER_TEXT_BOTTOM_MARGIN),
m_nPrefsAudio3DProviderIndex == NO_AUDIO_PROVIDER ? TheText.Get("FEH_NA") : TheText.Get("FET_MIG"));
return;
}
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_RESTOREDEF)
return;
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_MP3VOLUMEBOOST) {
CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(HELPER_TEXT_RIGHT_MARGIN), SCREEN_SCALE_FROM_BOTTOM(HELPER_TEXT_BOTTOM_MARGIN),
m_nPrefsAudio3DProviderIndex == NO_AUDIO_PROVIDER ? TheText.Get("FEH_NA") : TheText.Get("FET_MIG"));
return;
}
CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(HELPER_TEXT_RIGHT_MARGIN), SCREEN_SCALE_FROM_BOTTOM(HELPER_TEXT_BOTTOM_MARGIN),
m_nCurrScreen != MENUPAGE_STATS ? TheText.Get("FET_MIG") : TheText.Get("FEH_SSA"));
break;
}
}
int
CMenuManager::DisplaySlider(float x, float y, float mostLeftBarSize, float mostRightBarSize, float rectSize, float progress, float spacing)
{
CRGBA color;
float maxBarHeight;
int lastActiveBarX = 0;
float curBarX = 0.0f;
for (int i = 0; i < 16; i++) {
curBarX = i * rectSize/16.0f + x;
if (i / 16.0f + 1 / 32.0f < progress) {
color = CRGBA(SLIDERON_COLOR.r, SLIDERON_COLOR.g, SLIDERON_COLOR.b, FadeIn(255));
lastActiveBarX = curBarX;
} else
color = CRGBA(SLIDEROFF_COLOR.r, SLIDEROFF_COLOR.g, SLIDEROFF_COLOR.b, FadeIn(255));
maxBarHeight = Max(mostLeftBarSize, mostRightBarSize);
float curBarFreeSpace = ((16 - i) * mostLeftBarSize + i * mostRightBarSize) / 16.0f;
float left = curBarX;
float top = y + maxBarHeight - curBarFreeSpace;
float right = spacing + curBarX;
float bottom = y + maxBarHeight;
float shadowOffset = SCREEN_SCALE_X(2.0f);
CSprite2d::DrawRect(CRect(left + shadowOffset, top + shadowOffset, right + shadowOffset, bottom + shadowOffset), CRGBA(0, 0, 0, FadeIn(200))); // Shadow
CSprite2d::DrawRect(CRect(left, top, right, bottom), color);
}
return lastActiveBarX;
}
void
CMenuManager::DoSettingsBeforeStartingAGame()
{
#ifdef LEGACY_MENU_OPTIONS
if (m_PrefsVsyncDisp != m_PrefsVsync)
m_PrefsVsync = m_PrefsVsyncDisp;
#endif
DMAudio.DestroyAllGameCreatedEntities();
DMAudio.Service();
m_bShutDownFrontEndRequested = true;
m_bWantToRestart = true;
DMAudio.SetEffectsFadeVol(0);
DMAudio.SetMusicFadeVol(0);
for (int i = 0; i < NUM_RADIOS; i++)
CStats::FavoriteRadioStationList[i] = 0.0f;
SwitchMenuOnAndOff();
DMAudio.ResetTimers(CTimer::GetTimeInMilliseconds());
}
void
CMenuManager::DrawStandardMenus(bool activeScreen)
{
float nextYToUse = 0.0f; // III leftover, set but unused in VC
bool itemsAreSelectable = true;
CFont::SetBackgroundOff();
CFont::SetPropOn();
CFont::SetCentreOff();
CFont::SetJustifyOn();
CFont::SetBackGroundOnlyTextOff();
#ifdef CUSTOM_FRONTEND_OPTIONS
const int xMargin = aScreens[m_nCurrScreen].layout && aScreens[m_nCurrScreen].layout->xMargin != 0 ? aScreens[m_nCurrScreen].layout->xMargin : MENU_X_MARGIN;
#else
const int xMargin = MENU_X_MARGIN;
#endif
CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(xMargin));
CFont::SetRightJustifyWrap(MENU_X_LEFT_ALIGNED(xMargin));
#ifdef ASPECT_RATIO_SCALE
CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH));
#else
CFont::SetCentreSize(SCREEN_WIDTH);
#endif
switch (m_nCurrScreen) {
/*case MENUPAGE_CHOOSE_LOAD_SLOT:
case MENUPAGE_CHOOSE_DELETE_SLOT:
case MENUPAGE_CHOOSE_SAVE_SLOT:
CSprite2d::Draw2DPolygon(MENU_X_LEFT_ALIGNED(38.0f), MENU_Y(85.0f),
MENU_X_LEFT_ALIGNED(615.0f), MENU_Y(75.0f),
MENU_X_LEFT_ALIGNED(30.0f), MENU_Y(320.0f),
MENU_X_LEFT_ALIGNED(605.0f), MENU_Y(330.0f), CRGBA(LIST_BACKGROUND_COLOR.r, LIST_BACKGROUND_COLOR.g, LIST_BACKGROUND_COLOR.b, FadeIn(LIST_BACKGROUND_COLOR.a)));
break;*/
case MENUPAGE_SOUND_SETTINGS:
PrintRadioSelector();
break;
case MENUPAGE_STATS:
PrintStats();
break;
case MENUPAGE_BRIEFS:
PrintBriefs();
break;
}
// Page name
if (aScreens[m_nCurrScreen].m_ScreenName[0] != '\0') {
SET_FONT_FOR_MENU_HEADER
//CFont::SetColor(CRGBA(30, 30, 30, FadeIn(255)));
//CFont::PrintString(SCREEN_STRETCH_X(MENUHEADER_POS_X) - MENU_X(7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName));
CFont::SetColor(CRGBA(HEADER_COLOR.r, HEADER_COLOR.g, HEADER_COLOR.b, FadeIn(255)));
CFont::PrintString(SCREEN_STRETCH_X(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName));
}
// Label
wchar *str;
if (aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL) {
CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENULABEL_X_MARGIN));
CFont::SetRightJustifyWrap(MENU_X_LEFT_ALIGNED(MENULABEL_X_MARGIN));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetScale(MENU_X(BIGTEXT2_X_SCALE), MENU_Y(BIGTEXT2_Y_SCALE));
CFont::SetRightJustifyOff();
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(255)));
CFont::SetColor(CRGBA(LABEL_COLOR.r, LABEL_COLOR.g, LABEL_COLOR.b, FadeIn(255)));
switch (m_nCurrScreen) {
case MENUPAGE_LOAD_SLOT_CONFIRM:
if (m_bGameNotLoaded)
str = TheText.Get("FES_LCG");
else
str = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[0].m_EntryName);
break;
case MENUPAGE_DELETE_SLOT_CONFIRM:
str = TheText.Get(aScreens[MENUPAGE_DELETE_SLOT_CONFIRM].m_aEntries[0].m_EntryName);
break;
case MENUPAGE_SAVE_OVERWRITE_CONFIRM:
if (Slots[m_nCurrSaveSlot] == SLOT_OK)
str = TheText.Get("FESZ_QO");
else if (Slots[m_nCurrSaveSlot] == SLOT_CORRUPTED)
str = TheText.Get("FESZ_QZ");
else
str = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[0].m_EntryName);
break;
case MENUPAGE_EXIT:
if (m_bGameNotLoaded)
str = TheText.Get("FEQ_SRW");
else
str = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[0].m_EntryName);
break;
default:
str = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[0].m_EntryName);
break;
}
CFont::PrintString(MENU_X_LEFT_ALIGNED(100.0f), MENU_Y(97.0f), str);
CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(xMargin));
CFont::SetRightJustifyWrap(MENU_X_LEFT_ALIGNED(xMargin));
}
if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) {
if (m_bWaitingForNewKeyBind)
itemsAreSelectable = false;
DrawControllerScreenExtraText(-8.0f, MENU_X_LEFT_ALIGNED(350), MENU_DEFAULT_LINE_HEIGHT);
}
wchar unicodeTemp[64];
#ifdef ASPECT_RATIO_SCALE
char asciiTemp[32];
#endif
bool weHaveLabel = aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL;
uint8 section = 0; // 0: highlight trapezoid 1: texts
while (section < 2) {
#endif
#ifdef SCROLLABLE_PAGES
int firstOption = SCREEN_HAS_AUTO_SCROLLBAR ? m_nFirstVisibleRowOnList : 0;
int scrollOffset = aScreens[m_nCurrScreen].m_aEntries[firstOption].m_Y - aScreens[m_nCurrScreen].m_aEntries[0].m_Y;
for (int i = firstOption; i < firstOption + MAX_VISIBLE_OPTION && i < NUM_MENUROWS; ++i) {
#else
for (int i = 0; i < NUM_MENUROWS; ++i) {
#endif
wchar* rightText = nil;
wchar* leftText;
/*if (aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot >= SAVESLOT_1 && aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot <= SAVESLOT_8) {
CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255)));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetScale(MENU_X(MEDIUMTEXT_X_SCALE), MENU_Y(MEDIUMTEXT_Y_SCALE));
CFont::SetDropShadowPosition(0);
} else {*/
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetScale(MENU_X(BIGTEXT_X_SCALE), MENU_Y(BIGTEXT_Y_SCALE));
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(255)));
if (i == m_nCurrOption && itemsAreSelectable)
CFont::SetColor(CRGBA(SELECTEDMENUOPTION_COLOR.r, SELECTEDMENUOPTION_COLOR.g, SELECTEDMENUOPTION_COLOR.b, FadeIn(255)));
else
CFont::SetColor(CRGBA(MENUOPTION_COLOR.r, MENUOPTION_COLOR.g, MENUOPTION_COLOR.b, FadeIn(255)));
//}
if (aScreens[m_nCurrScreen].m_aEntries[i].m_Align == MENUALIGN_LEFT) {
CFont::SetCentreOff();
CFont::SetRightJustifyOff();
} else if (aScreens[m_nCurrScreen].m_aEntries[i].m_Align == MENUALIGN_RIGHT) {
CFont::SetCentreOff();
CFont::SetRightJustifyOn();
} else {
CFont::SetRightJustifyOff();
CFont::SetCentreOn();
}
if (aScreens[m_nCurrScreen].m_aEntries[i].m_X == 0 && aScreens[m_nCurrScreen].m_aEntries[i].m_Y == 0) {
if (i == 0 || (i == 1 && weHaveLabel)) {
#ifdef CUSTOM_FRONTEND_OPTIONS
aScreens[m_nCurrScreen].m_aEntries[i].m_X = (aScreens[m_nCurrScreen].layout ? aScreens[m_nCurrScreen].layout->startX : MENU_DEFAULT_CONTENT_X);
aScreens[m_nCurrScreen].m_aEntries[i].m_Y = (aScreens[m_nCurrScreen].layout ? aScreens[m_nCurrScreen].layout->startY : MENU_DEFAULT_CONTENT_Y);
#else
aScreens[m_nCurrScreen].m_aEntries[i].m_X = MENU_DEFAULT_CONTENT_X;
aScreens[m_nCurrScreen].m_aEntries[i].m_Y = MENU_DEFAULT_CONTENT_Y;
#endif
} else {
aScreens[m_nCurrScreen].m_aEntries[i].m_X = aScreens[m_nCurrScreen].m_aEntries[i-1].m_X;
aScreens[m_nCurrScreen].m_aEntries[i].m_Y = aScreens[m_nCurrScreen].m_aEntries[i-1].m_Y PLUS_LINE_HEIGHT_ON_SCREEN;
}
}
#ifdef CUSTOM_FRONTEND_OPTIONS
else if (aScreens[m_nCurrScreen].m_aEntries[i].m_Y == 0) {
aScreens[m_nCurrScreen].m_aEntries[i].m_Y = aScreens[m_nCurrScreen].m_aEntries[i-1].m_Y PLUS_LINE_HEIGHT_ON_SCREEN;
}
#endif
if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action != MENUACTION_LABEL && aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName[0] != '\0') {
if (aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot >= SAVESLOT_1 && aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot <= SAVESLOT_8) {
CFont::SetRightJustifyOff();
leftText = nil;
if (Slots[i] == SLOT_OK) {
leftText = GetNameOfSavedGame(i);
rightText = GetSavedGameDateAndTime(i);
}
if (!leftText || leftText[0] == '\0') {
sprintf(gString, "FEM_SL%d", i + 1);
leftText = TheText.Get(gString);
}
} else {
leftText = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName);
}
if (m_nPrefsAudio3DProviderIndex == NO_AUDIO_PROVIDER) {
if (strcmp(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName, "FEO_AUD") == 0) {
CFont::SetColor(CRGBA(DARKMENUOPTION_COLOR.r, DARKMENUOPTION_COLOR.g, DARKMENUOPTION_COLOR.b, FadeIn(255)));
}
}
switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) {
#ifdef GAMEPAD_MENU
case MENUACTION_CTRLVIBRATION:
if (m_PrefsUseVibration)
rightText = TheText.Get("FEM_ON");
else
rightText = TheText.Get("FEM_OFF");
break;
case MENUACTION_CTRLCONFIG:
switch (CPad::GetPad(0)->Mode) {
case 0:
rightText = TheText.Get("FEC_CF1");
break;
case 1:
rightText = TheText.Get("FEC_CF2");
break;
case 2:
rightText = TheText.Get("FEC_CF3");
break;
case 3:
rightText = TheText.Get("FEC_CF4");
break;
}
break;
// This one is still in enum and ProcessOnOffMenuOptions, but removed from other places
case MENUACTION_CTRLDISPLAY:
if (m_DisplayControllerOnFoot)
rightText = TheText.Get("FEC_ONF");
else
rightText = TheText.Get("FEC_INC");
break;
#endif
case MENUACTION_FRAMESYNC:
rightText = TheText.Get(m_PrefsVsyncDisp ? "FEM_ON" : "FEM_OFF");
break;
case MENUACTION_FRAMELIMIT:
rightText = TheText.Get(m_PrefsFrameLimiter ? "FEM_ON" : "FEM_OFF");
break;
case MENUACTION_TRAILS:
rightText = TheText.Get(CMBlur::BlurOn ? "FEM_ON" : "FEM_OFF");
break;
case MENUACTION_SUBTITLES:
rightText = TheText.Get(m_PrefsShowSubtitles ? "FEM_ON" : "FEM_OFF");
break;
case MENUACTION_WIDESCREEN:
#ifndef ASPECT_RATIO_SCALE
rightText = TheText.Get(m_PrefsUseWideScreen ? "FEM_ON" : "FEM_OFF");
#else
switch (m_PrefsUseWideScreen) {
case AR_AUTO:
rightText = TheText.Get("FEM_AUT");
break;
case AR_4_3:
sprintf(asciiTemp, "4:3");
AsciiToUnicode(asciiTemp, unicodeTemp);
rightText = unicodeTemp;
break;
case AR_5_4:
sprintf(asciiTemp, "5:4");
AsciiToUnicode(asciiTemp, unicodeTemp);
rightText = unicodeTemp;
break;
case AR_16_10:
sprintf(asciiTemp, "16:10");
AsciiToUnicode(asciiTemp, unicodeTemp);
rightText = unicodeTemp;
break;
case AR_16_9:
sprintf(asciiTemp, "16:9");
AsciiToUnicode(asciiTemp, unicodeTemp);
rightText = unicodeTemp;
break;
case AR_21_9:
sprintf(asciiTemp, "21:9");
AsciiToUnicode(asciiTemp, unicodeTemp);
rightText = unicodeTemp;
break;
}
#endif
break;
case MENUACTION_MUSICVOLUME:
case MENUACTION_SFXVOLUME:
if (m_nPrefsAudio3DProviderIndex == NO_AUDIO_PROVIDER)
rightText = TheText.Get("FEA_NAH");
break;
case MENUACTION_RADIO:
switch (m_PrefsRadioStation) {
case WILDSTYLE:
rightText = TheText.Get("FEA_FM0");
break;
case FLASH_FM:
rightText = TheText.Get("FEA_FM1");
break;
case KCHAT:
rightText = TheText.Get("FEA_FM2");
break;
case FEVER:
rightText = TheText.Get("FEA_FM3");
break;
case V_ROCK:
rightText = TheText.Get("FEA_FM4");
break;
case VCPR:
rightText = TheText.Get("FEA_FM5");
break;
case RADIO_ESPANTOSO:
rightText = TheText.Get("FEA_FM6");
break;
case EMOTION:
rightText = TheText.Get("FEA_FM7");
break;
case WAVE:
rightText = TheText.Get("FEA_FM8");
break;
case USERTRACK:
rightText = TheText.Get("FEA_MP3");
break;
}
break;
case MENUACTION_LEGENDS:
rightText = TheText.Get(m_PrefsShowLegends ? "FEM_ON" : "FEM_OFF");
break;
case MENUACTION_RADARMODE:
switch (m_PrefsRadarMode) {
case 0:
rightText = TheText.Get("FED_RDM");
break;
case 1:
rightText = TheText.Get("FED_RDB");
break;
case 2:
rightText = TheText.Get("FEM_OFF");
break;
}
break;
case MENUACTION_HUD:
rightText = TheText.Get(m_PrefsShowHud ? "FEM_ON" : "FEM_OFF");
break;
#ifdef LEGACY_MENU_OPTIONS
case MENUACTION_SETDBGFLAG:
rightText = TheText.Get(CTheScripts::IsDebugOn() ? "FEM_ON" : "FEM_OFF");
break;
case MENUACTION_SWITCHBIGWHITEDEBUGLIGHT:
rightText = TheText.Get(gbBigWhiteDebugLightSwitchedOn ? "FEM_ON" : "FEM_OFF");
break;
case MENUACTION_COLLISIONPOLYS:
rightText = TheText.Get(gbShowCollisionPolys ? "FEM_ON" : "FEM_OFF");
break;
#endif
case MENUACTION_SHOWHEADBOB:
rightText = TheText.Get(TheCamera.m_bHeadBob ? "FEM_ON" : "FEM_OFF");
break;
case MENUACTION_INVVERT:
rightText = TheText.Get(MousePointerStateHelper.bInvertVertically ? "FEM_OFF" : "FEM_ON");
break;
case MENUACTION_SCREENRES:
AsciiToUnicode(_psGetVideoModeList()[m_nDisplayVideoMode], unicodeTemp);
rightText = unicodeTemp;
if (!m_bGameNotLoaded) {
CFont::SetColor(CRGBA(DARKMENUOPTION_COLOR.r, DARKMENUOPTION_COLOR.g, DARKMENUOPTION_COLOR.b, FadeIn(255)));
}
break;
case MENUACTION_AUDIOHW:
if (m_nPrefsAudio3DProviderIndex == NO_AUDIO_PROVIDER)
rightText = TheText.Get("FEA_NAH");
else if (m_nPrefsAudio3DProviderIndex == -1)
rightText = TheText.Get("FEA_ADP");
else {
char *rawProvider = DMAudio.Get3DProviderName(m_nPrefsAudio3DProviderIndex);
AsciiToUnicode(rawProvider, unicodeTemp);
char *provider = UnicodeToAscii(unicodeTemp); // genius
strupr(provider);
if (!strcmp(provider, "DIRECTSOUND3D HARDWARE SUPPORT")) {
strcpy(provider, "DSOUND3D HARDWARE SUPPORT");
} else if (!strcmp(provider, "DIRECTSOUND3D SOFTWARE EMULATION")) {
strcpy(provider, "DSOUND3D SOFTWARE EMULATION");
}
AsciiToUnicode(provider, unicodeTemp);
rightText = unicodeTemp;
}
break;
case MENUACTION_SPEAKERCONF: {
if (m_nPrefsAudio3DProviderIndex == NO_AUDIO_PROVIDER)
rightText = TheText.Get("FEA_NAH");
else {
switch (m_PrefsSpeakers) {
case 0:
rightText = TheText.Get("FEA_2SP");
break;
case 1:
rightText = TheText.Get("FEA_EAR");
break;
case 2:
rightText = TheText.Get("FEA_4SP");
break;
}
}
break;
}
case MENUACTION_CTRLMETHOD: {
switch (m_ControlMethod) {
case CONTROL_STANDARD:
leftText = TheText.Get("FET_STI");
break;
case CONTROL_CLASSIC:
leftText = TheText.Get("FET_CTI");
break;
}
break;
}
case MENUACTION_DYNAMICACOUSTIC:
rightText = TheText.Get(m_PrefsDMA ? "FEM_ON" : "FEM_OFF");
break;
case MENUACTION_MOUSESTEER:
rightText = TheText.Get(CVehicle::m_bDisableMouseSteering ? "FEM_OFF" : "FEM_ON");
if (m_ControlMethod == CONTROL_CLASSIC) {
CFont::SetColor(CRGBA(DARKMENUOPTION_COLOR.r, DARKMENUOPTION_COLOR.g, DARKMENUOPTION_COLOR.b, FadeIn(255)));
}
break;
case MENUACTION_MP3VOLUMEBOOST:
if (!DMAudio.IsMP3RadioChannelAvailable()) {
rightText = TheText.Get("FEA_NM3");
}
break;
#ifdef CUSTOM_FRONTEND_OPTIONS
case MENUACTION_CFO_DYNAMIC:
case MENUACTION_CFO_SELECT:
CMenuScreenCustom::CMenuEntry &option = aScreens[m_nCurrScreen].m_aEntries[i];
if (option.m_Action == MENUACTION_CFO_SELECT) {
if (option.m_CFOSelect->disableIfGameLoaded && !m_bGameNotLoaded)
CFont::SetColor(CRGBA(DARKMENUOPTION_COLOR.r, DARKMENUOPTION_COLOR.g, DARKMENUOPTION_COLOR.b, FadeIn(255)));
// To whom manipulate option.m_CFO->value of static options externally (like RestoreDef functions)
if (*option.m_CFO->value != option.m_CFOSelect->lastSavedValue)
option.m_CFOSelect->displayedValue = option.m_CFOSelect->lastSavedValue = *option.m_CFO->value;
if (option.m_CFOSelect->displayedValue >= option.m_CFOSelect->numRightTexts || option.m_CFOSelect->displayedValue < 0)
option.m_CFOSelect->displayedValue = 0;
rightText = TheText.Get(option.m_CFOSelect->rightTexts[option.m_CFOSelect->displayedValue]);
} else if (option.m_Action == MENUACTION_CFO_DYNAMIC) {
if (option.m_CFODynamic->drawFunc) {
bool isOptionDisabled = false;
rightText = option.m_CFODynamic->drawFunc(&isOptionDisabled, m_nCurrOption == i);
if (isOptionDisabled)
CFont::SetColor(CRGBA(DARKMENUOPTION_COLOR.r, DARKMENUOPTION_COLOR.g, DARKMENUOPTION_COLOR.b, FadeIn(255)));
}
}
break;
#endif
}
// Highlight trapezoid
if (activeScreen && i == m_nCurrOption && itemsAreSelectable && section == 0) {
int leftXMax, rightXMin;
// FIX: Let's don't scale those so GetStringWidth can give us unscaled width, which will be handy to other calculations below that's done without scaling in mind,
// and scaling will be done eventually.
// CFont::SetScale(MENU_X(BIGTEXT_X_SCALE), MENU_Y(BIGTEXT_Y_SCALE));
CFont::SetScale(BIGTEXT_X_SCALE, BIGTEXT_Y_SCALE);
wchar *curOptionName = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName);
float curOptionWidth = CFont::GetStringWidth(curOptionName, true);
if (CFont::Details.centre) {
leftXMax = Max(0, aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_X - curOptionWidth / 2.f);
rightXMin = Min(DEFAULT_SCREEN_WIDTH, curOptionWidth / 2.f + aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_X);
} else if (!CFont::Details.rightJustify) {
leftXMax = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_X;
rightXMin = Min(DEFAULT_SCREEN_WIDTH, curOptionWidth + aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_X);
} else {
leftXMax = Max(0, aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_X - curOptionWidth);
rightXMin = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_X;
}
CFont::SetScale(MENU_X(BIGTEXT_X_SCALE), MENU_Y(BIGTEXT_Y_SCALE));
int action = aScreens[m_nCurrScreen].m_aEntries[i].m_Action;
int saveSlot = aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot;
if (rightText || action == MENUACTION_DRAWDIST || action == MENUACTION_BRIGHTNESS || action == MENUACTION_MUSICVOLUME ||
action == MENUACTION_SFXVOLUME || action == MENUACTION_MP3VOLUMEBOOST || action == MENUACTION_MOUSESENS ||
saveSlot >= SAVESLOT_1 && saveSlot <= SAVESLOT_8) {
rightXMin = 600;
leftXMax = 40;
}
int y = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Y MINUS_SCROLL_OFFSET;
int topYMax = y;
uint32 bottomYMin = y + MENU_DEFAULT_LINE_HEIGHT - 7; // Decreasing is not recommended. Because this actually is dependent to font scale, not line height.
// Actually bottomRight and bottomLeft should be exchanged here(although this is original code).
// So this shows us either R* didn't use same struct for menu BG and highlight, or they just kept fields as x1,y1 etc. Yikes.
/*if (m_nOptionHighlightTransitionBlend == 0) {
if (m_firstStartCounter == 255 && m_nMenuFadeAlpha == 255 && !bMenuChangeOngoing) {
CSprite2d::Draw2DPolygon(MENU_X_LEFT_ALIGNED(menuOptionHighlight.topLeft_x), MENU_Y(menuOptionHighlight.topLeft_y),
MENU_X_LEFT_ALIGNED(menuOptionHighlight.topRight_x), MENU_Y(menuOptionHighlight.topRight_y),
MENU_X_LEFT_ALIGNED(menuOptionHighlight.bottomRight_x), MENU_Y(menuOptionHighlight.bottomRight_y),
MENU_X_LEFT_ALIGNED(menuOptionHighlight.bottomLeft_x), MENU_Y(menuOptionHighlight.bottomLeft_y), SELECTIONBORDER_COLOR);
}
menuOptionHighlight.SaveCurrentCoors();
menuOptionHighlight.topLeft_x = leftXMax - 5 - CGeneral::GetRandomNumber() % 10;
menuOptionHighlight.topLeft_y = topYMax - CGeneral::GetRandomNumber() % 7;
menuOptionHighlight.topRight_x = rightXMin + 5 + CGeneral::GetRandomNumber() % 10;
menuOptionHighlight.topRight_y = topYMax - CGeneral::GetRandomNumber() % 7;
menuOptionHighlight.bottomLeft_x = rightXMin + 5 + CGeneral::GetRandomNumber() % 10;
menuOptionHighlight.bottomLeft_y = bottomYMin + CGeneral::GetRandomNumber() % 7;
menuOptionHighlight.bottomRight_x = leftXMax - 5 - CGeneral::GetRandomNumber() % 10;
menuOptionHighlight.bottomRight_y = bottomYMin + CGeneral::GetRandomNumber() % 7;
menuOptionHighlight.UpdateMultipliers();
menuOptionHighlight.Translate(m_nOptionHighlightTransitionBlend);
} else if (m_nOptionHighlightTransitionBlend < 255) {
menuOptionHighlight.Translate(m_nOptionHighlightTransitionBlend);
if (m_firstStartCounter == 255 && m_nMenuFadeAlpha == 255 && !bMenuChangeOngoing) {
CSprite2d::Draw2DPolygon(MENU_X_LEFT_ALIGNED(menuOptionHighlight.topLeft_x), MENU_Y(menuOptionHighlight.topLeft_y),
MENU_X_LEFT_ALIGNED(menuOptionHighlight.topRight_x), MENU_Y(menuOptionHighlight.topRight_y),
MENU_X_LEFT_ALIGNED(menuOptionHighlight.bottomRight_x), MENU_Y(menuOptionHighlight.bottomRight_y),
MENU_X_LEFT_ALIGNED(menuOptionHighlight.bottomLeft_x), MENU_Y(menuOptionHighlight.bottomLeft_y), SELECTIONBORDER_COLOR);
}
} else {
m_nOptionHighlightTransitionBlend = 255;
menuOptionHighlight.Translate(m_nOptionHighlightTransitionBlend);
if (m_firstStartCounter == 255 && m_nMenuFadeAlpha == 255 && !bMenuChangeOngoing) {
CSprite2d::Draw2DPolygon(MENU_X_LEFT_ALIGNED(menuOptionHighlight.topLeft_x), MENU_Y(menuOptionHighlight.topLeft_y),
MENU_X_LEFT_ALIGNED(menuOptionHighlight.topRight_x), MENU_Y(menuOptionHighlight.topRight_y),
MENU_X_LEFT_ALIGNED(menuOptionHighlight.bottomRight_x), MENU_Y(menuOptionHighlight.bottomRight_y),
MENU_X_LEFT_ALIGNED(menuOptionHighlight.bottomLeft_x), MENU_Y(menuOptionHighlight.bottomLeft_y), SELECTIONBORDER_COLOR);
}
}*/
static PauseModeTime lastBlendChange = 0;
if (m_nOptionHighlightTransitionBlend <= 255) {
static uint32 blendChangeCounter = 0;
if (CTimer::GetTimeInMillisecondsPauseMode() - lastBlendChange > 20
#ifndef FIX_HIGH_FPS_BUGS_ON_FRONTEND // Dirty dirty hack
|| blendChangeCounter > 20
#endif
) {
m_nOptionHighlightTransitionBlend += 50;
lastBlendChange = CTimer::GetTimeInMillisecondsPauseMode();
blendChangeCounter = 0;
}
++blendChangeCounter;
}
}
if (section == 1) {
if (leftText) {
CFont::PrintString(MENU_X_LEFT_ALIGNED(aScreens[m_nCurrScreen].m_aEntries[i].m_X), MENU_Y(aScreens[m_nCurrScreen].m_aEntries[i].m_Y MINUS_SCROLL_OFFSET), leftText);
}
if (rightText) {
CFont::SetCentreOff();
CFont::SetRightJustifyOn();
if (aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot >= SAVESLOT_1 && aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot <= SAVESLOT_8) {
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetScale(MENU_X(MEDIUMTEXT_X_SCALE), MENU_Y(MEDIUMTEXT_Y_SCALE));
} else {
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetScale(MENU_X(BIGTEXT_X_SCALE), MENU_Y(BIGTEXT_Y_SCALE));
}
CFont::PrintString(MENU_X_LEFT_ALIGNED(DEFAULT_SCREEN_WIDTH - RIGHT_ALIGNED_TEXT_RIGHT_MARGIN(xMargin)), MENU_Y(aScreens[m_nCurrScreen].m_aEntries[i].m_Y MINUS_SCROLL_OFFSET), rightText);
}
if (m_nPrefsAudio3DProviderIndex == DMAudio.GetCurrent3DProviderIndex()) {
if (!strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEA_3DH") && m_nHelperTextMsgId == 1)
ResetHelperText();
}
if (m_nDisplayVideoMode == m_nPrefsVideoMode) {
if (!strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FED_RES") && m_nHelperTextMsgId == 1)
ResetHelperText();
}
if (m_nPrefsAudio3DProviderIndex != DMAudio.GetCurrent3DProviderIndex()) {
if (!strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEA_3DH"))
SetHelperText(1);
}
if (m_nDisplayVideoMode != m_nPrefsVideoMode) {
if (!strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FED_RES"))
SetHelperText(1);
}
if (m_nPrefsAudio3DProviderIndex != DMAudio.GetCurrent3DProviderIndex()) {
if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEA_3DH") != 0
#ifdef CUSTOM_FRONTEND_OPTIONS
&& ScreenHasOption(m_nCurrScreen, "FEA_3DH")
#else
&& m_nCurrScreen == MENUPAGE_SOUND_SETTINGS
#endif
&& m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
m_nPrefsAudio3DProviderIndex = DMAudio.GetCurrent3DProviderIndex();
SetHelperText(3);
}
}
if (m_nDisplayVideoMode != m_nPrefsVideoMode) {
if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FED_RES") != 0
#ifdef CUSTOM_FRONTEND_OPTIONS
&& ScreenHasOption(m_nCurrScreen, "FED_RES")) {
#else
&& m_nCurrScreen == MENUPAGE_DISPLAY_SETTINGS) {
#endif
m_nDisplayVideoMode = m_nPrefsVideoMode;
SetHelperText(3);
}
}
// Sliders
int lastActiveBarX;
switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) {
case MENUACTION_BRIGHTNESS:
ProcessSlider((float)(m_PrefsBrightness - MIN_BRIGHTNESS) / (MAX_BRIGHTNESS - MIN_BRIGHTNESS), 70.0f, HOVEROPTION_INCREASE_BRIGHTNESS, HOVEROPTION_DECREASE_BRIGHTNESS, SCREEN_WIDTH, true);
break;
case MENUACTION_DRAWDIST:
ProcessSlider((m_PrefsLOD - 0.925f) / 0.875f, 99.0f, HOVEROPTION_INCREASE_DRAWDIST, HOVEROPTION_DECREASE_DRAWDIST, SCREEN_WIDTH, true);
break;
case MENUACTION_MUSICVOLUME:
if(m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER)
ProcessSlider(m_PrefsMusicVolume / 64.0f, 70.0f, HOVEROPTION_INCREASE_MUSICVOLUME, HOVEROPTION_DECREASE_MUSICVOLUME, SCREEN_WIDTH, true);
break;
case MENUACTION_SFXVOLUME:
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER)
ProcessSlider(m_PrefsSfxVolume / 64.0f, 99.0f, HOVEROPTION_INCREASE_SFXVOLUME, HOVEROPTION_DECREASE_SFXVOLUME, SCREEN_WIDTH, true);
break;
case MENUACTION_MOUSESENS:
ProcessSlider(TheCamera.m_fMouseAccelHorzntl * 200.0f, 170.0f, HOVEROPTION_INCREASE_MOUSESENS, HOVEROPTION_DECREASE_MOUSESENS, SCREEN_WIDTH, false);
break;
case MENUACTION_MP3VOLUMEBOOST:
if(m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER && DMAudio.IsMP3RadioChannelAvailable())
ProcessSlider(m_PrefsMP3BoostVolume / 64.f, 128.0f, HOVEROPTION_INCREASE_MP3BOOST, HOVEROPTION_DECREASE_MP3BOOST, SCREEN_WIDTH, true);
break;
}
// Not just unused, but also collides with the bug fix in Font.cpp. Yikes.
#ifndef FIX_BUGS
nextYToUse += MENU_DEFAULT_LINE_HEIGHT * CFont::GetNumberLines(MENU_X_LEFT_ALIGNED(60.0f), MENU_Y(nextYToUse), leftText);
#endif
if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action == MENUACTION_RADIO) {
nextYToUse += MENURADIO_SELECTOR_HEIGHT + 5.f; // unused
}
}
}
}
section++;
}
#ifdef SCROLLABLE_PAGES
#define SCROLLBAR_BOTTOM_Y 105.0f // only for background, scrollbar's itself is calculated
#define SCROLLBAR_RIGHT_X 26.0f
#define SCROLLBAR_WIDTH 9.5f
#define SCROLLBAR_TOP_Y 84
if (activeScreen && SCREEN_HAS_AUTO_SCROLLBAR) {
// Scrollbar background
CSprite2d::DrawRect(CRect(MENU_X_RIGHT_ALIGNED(SCROLLBAR_RIGHT_X - 2), MENU_Y(SCROLLBAR_TOP_Y),
MENU_X_RIGHT_ALIGNED(SCROLLBAR_RIGHT_X - 2 - SCROLLBAR_WIDTH), SCREEN_SCALE_FROM_BOTTOM(SCROLLBAR_BOTTOM_Y)), CRGBA(30, 30, 30, FadeIn(150)));
float scrollbarHeight = SCROLLBAR_MAX_HEIGHT / (m_nTotalListRow / (float) MAX_VISIBLE_OPTION);
float scrollbarBottom, scrollbarTop;
scrollbarBottom = MENU_Y(SCROLLBAR_TOP_Y - 6 + m_nScrollbarTopMargin + scrollbarHeight);
scrollbarTop = MENU_Y(SCROLLBAR_TOP_Y + 2 + m_nScrollbarTopMargin);
// Scrollbar shadow
CSprite2d::DrawRect(CRect(MENU_X_RIGHT_ALIGNED(SCROLLBAR_RIGHT_X - 4), scrollbarTop,
MENU_X_RIGHT_ALIGNED(SCROLLBAR_RIGHT_X - 1 - SCROLLBAR_WIDTH), scrollbarBottom + MENU_Y(1.0f)),
CRGBA(50, 50, 50, FadeIn(255)));
// Scrollbar
CSprite2d::DrawRect(CRect(MENU_X_RIGHT_ALIGNED(SCROLLBAR_RIGHT_X - 4), scrollbarTop,
MENU_X_RIGHT_ALIGNED(SCROLLBAR_RIGHT_X - SCROLLBAR_WIDTH), scrollbarBottom),
CRGBA(SCROLLBAR_COLOR.r, SCROLLBAR_COLOR.g, SCROLLBAR_COLOR.b, FadeIn(255)));
}
#endif
switch (m_nCurrScreen) {
#ifdef GAMEPAD_MENU
case MENUPAGE_CONTROLLER_SETTINGS:
PrintController();
break;
#endif
case MENUPAGE_STATS:
case MENUPAGE_CONTROLLER_PC:
case MENUPAGE_SOUND_SETTINGS:
case MENUPAGE_DISPLAY_SETTINGS:
case MENUPAGE_MOUSE_CONTROLS:
DisplayHelperText(nil);
break;
case MENUPAGE_OPTIONS:
if (m_nPrefsAudio3DProviderIndex == NO_AUDIO_PROVIDER && aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_LOADRADIO)
DisplayHelperText("FEA_NAH");
break;
#ifdef CUSTOM_FRONTEND_OPTIONS
default:
if (aScreens[m_nCurrScreen].layout) {
if (aScreens[m_nCurrScreen].layout->showLeftRightHelper) {
DisplayHelperText(nil);
}
}
break;
#endif
}
if (m_nCurrScreen == MENUPAGE_DELETING_IN_PROGRESS) {
SmallMessageScreen("FEDL_WR");
}
#ifndef XBOX_MESSAGE_SCREEN
else if (m_nCurrScreen == MENUPAGE_SAVING_IN_PROGRESS) {
SmallMessageScreen("FESZ_WR");
}
#endif
}
int
CMenuManager::GetNumOptionsCntrlConfigScreens(void)
{
int number = 0;
switch (m_nCurrScreen) {
#ifdef LEGACY_MENU_OPTIONS
case MENUPAGE_CONTROLLER_PC_OLD3:
number = 2;
break;
case MENUPAGE_CONTROLLER_DEBUG:
number = 4;
break;
#endif
case MENUPAGE_KEYBOARD_CONTROLS:
switch (m_ControlMethod) {
case CONTROL_STANDARD:
number = 27;
break;
case CONTROL_CLASSIC:
number = 32;
break;
}
break;
}
return number;
}
void
CMenuManager::DrawControllerBound(int32 yStart, int32 xStart, int32 unused, int8 column)
{
int controllerAction = PED_FIREWEAPON;
// GetStartOptionsCntrlConfigScreens();
int numOptions = GetNumOptionsCntrlConfigScreens();
int nextY = MENU_Y(yStart);
int bindingMargin = MENU_X(3.0f);
float rowHeight;
switch (m_ControlMethod) {
case CONTROL_STANDARD:
rowHeight = CONTSETUP_STANDARD_ROW_HEIGHT;
break;
case CONTROL_CLASSIC:
rowHeight = CONTSETUP_CLASSIC_ROW_HEIGHT;
break;
default:
break;
}
for (int optionIdx = 0; optionIdx < numOptions; nextY = MENU_Y(++optionIdx * rowHeight + yStart)) {
int nextX = xStart;
int bindingsForThisOpt = 0;
int contSetOrder = SETORDER_1;
CFont::SetColor(CRGBA(255, 255, 255, FadeIn(255)));
if (column == CONTSETUP_PED_COLUMN) {
switch (optionIdx) {
case 0:
controllerAction = PED_FIREWEAPON;
break;
case 1:
controllerAction = PED_CYCLE_WEAPON_RIGHT;
break;
case 2:
controllerAction = PED_CYCLE_WEAPON_LEFT;
break;
case 3:
controllerAction = GO_FORWARD;
break;
case 4:
controllerAction = GO_BACK;
break;
case 5:
controllerAction = GO_LEFT;
break;
case 6:
controllerAction = GO_RIGHT;
break;
case 7:
controllerAction = PED_SNIPER_ZOOM_IN;
break;
case 8:
controllerAction = PED_SNIPER_ZOOM_OUT;
break;
case 9:
controllerAction = VEHICLE_ENTER_EXIT;
break;
case 10:
case 11:
case 12:
case 16:
case 20:
case 21:
case 22:
case 23:
controllerAction = -1;
break;
case 13:
controllerAction = CAMERA_CHANGE_VIEW_ALL_SITUATIONS;
break;
case 14:
controllerAction = PED_JUMPING;
break;
case 15:
controllerAction = PED_SPRINT;
break;
case 17:
controllerAction = PED_LOCK_TARGET;
break;
case 18:
controllerAction = PED_DUCK;
break;
case 19:
controllerAction = PED_ANSWER_PHONE;
break;
case 24:
controllerAction = PED_LOOKBEHIND;
break;
case 25:
if (m_ControlMethod == CONTROL_STANDARD)
controllerAction = -1;
else
controllerAction = PED_1RST_PERSON_LOOK_LEFT;
break;
case 26:
if (m_ControlMethod == CONTROL_STANDARD)
controllerAction = -1;
else
controllerAction = PED_1RST_PERSON_LOOK_RIGHT;
break;
case 27:
controllerAction = PED_1RST_PERSON_LOOK_UP;
break;
case 28:
controllerAction = PED_1RST_PERSON_LOOK_DOWN;
break;
case 29:
controllerAction = PED_CYCLE_TARGET_LEFT;
break;
case 30:
controllerAction = PED_CYCLE_TARGET_RIGHT;
break;
case 31:
controllerAction = PED_CENTER_CAMERA_BEHIND_PLAYER;
break;
default:
break;
}
} else if (column == CONTSETUP_VEHICLE_COLUMN) {
switch (optionIdx) {
case 0:
#ifdef BIND_VEHICLE_FIREWEAPON
controllerAction = VEHICLE_FIREWEAPON;
#else
controllerAction = PED_FIREWEAPON;
#endif
break;
case 1:
case 2:
case 7:
case 8:
case 14:
case 15:
case 17:
case 18:
case 19:
case 27:
case 28:
case 29:
case 30:
case 31:
controllerAction = -1;
break;
case 3:
controllerAction = VEHICLE_ACCELERATE;
break;
case 4:
controllerAction = VEHICLE_BRAKE;
break;
case 5:
controllerAction = GO_LEFT;
break;
case 6:
controllerAction = GO_RIGHT;
break;
case 9:
controllerAction = VEHICLE_ENTER_EXIT;
break;
case 10:
controllerAction = VEHICLE_CHANGE_RADIO_STATION;
break;
case 11:
controllerAction = VEHICLE_HORN;
break;
case 12:
controllerAction = TOGGLE_SUBMISSIONS;
break;
case 13:
controllerAction = CAMERA_CHANGE_VIEW_ALL_SITUATIONS;
break;
case 16:
controllerAction = VEHICLE_HANDBRAKE;
break;
case 20:
controllerAction = VEHICLE_TURRETLEFT;
break;
case 21:
controllerAction = VEHICLE_TURRETRIGHT;
break;
case 22:
controllerAction = VEHICLE_TURRETUP;
break;
case 23:
controllerAction = VEHICLE_TURRETDOWN;
break;
case 24:
controllerAction = -2;
break;
case 25:
controllerAction = VEHICLE_LOOKLEFT;
break;
case 26:
controllerAction = VEHICLE_LOOKRIGHT;
break;
default:
break;
}
}
// Highlight selected column(and make its text black)
if (m_nSelectedListRow == optionIdx) {
int bgY = m_nSelectedListRow * rowHeight + yStart + 1.0f;
if (m_nCurrExLayer == HOVEROPTION_LIST) {
if (column == CONTSETUP_PED_COLUMN && m_nSelectedContSetupColumn == CONTSETUP_PED_COLUMN) {
#ifdef FIX_BUGS
CSprite2d::DrawRect(CRect(nextX, MENU_Y(bgY), nextX + MENU_X(CONTSETUP_BOUND_COLUMN_WIDTH),
MENU_Y(bgY + CONTSETUP_BOUND_HIGHLIGHT_HEIGHT)), CRGBA(SELECTIONBORDER_COLOR.r, SELECTIONBORDER_COLOR.g, SELECTIONBORDER_COLOR.b, FadeIn(255)));
#else
CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(210.0f), MENU_Y(bgY),
MENU_X_LEFT_ALIGNED(400.0f), MENU_Y(bgY + CONTSETUP_BOUND_HIGHLIGHT_HEIGHT)),
CRGBA(SELECTIONBORDER_COLOR.r, SELECTIONBORDER_COLOR.g, SELECTIONBORDER_COLOR.b, FadeIn(255)));
#endif
CFont::SetColor(CRGBA(255, 255, 255, FadeIn(255)));
} else if (column == CONTSETUP_VEHICLE_COLUMN && m_nSelectedContSetupColumn == CONTSETUP_VEHICLE_COLUMN) {
#ifdef FIX_BUGS
CSprite2d::DrawRect(CRect(nextX, MENU_Y(bgY), nextX + MENU_X(CONTSETUP_BOUND_COLUMN_WIDTH),
MENU_Y(bgY + CONTSETUP_BOUND_HIGHLIGHT_HEIGHT)), CRGBA(SELECTIONBORDER_COLOR.r, SELECTIONBORDER_COLOR.g, SELECTIONBORDER_COLOR.b, FadeIn(255)));
#else
CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(410.0f), MENU_Y(bgY), MENU_X_LEFT_ALIGNED(600.0f), MENU_Y(bgY + CONTSETUP_BOUND_HIGHLIGHT_HEIGHT)),
CRGBA(SELECTIONBORDER_COLOR.r, SELECTIONBORDER_COLOR.g, SELECTIONBORDER_COLOR.b, FadeIn(255)));
#endif
CFont::SetColor(CRGBA(255, 255, 255, FadeIn(255)));
}
}
}
// Print bindings, including seperator (-) between them
CFont::SetScale(MENU_X(0.25f), MENU_Y(LISTITEM_Y_SCALE));
#ifdef FIX_BUGS
for (; contSetOrder < MAX_SETORDERS && controllerAction >= 0; contSetOrder++) {
#else
for (; contSetOrder < MAX_SETORDERS && controllerAction != -1; contSetOrder++) {
#endif
wchar *settingText = ControlsManager.GetControllerSettingTextWithOrderNumber((e_ControllerAction)controllerAction, (eContSetOrder)contSetOrder);
if (settingText) {
++bindingsForThisOpt;
if (bindingsForThisOpt > 1) {
wchar *seperator = TheText.Get("FEC_IBT");
CFont::SetColor(CRGBA(255, 255, 255, FadeIn(255)));
CFont::PrintString(nextX, nextY, seperator);
nextX += CFont::GetStringWidth(seperator, true) + bindingMargin;
}
CFont::PrintString(nextX, nextY, settingText);
#ifdef MORE_LANGUAGES
if (CFont::IsJapanese())
nextX += CFont::GetStringWidth_Jap(settingText) + bindingMargin;
else
#endif
nextX += CFont::GetStringWidth(settingText, true) + bindingMargin;
}
}
if (controllerAction == -1) {
CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255)));
CFont::PrintString(nextX, nextY, TheText.Get("FEC_NUS")); // not used
} else if (controllerAction == -2) {
CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255)));
CFont::PrintString(nextX, nextY, TheText.Get("FEC_CMP")); // combo: l+r
} else if (bindingsForThisOpt == 0) {
m_NoEmptyBinding = false;
if (m_nSelectedListRow != optionIdx) {
CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255)));
CFont::PrintString(nextX, nextY, TheText.Get("FEC_UNB")); // unbound
} else if (m_bWaitingForNewKeyBind) {
if (column != m_nSelectedContSetupColumn) {
CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255)));
CFont::PrintString(nextX, nextY, TheText.Get("FEC_UNB")); // unbound
}
} else {
if (column != m_nSelectedContSetupColumn) {
CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255)));
}
CFont::PrintString(nextX, nextY, TheText.Get("FEC_UNB")); // unbound
}
}
if (column == CONTSETUP_PED_COLUMN && m_nSelectedContSetupColumn == CONTSETUP_PED_COLUMN ||
column == CONTSETUP_VEHICLE_COLUMN && m_nSelectedContSetupColumn == CONTSETUP_VEHICLE_COLUMN) {
if (optionIdx == m_nSelectedListRow && controllerAction != -1 && controllerAction != -2) {
m_CurrCntrlAction = controllerAction;
if (m_bWaitingForNewKeyBind) {
static bool showWaitingText = false;
if (bindingsForThisOpt > 0) {
wchar *seperator = TheText.Get("FEC_IBT");
CFont::PrintString(nextX, nextY, seperator);
nextX += CFont::GetStringWidth(seperator, true) + bindingMargin;
}
static PauseModeTime lastWaitingTextFlash = 0;
if (CTimer::GetTimeInMillisecondsPauseMode() - lastWaitingTextFlash > 150) {
showWaitingText = !showWaitingText;
lastWaitingTextFlash = CTimer::GetTimeInMillisecondsPauseMode();
}
if (showWaitingText) {
CFont::SetColor(CRGBA(255, 255, 255, FadeIn(255)));
CFont::PrintString(nextX, nextY, TheText.Get("FEC_QUE")); // "???"
}
if (m_bKeyChangeNotProcessed)
DisplayHelperText("FET_CIG");
else
DisplayHelperText("FET_RIG");
SET_FONT_FOR_LIST_ITEM
m_bKeyIsOK = true;
} else {
DisplayHelperText("FET_CIG");
SET_FONT_FOR_LIST_ITEM
m_bKeyIsOK = false;
m_bKeyChangeNotProcessed = false;
}
} else if (optionIdx == m_nSelectedListRow) {
DisplayHelperText("FET_EIG");
SET_FONT_FOR_LIST_ITEM
}
}
}
}
void
CMenuManager::DrawControllerScreenExtraText(int yStart, int xStart, int lineHeight)
{
int extraTextStart = GetStartOptionsCntrlConfigScreens();
int numOpts = GetNumOptionsCntrlConfigScreens();
int spacing = MENU_X(10.0f);
for (int i = extraTextStart; i < extraTextStart + numOpts; i++) {
int numTextsPrinted = 0;
int nextX = xStart;
for (int j = 1; j < 5; j++) {
wchar *text = ControlsManager.GetControllerSettingTextWithOrderNumber((e_ControllerAction)i, (eContSetOrder)j);
if (text)
++numTextsPrinted;
if (text) {
// Seperator
if (numTextsPrinted > 1) {
CFont::PrintString(nextX, MENU_Y(yStart), TheText.Get("FEC_IBT"));
nextX = CFont::GetStringWidth(TheText.Get("FEC_IBT"), true) + spacing + nextX;
}
CFont::PrintString(nextX, MENU_Y(yStart), text);
}
if (text)
nextX = CFont::GetStringWidth(text, true) + spacing + nextX;
}
if (m_nCurrOption == i - extraTextStart && m_bWaitingForNewKeyBind) {
static bool waitingTextVisible = false;
// Seperator
if (numTextsPrinted > 0) {
CFont::PrintString(nextX, MENU_Y(yStart), TheText.Get("FEC_IBT"));
nextX = CFont::GetStringWidth(TheText.Get("FEC_IBT"), true) + spacing + nextX;
}
static PauseModeTime lastStateChange = 0;
if (CTimer::GetTimeInMillisecondsPauseMode() - lastStateChange > 150) {
waitingTextVisible = !waitingTextVisible;
lastStateChange = CTimer::GetTimeInMillisecondsPauseMode();
}
if (waitingTextVisible) {
CFont::SetColor(CRGBA(255, 255, 0, FadeIn(255)));
CFont::PrintString(nextX, MENU_Y(yStart), TheText.Get("FEC_QUE"));
CFont::SetColor(CRGBA(LABEL_COLOR.r, LABEL_COLOR.g, LABEL_COLOR.b, FadeIn(255)));
}
}
yStart += lineHeight;
}
wchar *error = nil;
if (DisplayComboButtonErrMsg)
error = ControlsManager.GetButtonComboText((e_ControllerAction)(m_nCurrOption + extraTextStart));
if (error) {
CFont::SetColor(CRGBA(233, 22, 159, 255));
CFont::PrintString(xStart, MENU_Y(yStart + 10), error);
}
}
void
CMenuManager::DrawControllerSetupScreen()
{
float rowHeight;
switch (m_ControlMethod) {
case CONTROL_STANDARD:
rowHeight = CONTSETUP_STANDARD_ROW_HEIGHT;
break;
case CONTROL_CLASSIC:
rowHeight = CONTSETUP_CLASSIC_ROW_HEIGHT;
break;
default:
break;
}
RESET_FONT_FOR_NEW_PAGE
SET_FONT_FOR_MENU_HEADER
// Shadow
CFont::SetColor(CRGBA(30, 30, 30, FadeIn(255)));
//if (m_ControlMethod == CONTROL_STANDARD)
// CFont::PrintString(SCREEN_STRETCH_X(MENUHEADER_POS_X) - MENU_X(7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get("FET_STI"));
//else if (m_ControlMethod == CONTROL_CLASSIC)
// CFont::PrintString(SCREEN_STRETCH_X(MENUHEADER_POS_X) - MENU_X(7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get("FET_CTI"));
// Real header
CFont::SetColor(CRGBA(HEADER_COLOR.r, HEADER_COLOR.g, HEADER_COLOR.b, FadeIn(255)));
if (m_ControlMethod == CONTROL_STANDARD)
CFont::PrintString(SCREEN_STRETCH_X(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get("FET_STI"));
else if (m_ControlMethod == CONTROL_CLASSIC)
CFont::PrintString(SCREEN_STRETCH_X(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get("FET_CTI"));
wchar *actionTexts[33];
actionTexts[0] = TheText.Get("FEC_FIR");
actionTexts[1] = TheText.Get("FEC_NWE");
actionTexts[2] = TheText.Get("FEC_PWE");
actionTexts[3] = TheText.Get("FEC_FOR");
actionTexts[4] = TheText.Get("FEC_BAC");
actionTexts[5] = TheText.Get("FEC_LEF");
actionTexts[6] = TheText.Get("FEC_RIG");
actionTexts[7] = TheText.Get("FEC_ZIN");
actionTexts[8] = TheText.Get("FEC_ZOT");
actionTexts[9] = TheText.Get("FEC_EEX");
actionTexts[10] = TheText.Get("FEC_RAD");
actionTexts[11] = TheText.Get("FEC_HRN");
actionTexts[12] = TheText.Get("FEC_SUB");
actionTexts[13] = TheText.Get("FEC_CMR");
actionTexts[14] = TheText.Get("FEC_JMP");
actionTexts[15] = TheText.Get("FEC_SPN");
actionTexts[16] = TheText.Get("FEC_HND");
actionTexts[17] = TheText.Get("FEC_TAR");
actionTexts[18] = TheText.Get("FEC_CRO");
actionTexts[19] = TheText.Get("FEC_ANS");
if (m_ControlMethod == CONTROL_CLASSIC) {
actionTexts[20] = TheText.Get("FEC_TFL");
actionTexts[21] = TheText.Get("FEC_TFR");
actionTexts[22] = TheText.Get("FEC_TFU");
actionTexts[23] = TheText.Get("FEC_TFD");
actionTexts[24] = TheText.Get("FEC_LBA");
actionTexts[25] = TheText.Get("FEC_LOL");
actionTexts[26] = TheText.Get("FEC_LOR");
actionTexts[27] = TheText.Get("FEC_LUD");
actionTexts[28] = TheText.Get("FEC_LDU");
actionTexts[29] = TheText.Get("FEC_NTR");
actionTexts[30] = TheText.Get("FEC_PTT");
actionTexts[31] = TheText.Get("FEC_CEN");
actionTexts[32] = nil;
} else {
actionTexts[20] = TheText.Get("FEC_TFL");
actionTexts[21] = TheText.Get("FEC_TFR");
actionTexts[22] = TheText.Get("FEC_TFU");
actionTexts[23] = TheText.Get("FEC_TFD");
actionTexts[24] = TheText.Get("FEC_LBA");
actionTexts[25] = TheText.Get("FEC_LOL");
actionTexts[26] = TheText.Get("FEC_LOR");
actionTexts[27] = nil;
}
// Blue panel background
CSprite2d::DrawRect(CRect(MENU_X_LEFT_ALIGNED(CONTSETUP_LIST_LEFT), MENU_Y(CONTSETUP_LIST_TOP),
MENU_X_RIGHT_ALIGNED(CONTSETUP_LIST_RIGHT), SCREEN_SCALE_FROM_BOTTOM(CONTSETUP_LIST_BOTTOM)),
CRGBA(LIST_BACKGROUND_COLOR.r, LIST_BACKGROUND_COLOR.g, LIST_BACKGROUND_COLOR.b, FadeIn(LIST_BACKGROUND_COLOR.a)));
if (m_nCurrExLayer == HOVEROPTION_LIST)
CFont::SetColor(CRGBA(SELECTEDMENUOPTION_COLOR.r, SELECTEDMENUOPTION_COLOR.g, SELECTEDMENUOPTION_COLOR.b, FadeIn(255)));
else
CFont::SetColor(CRGBA(MENUOPTION_COLOR.r, MENUOPTION_COLOR.g, MENUOPTION_COLOR.b, FadeIn(255)));
// List header
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
CFont::SetScale(MENU_X(MENUACTION_SCALE_MULT), MENU_Y(MENUACTION_SCALE_MULT));
CFont::SetRightJustifyOff();
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(255)));
CFont::PrintString(MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_2_X), MENU_Y(CONTSETUP_LIST_TOP), TheText.Get("FET_CFT"));
CFont::PrintString(MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_3_X), MENU_Y(CONTSETUP_LIST_TOP), TheText.Get("FET_CCR"));
CFont::SetDropShadowPosition(0);
SET_FONT_FOR_LIST_ITEM
int yStart;
if (m_ControlMethod == CONTROL_CLASSIC)
yStart = CONTSETUP_LIST_TOP + 18;
else
yStart = CONTSETUP_LIST_TOP + 21;
float optionYBottom = yStart + rowHeight;
for (int i = 0; i < ARRAY_SIZE(actionTexts); ++i) {
wchar *actionText = actionTexts[i];
if (!actionText)
break;
if (!m_bWaitingForNewKeyBind) {
if (m_nMousePosX > MENU_X_LEFT_ALIGNED(CONTSETUP_LIST_LEFT - 10.0f) &&
m_nMousePosX < MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_3_X + CONTSETUP_BOUND_COLUMN_WIDTH)) {
if (m_nMousePosY > MENU_Y(i * rowHeight + yStart) && m_nMousePosY < MENU_Y(i * rowHeight + optionYBottom)) {
m_nOptionMouseHovering = i;
if (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY) {
m_nCurrExLayer = HOVEROPTION_LIST;
m_nSelectedListRow = i;
// why different number for 3rd column hovering X?? this function is a mess
#ifdef FIX_BUGS
if (m_nMousePosX > MENU_X_LEFT_ALIGNED(0.0f) && m_nMousePosX < MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_2_X + CONTSETUP_BOUND_COLUMN_WIDTH)) {
#else
if (m_nMousePosX > MENU_X_LEFT_ALIGNED(0.0f) && m_nMousePosX < MENU_X_LEFT_ALIGNED(370.0f)) {
#endif
m_nSelectedContSetupColumn = CONTSETUP_PED_COLUMN;
#ifdef FIX_BUGS
} else if (m_nMousePosX > MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_2_X + CONTSETUP_BOUND_COLUMN_WIDTH) && m_nMousePosX < SCREEN_WIDTH) {
#else
} else if (m_nMousePosX > MENU_X_LEFT_ALIGNED(370.0f) && m_nMousePosX < SCREEN_WIDTH) {
#endif
m_nSelectedContSetupColumn = CONTSETUP_VEHICLE_COLUMN;
}
}
// what??
if (m_nHoverOption == HOVEROPTION_SKIN) {
if (i == m_nSelectedListRow) {
m_nHoverOption = HOVEROPTION_NOT_HOVERING;
m_bWaitingForNewKeyBind = true;
m_bStartWaitingForKeyBind = true;
pControlEdit = &m_KeyPressedCode;
}
} else
m_nHoverOption = HOVEROPTION_NOT_HOVERING;
}
}
}
if (m_nSelectedListRow != i)
CFont::SetColor(CRGBA(MENUOPTION_COLOR.r, MENUOPTION_COLOR.g, MENUOPTION_COLOR.b, FadeIn(255)));
else if (m_nCurrExLayer == HOVEROPTION_LIST)
CFont::SetColor(CRGBA(SELECTEDMENUOPTION_COLOR.r, SELECTEDMENUOPTION_COLOR.g, SELECTEDMENUOPTION_COLOR.b, FadeIn(255)));
CFont::SetRightJustifyOff();
if (m_PrefsLanguage == LANGUAGE_GERMAN && (i == 20 || i == 21 || i == 22 || i == 23))
CFont::SetScale(MENU_X(0.32f), MENU_Y(LISTITEM_Y_SCALE));
else
CFont::SetScale(MENU_X(LISTITEM_X_SCALE), MENU_Y(LISTITEM_Y_SCALE));
CFont::PrintString(MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_1_X), MENU_Y(i * rowHeight + yStart), actionText);
}
DrawControllerBound(yStart, MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_2_X), rowHeight, CONTSETUP_PED_COLUMN);
DrawControllerBound(yStart, MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_3_X), rowHeight, CONTSETUP_VEHICLE_COLUMN);
if (!m_bWaitingForNewKeyBind) {
CFont::SetScale(MENU_X(BIGTEXT_X_SCALE), MENU_Y(BIGTEXT_Y_SCALE));
if ((m_nMousePosX > MENU_X_RIGHT_ALIGNED(CONTSETUP_BACK_RIGHT) - CFont::GetStringWidth(TheText.Get("FEDS_TB"), true)
&& m_nMousePosX < MENU_X_RIGHT_ALIGNED(CONTSETUP_BACK_RIGHT) && m_nMousePosY > SCREEN_SCALE_FROM_BOTTOM(CONTSETUP_BACK_BOTTOM)
&& m_nMousePosY < SCREEN_SCALE_FROM_BOTTOM(CONTSETUP_BACK_BOTTOM - CONTSETUP_BACK_HEIGHT)) || m_nCurrExLayer == HOVEROPTION_BACK) {
m_nHoverOption = HOVEROPTION_BACK;
} else if (m_nMousePosX > MENU_X_LEFT_ALIGNED(CONTSETUP_LIST_LEFT - 10.0f) && m_nMousePosX < MENU_X_LEFT_ALIGNED(CONTSETUP_COLUMN_3_X + CONTSETUP_BOUND_COLUMN_WIDTH)
&& m_nMousePosY > MENU_Y(CONTSETUP_LIST_TOP - 10.0f) && m_nMousePosY < SCREEN_SCALE_FROM_BOTTOM(CONTSETUP_LIST_BOTTOM)) {
m_nHoverOption = HOVEROPTION_LIST;
} else {
m_nHoverOption = HOVEROPTION_NOT_HOVERING;
}
}
// Back button and it's shadow
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetScale(MENU_X(BIGTEXT_X_SCALE), MENU_Y(BIGTEXT_Y_SCALE));
CFont::SetRightJustifyOn();
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(255)));
CFont::SetColor(CRGBA(MENUOPTION_COLOR.r, MENUOPTION_COLOR.g, MENUOPTION_COLOR.b, FadeIn(255)));
CFont::PrintString(MENU_X_RIGHT_ALIGNED(CONTSETUP_BACK_RIGHT - 2.0f), SCREEN_SCALE_FROM_BOTTOM(CONTSETUP_BACK_BOTTOM - 4.0f), TheText.Get("FEDS_TB"));
}
void
CMenuManager::DrawFrontEnd()
{
CFont::SetAlphaFade(255.0f);
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
SetFrontEndRenderStates();
m_NoEmptyBinding = true;
if (m_nCurrScreen == MENUPAGE_NONE) {
if (m_bGameNotLoaded) {
m_nCurrScreen = MENUPAGE_START_MENU;
} else {
m_nCurrScreen = MENUPAGE_PAUSE_MENU;
}
SETUP_SCROLLING(m_nCurrScreen)
}
if (m_nCurrOption == 0 && aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL)
m_nCurrOption = 1;
if (m_firstStartCounter == 255 && m_nMenuFadeAlpha == 255)
bMenuChangeOngoing = false;
DrawBackground(false);
}
void
CMenuManager::DrawBackground(bool transitionCall)
{
if (!m_bSpritesLoaded)
return;
SetFrontEndRenderStates();
if (m_firstStartCounter < 255) {
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(0, 0, 0, 255));
}
if (m_nMenuFadeAlpha != 0) {
if (m_nMenuFadeAlpha < 255) {
menuBg.Translate(m_nMenuFadeAlpha);
SetFrontEndRenderStates();
m_aFrontEndSprites[MENUSPRITE_BACKGROUND].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, FadeIn(255)));
if (m_nCurrScreen == MENUPAGE_MAP)
PrintMap();
// Left border
/*CSprite2d::Draw2DPolygon(SCREEN_STRETCH_X(menuBg.bottomLeft_x), SCREEN_STRETCH_Y(menuBg.bottomLeft_y), 0.0f, SCREEN_HEIGHT,
SCREEN_STRETCH_X(menuBg.topLeft_x), SCREEN_STRETCH_Y(menuBg.topLeft_y), 0.0f, 0.0f, CRGBA(0, 0, 0, 255));
// Top border
CSprite2d::Draw2DPolygon(SCREEN_STRETCH_X(menuBg.topRight_x), SCREEN_STRETCH_Y(menuBg.topRight_y),
SCREEN_STRETCH_X(menuBg.topLeft_x), SCREEN_STRETCH_Y(menuBg.topLeft_y), SCREEN_WIDTH, 0.0f, 0.0f, 0.0f, CRGBA(0, 0, 0, 255));
// Bottom border
CSprite2d::Draw2DPolygon(SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, SCREEN_HEIGHT, SCREEN_STRETCH_X(menuBg.bottomRight_x), SCREEN_STRETCH_Y(menuBg.bottomRight_y),
SCREEN_STRETCH_X(menuBg.bottomLeft_x), SCREEN_STRETCH_Y(menuBg.bottomLeft_y), CRGBA(0, 0, 0, 255));
// Right border
CSprite2d::Draw2DPolygon(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_STRETCH_X(menuBg.bottomRight_x), SCREEN_STRETCH_Y(menuBg.bottomRight_y),
SCREEN_WIDTH, 0.0f, SCREEN_STRETCH_X(menuBg.topRight_x), SCREEN_STRETCH_Y(menuBg.topRight_y), CRGBA(0, 0, 0, 255));*/
} else {
m_nMenuFadeAlpha = 255;
m_firstStartCounter = 255;
m_aFrontEndSprites[MENUSPRITE_BACKGROUND].Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, FadeIn(255)));
if (m_nCurrScreen == MENUPAGE_MAP)
PrintMap();
// Left border
/*CSprite2d::Draw2DPolygon(SCREEN_STRETCH_X(menuBg.bottomLeft_x), SCREEN_STRETCH_Y(menuBg.bottomLeft_y), 0.0f, SCREEN_HEIGHT,
SCREEN_STRETCH_X(menuBg.topLeft_x), SCREEN_STRETCH_Y(menuBg.topLeft_y), 0.0f, 0.0f, CRGBA(0, 0, 0, 255));
// Top border
CSprite2d::Draw2DPolygon(SCREEN_STRETCH_X(menuBg.topRight_x), SCREEN_STRETCH_Y(menuBg.topRight_y),
SCREEN_STRETCH_X(menuBg.topLeft_x), SCREEN_STRETCH_Y(menuBg.topLeft_y), SCREEN_WIDTH, 0.0f, 0.0f, 0.0f, CRGBA(0, 0, 0, 255));
// Bottom border
CSprite2d::Draw2DPolygon(SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, SCREEN_HEIGHT, SCREEN_STRETCH_X(menuBg.bottomRight_x), SCREEN_STRETCH_Y(menuBg.bottomRight_y),
SCREEN_STRETCH_X(menuBg.bottomLeft_x), SCREEN_STRETCH_Y(menuBg.bottomLeft_y), CRGBA(0, 0, 0, 255));
// Right border
CSprite2d::Draw2DPolygon(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_STRETCH_X(menuBg.bottomRight_x), SCREEN_STRETCH_Y(menuBg.bottomRight_y),
SCREEN_WIDTH, 0.0f, SCREEN_STRETCH_X(menuBg.topRight_x), SCREEN_STRETCH_Y(menuBg.topRight_y), CRGBA(0, 0, 0, 255));*/
}
} else {
menuBg.SaveCurrentCoors();
switch (m_nCurrScreen) {
case MENUPAGE_STATS:
menuBg.topLeft_x = 70.0f;
menuBg.topLeft_y = 75.0f;
menuBg.topRight_x = 550.0f;
menuBg.topRight_y = 16.0f;
menuBg.bottomLeft_x = 74.0f;
menuBg.bottomLeft_y = 354.0f;
menuBg.bottomRight_x = 581.0f;
menuBg.bottomRight_y = 340.0f;
break;
case MENUPAGE_SOUND_SETTINGS:
menuBg.topLeft_x = 26.0f;
menuBg.topLeft_y = 59.0f;
menuBg.topRight_x = 629.0f;
menuBg.topRight_y = 29.0f;
menuBg.bottomLeft_x = 15.0f;
menuBg.bottomLeft_y = 438.0f;
menuBg.bottomRight_x = 610.0f;
menuBg.bottomRight_y = 410.0f;
break;
case MENUPAGE_SKIN_SELECT:
case MENUPAGE_KEYBOARD_CONTROLS:
menuBg.topLeft_x = 14.0f;
menuBg.topLeft_y = 39.0f;
menuBg.topRight_x = 636.0f;
menuBg.topRight_y = 29.0f;
menuBg.bottomLeft_x = 15.0f;
menuBg.bottomLeft_y = 426.0f;
menuBg.bottomRight_x = 630.0f;
menuBg.bottomRight_y = 398.0f;
break;
case MENUPAGE_BRIEFS:
case MENUPAGE_DISPLAY_SETTINGS:
case MENUPAGE_MAP:
case MENUPAGE_CHOOSE_LOAD_SLOT:
case MENUPAGE_CHOOSE_DELETE_SLOT:
case MENUPAGE_CHOOSE_SAVE_SLOT:
case MENUPAGE_MOUSE_CONTROLS:
menuBg.topLeft_x = 26.0f;
menuBg.topLeft_y = 59.0f;
menuBg.topRight_x = 629.0f;
menuBg.topRight_y = 29.0f;
menuBg.bottomLeft_x = 15.0f;
menuBg.bottomLeft_y = 426.0f;
menuBg.bottomRight_x = 610.0f;
menuBg.bottomRight_y = 398.0f;
break;
default:
#ifdef CUSTOM_FRONTEND_OPTIONS
if (aScreens[m_nCurrScreen].layout && aScreens[m_nCurrScreen].layout->noInvasiveBorders) {
// Taken from the case above
menuBg.topLeft_x = 26.0f;
menuBg.topLeft_y = 59.0f;
menuBg.topRight_x = 629.0f;
menuBg.topRight_y = 29.0f;
menuBg.bottomLeft_x = 15.0f;
menuBg.bottomLeft_y = 426.0f;
menuBg.bottomRight_x = 610.0f;
menuBg.bottomRight_y = 398.0f;
break;
}
#endif
menuBg.topLeft_x = CGeneral::GetRandomNumber() % 40 + 65;
menuBg.topLeft_y = CGeneral::GetRandomNumber() % 40 + 21;
menuBg.topRight_x = CGeneral::GetRandomNumber() % 40 + 568;
menuBg.topRight_y = CGeneral::GetRandomNumber() % 40 + 44;
menuBg.bottomLeft_x = CGeneral::GetRandomNumber() % 40 + 36;
menuBg.bottomLeft_y = CGeneral::GetRandomNumber() % 40 + 382;
menuBg.bottomRight_x = CGeneral::GetRandomNumber() % 40 + 593;
menuBg.bottomRight_y = CGeneral::GetRandomNumber() % 40 + 342;
break;
}
menuBg.UpdateMultipliers();
if (m_firstStartCounter == 255)
m_nOptionHighlightTransitionBlend = 0;
}
static PauseModeTime LastFade = 0;
if (m_nMenuFadeAlpha < 255) {
static uint8 forceFadeInCounter = 0;
if (CTimer::GetTimeInMillisecondsPauseMode() - LastFade > 30
#ifndef FIX_HIGH_FPS_BUGS_ON_FRONTEND // Dirty dirty hack
|| forceFadeInCounter > 30
#endif
) {
m_nMenuFadeAlpha += 50;
if (m_firstStartCounter < 255) {
m_firstStartCounter = Min(m_firstStartCounter + 50, 255);
}
LastFade = CTimer::GetTimeInMillisecondsPauseMode();
}
forceFadeInCounter++;
} else if (m_nMenuFadeAlpha > 255)
m_nMenuFadeAlpha = 255;
if (!transitionCall && m_firstStartCounter == 255) {
int actualAlpha = m_nMenuFadeAlpha;
if (actualAlpha < 255) {
int actualScreen = m_nCurrScreen;
SetFrontEndRenderStates();
m_nCurrScreen = m_nPrevScreen;
m_nMenuFadeAlpha = 255 - m_nMenuFadeAlpha;
switch (m_nCurrScreen) {
case MENUPAGE_SKIN_SELECT:
DrawPlayerSetupScreen(false);
break;
case MENUPAGE_KEYBOARD_CONTROLS:
DrawControllerSetupScreen();
break;
case MENUPAGE_OUTRO:
DrawQuitGameScreen();
break;
default:
DrawStandardMenus(false);
break;
}
m_nCurrScreen = actualScreen;
m_nMenuFadeAlpha = actualAlpha;
}
}
switch (m_nCurrScreen) {
case MENUPAGE_SKIN_SELECT:
DrawPlayerSetupScreen(true);
break;
case MENUPAGE_KEYBOARD_CONTROLS:
DrawControllerSetupScreen();
break;
case MENUPAGE_OUTRO:
DrawQuitGameScreen();
break;
default:
DrawStandardMenus(true);
break;
}
CFont::DrawFonts();
SetFrontEndRenderStates();
//if (m_nCurrScreen != MENUPAGE_OUTRO)
// if (m_firstStartCounter == 255) {
// m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(SCREEN_STRETCH_X(27.0f), MENU_Y(8.0f), SCREEN_STRETCH_X(27.0f) + MENU_X(130.f), MENU_Y(138.0f)), CRGBA(255, 255, 255, 255));
// } else {
// m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(SCREEN_STRETCH_X(27.0f), MENU_Y(8.0f), SCREEN_STRETCH_X(27.0f) + MENU_X(130.f), MENU_Y(138.0f)), CRGBA(255, 255, 255, FadeIn(255)));
// }
if (m_ShowEmptyBindingError) {
static PauseModeTime lastBindingError = CTimer::GetTimeInMillisecondsPauseMode();
static bool bindingErrorShown = false;
if (bindingErrorShown) {
lastBindingError = CTimer::GetTimeInMillisecondsPauseMode();
bindingErrorShown = false;
}
SmallMessageScreen("FEC_ERI");
CFont::DrawFonts();
if (CTimer::GetTimeInMillisecondsPauseMode() - lastBindingError > 4000) {
m_ShowEmptyBindingError = false;
bindingErrorShown = true;
}
}
if (m_bShowMouse) {
CRect mouse(0.0f, 0.0f, MENU_X(35.0f), MENU_Y(35.0f));
CRect shad(MENU_X(10.0f), MENU_Y(3.0f), MENU_X(45.0f), MENU_Y(38.0f));
mouse.Translate(m_nMousePosX, m_nMousePosY);
shad.Translate(m_nMousePosX, m_nMousePosY);
m_aFrontEndSprites[MENUSPRITE_MOUSE].Draw(shad, CRGBA(100, 100, 100, 50));
m_aFrontEndSprites[MENUSPRITE_MOUSE].Draw(mouse, CRGBA(255, 255, 255, 255));
}
}
void
CMenuManager::DrawPlayerSetupScreen(bool activeScreen)
{
RESET_FONT_FOR_NEW_PAGE
// lstrcpy's changed with strcpy
if (!m_bSkinsEnumerated) {
OutputDebugString("Enumerating skin filenames from skins...");
m_pSkinListHead.nextSkin = nil;
m_pSelectedSkin = &m_pSkinListHead;
m_pSelectedSkin->nextSkin = new tSkinInfo;
m_pSelectedSkin = m_pSelectedSkin->nextSkin;
m_pSelectedSkin->skinId = 0;
strcpy(m_pSelectedSkin->skinNameOriginal, DEFAULT_SKIN_NAME);
strcpy(m_pSelectedSkin->skinNameDisplayed, UnicodeToAscii(TheText.Get("FET_DSN")));
int nextSkinId = 1;
m_pSelectedSkin->nextSkin = nil;
WIN32_FIND_DATA FindFileData;
SYSTEMTIME SystemTime;
HANDLE handle = FindFirstFile("skins\\*.bmp", &FindFileData);
for (int i = 1; handle != INVALID_HANDLE_VALUE && i; i = FindNextFile(handle, &FindFileData)) {
if (strcmp(FindFileData.cFileName, DEFAULT_SKIN_NAME) != 0) {
m_pSelectedSkin->nextSkin = new tSkinInfo;
m_pSelectedSkin = m_pSelectedSkin->nextSkin;
m_pSelectedSkin->skinId = nextSkinId;
strcpy(m_pSelectedSkin->skinNameOriginal, FindFileData.cFileName);
strcpy(m_pSelectedSkin->skinNameDisplayed, FindFileData.cFileName);
FileTimeToSystemTime(&FindFileData.ftLastWriteTime, &SystemTime);
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &SystemTime, 0, m_pSelectedSkin->date, 255);
++nextSkinId;
m_pSelectedSkin->nextSkin = nil;
}
}
FindClose(handle);
m_nSkinsTotal = nextSkinId;
char nameTemp[256];
for (m_pSelectedSkin = m_pSkinListHead.nextSkin; m_pSelectedSkin; m_pSelectedSkin = m_pSelectedSkin->nextSkin) {
// Drop extension
int oldLength = (int)strlen(m_pSelectedSkin->skinNameDisplayed);
m_pS