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-10-08 21:03:58 +02:00
|
|
|
INCLUDE_ASM(s32, "code_dbd70_len_700", is_trigger_bound, Trigger* trigger, Bytecode* script);
|
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
|
|
|
s32 func_80145CE8(s32 arg0) {
|
2020-08-14 17:18:05 +02:00
|
|
|
s32 i;
|
|
|
|
|
|
|
|
if (func_800E52F8() == 0) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_COUNT(gCurrentTriggerListPtr); i++) {
|
2020-10-09 21:07:58 +02:00
|
|
|
Trigger* trigger = (*gCurrentTriggerListPtr)[i];
|
2020-10-09 20:55:23 +02:00
|
|
|
|
2020-10-09 21:07:58 +02:00
|
|
|
if ((trigger != NULL) &&
|
|
|
|
(trigger->unk_30 != 0) &&
|
|
|
|
(trigger->params2 == arg0) &&
|
|
|
|
(trigger->flags.flags & 0x100)) {
|
2020-10-09 20:55:23 +02:00
|
|
|
return 1;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
|
|
|
}
|
2020-10-09 20:55:23 +02:00
|
|
|
return 0;
|
2020-08-19 03:45:26 +02:00
|
|
|
}
|