Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
States_TackleAI.inc.c
Go to the documentation of this file.
1#ifndef _AI_TACKLE_STATES_INC_
2#define _AI_TACKLE_STATES_INC_ 0
3
4#include "common.h"
5#include "npc.h"
6
7// used with KoopaPatrolAI, TackleAI, SpinyAI
8// all functions only used here
9
10void N(set_script_owner_npc_anim)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume* territory) {
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}
19
20
21ApiStatus N(UnkDistFunc)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume* territory) {
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}
42
43void N(UnkNpcAIFunc12)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume* territory) {
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}
74
76 EnemyDetectVolume* territory) {
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}
92
93#endif
void N UnkNpcAIFunc12(Evt *script, MobileAISettings *aiSettings, EnemyDetectVolume *territory)
ApiStatus N UnkDistFunc(Evt *script, MobileAISettings *aiSettings, EnemyDetectVolume *territory)
void N set_script_owner_npc_col_height(Evt *script, MobileAISettings *aiSettings, EnemyDetectVolume *territory)
void N set_script_owner_npc_anim(Evt *script, MobileAISettings *aiSettings, EnemyDetectVolume *territory)
#define atan2
@ ENEMY_ANIM_INDEX_MELEE_PRE
Definition enums.h:3434
@ ENEMY_ANIM_INDEX_MELEE_HIT
Definition enums.h:3435
s32 ApiStatus
Definition evt.h:115
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by)
Definition 43F0.c:670
b32 npc_test_move_simple_with_slipping(s32, f32 *, f32 *, f32 *, f32, f32, f32, f32)
s16 npcID
Definition npc.h:300
s32 * animList
Definition npc.h:341
Npc * get_npc_unsafe(s32 npcID)
Definition npc.c:995
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
Definition npc.h:294
s16 collisionDiameter
AnimID curAnim
s32 collisionChannel
s16 collisionHeight
s16 turnAroundYawAdjustment
Vec3f pos
f32 moveSpeed
s16 duration
PlayerStatus * gPlayerStatusPtr