From 905f5a7e7320eac6601ba6a211be022ae94234dc Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Thu, 23 Nov 2023 12:32:29 -0600 Subject: [PATCH 1/2] Improve local variable names in SubchrMain --- src/REL/subchrselDll/subchrselDll.c | 32 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/REL/subchrselDll/subchrselDll.c b/src/REL/subchrselDll/subchrselDll.c index 8d2279c8..22659be6 100644 --- a/src/REL/subchrselDll/subchrselDll.c +++ b/src/REL/subchrselDll/subchrselDll.c @@ -64,12 +64,12 @@ static u16 GetBtns(void) static void SubchrMain() { - int prev_character[4]; int character[4]; + int ext_character[4]; int i, cursor_pos; for(i=0; i<4; i++) { - prev_character[i] = gPlayerConfig[i].character; - character[i] = 0; + character[i] = gPlayerConfig[i].character; + ext_character[i] = 0; cur_direction[i] = 0; } cursor_pos = 0; @@ -88,16 +88,16 @@ static void SubchrMain() } else { fontcolor = 12; } - if(character[i] != 0) { - print8(x+200, y, 2.0f, ext_character_str[character[i]]); + if(ext_character[i] != 0) { + print8(x+200, y, 2.0f, ext_character_str[ext_character[i]]); } else { - print8(x+200, y, 2.0f, character_str[prev_character[i]]); + print8(x+200, y, 2.0f, character_str[character[i]]); } } if(GetBtns() & 0x1000) { for(i=0; i<4; i++) { - if(character[i] != 0) { - gPlayerConfig[i]. character = character[i]+7; + if(ext_character[i] != 0) { + gPlayerConfig[i]. character = ext_character[i]+7; } } fn_80032A58(30); @@ -111,13 +111,13 @@ static void SubchrMain() } else { if(GetBtns() & 0x1) { do { - character[cursor_pos]--; - if(character[cursor_pos] < 0) { - character[cursor_pos] = 6; + ext_character[cursor_pos]--; + if(ext_character[cursor_pos] < 0) { + ext_character[cursor_pos] = 6; } for(i=0; i<4; i++) { if(cursor_pos != i) { - if(character[cursor_pos] == character[i] && character[cursor_pos] != 0) { + if(ext_character[cursor_pos] == ext_character[i] && ext_character[cursor_pos] != 0) { break; } } @@ -126,13 +126,13 @@ static void SubchrMain() } if(GetBtns() & 0x2) { do { - character[cursor_pos]++; - if(character[cursor_pos] > 6) { - character[cursor_pos] = 0; + ext_character[cursor_pos]++; + if(ext_character[cursor_pos] > 6) { + ext_character[cursor_pos] = 0; } for(i=0; i<4; i++) { if(cursor_pos != i) { - if(character[cursor_pos] == character[i] && character[cursor_pos] != 0) { + if(ext_character[cursor_pos] == ext_character[i] && ext_character[cursor_pos] != 0) { break; } } From 39286d7a62bf2b17c6cf482d5258cc34e1c60a8c Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Thu, 23 Nov 2023 12:53:00 -0600 Subject: [PATCH 2/2] Add variables to common.h --- include/common.h | 1 + include/variables.h | 23 +++++++++++++++++++++++ src/REL/subchrselDll/subchrselDll.c | 7 ------- src/game/malloc.c | 2 -- 4 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 include/variables.h diff --git a/include/common.h b/include/common.h index 70f5399c..4875c13a 100644 --- a/include/common.h +++ b/include/common.h @@ -4,5 +4,6 @@ #include "types.h" #include "common_structs.h" #include "functions.h" +#include "variables.h" #endif \ No newline at end of file diff --git a/include/variables.h b/include/variables.h new file mode 100644 index 00000000..8ed35427 --- /dev/null +++ b/include/variables.h @@ -0,0 +1,23 @@ +#ifndef _VARIABLES_H +#define _VARIABLES_H + +#include "types.h" +#include "common_structs.h" +#include "dolphin/os.h" + +extern u16 HuPadBtnDown[4]; +extern u8 HuPadDStk[4]; + +extern OSHeapHandle currentHeapHandle; + +extern BOOL saftyFrameF; +extern u16 strlinecnt; +extern u16 empstrline; +extern int fontcolor; +extern u32 procfunc; + +extern WipeState wipeData; + +extern PlayerConfig gPlayerConfig[4]; + +#endif diff --git a/src/REL/subchrselDll/subchrselDll.c b/src/REL/subchrselDll/subchrselDll.c index 22659be6..20b9801f 100644 --- a/src/REL/subchrselDll/subchrselDll.c +++ b/src/REL/subchrselDll/subchrselDll.c @@ -4,13 +4,6 @@ const double _half = 0.5; const double _three = 3.0; -extern WipeState wipeData; - -extern PlayerConfig gPlayerConfig[4]; -extern u16 HuPadBtnDown[4]; -extern u8 HuPadDStk[4]; -extern int fontcolor; - static void SubchrMain(void); static u8 cur_direction[4]; diff --git a/src/game/malloc.c b/src/game/malloc.c index d93463e2..4dab78e4 100644 --- a/src/game/malloc.c +++ b/src/game/malloc.c @@ -1,8 +1,6 @@ #include "common.h" #include "dolphin/os.h" -extern OSHeapHandle currentHeapHandle; - static u32 HeapSizeTbl[5] = { 0x240000, 0x140000, 0xA80000, 0x580000, 0 }; static void *HeapTbl[5];