Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/game/features/vehicle/BigLoudSubwoofer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include "core/commands/LoopedCommand.hpp"
#include "game/backend/Self.hpp"
#include "game/gta/Natives.hpp"
#include "game/gta/Pools.hpp"

namespace YimMenu::Features
{
class AllVehsLoudRadio : public LoopedCommand
{
using LoopedCommand::LoopedCommand;

virtual void OnTick() override
{
for (auto veh : Pools::GetVehicles())
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we enabling it for all vehicles?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be OnTick either. This only works accidentally because he's looping it. Setting the engine on at the end makes no sense, it should be at the top with a short yield but still, there's no need for all of that. All he needs to do is call SET_VEHICLE_RADIO_LOUD on the player's vehicle only once on enable. If he wants it to persist when the player changes vehicles then he will have to manually track it by adding a member Vehicle::m_HasLoudRadio.

veh.ForceControl();
auto handle = veh.GetHandle();
auto target_veh = Vehicle(handle);
if (target_veh.RequestControl())
AUDIO::SET_VEHICLE_RADIO_ENABLED(handle, 1);
AUDIO::SET_VEHICLE_RADIO_LOUD(handle, 1);
VEHICLE::SET_VEHICLE_ENGINE_ON(handle, 1, 1, 0);
}
return;
}
};

static AllVehsLoudRadio _AllVehsLoudRadio{"loudsubwoffer", "Subwoofer", "Enables loud radio on vehicles, Players can hear it."};
}
5 changes: 3 additions & 2 deletions src/game/frontend/submenus/Vehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace YimMenu::Submenus
{
Vehicle::Vehicle() :
#define ICON_FA_CAR "\xef\x86\xb9"
Submenu::Submenu("Vehicle", ICON_FA_CAR)
Submenu::Submenu("Vehicle", ICON_FA_CAR)
{
auto main = std::make_shared<Category>("Main");

Expand All @@ -32,6 +32,7 @@ namespace YimMenu::Submenus

misc->AddItem(std::make_shared<BoolCommandItem>("speedometer"_J));
misc->AddItem(std::make_shared<BoolCommandItem>("seatbelt"_J));
misc->AddItem(std::make_shared<BoolCommandItem>("loudsubwoffer"_J));
misc->AddItem(std::make_shared<BoolCommandItem>("lowervehiclestance"_J, "Lower Stance"));
misc->AddItem(std::make_shared<BoolCommandItem>("allowhatsinvehicles"_J));
misc->AddItem(std::make_shared<BoolCommandItem>("lsccustomsbypass"_J));
Expand All @@ -46,4 +47,4 @@ namespace YimMenu::Submenus
AddCategory(BuildVehicleEditorMenu());
AddCategory(BuildSavedVehiclesMenu());
}
}
}
2 changes: 1 addition & 1 deletion src/game/pointers/Pointers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,4 +509,4 @@ namespace YimMenu
PatternCache::Update();
return true;
}
}
}