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

Go to the source code of this file.

Macros

#define _AI_TACKLE_STATES_INC_   0
 

Functions

void N set_script_owner_npc_anim (Evt *script, MobileAISettings *aiSettings, EnemyDetectVolume *territory)
 
ApiStatusUnkDistFunc (Evt *script, MobileAISettings *aiSettings, EnemyDetectVolume *territory)
 
void N UnkNpcAIFunc12 (Evt *script, MobileAISettings *aiSettings, EnemyDetectVolume *territory)
 
void N set_script_owner_npc_col_height (Evt *script, MobileAISettings *aiSettings, EnemyDetectVolume *territory)
 

Macro Definition Documentation

◆ _AI_TACKLE_STATES_INC_

#define _AI_TACKLE_STATES_INC_   0

Definition at line 2 of file States_TackleAI.inc.c.

Function Documentation

◆ set_script_owner_npc_anim()

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

Definition at line 10 of file States_TackleAI.inc.c.

10 {
11 Enemy* enemy = script->owner1.enemy;
12 Npc* npc = get_npc_unsafe(enemy->npcID);
13
15 npc->duration = enemy->varTable[2];
16 npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x, gPlayerStatusPtr->pos.z);
17 script->AI_TEMP_STATE = 13;
18}
union Evt::@8 owner1
Initially -1.
#define atan2
@ ENEMY_ANIM_INDEX_MELEE_PRE
Definition enums.h:3434
s16 npcID
Definition npc.h:300
s32 * animList
Definition npc.h:341
Npc * get_npc_unsafe(s32 npcID)
Definition npc.c:995
Definition npc.h:294
AnimID curAnim
Vec3f pos
s16 duration
PlayerStatus * gPlayerStatusPtr

◆ UnkDistFunc()

ApiStatus N UnkDistFunc ( Evt * script,
MobileAISettings * aiSettings,
EnemyDetectVolume * territory )

Definition at line 21 of file States_TackleAI.inc.c.

21 {
22 Enemy* enemy = script->owner1.enemy;
23 Npc* npc = get_npc_unsafe(enemy->npcID);
24
25 if ((npc->duration <= 0) || (--npc->duration <= 0)) {
26 if (npc->turnAroundYawAdjustment == 0) {
28 npc->moveSpeed = aiSettings->chaseSpeed;
29 if ((enemy->varTable[7] == 5) || (enemy->varTable[7] == 0) || (enemy->varTable[7] == 1)) {
30 npc->collisionHeight = enemy->varTable[6] / 2;
31 }
32 npc->duration = (dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->pos.x,
33 gPlayerStatusPtr->pos.z) / npc->moveSpeed) + 0.8;
34 if (npc->duration < enemy->varTable[3]) {
35 npc->duration = enemy->varTable[3];
36 }
37 enemy->varTable[4] = npc->duration;
38 script->functionTemp[0] = 14;
39 }
40 }
41}
@ ENEMY_ANIM_INDEX_MELEE_HIT
Definition enums.h:3435
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by)
Definition 43F0.c:670
f32 chaseSpeed
Definition npc.h:99
s16 collisionHeight
s16 turnAroundYawAdjustment
f32 moveSpeed

◆ UnkNpcAIFunc12()

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

Definition at line 43 of file States_TackleAI.inc.c.

43 {
44 Enemy* enemy = script->owner1.enemy;
45 Npc* npc = get_npc_unsafe(enemy->npcID);
46 s32 temp;
47 f32 f1;
48 f32 f2;
49 f32 f3;
50
51 if (npc->duration == enemy->varTable[4] - 1) {
52 enemy->unk_10.x = npc->pos.x;
53 enemy->unk_10.y = npc->pos.y;
54 enemy->unk_10.z = npc->pos.z;
55 enemy->hitboxIsActive = TRUE;
56 }
57
58 f1 = npc->pos.x;
59 f2 = npc->pos.y;
60 f3 = npc->pos.z;
61
63 if (temp == 0) {
64 npc_move_heading(npc, npc->moveSpeed, npc->yaw);
65 }
66
67 if ((npc->duration <= 0) || (--npc->duration <= 0) || (temp != 0)) {
68 enemy->hitboxIsActive = FALSE;
69 npc->curAnim = enemy->animList[10];
70 npc->duration = 0;
71 script->functionTemp[0] = 15;
72 }
73}
b32 npc_test_move_simple_with_slipping(s32, f32 *, f32 *, f32 *, f32, f32, f32, f32)
Vec3s unk_10
Definition npc.h:302
s8 hitboxIsActive
Definition npc.h:299
void npc_move_heading(Npc *npc, f32 speed, f32 yaw)
Definition npc.c:986
s16 collisionDiameter
s32 collisionChannel

◆ set_script_owner_npc_col_height()

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

Definition at line 75 of file States_TackleAI.inc.c.

76 {
77 Enemy* enemy = script->owner1.enemy;
78 Npc* npc = get_npc_unsafe(enemy->npcID);
79
80 npc->duration++;
81 if (npc->duration == 3) {
82 npc->collisionHeight = enemy->varTable[6];
83 }
84
85 if (npc->duration < enemy->varTable[5]) {
86 return;
87 }
88
89 npc->collisionHeight = enemy->varTable[6];
90 script->functionTemp[0] = 0;
91}