1#ifndef _AI_FIRE_BAR_INC_
2#define _AI_FIRE_BAR_INC_ 0
7extern s32 N(FireBar_Sounds)[11];
16API_CALLABLE(N(FireBarAI_Main)) {
24 f32 distToPlayer, angleToPlayer;
25 f32 distToNpc, angleToNpc;
26 f32 deltaYaw, clampedYaw;
39 script->functionTempPtr[1] = data;
58 data = script->functionTempPtr[1];
59 for (i = 0; i < data->
npcCount; i++) {
61 if (!(data->
flags & 1)) {
71 dY = playerStatus->
pos.
y - npc->
pos.
y;
76 dY = (playerStatus->
pos.
y - 10.0f) - npc->
pos.
y;
79 dX = playerStatus->
pos.
x - npc->
pos.
x;
80 dZ = playerStatus->
pos.
z - npc->
pos.
z;
92 if (clampedYaw != data->
yaw) {
93 data->
yaw = clampedYaw;
99 tempPlayerDist = distToPlayer;
116 }
else if ((tempPlayerDist < distToNpc) && !(data->
flags & 2)
120 if (deltaYaw > 0.0f) {
128 if (deltaYaw < 0.0f) {
146 if (data->flags & 2) {
147 data->rotRate *= 0.95f;
151 data->rotRate *= 1.12f;
152 if (data->soundIndex == 10) {
154 script->varTable[0] = data->firstNpc;
155 script->varTable[1] = data->npcCount;
160 data->rotRate = abs(data->settings->rotRate) *
signF(-data->rotRate);
void N FireBarAI_Callback(FireBarData *data, s32 mode)
#define sfx_play_sound_at_position
@ PS_FLAG_HAZARD_INVINCIBILITY
@ ACTION_STATE_HIT_FIRE
Causes Mario to fly up and take damage. Used for fire bars.
s32 evt_get_variable(Evt *script, Bytecode var)
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by)
Evt * start_script(EvtScript *source, s32 priority, s32 initialState)
void set_action_state(s32 actionState)
s32 get_time_freeze_mode(void)
f32 get_clamped_angle_diff(f32, f32)
void * heap_malloc(s32 size)
s8 battleTriggerCooldown
set to 15 after victory, 45 after fleeing
FireBarAISettings * settings
Npc * get_npc_unsafe(s32 npcID)
EncounterStatus gCurrentEncounter
PartnerStatus gPartnerStatus
PlayerStatus gPlayerStatus