From a87df6579ea833452281982f5379f517aa262d0e Mon Sep 17 00:00:00 2001 From: Jannik Vogel Date: Wed, 1 Jun 2016 23:55:08 +0200 Subject: [PATCH] Script: 0329 (Has Respray Happened) --- rwengine/src/script/modules/GameModule.cpp | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/rwengine/src/script/modules/GameModule.cpp b/rwengine/src/script/modules/GameModule.cpp index 8d8a194f..bf3af899 100644 --- a/rwengine/src/script/modules/GameModule.cpp +++ b/rwengine/src/script/modules/GameModule.cpp @@ -777,6 +777,29 @@ void game_set_zone_ped_group(const ScriptArguments& args) } } +bool game_has_respray_happened(const ScriptArguments& args) +{ + const auto& garages = args.getWorld()->state->garages; + int garageIndex = args[0].integerValue(); + + RW_CHECK(garageIndex >= 0, "Garage index too low"); + RW_CHECK(garageIndex < static_cast(garages.size()), "Garage index too high"); + const auto& garage = garages[garageIndex]; + + if (garage.type != GarageInfo::GARAGE_RESPRAY) { + return false; + } + + auto playerobj = args.getWorld()->pedestrianPool.find(args.getState()->playerObject); + auto pp = playerobj->getPosition(); + if (pp.x >= garage.min.x && pp.y >= garage.min.y && pp.z >= garage.min.z && + pp.x <= garage.max.x && pp.y <= garage.max.y && pp.z <= garage.max.z) { + return true; + } + + return false; +} + void game_display_text(const ScriptArguments& args) { glm::vec2 pos(args[0].real, args[1].real); @@ -1253,6 +1276,8 @@ GameModule::GameModule() bindFunction(0x0324, game_set_zone_ped_group, 3, "Set zone ped group" ); bindUnimplemented( 0x0325, game_create_car_fire, 2, "Create Car Fire" ); + bindFunction( 0x0329, game_has_respray_happened, 1, "Has Respray Happened" ); + bindUnimplemented( 0x032B, game_create_weapon_pickup, 7, "Create Weapon Pickup" ); bindUnimplemented( 0x0335, game_free_resprays, 1, "Set Free Respray" );