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-10-22 02:07:00 +02:00
|
|
|
gCurrentTriggerListPtr = &gTriggerList1;
|
2020-08-13 07:03:47 +02:00
|
|
|
} else {
|
2020-10-22 02:07:00 +02:00
|
|
|
gCurrentTriggerListPtr = &gTriggerList2;
|
2020-08-13 07:03:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2020-10-22 02:07:00 +02:00
|
|
|
TriggerList** currentTriggerListPtr = &gCurrentTriggerListPtr;
|
2020-08-13 07:03:47 +02:00
|
|
|
|
2020-10-22 02:07:00 +02:00
|
|
|
for (i = 0; i < MAX_TRIGGERS; i++) {
|
|
|
|
if ((**currentTriggerListPtr)[i] == toDelete) {
|
2020-08-13 07:03:47 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-22 02:07:00 +02:00
|
|
|
if (i < MAX_TRIGGERS) {
|
|
|
|
heap_free((**currentTriggerListPtr)[i]);
|
|
|
|
(**currentTriggerListPtr)[i] = NULL;
|
2020-08-13 07:03:47 +02:00
|
|
|
}
|
|
|
|
}
|
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;
|
|
|
|
}
|
|
|
|
|
2020-10-22 02:07:00 +02:00
|
|
|
for (i = 0; i < MAX_TRIGGERS; i++) {
|
2020-10-09 21:07:58 +02:00
|
|
|
Trigger* trigger = (*gCurrentTriggerListPtr)[i];
|
2020-10-09 20:55:23 +02:00
|
|
|
|
2020-10-10 19:42:15 +02:00
|
|
|
if ((trigger != NULL) &&
|
|
|
|
(trigger->unk_30 != 0) &&
|
|
|
|
(trigger->params2 == arg0) &&
|
2020-10-09 21:07:58 +02:00
|
|
|
(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
|
|
|
}
|