diff options
-rw-r--r-- | src/audio/AudioLogic.cpp | 1 | ||||
-rw-r--r-- | src/audio/audio_enums.h | 3 | ||||
-rw-r--r-- | src/control/GameLogic.cpp | 6 | ||||
-rw-r--r-- | src/control/Script.cpp | 60 | ||||
-rw-r--r-- | src/core/Cam.cpp | 22 | ||||
-rw-r--r-- | src/core/Frontend.cpp | 1076 | ||||
-rw-r--r-- | src/core/Frontend.h | 6 | ||||
-rw-r--r-- | src/core/Frontend_PS2.cpp | 27 | ||||
-rw-r--r-- | src/core/Pad.cpp | 22 | ||||
-rw-r--r-- | src/core/Pad.h | 1 | ||||
-rw-r--r-- | src/core/PlayerInfo.cpp | 363 | ||||
-rw-r--r-- | src/core/PlayerInfo.h | 25 | ||||
-rw-r--r-- | src/core/Radar.h | 2 | ||||
-rw-r--r-- | src/core/Stats.cpp | 531 | ||||
-rw-r--r-- | src/core/Stats.h | 80 | ||||
-rw-r--r-- | src/core/Wanted.cpp | 13 | ||||
-rw-r--r-- | src/core/re3.cpp | 2 | ||||
-rw-r--r-- | src/peds/Ped.cpp | 8 | ||||
-rw-r--r-- | src/render/SpecialFX.cpp | 40 | ||||
-rw-r--r-- | src/render/SpecialFX.h | 1 | ||||
-rw-r--r-- | src/render/Timecycle.cpp | 2 | ||||
-rw-r--r-- | src/render/Timecycle.h | 2 | ||||
-rw-r--r-- | src/save/GenericGameStorage.cpp | 21 | ||||
-rw-r--r-- | src/save/GenericGameStorage.h | 2 | ||||
-rw-r--r-- | src/save/PCSave.cpp | 8 | ||||
-rw-r--r-- | src/skel/glfw/glfw.cpp | 2 | ||||
-rw-r--r-- | src/weapons/BulletInfo.cpp | 2 | ||||
-rw-r--r-- | src/weapons/Weapon.cpp | 15 |
28 files changed, 1404 insertions, 939 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index b814d58c..98ebf0d8 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -2756,7 +2756,6 @@ cAudioManager::ProcessPlane(cVehicleParams *params) ProcessCesna(params); break; default: - debug("Plane Model Id is %d\n, ", params->m_pVehicle->GetModelIndex()); break; } } diff --git a/src/audio/audio_enums.h b/src/audio/audio_enums.h index 1f13521b..375c4a70 100644 --- a/src/audio/audio_enums.h +++ b/src/audio/audio_enums.h @@ -12,7 +12,8 @@ enum eRadioStation EMOTION, WAVE, USERTRACK, - POLICE_RADIO, + NUM_RADIOS = 10, + POLICE_RADIO = 10, //TAXI_RADIO, RADIO_OFF, }; diff --git a/src/control/GameLogic.cpp b/src/control/GameLogic.cpp index 2af9464c..f4e4fdd4 100644 --- a/src/control/GameLogic.cpp +++ b/src/control/GameLogic.cpp @@ -28,6 +28,7 @@ #include "Particle.h" #include "ColStore.h" #include "Automobile.h" +#include "MBlur.h" uint8 CGameLogic::ActivePlayers; uint8 CGameLogic::ShortCutState; @@ -343,7 +344,10 @@ CGameLogic::RestorePlayerStuffDuringResurrection(CPlayerPed *pPlayerPed, CVector pPlayerPed->bIsVisible = true; pPlayerPed->m_bloodyFootprintCountOrDeathTime = 0; pPlayerPed->bDoBloodyFootprints = false; - //TODO(MIAMI): clear drunk stuff + pPlayerPed->m_nDrunkenness = 0; + pPlayerPed->m_nFadeDrunkenness = 0; + CMBlur::ClearDrunkBlur(); + pPlayerPed->m_nDrunkCountdown = 0; pPlayerPed->ClearAdrenaline(); pPlayerPed->m_fCurrentStamina = pPlayerPed->m_fMaxStamina; if (pPlayerPed->m_pFire) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 9508677b..e16ba9e0 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -1806,7 +1806,7 @@ void CMissionCleanup::Process() // TODO(MIAMI) //CSpecialFX::bLiftCam = false; //CSpecialFX::bVideoCam = false; - //CTimeCycle::StopExtraColour(0); + CTimeCycle::StopExtraColour(0); for (int i = 0; i < MISSION_AUDIO_SLOTS; i++) DMAudio.ClearMissionAudio(i); CWeather::ReleaseWeather(); @@ -1822,8 +1822,11 @@ void CMissionCleanup::Process() CWorld::Players[0].m_pPed->m_pWanted->m_bIgnoredByCops = false; CWorld::Players[0].m_pPed->m_pWanted->m_bIgnoredByEveryone = false; CWorld::Players[0].MakePlayerSafe(false); - //TODO(MIAMI): drunkenness, enable drive by - //DMAudio::ShutUpPlayerTalking(0); + CWorld::Players[0].m_pPed->m_nFadeDrunkenness = 1; + CWorld::Players[0].m_pPed->m_nDrunkCountdown = 0; + // CPad::GetPad(0)->SetDrunkInputDelay(0); // TODO(Miami) + CWorld::Players[0].m_bDriveByAllowed = true; + // DMAudio::ShutUpPlayerTalking(0); // TODO(Miami) CVehicle::bDisableRemoteDetonation = false; CVehicle::bDisableRemoteDetonationOnContact = false; CGameLogic::ClearShortCut(); @@ -5353,7 +5356,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); - int handle = CRadar::SetCoordBlip(BLIP_COORD, pos, 2, BLIP_DISPLAY_BOTH); + int handle = CRadar::SetCoordBlip(BLIP_CONTACT_POINT, pos, 2, BLIP_DISPLAY_BOTH); CRadar::ChangeBlipScale(handle, 3); ScriptParams[0] = handle; StoreParameters(&m_nIp, 1); @@ -9792,7 +9795,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) CVector pos = *(CVector*)&ScriptParams[0]; if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - C3dMarkers::PlaceMarkerSet((uintptr)this + m_nIp, 4, pos, *(float*)&ScriptParams[3], + C3dMarkers::PlaceMarkerSet((uintptr)this + m_nIp, MARKERTYPE_CYLINDER, pos, *(float*)&ScriptParams[3], SPHERE_MARKER_R, SPHERE_MARKER_G, SPHERE_MARKER_B, SPHERE_MARKER_A, SPHERE_MARKER_PULSE_PERIOD, SPHERE_MARKER_PULSE_FRACTION, 0); return 0; @@ -12722,14 +12725,20 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) case COMMAND_GET_WHEELIE_STATS: { CollectParameters(&m_nIp, 1); - static bool bShowed = false; - if (!bShowed) { - debug("GET_WHEELIE_STATS not implemented\n"); - bShowed = true; - } - for (int i = 0; i < 6; i++) - ScriptParams[i] = 0; + CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]]; + ScriptParams[0] = pPlayerInfo->m_nLastTimeCarSpentOnTwoWheels; + ScriptParams[1] = *(int*)&pPlayerInfo->m_nLastDistanceCarTravelledOnTwoWheels; + ScriptParams[2] = pPlayerInfo->m_nLastTimeSpentOnWheelie; + ScriptParams[3] = *(int*)&pPlayerInfo->m_nLastDistanceTravelledOnWheelie; + ScriptParams[4] = pPlayerInfo->m_nLastTimeSpentOnStoppie; + ScriptParams[5] = *(int*)&pPlayerInfo->m_nLastDistanceTravelledOnStoppie; StoreParameters(&m_nIp, 6); + pPlayerInfo->m_nLastTimeCarSpentOnTwoWheels = 0; + pPlayerInfo->m_nLastDistanceCarTravelledOnTwoWheels = 0.0f; + pPlayerInfo->m_nLastTimeSpentOnWheelie = 0; + pPlayerInfo->m_nLastDistanceTravelledOnWheelie = 0.0f; + pPlayerInfo->m_nLastTimeSpentOnStoppie = 0; + pPlayerInfo->m_nLastDistanceTravelledOnStoppie = 0.0f; return 0; } //case COMMAND_DISARM_CHAR: @@ -13008,11 +13017,11 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) //case COMMAND_IS_MISSION_AUDIO_LOADING: case COMMAND_ADD_MONEY_SPENT_ON_WEAPONS: CollectParameters(&m_nIp, 1); - debug("ADD_MONEY_SPENT_ON_WEAPON not implemented\n"); // TODO(MIAMI) + CStats::MoneySpentOnWeapons(ScriptParams[0]); return 0; case COMMAND_ADD_MONEY_SPENT_ON_PROPERTY: CollectParameters(&m_nIp, 1); - debug("ADD_MONEY_SPENT_ON_PROPERTY not implemented\n"); // TODO(MIAMI) + CStats::MoneySpentOnProperty(ScriptParams[0]); return 0; //case COMMAND_ADD_MONEY_SPENT_ON_AUTO_PAINTING: case COMMAND_SET_CHAR_ANSWERING_MOBILE: @@ -13041,21 +13050,21 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) //case COMMAND_ADD_LOAN_SHARK_VISITS: case COMMAND_ADD_STORES_KNOCKED_OFF: CollectParameters(&m_nIp, 1); - debug("ADD_STORES_KNOCKED_OFF not implemented\n"); // TODO(MIAMI) + CStats::NumOfStoresKnockedOff(ScriptParams[0]); return 0; //case COMMAND_ADD_MOVIE_STUNTS: case COMMAND_ADD_NUMBER_OF_ASSASSINATIONS: CollectParameters(&m_nIp, 1); - debug("ADD_NUMBER_OF_ASSASSINATIONS not implemented\n"); // TODO(MIAMI) + CStats::NumOfAssassinations(ScriptParams[0]); return 0; case COMMAND_ADD_PIZZAS_DELIVERED: CollectParameters(&m_nIp, 1); - debug("ADD_PIZZAS_DELIVERED not implemented\n"); // TODO(MIAMI) + CStats::NumOfPizzasDelivered(ScriptParams[0]); return 0; //case COMMAND_ADD_GARBAGE_PICKUPS: case COMMAND_ADD_ICE_CREAMS_SOLD: CollectParameters(&m_nIp, 1); - debug("ADD_ICE_CREAMS_SOLD not implemented\n"); // TODO(MIAMI) + CStats::NumOfIceCreamSold(ScriptParams[0]); return 0; //case COMMAND_SET_TOP_SHOOTING_RANGE_SCORE: //case COMMAND_ADD_SHOOTING_RANGE_RANK: @@ -13137,15 +13146,15 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) } case COMMAND_SET_PROPERTY_AS_OWNED: CollectParameters(&m_nIp, 1); - debug("SET_PROPERTY_AS_OWNED not implemented\n"); // TODO(MIAMI) + CStats::AddPropertyAsOwned(ScriptParams[0]); return 0; case COMMAND_ADD_BLOOD_RING_KILLS: CollectParameters(&m_nIp, 1); - debug("ADD_BLOOD_RING_KILLS not implemented\n"); // TODO(MIAMI) + CStats::AddNumBloodRingKills(ScriptParams[0]); return 0; case COMMAND_SET_LONGEST_TIME_IN_BLOOD_RING: CollectParameters(&m_nIp, 1); - debug("SET_LONGEST_TIME_IN_BLOOD_RING not implemented\n"); // TODO(MIAMI) + CStats::LongestTimeInBloodRing(ScriptParams[0]); return 0; case COMMAND_REMOVE_EVERYTHING_FOR_HUGE_CUTSCENE: { @@ -13271,7 +13280,8 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) //case COMMAND_SET_CHAR_OBJ_GOTO_CAR_ON_FOOT: //case COMMAND_GET_CLOSEST_WATER_NODE: case COMMAND_ADD_PORN_LEAFLET_TO_RUBBISH: - debug("ADD_PORN_LEAFLET_TO_RUBBISH is not implemented\n"); // TODO(MIAMI) + CollectParameters(&m_nIp, 1); + CStats::PamphletMissionPassed = ScriptParams[0]; return 0; case COMMAND_CREATE_CLOTHES_PICKUP: { @@ -13541,7 +13551,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) switch (command) { case COMMAND_REGISTER_VIGILANTE_LEVEL: CollectParameters(&m_nIp, 1); - debug("REGISTER_VIGILANTE_LEVEL not implemented\n"); // TODO(MIAMI) + CStats::RegisterLevelVigilanteMission(ScriptParams[0]); return 0; case COMMAND_CLEAR_ALL_CHAR_ANIMS: { @@ -13854,7 +13864,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) } case COMMAND_REGISTER_FIRE_LEVEL: CollectParameters(&m_nIp, 1); - debug("REGISTER_FIRE_LEVEL not implemented\n"); // TODO(MIAMI) + CStats::RegisterLevelFireMission(ScriptParams[0]); return 0; case COMMAND_IS_AUSTRALIAN_GAME: UpdateCompareFlag(false); // should we make some check? @@ -14007,7 +14017,7 @@ void CTheScripts::DrawScriptSpheres() { for (int i = 0; i < MAX_NUM_SCRIPT_SPHERES; i++) { if (ScriptSphereArray[i].m_bInUse) - C3dMarkers::PlaceMarkerSet(ScriptSphereArray[i].m_Id, 4, ScriptSphereArray[i].m_vecCenter, ScriptSphereArray[i].m_fRadius, + C3dMarkers::PlaceMarkerSet(ScriptSphereArray[i].m_Id, MARKERTYPE_CYLINDER, ScriptSphereArray[i].m_vecCenter, ScriptSphereArray[i].m_fRadius, SPHERE_MARKER_R, SPHERE_MARKER_G, SPHERE_MARKER_B, SPHERE_MARKER_A, SPHERE_MARKER_PULSE_PERIOD, SPHERE_MARKER_PULSE_FRACTION, 0); } } diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 375e9d5b..b996e77f 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -4894,11 +4894,6 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, if (ResetStatics) { FOV = DefaultFOV; - - // TODO(Miami): Remove that when cam is done! - // GTA 3 has this in veh. camera - if (TheCamera.m_bIdleOn) - TheCamera.m_uiTimeWeEnteredIdle = CTimer::GetTimeInMilliseconds(); } else { if (isCar || isBike) { // 0.4f: CAR_FOV_START_SPEED @@ -4933,18 +4928,13 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, Rotating = false; m_bCollisionChecksOn = true; - - // TODO(Miami): Uncomment that when cam is done! - - // Garage exit cam is not working well in III... - // if (!TheCamera.m_bJustCameOutOfGarage) - // { - Alpha = 0.0f; - Beta = car->GetForward().Heading() - HALFPI; - if (TheCamera.m_bCamDirectlyInFront) { - Beta += PI; + if (!TheCamera.m_bJustCameOutOfGarage) { + Alpha = 0.0f; + Beta = car->GetForward().Heading() - HALFPI; + if (TheCamera.m_bCamDirectlyInFront) { + Beta += PI; + } } - // } BetaSpeed = 0.0; AlphaSpeed = 0.0; diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index ccb89fbd..0be9daf0 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -36,6 +36,7 @@ #include "Stats.h" #include "Messages.h" #include "FileLoader.h" +#include "User.h" // TODO(Miami): Remove that!! That was my map implementation for III, instead use MAP_ENHACEMENTS on some places #define CUSTOM_MAP @@ -65,8 +66,6 @@ CRGBA LIST_BACKGROUND_COLOR(49, 101, 148, 255); #define FEET_IN_METER 3.33f #endif -#define isPlainTextScreen(screen) (screen == MENUPAGE_BRIEFS || screen == MENUPAGE_STATS) - #ifdef TRIANGLE_BACK_BUTTON #define GetBackJustUp GetTriangleJustUp #define GetBackJustDown GetTriangleJustDown @@ -924,9 +923,9 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen) str = TheText.Get(aScreens[MENUPAGE_DELETE_SLOT_CONFIRM].m_aEntries[0].m_EntryName); break; case MENUPAGE_SAVE_OVERWRITE_CONFIRM: - if (Slots[m_nCurrSaveSlot + 1] == SLOT_OK) + if (Slots[m_nCurrSaveSlot] == SLOT_OK) str = TheText.Get("FESZ_QO"); - else if (Slots[m_nCurrSaveSlot + 1] == SLOT_CORRUPTED) + else if (Slots[m_nCurrSaveSlot] == SLOT_CORRUPTED) str = TheText.Get("FESZ_QZ"); else str = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[0].m_EntryName); @@ -3583,7 +3582,7 @@ CMenuManager::Process(void) InitialiseChangedLanguageSettings(); if (m_bMenuActive) { - ProcessButtonPresses(); + UserInput(); ProcessFileActions(); DMAudio.Service(); @@ -3593,100 +3592,249 @@ CMenuManager::Process(void) SwitchMenuOnAndOff(); } -// TODO(Miami) +// Original name is unknown void -CMenuManager::ProcessButtonPresses(void) +CMenuManager::ProcessList(bool &optionSelected, bool &goBack) { - if (m_nCurrScreen == MENUPAGE_OUTRO) + if (m_bWaitingForNewKeyBind) return; - if (m_bWaitingForNewKeyBind) { - if (m_bStartWaitingForKeyBind) - m_bStartWaitingForKeyBind = false; - else { - pControlEdit = CPad::EditCodesForControls(pControlEdit, 1); - JoyButtonJustClicked = false; - MouseButtonJustClicked = false; + if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) { + m_nTotalListRow = m_nSkinsTotal; + } + if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) { + m_nTotalListRow = m_ControlMethod == CONTROL_CLASSIC ? 30 : 25; + if (m_nSelectedListRow > m_nTotalListRow) + m_nSelectedListRow = m_nTotalListRow - 1; + } - if (CPad::GetPad(0)->GetLeftMouseJustDown()) - MouseButtonJustClicked = 1; - else if (CPad::GetPad(0)->GetRightMouseJustUp()) - MouseButtonJustClicked = 3; - else if (CPad::GetPad(0)->GetMiddleMouseJustUp()) - MouseButtonJustClicked = 2; - else if (CPad::GetPad(0)->GetMouseWheelUpJustUp()) - MouseButtonJustClicked = 4; - else if (CPad::GetPad(0)->GetMouseWheelDownJustUp()) - MouseButtonJustClicked = 5; - // TODO two more buttons + if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCrossJustDown()) { + m_bShowMouse = 0; + optionSelected = true; + } + if (CPad::GetPad(0)->GetBackspaceJustDown() && m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS && !field_159) { + if (m_nCurrExLayer == HOVEROPTION_LIST) { + m_nHoverOption = HOVEROPTION_NOT_HOVERING; + m_bWaitingForNewKeyBind = true; + m_bStartWaitingForKeyBind = true; + m_bKeyChangeNotProcessed = true; + pControlEdit = &m_KeyPressedCode; + } + } else { + field_159 = false; + } - JoyButtonJustClicked = ControlsManager.GetJoyButtonJustDown(); + static PauseModeTime lastTimeClickedScrollButton = 0; - int32 TypeOfControl = KEYBOARD; - if (JoyButtonJustClicked) - TypeOfControl = JOYSTICK; - if (MouseButtonJustClicked) - TypeOfControl = MOUSE; - if (*pControlEdit != rsNULL) - TypeOfControl = KEYBOARD; + if (CTimer::GetTimeInMillisecondsPauseMode() - lastTimeClickedScrollButton >= 200) { + m_bPressedPgUpOnList = false; + m_bPressedPgDnOnList = false; + m_bPressedUpOnList = false; + m_bPressedDownOnList = false; + m_bPressedScrollButton = false; + lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); + } - if (!m_bKeyIsOK) { - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0); - pControlEdit = nil; - m_bWaitingForNewKeyBind = false; - m_KeyPressedCode = -1; - m_bStartWaitingForKeyBind = false; - } - else if (!m_bKeyChangeNotProcessed) { - if (*pControlEdit != rsNULL || MouseButtonJustClicked || JoyButtonJustClicked) - CheckCodesForControls(TypeOfControl); + if (CPad::GetPad(0)->GetTabJustDown()) { + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); + m_bShowMouse = false; + switch (m_nCurrExLayer) { + case HOVEROPTION_BACK: + default: + m_nCurrExLayer = HOVEROPTION_LIST; + break; + case HOVEROPTION_LIST: + m_nCurrExLayer = HOVEROPTION_USESKIN; + break; + case HOVEROPTION_USESKIN: + m_nCurrExLayer = HOVEROPTION_BACK; + } + if (((m_nCurrScreen == MENUPAGE_SKIN_SELECT) && (m_nCurrExLayer == HOVEROPTION_USESKIN)) && strcmp(m_aSkinName, m_PrefsSkinFile) == 0) { + m_nCurrExLayer = HOVEROPTION_BACK; + } + if ((m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) && (m_nCurrExLayer == HOVEROPTION_USESKIN)) { + m_nCurrExLayer = HOVEROPTION_BACK; + } + } - field_159 = true; + bool pressed = false; + if (CPad::GetPad(0)->GetUp() || CPad::GetPad(0)->GetAnaloguePadUp() || CPad::GetPad(0)->GetDPadUpJustDown()) { + m_bShowMouse = false; + pressed = true; + } else if (CPad::GetPad(0)->GetMouseWheelUpJustUp()) { + m_bShowMouse = true; + pressed = true; + } + + // Up + if (pressed) { + m_nCurrExLayer = HOVEROPTION_LIST; + if (!m_bPressedUpOnList) { + m_bPressedUpOnList = true; + lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); + ScrollUpListByOne(); + } + } else { + m_bPressedUpOnList = false; + } + + pressed = false; + if (CPad::GetPad(0)->GetDown() || CPad::GetPad(0)->GetAnaloguePadDown() || CPad::GetPad(0)->GetDPadDownJustDown()) { + m_bShowMouse = false; + pressed = true; + } else if (CPad::GetPad(0)->GetMouseWheelDownJustDown()) { + m_bShowMouse = true; + pressed = true; + } + + // Down + if (pressed) { + m_nCurrExLayer = HOVEROPTION_LIST; + if (!m_bPressedDownOnList) { + m_bPressedDownOnList = true; + lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); + ScrollDownListByOne(); + } + } else { + m_bPressedDownOnList = false; + } + + if (m_nCurrScreen != MENUPAGE_KEYBOARD_CONTROLS) { + if (!CPad::GetPad(0)->GetPageUp()) { + m_bPressedPgUpOnList = false; + } else { + m_nCurrExLayer = HOVEROPTION_LIST; + if (!m_bPressedPgUpOnList) { + m_bPressedPgUpOnList = true; + lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); + m_bShowMouse = false; + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); + PageUpList(false); } - else { + } + if (!CPad::GetPad(0)->GetPageDown()) { + m_bPressedPgDnOnList = false; + } else { + m_nCurrExLayer = HOVEROPTION_LIST; + if (!m_bPressedPgDnOnList) { + m_bPressedPgDnOnList = true; + lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); + m_bShowMouse = false; + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); + PageDownList(false); + } + } + if (CPad::GetPad(0)->GetHome()) { + m_nCurrExLayer = HOVEROPTION_LIST; + m_bShowMouse = false; + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); + if (m_nTotalListRow >= MAX_VISIBLE_LIST_ROW) { + m_nFirstVisibleRowOnList = 0; + } + m_nSelectedListRow = 0; + m_nScrollbarTopMargin = (SCROLLBAR_MAX_HEIGHT / m_nTotalListRow) * m_nFirstVisibleRowOnList; + } + if (CPad::GetPad(0)->GetEnd()) { + m_nCurrExLayer = HOVEROPTION_LIST; + m_bShowMouse = false; + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); + if (m_nTotalListRow >= MAX_VISIBLE_LIST_ROW) { + m_nFirstVisibleRowOnList = m_nTotalListRow - MAX_VISIBLE_LIST_ROW; + } + m_nSelectedListRow = m_nTotalListRow - 1; + m_nScrollbarTopMargin = (SCROLLBAR_MAX_HEIGHT / m_nTotalListRow) * m_nFirstVisibleRowOnList; + } + } + + if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetBackJustDown()) { + m_bShowMouse = false; + goBack = true; + } + + if (CPad::GetPad(0)->GetLeftMouseJustDown()) { + switch (m_nHoverOption) { + case HOVEROPTION_BACK: + goBack = true; + break; + case HOVEROPTION_PAGEUP: + PageUpList(true); + break; + case HOVEROPTION_PAGEDOWN: + PageDownList(true); + break; + case HOVEROPTION_USESKIN: + if (m_nSkinsTotal > 0) { DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); - for (int i = 0; i < 4; i++) - ControlsManager.ClearSettingsAssociatedWithAction((e_ControllerAction)m_CurrCntrlAction, (eControllerType)i); - m_bKeyIsOK = false; - m_bKeyChangeNotProcessed = false; - pControlEdit = nil; - m_bWaitingForNewKeyBind = false; - m_KeyPressedCode = -1; - m_bStartWaitingForKeyBind = false; + m_pSelectedSkin = m_pSkinListHead.nextSkin; + strcpy(m_PrefsSkinFile, m_aSkinName); + CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile); + SaveSettings(); } } } - if (pEditString || pControlEdit) - return; + if (CPad::GetPad(0)->GetLeftMouseJustDown()) { + switch (m_nHoverOption) { + case HOVEROPTION_OVER_SCROLL_UP: + m_nHoverOption = HOVEROPTION_CLICKED_SCROLL_UP; + break; + case HOVEROPTION_OVER_SCROLL_DOWN: + m_nHoverOption = HOVEROPTION_CLICKED_SCROLL_DOWN; + break; + case HOVEROPTION_LIST: + m_nHoverOption = HOVEROPTION_SKIN; + } + } else if ((CPad::GetPad(0)->GetLeftMouseJustUp()) + && ((m_nHoverOption == HOVEROPTION_CLICKED_SCROLL_UP || (m_nHoverOption == HOVEROPTION_CLICKED_SCROLL_DOWN)))) { + m_nHoverOption = HOVEROPTION_NOT_HOVERING; + } + + if (!CPad::GetPad(0)->GetLeftMouse()) { + holdingScrollBar = false; + } else { + if ((m_nHoverOption == HOVEROPTION_HOLDING_SCROLLBAR) || holdingScrollBar) { + holdingScrollBar = true; + // TODO: This part is a bit hard to reverse. Not much code tho + assert(0 && "Holding scrollbar isn't done yet"); + } else { + switch (m_nHoverOption) { + case HOVEROPTION_OVER_SCROLL_UP: + case HOVEROPTION_CLICKED_SCROLL_UP: + if (!m_bPressedScrollButton) { + m_bPressedScrollButton = true; + lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); + ScrollUpListByOne(); + } + break; + case HOVEROPTION_OVER_SCROLL_DOWN: + case HOVEROPTION_CLICKED_SCROLL_DOWN: + if (!m_bPressedScrollButton) { + m_bPressedScrollButton = true; + lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); + ScrollDownListByOne(); + } + break; + default: + m_bPressedScrollButton = false; + } + } + } +} +void +CMenuManager::UserInput(void) +{ bool goBack = false; bool optionSelected = false; bool goUp = false; bool goDown = false; -#ifdef TIDY_UP_PBP - bool assumeIncrease = false; -#endif + int8 changeValueBy; -#ifdef USE_DEBUG_SCRIPT_LOADER - if (m_nCurrScreen == MENUPAGE_START_MENU || m_nCurrScreen == MENUPAGE_NEW_GAME || m_nCurrScreen == MENUPAGE_NEW_GAME_RELOAD) { -#ifdef RW_GL3 - if (glfwGetKey(PSGLOBAL(window), GLFW_KEY_R) == GLFW_PRESS) { - scriptToLoad = 1; - DoSettingsBeforeStartingAGame(); - return; - } -#elif defined _WIN32 - if (GetAsyncKeyState('R') & 0x8000) { - scriptToLoad = 1; - DoSettingsBeforeStartingAGame(); - return; - } -#endif - } -#endif - - if (!m_bShowMouse && (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY)) { + if (!m_AllowNavigation && m_menuTransitionProgress == 255) + m_AllowNavigation = true; + if (!m_bShowMouse && m_nCurrScreen != MENUPAGE_MAP && (m_nMouseOldPosX != m_nMousePosX || m_nMouseOldPosY != m_nMousePosY)) { m_bShowMouse = true; } @@ -3745,248 +3893,23 @@ CMenuManager::ProcessButtonPresses(void) if (m_nMousePosY < 0) m_nMousePosY = 0; if (m_nMousePosY > SCREEN_HEIGHT) m_nMousePosY = SCREEN_HEIGHT; - if (m_nCurrScreen == MENUPAGE_SKIN_SELECT || m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) { - - if (m_nCurrScreen == MENUPAGE_SKIN_SELECT) { - m_nTotalListRow = m_nSkinsTotal; - } - if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) { - m_nTotalListRow = m_ControlMethod == CONTROL_CLASSIC ? 30 : 25; - if (m_nSelectedListRow > m_nTotalListRow) - m_nSelectedListRow = m_nTotalListRow - 1; - } - - if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCrossJustDown()) { - m_bShowMouse = 0; - optionSelected = true; - } - if (CPad::GetPad(0)->GetBackspaceJustDown() && m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS && !field_159) { - if (m_nCurrExLayer == HOVEROPTION_LIST) { - m_nHoverOption = HOVEROPTION_NOT_HOVERING; - m_bWaitingForNewKeyBind = true; - m_bStartWaitingForKeyBind = true; - m_bKeyChangeNotProcessed = true; - pControlEdit = &m_KeyPressedCode; - } - } else { - field_159 = false; - } - - static PauseModeTime lastTimeClickedScrollButton = 0; - - if (CTimer::GetTimeInMillisecondsPauseMode() - lastTimeClickedScrollButton >= 200) { - m_bPressedPgUpOnList = false; - m_bPressedPgDnOnList = false; - m_bPressedUpOnList = false; - m_bPressedDownOnList = false; - m_bPressedScrollButton = false; - lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); - } - - if (CPad::GetPad(0)->GetTabJustDown()) { - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); - m_bShowMouse = false; - switch (m_nCurrExLayer) { - case HOVEROPTION_BACK: - default: - m_nCurrExLayer = HOVEROPTION_LIST; - break; - case HOVEROPTION_LIST: - m_nCurrExLayer = HOVEROPTION_USESKIN; - break; - case HOVEROPTION_USESKIN: - m_nCurrExLayer = HOVEROPTION_BACK; - } - if (((m_nCurrScreen == MENUPAGE_SKIN_SELECT) && (m_nCurrExLayer == HOVEROPTION_USESKIN)) && strcmp(m_aSkinName, m_PrefsSkinFile) == 0) { - m_nCurrExLayer = HOVEROPTION_BACK; - } - if ((m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) && (m_nCurrExLayer == HOVEROPTION_USESKIN)) { - m_nCurrExLayer = HOVEROPTION_BACK; - } - } - - bool pressed = false; - if (CPad::GetPad(0)->GetUp() || CPad::GetPad(0)->GetAnaloguePadUp() || CPad::GetPad(0)->GetDPadUpJustDown()) { - m_bShowMouse = false; - pressed = true; - } else if (CPad::GetPad(0)->GetMouseWheelUpJustUp()) { - m_bShowMouse = true; - pressed = true; - } - - // Up - if (pressed) { - m_nCurrExLayer = HOVEROPTION_LIST; - if (!m_bPressedUpOnList) { - m_bPressedUpOnList = true; - lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); - ScrollUpListByOne(); - } - } else { - m_bPressedUpOnList = false; - } - - pressed = false; - if (CPad::GetPad(0)->GetDown() || CPad::GetPad(0)->GetAnaloguePadDown() || CPad::GetPad(0)->GetDPadDownJustDown()) { - m_bShowMouse = false; - pressed = true; - } else if (CPad::GetPad(0)->GetMouseWheelDownJustDown()) { - m_bShowMouse = true; - pressed = true; - } - - // Down - if (pressed) { - m_nCurrExLayer = HOVEROPTION_LIST; - if (!m_bPressedDownOnList) { - m_bPressedDownOnList = true; - lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); - ScrollDownListByOne(); - } - } else { - m_bPressedDownOnList = false; - } - - if (m_nCurrScreen != MENUPAGE_KEYBOARD_CONTROLS) { - if (!CPad::GetPad(0)->GetPageUp()) { - m_bPressedPgUpOnList = false; - } else { - m_nCurrExLayer = HOVEROPTION_LIST; - if (!m_bPressedPgUpOnList) { - m_bPressedPgUpOnList = true; - lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); - m_bShowMouse = false; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); - PageUpList(false); - } - } - if (!CPad::GetPad(0)->GetPageDown()) { - m_bPressedPgDnOnList = false; - } else { - m_nCurrExLayer = HOVEROPTION_LIST; - if (!m_bPressedPgDnOnList) { - m_bPressedPgDnOnList = true; - lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); - m_bShowMouse = false; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); - PageDownList(false); - } - } - if (CPad::GetPad(0)->GetHome()) { - m_nCurrExLayer = HOVEROPTION_LIST; - m_bShowMouse = false; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); - if (m_nTotalListRow >= MAX_VISIBLE_LIST_ROW) { - m_nFirstVisibleRowOnList = 0; - } - m_nSelectedListRow = 0; - m_nScrollbarTopMargin = (SCROLLBAR_MAX_HEIGHT / m_nTotalListRow) * m_nFirstVisibleRowOnList; - } - if (CPad::GetPad(0)->GetEnd()) { - m_nCurrExLayer = HOVEROPTION_LIST; - m_bShowMouse = false; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); - if (m_nTotalListRow >= MAX_VISIBLE_LIST_ROW) { - m_nFirstVisibleRowOnList = m_nTotalListRow - MAX_VISIBLE_LIST_ROW; - } - m_nSelectedListRow = m_nTotalListRow - 1; - m_nScrollbarTopMargin = (SCROLLBAR_MAX_HEIGHT / m_nTotalListRow) * m_nFirstVisibleRowOnList; - } - } - - if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetBackJustDown()) { - m_bShowMouse = false; - goBack = true; - } - - if (CPad::GetPad(0)->GetLeftMouseJustDown()) { - switch (m_nHoverOption) { - case HOVEROPTION_BACK: - goBack = true; - break; - case HOVEROPTION_PAGEUP: - PageUpList(true); - break; - case HOVEROPTION_PAGEDOWN: - PageDownList(true); - break; - case HOVEROPTION_USESKIN: - if (m_nSkinsTotal > 0) { - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); - m_pSelectedSkin = m_pSkinListHead.nextSkin; - strcpy(m_PrefsSkinFile, m_aSkinName); - CWorld::Players[0].SetPlayerSkin(m_PrefsSkinFile); - SaveSettings(); - } - } - } - - if (CPad::GetPad(0)->GetLeftMouseJustDown()) { - switch (m_nHoverOption) { - case HOVEROPTION_OVER_SCROLL_UP: - m_nHoverOption = HOVEROPTION_CLICKED_SCROLL_UP; - break; - case HOVEROPTION_OVER_SCROLL_DOWN: - m_nHoverOption = HOVEROPTION_CLICKED_SCROLL_DOWN; - break; - case HOVEROPTION_LIST: - m_nHoverOption = HOVEROPTION_SKIN; - } - } else if ((CPad::GetPad(0)->GetLeftMouseJustUp()) - && ((m_nHoverOption == HOVEROPTION_CLICKED_SCROLL_UP || (m_nHoverOption == HOVEROPTION_CLICKED_SCROLL_DOWN)))) { - m_nHoverOption = HOVEROPTION_NOT_HOVERING; - } - - if (!CPad::GetPad(0)->GetLeftMouse()) { - holdingScrollBar = false; - } else { - if ((m_nHoverOption == HOVEROPTION_HOLDING_SCROLLBAR) || holdingScrollBar) { - holdingScrollBar = true; - // TODO: This part is a bit hard to reverse. Not much code tho - assert(0 && "Holding scrollbar isn't done yet"); - } else { - switch (m_nHoverOption) { - case HOVEROPTION_OVER_SCROLL_UP: - case HOVEROPTION_CLICKED_SCROLL_UP: - if (!m_bPressedScrollButton) { - m_bPressedScrollButton = true; - lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); - ScrollUpListByOne(); - } - break; - case HOVEROPTION_OVER_SCROLL_DOWN: - case HOVEROPTION_CLICKED_SCROLL_DOWN: - if (!m_bPressedScrollButton) { - m_bPressedScrollButton = true; - lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode(); - ScrollDownListByOne(); - } - break; - default: - m_bPressedScrollButton = false; - } - } - } - } else if (isPlainTextScreen(m_nCurrScreen)) { - if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCrossJustDown() || CPad::GetPad(0)->GetLeftMouseJustDown()) { - optionSelected = true; - } - if (CPad::GetPad(0)->GetEscapeJustDown() || CPad::GetPad(0)->GetBackJustUp()) { - if (m_nCurrScreen != MENUPAGE_START_MENU) { - goBack = true; - } - } + changeValueBy = 0; + if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS || m_nCurrScreen == MENUPAGE_SKIN_SELECT) { + ProcessList(optionSelected, goBack); } else { - if (CPad::GetPad(0)->GetDownJustDown() || CPad::GetPad(0)->GetAnaloguePadDown() || CPad::GetPad(0)->GetDPadDownJustDown()) { + // TODO(Miami): Seperate that code into a new function from ProcessButtonPresses + // ProcessScrollingExceptLists(goBack); + + if (m_AllowNavigation && + (CPad::GetPad(0)->GetDownJustDown() || CPad::GetPad(0)->GetAnaloguePadDown() || CPad::GetPad(0)->GetDPadDownJustDown())) { m_bShowMouse = false; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); goDown = true; m_nOptionHighlightTransitionBlend = 0; - } else if (CPad::GetPad(0)->GetUpJustDown() || CPad::GetPad(0)->GetAnaloguePadUp() || CPad::GetPad(0)->GetDPadUpJustDown()) { + + } + else if (m_AllowNavigation && + (CPad::GetPad(0)->GetUpJustDown() || CPad::GetPad(0)->GetAnaloguePadUp() || CPad::GetPad(0)->GetDPadUpJustDown())) { m_bShowMouse = false; - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); goUp = true; m_nOptionHighlightTransitionBlend = 0; } @@ -3996,25 +3919,23 @@ CMenuManager::ProcessButtonPresses(void) m_bShowMouse = false; optionSelected = true; } - } else { + } + else { if (CPad::GetPad(0)->GetEnterJustDown() || CPad::GetPad(0)->GetCrossJustDown()) { m_bShowMouse = false; optionSelected = true; } } - if (CPad::GetPad(0)->GetLeftMouseJustUp()) { -#ifndef TIDY_UP_PBP - if (((m_nCurrOption == 0) && (m_nCurrScreen == MENUPAGE_PAUSE_MENU)) && -#else - if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_RESUME && -#endif - (m_nHoverOption == HOVEROPTION_RANDOM_ITEM)) { + if (CPad::GetPad(0)->GetLeftMouseJustUp() && m_nCurrScreen != MENUPAGE_MAP) { + // TODO(Miami): New radio selector + if (m_nHoverOption == HOVEROPTION_RANDOM_ITEM) { m_nCurrOption = m_nOptionMouseHovering; optionSelected = true; } - } else if (CPad::GetPad(0)->GetLeftMouseJustDown()) { -#ifdef TIDY_UP_PBP + } + // TODO(Miami): This part is old radio selector, remove when new is reversed!! + else if (CPad::GetPad(0)->GetLeftMouseJustDown()) { if (m_nHoverOption >= HOVEROPTION_RADIO_0 && m_nHoverOption <= HOVEROPTION_RADIO_9) { DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); m_PrefsRadioStation = m_nHoverOption - HOVEROPTION_RADIO_0; @@ -4022,206 +3943,28 @@ CMenuManager::ProcessButtonPresses(void) DMAudio.SetRadioInCar(m_PrefsRadioStation); DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); OutputDebugString("FRONTEND RADIO STATION CHANGED"); - } else if (m_nHoverOption == HOVEROPTION_RANDOM_ITEM - && aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_RESUME) { - m_nCurrOption = m_nOptionMouseHovering; - optionSelected = true; - } -#else - switch (m_nHoverOption) { - case HOVEROPTION_RADIO_0: - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); - m_PrefsRadioStation = HEAD_RADIO; - SaveSettings(); - DMAudio.SetRadioInCar(m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); - OutputDebugString("FRONTEND RADIO STATION CHANGED"); - break; - case HOVEROPTION_RADIO_1: - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); - m_PrefsRadioStation = DOUBLE_CLEF; - SaveSettings(); - DMAudio.SetRadioInCar(m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); - OutputDebugString("FRONTEND RADIO STATION CHANGED"); - break; - case HOVEROPTION_RADIO_2: - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); - m_PrefsRadioStation = JAH_RADIO; - SaveSettings(); - DMAudio.SetRadioInCar(m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); - OutputDebugString("FRONTEND RADIO STATION CHANGED"); - break; - case HOVEROPTION_RADIO_3: - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); - m_PrefsRadioStation = RISE_FM; - SaveSettings(); - DMAudio.SetRadioInCar(m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); - OutputDebugString("FRONTEND RADIO STATION CHANGED"); - break; - case HOVEROPTION_RADIO_4: - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); - m_PrefsRadioStation = LIPS_106; - SaveSettings(); - DMAudio.SetRadioInCar(m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); - OutputDebugString("FRONTEND RADIO STATION CHANGED"); - break; - case HOVEROPTION_RADIO_5: - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); - m_PrefsRadioStation = GAME_FM; - SaveSettings(); - DMAudio.SetRadioInCar(m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); - OutputDebugString("FRONTEND RADIO STATION CHANGED"); - break; - case HOVEROPTION_RADIO_6: - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); - m_PrefsRadioStation = MSX_FM; - SaveSettings(); - DMAudio.SetRadioInCar(m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); - OutputDebugString("FRONTEND RADIO STATION CHANGED"); - break; - case HOVEROPTION_RADIO_7: - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); - m_PrefsRadioStation = FLASHBACK; - SaveSettings(); - DMAudio.SetRadioInCar(m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); - OutputDebugString("FRONTEND RADIO STATION CHANGED"); - break; - case HOVEROPTION_RADIO_8: - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); - m_PrefsRadioStation = CHATTERBOX; - SaveSettings(); - DMAudio.SetRadioInCar(m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); - OutputDebugString("FRONTEND RADIO STATION CHANGED"); - break; - case HOVEROPTION_RADIO_9: - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); - m_PrefsRadioStation = USERTRACK; - SaveSettings(); - DMAudio.SetRadioInCar(m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); - OutputDebugString("FRONTEND RADIO STATION CHANGED"); - break; - case HOVEROPTION_RANDOM_ITEM: - if (((m_nCurrOption != 0) || (m_nCurrScreen != MENUPAGE_PAUSE_MENU)) { - m_nCurrOption = m_nOptionMouseHovering; - optionSelected = true; - } - break; } -#endif } if (CPad::GetPad(0)->GetLeftMouse()) { -#ifndef TIDY_UP_PBP switch (m_nHoverOption) { case HOVEROPTION_INCREASE_BRIGHTNESS: - m_PrefsBrightness = m_PrefsBrightness + 32; - if (m_PrefsBrightness < 0) { - m_PrefsBrightness = 0; - } - if (510 < m_PrefsBrightness) { - m_PrefsBrightness = 511; - } - SaveSettings(); - break; - case HOVEROPTION_DECREASE_BRIGHTNESS: - m_PrefsBrightness = m_PrefsBrightness - 32; - if (m_PrefsBrightness < 0) { - m_PrefsBrightness = 0; - } - if (510 < m_PrefsBrightness) { - m_PrefsBrightness = 511; - } - SaveSettings(); - break; + case HOVEROPTION_INCREASE_MP3BOOST: case HOVEROPTION_INCREASE_DRAWDIST: - m_PrefsLOD = m_PrefsLOD + (1.0f / 16); - m_PrefsLOD = min(1.8f, m_PrefsLOD); - CRenderer::ms_lodDistScale = m_PrefsLOD; - SaveSettings(); - break; - case HOVEROPTION_DECREASE_DRAWDIST: - m_PrefsLOD = m_PrefsLOD - (1.0f / 16); - m_PrefsLOD = max(0.8f, m_PrefsLOD); - CRenderer::ms_lodDistScale = m_PrefsLOD; - SaveSettings(); - break; case HOVEROPTION_INCREASE_MUSICVOLUME: - m_PrefsMusicVolume = m_PrefsMusicVolume + 8; - m_PrefsMusicVolume = clamp(m_PrefsMusicVolume, 0, 127); - DMAudio.SetMusicMasterVolume(uchar)(m_PrefsMusicVolume); - SaveSettings(); - break; - case HOVEROPTION_DECREASE_MUSICVOLUME: - m_PrefsMusicVolume = m_PrefsMusicVolume - 8; - if (m_PrefsMusicVolume < 0) { - m_PrefsMusicVolume = 0; - } - if (126 < m_PrefsMusicVolume) { - m_PrefsMusicVolume = 127; - } - DMAudio.SetMusicMasterVolume(uchar)(m_PrefsMusicVolume); - SaveSettings(); - break; case HOVEROPTION_INCREASE_SFXVOLUME: - m_PrefsSFXVolume = m_PrefsSFXVolume + 8; - if (m_PrefsSFXVolume < 0) { - m_PrefsSFXVolume = 0; - } - if (126 < m_PrefsSFXVolume) { - m_PrefsSFXVolume = 127; - } - DMAudio.SetEffectsMasterVolume(uchar)(m_PrefsSFXVolume); - SaveSettings(); - break; - case HOVEROPTION_DECREASE_SFXVOLUME: - m_PrefsSFXVolume = m_PrefsSFXVolume - 8; - if (m_PrefsSFXVolume < 0) { - m_PrefsSFXVolume = 0; - } - if (126 < m_PrefsSFXVolume) { - m_PrefsSFXVolume = 127; - } - DMAudio.SetEffectsMasterVolume(uchar)(m_PrefsSFXVolume); - SaveSettings(); - break; case HOVEROPTION_INCREASE_MOUSESENS: - TheCamera.m_fMouseAccelHorzntl += (1.0f / 3000); - TheCamera.m_fMouseAccelHorzntl = clamp(TheCamera.m_fMouseAccelHorzntl, 1.0f / 3200, 1.0f / 200); - SaveSettings(); + CheckSliderMovement(1); break; + case HOVEROPTION_DECREASE_BRIGHTNESS: + case HOVEROPTION_DECREASE_MP3BOOST: + case HOVEROPTION_DECREASE_DRAWDIST: + case HOVEROPTION_DECREASE_MUSICVOLUME: + case HOVEROPTION_DECREASE_SFXVOLUME: case HOVEROPTION_DECREASE_MOUSESENS: - TheCamera.m_fMouseAccelHorzntl -= (1.0f / 3000); - TheCamera.m_fMouseAccelHorzntl = clamp(TheCamera.m_fMouseAccelHorzntl, 1.0f / 3200, 1.0f / 200); - SaveSettings(); + CheckSliderMovement(-1); break; } -#else - switch (m_nHoverOption) { - case HOVEROPTION_INCREASE_BRIGHTNESS: - case HOVEROPTION_INCREASE_DRAWDIST: - case HOVEROPTION_INCREASE_MUSICVOLUME: - case HOVEROPTION_INCREASE_SFXVOLUME: - case HOVEROPTION_INCREASE_MOUSESENS: - CheckSliderMovement(1); - break; - case HOVEROPTION_DECREASE_BRIGHTNESS: - case HOVEROPTION_DECREASE_DRAWDIST: - case HOVEROPTION_DECREASE_MUSICVOLUME: - case HOVEROPTION_DECREASE_SFXVOLUME: - case HOVEROPTION_DECREASE_MOUSESENS: - CheckSliderMovement(-1); - break; - } -#endif } if (CPad::GetPad(0)->GetLeftMouseJustUp() || CPad::GetPad(0)->GetLeftJustUp() || CPad::GetPad(0)->GetRightJustUp() @@ -4229,23 +3972,19 @@ CMenuManager::ProcessButtonPresses(void) || CPad::GetPad(0)->GetAnaloguePadLeftJustUp() || CPad::GetPad(0)->GetAnaloguePadRightJustUp() || CPad::GetPad(0)->GetMouseWheelUpJustDown() || CPad::GetPad(0)->GetMouseWheelDownJustDown()) { int option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action; - if (option == MENUACTION_BRIGHTNESS || option == MENUACTION_DRAWDIST) - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); + if (option == MENUACTION_BRIGHTNESS) + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0); else if (option == MENUACTION_SFXVOLUME) DMAudio.PlayFrontEndSound(SOUND_FRONTEND_AUDIO_TEST, 0); - else if (option == MENUACTION_MOUSESENS) - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); + else if (option == MENUACTION_DRAWDIST || option == MENUACTION_MOUSESTEER) + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0); } - if (CPad::GetPad(0)->GetBackJustDown()) { - if (m_nCurrScreen != MENUPAGE_START_MENU && m_nCurrScreen != MENUPAGE_PAUSE_MENU) { - m_bShowMouse = false; - goBack = true; - } - } - - if (CPad::GetPad(0)->GetEscapeJustDown()) { - if (m_nCurrScreen != MENUPAGE_START_MENU) { + if (CPad::GetPad(0)->GetBackJustDown() || CPad::GetPad(0)->GetEscapeJustDown()) { + if (m_nCurrScreen != MENUPAGE_NONE && m_nCurrScreen != MENUPAGE_PAUSE_MENU && m_nCurrScreen != MENUPAGE_CHOOSE_SAVE_SLOT + && m_nCurrScreen != MENUPAGE_SAVE_CHEAT_WARNING && m_nCurrScreen != MENUPAGE_SAVING_IN_PROGRESS + && m_nCurrScreen != MENUPAGE_DELETING_IN_PROGRESS && m_nCurrScreen != MENUPAGE_OUTRO) + { m_bShowMouse = false; goBack = true; } @@ -4254,8 +3993,156 @@ CMenuManager::ProcessButtonPresses(void) if (((goDown) || (goUp)) || (optionSelected)) { goBack = false; } + + } + + int curAction = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action; + if (CPad::GetPad(0)->GetLeft() || CPad::GetPad(0)->GetPedWalkLeftRight() < 0 || CPad::GetPad(0)->GetDPadLeft()) { + static PauseModeTime lastSliderDecrease = 0; + if (CTimer::GetTimeInMillisecondsPauseMode() - lastSliderDecrease > 150) { + if (curAction == MENUACTION_BRIGHTNESS || curAction == MENUACTION_MUSICVOLUME || + curAction == MENUACTION_SFXVOLUME || curAction == MENUACTION_RADIO || + curAction == MENUACTION_DRAWDIST || curAction == MENUACTION_MOUSESENS || + curAction == MENUACTION_MP3VOLUMEBOOST) + changeValueBy = -1; + + lastSliderDecrease = CTimer::GetTimeInMillisecondsPauseMode(); + } + } else if (CPad::GetPad(0)->GetRight() || CPad::GetPad(0)->GetPedWalkLeftRight() > 0 || CPad::GetPad(0)->GetDPadRight()) { + static PauseModeTime lastSliderIncrease = 0; + if (CTimer::GetTimeInMillisecondsPauseMode() - lastSliderIncrease > 150) { + if (curAction == MENUACTION_BRIGHTNESS || curAction == MENUACTION_MUSICVOLUME || + curAction == MENUACTION_SFXVOLUME || curAction == MENUACTION_RADIO || + curAction == MENUACTION_DRAWDIST || curAction == MENUACTION_MOUSESENS || + curAction == MENUACTION_MP3VOLUMEBOOST) + changeValueBy = 1; + lastSliderIncrease = CTimer::GetTimeInMillisecondsPauseMode(); + } + } + + if (CPad::GetPad(0)->GetMouseWheelUpJustDown()) { + changeValueBy = 1; + } else if (CPad::GetPad(0)->GetMouseWheelDownJustDown()) { + changeValueBy = -1; + } + + if (m_AllowNavigation) { + if (CPad::GetPad(0)->GetRightJustDown() || CPad::GetPad(0)->GetAnaloguePadRight() || CPad::GetPad(0)->GetDPadRightJustDown()) { + m_bShowMouse = false; + changeValueBy = 1; + } + } + + if (m_AllowNavigation) { + if (CPad::GetPad(0)->GetLeftJustDown() || CPad::GetPad(0)->GetAnaloguePadLeft() || CPad::GetPad(0)->GetDPadLeftJustDown()) { + m_bShowMouse = false; + changeValueBy = -1; + } } + if (changeValueBy != 0) { + if ((m_nCurrScreen == MENUPAGE_SOUND_SETTINGS || m_nCurrScreen == MENUPAGE_GRAPHICS_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 + && aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_NO + && aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_CHANGEMENU + && aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_KEYBOARDCTRLS + && aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_GOBACK + && aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_RESTOREDEF + && aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_DRAWDIST + && aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_MOUSESENS + && aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action != MENUACTION_MP3VOLUMEBOOST) { + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0); + } + } + ProcessButtonPresses(goDown, goUp, optionSelected, goBack, changeValueBy); +} + +// TODO(Miami) +// Also rename it to ProcessUserInput when it's done +void +CMenuManager::ProcessButtonPresses(uint8 goDown, uint8 goUp, uint8 optionSelected, uint8 goBack, int8 changeAmount) +{ + if (m_nCurrScreen == MENUPAGE_OUTRO) + return; + + if (m_bWaitingForNewKeyBind) { + if (m_bStartWaitingForKeyBind) + m_bStartWaitingForKeyBind = false; + else { + pControlEdit = CPad::EditCodesForControls(pControlEdit, 1); + JoyButtonJustClicked = false; + MouseButtonJustClicked = false; + + if (CPad::GetPad(0)->GetLeftMouseJustDown()) + MouseButtonJustClicked = 1; + else if (CPad::GetPad(0)->GetRightMouseJustUp()) + MouseButtonJustClicked = 3; + else if (CPad::GetPad(0)->GetMiddleMouseJustUp()) + MouseButtonJustClicked = 2; + else if (CPad::GetPad(0)->GetMouseWheelUpJustUp()) + MouseButtonJustClicked = 4; + else if (CPad::GetPad(0)->GetMouseWheelDownJustUp()) + MouseButtonJustClicked = 5; + // TODO two more buttons + + JoyButtonJustClicked = ControlsManager.GetJoyButtonJustDown(); + + int32 TypeOfControl = KEYBOARD; + if (JoyButtonJustClicked) + TypeOfControl = JOYSTICK; + if (MouseButtonJustClicked) + TypeOfControl = MOUSE; + if (*pControlEdit != rsNULL) + TypeOfControl = KEYBOARD; + if (!m_bKeyIsOK) { + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0); + pControlEdit = nil; + m_bWaitingForNewKeyBind = false; + m_KeyPressedCode = -1; + m_bStartWaitingForKeyBind = false; + } + else if (!m_bKeyChangeNotProcessed) { + if (*pControlEdit != rsNULL || MouseButtonJustClicked || JoyButtonJustClicked) + CheckCodesForControls(TypeOfControl); + + field_159 = true; + } + else { + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); + for (int i = 0; i < 4; i++) + ControlsManager.ClearSettingsAssociatedWithAction((e_ControllerAction)m_CurrCntrlAction, (eControllerType)i); + m_bKeyIsOK = false; + m_bKeyChangeNotProcessed = false; + pControlEdit = nil; + m_bWaitingForNewKeyBind = false; + m_KeyPressedCode = -1; + m_bStartWaitingForKeyBind = false; + } + } + } + + if (pEditString || pControlEdit) + return; + +#ifdef USE_DEBUG_SCRIPT_LOADER + if (m_nCurrScreen == MENUPAGE_START_MENU || m_nCurrScreen == MENUPAGE_NEW_GAME || m_nCurrScreen == MENUPAGE_NEW_GAME_RELOAD) { +#ifdef RW_GL3 + if (glfwGetKey(PSGLOBAL(window), GLFW_KEY_R) == GLFW_PRESS) { + scriptToLoad = 1; + DoSettingsBeforeStartingAGame(); + return; + } +#elif defined _WIN32 + if (GetAsyncKeyState('R') & 0x8000) { + scriptToLoad = 1; + DoSettingsBeforeStartingAGame(); + return; + } +#endif + } +#endif #ifdef PS2_LIKE_MENU if (CPad::GetPad(0)->GetLeftMouseJustDown() && hoveredBottomBarOption != -1) { @@ -4296,11 +4183,14 @@ CMenuManager::ProcessButtonPresses(void) } #endif + int oldOption = m_nCurrOption; if (goDown) { m_nCurrOption++; if (m_nCurrOption == NUM_MENUROWS || (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action == MENUACTION_NOTHING)) { m_nCurrOption = 0; } + if (oldOption != m_nCurrOption) + m_nOptionHighlightTransitionBlend = 0; } if (goUp) { if (m_nCurrOption == (aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL)) { @@ -4311,6 +4201,8 @@ CMenuManager::ProcessButtonPresses(void) } else { m_nCurrOption--; } + if (oldOption != m_nCurrOption) + m_nOptionHighlightTransitionBlend = 0; } if (optionSelected) { @@ -4321,10 +4213,10 @@ CMenuManager::ProcessButtonPresses(void) strncmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FESZ_CA", 8) != 0) { if (m_nCurrScreen == MENUPAGE_CHOOSE_DELETE_SLOT) { - if (Slots[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_SaveSlot - 1] == SLOT_EMPTY) - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0); + if (Slots[m_nCurrOption] != SLOT_OK) + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_BACK, 0); else - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); + DMAudio.PlayFrontEndSound(SOUND_FRONTEND_FAIL, 0); } else DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); } else { @@ -4399,21 +4291,17 @@ CMenuManager::ProcessButtonPresses(void) option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action; switch (option) { case MENUACTION_RADIO: -#ifdef TIDY_UP_PBP - assumeIncrease = true; -#else ++m_PrefsRadioStation; if (DMAudio.IsMP3RadioChannelAvailable()) { if (m_PrefsRadioStation > USERTRACK) - m_PrefsRadioStation = HEAD_RADIO; - } else if (m_PrefsRadioStation > CHATTERBOX) { + m_PrefsRadioStation = WILDSTYLE; + } else if (m_PrefsRadioStation > WAVE) { m_PrefsRadioStation = USERTRACK; } SaveSettings(); DMAudio.SetRadioInCar(m_PrefsRadioStation); DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); OutputDebugString("FRONTEND RADIO STATION CHANGED"); -#endif break; case MENUACTION_LANG_ENG: m_PrefsLanguage = LANGUAGE_AMERICAN; @@ -4471,7 +4359,7 @@ CMenuManager::ProcessButtonPresses(void) if (saveSlot >= 2 && saveSlot <= 9) { m_nCurrSaveSlot = saveSlot - 2; - if (Slots[m_nCurrSaveSlot + 1] != SLOT_EMPTY && Slots[m_nCurrSaveSlot + 1] != SLOT_CORRUPTED) { + if (Slots[m_nCurrSaveSlot] != SLOT_EMPTY && Slots[m_nCurrSaveSlot] != SLOT_CORRUPTED) { if (m_nCurrScreen == MENUPAGE_CHOOSE_LOAD_SLOT) { SwitchToNewScreen(MENUPAGE_LOAD_SLOT_CONFIRM); } else if (m_nCurrScreen == MENUPAGE_CHOOSE_DELETE_SLOT) { @@ -4554,16 +4442,12 @@ CMenuManager::ProcessButtonPresses(void) break; } case MENUACTION_SPEAKERCONF: -#ifndef TIDY_UP_PBP if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) { if (--m_PrefsSpeakers < 0) m_PrefsSpeakers = 2; DMAudio.SetSpeakerConfig(m_PrefsSpeakers); SaveSettings(); } -#else - assumeIncrease = true; -#endif break; case MENUACTION_PLAYERSETUP: CPlayerSkin::BeginFrontendSkinEdit(); @@ -4633,7 +4517,6 @@ CMenuManager::ProcessButtonPresses(void) SetHelperText(2); break; case MENUACTION_CTRLMETHOD: -#ifndef TIDY_UP_PBP if (m_ControlMethod == CONTROL_CLASSIC) { CCamera::m_bUseMouse3rdPerson = true; m_ControlMethod = CONTROL_STANDARD; @@ -4642,9 +4525,6 @@ CMenuManager::ProcessButtonPresses(void) m_ControlMethod = CONTROL_CLASSIC; } SaveSettings(); -#else - assumeIncrease = true; -#endif break; case MENUACTION_LOADRADIO: SwitchToNewScreen(MENUPAGE_SOUND_SETTINGS); @@ -4760,58 +4640,11 @@ CMenuManager::ProcessButtonPresses(void) return; #endif - int changeValueBy = 0; - bool decrease = false; -#ifdef TIDY_UP_PBP - bool increase = assumeIncrease; -#else - bool increase = false; -#endif - if (CPad::GetPad(0)->GetLeft() || CPad::GetPad(0)->GetPedWalkLeftRight() < 0 || CPad::GetPad(0)->GetDPadLeft()) { - static PauseModeTime lastSliderDecrease = 0; - if (CTimer::GetTimeInMillisecondsPauseMode() - lastSliderDecrease > 150) { - CheckSliderMovement(-1); - lastSliderDecrease = CTimer::GetTimeInMillisecondsPauseMode(); - } - } else if (CPad::GetPad(0)->GetRight() || CPad::GetPad(0)->GetPedWalkLeftRight() > 0 || CPad::GetPad(0)->GetDPadRight()) { - static PauseModeTime lastSliderIncrease = 0; - if (CTimer::GetTimeInMillisecondsPauseMode() - lastSliderIncrease > 150) { - CheckSliderMovement(1); - lastSliderIncrease = CTimer::GetTimeInMillisecondsPauseMode(); - } - } - - if (CPad::GetPad(0)->GetRightJustDown() || CPad::GetPad(0)->GetAnaloguePadRight() || CPad::GetPad(0)->GetDPadRightJustDown()) { - m_bShowMouse = false; - increase = true; - } else if (CPad::GetPad(0)->GetMouseWheelUpJustDown() && m_nCurrScreen != MENUPAGE_KEYBOARD_CONTROLS) { - increase = true; - CheckSliderMovement(1); - m_bShowMouse = true; - } - - if (!CPad::GetPad(0)->GetLeftJustDown() && !CPad::GetPad(0)->GetAnaloguePadLeft() && !CPad::GetPad(0)->GetDPadLeftJustDown()) { - if (CPad::GetPad(0)->GetMouseWheelDownJustDown()) { - if (m_nCurrScreen != MENUPAGE_KEYBOARD_CONTROLS) { - decrease = true; - CheckSliderMovement(-1); - m_bShowMouse = true; - } - } - } else { - m_bShowMouse = false; - decrease = true; - } - - if (increase) - changeValueBy++; - else if (decrease) - changeValueBy--; - if (changeValueBy != 0) { + if (changeAmount != 0) { switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) { case MENUACTION_RADIO: - m_PrefsRadioStation += changeValueBy; + m_PrefsRadioStation += changeAmount; DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); if (DMAudio.IsMP3RadioChannelAvailable()) { if (m_PrefsRadioStation < WILDSTYLE) @@ -4831,7 +4664,7 @@ CMenuManager::ProcessButtonPresses(void) break; #ifdef ASPECT_RATIO_SCALE case MENUACTION_WIDESCREEN: - if (changeValueBy > 0) { + if (changeAmount > 0) { m_PrefsUseWideScreen++; if (m_PrefsUseWideScreen > 2) m_PrefsUseWideScreen = 0; @@ -4848,7 +4681,7 @@ CMenuManager::ProcessButtonPresses(void) if (m_bGameNotLoaded) { RwChar** videoMods = _psGetVideoModeList(); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); - if (changeValueBy > 0) { + if (changeAmount > 0) { do { ++m_nDisplayVideoMode; @@ -4873,14 +4706,14 @@ CMenuManager::ProcessButtonPresses(void) #endif case MENUACTION_AUDIOHW: if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) { - m_nPrefsAudio3DProviderIndex += changeValueBy; + m_nPrefsAudio3DProviderIndex += changeAmount; m_nPrefsAudio3DProviderIndex = clamp(m_nPrefsAudio3DProviderIndex, 0, DMAudio.GetNum3DProvidersAvailable() - 1); } DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); break; case MENUACTION_SPEAKERCONF: if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) { - m_PrefsSpeakers -= changeValueBy; + m_PrefsSpeakers -= changeAmount; m_PrefsSpeakers = clamp(m_PrefsSpeakers, 0, 2); DMAudio.SetSpeakerConfig(m_PrefsSpeakers); SaveSettings(); @@ -4898,7 +4731,7 @@ CMenuManager::ProcessButtonPresses(void) 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 (changeValueBy > 0) { + if (changeAmount > 0) { option.displayedValue++; if (option.displayedValue >= option.numRightTexts) option.displayedValue = 0; @@ -4912,7 +4745,7 @@ CMenuManager::ProcessButtonPresses(void) *option.value = option.displayedValue; } } else if (option.type == FEOPTION_DYNAMIC) { - option.buttonPressFunc(changeValueBy > 0 ? FEOPTION_ACTION_RIGHT : FEOPTION_ACTION_LEFT); + option.buttonPressFunc(changeAmount > 0 ? FEOPTION_ACTION_RIGHT : FEOPTION_ACTION_LEFT); } DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0); } @@ -4924,14 +4757,14 @@ CMenuManager::ProcessButtonPresses(void) break; #endif } + CheckSliderMovement(changeAmount); ProcessOnOffMenuOptions(); if (m_nCurrScreen == MENUPAGE_KEYBOARD_CONTROLS) { - if (changeValueBy < 1) { + if (changeAmount < 1) { m_nSelectedContSetupColumn = CONTSETUP_PED_COLUMN; } else { m_nSelectedContSetupColumn = CONTSETUP_VEHICLE_COLUMN; } - DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_NEW_PAGE, 0); } } } @@ -5226,9 +5059,13 @@ CMenuManager::SwitchMenuOnAndOff() Initialise(); LoadAllTextures(); - // TODO(Miami): Cheat warning - m_nCurrScreen = MENUPAGE_CHOOSE_SAVE_SLOT; - m_nCurrOption = 8; + if (CPad::bHasPlayerCheated) { + m_nCurrScreen = MENUPAGE_SAVE_CHEAT_WARNING; + m_nCurrOption = 0; + } else { + m_nCurrScreen = MENUPAGE_CHOOSE_SAVE_SLOT; + m_nCurrOption = 8; + } } m_bStartUpFrontEndRequested = false; @@ -5262,7 +5099,7 @@ CMenuManager::UnloadTextures() m_bSpritesLoaded = false; } m_OnlySaveMenu = false; - // TODO(Miami): Place name thing + CUserDisplay::PlaceName.ProcessAfterFrontEndShutDown(); } void @@ -5565,27 +5402,6 @@ CMenuManager::ConstructStatLine(int rowIdx) STAT_LINE("DED_CRI", &(nTemp = CStats::PedsKilledOfThisType[PEDTYPE_CRIMINAL]), false, nil); STAT_LINE("HEL_DST", &CStats::HelisDestroyed, false, nil); STAT_LINE("KGS_EXP", &CStats::KgsOfExplosivesUsed, false, nil); - STAT_LINE("ACCURA", &(nTemp = (CStats::InstantHitsFiredByPlayer == 0 ? 0 : - CStats::InstantHitsHitByPlayer * 100.0f / CStats::InstantHitsFiredByPlayer)), false, nil); - - if (CStats::ElBurroTime > 0) { - STAT_LINE("ELBURRO", &CStats::ElBurroTime, false, nil); - } - if (CStats::Record4x4One > 0) { - STAT_LINE("FEST_R1", &CStats::Record4x4One, false, nil); - } - if (CStats::Record4x4Two > 0) { - STAT_LINE("FEST_R2", &CStats::Record4x4Two, false, nil); - } - if (CStats::Record4x4Three > 0) { - STAT_LINE("FEST_R3", &CStats::Record4x4Three, false, nil); - } - if (CStats::Record4x4Mayhem > 0) { - STAT_LINE("FEST_RM", &CStats::Record4x4Mayhem, false, nil); - } - if (CStats::TimeTakenDefuseMission > 0) { - STAT_LINE("FEST_BD", &CStats::TimeTakenDefuseMission, false, nil); - } if (CStats::HighestScores[0] > 0) { STAT_LINE("FEST_BB", nil, false, nil); @@ -5612,7 +5428,11 @@ CMenuManager::ConstructStatLine(int rowIdx) #ifndef USE_MEASUREMENTS_IN_METERS float fTemp; STAT_LINE("FEST_DF", &(fTemp = CStats::DistanceTravelledOnFoot * MILES_IN_METER), true, nil); - STAT_LINE("FEST_DC", &(fTemp = CStats::DistanceTravelledInVehicle * MILES_IN_METER), true, nil); + STAT_LINE("FEST_DC", &(fTemp = CStats::DistanceTravelledByCar * MILES_IN_METER), true, nil); + STAT_LINE("DISTBIK", &(fTemp = CStats::DistanceTravelledByBike * MILES_IN_METER), true, nil); + STAT_LINE("DISTBOA", &(fTemp = CStats::DistanceTravelledByBoat * MILES_IN_METER), true, nil); + STAT_LINE("DISTGOL", &(fTemp = CStats::DistanceTravelledByGolfCart * MILES_IN_METER), true, nil); + STAT_LINE("DISTHEL", &(fTemp = CStats::DistanceTravelledByHelicoptor * MILES_IN_METER), true, nil); STAT_LINE("MXCARD", &(fTemp = CStats::MaximumJumpDistance * FEET_IN_METER), true, nil); STAT_LINE("MXCARJ", &(fTemp = CStats::MaximumJumpHeight * FEET_IN_METER), true, nil); break; @@ -5627,7 +5447,11 @@ CMenuManager::ConstructStatLine(int rowIdx) case LANGUAGE_JAPANESE: #endif STAT_LINE("FESTDFM", &CStats::DistanceTravelledOnFoot, true, nil); - STAT_LINE("FESTDCM", &CStats::DistanceTravelledInVehicle, true, nil); + STAT_LINE("FESTDCM", &CStats::DistanceTravelledByCar, true, nil); + STAT_LINE("DISTBIM", &CStats::DistanceTravelledByBike, true, nil); + STAT_LINE("DISTBOM", &CStats::DistanceTravelledByBoat, true, nil); + STAT_LINE("DISTGOM", &CStats::DistanceTravelledByGolfCart, true, nil); + STAT_LINE("DISTHEM", &CStats::DistanceTravelledByHelicoptor, true, nil); STAT_LINE("MXCARDM", &CStats::MaximumJumpDistance, true, nil); STAT_LINE("MXCARJM", &CStats::MaximumJumpHeight, true, nil); break; diff --git a/src/core/Frontend.h b/src/core/Frontend.h index 83d86d5b..e64eae98 100644 --- a/src/core/Frontend.h +++ b/src/core/Frontend.h @@ -318,6 +318,8 @@ enum eCheckHover HOVEROPTION_DECREASE_SFXVOLUME, HOVEROPTION_INCREASE_MOUSESENS, HOVEROPTION_DECREASE_MOUSESENS, + HOVEROPTION_INCREASE_MP3BOOST, + HOVEROPTION_DECREASE_MP3BOOST, HOVEROPTION_NOT_HOVERING, }; @@ -633,7 +635,9 @@ public: static void PrintErrorMessage(); void PrintStats(); void Process(); - void ProcessButtonPresses(); + void ProcessList(bool &optionSelected, bool &goBack); + void UserInput(); + void ProcessButtonPresses(uint8, uint8, uint8, uint8, int8); void ProcessFileActions(); void ProcessOnOffMenuOptions(); void RequestFrontEndShutDown(); diff --git a/src/core/Frontend_PS2.cpp b/src/core/Frontend_PS2.cpp index 8e604978..d9eff445 100644 --- a/src/core/Frontend_PS2.cpp +++ b/src/core/Frontend_PS2.cpp @@ -1179,30 +1179,9 @@ CMenuManager::InitialiseMenuContents(void) STAT_LINE("KGS_EXP", &CStats::KgsOfExplosivesUsed, 0, nil); - nTemp = (CStats::InstantHitsFiredByPlayer == 0 ? 0 : CStats::InstantHitsHitByPlayer * 100.0f / CStats::InstantHitsFiredByPlayer); - STAT_LINE("ACCURA", &nTemp, 0, nil); - - if (CStats::ElBurroTime > 0) - STAT_LINE("ELBURRO", &CStats::ElBurroTime, 0, nil); - - if (CStats::Record4x4One > 0) - STAT_LINE("FEST_R1", &CStats::Record4x4One, 0, nil); - - if (CStats::Record4x4Two > 0) - STAT_LINE("FEST_R2", &CStats::Record4x4Two, 0, nil); - - if (CStats::Record4x4Three > 0) - STAT_LINE("FEST_R3", &CStats::Record4x4Three, 0, nil); - - if (CStats::Record4x4Mayhem > 0) - STAT_LINE("FEST_RM", &CStats::Record4x4Mayhem, 0, nil); - if (CStats::LongestFlightInDodo > 0) STAT_LINE("FEST_LF", &CStats::LongestFlightInDodo, 0, nil); - if (CStats::TimeTakenDefuseMission > 0) - STAT_LINE("FEST_BD", &CStats::TimeTakenDefuseMission, 0, nil); - STAT_LINE("CAR_CRU", &CStats::CarsCrushed, 0, nil); if (CStats::HighestScores[0] > 0) @@ -1231,7 +1210,11 @@ CMenuManager::InitialiseMenuContents(void) STAT_LINE("FEST_H4", &CStats::HighestScores[4], 0, nil); STAT_LINE("FESTDFM", &CStats::DistanceTravelledOnFoot, 0, nil); - STAT_LINE("FESTDCM", &CStats::DistanceTravelledInVehicle, 0, nil); + STAT_LINE("FESTDCM", &CStats::DistanceTravelledByCar, 0, nil); + STAT_LINE("DISTBIM", &CStats::DistanceTravelledByBike, 0, nil); + STAT_LINE("DISTBOM", &CStats::DistanceTravelledByBoat, 0, nil); + STAT_LINE("DISTGOM", &CStats::DistanceTravelledByGolfCart, 0, nil); + STAT_LINE("DISTHEM", &CStats::DistanceTravelledByHelicoptor, 0, nil); STAT_LINE("MMRAIN", &CStats::mmRain, 0, nil); nTemp = (int32)CStats::MaximumJumpDistance; STAT_LINE("MXCARDM", &nTemp, 0, nil); diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index c1016bdd..6d6c30e4 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -41,6 +41,7 @@ #include "Fluff.h" #include "Gangs.h" #include "platform.h" +#include "Stats.h" #ifdef GTA_PS2 #include "eetypes.h" @@ -59,6 +60,7 @@ bool CPad::bDisplayNoControllerMessage; bool CPad::bObsoleteControllerMessage; bool CPad::bOldDisplayNoControllerMessage; bool CPad::m_bMapPadOneToPadTwo; +bool CPad::bHasPlayerCheated; #ifdef GTA_PS2 unsigned char act_direct[6]; unsigned char act_align[6]; @@ -228,6 +230,8 @@ void VehicleCheat(bool something, int model) CWorld::Add(vehicle); } } + CStats::CheatedCount += 1000; + CPad::bHasPlayerCheated = true; } void BlowUpCarsCheat() @@ -287,6 +291,8 @@ void MayhemCheat() PED_FLAG_GANG2 | PED_FLAG_GANG3 | PED_FLAG_GANG4 | PED_FLAG_GANG5 | PED_FLAG_GANG6 | PED_FLAG_GANG7 | PED_FLAG_GANG8 | PED_FLAG_GANG9 | PED_FLAG_EMERGENCY | PED_FLAG_PROSTITUTE | PED_FLAG_CRIMINAL | PED_FLAG_SPECIAL ); + CStats::CheatedCount += 1000; + CPad::bHasPlayerCheated = true; } void EverybodyAttacksPlayerCheat() @@ -294,12 +300,17 @@ void EverybodyAttacksPlayerCheat() CHud::SetHelpMessage(TheText.Get("CHEAT1"), true); for (int i = PEDTYPE_CIVMALE; i < PEDTYPE_SPECIAL; i++) CPedType::AddThreat(i, PED_FLAG_PLAYER1); + + CStats::CheatedCount += 1000; + CPad::bHasPlayerCheated = true; } void WeaponsForAllCheat() { CHud::SetHelpMessage(TheText.Get("CHEAT1"), true); CPopulation::ms_bGivePedsWeapons = !CPopulation::ms_bGivePedsWeapons; + CStats::CheatedCount += 1000; + CPad::bHasPlayerCheated = true; } void FastTimeCheat() @@ -380,19 +391,24 @@ void OnlyRenderWheelsCheat() { CHud::SetHelpMessage(TheText.Get("CHEAT1"), true); CVehicle::bWheelsOnlyCheat = !CVehicle::bWheelsOnlyCheat; + CStats::CheatedCount += 1000; + CPad::bHasPlayerCheated = true; } - void ChittyChittyBangBangCheat() { CHud::SetHelpMessage(TheText.Get("CHEAT1"), true); CVehicle::bAllDodosCheat = !CVehicle::bAllDodosCheat; + CStats::CheatedCount += 1000; + CPad::bHasPlayerCheated = true; } void StrongGripCheat() { CHud::SetHelpMessage(TheText.Get("CHEAT1"), true); CVehicle::bCheat3 = !CVehicle::bCheat3; + CStats::CheatedCount += 1000; + CPad::bHasPlayerCheated = true; } void NastyLimbsCheat() @@ -404,6 +420,7 @@ void FannyMagnetCheat() { CHud::SetHelpMessage(TheText.Get("CHEAT1"), true); CPed::bFannyMagnetCheat = !CPed::bFannyMagnetCheat; + CPad::bHasPlayerCheated = true; } void BlackCarsCheat() @@ -437,6 +454,7 @@ void BackToTheFuture(void) { CHud::SetHelpMessage(TheText.Get("CHEAT1"), true); CVehicle::bHoverCheat = !CVehicle::bHoverCheat; + CPad::bHasPlayerCheated = true; } void SuicideCheat(void) { @@ -453,6 +471,8 @@ void DoChicksWithGunsCheat(void) { CStreaming::RemoveCurrentZonesModels(); CGangs::SetGangPedModels(GANG_PLAYER, MI_HFYBE, MI_WFYBE); CGangs::SetGangWeapons(GANG_PLAYER, WEAPONTYPE_M4, WEAPONTYPE_M4); + CStats::CheatedCount += 1000; + CPad::bHasPlayerCheated = true; } ////////////////////////////////////////////////////////////////////////// diff --git a/src/core/Pad.h b/src/core/Pad.h index 2a0bb7d3..4374bc1a 100644 --- a/src/core/Pad.h +++ b/src/core/Pad.h @@ -171,6 +171,7 @@ public: static bool bObsoleteControllerMessage; static bool bOldDisplayNoControllerMessage; static bool m_bMapPadOneToPadTwo; + static bool bHasPlayerCheated; static CKeyboardState OldKeyState; static CKeyboardState NewKeyState; diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp index 3c01a176..256bc1b7 100644 --- a/src/core/PlayerInfo.cpp +++ b/src/core/PlayerInfo.cpp @@ -30,7 +30,13 @@ #include "World.h" #include "ZoneCull.h" #include "main.h" +#include "Bike.h" +#include "Automobile.h" +#include "GameLogic.h" + +CVector lastPlayerPos; +// --MIAMI: Done void CPlayerInfo::SetPlayerSkin(char *skin) { @@ -38,6 +44,7 @@ CPlayerInfo::SetPlayerSkin(char *skin) LoadPlayerSkin(); } +// --MIAMI: Done const CVector & CPlayerInfo::GetPos() { @@ -50,16 +57,16 @@ CPlayerInfo::GetPos() return m_pPed->GetPosition(); } +// --MIAMI: Done void CPlayerInfo::LoadPlayerSkin() { DeletePlayerSkin(); m_pSkinTexture = CPlayerSkin::GetSkinTexture(m_aSkinName); - if (!m_pSkinTexture) - m_pSkinTexture = CPlayerSkin::GetSkinTexture(DEFAULT_SKIN_NAME); } +// --MIAMI: Done void CPlayerInfo::DeletePlayerSkin() { @@ -69,6 +76,7 @@ CPlayerInfo::DeletePlayerSkin() } } +// --MIAMI: Done void CPlayerInfo::KillPlayer() { @@ -81,6 +89,7 @@ CPlayerInfo::KillPlayer() CStats::TimesDied++; } +// --MIAMI: Done void CPlayerInfo::ArrestPlayer() { @@ -88,11 +97,13 @@ CPlayerInfo::ArrestPlayer() m_WBState = WBSTATE_BUSTED; m_nWBTime = CTimer::GetTimeInMilliseconds(); + m_nBustedAudioStatus = BUSTEDAUDIO_NONE; CDarkel::ResetOnPlayerDeath(); CMessages::AddBigMessage(TheText.Get("BUSTED"), 5000, 2); CStats::TimesArrested++; } +// --MIAMI: Done bool CPlayerInfo::IsPlayerInRemoteMode() { @@ -109,6 +120,7 @@ CPlayerInfo::PlayerFailedCriticalMission() CDarkel::ResetOnPlayerDeath(); } +// --MIAMI: Done void CPlayerInfo::Clear(void) { @@ -125,6 +137,8 @@ CPlayerInfo::Clear(void) m_nTrafficMultiplier = 0; m_fRoadDensity = 1.0f; m_bInRemoteMode = false; + field_D5 = false; + field_D6 = false; m_bUnusedTaxiThing = false; m_nUnusedTaxiTimer = 0; m_nCollectedPackages = 0; @@ -136,10 +150,25 @@ CPlayerInfo::Clear(void) m_nSexFrequency = 0; m_pHooker = nil; m_nTimeTankShotGun = 0; - field_248 = 0; + field_EC = 0; m_nUpsideDownCounter = 0; + m_nTimeCarSpentOnTwoWheels = 0; + m_nDistanceCarTravelledOnTwoWheels = 0; + m_nTimeNotFullyOnGround = 0; + m_nTimeSpentOnWheelie = 0; + m_nDistanceTravelledOnWheelie = 0.0f; + m_nTimeSpentOnStoppie = 0; + m_nDistanceTravelledOnStoppie = 0.0f; + m_nCancelWheelStuntTimer = 0; + m_nLastTimeCarSpentOnTwoWheels = 0; + m_nLastDistanceCarTravelledOnTwoWheels = 0; + m_nLastTimeSpentOnWheelie = 0; + m_nLastDistanceTravelledOnWheelie = 0; + m_nLastTimeSpentOnStoppie = 0; + m_nLastDistanceTravelledOnStoppie = 0; m_bInfiniteSprint = false; m_bFastReload = false; + m_bFireproof = false; m_nMaxHealth = m_nMaxArmour = 100; m_bGetOutOfJailFree = false; m_bGetOutOfHospitalFree = false; @@ -147,11 +176,12 @@ CPlayerInfo::Clear(void) m_nPreviousTimeRewardedForExplosion = 0; m_nExplosionsSinceLastReward = 0; m_nHavocLevel = 0; - m_fMediaAttention = 0; + m_fMediaAttention = 0.0f; m_nCurrentBustedAudio = 1; m_nBustedAudioStatus = BUSTEDAUDIO_NONE; } +// --MIAMI: Done void CPlayerInfo::BlowUpRCBuggy(bool actually) { @@ -163,6 +193,7 @@ CPlayerInfo::BlowUpRCBuggy(bool actually) m_pRemoteVehicle->BlowUpCar(FindPlayerPed()); } +// --MIAMI: Done void CPlayerInfo::CancelPlayerEnteringCars(CVehicle *car) { @@ -174,6 +205,7 @@ CPlayerInfo::CancelPlayerEnteringCars(CVehicle *car) m_pPed->ClearObjective(); } +// --MIAMI: Done void CPlayerInfo::MakePlayerSafe(bool toggle) { @@ -198,8 +230,7 @@ CPlayerInfo::MakePlayerSafe(bool toggle) CWorld::ExtinguishAllCarFiresInArea(GetPos(), 4000.0f); CReplay::DisableReplays(); - } - else { + } else { m_pPed->m_pWanted->m_bIgnoredByEveryone = false; CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PLAYERINFO); m_pPed->bBulletProof = false; @@ -214,18 +245,21 @@ CPlayerInfo::MakePlayerSafe(bool toggle) } } +// --MIAMI: Done bool CPlayerInfo::IsRestartingAfterDeath() { return m_WBState == WBSTATE_WASTED; } +// --MIAMI: Done bool CPlayerInfo::IsRestartingAfterArrest() { return m_WBState == WBSTATE_BUSTED; } +// --MIAMI: Done // lastCloseness is passed to other calls of this function void CPlayerInfo::EvaluateCarPosition(CEntity *carToTest, CPed *player, float carBoundCentrePedDist, float *lastCloseness, CVehicle **closestCarOutput) @@ -250,32 +284,7 @@ CPlayerInfo::EvaluateCarPosition(CEntity *carToTest, CPed *player, float carBoun } } -// There is something unfinished in here... Sadly all IDBs we have have it unfinished. -void -CPlayerInfo::AwardMoneyForExplosion(CVehicle *wreckedCar) -{ - if (CTimer::GetTimeInMilliseconds() - m_nPreviousTimeRewardedForExplosion < 6000) - ++m_nExplosionsSinceLastReward; - else - m_nExplosionsSinceLastReward = 1; - - m_nPreviousTimeRewardedForExplosion = CTimer::GetTimeInMilliseconds(); - int award = wreckedCar->pHandling->nMonetaryValue * 0.002f; - sprintf(gString, "$%d", award); -#ifdef MONEY_MESSAGES - // This line is a leftover from PS2, I don't know what it was meant to be. - // CVector sth(TheCamera.GetPosition() * 4.0f); - - CMoneyMessages::RegisterOne(wreckedCar->GetPosition() + CVector(0.0f, 0.0f, 2.0f), gString, 0, 255, 0, 2.0f, 0.5f); -#endif - CWorld::Players[CWorld::PlayerInFocus].m_nMoney += award; - - for (int i = m_nExplosionsSinceLastReward; i > 1; --i) { - CGeneral::GetRandomNumber(); - CWorld::Players[CWorld::PlayerInFocus].m_nMoney += award; - } -} - +// --MIAMI: Done void CPlayerInfo::SavePlayerInfo(uint8 *buf, uint32 *size) { @@ -293,12 +302,19 @@ CPlayerInfo::SavePlayerInfo(uint8 *buf, uint32 *size) CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages); CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bInfiniteSprint); CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFastReload); + CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFireproof); + CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxHealth); + CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxArmour); CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfJailFree); CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfHospitalFree); + CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bDriveByAllowed); CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName); + CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nBustedAudioStatus); + CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCurrentBustedAudio); #undef CopyToBuf } +// --MIAMI: Done void CPlayerInfo::LoadPlayerInfo(uint8 *buf, uint32 size) { @@ -313,12 +329,19 @@ CPlayerInfo::LoadPlayerInfo(uint8 *buf, uint32 size) CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages); CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bInfiniteSprint); CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFastReload); + CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFireproof); + CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxHealth); + CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxArmour); CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfJailFree); CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfHospitalFree); - CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName) + CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bDriveByAllowed); + CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName); + CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nBustedAudioStatus); + CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCurrentBustedAudio) #undef CopyFromBuf } +// --MIAMI: Done void CPlayerInfo::FindClosestCarSectorList(CPtrList& carList, CPed* ped, float unk1, float unk2, float unk3, float unk4, float* lastCloseness, CVehicle** closestCarOutput) { @@ -333,7 +356,7 @@ CPlayerInfo::FindClosestCarSectorList(CPtrList& carList, CPed* ped, float unk1, && (car->GetUp().z > 0.3f || (car->IsVehicle() && ((CVehicle*)car)->m_vehType == VEHICLE_TYPE_BIKE))) { CVector carCentre = car->GetBoundCentre(); - if (Abs(ped->GetPosition().z - carCentre.z) < 2.0f) { + if (Abs(ped->GetPosition().z - carCentre.z) < 2.0f || car->IsCar() && carCentre.z < ped->GetPosition().z && ped->GetPosition().z - 4.f < carCentre.z) { float dist = (ped->GetPosition() - carCentre).Magnitude2D(); if (dist <= 10.0f && !CCranes::IsThisCarBeingCarriedByAnyCrane(car)) { EvaluateCarPosition(car, ped, dist, lastCloseness, closestCarOutput); @@ -367,6 +390,157 @@ CPlayerInfo::Process(void) if (startTaxiTimer) m_nUnusedTaxiTimer = CTimer::GetTimeInMilliseconds(); + if (!m_pPed->InVehicle()) { + m_nTimeCarSpentOnTwoWheels = 0; + m_nTimeNotFullyOnGround = 0; + m_nTimeSpentOnWheelie = 0; + m_nTimeSpentOnStoppie = 0; + m_nCancelWheelStuntTimer = 0; + } else if (m_pPed->m_pMyVehicle->IsCar()) { + CAutomobile *car = (CAutomobile*)m_pPed->m_pMyVehicle; + + if (car->m_nWheelsOnGround < 3) + m_nTimeNotFullyOnGround += CTimer::GetTimeInMilliseconds(); + else + m_nTimeNotFullyOnGround = 0; + + if (car->m_aSuspensionSpringRatioPrev[2] == 1.f && car->m_aSuspensionSpringRatioPrev[3] == 1.f) { + if (car->m_aSuspensionSpringRatioPrev[0] < 1.0f && car->m_aSuspensionSpringRatioPrev[1] < 1.0f && car->m_fDamageImpulse == 0.0f) { + m_nTimeCarSpentOnTwoWheels += CTimer::GetTimeStepInMilliseconds(); + m_nDistanceCarTravelledOnTwoWheels += car->m_fDistanceTravelled; + m_nCancelWheelStuntTimer = Max(0.0f, m_nCancelWheelStuntTimer - CTimer::GetTimeStepInMilliseconds() * 0.5f); + + } else { + if (m_nTimeCarSpentOnTwoWheels != 0 && m_nCancelWheelStuntTimer < 500) { + m_nCancelWheelStuntTimer += CTimer::GetTimeStepInMilliseconds(); + } else { + if (m_nTimeCarSpentOnTwoWheels >= 2000) { + m_nLastTimeCarSpentOnTwoWheels = m_nTimeCarSpentOnTwoWheels; + m_nLastDistanceCarTravelledOnTwoWheels = m_nDistanceCarTravelledOnTwoWheels; + if (CStats::Longest2Wheel < m_nTimeCarSpentOnTwoWheels / 1000) + CStats::Longest2Wheel = m_nTimeCarSpentOnTwoWheels / 1000; + if (CStats::Longest2WheelDist < m_nDistanceCarTravelledOnTwoWheels) + CStats::Longest2WheelDist = m_nDistanceCarTravelledOnTwoWheels; + } + m_nTimeCarSpentOnTwoWheels = 0; + m_nDistanceCarTravelledOnTwoWheels = 0; + m_nCancelWheelStuntTimer = 0; + } + } + } else if (car->m_aSuspensionSpringRatioPrev[0] == 1.0f && car->m_aSuspensionSpringRatioPrev[1] == 1.0f) { +#ifdef FIX_BUGS + if (car->m_aSuspensionSpringRatioPrev[2] < 1.f +#else + if (car->m_aSuspensionSpringRatioPrev[1] < 1.f +#endif + && car->m_aSuspensionSpringRatioPrev[3] < 1.f && 0.0f == car->m_fDamageImpulse) { + m_nTimeCarSpentOnTwoWheels += CTimer::GetTimeStepInMilliseconds(); + m_nDistanceCarTravelledOnTwoWheels += car->m_fDistanceTravelled; + m_nCancelWheelStuntTimer = Max(0.0f, m_nCancelWheelStuntTimer - CTimer::GetTimeStepInMilliseconds() * 0.2f); + + } else if (m_nTimeCarSpentOnTwoWheels != 0 && m_nCancelWheelStuntTimer < 500) { + m_nCancelWheelStuntTimer += CTimer::GetTimeStepInMilliseconds(); + + } else { + if (m_nTimeCarSpentOnTwoWheels >= 2000) { + m_nLastTimeCarSpentOnTwoWheels = m_nTimeCarSpentOnTwoWheels; + m_nLastDistanceCarTravelledOnTwoWheels = m_nDistanceCarTravelledOnTwoWheels; + if (CStats::Longest2Wheel < m_nTimeCarSpentOnTwoWheels / 1000) + CStats::Longest2Wheel = m_nTimeCarSpentOnTwoWheels / 1000; + if (CStats::Longest2WheelDist < m_nDistanceCarTravelledOnTwoWheels) + CStats::Longest2WheelDist = m_nDistanceCarTravelledOnTwoWheels; + } + m_nTimeCarSpentOnTwoWheels = 0; + m_nDistanceCarTravelledOnTwoWheels = 0; + m_nCancelWheelStuntTimer = 0; + } + } else if (m_nTimeCarSpentOnTwoWheels != 0) { + if (m_nTimeCarSpentOnTwoWheels >= 2000) { + m_nLastTimeCarSpentOnTwoWheels = m_nTimeCarSpentOnTwoWheels; + m_nLastDistanceCarTravelledOnTwoWheels = m_nDistanceCarTravelledOnTwoWheels; + if (CStats::Longest2Wheel < m_nTimeCarSpentOnTwoWheels / 1000) + CStats::Longest2Wheel = m_nTimeCarSpentOnTwoWheels / 1000; + if (CStats::Longest2WheelDist < m_nDistanceCarTravelledOnTwoWheels) + CStats::Longest2WheelDist = m_nDistanceCarTravelledOnTwoWheels; + } + m_nTimeCarSpentOnTwoWheels = 0; + m_nDistanceCarTravelledOnTwoWheels = 0; + m_nCancelWheelStuntTimer = 0; + } + m_nTimeSpentOnWheelie = 0; + m_nTimeSpentOnStoppie = 0; + } else if (m_pPed->m_pMyVehicle->IsBike()) { + CBike *bike = (CBike*)m_pPed->m_pMyVehicle; + if (bike->m_aSuspensionSpringRatioPrev[0] == 1.0f && bike->m_aSuspensionSpringRatioPrev[1] == 1.0f) { + if (bike->m_aSuspensionSpringRatioPrev[2] < 1.0f + || (bike->m_aSuspensionSpringRatioPrev[3] < 1.0f && 0.0f == bike->m_fDamageImpulse)) { + m_nTimeSpentOnWheelie += CTimer::GetTimeStepInMilliseconds(); + m_nDistanceTravelledOnWheelie += bike->m_fDistanceTravelled; + m_nCancelWheelStuntTimer = Max(0.0f, m_nCancelWheelStuntTimer - CTimer::GetTimeStepInMilliseconds() * 0.2f); + + } else { + if (m_nTimeSpentOnWheelie != 0 && m_nCancelWheelStuntTimer < 500) { + m_nCancelWheelStuntTimer += CTimer::GetTimeStepInMilliseconds(); + } else { + if (m_nTimeSpentOnWheelie >= 5000) { + m_nLastTimeSpentOnWheelie = m_nTimeSpentOnWheelie; + m_nLastDistanceTravelledOnWheelie = m_nDistanceTravelledOnWheelie; + if (CStats::LongestWheelie < m_nTimeSpentOnWheelie / 1000) + CStats::LongestWheelie = m_nTimeSpentOnWheelie / 1000; + if (CStats::LongestWheelieDist < m_nDistanceTravelledOnWheelie) + CStats::LongestWheelieDist = m_nDistanceTravelledOnWheelie; + } + m_nTimeSpentOnWheelie = 0; + m_nDistanceTravelledOnWheelie = 0; + m_nCancelWheelStuntTimer = 0; + } + } + } else if (m_nTimeSpentOnWheelie != 0) { + if (m_nTimeSpentOnWheelie >= 5000) { + m_nLastTimeSpentOnWheelie = m_nTimeSpentOnWheelie; + m_nLastDistanceTravelledOnWheelie = m_nDistanceTravelledOnWheelie; + if (CStats::LongestWheelie < m_nTimeSpentOnWheelie / 1000) + CStats::LongestWheelie = m_nTimeSpentOnWheelie / 1000; + if (CStats::LongestWheelieDist < m_nDistanceTravelledOnWheelie) + CStats::LongestWheelieDist = m_nDistanceTravelledOnWheelie; + } + m_nTimeSpentOnWheelie = 0; + m_nDistanceTravelledOnWheelie = 0; + m_nCancelWheelStuntTimer = 0; + + } else if (bike->m_aSuspensionSpringRatioPrev[2] == 1.0f && bike->m_aSuspensionSpringRatioPrev[3] == 1.0f + && 0.0f == bike->m_fDamageImpulse) { + m_nTimeSpentOnStoppie += CTimer::GetTimeStepInMilliseconds(); + m_nDistanceTravelledOnStoppie += bike->m_fDistanceTravelled; + m_nCancelWheelStuntTimer = Max(0.0f, m_nCancelWheelStuntTimer - CTimer::GetTimeStepInMilliseconds() * 0.2f); + + } else { + if (m_nTimeSpentOnStoppie != 0 && m_nCancelWheelStuntTimer < 500) { + m_nCancelWheelStuntTimer += CTimer::GetTimeStepInMilliseconds(); + } else { + if (m_nTimeSpentOnStoppie >= 2000) { + m_nLastTimeSpentOnStoppie = m_nTimeSpentOnStoppie; + m_nLastDistanceTravelledOnStoppie = m_nDistanceTravelledOnStoppie; + if (CStats::LongestStoppie < m_nTimeSpentOnStoppie / 1000) + CStats::LongestStoppie = m_nTimeSpentOnStoppie / 1000; + if (CStats::LongestStoppieDist < m_nDistanceTravelledOnStoppie) + CStats::LongestStoppieDist = m_nDistanceTravelledOnStoppie; + } + m_nTimeSpentOnStoppie = 0; + m_nDistanceTravelledOnStoppie = 0; + m_nCancelWheelStuntTimer = 0; + } + } + m_nTimeCarSpentOnTwoWheels = 0; + m_nTimeNotFullyOnGround = 0; + } else { + m_nTimeCarSpentOnTwoWheels = 0; + m_nTimeNotFullyOnGround = 0; + m_nTimeSpentOnWheelie = 0; + m_nTimeSpentOnStoppie = 0; + m_nCancelWheelStuntTimer = 0; + } + // The effect that makes money counter does while earning/losing money if (m_nVisibleMoney != m_nMoney) { int diff = m_nMoney - m_nVisibleMoney; @@ -395,7 +569,7 @@ CPlayerInfo::Process(void) m_fRoadDensity = ThePaths.CalcRoadDensity(playerPos.x, playerPos.y); } - m_fRoadDensity = clamp(m_fRoadDensity, 0.4f, 1.45f); + m_fRoadDensity = clamp(m_fRoadDensity, 0.5f, 1.45f); // Because vehicle enter/exit use same key binding. bool enterOrExitVeh; @@ -404,39 +578,31 @@ CPlayerInfo::Process(void) else enterOrExitVeh = CPad::GetPad(0)->GetExitVehicle(); - if (enterOrExitVeh && m_pPed->m_nPedState != PED_SNIPER_MODE && m_pPed->m_nPedState != PED_ROCKET_MODE) { + if (enterOrExitVeh && m_pPed->m_nPedState != PED_ANSWER_MOBILE && m_pPed->m_nPedState != PED_SNIPER_MODE && m_pPed->m_nPedState != PED_ROCKET_MODE) { if (m_pPed->bInVehicle) { if (!m_pRemoteVehicle) { CEntity *surfaceBelowVeh = m_pPed->m_pMyVehicle->m_pCurGroundEntity; if (!surfaceBelowVeh || !CBridge::ThisIsABridgeObjectMovingUp(surfaceBelowVeh->GetModelIndex())) { CVehicle *veh = m_pPed->m_pMyVehicle; if (!veh->IsBoat() || veh->m_nDoorLock == CARLOCK_LOCKED_PLAYER_INSIDE) { + if (veh->GetStatus() != STATUS_WRECKED && veh->GetStatus() != STATUS_TRAIN_MOVING && veh->m_nDoorLock != CARLOCK_LOCKED_PLAYER_INSIDE) { + bool canJumpOff = false; + if (veh->m_vehType == VEHICLE_TYPE_BIKE) { + canJumpOff = veh->CanPedJumpOffBike(); + } else if (veh->pDriver == m_pPed) { + canJumpOff = veh->CanPedJumpOutCar(); + } - // This condition will always return true, else block was probably WIP Miami code. - if (veh->m_vehType != VEHICLE_TYPE_BIKE || veh->m_nDoorLock == CARLOCK_LOCKED_PLAYER_INSIDE) { - if (veh->GetStatus() != STATUS_WRECKED && veh->GetStatus() != STATUS_TRAIN_MOVING && veh->m_nDoorLock != CARLOCK_LOCKED_PLAYER_INSIDE) { - if (veh->m_vecMoveSpeed.Magnitude() < 0.17f && CTimer::GetTimeScale() >= 0.5f && !veh->bIsInWater) { + if (canJumpOff || veh->m_vecMoveSpeed.Magnitude() < 0.1f) { + if (!veh->bIsInWater) m_pPed->SetObjective(OBJECTIVE_LEAVE_CAR, veh); - } + + } else if (veh->GetStatus() != STATUS_PLAYER && veh != CGameLogic::pShortCutTaxi) { + veh->AutoPilot.m_nTempAction = TEMPACT_WAIT; + veh->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 1000; } - } else { - CVector sth = 0.7f * veh->GetRight() + veh->GetPosition(); - bool found = false; - float groundZ = CWorld::FindGroundZFor3DCoord(sth.x, sth.y, 2.0f + sth.z, &found); - - if (found) - sth.z = 1.0f + groundZ; - m_pPed->m_nPedState = PED_IDLE; - m_pPed->SetMoveState(PEDMOVE_STILL); - CPed::PedSetOutCarCB(0, m_pPed); - CAnimManager::BlendAnimation(m_pPed->GetClump(), m_pPed->m_animGroup, ANIM_IDLE_STANCE, 100.0f); - CAnimManager::BlendAnimation(m_pPed->GetClump(), ASSOCGRP_STD, ANIM_FALL_LAND, 100.0f); - m_pPed->SetPosition(sth); - m_pPed->SetMoveState(PEDMOVE_STILL); - m_pPed->m_vecMoveSpeed = veh->m_vecMoveSpeed; } } else { - // The code in here was under CPed::SetExitBoat in VC, did the same for here. m_pPed->SetExitBoat(veh); m_pPed->bTryingToReachDryLand = true; } @@ -451,14 +617,10 @@ CPlayerInfo::Process(void) CEntity *surfaceBelow = m_pPed->m_pCurrentPhysSurface; if (surfaceBelow && surfaceBelow->IsVehicle()) { carBelow = (CVehicle*)surfaceBelow; - if (carBelow->IsBoat()) { + if (carBelow->IsBoat() && carBelow->m_modelIndex != MI_SKIMMER) { weAreOnBoat = true; m_pPed->bOnBoat = true; -#ifdef VC_PED_PORTS if (carBelow->GetStatus() != STATUS_WRECKED && carBelow->GetUp().z > 0.3f) -#else - if (carBelow->GetStatus() != STATUS_WRECKED) -#endif m_pPed->SetSeekBoatPosition(carBelow); } } @@ -506,14 +668,15 @@ CPlayerInfo::Process(void) } } } + if (m_bInRemoteMode) { uint32 timeWithoutRemoteCar = CTimer::GetTimeInMilliseconds() - m_nTimeLostRemoteCar; - if (CTimer::GetPreviousTimeInMilliseconds() - m_nTimeLostRemoteCar < 1000 && timeWithoutRemoteCar >= 1000 && m_WBState == WBSTATE_PLAYING) { + if (CTimer::GetPreviousTimeInMilliseconds() - m_nTimeLostRemoteCar < 1000 && timeWithoutRemoteCar >= 1000 && m_WBState == WBSTATE_PLAYING && field_D6) { TheCamera.SetFadeColour(0, 0, 0); TheCamera.Fade(1.0f, 0); } if (timeWithoutRemoteCar > 2000) { - if (m_WBState == WBSTATE_PLAYING) { + if (m_WBState == WBSTATE_PLAYING && field_D6) { TheCamera.RestoreWithJumpCut(); TheCamera.SetFadeColour(0, 0, 0); TheCamera.Fade(1.0f, 1); @@ -525,6 +688,7 @@ CPlayerInfo::Process(void) CTimer::Update(); } m_bInRemoteMode = false; + CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->bRemoveFromWorld = true; CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle = nil; if (FindPlayerVehicle()) { FindPlayerVehicle()->SetStatus(STATUS_PLAYER); @@ -534,11 +698,10 @@ CPlayerInfo::Process(void) if (!(CTimer::GetFrameCounter() & 31)) { CVehicle *veh = FindPlayerVehicle(); if (veh && m_pPed->bInVehicle && veh->GetUp().z < 0.0f - && veh->m_vecMoveSpeed.Magnitude() < 0.05f && veh->IsCar() && !veh->bIsInWater) { + && veh->m_vecMoveSpeed.Magnitude() < 0.05f && (veh->IsCar() || veh->IsBoat()) && !veh->bIsInWater) { if (veh->GetUp().z < -0.5f) { m_nUpsideDownCounter += 2; - } else { m_nUpsideDownCounter++; } @@ -562,8 +725,74 @@ CPlayerInfo::Process(void) if (veh->pPassengers[i]) veh->pPassengers[i]->m_nZoneLevel = LEVEL_GENERIC; } - CStats::DistanceTravelledInVehicle += veh->m_fDistanceTravelled; + if(veh->m_modelIndex == MI_CADDY) + CStats::DistanceTravelledByGolfCart += veh->m_fDistanceTravelled; + else { + if(veh->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI) + CStats::DistanceTravelledByHelicoptor += veh->m_fDistanceTravelled; + if (veh->GetVehicleAppearance() == VEHICLE_APPEARANCE_PLANE) + CStats::DistanceTravelledByPlane += veh->m_fDistanceTravelled; + if (veh->GetVehicleAppearance() == VEHICLE_APPEARANCE_CAR) + CStats::DistanceTravelledByCar += veh->m_fDistanceTravelled; + if (veh->GetVehicleAppearance() == VEHICLE_APPEARANCE_BIKE) + CStats::DistanceTravelledByBike += veh->m_fDistanceTravelled; + if (veh->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT) + CStats::DistanceTravelledByBoat += veh->m_fDistanceTravelled; + + if (veh->GetVehicleAppearance() == VEHICLE_APPEARANCE_PLANE) { + if (veh->m_vecMoveSpeed.Magnitude() > 0.2f) { + CStats::FlightTime += CTimer::GetTimeStep() * 16.f; // what a weird choice + } + } + } } else { CStats::DistanceTravelledOnFoot += FindPlayerPed()->m_fDistanceTravelled; } + + if (m_pPed->m_pWanted->m_nWantedLevel && !CTheScripts::IsPlayerOnAMission()) { + float maxDelta = 0.0f; + static bool movedSignificantly = true; + static bool thereIsACarPathNear = true; + // there was one more guard without variable's itself??? + + if (CTimer::GetTimeInMilliseconds() / 20000 != CTimer::GetPreviousTimeInMilliseconds() / 20000) { + float posChange = (lastPlayerPos - FindPlayerCoors()).Magnitude(); + movedSignificantly = posChange >= 10.0f; + lastPlayerPos = FindPlayerCoors(); + thereIsACarPathNear = ThePaths.FindNodeClosestToCoors(FindPlayerCoors(), PATH_CAR, 60.0f, true, false, false, false) != 0; + } + switch (m_pPed->m_pWanted->m_nWantedLevel) { + case 1: + maxDelta = 31.f; + break; + case 2: + maxDelta = 62.f; + break; + case 3: + maxDelta = 125.f; + break; + case 4: + maxDelta = 250.f; + break; + case 5: + maxDelta = 500.f; + break; + case 6: + maxDelta = 1000.f; + break; + default: + break; + } + float increaseDelta = maxDelta - m_fMediaAttention; + float increaseAttentionBy = CTimer::GetTimeStep() * 0.0001f * increaseDelta; + if (increaseAttentionBy < 0.0f + || movedSignificantly && thereIsACarPathNear && !CCullZones::NoPolice() && !CCullZones::PoliceAbandonCars() && CGame::currArea == AREA_MAIN_MAP) { + m_fMediaAttention += increaseAttentionBy; + } + } else { + m_fMediaAttention = 0.0f; + } + CStats::HighestChaseValue = Max(m_fMediaAttention, CStats::HighestChaseValue); + m_nMoney = Min(999999999, m_nMoney); + m_nVisibleMoney = Min(999999999, m_nVisibleMoney); } diff --git a/src/core/PlayerInfo.h b/src/core/PlayerInfo.h index 11f51ac0..7d99a4e0 100644 --- a/src/core/PlayerInfo.h +++ b/src/core/PlayerInfo.h @@ -45,19 +45,33 @@ public: int8 m_WBState; // eWastedBustedState uint32 m_nWBTime; bool m_bInRemoteMode; + bool field_D5; + bool field_D6; uint32 m_nTimeLostRemoteCar; uint32 m_nTimeLastHealthLoss; uint32 m_nTimeLastArmourLoss; uint32 m_nTimeTankShotGun; - int32 m_nTimeNotFullyOnGround; int32 m_nUpsideDownCounter; - int32 field_248; + int32 field_EC; + int32 m_nTimeCarSpentOnTwoWheels; + int32 m_nDistanceCarTravelledOnTwoWheels; + int32 m_nTimeNotFullyOnGround; + int32 m_nTimeSpentOnWheelie; + float m_nDistanceTravelledOnWheelie; + int32 m_nTimeSpentOnStoppie; + float m_nDistanceTravelledOnStoppie; + int32 m_nCancelWheelStuntTimer; + int32 m_nLastTimeCarSpentOnTwoWheels; + int32 m_nLastDistanceCarTravelledOnTwoWheels; + int32 m_nLastTimeSpentOnWheelie; + int32 m_nLastDistanceTravelledOnWheelie; + int32 m_nLastTimeSpentOnStoppie; + int32 m_nLastDistanceTravelledOnStoppie; int16 m_nTrafficMultiplier; + int16 field_12A; float m_fRoadDensity; uint32 m_nPreviousTimeRewardedForExplosion; - int32 m_nExplosionsSinceLastReward; - int32 field_268; - int32 field_272; + uint32 m_nExplosionsSinceLastReward; uint32 m_nHavocLevel; float m_fMediaAttention; bool m_bInfiniteSprint; @@ -76,7 +90,6 @@ public: void MakePlayerSafe(bool); void LoadPlayerSkin(); void DeletePlayerSkin(); - void AwardMoneyForExplosion(CVehicle *vehicle); void SetPlayerSkin(char* skin); const CVector &GetPos(); void Process(void); diff --git a/src/core/Radar.h b/src/core/Radar.h index a36faaea..100da8f3 100644 --- a/src/core/Radar.h +++ b/src/core/Radar.h @@ -19,7 +19,7 @@ #define COORDBLIP_MARKER_COLOR_R 252 #define COORDBLIP_MARKER_COLOR_G 138 #define COORDBLIP_MARKER_COLOR_B 242 -#define COORDBLIP_MARKER_COLOR_A 255 +#define COORDBLIP_MARKER_COLOR_A 228 #define NUM_MAP_LEGENDS 75 diff --git a/src/core/Stats.cpp b/src/core/Stats.cpp index 29087b34..d5c08e4f 100644 --- a/src/core/Stats.cpp +++ b/src/core/Stats.cpp @@ -3,12 +3,14 @@ #include "Stats.h" #include "Text.h" #include "World.h" +#include "Pad.h" #include <climits> -//TODO int32 CStats::SeagullsKilled; - +int32 CStats::BoatsExploded; +int32 CStats::WantedStarsAttained; +int32 CStats::WantedStarsEvaded; int32 CStats::DaysPassed; int32 CStats::HeadsPopped; int32 CStats::CommercialPassed; @@ -21,8 +23,25 @@ int32 CStats::PedsKilledOfThisType[NUM_PEDTYPES]; int32 CStats::TimesDied; int32 CStats::TimesArrested; int32 CStats::KillsSinceLastCheckpoint; -float CStats::DistanceTravelledInVehicle; +float CStats::DistanceTravelledByCar; +float CStats::DistanceTravelledByHelicoptor; +float CStats::DistanceTravelledByBike; +float CStats::DistanceTravelledByBoat; +float CStats::DistanceTravelledByPlane; +float CStats::DistanceTravelledByGolfCart; float CStats::DistanceTravelledOnFoot; +int32 CStats::FlightTime; +int32 CStats::TimesDrowned; +int32 CStats::PhotosTaken; +float CStats::LoanSharks; +float CStats::StoresKnockedOff; +float CStats::MovieStunts; +float CStats::Assassinations; +float CStats::PizzasDelivered; +float CStats::GarbagePickups; +float CStats::IceCreamSold; +float CStats::TopShootingRangeScore; +float CStats::ShootingRank; int32 CStats::ProgressMade; int32 CStats::TotalProgressInGame; int32 CStats::CarsExploded; @@ -40,95 +59,153 @@ int32 CStats::MissionsGiven; int32 CStats::MissionsPassed; char CStats::LastMissionPassedName[8]; int32 CStats::TotalLegitimateKills; -int32 CStats::ElBurroTime; -int32 CStats::Record4x4One; -int32 CStats::Record4x4Two; -int32 CStats::Record4x4Three; -int32 CStats::Record4x4Mayhem; int32 CStats::LivesSavedWithAmbulance; int32 CStats::CriminalsCaught; int32 CStats::HighestLevelAmbulanceMission; +int32 CStats::HighestLevelVigilanteMission; +int32 CStats::HighestLevelFireMission; int32 CStats::FiresExtinguished; -int32 CStats::TimeTakenDefuseMission; int32 CStats::TotalNumberKillFrenzies; int32 CStats::TotalNumberMissions; int32 CStats::RoundsFiredByPlayer; int32 CStats::KgsOfExplosivesUsed; -int32 CStats::InstantHitsFiredByPlayer; -int32 CStats::InstantHitsHitByPlayer; +int32 CStats::BulletsThatHit; int32 CStats::BestTimeBombDefusal; int32 CStats::FastestTimes[CStats::TOTAL_FASTEST_TIMES]; int32 CStats::HighestScores[CStats::TOTAL_HIGHEST_SCORES]; int32 CStats::BestPositions[CStats::TOTAL_BEST_POSITIONS]; +bool CStats::PropertyOwned[CStats::TOTAL_PROPERTIES]; +int32 CStats::NumPropertyOwned; int32 CStats::PropertyDestroyed; +float CStats::HighestChaseValue; +int32 CStats::CheatedCount; +int32 CStats::ShowChaseStatOnScreen; int32 CStats::PamphletMissionPassed; +bool CStats::abSonyCDs[1]; +int32 CStats::BloodRingKills; +int32 CStats::BloodRingTime; +float CStats::FavoriteRadioStationList[NUM_RADIOS]; int32 CStats::Sprayings; float CStats::AutoPaintingBudget; int32 CStats::NoMoreHurricanes; float CStats::FashionBudget; +float CStats::PropertyBudget; +float CStats::WeaponBudget; int32 CStats::SafeHouseVisits; int32 CStats::TyresPopped; +int32 CStats::LongestWheelie; +int32 CStats::LongestStoppie; +int32 CStats::Longest2Wheel; +float CStats::LongestWheelieDist; +float CStats::LongestStoppieDist; +float CStats::Longest2WheelDist; + +// --MIAMI: functions below are done except TODOs, but there are some to be moved from Frontend + void CStats::Init() { PeopleKilledByOthers = 0; PeopleKilledByPlayer = 0; - RoundsFiredByPlayer = 0; CarsExploded = 0; + BoatsExploded = 0; + RoundsFiredByPlayer = 0; + for (int i = 0; i < NUM_PEDTYPES; i++) + PedsKilledOfThisType[i] = 0; HelisDestroyed = 0; ProgressMade = 0; KgsOfExplosivesUsed = 0; - InstantHitsFiredByPlayer = 0; - InstantHitsHitByPlayer = 0; + BulletsThatHit = 0; + TyresPopped = 0; HeadsPopped = 0; + WantedStarsAttained = 0; + WantedStarsEvaded = 0; TimesArrested = 0; TimesDied = 0; DaysPassed = 0; - NumberOfUniqueJumpsFound = 0; - MaximumJumpFlips = 0; - MaximumJumpSpins = 0; + SafeHouseVisits = 0; + Sprayings = 0; MaximumJumpDistance = 0; MaximumJumpHeight = 0; + MaximumJumpFlips = 0; + MaximumJumpSpins = 0; BestStuntJump = 0; + NumberOfUniqueJumpsFound = 0; TotalNumberOfUniqueJumps = 0; - Record4x4One = 0; - Record4x4Two = 0; + MissionsGiven = 0; + MissionsPassed = 0; PassengersDroppedOffWithTaxi = 0; - Record4x4Three = 0; MoneyMadeWithTaxi = 0; - Record4x4Mayhem = 0; + DistanceTravelledOnFoot = 0; + DistanceTravelledByCar = 0; + DistanceTravelledByBike = 0; + DistanceTravelledByBoat = 0; + DistanceTravelledByGolfCart = 0; + DistanceTravelledByHelicoptor = 0; + DistanceTravelledByPlane = 0; // FIX: Wasn't initialized LivesSavedWithAmbulance = 0; - ElBurroTime = 0; CriminalsCaught = 0; - MissionsGiven = 0; + HighestLevelVigilanteMission = 0; HighestLevelAmbulanceMission = 0; - MissionsPassed = 0; + HighestLevelFireMission = 0; FiresExtinguished = 0; - DistanceTravelledOnFoot = 0; - TimeTakenDefuseMission = 0; + PhotosTaken = 0; NumberKillFrenziesPassed = 0; - DistanceTravelledInVehicle = 0; TotalNumberKillFrenzies = 0; TotalNumberMissions = 0; - KillsSinceLastCheckpoint = 0; - TotalLegitimateKills = 0; + FlightTime = 0; + TimesDrowned = 0; + SeagullsKilled = 0; + WeaponBudget = 0.0f; + FashionBudget = 0.0f; + LoanSharks = 0.0f; + StoresKnockedOff = 0.0f; + MovieStunts = 0.0f; + Assassinations = 0.0f; + PizzasDelivered = 0.0f; + GarbagePickups = 0.0f; + IceCreamSold = 0.0f; + TopShootingRangeScore = 0.0f; + ShootingRank = 0.0f; + LongestWheelie = 0; + LongestStoppie = 0; + Longest2Wheel = 0; + LongestWheelieDist = 0.0f; + LongestStoppieDist = 0.0f; + Longest2WheelDist = 0.0f; + PropertyBudget = 0.0f; + AutoPaintingBudget = 0.0f; + PropertyDestroyed = 0; + HighestChaseValue = 0.0f; + CheatedCount = 0; + for (int i = 0; i < TOTAL_FASTEST_TIMES; i++) FastestTimes[i] = 0; for (int i = 0; i < TOTAL_HIGHEST_SCORES; i++) HighestScores[i] = 0; for (int i = 0; i < TOTAL_BEST_POSITIONS; i++) BestPositions[i] = INT_MAX; - for (int i = 0; i < NUM_PEDTYPES; i++) - PedsKilledOfThisType[i] = 0; + + KillsSinceLastCheckpoint = 0; + TotalLegitimateKills = 0; IndustrialPassed = 0; CommercialPassed = 0; SuburbanPassed = 0; - - Sprayings = 0; - AutoPaintingBudget = 0.0f; + PamphletMissionPassed = 0; NoMoreHurricanes = 0; - SafeHouseVisits = 0; + ShowChaseStatOnScreen = 0; + abSonyCDs[0] = 0; + // TODO(Miami): Change this with PopulateFavoriteRadioStationList(); !! + for (int i = 0; i < NUM_RADIOS; i++) + FavoriteRadioStationList[i] = 0.0f; + + NumPropertyOwned = 0; + for (int i = 0; i < TOTAL_PROPERTIES; i++) + PropertyOwned[i] = false; + + BloodRingKills = 0; + BloodRingTime = 0; } void CStats::RegisterFastestTime(int32 index, int32 time) @@ -152,31 +229,6 @@ void CStats::RegisterBestPosition(int32 index, int32 position) BestPositions[index] = Min(BestPositions[index], position); } -void CStats::RegisterElBurroTime(int32 time) -{ - ElBurroTime = (ElBurroTime && ElBurroTime < time) ? ElBurroTime : time; -} - -void CStats::Register4x4OneTime(int32 time) -{ - Record4x4One = (Record4x4One && Record4x4One < time) ? Record4x4One : time; -} - -void CStats::Register4x4TwoTime(int32 time) -{ - Record4x4Two = (Record4x4Two && Record4x4Two < time) ? Record4x4Two : time; -} - -void CStats::Register4x4ThreeTime(int32 time) -{ - Record4x4Three = (Record4x4Three && Record4x4Three < time) ? Record4x4Three : time; -} - -void CStats::Register4x4MayhemTime(int32 time) -{ - Record4x4Mayhem = (Record4x4Mayhem && Record4x4Mayhem < time) ? Record4x4Mayhem : time; -} - void CStats::AnotherLifeSavedWithAmbulance() { ++LivesSavedWithAmbulance; @@ -192,14 +244,19 @@ void CStats::RegisterLevelAmbulanceMission(int32 level) HighestLevelAmbulanceMission = Max(HighestLevelAmbulanceMission, level); } -void CStats::AnotherFireExtinguished() +void CStats::RegisterLevelVigilanteMission(int32 level) { - ++FiresExtinguished; + HighestLevelVigilanteMission = Max(HighestLevelVigilanteMission, level); } -void CStats::RegisterTimeTakenDefuseMission(int32 time) +void CStats::RegisterLevelFireMission(int32 level) { - TimeTakenDefuseMission = (TimeTakenDefuseMission && TimeTakenDefuseMission < time) ? TimeTakenDefuseMission : time; + HighestLevelFireMission = Max(HighestLevelFireMission, level); +} + +void CStats::AnotherFireExtinguished() +{ + ++FiresExtinguished; } void CStats::AnotherKillFrenzyPassed() @@ -221,40 +278,88 @@ wchar *CStats::FindCriminalRatingString() { int rating = FindCriminalRatingNumber(); - if (rating < 10) return TheText.Get("RATNG1"); - if (rating < 25) return TheText.Get("RATNG2"); - if (rating < 70) return TheText.Get("RATNG3"); - if (rating < 150) return TheText.Get("RATNG4"); - if (rating < 250) return TheText.Get("RATNG5"); - if (rating < 450) return TheText.Get("RATNG6"); - if (rating < 700) return TheText.Get("RATNG7"); - if (rating < 1000) return TheText.Get("RATNG8"); - if (rating < 1400) return TheText.Get("RATNG9"); - if (rating < 1900) return TheText.Get("RATNG10"); - if (rating < 2500) return TheText.Get("RATNG11"); - if (rating < 3200) return TheText.Get("RATNG12"); - if (rating < 4000) return TheText.Get("RATNG13"); - if (rating < 5000) return TheText.Get("RATNG14"); - return TheText.Get("RATNG15"); + if (rating < 0) { + if (rating > -500) return TheText.Get("RATNG53"); + if (rating > -2000) return TheText.Get("RATNG54"); + if (rating > -4000) return TheText.Get("RATNG55"); + if (rating > -6000) return TheText.Get("RATNG56"); + return TheText.Get("RATNG57"); + } + if (rating < 20) return TheText.Get("RATNG1"); + if (rating < 50) return TheText.Get("RATNG2"); + if (rating < 75) return TheText.Get("RATNG3"); + if (rating < 100) return TheText.Get("RATNG4"); + if (rating < 120) return TheText.Get("RATNG5"); + if (rating < 150) return TheText.Get("RATNG6"); + if (rating < 200) return TheText.Get("RATNG7"); + if (rating < 240) return TheText.Get("RATNG8"); + if (rating < 270) return TheText.Get("RATNG9"); + if (rating < 300) return TheText.Get("RATNG10"); + if (rating < 335) return TheText.Get("RATNG11"); + if (rating < 370) return TheText.Get("RATNG12"); + if (rating < 400) return TheText.Get("RATNG13"); + if (rating < 450) return TheText.Get("RATNG14"); + if (rating < 500) return TheText.Get("RATNG15"); + if (rating < 550) return TheText.Get("RATNG16"); + if (rating < 600) return TheText.Get("RATNG17"); + if (rating < 610) return TheText.Get("RATNG18"); + if (rating < 650) return TheText.Get("RATNG19"); + if (rating < 700) return TheText.Get("RATNG20"); + if (rating < 850) return TheText.Get("RATNG21"); + if (rating < 1000) return TheText.Get("RATNG22"); + if (rating < 1005) return TheText.Get("RATNG23"); + if (rating < 1150) return TheText.Get("RATNG24"); + if (rating < 1300) return TheText.Get(TimesArrested > 0 ? "RATNG25" : "RATNG24"); + if (rating < 1500) return TheText.Get("RATNG26"); + if (rating < 1700) return TheText.Get("RATNG27"); + if (rating < 2000) return TheText.Get("RATNG28"); + if (rating < 2100) return TheText.Get("RATNG29"); + if (rating < 2300) return TheText.Get("RATNG30"); + if (rating < 2500) return TheText.Get("RATNG31"); + if (rating < 2750) return TheText.Get("RATNG32"); + if (rating < 3000) return TheText.Get("RATNG33"); + if (rating < 3500) return TheText.Get("RATNG34"); + if (rating < 4000) return TheText.Get("RATNG35"); + if (rating < 5000) return TheText.Get("RATNG36"); + if (rating < 7500) return TheText.Get("RATNG37"); + if (rating < 10000) return TheText.Get("RATNG38"); + if (rating < 20000) return TheText.Get("RATNG39"); + if (rating < 30000) return TheText.Get("RATNG40"); + if (rating < 40000) return TheText.Get("RATNG41"); + if (rating < 50000) return TheText.Get("RATNG42"); + if (rating < 65000) return TheText.Get("RATNG43"); + if (rating < 80000) return TheText.Get("RATNG44"); + if (rating < 100000) return TheText.Get("RATNG45"); + if (rating < 150000) return TheText.Get("RATNG46"); + if (rating < 200000) return TheText.Get("RATNG47"); + if (rating < 300000) return TheText.Get("RATNG48"); + if (rating < 375000) return TheText.Get("RATNG49"); + if (rating < 500000) return TheText.Get(FlightTime / 60000 / 60 > 10 ? "RATNG50" : "RATNG49"); + if (rating < 1000000) return TheText.Get("RATNG51"); + return TheText.Get(CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney > 10000000 ? "RATNG52" : "RATNG51"); } int32 CStats::FindCriminalRatingNumber() { int32 rating; - rating = FiresExtinguished + 10 * HighestLevelAmbulanceMission + CriminalsCaught + LivesSavedWithAmbulance + rating = FiresExtinguished + 10 * HighestLevelFireMission + 10 * HighestLevelAmbulanceMission + + CriminalsCaught + LivesSavedWithAmbulance + 30 * HelisDestroyed + TotalLegitimateKills - 3 * TimesArrested - 3 * TimesDied + CWorld::Players[CWorld::PlayerInFocus].m_nMoney / 5000; - if (rating <= 0) rating = 0; + if (CPad::bHasPlayerCheated || CheatedCount > 0) { + rating -= CheatedCount; + if (rating <= -10000) + rating = -10000; + + } else if (rating <= 0) { + rating = 0; + } - if (InstantHitsFiredByPlayer > 100) - rating += (float)CStats::InstantHitsHitByPlayer / (float)CStats::InstantHitsFiredByPlayer * 500.0f; + if (RoundsFiredByPlayer > 100) + rating += (float)CStats::BulletsThatHit / (float)CStats::RoundsFiredByPlayer * 500.0f; if (TotalProgressInGame) rating += (float)CStats::ProgressMade / (float)CStats::TotalProgressInGame * 1000.0f; - if (!IndustrialPassed && rating >= 3521) - rating = 3521; - if (!CommercialPassed && rating >= 4552) - rating = 4552; return rating; } @@ -266,11 +371,80 @@ float CStats::GetPercentageProgress() return Min(percentCompleted, 100.0f); } +void CStats::MoneySpentOnWeapons(int32 money) +{ + WeaponBudget += money; +} + +void CStats::MoneySpentOnProperty(int32 money) +{ + PropertyBudget += money; +} + +void CStats::MoneySpentOnAutoPainting(int32 money) +{ + AutoPaintingBudget += money; +} + void CStats::MoneySpentOnFashion(int32 money) { FashionBudget += money; } +void CStats::NumOfVisitsFromLoanSharks(int32 num) +{ + LoanSharks += num; +} + +void CStats::NumOfStoresKnockedOff(int32 num) +{ + StoresKnockedOff += num; +} + +void CStats::NumOfMovieStunts(int32 num) +{ + MovieStunts += num; +} + +void CStats::NumOfAssassinations(int32 num) +{ + Assassinations += num; +} + +void CStats::NumOfPizzasDelivered(int32 num) +{ + PizzasDelivered += num; +} + +void CStats::NumOfGarbagePickups(int32 num) +{ + GarbagePickups += num; +} + +void CStats::NumOfIceCreamSold(int32 num) +{ + IceCreamSold += num; +} + +void CStats::AddNumBloodRingKills(int32 num) +{ + BloodRingKills += num; +} + +void CStats::LongestTimeInBloodRing(int32 time) +{ + if (BloodRingTime < time) + BloodRingTime = time; +} + +void CStats::AddPropertyAsOwned(int32 id) +{ + if (!PropertyOwned[id]) { + PropertyOwned[id] = true; + ++NumPropertyOwned; + } +} + void CStats::SaveStats(uint8 *buf, uint32 *size) { CheckPointReachedSuccessfully(); @@ -278,18 +452,23 @@ void CStats::SaveStats(uint8 *buf, uint32 *size) *size = sizeof(PeopleKilledByPlayer) + sizeof(PeopleKilledByOthers) + sizeof(CarsExploded) + + sizeof(BoatsExploded) + + sizeof(TyresPopped) + sizeof(RoundsFiredByPlayer) + sizeof(PedsKilledOfThisType) + sizeof(HelisDestroyed) + sizeof(ProgressMade) + sizeof(TotalProgressInGame) + sizeof(KgsOfExplosivesUsed) + - sizeof(InstantHitsFiredByPlayer) + - sizeof(InstantHitsHitByPlayer) + + sizeof(BulletsThatHit) + sizeof(HeadsPopped) + + sizeof(WantedStarsAttained) + + sizeof(WantedStarsEvaded) + sizeof(TimesArrested) + sizeof(TimesDied) + sizeof(DaysPassed) + + sizeof(SafeHouseVisits) + + sizeof(Sprayings) + sizeof(MaximumJumpDistance) + sizeof(MaximumJumpHeight) + sizeof(MaximumJumpFlips) + @@ -298,50 +477,88 @@ void CStats::SaveStats(uint8 *buf, uint32 *size) sizeof(NumberOfUniqueJumpsFound) + sizeof(TotalNumberOfUniqueJumps) + sizeof(MissionsGiven) + - sizeof(MissionsPassed) + sizeof(PassengersDroppedOffWithTaxi) + sizeof(MoneyMadeWithTaxi) + sizeof(IndustrialPassed) + sizeof(CommercialPassed) + sizeof(SuburbanPassed) + - sizeof(ElBurroTime) + + sizeof(PamphletMissionPassed) + + sizeof(NoMoreHurricanes) + sizeof(DistanceTravelledOnFoot) + - sizeof(DistanceTravelledInVehicle) + - sizeof(Record4x4One) + - sizeof(Record4x4Two) + - sizeof(Record4x4Three) + - sizeof(Record4x4Mayhem) + + sizeof(DistanceTravelledByCar) + + sizeof(DistanceTravelledByBike) + + sizeof(DistanceTravelledByBoat) + + sizeof(DistanceTravelledByGolfCart) + + sizeof(DistanceTravelledByHelicoptor) + + sizeof(DistanceTravelledByPlane) + sizeof(LivesSavedWithAmbulance) + sizeof(CriminalsCaught) + - sizeof(HighestLevelAmbulanceMission) + sizeof(FiresExtinguished) + - sizeof(TimeTakenDefuseMission) + + sizeof(HighestLevelVigilanteMission) + + sizeof(HighestLevelAmbulanceMission) + + sizeof(HighestLevelFireMission) + + sizeof(PhotosTaken) + sizeof(NumberKillFrenziesPassed) + sizeof(TotalNumberKillFrenzies) + sizeof(TotalNumberMissions) + + sizeof(FlightTime) + + sizeof(TimesDrowned) + + sizeof(SeagullsKilled) + + sizeof(WeaponBudget) + + sizeof(FashionBudget) + + sizeof(LoanSharks) + + sizeof(StoresKnockedOff) + + sizeof(MovieStunts) + + sizeof(Assassinations) + + sizeof(PizzasDelivered) + + sizeof(GarbagePickups) + + sizeof(IceCreamSold) + + sizeof(TopShootingRangeScore) + + sizeof(ShootingRank) + + sizeof(LongestWheelie) + + sizeof(LongestStoppie) + + sizeof(Longest2Wheel) + + sizeof(LongestWheelieDist) + + sizeof(LongestStoppieDist) + + sizeof(Longest2WheelDist) + + sizeof(PropertyBudget) + + sizeof(AutoPaintingBudget) + + sizeof(PropertyDestroyed) + + sizeof(NumPropertyOwned) + + sizeof(BloodRingKills) + + sizeof(BloodRingTime) + + sizeof(PropertyOwned) + + sizeof(HighestChaseValue) + sizeof(FastestTimes) + sizeof(HighestScores) + sizeof(BestPositions) + sizeof(KillsSinceLastCheckpoint) + sizeof(TotalLegitimateKills) + - sizeof(LastMissionPassedName); + sizeof(LastMissionPassedName) + + sizeof(CheatedCount) + + sizeof(FavoriteRadioStationList); #define CopyToBuf(buf, data) memcpy(buf, &data, sizeof(data)); buf += sizeof(data); CopyToBuf(buf, PeopleKilledByPlayer); CopyToBuf(buf, PeopleKilledByOthers); CopyToBuf(buf, CarsExploded); + CopyToBuf(buf, BoatsExploded); + CopyToBuf(buf, TyresPopped); CopyToBuf(buf, RoundsFiredByPlayer); CopyToBuf(buf, PedsKilledOfThisType); CopyToBuf(buf, HelisDestroyed); CopyToBuf(buf, ProgressMade); CopyToBuf(buf, TotalProgressInGame); CopyToBuf(buf, KgsOfExplosivesUsed); - CopyToBuf(buf, InstantHitsFiredByPlayer); - CopyToBuf(buf, InstantHitsHitByPlayer); + CopyToBuf(buf, BulletsThatHit); CopyToBuf(buf, HeadsPopped); + CopyToBuf(buf, WantedStarsAttained); + CopyToBuf(buf, WantedStarsEvaded); CopyToBuf(buf, TimesArrested); CopyToBuf(buf, TimesDied); CopyToBuf(buf, DaysPassed); + CopyToBuf(buf, SafeHouseVisits); + CopyToBuf(buf, Sprayings); CopyToBuf(buf, MaximumJumpDistance); CopyToBuf(buf, MaximumJumpHeight); CopyToBuf(buf, MaximumJumpFlips); @@ -350,33 +567,67 @@ void CStats::SaveStats(uint8 *buf, uint32 *size) CopyToBuf(buf, NumberOfUniqueJumpsFound); CopyToBuf(buf, TotalNumberOfUniqueJumps); CopyToBuf(buf, MissionsGiven); - CopyToBuf(buf, MissionsPassed); CopyToBuf(buf, PassengersDroppedOffWithTaxi); CopyToBuf(buf, MoneyMadeWithTaxi); CopyToBuf(buf, IndustrialPassed); CopyToBuf(buf, CommercialPassed); CopyToBuf(buf, SuburbanPassed); - CopyToBuf(buf, ElBurroTime); + CopyToBuf(buf, PamphletMissionPassed); + CopyToBuf(buf, NoMoreHurricanes); CopyToBuf(buf, DistanceTravelledOnFoot); - CopyToBuf(buf, DistanceTravelledInVehicle); - CopyToBuf(buf, Record4x4One); - CopyToBuf(buf, Record4x4Two); - CopyToBuf(buf, Record4x4Three); - CopyToBuf(buf, Record4x4Mayhem); + CopyToBuf(buf, DistanceTravelledByCar); + CopyToBuf(buf, DistanceTravelledByBike); + CopyToBuf(buf, DistanceTravelledByBoat); + CopyToBuf(buf, DistanceTravelledByGolfCart); + CopyToBuf(buf, DistanceTravelledByHelicoptor); + CopyToBuf(buf, DistanceTravelledByPlane); CopyToBuf(buf, LivesSavedWithAmbulance); CopyToBuf(buf, CriminalsCaught); - CopyToBuf(buf, HighestLevelAmbulanceMission); CopyToBuf(buf, FiresExtinguished); - CopyToBuf(buf, TimeTakenDefuseMission); + CopyToBuf(buf, HighestLevelVigilanteMission); + CopyToBuf(buf, HighestLevelAmbulanceMission); + CopyToBuf(buf, HighestLevelFireMission); + CopyToBuf(buf, PhotosTaken); CopyToBuf(buf, NumberKillFrenziesPassed); CopyToBuf(buf, TotalNumberKillFrenzies); CopyToBuf(buf, TotalNumberMissions); + CopyToBuf(buf, FlightTime); + CopyToBuf(buf, TimesDrowned); + CopyToBuf(buf, SeagullsKilled); + CopyToBuf(buf, WeaponBudget); + CopyToBuf(buf, FashionBudget); + CopyToBuf(buf, LoanSharks); + CopyToBuf(buf, StoresKnockedOff); + CopyToBuf(buf, MovieStunts); + CopyToBuf(buf, Assassinations); + CopyToBuf(buf, PizzasDelivered); + CopyToBuf(buf, GarbagePickups); + CopyToBuf(buf, IceCreamSold); + CopyToBuf(buf, TopShootingRangeScore); + CopyToBuf(buf, ShootingRank); + CopyToBuf(buf, LongestWheelie); + CopyToBuf(buf, LongestStoppie); + CopyToBuf(buf, Longest2Wheel); + CopyToBuf(buf, LongestWheelieDist); + CopyToBuf(buf, LongestStoppieDist); + CopyToBuf(buf, Longest2WheelDist); + CopyToBuf(buf, PropertyBudget); + CopyToBuf(buf, AutoPaintingBudget); + CopyToBuf(buf, PropertyDestroyed); + CopyToBuf(buf, NumPropertyOwned); + CopyToBuf(buf, BloodRingKills); + CopyToBuf(buf, BloodRingTime); + CopyToBuf(buf, PropertyOwned); + CopyToBuf(buf, HighestChaseValue); CopyToBuf(buf, FastestTimes); CopyToBuf(buf, HighestScores); CopyToBuf(buf, BestPositions); CopyToBuf(buf, KillsSinceLastCheckpoint); CopyToBuf(buf, TotalLegitimateKills); CopyToBuf(buf, LastMissionPassedName); + CopyToBuf(buf, CheatedCount); + // TODO(Miami): Set favourite radio stations!! + CopyToBuf(buf, FavoriteRadioStationList); assert(buf - buf_start == *size); #undef CopyToBuf @@ -391,18 +642,23 @@ void CStats::LoadStats(uint8 *buf, uint32 size) CopyFromBuf(buf, PeopleKilledByPlayer); CopyFromBuf(buf, PeopleKilledByOthers); CopyFromBuf(buf, CarsExploded); + CopyFromBuf(buf, BoatsExploded); + CopyFromBuf(buf, TyresPopped); CopyFromBuf(buf, RoundsFiredByPlayer); CopyFromBuf(buf, PedsKilledOfThisType); CopyFromBuf(buf, HelisDestroyed); CopyFromBuf(buf, ProgressMade); CopyFromBuf(buf, TotalProgressInGame); CopyFromBuf(buf, KgsOfExplosivesUsed); - CopyFromBuf(buf, InstantHitsFiredByPlayer); - CopyFromBuf(buf, InstantHitsHitByPlayer); + CopyFromBuf(buf, BulletsThatHit); CopyFromBuf(buf, HeadsPopped); + CopyFromBuf(buf, WantedStarsAttained); + CopyFromBuf(buf, WantedStarsEvaded); CopyFromBuf(buf, TimesArrested); CopyFromBuf(buf, TimesDied); CopyFromBuf(buf, DaysPassed); + CopyFromBuf(buf, SafeHouseVisits); + CopyFromBuf(buf, Sprayings); CopyFromBuf(buf, MaximumJumpDistance); CopyFromBuf(buf, MaximumJumpHeight); CopyFromBuf(buf, MaximumJumpFlips); @@ -411,33 +667,66 @@ void CStats::LoadStats(uint8 *buf, uint32 size) CopyFromBuf(buf, NumberOfUniqueJumpsFound); CopyFromBuf(buf, TotalNumberOfUniqueJumps); CopyFromBuf(buf, MissionsGiven); - CopyFromBuf(buf, MissionsPassed); CopyFromBuf(buf, PassengersDroppedOffWithTaxi); CopyFromBuf(buf, MoneyMadeWithTaxi); CopyFromBuf(buf, IndustrialPassed); CopyFromBuf(buf, CommercialPassed); CopyFromBuf(buf, SuburbanPassed); - CopyFromBuf(buf, ElBurroTime); + CopyFromBuf(buf, PamphletMissionPassed); + CopyFromBuf(buf, NoMoreHurricanes); CopyFromBuf(buf, DistanceTravelledOnFoot); - CopyFromBuf(buf, DistanceTravelledInVehicle); - CopyFromBuf(buf, Record4x4One); - CopyFromBuf(buf, Record4x4Two); - CopyFromBuf(buf, Record4x4Three); - CopyFromBuf(buf, Record4x4Mayhem); + CopyFromBuf(buf, DistanceTravelledByCar); + CopyFromBuf(buf, DistanceTravelledByBike); + CopyFromBuf(buf, DistanceTravelledByBoat); + CopyFromBuf(buf, DistanceTravelledByGolfCart); + CopyFromBuf(buf, DistanceTravelledByHelicoptor); + CopyFromBuf(buf, DistanceTravelledByPlane); CopyFromBuf(buf, LivesSavedWithAmbulance); CopyFromBuf(buf, CriminalsCaught); - CopyFromBuf(buf, HighestLevelAmbulanceMission); CopyFromBuf(buf, FiresExtinguished); - CopyFromBuf(buf, TimeTakenDefuseMission); + CopyFromBuf(buf, HighestLevelVigilanteMission); + CopyFromBuf(buf, HighestLevelAmbulanceMission); + CopyFromBuf(buf, HighestLevelFireMission); + CopyFromBuf(buf, PhotosTaken); CopyFromBuf(buf, NumberKillFrenziesPassed); CopyFromBuf(buf, TotalNumberKillFrenzies); CopyFromBuf(buf, TotalNumberMissions); + CopyFromBuf(buf, FlightTime); + CopyFromBuf(buf, TimesDrowned); + CopyFromBuf(buf, SeagullsKilled); + CopyFromBuf(buf, WeaponBudget); + CopyFromBuf(buf, FashionBudget); + CopyFromBuf(buf, LoanSharks); + CopyFromBuf(buf, StoresKnockedOff); + CopyFromBuf(buf, MovieStunts); + CopyFromBuf(buf, Assassinations); + CopyFromBuf(buf, PizzasDelivered); + CopyFromBuf(buf, GarbagePickups); + CopyFromBuf(buf, IceCreamSold); + CopyFromBuf(buf, TopShootingRangeScore); + CopyFromBuf(buf, ShootingRank); + CopyFromBuf(buf, LongestWheelie); + CopyFromBuf(buf, LongestStoppie); + CopyFromBuf(buf, Longest2Wheel); + CopyFromBuf(buf, LongestWheelieDist); + CopyFromBuf(buf, LongestStoppieDist); + CopyFromBuf(buf, Longest2WheelDist); + CopyFromBuf(buf, PropertyBudget); + CopyFromBuf(buf, AutoPaintingBudget); + CopyFromBuf(buf, PropertyDestroyed); + CopyFromBuf(buf, NumPropertyOwned); + CopyFromBuf(buf, BloodRingKills); + CopyFromBuf(buf, BloodRingTime); + CopyFromBuf(buf, PropertyOwned); + CopyFromBuf(buf, HighestChaseValue); CopyFromBuf(buf, FastestTimes); CopyFromBuf(buf, HighestScores); CopyFromBuf(buf, BestPositions); CopyFromBuf(buf, KillsSinceLastCheckpoint); CopyFromBuf(buf, TotalLegitimateKills); CopyFromBuf(buf, LastMissionPassedName); + CopyFromBuf(buf, CheatedCount); + CopyFromBuf(buf, FavoriteRadioStationList); assert(buf - buf_start == size); #undef CopyFromBuf diff --git a/src/core/Stats.h b/src/core/Stats.h index e6b8df6a..f9ad4174 100644 --- a/src/core/Stats.h +++ b/src/core/Stats.h @@ -1,6 +1,7 @@ #pragma once #include "PedType.h" +#include "audio_enums.h" class CStats { @@ -8,11 +9,10 @@ public: enum { TOTAL_FASTEST_TIMES = 23, TOTAL_HIGHEST_SCORES = 5, - TOTAL_BEST_POSITIONS = 1 + TOTAL_BEST_POSITIONS = 1, + TOTAL_PROPERTIES = 15 }; - //TODO static int32 SeagullsKilled; - static int32 DaysPassed; static int32 HeadsPopped; static int32 CommercialPassed; @@ -25,9 +25,29 @@ public: static int32 TimesDied; static int32 TimesArrested; static int32 KillsSinceLastCheckpoint; - static float DistanceTravelledInVehicle; + static float DistanceTravelledByCar; + static float DistanceTravelledByHelicoptor; + static float DistanceTravelledByBike; + static float DistanceTravelledByBoat; + static float DistanceTravelledByPlane; + static float DistanceTravelledByGolfCart; static float DistanceTravelledOnFoot; + static int32 FlightTime; + static int32 TimesDrowned; + static int32 PhotosTaken; + static float LoanSharks; + static float StoresKnockedOff; + static float MovieStunts; + static float Assassinations; + static float PizzasDelivered; + static float GarbagePickups; + static float IceCreamSold; + static float TopShootingRangeScore; + static float ShootingRank; static int32 CarsExploded; + static int32 BoatsExploded; + static int32 WantedStarsAttained; + static int32 WantedStarsEvaded; static int32 PeopleKilledByPlayer; static int32 ProgressMade; static int32 TotalProgressInGame; @@ -44,51 +64,60 @@ public: static int32 MissionsPassed; static char LastMissionPassedName[8]; static int32 TotalLegitimateKills; - static int32 ElBurroTime; - static int32 Record4x4One; - static int32 Record4x4Two; - static int32 Record4x4Three; - static int32 Record4x4Mayhem; static int32 LivesSavedWithAmbulance; static int32 CriminalsCaught; static int32 HighestLevelAmbulanceMission; + static int32 HighestLevelVigilanteMission; + static int32 HighestLevelFireMission; static int32 FiresExtinguished; - static int32 TimeTakenDefuseMission; static int32 TotalNumberKillFrenzies; static int32 TotalNumberMissions; static int32 RoundsFiredByPlayer; static int32 KgsOfExplosivesUsed; - static int32 InstantHitsFiredByPlayer; - static int32 InstantHitsHitByPlayer; + static int32 BulletsThatHit; static int32 BestTimeBombDefusal; static int32 FastestTimes[TOTAL_FASTEST_TIMES]; static int32 HighestScores[TOTAL_HIGHEST_SCORES]; static int32 BestPositions[TOTAL_BEST_POSITIONS]; + static bool PropertyOwned[TOTAL_PROPERTIES]; + static int32 NumPropertyOwned; static int32 PropertyDestroyed; + static float HighestChaseValue; + static int32 CheatedCount; + static int32 ShowChaseStatOnScreen; static int32 PamphletMissionPassed; + static bool abSonyCDs[1]; + static int32 BloodRingKills; + static int32 BloodRingTime; + static float FavoriteRadioStationList[NUM_RADIOS]; static int32 Sprayings; static float AutoPaintingBudget; static int32 NoMoreHurricanes; static float FashionBudget; + static float PropertyBudget; + static float WeaponBudget; static int32 SafeHouseVisits; static int32 TyresPopped; + static int32 LongestWheelie; + static int32 LongestStoppie; + static int32 Longest2Wheel; + static float LongestWheelieDist; + static float LongestStoppieDist; + static float Longest2WheelDist; + public: static void Init(void); static void RegisterFastestTime(int32, int32); static void RegisterHighestScore(int32, int32); static void RegisterBestPosition(int32, int32); - static void RegisterElBurroTime(int32); - static void Register4x4OneTime(int32); - static void Register4x4TwoTime(int32); - static void Register4x4ThreeTime(int32); - static void Register4x4MayhemTime(int32); static void AnotherLifeSavedWithAmbulance(); static void AnotherCriminalCaught(); static void RegisterLevelAmbulanceMission(int32); + static void RegisterLevelVigilanteMission(int32); + static void RegisterLevelFireMission(int32); static void AnotherFireExtinguished(); static wchar *FindCriminalRatingString(); - static void RegisterTimeTakenDefuseMission(int32); static void AnotherKillFrenzyPassed(); static void SetTotalNumberKillFrenzies(int32); static void SetTotalNumberMissions(int32); @@ -99,5 +128,20 @@ public: static void LoadStats(uint8 *buf, uint32 size); static float GetPercentageProgress(); + static void MoneySpentOnWeapons(int32); + static void MoneySpentOnProperty(int32); + static void MoneySpentOnAutoPainting(int32); static void MoneySpentOnFashion(int32); + + static void NumOfVisitsFromLoanSharks(int32); + static void NumOfStoresKnockedOff(int32); + static void NumOfMovieStunts(int32); + static void NumOfAssassinations(int32); + static void NumOfPizzasDelivered(int32); + static void NumOfGarbagePickups(int32); + static void NumOfIceCreamSold(int32); + static void AddNumBloodRingKills(int32); + + static void LongestTimeInBloodRing(int32); + static void AddPropertyAsOwned(int32); }; diff --git a/src/core/Wanted.cpp b/src/core/Wanted.cpp index c70a3ab5..f5ea6e53 100644 --- a/src/core/Wanted.cpp +++ b/src/core/Wanted.cpp @@ -10,6 +10,7 @@ #include "CopPed.h" #include "Wanted.h" #include "General.h" +#include "Stats.h" int32 CWanted::MaximumWantedLevel = 6; int32 CWanted::nMaximumWantedLevel = 9600; @@ -308,7 +309,6 @@ CWanted::ReportCrimeNow(eCrimeType type, const CVector &coors, bool policeDoesnt UpdateWantedLevel(); } -// TODO(Miami): Stats void CWanted::UpdateWantedLevel() { @@ -318,36 +318,44 @@ CWanted::UpdateWantedLevel() m_nChaos = nMaximumWantedLevel; if (m_nChaos >= 0 && m_nChaos < 50) { + if (m_nWantedLevel == 1) + ++CStats::WantedStarsEvaded; m_nWantedLevel = 0; m_MaximumLawEnforcerVehicles = 0; m_MaxCops = 0; m_RoadblockDensity = 0; } else if (m_nChaos >= 50 && m_nChaos < 180) { + CStats::WantedStarsAttained += 1 - m_nWantedLevel; m_nWantedLevel = 1; m_MaximumLawEnforcerVehicles = 1; m_MaxCops = 1; m_RoadblockDensity = 0; } else if (m_nChaos >= 180 && m_nChaos < 550) { + CStats::WantedStarsAttained += 2 - m_nWantedLevel; m_nWantedLevel = 2; m_MaximumLawEnforcerVehicles = 2; m_MaxCops = 3; m_RoadblockDensity = 0; } else if (m_nChaos >= 550 && m_nChaos < 1200) { + CStats::WantedStarsAttained += 3 - m_nWantedLevel; m_nWantedLevel = 3; m_MaximumLawEnforcerVehicles = 2; m_MaxCops = 4; m_RoadblockDensity = 12; } else if (m_nChaos >= 1200 && m_nChaos < 2400) { + CStats::WantedStarsAttained += 4 - m_nWantedLevel; m_nWantedLevel = 4; m_MaximumLawEnforcerVehicles = 2; m_MaxCops = 6; m_RoadblockDensity = 18; } else if (m_nChaos >= 2400 && m_nChaos < 4800) { + CStats::WantedStarsAttained += 5 - m_nWantedLevel; m_nWantedLevel = 5; m_MaximumLawEnforcerVehicles = 3; m_MaxCops = 8; m_RoadblockDensity = 24; } else if (m_nChaos >= 4800) { + CStats::WantedStarsAttained += 6 - m_nWantedLevel; m_nWantedLevel = 6; m_MaximumLawEnforcerVehicles = 3; m_MaxCops = 10; @@ -494,8 +502,7 @@ CWanted::UpdateCrimesQ(void) void CWanted::Suspend(void) { - // TODO(Miami): Stats - // dwStarsEvaded += m_nWantedLevel; + CStats::WantedStarsEvaded += m_nWantedLevel; m_nMinChaos = m_nChaos; m_nMinWantedLevel = m_nWantedLevel; m_nLastTimeSuspended = CTimer::GetTimeInMilliseconds(); diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 34fbb428..51995cf5 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -439,7 +439,7 @@ DebugMenuPopulate(void) DebugMenuEntrySetWrap(e, true); e = DebugMenuAddVar("Time & Weather", "New Weather", (int16*)&CWeather::NewWeatherType, nil, 1, 0, 5, weathers); DebugMenuEntrySetWrap(e, true); - DebugMenuAddVarBool8("Time & Weather", "Extracolours On", &CTimeCycle::m_bExtraColourOn, nil); + DebugMenuAddVarBool32("Time & Weather", "Extracolours On", &CTimeCycle::m_bExtraColourOn, nil); DebugMenuAddVar("Time & Weather", "Extracolour", &CTimeCycle::m_ExtraColour, nil, 1, 0, 23, extracols); DebugMenuAddVar("Time & Weather", "Time scale", (float*)&CTimer::GetTimeScale(), nil, 0.1f, 0.0f, 10.0f); diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 26c91abb..d009579c 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -3160,6 +3160,8 @@ CPed::SetStoredObjective(void) case OBJECTIVE_GOTO_CHAR_ON_FOOT: case OBJECTIVE_GOTO_CHAR_ON_FOOT_WALKING: case OBJECTIVE_HASSLE_CHAR: + case OBJECTIVE_FOLLOW_CHAR_IN_FORMATION: + case OBJECTIVE_LEAVE_CAR: case OBJECTIVE_ENTER_CAR_AS_PASSENGER: case OBJECTIVE_ENTER_CAR_AS_DRIVER: case OBJECTIVE_GOTO_AREA_ON_FOOT: @@ -4730,9 +4732,11 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi } else { CDarkel::RegisterKillNotByPlayer(this, method); } - if (method == WEAPONTYPE_DROWNING) + if (method == WEAPONTYPE_DROWNING) { bIsInTheAir = false; - // TODO(Miami): timesDrowned + if (FindPlayerPed() == this) + CStats::TimesDrowned++; + } return true; } diff --git a/src/render/SpecialFX.cpp b/src/render/SpecialFX.cpp index 4133e2fb..e9079bef 100644 --- a/src/render/SpecialFX.cpp +++ b/src/render/SpecialFX.cpp @@ -21,6 +21,9 @@ #include "Camera.h" #include "Shadows.h" #include "main.h" +#include "ColStore.h" +#include "Coronas.h" +#include "Script.h" RwIm3DVertex StreakVertices[4]; RwImVertexIndex StreakIndexList[12]; @@ -370,6 +373,8 @@ MarkerAtomicCB(RpAtomic *atomic, void *data) return atomic; } +// --MIAMI: C3dMarker and C3dMarkers done + bool C3dMarker::AddMarker(uint32 identifier, uint16 type, float fSize, uint8 r, uint8 g, uint8 b, uint8 a, uint16 pulsePeriod, float pulseFraction, int16 rotateRate) { @@ -414,6 +419,7 @@ C3dMarker::DeleteMarkerObject() m_nIdentifier = 0; m_nStartTime = 0; m_bIsUsed = false; + m_bFindZOnNextPlacement = false; m_nType = MARKERTYPE_INVALID; frame = RpAtomicGetFrame(m_pAtomic); @@ -457,6 +463,7 @@ C3dMarkers::Init() m_aMarkerArray[i].m_pAtomic = nil; m_aMarkerArray[i].m_nType = MARKERTYPE_INVALID; m_aMarkerArray[i].m_bIsUsed = false; + m_aMarkerArray[i].m_bFindZOnNextPlacement = false; m_aMarkerArray[i].m_nIdentifier = 0; m_aMarkerArray[i].m_Color.red = 255; m_aMarkerArray[i].m_Color.green = 255; @@ -502,8 +509,15 @@ C3dMarkers::Render() ActivateDirectional(); for (int i = 0; i < NUM3DMARKERS; i++) { if (m_aMarkerArray[i].m_bIsUsed) { - if (m_aMarkerArray[i].m_fCameraRange < 120.0f) + if (m_aMarkerArray[i].m_fCameraRange < 150.0f) { m_aMarkerArray[i].Render(); + if (m_aMarkerArray[i].m_nType == MARKERTYPE_ARROW) { + CCoronas::RegisterCorona((uintptr)&m_aMarkerArray[i], + SPHERE_MARKER_R, SPHERE_MARKER_G, SPHERE_MARKER_B, 192, + m_aMarkerArray[i].m_Matrix.GetPosition(), 1.2f * m_aMarkerArray[i].m_fSize, 50.0f * TheCamera.LODDistMultiplier, + CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.0f, false); + } + } NumActiveMarkers++; m_aMarkerArray[i].m_bIsUsed = false; } else if (m_aMarkerArray[i].m_pAtomic != nil) { @@ -516,9 +530,9 @@ C3dMarker * C3dMarkers::PlaceMarker(uint32 identifier, uint16 type, CVector &pos, float size, uint8 r, uint8 g, uint8 b, uint8 a, uint16 pulsePeriod, float pulseFraction, int16 rotateRate) { C3dMarker *pMarker; - + CVector2D playerPos = FindPlayerCentreOfWorld(0); pMarker = nil; - float dist = Sqrt((pos.x - FindPlayerCentreOfWorld(0).x) * (pos.x - FindPlayerCentreOfWorld(0).x) + (pos.y - FindPlayerCentreOfWorld(0).y) * (pos.y - FindPlayerCentreOfWorld(0).y)); + float dist = ((CVector2D)pos - playerPos).Magnitude(); if (type != MARKERTYPE_ARROW && type != MARKERTYPE_CYLINDER) return nil; @@ -591,6 +605,15 @@ C3dMarkers::PlaceMarker(uint32 identifier, uint16 type, CVector &pos, float size } if (type == MARKERTYPE_ARROW) pMarker->m_Matrix.GetPosition() = pos; + + if (pMarker->m_bFindZOnNextPlacement) { + if ((playerPos - pos).MagnitudeSqr() < sq(100.f) && CColStore::HasCollisionLoaded(CVector2D(pos))) { + float z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z + 1.0f, nil); + if (z != 0.0f) + pMarker->m_Matrix.GetPosition().z = z - 0.05f * size; + pMarker->m_bFindZOnNextPlacement = false; + } + } pMarker->m_bIsUsed = true; return pMarker; } @@ -600,9 +623,14 @@ C3dMarkers::PlaceMarker(uint32 identifier, uint16 type, CVector &pos, float size pMarker->AddMarker(identifier, type, size, r, g, b, a, pulsePeriod, pulseFraction, rotateRate); if (type == MARKERTYPE_CYLINDER || type == MARKERTYPE_0 || type == MARKERTYPE_2) { - float z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z + 1.0f, nil); - if (z != 0.0f) - pos.z = z - 0.05f * size; + if ((playerPos - pos).MagnitudeSqr() < sq(100.f) && CColStore::HasCollisionLoaded(CVector2D(pos))) { + float z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z + 1.0f, nil); + if (z != 0.0f) + pos.z = z - 0.05f * size; + pMarker->m_bFindZOnNextPlacement = false; + } else { + pMarker->m_bFindZOnNextPlacement = true; + } } pMarker->m_Matrix.SetTranslate(pos.x, pos.y, pos.z); if (type == MARKERTYPE_2) { diff --git a/src/render/SpecialFX.h b/src/render/SpecialFX.h index 7bc3750a..8c79856b 100644 --- a/src/render/SpecialFX.h +++ b/src/render/SpecialFX.h @@ -79,6 +79,7 @@ public: RpMaterial *m_pMaterial; uint16 m_nType; bool m_bIsUsed; + bool m_bFindZOnNextPlacement; uint32 m_nIdentifier; RwRGBA m_Color; uint16 m_nPulsePeriod; diff --git a/src/render/Timecycle.cpp b/src/render/Timecycle.cpp index 7e8ad5e5..b20a2443 100644 --- a/src/render/Timecycle.cpp +++ b/src/render/Timecycle.cpp @@ -123,7 +123,7 @@ int32 CTimeCycle::m_nCurrentFogColourGreen; int32 CTimeCycle::m_nCurrentFogColourBlue; int32 CTimeCycle::m_FogReduction; -bool CTimeCycle::m_bExtraColourOn; +int32 CTimeCycle::m_bExtraColourOn; int32 CTimeCycle::m_ExtraColour; float CTimeCycle::m_ExtraColourInter; diff --git a/src/render/Timecycle.h b/src/render/Timecycle.h index ad079a95..da911b75 100644 --- a/src/render/Timecycle.h +++ b/src/render/Timecycle.h @@ -114,7 +114,7 @@ class CTimeCycle static int32 m_FogReduction; public: - static bool m_bExtraColourOn; + static int32 m_bExtraColourOn; static int32 m_ExtraColour; static float m_ExtraColourInter; static int32 m_CurrentStoredValue; diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp index 52c1aef7..4f69123b 100644 --- a/src/save/GenericGameStorage.cpp +++ b/src/save/GenericGameStorage.cpp @@ -37,9 +37,10 @@ #include "Weather.h" #include "World.h" #include "Zones.h" +#include "Timecycle.h" #define BLOCK_COUNT 20 -#define SIZE_OF_SIMPLEVARS 0xBC +#define SIZE_OF_SIMPLEVARS 0xD4 const uint32 SIZE_OF_ONE_GAME_IN_BYTES = 201729; @@ -56,7 +57,7 @@ wchar SlotSaveDate[SLOT_COUNT][70]; int CheckSum; eLevelName m_LevelToLoad; char SaveFileNameJustSaved[260]; -int Slots[SLOT_COUNT+1]; +int Slots[SLOT_COUNT]; CDate CompileDateAndTime; bool b_FoundRecentSavedGameWantToLoad; @@ -187,6 +188,14 @@ GenericSave(int file) WriteDataToBufferPointer(buf, TheCamera.CarZoomIndicator); WriteDataToBufferPointer(buf, TheCamera.PedZoomIndicator); #endif + WriteDataToBufferPointer(buf, CGame::currArea); + WriteDataToBufferPointer(buf, CVehicle::bAllTaxisHaveNitro); + // TODO(Miami): Pad invert Y + bool invertY = 0; + WriteDataToBufferPointer(buf, invertY); + WriteDataToBufferPointer(buf, CTimeCycle::m_ExtraColour); + WriteDataToBufferPointer(buf, CTimeCycle::m_bExtraColourOn); + WriteDataToBufferPointer(buf, CTimeCycle::m_ExtraColourInter); assert(buf - work_buff == SIZE_OF_SIMPLEVARS); // Save scripts, block is nested within the same block as simple vars for some reason @@ -315,6 +324,14 @@ GenericLoad() ReadDataFromBufferPointer(buf, TheCamera.CarZoomIndicator); ReadDataFromBufferPointer(buf, TheCamera.PedZoomIndicator); #endif + ReadDataFromBufferPointer(buf, CGame::currArea); + ReadDataFromBufferPointer(buf, CVehicle::bAllTaxisHaveNitro); + // TODO(Miami): Pad invert Y + bool invertY = 0; + ReadDataFromBufferPointer(buf, invertY); + ReadDataFromBufferPointer(buf, CTimeCycle::m_ExtraColour); + ReadDataFromBufferPointer(buf, CTimeCycle::m_bExtraColourOn); + ReadDataFromBufferPointer(buf, CTimeCycle::m_ExtraColourInter); assert(buf - work_buff == SIZE_OF_SIMPLEVARS); #ifdef MISSION_REPLAY WaitForSave = 0; diff --git a/src/save/GenericGameStorage.h b/src/save/GenericGameStorage.h index 069ba7cd..630b3b50 100644 --- a/src/save/GenericGameStorage.h +++ b/src/save/GenericGameStorage.h @@ -31,7 +31,7 @@ extern wchar SlotFileName[SLOT_COUNT][260]; extern wchar SlotSaveDate[SLOT_COUNT][70]; extern int CheckSum; extern enum eLevelName m_LevelToLoad; -extern int Slots[SLOT_COUNT+1]; +extern int Slots[SLOT_COUNT]; extern bool b_FoundRecentSavedGameWantToLoad; extern bool JustLoadedDontFadeInYet; diff --git a/src/save/PCSave.cpp b/src/save/PCSave.cpp index da8134fc..8514a2b6 100644 --- a/src/save/PCSave.cpp +++ b/src/save/PCSave.cpp @@ -88,7 +88,7 @@ void C_PcSave::PopulateSlotInfo() { for (int i = 0; i < SLOT_COUNT; i++) { - Slots[i + 1] = SLOT_EMPTY; + Slots[i] = SLOT_EMPTY; SlotFileName[i][0] = '\0'; SlotSaveDate[i][0] = '\0'; } @@ -108,14 +108,14 @@ C_PcSave::PopulateSlotInfo() if (file != 0) { CFileMgr::Read(file, (char*)&header, sizeof(header)); if (strncmp((char*)&header, TopLineEmptyFile, sizeof(TopLineEmptyFile)-1) != 0) { - Slots[i + 1] = SLOT_OK; + Slots[i] = SLOT_OK; memcpy(SlotFileName[i], &header.FileName, sizeof(header.FileName)); SlotFileName[i][24] = '\0'; } CFileMgr::CloseFile(file); } - if (Slots[i + 1] == SLOT_OK) { + if (Slots[i] == SLOT_OK) { if (CheckDataNotCorrupt(i, savename)) { SYSTEMTIME st; memcpy(&st, &header.SaveDateTime, sizeof(SYSTEMTIME)); @@ -147,7 +147,7 @@ C_PcSave::PopulateSlotInfo() } else { CMessages::InsertNumberInString(TheText.Get("FEC_SLC"), i + 1, -1, -1, -1, -1, -1, SlotFileName[i]); - Slots[i + 1] = SLOT_CORRUPTED; + Slots[i] = SLOT_CORRUPTED; } } } diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index 0d8361b8..d94f2e80 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -1390,7 +1390,7 @@ WinMain(HINSTANCE instance, RwChar** argv; SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, nil, SPIF_SENDCHANGE); -#if 0 +#if 1 // TODO: make this an option somewhere AllocConsole(); freopen("CONIN$", "r", stdin); diff --git a/src/weapons/BulletInfo.cpp b/src/weapons/BulletInfo.cpp index 41d9c730..0efe6688 100644 --- a/src/weapons/BulletInfo.cpp +++ b/src/weapons/BulletInfo.cpp @@ -113,7 +113,7 @@ void CBulletInfo::Update(void) CEntity* pHitEntity; if (CWorld::ProcessLineOfSight(vecOldPos, vecNewPos, point, pHitEntity, true, true, true, true, true, false, false, true)) { if (pBullet->m_pSource && (pHitEntity->IsPed() || pHitEntity->IsVehicle())) - CStats::InstantHitsHitByPlayer++; + CStats::BulletsThatHit++; CWeapon::CheckForShootingVehicleOccupant(&pHitEntity, &point, pBullet->m_eWeaponType, vecOldPos, vecNewPos); if (pHitEntity->IsPed()) { diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp index 8e7e4265..0cd439c2 100644 --- a/src/weapons/Weapon.cpp +++ b/src/weapons/Weapon.cpp @@ -1466,20 +1466,20 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim, } case ENTITY_TYPE_VEHICLE: { - CStats::InstantHitsHitByPlayer++; + CStats::BulletsThatHit++; DMAudio.PlayOneShot(((CPhysical*)victim)->m_audioEntityId, SOUND_WEAPON_HIT_VEHICLE, 1.0f); break; } case ENTITY_TYPE_PED: { - CStats::InstantHitsHitByPlayer++; + CStats::BulletsThatHit++; DMAudio.PlayOneShot(((CPhysical*)victim)->m_audioEntityId, SOUND_WEAPON_HIT_PED, 1.0f); ((CPed*)victim)->Say(SOUND_PED_BULLET_HIT); break; } case ENTITY_TYPE_OBJECT: { - CStats::InstantHitsHitByPlayer++; + CStats::BulletsThatHit++; PlayOneShotScriptObject(SCRIPT_SOUND_BULLET_HIT_GROUND_2, point->point); break; } @@ -1862,7 +1862,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource) case ENTITY_TYPE_VEHICLE: { if (!statUpdated) { - CStats::InstantHitsHitByPlayer++; + CStats::BulletsThatHit++; statUpdated = true; } DMAudio.PlayOneShot(((CPhysical*)victim)->m_audioEntityId, SOUND_WEAPON_HIT_VEHICLE, 1.0f); @@ -1871,7 +1871,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource) case ENTITY_TYPE_PED: { if (!statUpdated) { - CStats::InstantHitsHitByPlayer++; + CStats::BulletsThatHit++; statUpdated = true; } DMAudio.PlayOneShot(((CPhysical*)victim)->m_audioEntityId, SOUND_WEAPON_HIT_PED, 1.0f); @@ -1881,7 +1881,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource) case ENTITY_TYPE_OBJECT: { if (!statUpdated) { - CStats::InstantHitsHitByPlayer++; + CStats::BulletsThatHit++; statUpdated = true; } PlayOneShotScriptObject(SCRIPT_SOUND_BULLET_HIT_GROUND_2, point.point); @@ -2071,9 +2071,6 @@ CWeapon::FireSniper(CEntity *shooter) CBulletInfo::AddBullet(shooter, m_eWeaponType, source, dir); if ( shooter == FindPlayerPed() ) - CStats::InstantHitsFiredByPlayer++; - - if ( shooter == FindPlayerPed() ) { CPad::GetPad(0)->StartShake_Distance(240, 128, FindPlayerPed()->GetPosition().x, |