From f555d43c7601da6e23b40d35905e9f62bd3d0ace Mon Sep 17 00:00:00 2001 From: jugeeya <jugeeya@live.com> Date: Tue, 21 May 2019 08:41:05 -0700 Subject: [PATCH] fix DI --- source/acmd_wrapper.hpp | 5 +++++ source/training_mods.hpp | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/source/acmd_wrapper.hpp b/source/acmd_wrapper.hpp index 228b308..09db985 100644 --- a/source/acmd_wrapper.hpp +++ b/source/acmd_wrapper.hpp @@ -25,6 +25,11 @@ namespace app::sv_system u64 battle_object_module_accessor(u64) asm("_ZN3app9sv_system29battle_object_module_accessorEP9lua_State") LINKABLE; } +namespace app::sv_math +{ + int rand(u64 hash, int endIndex) asm("_ZN3app7sv_math4randEN3phx6Hash40Ei") LINKABLE; +} + namespace app::lua_bind { namespace AttackModule diff --git a/source/training_mods.hpp b/source/training_mods.hpp index 99166d5..8f7a7c7 100644 --- a/source/training_mods.hpp +++ b/source/training_mods.hpp @@ -58,8 +58,8 @@ namespace app::lua_bind::WorkModule { float angle = (DI_STATE - 1) * M_PI / 4.0; // Either 0 (right) or PI (left) - if (DI_STATE = DI_RANDOM_IN_AWAY) { - angle = (rand() % 2) * M_PI; + if (DI_STATE == DI_RANDOM_IN_AWAY) { + angle = app::sv_math::rand(hash40("fighter"), 2) * M_PI; } // If facing left, reverse angle