Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
WistfulHopes authored Jun 7, 2023
1 parent 4cdb85e commit 79b5516
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 7 deletions.
17 changes: 10 additions & 7 deletions disp_hitboxes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@ local reversePairs = function ( aTable )
end

re.on_draw_ui(function()
changed, display_hitboxes = imgui.checkbox("Display Hitboxes", display_hitboxes)
changed, display_hurtboxes = imgui.checkbox("Display Hurtboxes", display_hurtboxes)
changed, display_pushboxes = imgui.checkbox("Display Pushboxes", display_pushboxes)
changed, display_throwboxes = imgui.checkbox("Display Throw Boxes", display_throwboxes)
changed, display_throwhurtboxes = imgui.checkbox("Display Throw Hurtboxes", display_throwhurtboxes)
changed, display_proximityboxes = imgui.checkbox("Display Proximity Boxes", display_proximityboxes)
changed, hide_p2 = imgui.checkbox("Hide P2 Boxes", hide_p2)
if imgui.tree_node("Hitbox Viewer") then
changed, display_hitboxes = imgui.checkbox("Display Hitboxes", display_hitboxes)
changed, display_hurtboxes = imgui.checkbox("Display Hurtboxes", display_hurtboxes)
changed, display_pushboxes = imgui.checkbox("Display Pushboxes", display_pushboxes)
changed, display_throwboxes = imgui.checkbox("Display Throw Boxes", display_throwboxes)
changed, display_throwhurtboxes = imgui.checkbox("Display Throw Hurtboxes", display_throwhurtboxes)
changed, display_proximityboxes = imgui.checkbox("Display Proximity Boxes", display_proximityboxes)
changed, hide_p2 = imgui.checkbox("Hide P2 Boxes", hide_p2)
imgui.tree_pop()
end
end)

re.on_frame(function()
Expand Down
132 changes: 132 additions & 0 deletions info_display.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
local gBattle
local p1 = {}
local p2 = {}
local changed
local display_info = true

local reversePairs = function ( aTable )
local keys = {}

for k,v in pairs(aTable) do keys[#keys+1] = k end
table.sort(keys, function (a, b) return a>b end)

local n = 0

return function ( )
n = n + 1
return keys[n], aTable[keys[n] ]
end
end

function bitand(a, b)
local result = 0
local bitval = 1
while a > 0 and b > 0 do
if a % 2 == 1 and b % 2 == 1 then -- test the rightmost bits
result = result + bitval -- set the current bit
end
bitval = bitval * 2 -- shift left
a = math.floor(a/2) -- shift right
b = math.floor(b/2)
end
return result
end

re.on_draw_ui(function()
if imgui.tree_node("Battle Info Display") then
changed, display_info = imgui.checkbox("Display Battle Info", display_info)
imgui.tree_pop()
end
end)

re.on_frame(function()
if display_info == false then return end
gBattle = sdk.find_type_definition("gBattle")
if gBattle then
imgui.begin_window("Battle Data", true, 0)

local sPlayer = gBattle:get_field("Player"):get_data(nil)
local cPlayer = sPlayer.mcPlayer
local BattleTeam = gBattle:get_field("Team"):get_data(nil)
local cTeam = BattleTeam.mcTeam

p1.posX = cPlayer[0].pos.x.v / 65336.0
p1.posY = cPlayer[0].pos.y.v / 65336.0
p1.spdX = cPlayer[0].speed.x.v / 65336.0
p1.spdY = cPlayer[0].speed.y.v / 65336.0
p1.aclX = cPlayer[0].alpha.x.v / 65336.0
p1.aclY = cPlayer[0].alpha.y.v / 65336.0
p1.dir = bitand(cPlayer[0].BitValue, 128) == 128
p1.hitstop = cPlayer[0].hit_stop
p1.stance = cPlayer[0].pose_st
p1.juggle = cPlayer[0].combo_dm_air
p1.drive = cPlayer[0].focus_new
p1.super = cTeam[0].mSuperGauge

p2.posX = cPlayer[1].pos.x.v / 65336.0
p2.posY = cPlayer[1].pos.y.v / 65336.0
p2.spdX = cPlayer[1].speed.x.v / 65336.0
p2.spdY = cPlayer[1].speed.y.v / 65336.0
p2.aclX = cPlayer[1].alpha.x.v / 65336.0
p2.aclY = cPlayer[1].alpha.y.v / 65336.0
p2.dir = bitand(cPlayer[1].BitValue, 128) == 128
p2.hitstop = cPlayer[1].hit_stop
p2.stance = cPlayer[1].pose_st
p2.juggle = cPlayer[1].combo_dm_air
p2.drive = cPlayer[1].focus_new
p2.super = cTeam[1].mSuperGauge

if imgui.tree_node("P1 Info") then
imgui.text("Position X: " .. p1.posX)
imgui.text("Position Y: " .. p1.posY)
imgui.text("Speed X: " .. p1.spdX)
imgui.text("Speed Y: " .. p1.spdY)
imgui.text("Acceleration X: " .. p1.aclX)
imgui.text("Acceleration Y: " .. p1.aclY)
if p1.dir == true then
imgui.text("Direction: Right")
else
imgui.text("Direction: Left")
end
imgui.text("Hitstop: " .. p1.hitstop)
if p1.stance == 0 then
imgui.text("Stance: Standing")
elseif p1.stance == 1 then
imgui.text("Stance: Crouching")
else
imgui.text("Stance: Jumping")
end
imgui.text("Juggle Counter: " .. p2.juggle)
imgui.text("Drive Gauge: " .. p1.drive)
imgui.text("Super Gauge: " .. p1.super)
imgui.tree_pop()
end

if imgui.tree_node("P2 Info") then
imgui.text("Position X: " .. p2.posX)
imgui.text("Position Y: " .. p2.posY)
imgui.text("Speed X: " .. p2.spdX)
imgui.text("Speed Y: " .. p2.spdY)
imgui.text("Acceleration X: " .. p2.aclX)
imgui.text("Acceleration Y: " .. p2.aclY)
if p2.dir == true then
imgui.text("Direction: Right")
else
imgui.text("Direction: Left")
end
imgui.text("Hitstop: " .. p2.hitstop)
if p2.stance == 0 then
imgui.text("Stance: Standing")
elseif p2.stance == 1 then
imgui.text("Stance: Crouching")
else
imgui.text("Stance: Jumping")
end
imgui.text("Juggle Counter: " .. p1.juggle)
imgui.text("Drive Gauge: " .. p2.drive)
imgui.text("Super Gauge: " .. p2.super)
imgui.tree_pop()
end
imgui.end_window()
end
end)

0 comments on commit 79b5516

Please sign in to comment.