Fix bugs with cutscene player

This commit is contained in:
Grinch_ 2022-07-28 09:29:04 +06:00
parent 5311ada582
commit 28f21de664
7 changed files with 113 additions and 3 deletions

View File

@ -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"

View File

@ -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<Commands::LOAD_CUTSCENE>(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<Commands::CLEAR_CUTSCENE>();
Cutscene::m_bRunning = false;
Cutscene::m_SceneName = "";
CPlayerPed* player = FindPlayerPed();
player->m_nAreaCode = Cutscene::m_nInterior;
Command<Commands::SET_AREA_VISIBLE>(player->m_nAreaCode);
if (Cutscene::m_nVehSeat == -1)
{
Command<Commands::WARP_CHAR_INTO_CAR>(hPlayer, hVeh);
}
else
{
Command<Commands::WARP_CHAR_INTO_CAR_AS_PASSENGER>(hPlayer, hVeh, Cutscene::m_nVehSeat);
}
Cutscene::m_nInterior = 0;
TheCamera.Fade(0, 1);
}

View File

@ -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);
};

View File

@ -7,6 +7,7 @@
#include <CIplStore.h>
#include <CMessages.h>
#include <CSprite2d.h>
#include <CAERadioTrackManager.h>
#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, 0x4EB3C0, int, int, int, int, int>((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<uint8_t>(0x4F5BA0, 0x90);
// patch::Set<uint8_t>(0x4FCF40, 0x51);
// patch::Set<uint8_t>(0x4F5B60, 0x0F);
// patch::Set<uint8_t>(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<Commands::GET_RADIO_CHANNEL>(&channelIndex);
if (ImGui::ArrowButton("Left", ImGuiDir_Left))
{
if (channelIndex == 0)
{
channelIndex = 12;
}
else
{
--channelIndex;
}
Command<Commands::SET_RADIO_CHANNEL>(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<Commands::SET_RADIO_CHANNEL>(channelIndex);
}
ImGui::Spacing();
ImGui::Separator();
}
if (ImGui::CollapsingHeader(TEXT("Game.CurrentDay")))
{
int day = CClock::CurrentDay - 1;

View File

@ -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
{

View File

@ -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"));

View File

@ -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);
}