mirror of
https://github.com/pmret/papermario.git
synced 2024-11-18 08:52:40 +01:00
Cleanup, starting trigger functions
This commit is contained in:
parent
d0c65a6e14
commit
7d5c31a6e6
@ -62,7 +62,7 @@ glabel step_game_loop
|
||||
/* 001C18 80026818 00000000 */ nop
|
||||
/* 001C1C 8002681C 0C052952 */ jal func_8014A548
|
||||
/* 001C20 80026820 00000000 */ nop
|
||||
/* 001C24 80026824 0C051C99 */ jal UpdateMusicPlayers
|
||||
/* 001C24 80026824 0C051C99 */ jal update_music_players
|
||||
/* 001C28 80026828 00000000 */ nop
|
||||
/* 001C2C 8002682C 0C0525CD */ jal func_80149734
|
||||
/* 001C30 80026830 00000000 */ nop
|
||||
|
@ -491,4 +491,22 @@ typedef struct {
|
||||
/* 0x0E */ u16 height;
|
||||
} bg_header; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s16 genericFlagIndex;
|
||||
/* 0x02 */ s16 field_0x2;
|
||||
/* 0x04 */ s16 crateFlagIndex;
|
||||
/* 0x06 */ s16 panelFlagIndex;
|
||||
/* 0x08 */ s32 colliderID;
|
||||
/* 0x0C */ UNK_FUN_PTR(functionHandler);
|
||||
/* 0x10 */ UNK_PTR scriptStart;
|
||||
/* 0x14 */ script_context* runningScript;
|
||||
/* 0x18 */ s32 priority;
|
||||
/* 0x1C */ s32 scriptVars[3];
|
||||
/* 0x28 */ s32 unk_28;
|
||||
/* 0x2C */ s32 unk_2C;
|
||||
/* 0x30 */ s8 unk_30;
|
||||
/* 0x31 */ char unk_31[3];
|
||||
/* 0x34 */ s32 runningScriptID;
|
||||
} trigger; // size = 0x38
|
||||
|
||||
#endif
|
||||
|
@ -17,6 +17,12 @@ extern s16 D_8010CD12;
|
||||
extern s32 D_801595A0;
|
||||
extern s8 D_8014F12F;
|
||||
|
||||
// Triggers
|
||||
/* 0x80151334 */ extern s16 gTriggerCount;
|
||||
/* 0x80159190 */ extern trigger gTriggerList1[64];
|
||||
/* 0x80159290 */ extern trigger gTriggerList2[64];
|
||||
/* 0x80159390 */ extern trigger** gCurrentTriggerListPtr[64];
|
||||
|
||||
extern u16 gMapTransitionAlpha;
|
||||
extern u16 D_800A0942;
|
||||
extern s16 D_800A0944;
|
||||
@ -30,8 +36,6 @@ extern s32 D_8009A650[1];
|
||||
|
||||
extern s16 gCurrentDoorSoundsSet;
|
||||
|
||||
|
||||
|
||||
extern UNK_TYPE D_800E92D8;
|
||||
extern UNK_TYPE D_80147474;
|
||||
extern UNK_TYPE D_80147574;
|
||||
|
@ -1,19 +1,48 @@
|
||||
#include "common.h"
|
||||
|
||||
INCLUDE_ASM(code_dbd70_len_700, default_trigger_function_handler);
|
||||
|
||||
void default_trigger_function_handler(s32* arg0) {
|
||||
arg0[0] |= 2;
|
||||
}
|
||||
|
||||
INCLUDE_ASM(code_dbd70_len_700, clear_trigger_data);
|
||||
|
||||
INCLUDE_ASM(code_dbd70_len_700, init_trigger_list);
|
||||
//INCLUDE_ASM(code_dbd70_len_700, init_trigger_list);
|
||||
void init_trigger_list(void) {
|
||||
if ((*gGameStatusPtr)->unk_70 == 0) {
|
||||
*gCurrentTriggerListPtr = gTriggerList1;
|
||||
} else {
|
||||
*gCurrentTriggerListPtr = gTriggerList2;
|
||||
}
|
||||
|
||||
gTriggerCount = 0;
|
||||
}
|
||||
|
||||
INCLUDE_ASM(code_dbd70_len_700, create_trigger);
|
||||
|
||||
INCLUDE_ASM(code_dbd70_len_700, update_triggers);
|
||||
|
||||
INCLUDE_ASM(code_dbd70_len_700, delete_trigger);
|
||||
|
||||
void delete_trigger(trigger* toDelete) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gCurrentTriggerListPtr); i++) {
|
||||
if ((*gCurrentTriggerListPtr)[i] == toDelete) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i < ARRAY_COUNT(gCurrentTriggerListPtr)) {
|
||||
heap_free((*gCurrentTriggerListPtr)[i]);
|
||||
(*gCurrentTriggerListPtr)[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM(code_dbd70_len_700, is_trigger_bound);
|
||||
|
||||
INCLUDE_ASM(code_dbd70_len_700, get_trigger_by_id);
|
||||
//INCLUDE_ASM(code_dbd70_len_700, get_trigger_by_id);
|
||||
trigger* get_trigger_by_id(s32 triggerID) {
|
||||
return (*gCurrentTriggerListPtr)[triggerID];
|
||||
}
|
||||
|
||||
INCLUDE_ASM(code_dbd70_len_700, func_80145CE8);
|
||||
|
@ -15,7 +15,7 @@ void func_80147230(void) {
|
||||
D_8015C7C0 = D_8014F140;
|
||||
}
|
||||
|
||||
void UpdateMusicPlayers(void) {
|
||||
void update_music_players(void) {
|
||||
struct_80147230* temp = &D_8015C7C0;
|
||||
|
||||
switch (temp->unk2) {
|
||||
|
@ -33,7 +33,7 @@ s16 func_80033830(add_val) {
|
||||
|
||||
if (gameStatus->boot_alpha != 0xFF) {
|
||||
gameStatus->boot_alpha += add_val;
|
||||
if ((gameStatus->boot_alpha >= 0x100)) {
|
||||
if ((gameStatus->boot_alpha > 0xFF)) {
|
||||
gameStatus->boot_alpha = 0xFF;
|
||||
}
|
||||
} else {
|
||||
@ -44,16 +44,14 @@ s16 func_80033830(add_val) {
|
||||
|
||||
|
||||
void func_80033874(void) {
|
||||
|
||||
func_80137D88(0, (*gGameStatusPtr)->boot_alpha);
|
||||
func_80137E10(0, (*gGameStatusPtr)->boot_blue, (*gGameStatusPtr)->boot_green, (*gGameStatusPtr)->boot_red);
|
||||
}
|
||||
|
||||
s8 start_battle_countdown(void) {
|
||||
void start_battle_countdown(void) {
|
||||
D_800A0900 = 5;
|
||||
}
|
||||
|
||||
|
||||
INCLUDE_ASM(code_ebd0_len_6a0, step_battle);
|
||||
INCLUDE_ASM(code_ebd0_len_6a0, func_80033B54);
|
||||
INCLUDE_ASM(code_ebd0_len_6a0, func_80033B88);
|
||||
|
@ -119,7 +119,7 @@ s32 AddKeyItem(script_context* script, s32 initialCall) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
for (i=0; i < ARRAY_COUNT(playerData->keyItems); i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(playerData->keyItems); i++) {
|
||||
if (playerData->keyItems[i] == 0) {
|
||||
break;
|
||||
}
|
||||
@ -146,7 +146,7 @@ s32 HasKeyItem(script_context* script, s32 initialCall) {
|
||||
player_data* playerData = &gPlayerData;
|
||||
s32 i;
|
||||
|
||||
for(i=0; i < ARRAY_COUNT(playerData->keyItems); i++) {
|
||||
for(i = 0; i < ARRAY_COUNT(playerData->keyItems); i++) {
|
||||
if (playerData->keyItems[i] == itemID) {
|
||||
break;
|
||||
}
|
||||
@ -163,7 +163,7 @@ s32 FindKeyItem(script_context* script, s32 initialCall) {
|
||||
s32 i;
|
||||
s32 itemIndex;
|
||||
|
||||
for(i=0; i < ARRAY_COUNT(playerData->keyItems); i++) {
|
||||
for(i = 0; i < ARRAY_COUNT(playerData->keyItems); i++) {
|
||||
if (playerData->keyItems[i] == itemID) {
|
||||
break;
|
||||
}
|
||||
|
@ -46,15 +46,15 @@ s32 DemoJoystickRadial(script_context* script) {
|
||||
}
|
||||
|
||||
s32 DemoJoystickXY(script_context* script) {
|
||||
f32 a;
|
||||
f32 b;
|
||||
f32 x;
|
||||
f32 y;
|
||||
s32* thisPos = script->ptrReadPos;
|
||||
|
||||
a = get_float_variable(script, *thisPos++);
|
||||
b = get_float_variable(script, *thisPos++);
|
||||
x = get_float_variable(script, *thisPos++);
|
||||
y = get_float_variable(script, *thisPos++);
|
||||
|
||||
(*gGameStatusPtr)->demoStickX = a;
|
||||
(*gGameStatusPtr)->demoStickY = b;
|
||||
(*gGameStatusPtr)->demoStickX = x;
|
||||
(*gGameStatusPtr)->demoStickY = y;
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
@ -1411,7 +1411,7 @@ labels:
|
||||
- [0x80145D70, "load_map_bg"]
|
||||
- [0x80145E28, "read_background_size"]
|
||||
- [0x80145E70, "set_background_size"]
|
||||
- [0x80147264, "UpdateMusicPlayers"]
|
||||
- [0x80147264, "update_music_players"]
|
||||
- [0x80149AB8, "_play_sound"]
|
||||
- [0x80149C6C, "stop_sound"]
|
||||
- [0x80149CB4, "play_sound"]
|
||||
|
@ -61,6 +61,11 @@ D_80151328 = 0x80151328;
|
||||
|
||||
gCurrentDoorSoundsSet = 0x80151340;
|
||||
|
||||
gTriggerCount = 0x80151334;
|
||||
gTriggerList1 = 0x80159190;
|
||||
gTriggerList2 = 0x80159290;
|
||||
gCurrentTriggerListPtr = 0x80159390;
|
||||
|
||||
D_801595A0 = 0x801595A0;
|
||||
D_8015C7C0 = 0x8015C7C0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user