Skip to content

Commit d03520b

Browse files
committed
refactor(s11d/rope): Address PR FoxdieTeam#2135 review feedback
Implement changes requested by reviewer KieronJ: - Remove 9 compiler-inserted division overflow checks (div_result == -1) These checks are automatically inserted by PSY-Q compiler for MIPS division overflow handling and should not be manually added in source - Remove duplicate extern declarations: * data_800C32B4, data_800C32B8 (were declared twice) - Fix typo in function name: func_8001511C8 -> func_800151C8 - Remove unused declaration: func_8003152948 (not referenced in rope.c) These changes improve code quality without affecting binary matching. Build verification will be performed by CI on Windows/Linux platforms. Addresses: PR FoxdieTeam#2135 review comments
1 parent 65398fa commit d03520b

File tree

2 files changed

+3
-54
lines changed

2 files changed

+3
-54
lines changed

source/overlays/s11d/chara/rope/rope.c

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4868,11 +4868,6 @@ void s11d_rope_800C5B10(void *work)
48684868

48694869
div_result = temp_calc / calc_value;
48704870

4871-
if (div_result == -1)
4872-
{
4873-
goto div_error;
4874-
}
4875-
48764871
if (div_result == 0x80000000)
48774872
{
48784873
goto div_check;
@@ -4925,11 +4920,6 @@ void s11d_rope_800C5B10(void *work)
49254920

49264921
div_result = temp_calc / calc_value;
49274922

4928-
if (div_result == -1)
4929-
{
4930-
goto skip_4000_logic;
4931-
}
4932-
49334923
if (div_result == 0x80000000)
49344924
{
49354925
goto continue_4000;
@@ -4977,11 +4967,6 @@ void s11d_rope_800C5B10(void *work)
49774967

49784968
div_result = temp_calc / calc_value;
49794969

4980-
if (div_result == -1)
4981-
{
4982-
goto skip_400_logic;
4983-
}
4984-
49854970
if (div_result == 0x80000000)
49864971
{
49874972
goto continue_400;
@@ -5097,11 +5082,6 @@ void s11d_rope_800C5E74(void *work)
50975082

50985083
div_result = temp_calc / calc_value;
50995084

5100-
if (div_result == -1)
5101-
{
5102-
goto div_error;
5103-
}
5104-
51055085
if (div_result == 0x80000000)
51065086
{
51075087
goto div_check;
@@ -5154,11 +5134,6 @@ void s11d_rope_800C5E74(void *work)
51545134

51555135
div_result = temp_calc / calc_value;
51565136

5157-
if (div_result == -1)
5158-
{
5159-
goto skip_4000_logic;
5160-
}
5161-
51625137
if (div_result == 0x80000000)
51635138
{
51645139
goto continue_4000;
@@ -5206,11 +5181,6 @@ void s11d_rope_800C5E74(void *work)
52065181

52075182
div_result = temp_calc / calc_value;
52085183

5209-
if (div_result == -1)
5210-
{
5211-
goto skip_400_logic;
5212-
}
5213-
52145184
if (div_result == 0x80000000)
52155185
{
52165186
goto continue_400;
@@ -5325,11 +5295,6 @@ void s11d_rope_800C6544(void *work)
53255295

53265296
div_result = temp_calc / calc_value;
53275297

5328-
if (div_result == -1)
5329-
{
5330-
goto check_4000;
5331-
}
5332-
53335298
if (div_result == 0x80000000)
53345299
{
53355300
goto apply_div_1;
@@ -5378,11 +5343,6 @@ void s11d_rope_800C6544(void *work)
53785343

53795344
div_result = temp_calc / calc_value;
53805345

5381-
if (div_result == -1)
5382-
{
5383-
goto check_400;
5384-
}
5385-
53865346
if (div_result == 0x80000000)
53875347
{
53885348
goto apply_div_2;
@@ -5430,11 +5390,6 @@ void s11d_rope_800C6544(void *work)
54305390

54315391
div_result = temp_calc / calc_value;
54325392

5433-
if (div_result == -1)
5434-
{
5435-
goto finalize;
5436-
}
5437-
54385393
if (div_result == 0x80000000)
54395394
{
54405395
goto apply_div_3;

source/overlays/s11d/chara/rope/rope.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,11 @@ typedef struct RopeWork
1313
// External data symbols
1414
extern int s11d_dword_800C32B4;
1515
extern int s11d_dword_800C32B8;
16-
extern unsigned int GM_GameStatus;
17-
18-
// External function declarations - consolidated from inline externs
19-
extern char linkvarbuf;
20-
extern char DG_ZeroVector;
21-
extern int s11d_dword_800C32B4;
22-
extern int s11d_dword_800C32B8;
2316
extern int s11d_dword_800C32BC;
2417
extern int s11d_dword_800C32C4;
2518
extern int s11d_dword_800C32CC;
19+
extern char linkvarbuf;
20+
extern char DG_ZeroVector;
2621
extern int data_800BB9B4; // Counter
2722
extern int data_800BB9D4;
2823
extern int data_800BB9F4;
@@ -33,7 +28,6 @@ extern int func_80016CCC(void *);
3328
extern int func_80016D00(void *, void *, void *);
3429
extern int func_80016D40(void *, void *, void *);
3530
extern int func_80031298(void *);
36-
extern int func_8003152948(void *);
3731
extern int func_80044DE0(void *);
3832
extern int func_80044FC8(void *);
3933
extern int func_80045298(void *);
@@ -57,7 +51,7 @@ extern void *func_800209E8(void *);
5751
extern void *func_80020A14(void *);
5852
extern void *func_80020AA4(void);
5953
extern void *func_8002D400(void *);
60-
extern void func_8001511C8(void *, void *);
54+
extern void func_800151C8(void *, void *);
6155
extern void func_80018C2E0(void *);
6256
extern void func_8001BC04(void *);
6357
extern void func_8001BC44(void *);

0 commit comments

Comments
 (0)