Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
ParatroopaAI.inc.c File Reference

Go to the source code of this file.

Enumerations

enum  AiStateParatroopa { AI_STATE_PARATROOPA_WINDUP = 12 , AI_STATE_PARATROOPA_DIVE = 13 , AI_STATE_PARATROOPA_OVERSHOOT = 14 , AI_STATE_PARATROOPA_RESET = 15 }
 

Functions

voidParatroopaAI_Windup (Evt *script, MobileAISettings *aiSettings, EnemyDetectVolume *territory)
 
voidParatroopaAI_Dive (Evt *script, MobileAISettings *aiSettings, EnemyDetectVolume *territory)
 
voidParatroopaAI_Overshoot (Evt *script, MobileAISettings *arg1, EnemyDetectVolume *arg2)
 
voidParatroopaAI_Reset (Evt *script, MobileAISettings *aiSettings, EnemyDetectVolume *territory)
 

Enumeration Type Documentation

◆ AiStateParatroopa

Enumerator
AI_STATE_PARATROOPA_WINDUP 
AI_STATE_PARATROOPA_DIVE 
AI_STATE_PARATROOPA_OVERSHOOT 
AI_STATE_PARATROOPA_RESET 

Definition at line 7 of file ParatroopaAI.inc.c.

7 {
12};
@ AI_STATE_PARATROOPA_DIVE
@ AI_STATE_PARATROOPA_WINDUP
@ AI_STATE_PARATROOPA_RESET
@ AI_STATE_PARATROOPA_OVERSHOOT

Function Documentation

◆ ParatroopaAI_Windup()

void N ParatroopaAI_Windup ( Evt * script,
MobileAISettings * aiSettings,
EnemyDetectVolume * territory )

Definition at line 14 of file ParatroopaAI.inc.c.

14 {
15 Enemy* enemy = script->owner1.enemy;
16 Npc* npc = get_npc_unsafe(enemy->npcID);
18
19 npc->curAnim = enemy->animList[9];
20 npc->jumpVel = -5.0f;
21 npc->jumpScale = 0.15f;
22 npc->collisionHeight = enemy->varTable[8] / 2;
23
25 npc->moveSpeed = 7.0f;
26 enemy->unk_10.x = npc->pos.x;
27 enemy->unk_10.y = npc->pos.y;
28 enemy->unk_10.z = npc->pos.z;
29 enemy->hitboxIsActive = true;
30
33 npc->duration = 12;
34 npc->yaw = yawTemp;
35 script->AI_TEMP_STATE = AI_STATE_PARATROOPA_DIVE;
36}
BSS s32 PopupMenu_SelectedIndex
#define atan2
@ SOUND_PARAGOOMBA_DIVE
Definition enums.h:1032
void ai_enemy_play_sound(Npc *npc, s32 arg1, s32 arg2)
Definition 23680.c:543
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by)
Definition 43F0.c:670
s16 npcID
Definition npc.h:300
s32 * animList
Definition npc.h:341
Npc * get_npc_unsafe(s32 npcID)
Definition npc.c:992
Vec3s unk_10
Definition npc.h:302
s8 hitboxIsActive
Definition npc.h:299
Definition npc.h:294
f32 jumpScale
f32 jumpVel
AnimID curAnim
s16 collisionHeight
Vec3f pos
f32 moveSpeed
s16 duration
PlayerStatus * gPlayerStatusPtr

◆ ParatroopaAI_Dive()

void N ParatroopaAI_Dive ( Evt * script,
MobileAISettings * aiSettings,
EnemyDetectVolume * territory )

Definition at line 38 of file ParatroopaAI.inc.c.

38 {
39 Enemy* enemy = script->owner1.enemy;
40 Npc* npc = get_npc_unsafe(script->owner1.enemy->npcID);
41
42 npc->jumpVel += npc->jumpScale;
43 npc->pos.y += npc->jumpVel;
44 npc_move_heading(npc, npc->moveSpeed, npc->yaw);
45 npc->duration--;
46
47 if (npc->duration <= 0) {
48 enemy->hitboxIsActive = false;
49 npc->jumpScale = 0.3f;
50 npc->jumpVel = 0.0f;
51 npc->moveSpeed = 3.0f;
52 npc->curAnim = enemy->animList[10];
54 }
55}
void npc_move_heading(Npc *npc, f32 speed, f32 yaw)
Definition npc.c:983

◆ ParatroopaAI_Overshoot()

void N ParatroopaAI_Overshoot ( Evt * script,
MobileAISettings * arg1,
EnemyDetectVolume * arg2 )

Definition at line 57 of file ParatroopaAI.inc.c.

58{
59 Enemy* enemy = script->owner1.enemy;
60 Npc* npc = get_npc_unsafe(enemy->npcID);
61 f32 overshootAmtRaw = enemy->varTable[3];
62 f32 posX, posY, posZ, hitDepth;
65
66 npc->jumpVel += npc->jumpScale;
67 npc->pos.y += npc->jumpVel;
69 npc_move_heading(npc, npc->moveSpeed, npc->yaw);
70
71 posX = npc->pos.x;
72 posY = npc->pos.y;
73 posZ = npc->pos.z;
74 hitDepth = 1000.0f;
75 if (npc_raycast_down_sides(npc->collisionChannel, &posX, &posY, &posZ, &hitDepth)) {
77 } else {
79 }
80
81 if (!(npc->pos.y < endOvershootHeight)) {
82 npc->duration = 10;
83 npc->curAnim = enemy->animList[11];
84 npc->collisionHeight = enemy->varTable[8];
85 script->AI_TEMP_STATE = AI_STATE_PARATROOPA_RESET;
86 }
87}
#define npc_raycast_down_sides
s32 collisionChannel

◆ ParatroopaAI_Reset()

void N ParatroopaAI_Reset ( Evt * script,
MobileAISettings * aiSettings,
EnemyDetectVolume * territory )

Definition at line 89 of file ParatroopaAI.inc.c.

89 {
90 Npc* npc = get_npc_unsafe(script->owner1.enemy->npcID);
91
92 npc->duration--;
93 if (npc->duration <= 0) {
94 script->AI_TEMP_STATE = AI_STATE_WANDER_INIT;
95 }
96}
@ AI_STATE_WANDER_INIT
Definition enums.h:4166