From 595377d81d1c9b31da1860f0f82040e3c811a123 Mon Sep 17 00:00:00 2001 From: Max <34987259+mparisi20@users.noreply.github.com> Date: Sat, 7 Feb 2026 19:28:57 -0500 Subject: [PATCH] Match gr_collision_shape_circle.cpp --- config/RSBE01_02/splits.txt | 5 + config/RSBE01_02/symbols.txt | 56 ++++---- configure.py | 1 + include/lib/BrawlHeaders | 2 +- .../collision/gr_collision_shape_circle.cpp | 136 ++++++++++++++++++ 5 files changed, 171 insertions(+), 29 deletions(-) create mode 100644 src/sora/gr/collision/gr_collision_shape_circle.cpp diff --git a/config/RSBE01_02/splits.txt b/config/RSBE01_02/splits.txt index b593beb..9d99d7b 100644 --- a/config/RSBE01_02/splits.txt +++ b/config/RSBE01_02/splits.txt @@ -216,6 +216,11 @@ sora/gr/collision/gr_collision_shape_rhombus.cpp: .text start:0x80132B64 end:0x801330B8 .data start:0x8045DA88 end:0x8045DAEC +sora/gr/collision/gr_collision_shape_circle.cpp: + .text start:0x801330B8 end:0x8013344C + .data start:0x8045DAF0 end:0x8045DB54 + .sdata2 start:0x805A2A30 end:0x805A2A3C + sora/gr/gr_path.cpp: .text start:0x80139570 end:0x80139658 diff --git a/config/RSBE01_02/symbols.txt b/config/RSBE01_02/symbols.txt index fc26ec0..4674d3f 100644 --- a/config/RSBE01_02/symbols.txt +++ b/config/RSBE01_02/symbols.txt @@ -2945,7 +2945,7 @@ fn_80041218 = .text:0x80041218; // type:function size:0x2A8 fn_800414C0 = .text:0x800414C0; // type:function size:0x68 fn_80041528 = .text:0x80041528; // type:function size:0x10 fn_80041538 = .text:0x80041538; // type:function size:0x80 -fn_800415B8 = .text:0x800415B8; // type:function size:0x30 +getAABBox__10clCircle2DCFR10clAABBox2D = .text:0x800415B8; // type:function size:0x30 fn_800415E8 = .text:0x800415E8; // type:function size:0x29C fn_80041884 = .text:0x80041884; // type:function size:0x4C fn_800418D0 = .text:0x800418D0; // type:function size:0x50 @@ -5850,29 +5850,29 @@ getDownPos__18grCollShapeRhombusCFv = .text:0x80133020; // type:function size:0x getCenterPos__18grCollShapeRhombusCFv = .text:0x80133030; // type:function size:0x10 getAABBox__18grCollShapeRhombusFR10clAABBox2D = .text:0x80133040; // type:function size:0x70 getType__18grCollShapeRhombusCFv = .text:0x801330B0; // type:function size:0x8 -fn_801330B8 = .text:0x801330B8; // type:function size:0x14 -fn_801330CC = .text:0x801330CC; // type:function size:0x1C -fn_801330E8 = .text:0x801330E8; // type:function size:0x34 -fn_8013311C = .text:0x8013311C; // type:function size:0x34 -fn_80133150 = .text:0x80133150; // type:function size:0x34 -fn_80133184 = .text:0x80133184; // type:function size:0x24 -fn_801331A8 = .text:0x801331A8; // type:function size:0x34 -fn_801331DC = .text:0x801331DC; // type:function size:0x38 -fn_80133214 = .text:0x80133214; // type:function size:0x9C -fn_801332B0 = .text:0x801332B0; // type:function size:0x38 -fn_801332E8 = .text:0x801332E8; // type:function size:0x4 -fn_801332EC = .text:0x801332EC; // type:function size:0x4 -fn_801332F0 = .text:0x801332F0; // type:function size:0x34 -fn_80133324 = .text:0x80133324; // type:function size:0x10 -fn_80133334 = .text:0x80133334; // type:function size:0x10 -fn_80133344 = .text:0x80133344; // type:function size:0x24 -fn_80133368 = .text:0x80133368; // type:function size:0x2C -fn_80133394 = .text:0x80133394; // type:function size:0x2C -fn_801333C0 = .text:0x801333C0; // type:function size:0x2C -fn_801333EC = .text:0x801333EC; // type:function size:0x2C -fn_80133418 = .text:0x80133418; // type:function size:0x24 -fn_8013343C = .text:0x8013343C; // type:function size:0x8 -fn_80133444 = .text:0x80133444; // type:function size:0x8 +init__17grCollShapeCircleFv = .text:0x801330B8; // type:function size:0x14 +set__17grCollShapeCircleFR11grCollShape = .text:0x801330CC; // type:function size:0x1C +setDownPos__17grCollShapeCircleFRC5Vec2f = .text:0x801330E8; // type:function size:0x34 +setRightPos__17grCollShapeCircleFRC5Vec2f = .text:0x8013311C; // type:function size:0x34 +setLeftPos__17grCollShapeCircleFRC5Vec2f = .text:0x80133150; // type:function size:0x34 +setCenterPos__17grCollShapeCircleFRC5Vec2f = .text:0x80133184; // type:function size:0x24 +setTopPos__17grCollShapeCircleFRC5Vec2f = .text:0x801331A8; // type:function size:0x34 +setLR__17grCollShapeCircleFRC5Vec2fRC5Vec2fRC5Vec2f = .text:0x801331DC; // type:function size:0x38 +setLR__17grCollShapeCircleFRC5Vec2fRC5Vec2f = .text:0x80133214; // type:function size:0x9C +setUD__17grCollShapeCircleFRC5Vec2fRC5Vec2fRC5Vec2f = .text:0x801332B0; // type:function size:0x38 +updateAABBox__17grCollShapeCircleFv = .text:0x801332E8; // type:function size:0x4 +test__17grCollShapeCircleFv = .text:0x801332EC; // type:function size:0x4 +modifyDownY__17grCollShapeCircleFf = .text:0x801332F0; // type:function size:0x34 +getWidth__17grCollShapeCircleCFv = .text:0x80133324; // type:function size:0x10 +getHeight__17grCollShapeCircleCFv = .text:0x80133334; // type:function size:0x10 +move__17grCollShapeCircleFRC5Vec2f = .text:0x80133344; // type:function size:0x24 +getTopPos__17grCollShapeCircleCFv = .text:0x80133368; // type:function size:0x2C +getRightPos__17grCollShapeCircleCFv = .text:0x80133394; // type:function size:0x2C +getLeftPos__17grCollShapeCircleCFv = .text:0x801333C0; // type:function size:0x2C +getDownPos__17grCollShapeCircleCFv = .text:0x801333EC; // type:function size:0x2C +getCenterPos__17grCollShapeCircleCFv = .text:0x80133418; // type:function size:0x24 +getAABBox__17grCollShapeCircleFR10clAABBox2D = .text:0x8013343C; // type:function size:0x8 +getType__17grCollShapeCircleCFv = .text:0x80133444; // type:function size:0x8 fn_8013344C = .text:0x8013344C; // type:function size:0x58 fn_801334A4 = .text:0x801334A4; // type:function size:0x6F4 fn_80133B98 = .text:0x80133B98; // type:function size:0x84 @@ -26054,7 +26054,7 @@ lbl_8045D9E0 = .data:0x8045D9E0; // type:object size:0x38 lbl_8045DA18 = .data:0x8045DA18; // type:object size:0x38 lbl_8045DA50 = .data:0x8045DA50; // type:object size:0x38 __vt__18grCollShapeRhombus = .data:0x8045DA88; // type:object size:0x64 -lbl_8045DAF0 = .data:0x8045DAF0; // type:object size:0x64 align:8 +__vt__17grCollShapeCircle = .data:0x8045DAF0; // type:object size:0x64 align:8 lbl_8045DB58 = .data:0x8045DB58; // type:object size:0x20 align:8 jumptable_8045DB78 = .data:0x8045DB78; // type:object size:0x20 scope:local jumptable_8045DB98 = .data:0x8045DB98; // type:object size:0x20 scope:local @@ -32886,9 +32886,9 @@ lbl_805A2A18 = .sdata2:0x805A2A18; // type:object size:0x8 align:4 data:float gUnk805a2a20__11grCollShape = .sdata2:0x805A2A20; // type:object size:0x4 align:4 data:float gUnk805a2a24__11grCollShape = .sdata2:0x805A2A24; // type:object size:0x4 align:4 data:float gUnk805a2a28__11grCollShape = .sdata2:0x805A2A28; // type:object size:0x4 align:4 data:float -lbl_805A2A30 = .sdata2:0x805A2A30; // type:object size:0x4 align:4 data:float -lbl_805A2A34 = .sdata2:0x805A2A34; // type:object size:0x4 align:4 data:float -lbl_805A2A38 = .sdata2:0x805A2A38; // type:object size:0x8 align:4 data:float +lbl_805A2A30 = .sdata2:0x805A2A30; // type:object size:0x4 scope:local align:4 data:float +lbl_805A2A34 = .sdata2:0x805A2A34; // type:object size:0x4 scope:local align:4 data:float +lbl_805A2A38 = .sdata2:0x805A2A38; // type:object size:0x4 scope:local align:4 data:float lbl_805A2A40 = .sdata2:0x805A2A40; // type:object size:0x4 align:4 data:float lbl_805A2A44 = .sdata2:0x805A2A44; // type:object size:0x4 align:4 data:float lbl_805A2A48 = .sdata2:0x805A2A48; // type:object size:0x4 align:4 data:float diff --git a/configure.py b/configure.py index a638ef0..fb6d6e9 100755 --- a/configure.py +++ b/configure.py @@ -336,6 +336,7 @@ def MatchingFor(*versions): Object(Matching, "sora/gr/collision/gr_collision_data.cpp"), Object(Matching, "sora/gr/collision/gr_collision_handle.cpp"), Object(Matching, "sora/gr/collision/gr_collision_shape_rhombus.cpp", extra_cflags=["-RTTI off"]), + Object(Matching, "sora/gr/collision/gr_collision_shape_circle.cpp", extra_cflags=["-RTTI off"]), Object(Matching, "sora/gr/gr_path.cpp"), Object(NonMatching, "sora/ac/ac_cmd_interpreter.cpp"), Object(Matching, "sora/ac/ac_anim_cmd_impl.cpp"), diff --git a/include/lib/BrawlHeaders b/include/lib/BrawlHeaders index 553b4d5..c520c0d 160000 --- a/include/lib/BrawlHeaders +++ b/include/lib/BrawlHeaders @@ -1 +1 @@ -Subproject commit 553b4d59735e082a9ff5602661bad0311782b066 +Subproject commit c520c0d4242458627dccba7fbbd6298b443ad590 diff --git a/src/sora/gr/collision/gr_collision_shape_circle.cpp b/src/sora/gr/collision/gr_collision_shape_circle.cpp new file mode 100644 index 0000000..ba67696 --- /dev/null +++ b/src/sora/gr/collision/gr_collision_shape_circle.cpp @@ -0,0 +1,136 @@ +#include +#include + +void grCollShapeCircle::init() { + m_circle.m_radius = 0.0f; + m_circle.m_centerPos.m_y = 0.0f; + m_circle.m_centerPos.m_x = 0.0f; +} + +void grCollShapeCircle::set(grCollShape& orig) { + const grCollShapeCircle& o = static_cast(orig); + m_circle.m_centerPos = o.m_circle.m_centerPos; + m_circle.m_radius = o.m_circle.m_radius; +} + +void grCollShapeCircle::setDownPos(const Vec2f& downPos) { + Vec2f pos(downPos.m_x, downPos.m_y + m_circle.m_radius + gUnk805a2a20); + m_circle.m_centerPos = pos; +} + +void grCollShapeCircle::setRightPos(const Vec2f& rightPos) { + Vec2f pos(rightPos.m_x - gUnk805a2a20 - m_circle.m_radius, rightPos.m_y); + m_circle.m_centerPos = pos; +} + +void grCollShapeCircle::setLeftPos(const Vec2f& leftPos) { + Vec2f pos(leftPos.m_x + gUnk805a2a20 + m_circle.m_radius, leftPos.m_y); + m_circle.m_centerPos = pos; +} + +void grCollShapeCircle::setCenterPos(const Vec2f& centerPos) { + Vec2f pos(centerPos.m_x, centerPos.m_y); + m_circle.m_centerPos = pos; +} + +void grCollShapeCircle::setTopPos(const Vec2f& topPos) { + Vec2f pos(topPos.m_x, topPos.m_y - gUnk805a2a20 - m_circle.m_radius); + m_circle.m_centerPos = pos; +} + +void grCollShapeCircle::setLR(const Vec2f& centerPos, const Vec2f& left, const Vec2f& right) { + float rx; + float lx; + float cx; + float upper; + float lower; + + cx = centerPos.m_x; + rx = right.m_x; + lx = left.m_x; + upper = rx - cx; + lower = cx - lx; + m_circle.m_centerPos = centerPos; + m_circle.m_radius = (upper > lower) ? lower : upper; +} + +void grCollShapeCircle::setLR(const Vec2f& left, const Vec2f& right) { + Vec2f v; + Vec2f::copy(v, ((left + right) / 2.0f)); + setLR(v, left, right); +} + +void grCollShapeCircle::setUD(const Vec2f& centerPos, const Vec2f& up, const Vec2f& down) { + float uy; + float dy; + float cy; + float upper; + float lower; + + cy = centerPos.m_y; + uy = up.m_y; + dy = down.m_y; + upper = uy - cy; + lower = cy - dy; + m_circle.m_centerPos = centerPos; + m_circle.m_radius = (upper > lower) ? lower : upper; +} + +void grCollShapeCircle::updateAABBox() { } + +void grCollShapeCircle::test() { } + +void grCollShapeCircle::modifyDownY(float downY) { + float diameter = m_circle.m_centerPos.m_y + m_circle.m_radius - downY; + if (diameter > 0) { + const float rad = 0.5f * diameter; + m_circle.m_radius = rad; + m_circle.m_centerPos.m_y = downY + rad; + } +} + +float grCollShapeCircle::getWidth() const { + return 2.0f * m_circle.m_radius; +} + +float grCollShapeCircle::getHeight() const { + return 2.0f * m_circle.m_radius; +} + +void grCollShapeCircle::move(const Vec2f& displacement) { + m_circle.m_centerPos.m_x += displacement.m_x; + m_circle.m_centerPos.m_y += displacement.m_y; +} + +Vec2f grCollShapeCircle::getTopPos() const { + Vec2f pos(m_circle.m_centerPos.m_x, m_circle.m_centerPos.m_y + m_circle.m_radius); + return pos; +} + +Vec2f grCollShapeCircle::getRightPos() const { + Vec2f pos(m_circle.m_centerPos.m_x + m_circle.m_radius, m_circle.m_centerPos.m_y); + return pos; +} + +Vec2f grCollShapeCircle::getLeftPos() const { + Vec2f pos(m_circle.m_centerPos.m_x - m_circle.m_radius, m_circle.m_centerPos.m_y); + return pos; +} + +Vec2f grCollShapeCircle::getDownPos() const { + Vec2f pos(m_circle.m_centerPos.m_x, m_circle.m_centerPos.m_y - m_circle.m_radius); + return pos; +} + +Vec2f grCollShapeCircle::getCenterPos() const { + Vec2f pos(m_circle.m_centerPos.m_x, m_circle.m_centerPos.m_y); + return pos; +} + +void grCollShapeCircle::getAABBox(clAABBox2D& aabBox) { + m_circle.getAABBox(aabBox); +} + +int grCollShapeCircle::getType() const { + return 0; +}