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

Go to the source code of this file.

Functions

s32 count_targets (Actor *actor, s32 targetHomeIndex, s32 targetSelectionFlags)
 
s32 get_nearest_home_index (f32 x, f32 y, f32 z)
 
void set_goal_pos_to_part (ActorState *state, s32 actorID, s32 partID)
 
void set_part_goal_to_actor_part (ActorPartMovement *movement, s32 actorID, s32 partID)
 
void set_actor_current_position (s32 actorID, f32 x, f32 y, f32 z)
 
void set_part_absolute_position (s32 actorID, s32 partID, f32 x, f32 y, f32 z)
 
void set_actor_home_position (s32 actorID, f32 x, f32 y, f32 z)
 
Actorget_actor (s32 actorID)
 

Variables

s32 IsGroupHeal
 
s8 ApplyingBuff
 

Function Documentation

◆ count_targets()

s32 count_targets ( Actor * actor,
s32 targetHomeIndex,
s32 targetSelectionFlags )

Definition at line 8 of file actor_api.c.

8 {
9 BattleStatus* battleStatus = &gBattleStatus;
10
11 battleStatus->sampleTargetHomeIndex = targetHomeIndex;
12 battleStatus->curTargetListFlags = targetSelectionFlags;
14 return actor->targetListLength;
15}
s8 targetListLength
void create_current_pos_target_list(Actor *actor)
Definition 190B20.c:472
BattleStatus gBattleStatus
Definition battle.c:11

◆ get_nearest_home_index()

s32 get_nearest_home_index ( f32 x,
f32 y,
f32 z )

Definition at line 17 of file actor_api.c.

17 {
18 s32 row;
19 s32 col;
20
21 if (y < 40.0f) {
22 row = 0;
23 } else if (y < 85.0f) {
24 row = 1;
25 } else if (y < 100.0f) {
26 row = 2;
27 } else {
28 row = 3;
29 }
30
31 if (x < 25.0f) {
32 col = 0;
33 } else if (x < 65.0f) {
34 col = 1;
35 } else if (x < 105.0f) {
36 col = 2;
37 } else {
38 col = 3;
39 }
40
41 return col | (row << 2);
42}

◆ set_goal_pos_to_part()

void set_goal_pos_to_part ( ActorState * state,
s32 actorID,
s32 partID )

Definition at line 44 of file actor_api.c.

44 {
45 s32 actorClass = actorID & ACTOR_CLASS_MASK;
46 Actor* actor = get_actor(actorID);
47 ActorPart* part;
48
49 switch (actorClass) {
51 part = get_actor_part(actor, 0);
52 state->goalPos.x = actor->curPos.x + part->partOffset.x * actor->scalingFactor;
53 state->goalPos.y = actor->curPos.y + part->partOffset.y * actor->scalingFactor;
54 state->goalPos.z = actor->curPos.z + 10.0f;
55 if (actor->stoneStatus == STATUS_KEY_STONE) {
56 state->goalPos.y -= actor->scalingFactor * 5.0f;
57 }
58 break;
61 part = get_actor_part(actor, partID);
63 state->goalPos.x = actor->curPos.x + (part->partOffset.x + part->targetOffset.x) * actor->scalingFactor;
64 if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
65 state->goalPos.y = actor->curPos.y + (part->partOffset.y + part->targetOffset.y) * actor->scalingFactor;
66 } else {
67 state->goalPos.y = actor->curPos.y + (-part->partOffset.y - part->targetOffset.y) * actor->scalingFactor;
68 }
69 state->goalPos.z = actor->curPos.z + part->partOffset.z + 10.0f;
70 } else {
71 state->goalPos.x = part->absolutePos.x + part->targetOffset.x;
72 if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
73 state->goalPos.y = part->absolutePos.y + part->targetOffset.y * actor->scalingFactor;
74 } else {
75 state->goalPos.y = part->absolutePos.y - part->targetOffset.y * actor->scalingFactor;
76 }
77 state->goalPos.z = part->absolutePos.z + 10.0f;
78 }
79 break;
80 }
81}
Actor * get_actor(s32 actorID)
Definition actor_api.c:155
f32 scalingFactor
Vec3f curPos
@ ACTOR_CLASS_ENEMY
Definition enums.h:2079
@ ACTOR_CLASS_PLAYER
Definition enums.h:2077
@ ACTOR_CLASS_PARTNER
Definition enums.h:2078
@ ACTOR_CLASS_MASK
Definition enums.h:2080
@ STATUS_KEY_STONE
Definition enums.h:2208
@ ACTOR_FLAG_UPSIDE_DOWN
HP bar offset below actor (e.g. Swooper when upside-down).
Definition enums.h:3331
@ ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION
Definition enums.h:3361
ActorPart * get_actor_part(Actor *actor, s32 partID)
Definition 190B20.c:1191

Referenced by dispatch_damage_event_partner(), and dispatch_damage_event_player().

◆ set_part_goal_to_actor_part()

