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

voidset_script_owner_npc_anim (Evt *script, MobileAISettings *aiSettings, EnemyDetectVolume *territory)
 
ApiStatusUnkDistFunc (Evt *script, MobileAISettings *aiSettings, EnemyDetectVolume *territory)
 
voidUnkNpcAIFunc12 (Evt *script, MobileAISettings *aiSettings, EnemyDetectVolume *territory)
 
voidset_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}
BSS s32 PopupMenu_SelectedIndex
#define atan2
@ ENEMY_ANIM_INDEX_MELEE_PRE
Definition enums.h:3468
s16 npcID
Definition npc.h:300
s32 * animList
Definition npc.h:341
Npc * get_npc_unsafe(s32 npcID)
Definition npc.c:992
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 return ApiStatus_BLOCK;
41}
@ ENEMY_ANIM_INDEX_MELEE_HIT
Definition enums.h:3469
#define ApiStatus_BLOCK
Definition evt.h:117
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by)
Definition 43F0.c:670
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:983
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}