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::@10 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:994
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 20 of file States_TackleAI.inc.c.

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

42 {
43 Enemy* enemy = script->owner1.enemy;
44 Npc* npc = get_npc_unsafe(enemy->npcID);
45 s32 temp;
46 f32 f1;
47 f32 f2;
48 f32 f3;
49
50 if (npc->duration == enemy->varTable[4] - 1) {
51 enemy->unk_10.x = npc->pos.x;
52 enemy->unk_10.y = npc->pos.y;
53 enemy->unk_10.z = npc->pos.z;
54 enemy->hitboxIsActive = TRUE;
55 }
56
57 f1 = npc->pos.x;
58 f2 = npc->pos.y;
59 f3 = npc->pos.z;
60
62 if (temp == 0) {
63 npc_move_heading(npc, npc->moveSpeed, npc->yaw);
64 }
65
66 if ((npc->duration <= 0) || (--npc->duration <= 0) || (temp != 0)) {
67 enemy->hitboxIsActive = FALSE;
68 npc->curAnim = enemy->animList[10];
69 npc->duration = 0;
70 script->functionTemp[0] = 15;
71 }
72}
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:985
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 74 of file States_TackleAI.inc.c.

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