Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.92 KB | None | 0 0
  1. #include <switch.h>
  2.  
  3. #include "acmd_imports.hpp"
  4. #include "l2c_imports.hpp"
  5. #include "lua_helper.hpp"
  6.  
  7. using namespace lib;
  8. namespace app::sv_system {
  9. u64 battle_object(u64) asm("_ZN3app9sv_system13battle_objectEP9lua_State") LINKABLE;
  10. u64 battle_object_module_accessor(u64) asm("_ZN3app9sv_system29battle_object_module_accessorEP9lua_State") LINKABLE;
  11. u8 battle_object_category(u64) asm("_ZN3app9sv_system22battle_object_categoryEP9lua_State") LINKABLE;
  12. int battle_object_kind(u64) asm("_ZN3app9sv_system18battle_object_kindEP9lua_State") LINKABLE;
  13. }
  14.  
  15. namespace app::lua_bind
  16. {
  17. namespace AttackModule
  18. {
  19. void clear_all(u64) asm("_ZN3app8lua_bind28AttackModule__clear_all_implEPNS_26BattleObjectModuleAccessorE") LINKABLE;
  20. }
  21. namespace WorkModule
  22. {
  23. void set_int(u64,int) asm("_ZN3app8lua_bind24WorkModule__set_int_implEPNS_26BattleObjectModuleAccessorEii") LINKABLE;
  24. void on_flag(u64,int) asm("_ZN3app8lua_bind24WorkModule__on_flag_implEPNS_26BattleObjectModuleAccessorEi") LINKABLE;
  25. void off_flag(u64,int) asm("_ZN3app8lua_bind25WorkModule__off_flag_implEPNS_26BattleObjectModuleAccessorEi") LINKABLE;
  26. }
  27. }
  28.  
  29. struct ACMD
  30. {
  31. L2CAgent* l2c_agent;
  32. u64 module_accessor;
  33.  
  34. ACMD(L2CAgent* agent) {
  35. l2c_agent = agent;
  36. module_accessor = app::sv_system::battle_object_module_accessor(l2c_agent->lua_state_agent);
  37. }
  38. void frame(float f) {
  39. l2c_agent->clear_lua_stack();
  40. L2CValue frame_val(f);
  41. l2c_agent->push_lua_stack(&frame_val);
  42. app::sv_animcmd::frame(l2c_agent->lua_state_agent, f);
  43. l2c_agent->clear_lua_stack();
  44. }
  45.  
  46. void wait(float f) {
  47. l2c_agent->clear_lua_stack();
  48. L2CValue frame_val(f);
  49. l2c_agent->push_lua_stack(&frame_val);
  50. app::sv_animcmd::wait(l2c_agent->lua_state_agent, f);
  51. l2c_agent->clear_lua_stack();
  52. }
  53. bool is_excute() {
  54. app::sv_animcmd::is_excute(l2c_agent->lua_state_agent);
  55. L2CValue is_excute;
  56. get_lua_stack(l2c_agent, 1, (u64*)&is_excute);
  57. bool excute = is_excute.raw;
  58. l2c_agent->clear_lua_stack();
  59. return excute;
  60. }
  61.  
  62. void ATTACK(
  63. u64 i1,
  64. u64 i2,
  65. u64 h1,
  66. float f1,
  67. u64 i3,
  68. u64 i4,
  69. u64 i5,
  70. u64 i6,
  71. float f2,
  72. float f3,
  73. float f4,
  74. float f5,
  75. //void,
  76. //void,
  77. //void,
  78. float f6,
  79. float f7,
  80. u64 i7,
  81. u64 i8,
  82. u64 i9,
  83. u64 i10,
  84. float f8,
  85. u64 i11,
  86. u64 i12,
  87. u64 i13,
  88. u64 i14,
  89. u64 i15,
  90. u64 i16,
  91. u64 i17,
  92. u64 i18,
  93. u64 i19,
  94. u64 i20,
  95. u64 h2,
  96. u64 i21,
  97. u64 i22,
  98. u64 i23
  99. ) {
  100. L2CValue hitbox_params[36] = {
  101. {.type = L2C_integer, .raw = i1}, // ID
  102. {.type = L2C_integer, .raw = i2}, // Unk
  103. {.type = L2C_hash, .raw = h1}, // Joint
  104. {.type = L2C_number, .raw_float = f1}, // Damage
  105. {.type = L2C_integer, .raw = i3}, // Angle
  106. {.type = L2C_integer, .raw = i4}, // KBG
  107. {.type = L2C_integer, .raw = i5}, // WBKB
  108. {.type = L2C_integer, .raw = i6}, // BKB
  109. {.type = L2C_number, .raw_float = f2}, // Size
  110. {.type = L2C_number, .raw_float = f3}, // X
  111. {.type = L2C_number, .raw_float = f4}, // Y
  112. {.type = L2C_number, .raw_float = f5}, // Z
  113. {.type = L2C_void, .raw = 0}, // X2
  114. {.type = L2C_void, .raw = 0}, // Y2
  115. {.type = L2C_void, .raw = 0}, // Z2
  116. {.type = L2C_number, .raw_float = f6}, // Hitlag
  117. {.type = L2C_number, .raw_float = f7}, // SDI
  118. {.type = L2C_integer, .raw = i7},
  119. {.type = L2C_integer, .raw = i8},
  120. {.type = L2C_integer, .raw = i9},
  121. {.type = L2C_integer, .raw = i10},
  122. {.type = L2C_number, .raw_float = f8},
  123. {.type = L2C_integer, .raw = i11},
  124. {.type = L2C_integer, .raw = i12},
  125. {.type = L2C_integer, .raw = i13},
  126. {.type = L2C_integer, .raw = i14},
  127. {.type = L2C_integer, .raw = i15},
  128. {.type = L2C_integer, .raw = i16},
  129. {.type = L2C_integer, .raw = i17},
  130. {.type = L2C_integer, .raw = i18},
  131. {.type = L2C_integer, .raw = i19},
  132. {.type = L2C_integer, .raw = i20},
  133. {.type = L2C_hash, .raw = h2},
  134. {.type = L2C_integer, .raw = i21},
  135. {.type = L2C_integer, .raw = i22},
  136. {.type = L2C_integer, .raw = i23},
  137. };
  138.  
  139. for (size_t i = 0; i < 36; i++)
  140. l2c_agent->push_lua_stack(&hitbox_params[i]);
  141.  
  142. app::sv_animcmd::ATTACK(l2c_agent->lua_state_agent);
  143.  
  144. l2c_agent->clear_lua_stack();
  145. }
  146. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement