papermario/src/code_dbd70_len_700.c

67 lines
1.6 KiB
C
Raw Normal View History

2020-08-04 08:49:11 +02:00
#include "common.h"
2020-08-13 07:03:47 +02:00
void default_trigger_function_handler(s32* arg0) {
arg0[0] |= 2;
}
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_dbd70_len_700", clear_trigger_data);
2020-08-04 08:49:11 +02:00
2020-08-13 07:03:47 +02:00
void init_trigger_list(void) {
2020-10-04 22:11:49 +02:00
if (!GAME_STATUS->isBattle) {
2020-08-13 07:03:47 +02:00
*gCurrentTriggerListPtr = gTriggerList1;
} else {
*gCurrentTriggerListPtr = gTriggerList2;
}
gTriggerCount = 0;
}
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(Trigger*, "code_dbd70_len_700", create_trigger, TriggerDefinition* def);
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_dbd70_len_700", update_triggers);
2020-08-04 08:49:11 +02:00
2020-08-16 05:19:00 +02:00
void delete_trigger(Trigger* toDelete) {
2020-08-13 07:03:47 +02:00
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;
}
}
2020-08-04 08:49:11 +02:00
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_dbd70_len_700", is_trigger_bound);
2020-08-04 08:49:11 +02:00
2020-08-16 05:19:00 +02:00
Trigger* get_trigger_by_id(s32 triggerID) {
2020-08-13 07:03:47 +02:00
return (*gCurrentTriggerListPtr)[triggerID];
}
2020-08-04 08:49:11 +02:00
2020-08-19 03:45:26 +02:00
#ifdef NON_MATCHING
s32 func_80145CE8(s32 arg0) {
2020-08-14 17:18:05 +02:00
s32 i;
s32 ret;
if (func_800E52F8() == 0) {
return 0;
}
for (i = 0; i < ARRAY_COUNT(gCurrentTriggerListPtr); i++) {
2020-08-19 02:55:56 +02:00
if (((*gCurrentTriggerListPtr)[i] == NULL) ||
2020-08-14 17:18:05 +02:00
((*gCurrentTriggerListPtr)[i]->unk_30 == 0) ||
((*gCurrentTriggerListPtr)[i]->colliderID != arg0) ||
((*gCurrentTriggerListPtr)[i]->genericFlagIndex & 0x100) == 0) {
ret = 1;
}
}
return ret;
2020-08-19 03:45:26 +02:00
}
#else
2020-09-25 23:18:09 +02:00
INCLUDE_ASM(s32, "code_dbd70_len_700", func_80145CE8);
2020-08-19 03:45:26 +02:00
#endif