mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 12:02:30 +01:00
Change to use ARRAY_COUNT for script list stuff
This commit is contained in:
parent
73e1eff76e
commit
c179e51a88
@ -5,17 +5,15 @@
|
||||
#include "common_structs.h"
|
||||
#include "types.h"
|
||||
|
||||
#define MAX_SCRIPT_LIST_LENGTH 128
|
||||
|
||||
extern ui_status gUIStatus;
|
||||
extern player_data gPlayerData;
|
||||
extern player_status gPlayerStatus;
|
||||
extern game_status* gGameStatusPtr[1];
|
||||
extern item_table_entry gItemTable[364];
|
||||
|
||||
extern script_context* gWorldScriptList[MAX_SCRIPT_LIST_LENGTH];
|
||||
extern script_context* gBattleScriptList[MAX_SCRIPT_LIST_LENGTH];
|
||||
extern script_context** gCurrentScriptListPtr;
|
||||
extern script_context* gWorldScriptList[128];
|
||||
extern script_context* gBattleScriptList[128];
|
||||
extern script_context** gCurrentScriptListPtr[128];
|
||||
|
||||
extern s8 D_800A0900;
|
||||
extern s16* D_80151328;
|
||||
|
@ -30,8 +30,8 @@ void* kill_script_by_ID(s32 id) {
|
||||
s32 i;
|
||||
script_context* scriptContextPtr;
|
||||
|
||||
for (i=0; i < MAX_SCRIPT_LIST_LENGTH; i++) {
|
||||
scriptContextPtr = gCurrentScriptListPtr[i];
|
||||
for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
||||
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
||||
if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) {
|
||||
kill_script(scriptContextPtr);
|
||||
}
|
||||
@ -42,8 +42,8 @@ s32 kill_all_scripts(void) {
|
||||
s32 i;
|
||||
script_context* scriptContextPtr;
|
||||
|
||||
for(i=0; i < MAX_SCRIPT_LIST_LENGTH; i++) {
|
||||
scriptContextPtr = gCurrentScriptListPtr[i];
|
||||
for(i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
||||
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
||||
if (scriptContextPtr != NULL) {
|
||||
kill_script(scriptContextPtr);
|
||||
}
|
||||
@ -55,8 +55,8 @@ s32 does_script_exist(s32 id) {
|
||||
s32 i;
|
||||
script_context* scriptContextPtr;
|
||||
|
||||
for(i=0; i < MAX_SCRIPT_LIST_LENGTH; i++) {
|
||||
scriptContextPtr = gCurrentScriptListPtr[i];
|
||||
for(i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
||||
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
||||
if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) {
|
||||
return 1;
|
||||
}
|
||||
@ -101,16 +101,16 @@ INCLUDE_ASM(code_e79b0_len_1920, suspend_group_others);
|
||||
INCLUDE_ASM(code_e79b0_len_1920, resume_group_others);
|
||||
|
||||
script_context* get_script_by_index(s32 index) {
|
||||
return gCurrentScriptListPtr[index];
|
||||
return (*gCurrentScriptListPtr)[index];
|
||||
}
|
||||
|
||||
script_context* get_script_by_id(s32 id) {
|
||||
s32 i;
|
||||
script_context* scriptContextPtr;
|
||||
|
||||
for (i=0; i < MAX_SCRIPT_LIST_LENGTH; i++) {
|
||||
if (gCurrentScriptListPtr[i] != NULL) {
|
||||
scriptContextPtr = gCurrentScriptListPtr[i];
|
||||
for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
||||
if ((*gCurrentScriptListPtr)[i] != NULL) {
|
||||
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
||||
if (scriptContextPtr->uniqueID == id) {
|
||||
return scriptContextPtr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user