mirror of https://github.com/pmret/papermario.git
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 "common_structs.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
#define MAX_SCRIPT_LIST_LENGTH 128
|
|
||||||
|
|
||||||
extern ui_status gUIStatus;
|
extern ui_status gUIStatus;
|
||||||
extern player_data gPlayerData;
|
extern player_data gPlayerData;
|
||||||
extern player_status gPlayerStatus;
|
extern player_status gPlayerStatus;
|
||||||
extern game_status* gGameStatusPtr[1];
|
extern game_status* gGameStatusPtr[1];
|
||||||
extern item_table_entry gItemTable[364];
|
extern item_table_entry gItemTable[364];
|
||||||
|
|
||||||
extern script_context* gWorldScriptList[MAX_SCRIPT_LIST_LENGTH];
|
extern script_context* gWorldScriptList[128];
|
||||||
extern script_context* gBattleScriptList[MAX_SCRIPT_LIST_LENGTH];
|
extern script_context* gBattleScriptList[128];
|
||||||
extern script_context** gCurrentScriptListPtr;
|
extern script_context** gCurrentScriptListPtr[128];
|
||||||
|
|
||||||
extern s8 D_800A0900;
|
extern s8 D_800A0900;
|
||||||
extern s16* D_80151328;
|
extern s16* D_80151328;
|
||||||
|
|
|
@ -30,8 +30,8 @@ void* kill_script_by_ID(s32 id) {
|
||||||
s32 i;
|
s32 i;
|
||||||
script_context* scriptContextPtr;
|
script_context* scriptContextPtr;
|
||||||
|
|
||||||
for (i=0; i < MAX_SCRIPT_LIST_LENGTH; i++) {
|
for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
||||||
scriptContextPtr = gCurrentScriptListPtr[i];
|
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
||||||
if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) {
|
if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) {
|
||||||
kill_script(scriptContextPtr);
|
kill_script(scriptContextPtr);
|
||||||
}
|
}
|
||||||
|
@ -42,8 +42,8 @@ s32 kill_all_scripts(void) {
|
||||||
s32 i;
|
s32 i;
|
||||||
script_context* scriptContextPtr;
|
script_context* scriptContextPtr;
|
||||||
|
|
||||||
for(i=0; i < MAX_SCRIPT_LIST_LENGTH; i++) {
|
for(i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
||||||
scriptContextPtr = gCurrentScriptListPtr[i];
|
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
||||||
if (scriptContextPtr != NULL) {
|
if (scriptContextPtr != NULL) {
|
||||||
kill_script(scriptContextPtr);
|
kill_script(scriptContextPtr);
|
||||||
}
|
}
|
||||||
|
@ -55,8 +55,8 @@ s32 does_script_exist(s32 id) {
|
||||||
s32 i;
|
s32 i;
|
||||||
script_context* scriptContextPtr;
|
script_context* scriptContextPtr;
|
||||||
|
|
||||||
for(i=0; i < MAX_SCRIPT_LIST_LENGTH; i++) {
|
for(i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
||||||
scriptContextPtr = gCurrentScriptListPtr[i];
|
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
||||||
if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) {
|
if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -101,16 +101,16 @@ INCLUDE_ASM(code_e79b0_len_1920, suspend_group_others);
|
||||||
INCLUDE_ASM(code_e79b0_len_1920, resume_group_others);
|
INCLUDE_ASM(code_e79b0_len_1920, resume_group_others);
|
||||||
|
|
||||||
script_context* get_script_by_index(s32 index) {
|
script_context* get_script_by_index(s32 index) {
|
||||||
return gCurrentScriptListPtr[index];
|
return (*gCurrentScriptListPtr)[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
script_context* get_script_by_id(s32 id) {
|
script_context* get_script_by_id(s32 id) {
|
||||||
s32 i;
|
s32 i;
|
||||||
script_context* scriptContextPtr;
|
script_context* scriptContextPtr;
|
||||||
|
|
||||||
for (i=0; i < MAX_SCRIPT_LIST_LENGTH; i++) {
|
for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
||||||
if (gCurrentScriptListPtr[i] != NULL) {
|
if ((*gCurrentScriptListPtr)[i] != NULL) {
|
||||||
scriptContextPtr = gCurrentScriptListPtr[i];
|
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
||||||
if (scriptContextPtr->uniqueID == id) {
|
if (scriptContextPtr->uniqueID == id) {
|
||||||
return scriptContextPtr;
|
return scriptContextPtr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue