8#include "sprite/npc/BattleMerlee.h"
9#include "sprite/player.h"
88 .item = ITEM_MUSHROOM,
96 .generalChance =
F16(100),
98 .chancePerAttempt = 1,
102 .generalChance =
F16(75),
104 .chancePerAttempt = 2,
108 .generalChance =
F16(50),
110 .chancePerAttempt = 3,
114 .generalChance =
F16(25),
116 .chancePerAttempt = 4,
124 .chancePerAttempt = 0,
204 s32 encounterIdx = encounterID / 32;
205 s32 encounterShift = encounterID % 32;
207 return currentEncounter->
defeatFlags[mapID][encounterIdx] & (1 << encounterShift);
212 s32 encounterIdx = encounterID / 32;
216 flag = encounterID % 32;
217 encounterShift = flag;
218 flag = currentEncounter->
defeatFlags[mapID][encounterIdx];
219 currentEncounter->
defeatFlags[mapID][encounterIdx] = flag | (1 << encounterShift);
258 script->functionTemp[0] = 25;
262 script->functionTemp[0]--;
264 if (script->functionTemp[0] == 0) {
273 script->functionTemp[0] = 25;
277 script->functionTemp[0] -= 5;
279 if (script->functionTemp[0] == 0) {
297 if ((u32)(npc->
alpha & 0xFF) >= 0xFF) {
309 if (npc->
alpha == 0) {
323 script->functionTemp[1] = 0;
334 script->functionTemp[1] += 10;
335 script->functionTemp[1] =
clamp_angle(script->functionTemp[1]);
339 effectData->
pos.
y = merlee->
pos.
y + 16.0f;
344 effectData->
pos.
y = merlee->
pos.
y + 16.0f;
345 effectData->
pos.
z = merlee->
pos.
z + 5.0f;
357 effectData->
scale += 0.35;
358 if (effectData->
scale > 3.5) {
359 effectData->
scale = 3.5;
366 effectData->
scale += 0.5;
367 if (effectData->
scale > 5.0) {
389 script->varTable[0] = FALSE;
391 script->varTable[0] = TRUE;
398 Bytecode* args = script->ptrReadPos;
403 fx_energy_in_out(6, var0, var1, var2, 1.2f, 30);
408 Bytecode* args = script->ptrReadPos;
413 fx_energy_orb_wave(9, var0, var1, var2, 5.0f, 15);
418 Enemy* enemy = script->owner1.enemy;
423 script->functionTemp[0] = 0;
424 script->functionTemp[1] = 20;
427 if (script->functionTemp[1] & 1) {
428 npc->
flags &= ~NPC_FLAG_INVISIBLE;
433 if (script->functionTemp[1] == 15) {
438 temp1 = script->functionTemp[1];
439 if (script->functionTemp[1] == 10) {
440 fx_big_smoke_puff(npc->
pos.
x, npc->
pos.
y + 10.0f, npc->
pos.
z + 10.0f);
441 if (script->functionTemp[1] == temp1) {
446 script->functionTemp[1]--;
447 if (script->functionTemp[1] == 0) {
460 script->functionTemp[0] = 0;
461 script->functionTemp[1] = 40;
462 script->functionTemp[2] = 0;
465 script->functionTemp[2]++;
466 if (script->functionTemp[2] >= 5) {
468 if (playerData->
coins != 0) {
475 script->functionTemp[2] = 0;
478 return --script->functionTemp[1] == 0;
485 s32 screenX, screenY, screenZ;
486 f32 npcX, npcY, npcZ;
488 f32 testX, testY, testZ;
491 f32 playerX, playerY, playerZ;
510 f32 playerJumpColHeight = 37.0f;
511 f32 playerColRadius = 14.0f;
512 f32 playerColHeight = 18.0f;
521 currentEncounter->
songID = -1;
522 currentEncounter->
unk_18 = -1;
526 currentEncounter->
flags &= ~ENCOUNTER_FLAG_THUMBS_UP;
527 currentEncounter->
flags &= ~ENCOUNTER_FLAG_CANT_SKIP_WIN_DELAY;
528 currentEncounter->
flags &= ~ENCOUNTER_FLAG_SKIP_FLEE_DROPS;
530 playerX = playerStatus->
pos.
x;
531 playerY = playerStatus->
pos.
y;
532 playerZ = playerStatus->
pos.
z;
535 if (playerYaw < 180.0f) {
556 if (encounter == NULL) {
559 for (i = 0; i < encounter->
count; i++) {
560 enemy = encounter->
enemy[i];
573 if (suspendTime & 1) {
577 npc->
flags &= ~NPC_FLAG_SUSPENDED;
578 enemy->
flags &= ~ENEMY_FLAG_SUSPENDED;
582 if (script != NULL) {
586 if (script != NULL) {
592 if (script != NULL) {
596 if (script != NULL) {
602 if ((screenX < -160 || screenX > 480 || screenY < -120 || screenY > 360 || screenZ < 0) && !(enemy->
flags &
ENEMY_FLAG_PASSIVE)) {
606 if (script != NULL) {
610 if (script != NULL) {
614 npc->
flags &= ~NPC_FLAG_SUSPENDED;
615 enemy->
flags &= ~ENEMY_FLAG_SUSPENDED;
617 if (script != NULL) {
621 if (script != NULL) {
626 npc->
flags &= ~NPC_FLAG_SUSPENDED;
627 enemy->
flags &= ~ENEMY_FLAG_SUSPENDED;
629 if (script != NULL) {
633 if (script != NULL) {
647 if (script != NULL) {
656 if (script != NULL) {
662 if (script != NULL) {
698 if (npcYaw < 180.0f) {
737 if (distance >= playerColRadius + colRadius || y > npcY + colHeight || npcY > y + playerColHeight) {
745 if (
npc_test_move_taller_with_slipping(
COLLIDER_FLAG_IGNORE_PLAYER, &testX, &testY, &testZ, distance,
atan2(npcX, npcZ, playerX, playerZ), colHeight, colRadius * 2.0f)) {
749 if (
npc_test_move_taller_with_slipping(
COLLIDER_FLAG_IGNORE_PLAYER, &testX, &testY, &testZ, distance,
atan2(playerX, playerZ, npcX, npcZ), colHeight, colRadius * 2.0f)) {
761 triggeredBattle = FALSE;
762 if (angle1 >= 90.0f && angle2 >= 90.0f) {
763 triggeredBattle = FALSE;
765 if (angle1 < 90.0f && angle2 >= 90.0f) {
766 triggeredBattle = TRUE;
768 if (angle1 >= 90.0f && angle2 < 90.0f) {
769 triggeredBattle = FALSE;
771 if (angle1 < 90.0f && angle2 < 90.0f) {
772 triggeredBattle = TRUE;
774 if (triggeredBattle) {
798 if (distance >= playerColRadius + colRadius) {
801 if (playerY > npcY + colHeight || npcY > playerY + playerJumpColHeight) {
808 if (
npc_test_move_taller_with_slipping(
COLLIDER_FLAG_IGNORE_PLAYER, &testX, &testY, &testZ, distance,
atan2(npcX, npcZ, playerX, playerZ), colHeight, colRadius * 2.0f)) {
812 if (
npc_test_move_taller_with_slipping(
COLLIDER_FLAG_IGNORE_PLAYER, &testX, &testY, &testZ, distance,
atan2(playerX, playerZ, npcX, npcZ), colHeight, colRadius * 2.0f)) {
816 triggeredBattle = FALSE;
817 if (npcY + colHeight < playerY + playerJumpColHeight * 0.5f) {
826 triggeredBattle = TRUE;
829 if (playerY + playerJumpColHeight < npcY + colHeight * 0.5f) {
830 triggeredBattle = FALSE;
832 if (triggeredBattle) {
880 if (distance >= (playerColRadius + colRadius) * 0.8) {
883 if (npcY + colHeight < playerY) {
886 if (playerY + playerJumpColHeight < npcY) {
893 if (
npc_test_move_taller_with_slipping(
COLLIDER_FLAG_IGNORE_PLAYER, &testX, &testY, &testZ, distance,
atan2(npcX, npcZ, playerX, playerZ), colHeight, colRadius * 2.0f)) {
897 if (
npc_test_move_taller_with_slipping(
COLLIDER_FLAG_IGNORE_PLAYER, &testX, &testY, &testZ, distance,
atan2(playerX, playerZ, npcX, npcZ), colHeight, colRadius * 2.0f)) {
901 triggeredBattle = FALSE;
906 triggeredBattle = TRUE;
910 testX = playerStatus->
pos.
x + ((npc->
pos.
x - playerStatus->
pos.
x) * 0.5f);
912 testZ = playerStatus->
pos.
z + ((npc->
pos.
z - playerStatus->
pos.
z) * 0.5f);
922 playerStatus->
animFlags &= ~PA_FLAG_DIZZY_ATTACK_ENCOUNTER;
926 testX = playerStatus->
pos.
x + ((npc->
pos.
x - playerStatus->
pos.
x) * 0.5f);
928 testZ = playerStatus->
pos.
z + ((npc->
pos.
z - playerStatus->
pos.
z) * 0.5f);
954 switch (currentEncounter->
hitType) {
958 currentEnemy = enemy = currentEncounter->
curEnemy;
966 for (i = 0; i < encounter->
count; i++) {
967 enemy = encounter->
enemy[i];
986 script->
owner1.enemy = enemy;
1012 currentEnemy = enemy = currentEncounter->
curEnemy;
1020 for (i = 0; i < encounter->
count; i++) {
1021 enemy = encounter->
enemy[i];
1022 if (enemy == NULL) {
1040 script->
owner1.enemy = enemy;
1056 currentEnemy = enemy = currentEncounter->
curEnemy;
1066 for (i = 0; i < encounter->
count; i++) {
1067 enemy = encounter->
enemy[i];
1068 enemy = encounter->
enemy[i];
1069 if (enemy == NULL) {
1086 script->
owner1.enemy = enemy;
1091 testX = playerStatus->
pos.
x + ((npc->
pos.
x - playerStatus->
pos.
x) * 0.5f);
1093 testZ = playerStatus->
pos.
z + ((npc->
pos.
z - playerStatus->
pos.
z) * 0.5f);
1098 testX = playerStatus->
pos.
x + ((npc->
pos.
x - playerStatus->
pos.
x) * 0.5f);
1100 testZ = playerStatus->
pos.
z + ((npc->
pos.
z - playerStatus->
pos.
z) * 0.5f);
1119 currentEnemy = enemy = currentEncounter->
curEnemy;
1127 for (i = 0; i < encounter->
count; i++) {
1128 enemy = encounter->
enemy[i];
1129 if (enemy == NULL) {
1146 script->
owner1.enemy = enemy;
1150 testX = playerStatus->
pos.
x + ((npc->
pos.
x - playerStatus->
pos.
x) * 0.5f);
1152 testZ = playerStatus->
pos.
z + ((npc->
pos.
z - playerStatus->
pos.
z) * 0.5f);
1156 testX = playerStatus->
pos.
x + ((npc->
pos.
x - playerStatus->
pos.
x) * 0.5f);
1158 testZ = playerStatus->
pos.
z + ((npc->
pos.
z - playerStatus->
pos.
z) * 0.5f);
1175 enemy = currentEncounter->
curEnemy;
1176 if (enemy != NULL && enemy->
aiScript != NULL) {
1179 enemy = currentEncounter->
curEnemy;
1185 script->
owner1.enemy = enemy;
1200 currentEnemy = enemy = currentEncounter->
curEnemy;
1209 for (i = 0; i < encounter->
count; i++) {
1210 enemy = encounter->
enemy[i];
1211 if (enemy == NULL) {
1228 script->
owner1.enemy = enemy;
1274 currentEncounter->
unk_08 = -1;
1283 if (encounter != NULL) {
1284 for (j = 0; j < encounter->
count; j++) {
1285 enemy = encounter->
enemy[j];
1299 enemy = currentEncounter->
curEnemy;
1318 enemy = currentEncounter->
curEnemy;
1334 enemy = currentEncounter->
curEnemy;
1348 enemy = currentEncounter->
curEnemy;
1363 if (currentEncounter->
songID < 0) {
1397 for (i = 0; i < encounter->
count; i++) {
1398 enemy = encounter->
enemy[i];
1399 if (enemy != NULL &&
1413 enemy = currentEncounter->
curEnemy;
1428 currentEncounter->
unk_07 = 1;
1429 currentEncounter->
unk_08 = 0;
1449 for (i = 0; i < encounter->
count; i++) {
1450 enemy = encounter->
enemy[i];
1451 if (enemy != NULL &&
1461 currentEncounter->
unk_08 = 1;
1462 currentEncounter->
unk_07 = 1;
1476 currentEncounter->
unk_08 = 1;
1493 if (encounter->
curEnemy->
npcID != (s16) DX_DEBUG_DUMMY_ID) {
1501 f32 playerX, playerY, playerZ;
1502 f32 otherX, otherY, otherZ;
1503 s32 pScreenX, pScreenY, pScreenZ;
1504 s32 oScreenX, oScreenY, oScreenZ;
1517 playerX = playerStatus->
pos.
x;
1518 playerY = playerStatus->
pos.
y;
1519 playerZ = playerStatus->
pos.
z;
1523 otherX = npc->
pos.
x;
1524 otherY = npc->
pos.
y;
1525 otherZ = npc->
pos.
z;
1532 otherX = npc->
pos.
x;
1533 otherY = npc->
pos.
y;
1534 otherZ = npc->
pos.
z;
1536 if (otherY < -990.0f) {
1549 (pScreenY - oScreenY) / 2 + oScreenY);
1557 (pScreenY - oScreenY) / 2 + oScreenY);
1568 s32 screenWidthHalf;
1578 if (xOffset < 1600) {
1589 switch (currentEncounter->
hitType) {
1593 posX = (xOffset + screenWidthHalf) - (width / 2);
1594 draw_box(0,
WINDOW_STYLE_20, posX, 69, 0, width, 28, 255, 0, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, NULL, 0, NULL,
1599 width =
get_msg_width(MSG_Menus_PartnerFirstStrike, 0) + 24;
1600 posX = (xOffset + screenWidthHalf) - (width / 2);
1601 draw_box(0,
WINDOW_STYLE_20, posX, 69, 0, width, 28, 255, 0, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, NULL, 0, NULL,
1610 posX = (xOffset + screenWidthHalf) - (width / 2);
1611 draw_box(0,
WINDOW_STYLE_4, posX, 69, 0, width, 28, 255, 0, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, NULL, 0, NULL,
1628 s32 hasDefeatScript;
1633 if (currentEncounter->
unk_08 == 0) {
1637 currentEncounter->
unk_08 = 0;
1659 currentEncounter->
hitType = 0;
1720 for (i = 0; i < encounter->
count; i++) {
1721 enemy = encounter->
enemy[i];
1722 if (enemy == NULL) {
1735 script->
owner1.enemy = enemy;
1743 script->
owner1.enemy = enemy;
1770 hasDefeatScript = FALSE;
1772 for (i = 0; i < encounter->
count; i++) {
1773 enemy = encounter->
enemy[i];
1774 if (enemy == NULL) {
1784 hasDefeatScript = TRUE;
1790 if (!hasDefeatScript) {
1798 for (i = 0; i < encounter->
count; i++) {
1799 enemy = encounter->
enemy[i];
1800 enemy = encounter->
enemy[i];
1801 if (enemy == NULL) {
1841 if (encounter == NULL) {
1844 for (j = 0; j < encounter->
count; j++) {
1845 enemy = encounter->
enemy[j];
1872 for (i = 0; i < encounter->
count; i++) {
1873 enemy = encounter->
enemy[i];
1874 if (enemy == NULL) {
1889 script->
owner1.enemy = enemy;
1909 hasDefeatScript = FALSE;
1910 for (i = 0; i < encounter->
count; i++) {
1911 enemy = encounter->
enemy[i];
1912 if (enemy == NULL) {
1917 hasDefeatScript = TRUE;
1923 if (!hasDefeatScript) {
1926 if (encounter == NULL) {
1929 for (j = 0; j < encounter->
count; j++) {
1930 enemy = encounter->
enemy[j];
1943 enemy = currentEncounter->
curEnemy;
1948 for (j = 0; j < encounter->
count; j++) {
1949 enemy = encounter->
enemy[j];
1950 if (enemy == NULL) {
1964 enemy = currentEncounter->
curEnemy;
1969 script->
owner1.enemy = enemy;
2005 for (i = 0; i < encounter->
count; i++) {
2006 enemy = encounter->
enemy[i];
2007 if (enemy == NULL) {
2022 script->
owner1.enemy = enemy;
2041 hasDefeatScript = FALSE;
2043 for (i = 0; i < encounter->
count; i++) {
2044 enemy = encounter->
enemy[i];
2045 if (enemy == NULL) {
2050 hasDefeatScript = TRUE;
2056 if (!hasDefeatScript) {
2059 if (encounter == NULL) {
2062 for (j = 0; j < encounter->
count; j++) {
2063 enemy = encounter->
enemy[j];
2098 if (encounter == NULL) {
2101 for (j = 0; j < encounter->
count; j++) {
2102 enemy = encounter->
enemy[j];
2124 for (i = 0; i < encounter->
count; i++) {
2125 enemy = encounter->
enemy[i];
2126 if (enemy == NULL) {
2141 script->
owner1.enemy = enemy;
2160 hasDefeatScript = FALSE;
2162 for (i = 0; i < encounter->
count; i++) {
2163 enemy = encounter->
enemy[i];
2164 if (enemy == NULL) {
2169 hasDefeatScript = TRUE;
2175 if (!hasDefeatScript) {
2178 if (encounter == NULL) {
2181 for (j = 0; j < encounter->
count; j++) {
2182 enemy = encounter->
enemy[j];
2195 enemy = currentEncounter->
curEnemy;
2200 for (j = 0; j < encounter->
count; j++) {
2201 enemy = encounter->
enemy[j];
2202 if (enemy == NULL) {
2230 if (encounter == NULL) {
2233 for (j = 0; j < encounter->
count; j++) {
2234 enemy = encounter->
enemy[j];
2245 npc->
flags &= ~NPC_FLAG_SUSPENDED;
2246 enemy->
flags &= ~ENEMY_FLAG_SUSPENDED;
2266 Enemy* currentEnemy;
2271 currentEnemy = encounter->
curEnemy;
2297 currentEnemy = encounter->
curEnemy;
2298 if (currentEnemy != NULL && currentEnemy->
aiScript != NULL) {
2326 f32 npcX, npcY, npcZ;
2330 f32 playerX, playerY, playerZ;
2346 playerStatus->
flags &= ~PS_FLAG_HAS_CONVERSATION_NPC;
2349 playerX = playerStatus->
pos.
x;
2350 playerY = playerStatus->
pos.
y;
2351 playerZ = playerStatus->
pos.
z;
2357 resultEncounter = NULL;
2360 minLength = 65535.0f;
2365 if (encounter == NULL) {
2369 for (j = 0; j < encounter->
count; j++) {
2370 enemy = encounter->
enemy[j];
2372 if (enemy == NULL) {
2393 deltaX = npcX - playerX;
2394 deltaZ = npcZ - playerZ;
2397 length =
sqrtf(
SQ(deltaX) +
SQ(deltaZ));
2400 if ((playerRadius + npcRadius <= length) ||
2401 (npcY + npcHeight < playerY) ||
2402 (playerY + playerHeight < npcY)) {
2418 yaw =
atan2(playerX, playerZ, npcX, npcZ);
2429 yaw =
atan2(npcX, npcZ, playerX, playerZ);
2436 if (length < minLength) {
2438 resultEncounter = encounter;
2440 resultEnemy = enemy;
2453 encounterStatus->
curEnemy = resultEnemy;
2467 s32 mapID = currentEncounter->
mapID;
2492 if (currentEncounter->
recentMaps[i] == mapID) {
2516 npcData = groupList->
npcs;
2517 groupNpcCount = groupList->
npcCount;
2522 ASSERT(encounter != NULL);
2523 encounter->
count = groupNpcCount;
2527 for (i = 0; i < groupNpcCount; i++) {
2530 encounter->
enemy[i] = NULL;
2537 for (k = 0; k <
ARRAY_COUNT(enemy->varTable); k++) {
2538 enemy->varTable[k] = 0;
2544 if ((*(s16*)(&npcData->
drops) & 0xFF00) != 0x8000) {
2595 enemy->varTable[k] = *initialVars++;
2671 if (npcSettings->
otherAI != NULL) {
2675 script->
owner1.enemy = enemy;
2684 totalNpcCount += groupNpcCount;
2694 if (encounter == NULL) {
2697 for (i = 0; i < encounter->
count; i++) {
2698 enemy = encounter->
enemy[i];
2699 if (enemy == NULL) {
2712 if (encounter == NULL) {
2715 for (i = 0; i < encounter->
count; i++) {
2716 enemy = encounter->
enemy[i];
2717 if (enemy == NULL) {
2724 script->
owner1.enemy = enemy;
2739 if (encounter == NULL) {
2742 for (i = 0; i < encounter->
count; i++) {
2743 enemy = encounter->
enemy[i];
2744 if (enemy == NULL) {
2763 if (encounter == NULL) {
2766 for (i = 0; i < encounter->
count; i++) {
2767 enemy = encounter->
enemy[i];
2768 if (enemy == NULL) {
2777 script->
owner1.enemy = enemy;
2787 if (encounter == NULL) {
2790 for (i = 0; i < encounter->
count; i++) {
2791 enemy = encounter->
enemy[i];
2792 if (enemy == NULL) {
2800 script->
owner1.enemy = enemy;
AnimID trueAnimation
Encoding back-facing sprite.
union Evt::@8 owner1
Initially -1.
union Evt::@9 owner2
Initially -1.
#define sfx_play_sound_at_position
struct EnergyOrbWaveFXData * energyOrbWave
#define ASSERT(condition)
void create_encounters(void)
b32 check_conversation_trigger(void)
void update_encounters_conversation(void)
void setup_status_bar_for_world(void)
void update_encounters_neutral(void)
void show_first_strike_message(void)
BSS EffectInstance * WorldMerleeOrbEffect
b8 LastBattleStartedBySpin
void update_encounters_post_battle(void)
s8 HasPreBattleSongPushed
s32 get_coin_drop_amount(Enemy *enemy)
BSS s32 WorldMerleeEffectsTime
BSS s16 WorldMerleeEffectsState
void init_encounters_ui(void)
BSS f32 WorldMerleeBasePosY
BSS s32 MerleeDropCoinsEvtID
void update_encounters_pre_battle(void)
s32 get_defeated(s32 mapID, s32 encounterID)
s32 is_starting_conversation(void)
s16 gFirstStrikeMessagePos
void set_defeated(s32 mapID, s32 encounterID)
void draw_encounters_pre_battle(void)
void set_battle_formation(Battle *)
BSS Evt * MerleeDropCoinsEvt
void draw_encounters_conversation(void)
EvtScript EVS_MerleeDropCoins
EvtScript EVS_FleeBattleDrops
EncounterStatus gCurrentEncounter
b32 EncounterStateChanged
void draw_encounters_neutral(void)
void partner_handle_after_battle(void)
void draw_encounters_post_battle(void)
b8 PendingPartnerAbilityResume
BSS EffectInstance * WorldMerleeWaveEffect
EnemyDrops DefaultEnemyDrops
@ FX_INSTANCE_FLAG_DISMISS
@ DEBUG_CONTACT_CANT_TOUCH
@ DEBUG_CONTACT_DIE_ON_TOUCH
@ ENCOUNTER_FLAG_SKIP_FLEE_DROPS
@ ENCOUNTER_FLAG_THUMBS_UP
Mario will do a 'thumbs up' animation after winning.
@ ENCOUNTER_FLAG_CANT_SKIP_WIN_DELAY
@ ITEM_SPAWN_MODE_TOSS_SPAWN_ALWAYS
@ ENCOUNTER_SUBSTATE_CONVERSATION_END
@ ENCOUNTER_SUBSTATE_CONVERSATION_INIT
@ PS_FLAG_ENTERING_BATTLE
@ PS_FLAG_HAS_CONVERSATION_NPC
@ ENCOUNTER_TRIGGER_CONVERSATION
@ ENCOUNTER_TRIGGER_HAMMER
@ ENCOUNTER_TRIGGER_PARTNER
@ ENCOUNTER_SUBSTATE_POST_BATTLE_WON_FADE_IN
@ ENCOUNTER_SUBSTATE_POST_BATTLE_LOST_RESUME
@ ENCOUNTER_SUBSTATE_POST_BATTLE_LOST_FADE_IN
@ ENCOUNTER_SUBSTATE_POST_BATTLE_SKIP
@ ENCOUNTER_SUBSTATE_POST_BATTLE_FLED_RESUME
@ ENCOUNTER_SUBSTATE_POST_BATTLE_WON_KILL
@ ENCOUNTER_SUBSTATE_POST_BATTLE_FLED_INIT
@ ENCOUNTER_SUBSTATE_POST_BATTLE_WON_RESUME
@ ENCOUNTER_SUBSTATE_POST_BATTLE_ENEMY_FLED_INIT
@ ENCOUNTER_SUBSTATE_POST_BATTLE_LOST_DELAY
@ ENCOUNTER_SUBSTATE_POST_BATTLE_FLED_FADE_IN
@ ENCOUNTER_SUBSTATE_POST_BATTLE_LOST_INIT
@ ENCOUNTER_SUBSTATE_POST_BATTLE_ENEMY_FLED_FADE_IN
@ ENCOUNTER_SUBSTATE_POST_BATTLE_INIT
@ ENCOUNTER_SUBSTATE_POST_BATTLE_PLAY_NPC_DEFEAT
@ ENCOUNTER_SUBSTATE_POST_BATTLE_ENEMY_FLED_RESUME
@ ENCOUNTER_SUBSTATE_POST_BATTLE_FLED_DELAY
@ ENCOUNTER_SUBSTATE_POST_BATTLE_WON_CHECK_MERLEE
@ ENEMY_FLAG_RAYCAST_TO_INTERACT
@ ENEMY_FLAG_NO_DELAY_AFTER_FLEE
@ ENEMY_FLAG_IGNORE_ENTITY_COLLISION
@ ENEMY_FLAG_HAS_NO_SPRITE
@ ENEMY_FLAG_IGNORE_HAMMER
@ ENEMY_FLAG_DO_NOT_AUTO_FACE_PLAYER
@ ENEMY_FLAG_IGNORE_PARTNER
@ ENEMY_FLAG_ENABLE_HIT_SCRIPT
@ ENEMY_FLAG_USE_PLAYER_SPRITE
@ ENEMY_FLAG_DONT_SUSPEND_SCRIPTS
@ ENEMY_FLAG_USE_INSPECT_ICON
@ ENEMY_FLAG_NO_SHADOW_RAYCAST
@ ENEMY_FLAG_IGNORE_TOUCH
@ ENEMY_FLAG_CANT_INTERACT
@ ENEMY_FLAG_DONT_UPDATE_SHADOW_Y
@ ENEMY_FLAG_IGNORE_PLAYER_COLLISION
@ ENEMY_FLAG_IGNORE_WORLD_COLLISION
@ ENEMY_FLAG_ACTIVE_WHILE_OFFSCREEN
@ COLLIDER_FLAG_IGNORE_PLAYER
@ PA_FLAG_DIZZY_ATTACK_ENCOUNTER
@ ENCOUNTER_SUBSTATE_PRE_BATTLE_INIT
@ ENCOUNTER_SUBSTATE_PRE_BATTLE_AUTO_WIN
@ ENCOUNTER_SUBSTATE_PRE_BATTLE_LOAD
@ ENCOUNTER_SUBSTATE_PRE_BATTLE_SKIP
@ SOUND_SPEEDY_SPIN_ATTACK
@ SOUND_HIT_PLAYER_NORMAL
@ ACTION_STATE_STEP_DOWN_LAND
@ ACTION_STATE_SPIN_POUND
@ ACTION_STATE_TALK
Reading signs doesn't count.
@ ACTION_STATE_TORNADO_POUND
@ ACTION_STATE_USE_SPINNING_FLOWER
@ ACTION_STATE_ENEMY_FIRST_STRIKE
@ ACTION_STATE_BOUNCE
Used with Kooper.
@ ACTION_STATE_TORNADO_JUMP
@ ENCOUNTER_STATE_POST_BATTLE
@ ENCOUNTER_STATE_CONVERSATION
@ ENCOUNTER_STATE_NEUTRAL
@ ENCOUNTER_STATE_PRE_BATTLE
@ GLOBAL_OVERRIDES_DISABLE_BATTLES
@ ENCOUNTER_SUBSTATE_NEUTRAL
@ ENCOUNTER_SUBSTATE_CREATE_RUN_INIT_SCRIPT
@ ENCOUNTER_SUBSTATE_CREATE_RUN_AI
@ ENCOUNTER_SUBSTATE_CREATE_INIT
@ NPC_FLAG_IGNORE_ENTITY_COLLISION
@ NPC_FLAG_RAYCAST_TO_INTERACT
@ NPC_FLAG_IGNORE_WORLD_COLLISION
@ NPC_FLAG_IGNORE_PLAYER_COLLISION
@ NPC_FLAG_NO_SHADOW_RAYCAST
@ NPC_FLAG_USE_INSPECT_ICON
@ NPC_FLAG_DONT_UPDATE_SHADOW_Y
@ EVT_GROUP_FLAG_INTERACT
@ EVT_FLAG_SUSPENDED
doesn't affect child
void set_screen_overlay_params_back(u8, f32)
void set_battle_stage(s32)
s32 evt_get_variable(Evt *script, Bytecode var)
s32 is_ability_active(s32 arg0)
s32 is_merlee_message_done(void)
void get_screen_coords(s32 camID, f32 x, f32 y, f32 z, s32 *screenX, s32 *screenY, s32 *screenZ)
void set_screen_overlay_alpha(s32, f32)
void spawn_drops(Enemy *enemy)
void partner_disable_input(void)
s32 disable_player_input(void)
s32 resume_all_group(s32 groupFlags)
s32 suspend_all_script(s32 id)
void set_screen_overlay_params_front(u8, f32)
void close_status_bar(void)
void mdl_set_all_tint_type(s32)
s32 enable_player_input(void)
void set_script_flags(Evt *script, s32 flags)
void bgm_pop_battle_song(void)
Evt * start_script(EvtScript *source, s32 priority, s32 initialState)
s32 is_picking_up_item(void)
void set_action_state(s32 actionState)
void clear_script_flags(Evt *script, s32 flags)
s32 partner_test_enemy_collision(Npc *enemy)
b32 npc_test_move_taller_with_slipping(s32, f32 *, f32 *, f32 *, f32, f32, f32, f32)
void show_merlee_message(s16, s16)
void set_screen_overlay_center(s32, s32, s32, s32)
void kill_script_by_ID(s32 id)
void set_screen_overlay_color(s32, u8, u8, u8)
void start_bounce_a(void)
void suggest_player_anim_allow_backward(AnimID anim)
void partner_handle_before_battle(void)
s32 resume_all_script(s32 id)
s32 does_script_exist(s32 id)
void bgm_set_battle_song(s32, s32)
void bgm_push_battle_song(void)
Evt * start_script_in_group(EvtScript *source, u8 priority, u8 initialState, u8 groupFlags)
s32 make_item_entity_delayed(s32 itemID, f32 x, f32 y, f32 z, s32 itemSpawnMode, s32 pickupDelay, s32 pickupVar)
void add_vec2D_polar(f32 *x, f32 *y, f32 r, f32 theta)
Evt * get_script_by_id(s32 id)
f32 get_clamped_angle_diff(f32, f32)
void suspend_all_group(s32 groupFlags)
void * heap_malloc(s32 size)
void mdl_set_shroud_tint_params(u8 r, u8 g, u8 b, u8 a)
s8 resetMapEncounterFlags
struct Evt * interactScript
s8 scriptedBattle
battle started by StartBattle but not by encounter
struct NpcData::@52 animations
FieldStatus unusedAttack3
FieldStatus unusedAttack1
void kill_enemy(Enemy *enemy)
Encounter * encounterList[24]
s32 create_peach_npc(NpcBlueprint *blueprint)
s8 battleTriggerCooldown
set to 15 after victory, 45 after fleeing
s32 create_standard_npc(NpcBlueprint *blueprint, AnimID *animList)
struct Evt * defeatScript
Npc * get_npc_unsafe(s32 npcID)
EvtScript * interactBytecode
Npc * get_npc_by_index(s32 listIndex)
NpcSettings * npcSettings
FieldStatus unusedAttack2
void set_npc_yaw(Npc *npc, f32 yaw)
EvtScript * defeatBytecode
EnemyTerritory * territory
void partner_enable_input(void)
void sfx_stop_sound(s32 soundID)
void sfx_play_sound(s32 soundID)
ApiStatus ShowMerleeCoinMessage(Evt *script, b32 isInitialCall)
ApiStatus PlaySound(Evt *script, b32 isInitialCall)
ApiStatus FadeBackgroundLighten(Evt *script, b32 isInitialCall)
ApiStatus DeleteNpc(Evt *script, b32 isInitialCall)
ApiStatus PlayMerleeGatherFX(Evt *script, b32 isInitialCall)
ApiStatus SetNpcAnimation(Evt *script, b32 isInitialCall)
ApiStatus SetEnemyFlagBits(Evt *script, b32 isInitialCall)
ApiStatus FadeInMerlee(Evt *script, b32 isInitialCall)
ApiStatus MerleeStopFX(Evt *script, b32 isInitialCall)
ApiStatus FadeOutMerlee(Evt *script, b32 isInitialCall)
ApiStatus OnFleeBattleDrops(Evt *script, b32 isInitialCall)
ApiStatus SetNpcRotation(Evt *script, b32 isInitialCall)
ApiStatus MerleeUpdateFX(Evt *script, b32 isInitialCall)
ApiStatus FadeBackgroundDarken(Evt *script, b32 isInitialCall)
ApiStatus CreateNpc(Evt *script, b32 isInitialCall)
ApiStatus RemoveNpc(Evt *script, b32 isInitialCall)
ApiStatus GetSelfAnimationFromTable(Evt *script, b32 isInitialCall)
ApiStatus DoNpcDefeat(Evt *script, b32 isInitialCall)
ApiStatus SetNpcPos(Evt *script, b32 isInitialCall)
ApiStatus OnDefeatEnemy(Evt *script, b32 isInitialCall)
ApiStatus GetOwnerEncounterTrigger(Evt *script, b32 isInitialCall)
ApiStatus PlayMerleeOrbFX(Evt *script, b32 isInitialCall)
ApiStatus HasMerleeCasts(Evt *script, b32 isInitialCall)
ApiStatus SetNpcYaw(Evt *script, b32 isInitialCall)
ApiStatus GetCamLookAtObjVector(Evt *script, b32 isInitialCall)
ApiStatus ShowMerleeRanOutMessage(Evt *script, b32 isInitialCall)
ApiStatus func_800458CC(Evt *script, b32 isInitialCall)
ApiStatus OnPlayerFled(Evt *script, b32 isInitialCall)
ApiStatus SetNpcFlagBits(Evt *script, b32 isInitialCall)
ApiStatus GetPlayerPos(Evt *script, b32 isInitialCall)
ApiStatus GetBattleOutcome(Evt *script, b32 isInitialCall)
#define Switch(LVAR)
Marks the start of a switch statement.
#define Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
#define CaseEq(RVAR)
Marks the start of a switch case that executes only if LVAR == RVAR. It also marks the end of any pre...
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
#define Add(VAR, INT_VALUE)
#define EndLoop
Marks the end of a loop.
#define EndCaseGroup
Marks the end of a switch case group (CaseOrEq and/or CaseAndEq), stopping fallthrough.
#define CaseOrEq(RVAR)
Marks the start of a switch case that executes only if LVAR == RVAR.
#define EndIf
Marks the end of an if statement or an else block.
#define ExecWait(EVT_SOURCE)
Launches a new child thread.
#define Thread
Marks the start of a thread block.
#define EndThread
Marks the end of a thread block.
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
#define EndSwitch
Marks the end of a switch statement and any case.
#define IfEq(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR == RVAR.
#define F16(f)
Fixed-point short literal.
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
#define Loop(TIMES)
Marks the beginning of a loop.
#define Return
Kills the current EVT thread.
EvtScript EVS_NpcHitRecoil
void(* onRender)(struct Npc *)
void(* onUpdate)(struct Npc *)
PartnerStatus gPartnerStatus
GameStatus * gGameStatusPtr
u8 * gBackgroundTintModePtr
PlayerStatus gPlayerStatus
void fx_damage_stars(s32, f32, f32, f32, f32, f32, f32, s32)