diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index cd08753d..036c947c 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -950,6 +950,10 @@ CCarCtrl::RemoveCarsIfThePoolGetsFull(void) void CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle) { +#ifdef FIX_BUGS + if (pVehicle->bIsLocked) + return; +#endif CVector vecPlayerPos = FindPlayerCentreOfWorld(CWorld::PlayerInFocus); /* BUG: this variable is initialized only in if-block below but can be used outside of it. */ if (!IsThisVehicleInteresting(pVehicle) && !pVehicle->bIsLocked && diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index e7b5ebe6..9aba431c 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -1324,7 +1324,7 @@ void CGarage::RemoveCarsBlockingDoorNotInside() if (!IsEntityTouching3D(pVehicle)) continue; if (!IsPointInsideGarage(pVehicle->GetPosition())) { - if (pVehicle->bIsLocked && pVehicle->CanBeDeleted()) { + if (!pVehicle->bIsLocked && pVehicle->CanBeDeleted()) { CWorld::Remove(pVehicle); delete pVehicle; return; // WHY? @@ -1817,8 +1817,9 @@ CVehicle* CStoredCar::RestoreCar() pVehicle->m_nRadioStation = m_nRadioStation; pVehicle->bFreebies = false; #ifdef FIX_BUGS - ((CAutomobile*)pVehicle)->m_bombType = m_nCarBombType; + if (pVehicle->IsCar()) #endif + ((CAutomobile*)pVehicle)->m_bombType = m_nCarBombType; pVehicle->bHasBeenOwnedByPlayer = true; pVehicle->m_nDoorLock = CARLOCK_UNLOCKED; pVehicle->bBulletProof = m_bBulletproof; diff --git a/src/control/Script.cpp b/src/control/Script.cpp index e3ee5503..82379f7e 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -10228,11 +10228,11 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) return 0; CVehicle* car; if (CModelInfo::IsBikeModel(model)) { - car = new CBike(model, MISSION_VEHICLE); + car = new CBike(model, RANDOM_VEHICLE); ((CBike*)(car))->bIsStanding = true; } else - car = new CAutomobile(model, MISSION_VEHICLE); + car = new CAutomobile(model, RANDOM_VEHICLE); CVector pos = *(CVector*)&ScriptParams[0]; pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel(); car->SetPosition(pos); @@ -10590,15 +10590,21 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CollectParameters(&m_nIp, 1); CTimer::Stop(); CGame::currLevel = (eLevelName)ScriptParams[0]; -#ifndef NO_ISLAND_LOADING - CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); - CStreaming::RemoveUnusedBuildings(CGame::currLevel); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + { + CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); + CStreaming::RemoveUnusedBuildings(CGame::currLevel); + } CCollision::SortOutCollisionAfterLoad(); -#ifndef NO_ISLAND_LOADING - CStreaming::RequestIslands(CGame::currLevel); - CStreaming::LoadAllRequestedModels(true); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_HIGH) #endif + { + CStreaming::RequestIslands(CGame::currLevel); + CStreaming::LoadAllRequestedModels(true); + } CTimer::Update(); return 0; } @@ -10924,7 +10930,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) #ifdef USE_MEASUREMENTS_IN_METERS UpdateCompareFlag(true); #else - UpdateCompareFlag(false) + UpdateCompareFlag(false); #endif return 0; case COMMAND_CONVERT_METRES_TO_FEET: @@ -11277,24 +11283,40 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command) CTimer::Stop(); CGame::currLevel = (eLevelName)ScriptParams[0]; if (CGame::currLevel != CCollision::ms_collisionInMemory) { -#ifndef NO_ISLAND_LOADING - DMAudio.SetEffectsFadeVol(0); - CPad::StopPadsShaking(); - CCollision::LoadCollisionScreen(CGame::currLevel); - DMAudio.Service(); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + { + DMAudio.SetEffectsFadeVol(0); + CPad::StopPadsShaking(); + CCollision::LoadCollisionScreen(CGame::currLevel); + DMAudio.Service(); + } CPopulation::DealWithZoneChange(CCollision::ms_collisionInMemory, CGame::currLevel, false); -#ifndef NO_ISLAND_LOADING - CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); - CStreaming::RemoveUnusedBuildings(CGame::currLevel); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) #endif + { + CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); + CStreaming::RemoveUnusedBuildings(CGame::currLevel); + } CCollision::SortOutCollisionAfterLoad(); -#ifndef NO_ISLAND_LOADING - CStreaming::RequestIslands(CGame::currLevel); - CStreaming::RequestBigBuildings(CGame::currLevel); - CStreaming::LoadAllRequestedModels(true); - DMAudio.SetEffectsFadeVol(127); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_HIGH) #endif + CStreaming::RequestIslands(CGame::currLevel); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) +#endif + CStreaming::RequestBigBuildings(CGame::currLevel); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_HIGH) +#endif + CStreaming::LoadAllRequestedModels(true); +#ifdef NO_ISLAND_LOADING + if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_LOW) +#endif + DMAudio.SetEffectsFadeVol(127); } CTimer::Update(); return 0; diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 0be9daf0..b76acf40 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -290,7 +290,7 @@ CMenuManager::ThingsToDoBeforeLeavingPage() DMAudio.StopFrontEndTrack(); OutputDebugString("FRONTEND AUDIO TRACK STOPPED"); #endif - } else if (m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS) { + } else if (m_nCurrScreen == MENUPAGE_DISPLAY_SETTINGS) { m_nDisplayVideoMode = m_nPrefsVideoMode; #ifdef IMPROVED_VIDEOMODE m_nSelectedScreenMode = m_nPrefsWindowed; @@ -300,48 +300,13 @@ CMenuManager::ThingsToDoBeforeLeavingPage() if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) { CPlayerSkin::EndFrontendSkinEdit(); } - -#ifdef CUSTOM_FRONTEND_OPTIONS - for (int i = 0; i < numCustomFrontendOptions; i++) { - FrontendOption& option = customFrontendOptions[i]; - if (option.type != FEOPTION_REDIRECT && option.type != FEOPTION_GOBACK && m_nCurrScreen == option.screen) { - if (option.returnPrevPageFunc) - option.returnPrevPageFunc(); - - if (m_nCurrOption == option.screenOptionOrder && option.type == FEOPTION_DYNAMIC) - option.buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS); - - if (option.onlyApplyOnEnter) - option.displayedValue = *option.value; - } - } -#endif } int8 CMenuManager::GetPreviousPageOption() { -#ifndef CUSTOM_FRONTEND_OPTIONS 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)))); -#else - int8 prevPage = 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_TargetMenu == m_nCurrScreen) { - return i; - } - } - - // Couldn't find current screen option on previous page, use default behaviour (maybe save-related screen?) - 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 @@ -1139,7 +1104,7 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen) } break; #ifdef IMPROVED_VIDEOMODE - case MENUACTION_SCREENMODE: + case MENUACTION_SCREENFORMAT: if (m_nSelectedScreenMode == 0) sprintf(asciiTemp, "FULLSCREEN"); else @@ -1210,32 +1175,6 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen) rightText = TheText.Get("FEA_NM3"); } break; -#ifdef CUSTOM_FRONTEND_OPTIONS - case MENUACTION_TRIGGERFUNC: - FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu]; - if (m_nCurrScreen == option.screen && i == option.screenOptionOrder) { - leftText = (wchar*)option.leftText; - if (option.type == FEOPTION_SELECT) { - if (option.displayedValue >= option.numRightTexts || option.displayedValue < 0) - option.displayedValue = 0; - - rightText = (wchar*)option.rightTexts[option.displayedValue]; - - } else if (option.type == FEOPTION_DYNAMIC) { - if (option.drawFunc) { - bool isOptionDisabled = false; - rightText = option.drawFunc(&isOptionDisabled); - if (isOptionDisabled) - CFont::SetColor(CRGBA(DARKMENUOPTION_COLOR.r, DARKMENUOPTION_COLOR.g, DARKMENUOPTION_COLOR.b, FadeIn(255))); - } - } - } else { - debug("A- screen:%d option:%d - totalCo: %d, coId: %d, coScreen:%d, coOption:%d\n", m_nCurrScreen, i, numCustomFrontendOptions, aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu, option.screen, option.screenOptionOrder); - assert(0 && "Custom frontend options is borked"); - } - - break; -#endif } // Highlight trapezoid @@ -1377,7 +1316,7 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen) } if (m_nDisplayVideoMode != m_nPrefsVideoMode) { if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FED_RES") != 0 - && m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS) { + && m_nCurrScreen == MENUPAGE_DISPLAY_SETTINGS) { m_nDisplayVideoMode = m_nPrefsVideoMode; SetHelperText(3); } @@ -1385,29 +1324,11 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen) #ifdef IMPROVED_VIDEOMODE if (m_nSelectedScreenMode != m_nPrefsWindowed) { if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FED_POS") != 0 - && m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS) { + && m_nCurrScreen == MENUPAGE_DISPLAY_SETTINGS) { m_nSelectedScreenMode = m_nPrefsWindowed; } } #endif -#ifdef CUSTOM_FRONTEND_OPTIONS - static int lastOption = m_nCurrOption; - - if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action == MENUACTION_TRIGGERFUNC) { - FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu]; - if (option.onlyApplyOnEnter && m_nCurrOption != i) - option.displayedValue = *option.value; - - if (m_nCurrOption != lastOption && lastOption == i) { - FrontendOption& oldOption = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[lastOption].m_TargetMenu]; - if (oldOption.type == FEOPTION_DYNAMIC) - oldOption.buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS); - } - } - - if (i == MAX_MENUROWS - 1 || aScreens[m_nCurrScreen].m_aEntries[i + 1].m_EntryName[0] == '\0') - lastOption = m_nCurrOption; -#endif // TODO(Miami): check // Sliders @@ -1464,7 +1385,7 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen) case MENUPAGE_STATS: case MENUPAGE_CONTROLLER_PC: case MENUPAGE_SOUND_SETTINGS: - case MENUPAGE_GRAPHICS_SETTINGS: + case MENUPAGE_DISPLAY_SETTINGS: case MENUPAGE_MOUSE_CONTROLS: DisplayHelperText(nil); break; @@ -2140,7 +2061,7 @@ CMenuManager::DrawFrontEnd() bbNames[0] = { "FEB_SAV",MENUPAGE_NEW_GAME }; bbNames[1] = { "FEB_CON",MENUPAGE_CONTROLLER_PC }; bbNames[2] = { "FEB_AUD",MENUPAGE_SOUND_SETTINGS }; - bbNames[3] = { "FEB_DIS",MENUPAGE_GRAPHICS_SETTINGS }; + bbNames[3] = { "FEB_DIS",MENUPAGE_DISPLAY_SETTINGS }; bbNames[4] = { "FEB_LAN",MENUPAGE_LANGUAGE_SETTINGS }; bbNames[5] = { "FESZ_QU",MENUPAGE_EXIT }; bbTabCount = 6; @@ -2152,7 +2073,7 @@ CMenuManager::DrawFrontEnd() bbNames[2] = { "FEB_BRI",MENUPAGE_BRIEFS }; bbNames[3] = { "FEB_CON",MENUPAGE_CONTROLLER_PC }; bbNames[4] = { "FEB_AUD",MENUPAGE_SOUND_SETTINGS }; - bbNames[5] = { "FEB_DIS",MENUPAGE_GRAPHICS_SETTINGS }; + bbNames[5] = { "FEB_DIS",MENUPAGE_DISPLAY_SETTINGS }; bbNames[6] = { "FEB_LAN",MENUPAGE_LANGUAGE_SETTINGS }; bbNames[7] = { "FESZ_QU",MENUPAGE_EXIT }; bbTabCount = 8; @@ -2225,7 +2146,7 @@ CMenuManager::DrawBackground() case MENUPAGE_DELETE_SLOT_CONFIRM: currentSprite = FE_ICONSAVE; break; - case MENUPAGE_GRAPHICS_SETTINGS: + case MENUPAGE_DISPLAY_SETTINGS: currentSprite = FE_ICONDISPLAY; break; case MENUPAGE_SOUND_SETTINGS: @@ -2471,7 +2392,7 @@ CMenuManager::DrawBackground(bool transitionCall) menuBg.bottomRight_y = 398.0f; break; case MENUPAGE_BRIEFS: - case MENUPAGE_GRAPHICS_SETTINGS: + case MENUPAGE_DISPLAY_SETTINGS: case MENUPAGE_MAP: case MENUPAGE_CHOOSE_LOAD_SLOT: case MENUPAGE_CHOOSE_DELETE_SLOT: @@ -3106,9 +3027,6 @@ CMenuManager::InitialiseChangedLanguageSettings() break; } -#ifdef CUSTOM_FRONTEND_OPTIONS - CustomFrontendOptionsPopulate(); -#endif } } @@ -4040,7 +3958,7 @@ CMenuManager::UserInput(void) } } if (changeValueBy != 0) { - if ((m_nCurrScreen == MENUPAGE_SOUND_SETTINGS || m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS || m_nCurrScreen == MENUPAGE_CONTROLLER_PC || m_nCurrScreen == MENUPAGE_MOUSE_CONTROLS) + if ((m_nCurrScreen == MENUPAGE_SOUND_SETTINGS || m_nCurrScreen == MENUPAGE_DISPLAY_SETTINGS || m_nCurrScreen == MENUPAGE_CONTROLLER_PC || m_nCurrScreen == MENUPAGE_MOUSE_CONTROLS) && aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_NOTHING && aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_LABEL && aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_YES @@ -4419,7 +4337,7 @@ CMenuManager::ProcessButtonPresses(uint8 goDown, uint8 goUp, uint8 optionSelecte } break; #ifdef IMPROVED_VIDEOMODE - case MENUACTION_SCREENMODE: + case MENUACTION_SCREENFORMAT: if (m_nSelectedScreenMode != m_nPrefsWindowed) { m_nPrefsWindowed = m_nSelectedScreenMode; _psSelectScreenVM(m_nPrefsVideoMode); // apply same resolution @@ -4471,7 +4389,7 @@ CMenuManager::ProcessButtonPresses(uint8 goDown, uint8 goUp, uint8 optionSelecte DMAudio.SetRadioInCar(m_PrefsRadioStation); DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); SaveSettings(); - } else if (m_nCurrScreen == MENUPAGE_GRAPHICS_SETTINGS) { + } else if (m_nCurrScreen == MENUPAGE_DISPLAY_SETTINGS) { m_PrefsBrightness = 256; m_PrefsLOD = 1.2f; #ifdef LEGACY_MENU_OPTIONS @@ -4541,33 +4459,6 @@ CMenuManager::ProcessButtonPresses(uint8 goDown, uint8 goUp, uint8 optionSelecte } break; } -#ifdef CUSTOM_FRONTEND_OPTIONS - case MENUACTION_TRIGGERFUNC: - FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu]; - if (m_nCurrScreen == option.screen && m_nCurrOption == option.screenOptionOrder) { - if (option.type == FEOPTION_SELECT) { - if (!option.onlyApplyOnEnter) { - option.displayedValue++; - if (option.displayedValue >= option.numRightTexts || option.displayedValue < 0) - option.displayedValue = 0; - } - option.changeFunc(option.displayedValue); - *option.value = option.displayedValue; - - } else if (option.type == FEOPTION_DYNAMIC) { - option.buttonPressFunc(FEOPTION_ACTION_SELECT); - } else if (option.type == FEOPTION_REDIRECT) { - ChangeScreen(option.to, option.option, true, option.fadeIn); - } else if (option.type == FEOPTION_GOBACK) { - goBack = true; - } - } else { - debug("B- screen:%d option:%d - totalCo: %d, coId: %d, coScreen:%d, coOption:%d\n", m_nCurrScreen, m_nCurrOption, numCustomFrontendOptions, aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, option.screen, option.screenOptionOrder); - assert(0 && "Custom frontend options are borked"); - } - - break; -#endif } } ProcessOnOffMenuOptions(); @@ -4699,7 +4590,7 @@ CMenuManager::ProcessButtonPresses(uint8 goDown, uint8 goUp, uint8 optionSelecte } break; #ifdef IMPROVED_VIDEOMODE - case MENUACTION_SCREENMODE: + case MENUACTION_SCREENFORMAT: DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); m_nSelectedScreenMode = !m_nSelectedScreenMode; break; @@ -4726,36 +4617,6 @@ CMenuManager::ProcessButtonPresses(uint8 goDown, uint8 goUp, uint8 optionSelecte DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); SaveSettings(); break; -#ifdef CUSTOM_FRONTEND_OPTIONS - case MENUACTION_TRIGGERFUNC: - FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu]; - if (m_nCurrScreen == option.screen && m_nCurrOption == option.screenOptionOrder) { - if (option.type == FEOPTION_SELECT) { - if (changeAmount > 0) { - option.displayedValue++; - if (option.displayedValue >= option.numRightTexts) - option.displayedValue = 0; - } else { - option.displayedValue--; - if (option.displayedValue < 0) - option.displayedValue = option.numRightTexts - 1; - } - if (!option.onlyApplyOnEnter) { - option.changeFunc(option.displayedValue); - *option.value = option.displayedValue; - } - } else if (option.type == FEOPTION_DYNAMIC) { - option.buttonPressFunc(changeAmount > 0 ? FEOPTION_ACTION_RIGHT : FEOPTION_ACTION_LEFT); - } - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); - } - else { - debug("C- screen:%d option:%d - totalCo: %d, coId: %d, coScreen:%d, coOption:%d\n", m_nCurrScreen, m_nCurrOption, numCustomFrontendOptions, aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, option.screen, option.screenOptionOrder); - assert(0 && "Custom frontend options are borked"); - } - - break; -#endif } CheckSliderMovement(changeAmount); ProcessOnOffMenuOptions(); diff --git a/src/core/Frontend.h b/src/core/Frontend.h index e64eae98..8b6fee87 100644 --- a/src/core/Frontend.h +++ b/src/core/Frontend.h @@ -160,7 +160,7 @@ enum eMenuScreen MENUPAGE_NEW_GAME = 1, MENUPAGE_BRIEFS = 2, MENUPAGE_SOUND_SETTINGS = 3, - MENUPAGE_GRAPHICS_SETTINGS = 4, + MENUPAGE_DISPLAY_SETTINGS = 4, MENUPAGE_LANGUAGE_SETTINGS = 5, MENUPAGE_MAP = 6, MENUPAGE_NEW_GAME_RELOAD = 7, @@ -199,6 +199,9 @@ enum eMenuScreen MENUPAGE_CONTROLLER_PC_OLD3, MENUPAGE_CONTROLLER_PC_OLD4, MENUPAGE_CONTROLLER_DEBUG, +#endif +#ifdef GRAPHICS_MENU_OPTIONS + MENUPAGE_GRAPHICS_SETTINGS, #endif MENUPAGES }; @@ -266,12 +269,28 @@ enum eMenuAction MENUACTION_MOUSESTEER, MENUACTION_UNK110, #ifdef IMPROVED_VIDEOMODE - MENUACTION_SCREENMODE, + MENUACTION_SCREENFORMAT, #endif #ifdef LEGACY_MENU_OPTIONS MENUACTION_CTRLVIBRATION, MENUACTION_CTRLCONFIG, #endif +#ifdef ANISOTROPIC_FILTERING + MENUACTION_MIPMAPS, + MENUACTION_TEXTURE_FILTERING, +#endif +#ifdef MULTISAMPLING + MENUACTION_MULTISAMPLING, +#endif +#ifdef NO_ISLAND_LOADING + MENUACTION_ISLANDLOADING, +#endif +#ifdef PS2_ALPHA_TEST + MENUACTION_PS2_ALPHA_TEST, +#endif +#ifdef CUTSCENE_BORDERS_SWITCH + MENUACTION_CUTSCENEBORDERS, +#endif }; enum eCheckHover @@ -576,6 +595,10 @@ public: int32 m_nPrefsSubsystem; int32 m_nSelectedScreenMode; #endif +#ifdef MULTISAMPLING + static int8 m_nPrefsMSAALevel; + static int8 m_nDisplayMSAALevel; +#endif enum LANGUAGE { @@ -603,7 +626,19 @@ public: CMenuManager(void); ~CMenuManager(void) { UnloadTextures(); } - + +#ifdef NO_ISLAND_LOADING + enum + { + ISLAND_LOADING_LOW = 0, + ISLAND_LOADING_MEDIUM, + ISLAND_LOADING_HIGH + }; + + static int8 m_DisplayIslandLoading; + static int8 m_PrefsIslandLoading; +#endif + void Initialise(); void PrintMap(); void SetFrontEndRenderStates(); diff --git a/src/core/Game.cpp b/src/core/Game.cpp index ce2194a0..172a77b5 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -293,10 +293,6 @@ bool CGame::InitialiseOnceAfterRW(void) DMAudio.SetEffectsFadeVol(127); DMAudio.SetMusicFadeVol(127); CWorld::Players[0].SetPlayerSkin(FrontEndMenuManager.m_PrefsSkinFile); - -#ifdef CUSTOM_FRONTEND_OPTIONS - CustomFrontendOptionsPopulate(); -#endif return true; } diff --git a/src/core/MenuScreens.cpp b/src/core/MenuScreens.cpp index 6fbf597b..65c265ed 100644 --- a/src/core/MenuScreens.cpp +++ b/src/core/MenuScreens.cpp @@ -2,7 +2,43 @@ #include "Frontend.h" #ifdef PC_MENU -// If you want to add new options, please don't do that here and see CustomFrontendOptionsPopulate in re3.cpp. +#ifdef CUTSCENE_BORDERS_SWITCH +#define MENU_CUTSCENE_BORDERS_SWITCH(screen) MENUACTION_CUTSCENEBORDERS, "FEM_CSB", SAVESLOT_NONE, screen, +#else +#define MENU_CUTSCENE_BORDERS_SWITCH(screen) +#endif + +#ifdef IMPROVED_VIDEOMODE +#define MENU_IMPROVED_VIDEOMODE(screen) MENUACTION_SCREENFORMAT, "FEM_SCF", SAVESLOT_NONE, screen, +#else +#define MENU_IMPROVED_VIDEOMODE(screen) +#endif + +#ifdef ANISOTROPIC_FILTERING +#define MENU_MIPMAPS(screen) MENUACTION_MIPMAPS, "FED_MIP", SAVESLOT_NONE, screen, +#define MENU_TEXTURE_FILTERING(screen) MENUACTION_TEXTURE_FILTERING, "FED_FIL", SAVESLOT_NONE, screen, +#else +#define MENU_MIPMAPS(screen) +#define MENU_TEXTURE_FILTERING(screen) +#endif + +#ifdef MULTISAMPLING +#define MENU_MULTISAMPLING(screen) MENUACTION_MULTISAMPLING, "FED_AAS", SAVESLOT_NONE, screen, +#else +#define MENU_MULTISAMPLING(screen) +#endif + +#ifdef NO_ISLAND_LOADING +#define MENU_ISLAND_LOADING(screen) MENUACTION_ISLANDLOADING, "FEM_ISL", SAVESLOT_NONE, screen, +#else +#define MENU_ISLAND_LOADING(screen) +#endif + +#ifdef PS2_ALPHA_TEST +#define MENU_PS2_ALPHA_TEST(screen) MENUACTION_PS2_ALPHA_TEST, "FEM_2PR", SAVESLOT_NONE, screen, +#else +#define MENU_PS2_ALPHA_TEST(screen) +#endif CMenuScreen aScreens[] = { // MENUPAGE_STATS = 0 @@ -44,24 +80,24 @@ CMenuScreen aScreens[] = { #endif { "FEH_DIS", MENUPAGE_OPTIONS, 2, - MENUACTION_BRIGHTNESS, "FED_BRI", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 78, MENUALIGN_LEFT, - MENUACTION_DRAWDIST, "FEM_LOD", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 103, MENUALIGN_LEFT, + MENUACTION_BRIGHTNESS, "FED_BRI", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 78, MENUALIGN_LEFT, + MENUACTION_DRAWDIST, "FEM_LOD", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 103, MENUALIGN_LEFT, #ifdef LEGACY_MENU_OPTIONS - MENUACTION_FRAMESYNC, "FEM_VSC", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 128, MENUALIGN_LEFT, + MENUACTION_FRAMESYNC, "FEM_VSC", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 128, MENUALIGN_LEFT, #endif - MENUACTION_FRAMELIMIT, "FEM_FRM", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 128 + Y_OFFSET/2, MENUALIGN_LEFT, + MENUACTION_FRAMELIMIT, "FEM_FRM", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 128 + Y_OFFSET/2, MENUALIGN_LEFT, #ifdef LEGACY_MENU_OPTIONS - MENUACTION_TRAILS, "FED_TRA", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 178, MENUALIGN_LEFT, + MENUACTION_TRAILS, "FED_TRA", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 178, MENUALIGN_LEFT, #endif - MENUACTION_SUBTITLES, "FED_SUB", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 153 + Y_OFFSET, MENUALIGN_LEFT, - MENUACTION_WIDESCREEN, "FED_WIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 178 + Y_OFFSET, MENUALIGN_LEFT, - MENUACTION_LEGENDS, "MAP_LEG", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 202 + Y_OFFSET, MENUALIGN_LEFT, - MENUACTION_RADARMODE, "FED_RDR", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 228 + Y_OFFSET, MENUALIGN_LEFT, - MENUACTION_HUD, "FED_HUD", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 253 + Y_OFFSET, MENUALIGN_LEFT, - MENUACTION_SCREENRES, "FED_RES", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 278 + Y_OFFSET, MENUALIGN_LEFT, + MENUACTION_SUBTITLES, "FED_SUB", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 153 + Y_OFFSET, MENUALIGN_LEFT, + MENUACTION_WIDESCREEN, "FED_WIS", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 178 + Y_OFFSET, MENUALIGN_LEFT, + MENUACTION_LEGENDS, "MAP_LEG", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 202 + Y_OFFSET, MENUALIGN_LEFT, + MENUACTION_RADARMODE, "FED_RDR", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 228 + Y_OFFSET, MENUALIGN_LEFT, + MENUACTION_HUD, "FED_HUD", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 253 + Y_OFFSET, MENUALIGN_LEFT, + MENUACTION_SCREENRES, "FED_RES", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 278 + Y_OFFSET, MENUALIGN_LEFT, #ifdef IMPROVED_VIDEOMODE - MENUACTION_SCREENMODE, "FED_POS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 303 + Y_OFFSET, MENUALIGN_LEFT, - MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 320, 328 + Y_OFFSET, MENUALIGN_CENTER, + MENUACTION_SCREENFORMAT,"FED_POS", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 303 + Y_OFFSET, MENUALIGN_LEFT, + MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 320, 328 + Y_OFFSET, MENUALIGN_CENTER, MENUACTION_GOBACK, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, 320, 353 + Y_OFFSET, MENUALIGN_CENTER, #else MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 320, 303 + Y_OFFSET, MENUALIGN_CENTER, @@ -230,7 +266,7 @@ CMenuScreen aScreens[] = { { "FET_OPT", MENUPAGE_NONE, 5, MENUACTION_CHANGEMENU, "FEO_CON", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC, 320, 132, MENUALIGN_CENTER, MENUACTION_LOADRADIO, "FEO_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, 0, 0, MENUALIGN_CENTER, - MENUACTION_CHANGEMENU, "FEO_DIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 0, 0, MENUALIGN_CENTER, + MENUACTION_CHANGEMENU, "FEO_DIS", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 0, 0, MENUALIGN_CENTER, MENUACTION_CHANGEMENU, "FEO_LAN", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS, 0, 0, MENUALIGN_CENTER, MENUACTION_PLAYERSETUP, "FET_PS", SAVESLOT_NONE, MENUPAGE_SKIN_SELECT, 0, 0, MENUALIGN_CENTER, MENUACTION_GOBACK, "FEDS_TB", SAVESLOT_NONE, 0, 0, 0, MENUALIGN_CENTER, diff --git a/src/core/config.h b/src/core/config.h index eadbc307..6c6a28ec 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -224,8 +224,14 @@ enum Config { //#define DISABLE_LOADING_SCREEN // disable the loading screen which vastly improves the loading time //#define NO_ISLAND_LOADING // disable loadscreen between islands via loading all island data at once, consumes more memory and CPU //#define USE_TEXTURE_POOL -#define CUTSCENE_BORDERS_SWITCH +//#define CUTSCENE_BORDERS_SWITCH //#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur) +//#define MULTISAMPLING // adds MSAA option TODO + +#ifdef LIBRW +// these are not supported with librw yet +# undef MULTISAMPLING +#endif // Water & Particle #define PC_PARTICLE @@ -255,12 +261,13 @@ enum Config { #ifndef PC_MENU # define PS2_MENU //# define PS2_MENU_USEALLPAGEICONS -#else //# define PS2_LIKE_MENU // An effort to recreate PS2 menu, cycling through tabs, different bg etc. +#else # define MAP_ENHANCEMENTS // Adding waypoint etc. # define TRIANGLE_BACK_BUTTON //# define CIRCLE_BACK_BUTTON //#define CUSTOM_FRONTEND_OPTIONS +# define GRAPHICS_MENU_OPTIONS #define LEGACY_MENU_OPTIONS #define MUCH_SHORTER_OUTRO_SCREEN diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 51995cf5..155dbcf4 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -74,110 +74,6 @@ mysrand(unsigned int seed) myrand_seed = seed; } -#ifdef CUSTOM_FRONTEND_OPTIONS -#include "frontendoption.h" -#include "platform.h" - -void ReloadFrontendOptions(void) -{ - CustomFrontendOptionsPopulate(); -} - -#ifdef MORE_LANGUAGES -void LangPolSelect(int8 action) -{ - if (action == FEOPTION_ACTION_SELECT) { - FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_POLISH; - FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true; - FrontEndMenuManager.InitialiseChangedLanguageSettings(); - FrontEndMenuManager.SaveSettings(); - } -} - -void LangRusSelect(int8 action) -{ - if (action == FEOPTION_ACTION_SELECT) { - FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_RUSSIAN; - FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true; - FrontEndMenuManager.InitialiseChangedLanguageSettings(); - FrontEndMenuManager.SaveSettings(); - } -} - -void LangJapSelect(int8 action) -{ - if (action == FEOPTION_ACTION_SELECT) { - FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_JAPANESE; - FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true; - FrontEndMenuManager.InitialiseChangedLanguageSettings(); - FrontEndMenuManager.SaveSettings(); - } -} -#endif - -#ifdef IMPROVED_VIDEOMODE -void ScreenModeChange(int8 displayedValue) -{ - if (displayedValue != FrontEndMenuManager.m_nPrefsWindowed) { - FrontEndMenuManager.m_nPrefsWindowed = displayedValue; - _psSelectScreenVM(FrontEndMenuManager.m_nPrefsVideoMode); // apply same resolution - FrontEndMenuManager.SetHelperText(0); - FrontEndMenuManager.SaveSettings(); - } -} -#endif - -#ifdef FREE_CAM -void ToggleFreeCam(int8 action) -{ - if (action == FEOPTION_ACTION_SELECT) { - TheCamera.bFreeCam = !TheCamera.bFreeCam; - FrontEndMenuManager.SaveSettings(); - } -} -#endif - -#ifdef CUTSCENE_BORDERS_SWITCH -void BorderModeChange(int8 displayedValue) -{ - CMenuManager::m_PrefsCutsceneBorders = !!displayedValue; - FrontEndMenuManager.SaveSettings(); -} -#endif - -// Reloaded on language change, so you can use hardcoded wchar* and TheText.Get with peace of mind -void -CustomFrontendOptionsPopulate(void) -{ - RemoveCustomFrontendOptions(); // if exist - -#ifdef MORE_LANGUAGES - FrontendOptionSetPosition(MENUPAGE_LANGUAGE_SETTINGS); - FrontendOptionAddDynamic(TheText.Get("FEL_POL"), nil, LangPolSelect, nil); - FrontendOptionAddDynamic(TheText.Get("FEL_RUS"), nil, LangRusSelect, nil); - FrontendOptionAddDynamic(TheText.Get("FEL_JAP"), nil, LangJapSelect, nil); -#endif - -#ifdef IMPROVED_VIDEOMODE - static const wchar *screenModes[] = { (wchar*)L"FULLSCREEN", (wchar*)L"WINDOWED" }; - FrontendOptionSetPosition(MENUPAGE_GRAPHICS_SETTINGS, 8); - FrontendOptionAddSelect(TheText.Get("SCRFOR"), screenModes, 2, (int8*)&FrontEndMenuManager.m_nPrefsWindowed, true, ScreenModeChange, nil); -#endif - -#ifdef FREE_CAM - static const wchar *text = (wchar*)L"TOGGLE FREE CAM"; - FrontendOptionSetPosition(MENUPAGE_CONTROLLER_PC, 1); - FrontendOptionAddDynamic(text, nil, ToggleFreeCam, nil); -#endif - -#ifdef CUTSCENE_BORDERS_SWITCH - static const wchar *off_on[] = { TheText.Get("FEM_OFF"), TheText.Get("FEM_ON") }; - FrontendOptionSetPosition(MENUPAGE_GRAPHICS_SETTINGS, 9); - FrontendOptionAddSelect((const wchar *)L"CUTSCENE BORDERS", off_on, 2, (int8 *)&CMenuManager::m_PrefsCutsceneBorders, false, BorderModeChange, nil); -#endif -} -#endif - #ifdef DEBUGMENU void WeaponCheat1(); void WeaponCheat2(); @@ -553,9 +449,6 @@ DebugMenuPopulate(void) DebugMenuAddVarBool8("Debug", "Script Heli On", &CHeli::ScriptHeliOn, nil); -#ifdef CUSTOM_FRONTEND_OPTIONS - DebugMenuAddCmd("Debug", "Reload custom frontend options", ReloadFrontendOptions); -#endif DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start); DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop); diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index c675b7e5..165436b5 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -14611,7 +14611,7 @@ CPed::ProcessObjective(void) if (m_pMyVehicle) { m_pMyVehicle->AutoPilot.m_nCruiseSpeed = 0; } else { - float closestVehDist = 3600.0f; + float closestVehDist = SQR(60.0f); int16 lastVehicle; CEntity* vehicles[8]; CWorld::FindObjectsInRange(GetPosition(), 25.0f, true, &lastVehicle, 6, vehicles, false, true, false, false, false); @@ -14624,11 +14624,11 @@ CPed::ProcessObjective(void) CVector ourSpeed = GetSpeed(); */ CVector vehDistVec = nearVeh->GetPosition() - GetPosition(); - if (vehDistVec.Magnitude() < closestVehDist + if (vehDistVec.MagnitudeSqr() < closestVehDist && m_pedInObjective->m_pMyVehicle != nearVeh) { foundVeh = nearVeh; - closestVehDist = vehDistVec.Magnitude(); + closestVehDist = vehDistVec.MagnitudeSqr(); } } m_pMyVehicle = foundVeh; diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp index f7e0973f..18c1ce04 100644 --- a/src/peds/Population.cpp +++ b/src/peds/Population.cpp @@ -127,8 +127,7 @@ CPopulation::Initialise() void CPopulation::RemovePed(CPed *ent) { - // CPed dtor already does that - // CWorld::Remove((CEntity*)ent); + CWorld::Remove((CEntity*)ent); delete ent; } diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 0b2b48c9..cc106e39 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -1610,7 +1610,9 @@ psSelectDevice() PSGLOBAL(fullScreen) = FALSE; #endif } - +#ifdef MULTISAMPLING + RwD3D8EngineSetMultiSamplingLevels(1 << FrontEndMenuManager.m_nPrefsMSAALevel); +#endif return TRUE; } diff --git a/utils/gxt/gxt.exe b/utils/gxt/gxt.exe index 0a39c0b1..ff264dad 100644 Binary files a/utils/gxt/gxt.exe and b/utils/gxt/gxt.exe differ