Skip to content

Commit

Permalink
Script Vehicle Randomizer: Fix Triathlon Crashes and Bikes
Browse files Browse the repository at this point in the history
* You can now use any vehicle in the cycling section of the
  triathlon.

* The game no longer crashes on starting Triathlon with the Script
  Vehicle Randomizer
  • Loading branch information
Parik27 committed Oct 26, 2021
1 parent 5000a8b commit eec96ca
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build-count.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
480
484
2 changes: 1 addition & 1 deletion data/Ramps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ docks_setup prop_fnclink_02e -53.5835 -2400.72 21.3826 0.147506 0.69614 -0.68672
docks_setup prop_fnclink_02e -64.8061 -2400.72 16.3484 0.147506 0.69614 -0.686726 0.148455
docks_setup prop_fnclink_02e -75.9732 -2400.72 11.3388 0.147506 0.69614 -0.686726 0.148455
docks_setup prop_fnclink_02e -87.1404 -2400.72 6.32913 0.147506 0.69614 -0.686726 0.148455
armenian1 vw_prop_casino_art_statue_02a -1906.53 -576.32 18.4972 0 0 0.941775 0.336244
armenian1 vw_prop_casino_art_statue_02a -1906.53 -576.32 18.4972 0 0 0.941775 0.336244
6 changes: 5 additions & 1 deletion data/VehiclePatterns.txt
Original file line number Diff line number Diff line change
Expand Up @@ -349,4 +349,8 @@ vehicle_gen_controller Tailgater 1 Y Y Y Y Y N Y Y Y Y N N
vehicle_gen_controller Bodhi2 1 Y Y Y Y Y N Y Y Y Y N N
taxilauncher Taxi 4 N N N N N N N N N N N N
hao1 AllVehicles 1 Y Y Y Y N Y N Y N N N N
mission_race Seashark 1 N N N N N N N Y N Y N N
mission_race Seashark 1 N N N N N N N Y N Y N N
triathlonsp Frogger 1 N N N N N N N N N N N N
triathlonsp Tribike3 1 Y Y Y Y Y N N N N Y N N
triathlonsp Tribike2 1 Y Y Y Y Y N N N N Y N N
triathlonsp Tribike 1 Y Y Y Y Y N N N N Y N N
15 changes: 15 additions & 0 deletions src/vehicles/vehicles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,24 @@ class ScriptVehicleRandomizer
return true;
}

/*******************************************************/
static void
RemoveTriathlonFailState (scrThread::Info *info)
{
if (scrThread::CheckActiveThread ("triathlonsp"_joaat))
{
if (info->GetArg (1) == "tribike"_joaat)
info->GetReturn () = true;
}
}

public:
/*******************************************************/
ScriptVehicleRandomizer ()
{
#define HOOK(native, func) NativeCallbackMgr::Add<native##_joaat, func, true> ()
#define HOOK_A(native, func) \
NativeCallbackMgr::Add<native##_joaat, func, false> ()

if (!ConfigManager::ReadConfig (
"ScriptVehicleRandomizer",
Expand All @@ -332,6 +345,8 @@ class ScriptVehicleRandomizer
return;

HOOK ("APPLY_FORCE_TO_ENTITY", FixFinaleC2Physics);
HOOK_A ("IS_VEHICLE_MODEL", RemoveTriathlonFailState);
HOOK_A ("IS_PED_IN_MODEL", RemoveTriathlonFailState);

InitialiseAllComponents ();
InitialiseRandomVehiclesHook ();
Expand Down

0 comments on commit eec96ca

Please sign in to comment.