diff options
Diffstat (limited to 'src')
39 files changed, 340 insertions, 457 deletions
diff --git a/src/audio/soundlist.h b/src/audio/soundlist.h index 2a5b83cf..bc9ac09a 100644 --- a/src/audio/soundlist.h +++ b/src/audio/soundlist.h @@ -146,9 +146,9 @@ enum eSound : uint16 SOUND_PED_LEAVE_VEHICLE, SOUND_PED_EVADE, SOUND_PED_FLEE_RUN, - SOUND_PED_CAR_COLLISION, - SOUND_PED_BOAT_COLLISION, - SOUND_PED_HORN_ACTIVE, + SOUND_PED_CRASH_VEHICLE, + SOUND_PED_CRASH_CAR, + SOUND_PED_ANNOYED_DRIVER, SOUND_PED_147, SOUND_PED_SOLICIT, SOUND_PED_149, diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index 0d85d54f..64049793 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -953,6 +953,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 3b0e2201..fb95e834 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -10229,11 +10229,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); @@ -10591,15 +10591,17 @@ 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); -#endif + ISLAND_LOADING_IS(LOW) + { + CStreaming::RemoveUnusedBigBuildings(CGame::currLevel); + CStreaming::RemoveUnusedBuildings(CGame::currLevel); + } CCollision::SortOutCollisionAfterLoad(); -#ifndef NO_ISLAND_LOADING - CStreaming::RequestIslands(CGame::currLevel); - CStreaming::LoadAllRequestedModels(true); -#endif + ISLAND_LOADING_ISNT(HIGH) + { + CStreaming::RequestIslands(CGame::currLevel); + CStreaming::LoadAllRequestedModels(true); + } CTimer::Update(); return 0; } @@ -10925,7 +10927,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: @@ -11278,24 +11280,33 @@ 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(); -#endif + ISLAND_LOADING_IS(LOW) + { + 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); -#endif + + ISLAND_LOADING_IS(LOW) + { + 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); -#endif + + ISLAND_LOADING_ISNT(HIGH) + CStreaming::RequestIslands(CGame::currLevel); + + ISLAND_LOADING_IS(LOW) + CStreaming::RequestBigBuildings(CGame::currLevel); + + ISLAND_LOADING_ISNT(HIGH) + CStreaming::LoadAllRequestedModels(true); + + ISLAND_LOADING_IS(LOW) + DMAudio.SetEffectsFadeVol(127); } CTimer::Update(); return 0; diff --git a/src/core/ColStore.cpp b/src/core/ColStore.cpp index 070967e5..bca1e9b7 100644 --- a/src/core/ColStore.cpp +++ b/src/core/ColStore.cpp @@ -223,7 +223,6 @@ CColStore::EnsureCollisionIsInMemory(const CVector2D &pos) } } -//--MIAMI: done bool CColStore::HasCollisionLoaded(const CVector2D &pos) { diff --git a/src/core/Collision.cpp b/src/core/Collision.cpp index c2037dc5..91e7bba7 100644 --- a/src/core/Collision.cpp +++ b/src/core/Collision.cpp @@ -3049,6 +3049,18 @@ CColModel::GetTrianglePoint(CVector &v, int i) const v = vertices[i].Get(); } +void* +CColModel::operator new(size_t){ + CColModel *node = CPools::GetColModelPool()->New(); + assert(node); + return node; +} + +void +CColModel::operator delete(void *p, size_t){ + CPools::GetColModelPool()->Delete((CColModel*)p); +} + CColModel& CColModel::operator=(const CColModel &other) { diff --git a/src/core/Collision.h b/src/core/Collision.h index fd079028..93959a72 100644 --- a/src/core/Collision.h +++ b/src/core/Collision.h @@ -181,7 +181,6 @@ struct CStoredCollPoly bool valid; }; -//--MIAMI: done struct struct CColModel { CSphere boundingSphere; @@ -208,6 +207,8 @@ struct CColModel void SetLinkPtr(CLink<CColModel*>*); void GetTrianglePoint(CVector &v, int i) const; + void *operator new(size_t); + void operator delete(void *p, size_t); CColModel& operator=(const CColModel& other); }; 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..858ad1f3 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, @@ -200,6 +200,9 @@ enum eMenuScreen 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,25 @@ 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; + + #define ISLAND_LOADING_IS(p) if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_##p) + #define ISLAND_LOADING_ISNT(p) if (CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_##p) +#else + #define ISLAND_LOADING_IS(p) + #define ISLAND_LOADING_ISNT(p) +#endif + void Initialise(); void PrintMap(); void SetFrontEndRenderStates(); diff --git a/src/core/Game.cpp b/src/core/Game.cpp index 50c4288c..7a2e56ed 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -294,10 +294,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/Pad.cpp b/src/core/Pad.cpp index eb2b1e31..42b26c63 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -11,7 +11,11 @@ #include "platform.h" #ifdef XINPUT #include <xinput.h> +#if !defined(PSAPI_VERSION) || (PSAPI_VERSION > 1) #pragma comment( lib, "Xinput9_1_0.lib" ) +#else +#pragma comment( lib, "Xinput.lib" ) +#endif #endif #include "Pad.h" diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp index 6e3799f4..fe2cf7ad 100644 --- a/src/core/Pools.cpp +++ b/src/core/Pools.cpp @@ -22,21 +22,25 @@ CTreadablePool *CPools::ms_pTreadablePool; CObjectPool *CPools::ms_pObjectPool; CDummyPool *CPools::ms_pDummyPool; CAudioScriptObjectPool *CPools::ms_pAudioScriptObjectPool; +CColModelPool *CPools::ms_pColModelPool; +//--MIAMI: done void CPools::Initialise(void) { - ms_pPtrNodePool = new CCPtrNodePool(NUMPTRNODES); - ms_pEntryInfoNodePool = new CEntryInfoNodePool(NUMENTRYINFOS); - ms_pPedPool = new CPedPool(NUMPEDS); - ms_pVehiclePool = new CVehiclePool(NUMVEHICLES); - ms_pBuildingPool = new CBuildingPool(NUMBUILDINGS); - ms_pTreadablePool = new CTreadablePool(NUMTREADABLES); - ms_pObjectPool = new CObjectPool(NUMOBJECTS); - ms_pDummyPool = new CDummyPool(NUMDUMMIES); - ms_pAudioScriptObjectPool = new CAudioScriptObjectPool(NUMAUDIOSCRIPTOBJECTS); + ms_pPtrNodePool = new CCPtrNodePool(NUMPTRNODES, "PtrNode"); + ms_pEntryInfoNodePool = new CEntryInfoNodePool(NUMENTRYINFOS, "EntryInfoNode"); + ms_pPedPool = new CPedPool(NUMPEDS, "Peds"); + ms_pVehiclePool = new CVehiclePool(NUMVEHICLES, "Vehicles"); + ms_pBuildingPool = new CBuildingPool(NUMBUILDINGS, "Buildings"); + ms_pTreadablePool = new CTreadablePool(NUMTREADABLES, "Treadables"); + ms_pObjectPool = new CObjectPool(NUMOBJECTS, "Objects"); + ms_pDummyPool = new CDummyPool(NUMDUMMIES, "Dummys"); + ms_pAudioScriptObjectPool = new CAudioScriptObjectPool(NUMAUDIOSCRIPTOBJECTS, "AudioScriptObj"); + ms_pColModelPool = new CColModelPool(NUMCOLMODELS, "ColModel"); } +//--MIAMI: done void CPools::ShutDown(void) { @@ -49,6 +53,7 @@ CPools::ShutDown(void) debug("Objects left %d\n", ms_pObjectPool->GetNoOfUsedSpaces()); debug("Dummys left %d\n", ms_pDummyPool->GetNoOfUsedSpaces()); debug("AudioScriptObjects left %d\n", ms_pAudioScriptObjectPool->GetNoOfUsedSpaces()); + debug("ColModels left %d\n", ms_pColModelPool->GetNoOfUsedSpaces()); printf("Shutdown pool started\n"); delete ms_pPtrNodePool; @@ -60,6 +65,7 @@ CPools::ShutDown(void) delete ms_pObjectPool; delete ms_pDummyPool; delete ms_pAudioScriptObjectPool; + delete ms_pColModelPool; printf("Shutdown pool done\n"); } diff --git a/src/core/Pools.h b/src/core/Pools.h index 2f0537ff..afef1b85 100644 --- a/src/core/Pools.h +++ b/src/core/Pools.h @@ -19,6 +19,7 @@ typedef CPool<CTreadable> CTreadablePool; typedef CPool<CObject, CCutsceneObject> CObjectPool; typedef CPool<CDummy, CDummyPed> CDummyPool; typedef CPool<cAudioScriptObject> CAudioScriptObjectPool; +typedef CPool<CColModel> CColModelPool; class CPools { @@ -31,6 +32,7 @@ class CPools static CObjectPool *ms_pObjectPool; static CDummyPool *ms_pDummyPool; static CAudioScriptObjectPool *ms_pAudioScriptObjectPool; + static CColModelPool *ms_pColModelPool; public: static CCPtrNodePool *GetPtrNodePool(void) { return ms_pPtrNodePool; } static CEntryInfoNodePool *GetEntryInfoNodePool(void) { return ms_pEntryInfoNodePool; } @@ -41,6 +43,7 @@ public: static CObjectPool *GetObjectPool(void) { return ms_pObjectPool; } static CDummyPool *GetDummyPool(void) { return ms_pDummyPool; } static CAudioScriptObjectPool *GetAudioScriptObjectPool(void) { return ms_pAudioScriptObjectPool; } + static CColModelPool *GetColModelPool(void) { return ms_pColModelPool; } static void Initialise(void); static void ShutDown(void); diff --git a/src/core/SurfaceTable.cpp b/src/core/SurfaceTable.cpp index 9076a9a6..56cea203 100644 --- a/src/core/SurfaceTable.cpp +++ b/src/core/SurfaceTable.cpp @@ -6,6 +6,8 @@ #include "Collision.h" #include "SurfaceTable.h" +//--MIAMI: file done + float CSurfaceTable::ms_aAdhesiveLimitTable[NUMADHESIVEGROUPS][NUMADHESIVEGROUPS]; void @@ -148,3 +150,9 @@ CSurfaceTable::GetAdhesiveLimit(CColPoint &colpoint) { return ms_aAdhesiveLimitTable[GetAdhesionGroup(colpoint.surfaceB)][GetAdhesionGroup(colpoint.surfaceA)]; } + +bool +CSurfaceTable::IsSoftLanding(uint8 surf) +{ + return surf == SURFACE_GRASS || surf == SURFACE_SAND || surf == SURFACE_SAND_BEACH; +} diff --git a/src/core/SurfaceTable.h b/src/core/SurfaceTable.h index 359ebd5c..cd08c843 100644 --- a/src/core/SurfaceTable.h +++ b/src/core/SurfaceTable.h @@ -96,4 +96,5 @@ public: static int GetAdhesionGroup(uint8 surfaceType); static float GetWetMultiplier(uint8 surfaceType); static float GetAdhesiveLimit(CColPoint &colpoint); + static bool IsSoftLanding(uint8 surf); }; diff --git a/src/core/config.h b/src/core/config.h index a061408a..1cd9ca6c 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -27,16 +27,16 @@ enum Config { // Pool sizes NUMPTRNODES = 50000, - NUMENTRYINFOS = 5400, // only 3200 in VC??? + NUMENTRYINFOS = 3200, NUMPEDS = 140, NUMVEHICLES = 110, NUMBUILDINGS = 7000, - NUMTREADABLES = 1214, // 1 in VC + NUMTREADABLES = 1, NUMOBJECTS = 460, - NUMDUMMIES = 2802, // 2340 in VC - NUMAUDIOSCRIPTOBJECTS = 256, // 192 in VC + NUMDUMMIES = 2340, + NUMAUDIOSCRIPTOBJECTS = 192, + NUMCOLMODELS = 4400, NUMCUTSCENEOBJECTS = 50, // does not exist in VC - // TODO(MIAMI): colmodel pool NUMANIMBLOCKS = 35, NUMANIMATIONS = 450, @@ -224,9 +224,15 @@ 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 EXTENDED_PIPELINES // custom render pipelines (includes Neo) +//#define MULTISAMPLING // adds MSAA option TODO + +#ifdef LIBRW +// these are not supported with librw yet +# undef MULTISAMPLING +#endif // Water & Particle #define PC_PARTICLE @@ -256,12 +262,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/main.cpp b/src/core/main.cpp index 27f6abd9..7a25daac 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -3,6 +3,9 @@ #include "rphanim.h" #include "rpskin.h" #include "rtbmp.h" +#ifndef LIBRW +#include "rpanisot.h" +#endif #include "main.h" #include "CdStream.h" @@ -384,6 +387,9 @@ PluginAttach(void) return FALSE; } +#ifndef LIBRW + RpAnisotPluginAttach(); +#endif #ifdef EXTENDED_PIPELINES CustomPipes::CustomPipeRegister(); #endif diff --git a/src/core/main.h b/src/core/main.h index 9ad4ed1c..96fbef05 100644 --- a/src/core/main.h +++ b/src/core/main.h @@ -20,6 +20,9 @@ extern bool gbShowTimebars; class CSprite2d; +bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha); +bool DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha); +void DoRWStuffEndOfFrame(void); void InitialiseGame(void); void LoadingScreen(const char *str1, const char *str2, const char *splashscreen); void LoadingIslandScreen(const char *levelName); diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 3b6b678a..6a305b4c 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -75,110 +75,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(); @@ -565,9 +461,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/core/templates.h b/src/core/templates.h index 465e3bef..9f5bd5ea 100644 --- a/src/core/templates.h +++ b/src/core/templates.h @@ -45,7 +45,7 @@ class CPool public: // TODO(MIAMI): remove ctor without name argument - CPool(int size){ + CPool(int size, const char *name){ // TODO: use new here m_entries = (U*)malloc(sizeof(U)*size); m_flags = (Flags*)malloc(sizeof(Flags)*size); @@ -56,8 +56,6 @@ public: m_flags[i].free = 1; } } - CPool(int size, const char *name) - : CPool(size) {} ~CPool() { Flush(); } diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp index b27284bc..cf1dd9e7 100644 --- a/src/entities/Entity.cpp +++ b/src/entities/Entity.cpp @@ -33,7 +33,7 @@ #include "WindModifiers.h" #include "Occlusion.h" -//--MIAMI: file almost done (see TODO) +//--MIAMI: file done int gBuildings; 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/PedChat.cpp b/src/peds/PedChat.cpp index 4480a8cd..73a8e59c 100644 --- a/src/peds/PedChat.cpp +++ b/src/peds/PedChat.cpp @@ -131,9 +131,9 @@ CPed::Say(uint16 audio) case SOUND_PED_FLEE_SPRINT: case SOUND_PED_TAXI_WAIT: case SOUND_PED_EVADE: - case SOUND_PED_CAR_COLLISION: - case SOUND_PED_BOAT_COLLISION: - case SOUND_PED_HORN_ACTIVE: + case SOUND_PED_CRASH_VEHICLE: + case SOUND_PED_CRASH_CAR: + case SOUND_PED_ANNOYED_DRIVER: break; default: return; 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/render/Shadows.cpp b/src/render/Shadows.cpp index 5bb6a734..a964ceb6 100644 --- a/src/render/Shadows.cpp +++ b/src/render/Shadows.cpp @@ -715,7 +715,7 @@ CShadows::StoreShadowForVehicle(CVehicle *pCar, VEH_SHD_TYPE type) } void -CShadows::StoreCarLightShadow(CAutomobile *pCar, int32 nID, RwTexture *pTexture, CVector *pPosn, +CShadows::StoreCarLightShadow(CVehicle *pCar, int32 nID, RwTexture *pTexture, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, uint8 nRed, uint8 nGreen, uint8 nBlue, float fMaxViewAngle) { diff --git a/src/render/Shadows.h b/src/render/Shadows.h index 94b2981f..937ff4eb 100644 --- a/src/render/Shadows.h +++ b/src/render/Shadows.h @@ -159,7 +159,7 @@ public: static void StoreShadowToBeRendered ( uint8 ShadowType, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity, uint8 nRed, uint8 nGreen, uint8 nBlue); static void StoreShadowToBeRendered ( uint8 ShadowType, RwTexture *pTexture, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity, uint8 nRed, uint8 nGreen, uint8 nBlue, float fZDistance, bool bDrawOnWater, float fScale, CCutsceneShadow *pShadow, bool bDrawOnBuildings); static void StoreShadowForVehicle (CVehicle *pCar, VEH_SHD_TYPE type); - static void StoreCarLightShadow (CAutomobile *pCar, int32 nID, RwTexture *pTexture, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, uint8 nRed, uint8 nGreen, uint8 nBlue, float fMaxViewAngle); + static void StoreCarLightShadow (CVehicle *pCar, int32 nID, RwTexture *pTexture, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, uint8 nRed, uint8 nGreen, uint8 nBlue, float fMaxViewAngle); static void StoreShadowForPed (CPed *pPed, float fDisplacementX, float fDisplacementY, float fFrontX, float fFrontY, float fSideX, float fSideY); static void StoreShadowForPedObject (CEntity *pPedObject, float fDisplacementX, float fDisplacementY, float fFrontX, float fFrontY, float fSideX, float fSideY); static void StoreShadowForCutscenePedObject(CCutsceneObject *pObject, float fDisplacementX, float fDisplacementY, float fFrontX, float fFrontY, float fSideX, float fSideY); diff --git a/src/rw/ClumpRead.cpp b/src/rw/ClumpRead.cpp index 5f50f52d..b8d72d23 100644 --- a/src/rw/ClumpRead.cpp +++ b/src/rw/ClumpRead.cpp @@ -1,5 +1,6 @@ #include "common.h" +//--MIAMI: done struct rpGeometryList { diff --git a/src/rw/Lights.cpp b/src/rw/Lights.cpp index c5038232..3657e2c7 100644 --- a/src/rw/Lights.cpp +++ b/src/rw/Lights.cpp @@ -10,6 +10,8 @@ #include "Frontend.h" #include "MBlur.h" +//--MIAMI: done + RpLight *pAmbient; RpLight *pDirect; RpLight *pExtraDirectionals[4] = { nil }; @@ -30,7 +32,6 @@ RwRGBAReal DirectionalLightColour; #define USEBLURCOLORS CMBlur::BlurOn #endif -//--MIAMI: done void SetLightsWithTimeOfDayColour(RpWorld *) { @@ -309,6 +310,14 @@ ActivateDirectional(void) RpLightSetFlags(pDirect, rpLIGHTLIGHTATOMICS); } +RwRGBAReal FullLight = { 1.0f, 1.0f, 1.0f, 1.0f }; + +void +SetFullAmbient(void) +{ + RpLightSetColor(pAmbient, &FullLight); +} + void SetAmbientColours(void) { diff --git a/src/rw/NodeName.cpp b/src/rw/NodeName.cpp index ad4acffb..a7185e4f 100644 --- a/src/rw/NodeName.cpp +++ b/src/rw/NodeName.cpp @@ -50,8 +50,8 @@ NodeNameStreamWrite(RwStream *stream, RwInt32 binaryLength, const void *object, RwInt32 NodeNameStreamGetSize(const void *object, RwInt32 offsetInObject, RwInt32 sizeInObject) { - // game checks for null pointer on node name extension but that really happen - return (RwInt32)rwstrlen(NODENAMEEXT(object)); + char *name = NODENAMEEXT(object); // can't be nil + return name ? (RwInt32)rwstrlen(name) : 0; } bool diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp index 58791ce2..9633e56c 100644 --- a/src/rw/RwHelper.cpp +++ b/src/rw/RwHelper.cpp @@ -209,24 +209,11 @@ GetFirstTexture(RwTexDictionary *txd) return tex; } -#ifdef PED_SKIN -static RpAtomic* -isSkinnedCb(RpAtomic *atomic, void *data) -{ - RpAtomic **pAtomic = (RpAtomic**)data; - if(*pAtomic) - return nil; // already found one - if(RpSkinGeometryGetSkin(RpAtomicGetGeometry(atomic))) - *pAtomic = atomic; // we could just return nil here directly... - return atomic; -} - -RpAtomic* +bool IsClumpSkinned(RpClump *clump) { - RpAtomic *atomic = nil; - RpClumpForAllAtomics(clump, isSkinnedCb, &atomic); - return atomic; + RpAtomic *atomic = GetFirstAtomic(clump); + return atomic ? RpSkinGeometryGetSkin(RpAtomicGetGeometry(atomic)) : nil; } static RpAtomic* @@ -264,17 +251,6 @@ GetAnimHierarchyFromClump(RpClump *clump) return hier; } -RwFrame* -GetHierarchyFromChildNodesCB(RwFrame *frame, void *data) -{ - RpHAnimHierarchy **pHier = (RpHAnimHierarchy**)data; - RpHAnimHierarchy *hier = RpHAnimFrameGetHierarchy(frame); - if(hier == nil) - RwFrameForAllChildren(frame, GetHierarchyFromChildNodesCB, &hier); - *pHier = hier; - return nil; -} - void SkinGetBonePositionsToTable(RpClump *clump, RwV3d *boneTable) { @@ -290,8 +266,7 @@ SkinGetBonePositionsToTable(RpClump *clump, RwV3d *boneTable) if(boneTable == nil) return; -// atomic = GetFirstAtomic(clump); // mobile, also VC - atomic = IsClumpSkinned(clump); // xbox, seems safer + atomic = GetFirstAtomic(clump); // mobile, also VC assert(atomic); skin = RpSkinGeometryGetSkin(RpAtomicGetGeometry(atomic)); assert(skin); @@ -397,7 +372,6 @@ RenderSkeleton(RpHAnimHierarchy *hier) par = stack[--sp]; } } -#endif RwBool Im2DRenderQuad(RwReal x1, RwReal y1, RwReal x2, RwReal y2, RwReal z, RwReal recipCamZ, RwReal uvOffset) @@ -560,6 +534,7 @@ CameraSize(RwCamera * camera, RwRect * rect, } } + // BUG: game just changes camera raster's sizes, but this is a hack if (( origSize.w != rect->w ) && ( origSize.h != rect->h )) { RwRaster *raster; @@ -844,4 +819,4 @@ RestoreAlphaTest() RwD3D8SetRenderState(D3DRS_ALPHAREF, saved_alpharef); #endif } -#endif
\ No newline at end of file +#endif diff --git a/src/rw/RwHelper.h b/src/rw/RwHelper.h index 3f1a3d19..cbcbb2e0 100644 --- a/src/rw/RwHelper.h +++ b/src/rw/RwHelper.h @@ -18,16 +18,13 @@ RwObject *GetFirstObject(RwFrame *frame); RpAtomic *GetFirstAtomic(RpClump *clump); RwTexture *GetFirstTexture(RwTexDictionary *txd); -#ifdef PED_SKIN -RpAtomic *IsClumpSkinned(RpClump *clump); +bool IsClumpSkinned(RpClump *clump); RpHAnimHierarchy *GetAnimHierarchyFromSkinClump(RpClump *clump); // get from atomic RpHAnimHierarchy *GetAnimHierarchyFromClump(RpClump *clump); // get from frame -RwFrame *GetHierarchyFromChildNodesCB(RwFrame *frame, void *data); void SkinGetBonePositionsToTable(RpClump *clump, RwV3d *boneTable); RpHAnimAnimation *HAnimAnimationCreateForHierarchy(RpHAnimHierarchy *hier); RpAtomic *AtomicRemoveAnimFromSkinCB(RpAtomic *atomic, void *data); void RenderSkeleton(RpHAnimHierarchy *hier); -#endif RwBool Im2DRenderQuad(RwReal x1, RwReal y1, RwReal x2, RwReal y2, RwReal z, RwReal recipCamZ, RwReal uvOffset); RpClump *RpClumpGetBoundingSphere(RpClump *clump, RwSphere *sphere, bool useLTM); @@ -38,6 +35,7 @@ RwTexDictionary *RwTexDictionaryGtaStreamRead2(RwStream *stream, RwTexDictionary void ReadVideoCardCapsFile(uint32&, uint32&, uint32&, uint32&); bool CheckVideoCardCaps(void); void WriteVideoCardCapsFile(void); +bool CanVideoCardDoDXT(void); void ConvertingTexturesScreen(uint32, uint32, const char*); void DealWithTxdWriteError(uint32, uint32, const char*); bool CreateTxdImageForVideoCard(); diff --git a/src/rw/TexRead.cpp b/src/rw/TexRead.cpp index 0c07b9f5..3199307b 100644 --- a/src/rw/TexRead.cpp +++ b/src/rw/TexRead.cpp @@ -1,7 +1,11 @@ #pragma warning( push ) #pragma warning( disable : 4005) #pragma warning( pop ) +#define WITHD3D #include "common.h" +#ifndef LIBRW +#include "rpanisot.h" +#endif #include "crossplatform.h" #include "platform.h" @@ -47,6 +51,15 @@ RwTextureGtaStreamRead(RwStream *stream) texLoadTime = (texNumLoaded * texLoadTime + (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond() - preloadTime) / (float)(texNumLoaded+1); texNumLoaded++; } + + if(tex == nil) + return nil; + +#ifndef LIBRW + if(RpAnisotTextureGetMaxAnisotropy(tex) > 1) + RpAnisotTextureSetMaxAnisotropy(tex, RpAnisotTextureGetMaxAnisotropy(tex)); +#endif + return tex; } @@ -152,6 +165,7 @@ RwTexDictionaryGtaStreamRead2(RwStream *stream, RwTexDictionary *texDict) #ifdef GTA_PC #ifdef RWLIBS extern "C" RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags); +extern "C" RwBool _rwD3D8CheckValidTextureFormat(RwInt32 format); #else RwInt32 _rwD3D8FindCorrectRasterFormat(RwRasterType type, RwInt32 flags); #endif @@ -202,8 +216,16 @@ WriteVideoCardCapsFile(void) } } -bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha); -void DoRWStuffEndOfFrame(void); +bool +CanVideoCardDoDXT(void) +{ +#ifdef LIBRW + // TODO + return true; +#else + return _rwD3D8CheckValidTextureFormat(D3DFMT_DXT1) && _rwD3D8CheckValidTextureFormat(D3DFMT_DXT3); +#endif +} void ConvertingTexturesScreen(uint32 num, uint32 count, const char *text) @@ -229,6 +251,7 @@ ConvertingTexturesScreen(uint32 num, uint32 count, const char *text) CFont::SetBackgroundOff(); CFont::SetPropOn(); CFont::SetScale(SCREEN_SCALE_X(0.45f), SCREEN_SCALE_Y(0.7f)); + CFont::SetCentreOff(); CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(170.0f)); CFont::SetJustifyOff(); CFont::SetColor(CRGBA(255, 217, 106, 255)); diff --git a/src/rw/TxdStore.cpp b/src/rw/TxdStore.cpp index 51d018f6..0bd29718 100644 --- a/src/rw/TxdStore.cpp +++ b/src/rw/TxdStore.cpp @@ -13,7 +13,7 @@ void CTxdStore::Initialise(void) { if(ms_pTxdPool == nil) - ms_pTxdPool = new CPool<TxdDef,TxdDef>(TXDSTORESIZE); + ms_pTxdPool = new CPool<TxdDef,TxdDef>(TXDSTORESIZE, "TexDictionary"); } void @@ -58,11 +58,10 @@ CTxdStore::RemoveTxdSlot(int slot) int CTxdStore::FindTxdSlot(const char *name) { - char *defname; int size = ms_pTxdPool->GetSize(); for(int i = 0; i < size; i++){ - defname = GetTxdName(i); - if(defname && !CGeneral::faststricmp(defname, name)) + TxdDef *def = GetSlot(i); + if(def && !CGeneral::faststricmp(def->name, name)) return i; } return -1; @@ -71,8 +70,7 @@ CTxdStore::FindTxdSlot(const char *name) char* CTxdStore::GetTxdName(int slot) { - TxdDef *def = GetSlot(slot); - return def ? def->name : nil; + return GetSlot(slot)->name; } void @@ -91,9 +89,7 @@ CTxdStore::PopCurrentTxd(void) void CTxdStore::SetCurrentTxd(int slot) { - TxdDef *def = GetSlot(slot); - if(def) - RwTexDictionarySetCurrent(def->texDict); + RwTexDictionarySetCurrent(GetSlot(slot)->texDict); } void @@ -118,7 +114,7 @@ void CTxdStore::RemoveRef(int slot) { if(--GetSlot(slot)->refCount <= 0) - CStreaming::RemoveModel(slot + STREAM_OFFSET_TXD); + CStreaming::RemoveTxd(slot); } void 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/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 44e0b044..eec44c35 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -49,7 +49,7 @@ #include "Object.h" #include "Automobile.h" -//--MIAMI: file done except TODOs +//--MIAMI: file done bool bAllCarCheat; @@ -4210,12 +4210,11 @@ CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece) pDriver && m_pDamageEntity && m_pDamageEntity->IsVehicle() && (this != FindPlayerVehicle() || ((CVehicle*)m_pDamageEntity)->VehicleCreatedBy == MISSION_VEHICLE) && -// TODO(MIAMI): enum ((CVehicle*)m_pDamageEntity)->pDriver){ if(GetVehicleAppearance() == VEHICLE_APPEARANCE_CAR) - pDriver->Say(145); + pDriver->Say(SOUND_PED_CRASH_CAR); else - pDriver->Say(144); + pDriver->Say(SOUND_PED_CRASH_VEHICLE); } int oldHealth = m_fHealth; @@ -4944,11 +4943,11 @@ CAutomobile::PlayCarHorn(void) m_nCarHornTimer = 45; }else if(r < 4){ if(pDriver) - pDriver->Say(SOUND_PED_CAR_COLLISION); + pDriver->Say(SOUND_PED_ANNOYED_DRIVER); m_nCarHornTimer = 45; }else{ if(pDriver) - pDriver->Say(SOUND_PED_CAR_COLLISION); + pDriver->Say(SOUND_PED_ANNOYED_DRIVER); } } diff --git a/src/vehicles/Bike.cpp b/src/vehicles/Bike.cpp index c32e72bc..62aeface 100644 --- a/src/vehicles/Bike.cpp +++ b/src/vehicles/Bike.cpp @@ -37,7 +37,7 @@ #include "Bike.h" #include "Debug.h" -//--MIAMI: done except for TODOs +//--MIAMI: file done // TODO: maybe put this somewhere else inline void @@ -1448,16 +1448,13 @@ CBike::PreRender(void) fwd.Normalise(); float f = headLightPos.y + 6.0f; pos += CVector(f*fwd.x, f*fwd.y, 2.0f); - -// TODO(MIAMI): -// CShadows::StoreCarLightShadow(this, (uintptr)this + 22, gpShadowExplosionTex, &pos, -// 7.0f*fwd.x, 7.0f*fwd.y, 3.5f*fwd.y, -3.5f*fwd.x, 45, 45, 45, 7.0f); + CShadows::StoreCarLightShadow(this, (uintptr)this + 22, gpShadowExplosionTex, &pos, + 7.0f*fwd.x, 7.0f*fwd.y, 3.5f*fwd.y, -3.5f*fwd.x, 45, 45, 45, 7.0f); f = (tailLightPos.y - 2.5f) - (headLightPos.y + 6.0f); pos += CVector(f*fwd.x, f*fwd.y, 0.0f); -// TODO(MIAMI): -// CShadows::StoreCarLightShadow(this, (uintptr)this + 25, gpShadowExplosionTex, &pos, -// 3.0f, 0.0f, 0.0f, -3.0f, 35, 0, 0, 4.0f); + CShadows::StoreCarLightShadow(this, (uintptr)this + 25, gpShadowExplosionTex, &pos, + 3.0f, 0.0f, 0.0f, -3.0f, 35, 0, 0, 4.0f); } if(this == FindPlayerVehicle() && !alarmOff){ @@ -2137,8 +2134,7 @@ CBike::VehicleDamage(void) m_pDamageEntity && m_pDamageEntity->IsVehicle() && (this != FindPlayerVehicle() || ((CVehicle*)m_pDamageEntity)->VehicleCreatedBy == MISSION_VEHICLE) && ((CVehicle*)m_pDamageEntity)->pDriver) -// TODO(MIAMI): enum - pDriver->Say(144); + pDriver->Say(SOUND_PED_CRASH_VEHICLE); int oldHealth = m_fHealth; if(this == FindPlayerVehicle()) @@ -2545,11 +2541,11 @@ CBike::PlayCarHorn(void) m_nCarHornTimer = 45; }else if(r < 4){ if(pDriver) - pDriver->Say(SOUND_PED_CAR_COLLISION); + pDriver->Say(SOUND_PED_ANNOYED_DRIVER); m_nCarHornTimer = 45; }else{ if(pDriver) - pDriver->Say(SOUND_PED_CAR_COLLISION); + pDriver->Say(SOUND_PED_ANNOYED_DRIVER); } } diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp index ae437f56..086a5002 100644 --- a/src/vehicles/Boat.cpp +++ b/src/vehicles/Boat.cpp @@ -242,7 +242,7 @@ CBoat::ProcessControl(void) m_fHealth -= (collisionDamage-25.0f)/2.0f; }else{ if(collisionDamage > 60.0f && pDriver) - pDriver->Say(SOUND_PED_CAR_COLLISION); + pDriver->Say(SOUND_PED_ANNOYED_DRIVER); if(bTakeLessDamage) m_fHealth -= (collisionDamage-25.0f)/12.0f; else diff --git a/src/vehicles/Transmission.cpp b/src/vehicles/Transmission.cpp index 5287055d..cc994ac6 100644 --- a/src/vehicles/Transmission.cpp +++ b/src/vehicles/Transmission.cpp @@ -4,6 +4,8 @@ #include "HandlingMgr.h" #include "Transmission.h" +//--MIAMI: done + void cTransmission::InitGearRatios(void) { @@ -80,59 +82,51 @@ cTransmission::CalculateDriveAcceleration(const float &gasPedal, uint8 &gear, fl if(fVelocity > pGearRatio->fShiftUpVelocity){ if(gear != 0 || gasPedal > 0.0f){ gear++; - time = 0.0f; return CalculateDriveAcceleration(gasPedal, gear, time, fVelocity, false); } }else if(fVelocity < pGearRatio->fShiftDownVelocity && gear != 0){ if(gear != 1 || gasPedal < 0.0f){ gear--; - time = 0.0f; return CalculateDriveAcceleration(gasPedal, gear, time, fVelocity, false); } } - if(time > 0.0f){ - // changing gears currently, can't accelerate - fAcceleration = 0.0f; - time -= CTimer::GetTimeStepInSeconds(); - }else{ - float speedMul, accelMul; + float speedMul, accelMul; - if(gear < 1){ - // going reverse - accelMul = (Flags & HANDLING_2G_BOOST) ? 2.0f : 1.0f; - speedMul = -1.0f; - }else if(nNumberOfGears == 1){ - accelMul = 1.0f; - speedMul = 1.0f; - }else{ - // BUG or not? this is 1.0 normally but 0.0 in the highest gear - float f = 1.0f - (gear-1)/(nNumberOfGears-1); - speedMul = 3.0f*sq(f) + 1.0f; - // This is pretty ugly, could be written more clearly - if(Flags & HANDLING_2G_BOOST){ - if(gear == 1) - accelMul = (Flags & HANDLING_1G_BOOST) ? 3.0f : 2.0f; - else if(gear == 2) - accelMul = 1.3f; - else - accelMul = 1.0f; - }else if(Flags & HANDLING_1G_BOOST && gear == 1){ - accelMul = 3.0f; - }else + if(gear < 1){ + // going reverse + accelMul = (Flags & HANDLING_2G_BOOST) ? 2.0f : 1.0f; + speedMul = -1.0f; + }else if(nNumberOfGears == 1){ + accelMul = 1.0f; + speedMul = 1.0f; + }else{ + // BUG or not? this is 1.0 normally but 0.0 in the highest gear + float f = 1.0f - (gear-1)/(nNumberOfGears-1); + speedMul = 3.0f*sq(f) + 1.0f; + // This is pretty ugly, could be written more clearly + if(Flags & HANDLING_2G_BOOST){ + if(gear == 1) + accelMul = (Flags & HANDLING_1G_BOOST) ? 2.0f : 1.6f; + else if(gear == 2) + accelMul = 1.3f; + else accelMul = 1.0f; - } - - if(cheat) - fCheat = 1.2f; - else - fCheat = 1.0f; - float targetVelocity = Gears[gear].fMaxVelocity*speedMul*fCheat; - float accel = fEngineAcceleration*accelMul * (targetVelocity - fVelocity)/Abs(targetVelocity); - if(Abs(fVelocity) < Abs(Gears[gear].fMaxVelocity*fCheat)) - fAcceleration = gasPedal * accel * CTimer::GetTimeStep(); - else - fAcceleration = 0.0f; + }else if(Flags & HANDLING_1G_BOOST && gear == 1){ + accelMul = 2.0f; + }else + accelMul = 1.0f; } + + if(cheat) + fCheat = 1.2f; + else + fCheat = 1.0f; + float targetVelocity = Gears[gear].fMaxVelocity*speedMul*fCheat; + float accel = fEngineAcceleration*accelMul * (targetVelocity - fVelocity)/Abs(targetVelocity); + if(Abs(fVelocity) < Abs(Gears[gear].fMaxVelocity*fCheat)) + fAcceleration = gasPedal * accel * CTimer::GetTimeStep(); + else + fAcceleration = 0.0f; return fAcceleration; } |