diff --git a/resource/common/locale/English.toml b/resource/common/locale/English.toml index b6da720..14bc1b5 100644 --- a/resource/common/locale/English.toml +++ b/resource/common/locale/English.toml @@ -46,6 +46,8 @@ CameraZoom = "Camera zoom" CameraZoomLock = "Lock camera zoom" CameraZoomLockFreecam = "Freecam is enabled. Camera zoom can't work together with freecam mode" CameraZoomLockInfo = "Note: This will permanently lock camera zoom. Snipers or scopes won't work properly!" +ChangeRadioStaion = "Change radio station" +CurrentStation = "Current staion" Cloudy = "Cloudy" Country = "Country" CurrentDay = "Current day" @@ -95,6 +97,7 @@ Mission loader may cause, It's recommanded not to save after using the mission loader. Use it at your own risk!""" Missions = "Missions" MissionStartFailed = "Can't start mission now" +MobileRadio = "Mobile radio" MovementSpeed = "Movement speed" Ninja = "Ninja" NoWaterPhysics = "No water physics" diff --git a/src/animation.cpp b/src/animation.cpp index c881904..6ea76cb 100644 --- a/src/animation.cpp +++ b/src/animation.cpp @@ -32,6 +32,20 @@ void Cutscene::Play(std::string& rootKey, std::string& cutsceneId, std::string& if (pPlayer) { m_SceneName = cutsceneId; + m_pLastVeh = pPlayer->m_nPedFlags.bInVehicle ? pPlayer->m_pVehicle : nullptr; + m_nVehSeat = -1; + + if (m_pLastVeh->m_pDriver != pPlayer) + { + for (size_t i = 0; i != 8; ++i) + { + if (m_pLastVeh->m_apPassengers[i] == pPlayer) + { + m_nVehSeat = i; + break; + } + } + } Command(cutsceneId.c_str()); m_nInterior = pPlayer->m_nAreaCode; pPlayer->m_nAreaCode = std::stoi(interior); @@ -358,12 +372,23 @@ void Animation::ShowPage() { if (Cutscene::m_bRunning) { + CPlayerPed* player = FindPlayerPed(); + int hPlayer = CPools::GetPedRef(player); + int hVeh = CPools::GetVehicleRef(Cutscene::m_pLastVeh); Command(); Cutscene::m_bRunning = false; Cutscene::m_SceneName = ""; - CPlayerPed* player = FindPlayerPed(); player->m_nAreaCode = Cutscene::m_nInterior; Command(player->m_nAreaCode); + + if (Cutscene::m_nVehSeat == -1) + { + Command(hPlayer, hVeh); + } + else + { + Command(hPlayer, hVeh, Cutscene::m_nVehSeat); + } Cutscene::m_nInterior = 0; TheCamera.Fade(0, 1); } diff --git a/src/animation.h b/src/animation.h index 521feb4..4459f9b 100644 --- a/src/animation.h +++ b/src/animation.h @@ -9,6 +9,8 @@ public: static inline std::string m_SceneName; static inline int m_nInterior; // player interior backup static inline bool m_bRunning; + static inline CVehicle *m_pLastVeh; + static inline int m_nVehSeat; static void Play(std::string& rootKey, std::string& cutsceneId, std::string& interior); }; diff --git a/src/game.cpp b/src/game.cpp index 3e8f43c..0994e10 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #endif #ifdef GTASA @@ -575,6 +576,45 @@ void Game::ShowPage() } } #ifdef GTASA + if (Widget::Checkbox(TEXT("Game.MobileRadio"), &m_bMobileRadio)) + { + // AERadioTrackManager.StartRadio(5, 0, 0, 0); + CallMethodAndReturn((int)&AERadioTrackManager, 5, 0, 0, 0); + patch::Nop(0x576C4E, 30); + // CVehicle *pVeh = FindPlayerVehicle(-1, false); + // static tVehicleAudioSettings settings; + // if (m_bMobileRadio) + // { + // patch::PutRetn(0x4F5BA0); + // patch::PutRetn(0x4FCF40); + // patch::PutRetn(0x4F5B60); + // patch::PutRetn(0x4F5700); + + // patch::PutRetn(0x4E9820); + + // if (!pVeh) + // { + // settings.m_nRadioType = RADIO_CIVILIAN; + // settings.m_nRadioID = RADIO_K_DST; + // settings.m_fBassEq = 1.0; + // settings.m_nBassSetting = 1; + // CAEVehicleAudioEntity::s_pVehicleAudioSettingsForRadio = &settings; + // // CAEVehicleAudioEntity::s_pPlayerDriver = FindPlayerPed(); + // CallMethod<0x4EB550, int, int>(0x8CB6F8, (int)&settings); + // } + // } + // else + // { + // patch::Set(0x4F5BA0, 0x90); + // patch::Set(0x4FCF40, 0x51); + // patch::Set(0x4F5B60, 0x0F); + // patch::Set(0x4F5700, 0x51); + // CAEVehicleAudioEntity::s_pVehicleAudioSettingsForRadio = nullptr; + // // CAEVehicleAudioEntity::s_pPlayerDriver = nullptr; + // // AERadioTrackManager.StopRadio(&settings, 0); + // Call<0x4E9820, int, int, int>((int)&AERadioTrackManager, 0, 0); + // } + } if (Widget::Checkbox(TEXT("Game.NoWaterPhysics"), &m_bNoWaterPhysics)) { if (m_bNoWaterPhysics) @@ -663,6 +703,45 @@ void Game::ShowPage() ImGui::Spacing(); ImGui::Separator(); } + if (ImGui::CollapsingHeader(TEXT("Game.ChangeRadioStaion"))) + { + static std::string channels[] = { + "Playback FM", "KRose", "KDST", "Bounce FM", "SFUR", "Radio Los Santos", "Radio X", + "CSR ", "KJah West", "Master Sounds", "WCTR", "User Tracks", "None" + }; + + int channelIndex = 0; + Command(&channelIndex); + if (ImGui::ArrowButton("Left", ImGuiDir_Left)) + { + if (channelIndex == 0) + { + channelIndex = 12; + } + else + { + --channelIndex; + } + Command(channelIndex); + } + ImGui::SameLine(); + ImGui::Text("%s: %s",TEXT("Game.CurrentStation"), channels[channelIndex].c_str()); + ImGui::SameLine(); + if (ImGui::ArrowButton("Right", ImGuiDir_Right)) + { + if (channelIndex == 12) + { + channelIndex = 0; + } + else + { + ++channelIndex; + } + Command(channelIndex); + } + ImGui::Spacing(); + ImGui::Separator(); + } if (ImGui::CollapsingHeader(TEXT("Game.CurrentDay"))) { int day = CClock::CurrentDay - 1; diff --git a/src/game.h b/src/game.h index 45587d4..9b078ee 100644 --- a/src/game.h +++ b/src/game.h @@ -45,6 +45,7 @@ private: static inline bool m_bDisableCheats; static inline bool m_bDisableReplay; static inline bool m_bMissionTimer; + static inline bool m_bMobileRadio; struct HardMode { diff --git a/src/menu.cpp b/src/menu.cpp index ca358f8..ba1f59b 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -505,7 +505,7 @@ void Menu::ShowPage() { ImGui::TextWrapped(TEXT("Menu.OpenCMDUsing"), commandWindow.GetNameString().c_str()); ImGui::Spacing(); - if (ImGui::CollapsingHeader(TEXT("Menu.SeArmourCMD"))) + if (ImGui::CollapsingHeader(TEXT("Menu.SetArmourCMD"))) { ImGui::Spacing(); ImGui::TextWrapped(TEXT("Menu.SetArmourCMDText")); diff --git a/src/player.cpp b/src/player.cpp index ce3eec9..dace574 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -808,7 +808,7 @@ void Player::ShowPage() { ImGui::Spacing(); - if (Widget::Checkbox(TEXT("Player.AimSkinChanger"), &m_bAimSkinChanger, TEXT("Player.AimSkinChangerTip") + aimSkinChanger.Pressed())) + if (Widget::Checkbox(TEXT("Player.AimSkinChanger"), &m_bAimSkinChanger, (TEXT_S("Player.AimSkinChangerTip") + aimSkinChanger.GetNameString()).c_str())) { gConfig.Set("Features.AimSkinChanger", m_bAimSkinChanger); }