void set_part_goal_to_actor_part ( ActorPartMovement * movement,
s32 actorID,
s32 partID )

Definition at line 83 of file actor_api.c.

83 {
84 s32 actorClass = actorID & ACTOR_CLASS_MASK;
85 Actor* actor = get_actor(actorID);
86 ActorPart* part;
87
88 switch (actorClass) {
90 part = get_actor_part(actor, 0);
91 part->movement->goalPos.x = actor->curPos.x + part->partOffset.x * actor->scalingFactor;
92 part->movement->goalPos.y = actor->curPos.y + part->partOffset.y * actor->scalingFactor;
93 part->movement->goalPos.z = actor->curPos.z;
94 break;
97 part = get_actor_part(actor, partID);
99 part->movement->goalPos.x = actor->curPos.x + (part->partOffset.x + part->targetOffset.x) * actor->scalingFactor;
100 if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
101 part->movement->goalPos.y = actor->curPos.y + (part->partOffset.y + part->targetOffset.y) * actor->scalingFactor;
102 } else {
103 part->movement->goalPos.y = actor->curPos.y + (-part->partOffset.y - part->targetOffset.y) * actor->scalingFactor;
104 }
105 part->movement->goalPos.z = actor->curPos.z + part->partOffset.z;
106 } else {
107 part->movement->goalPos.x = part->absolutePos.x + part->targetOffset.x;
108 if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
109 part->movement->goalPos.y = part->absolutePos.y + part->targetOffset.y * actor->scalingFactor;
110 } else {
111 part->movement->goalPos.y = part->absolutePos.y - part->targetOffset.y * actor->scalingFactor;
112 }
113 part->movement->goalPos.z = part->absolutePos.z;
114 }
115 break;
116 }
117}
struct ActorPartMovement * movement

◆ set_actor_current_position()

void set_actor_current_position ( s32 actorID,
f32 x,
f32 y,
f32 z )

Definition at line 119 of file actor_api.c.

119 {
120 Actor* actor = get_actor(actorID);
121
122 actor->curPos.x = x;
123 actor->curPos.y = y;
124 actor->curPos.z = z;
125}

◆ set_part_absolute_position()

void set_part_absolute_position ( s32 actorID,
s32 partID,
f32 x,
f32 y,
f32 z )

Definition at line 127 of file actor_api.c.

127 {
128 Actor* actor = get_actor(actorID);
129 ActorPart* actorPart;
130
131 switch (actorID & ACTOR_CLASS_MASK) {
133 actor->curPos.x = x;
134 actor->curPos.y = y;
135 actor->curPos.z = z;
136 break;
139 actorPart = get_actor_part(actor, partID);
140 actorPart->absolutePos.x = x;
141 actorPart->absolutePos.y = y;
142 actorPart->absolutePos.z = z;
143 break;
144 }
145}

◆ set_actor_home_position()

void set_actor_home_position ( s32 actorID,
f32 x,
f32 y,
f32 z )

Definition at line 147 of file actor_api.c.

147 {
148 Actor* actor = get_actor(actorID);
149
150 actor->homePos.x = x;
151 actor->homePos.y = y;
152 actor->homePos.z = z;
153}
Vec3f homePos

◆ get_actor()

Actor * get_actor ( s32 actorID)

Definition at line 155 of file actor_api.c.

155 {
156 Actor* ret = NULL;
157 BattleStatus* battleStatus = &gBattleStatus;
158 s32 actorClass = actorID & ACTOR_CLASS_MASK;
159 u32 idIdx = (u8)actorID;
160
161 switch (actorClass) {
163 ret = battleStatus->playerActor;
164 break;
166 ret = battleStatus->partnerActor;
167 break;
169 ret = battleStatus->enemyActors[idIdx];
170 break;
171 }
172 return ret;
173}
struct Actor * partnerActor
struct Actor * playerActor
struct Actor * enemyActors[24]

Referenced by btl_state_draw_select_target(), btl_state_update_first_strike(), btl_state_update_next_enemy(), btl_state_update_partner_striking_first(), btl_state_update_select_target(), calc_enemy_damage_target(), calc_enemy_test_target(), calc_item_check_hit(), calc_item_damage_enemy(), calc_partner_damage_enemy(), calc_partner_test_enemy(), calc_player_damage_enemy(), calc_player_test_enemy(), clear_part_flag_bits(), create_part_shadow(), create_target_list(), get_cam_subject_properties(), remove_part_shadow(), set_actor_anim(), set_actor_anim_rate(), set_actor_current_position(), set_actor_home_position(), set_actor_yaw(), set_goal_pos_to_part(), set_part_absolute_position(), set_part_flag_bits(), set_part_goal_to_actor_part(), and set_part_yaw().

Variable Documentation

◆ IsGroupHeal

s32 IsGroupHeal
extern

Definition at line 85 of file action_cmd.c.

◆ ApplyingBuff

s8 ApplyingBuff
extern

Definition at line 86 of file action_cmd.c.