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

Go to the source code of this file.

Macros

#define CHECK_DEFENSE(element)
 

Functions

s32 get_npc_anim_for_status (AnimID *, s32)
 
void create_target_list (Actor *actor, b32 targetHomePos)
 
void set_actor_pal_adjustment (Actor *actor, s32 palAdjust)
 
void create_current_pos_target_list (Actor *actor)
 
void create_home_target_list (Actor *actor)
 
s32 func_80263064 (Actor *actor, Actor *targetActor, b32 unused)
 
s32 func_80263230 (Actor *actor, Actor *targetActor)
 
s32 func_8026324C (Actor *actor, Actor *targetActor)
 
void btl_check_can_change_partner (void)
 
void btl_init_menu_items (void)
 
s32 btl_are_all_enemies_defeated (void)
 
s32 btl_check_enemies_defeated (void)
 
s32 btl_check_player_defeated (void)
 
s32 count_power_plus (s32 damageType)
 
void deduct_current_move_fp (void)
 
void reset_actor_turn_info (void)
 
void set_actor_anim (s32 actorID, s32 partID, AnimID animID)
 
void set_actor_anim_by_ref (Actor *actor, ActorPart *part, AnimID anim)
 
void set_actor_anim_rate (s32 actorID, s32 partID, f32 rate)
 
void set_actor_yaw (s32 actorID, s32 yaw)
 
void set_part_yaw (s32 actorID, s32 partID, s32 value)
 
void set_part_flag_bits (s32 actorID, s32 partID, s32 flags)
 
void clear_part_flag_bits (s32 actorID, s32 partID, s32 flags)
 
void add_xz_vec3f (Vec3f *vector, f32 speed, f32 angleDeg)
 
void add_xz_vec3f_copy1 (Vec3f *vector, f32 speed, f32 angleDeg)
 
void add_xz_vec3f_copy2 (Vec3f *vector, f32 speed, f32 angleDeg)
 
void play_movement_dust_effects (s32 var0, f32 xPos, f32 yPos, f32 zPos, f32 angleDeg)
 
ActorPartget_actor_part (Actor *actor, s32 partID)
 
void load_player_actor (void)
 
void load_partner_actor (void)
 
Actorcreate_actor (Formation formation)
 
s32 get_player_anim_for_status (s32 statusKey)
 
s32 lookup_defense (s32 *defenseTable, s32 elementKey)
 
s32 lookup_status_chance (s32 *statusTable, s32 statusKey)
 
s32 lookup_status_duration_mod (s32 *statusTable, s32 statusKey)
 
s32 inflict_status (Actor *target, s32 statusTypeKey, s32 duration)
 
s32 inflict_partner_ko (Actor *target, s32 statusTypeKey, s32 duration)
 
s32 get_defense (Actor *actor, s32 *defenseTable, s32 elementFlags)
 
void show_primary_damage_popup (f32 posX, f32 posY, f32 posZ, s32 damageAmt, b32 angle)
 
void show_next_damage_popup (f32 posX, f32 posY, f32 posZ, s32 damageAmt, b32 angle)
 
void update_damage_popups (void)
 
void show_damage_fx (Actor *actor, f32 x, f32 y, f32 z, s32 damage)
 
void show_action_rating (s32 rating, Actor *actor, f32 x, f32 y, f32 z)
 
void cancel_action_rating_combo (Actor *target)
 
void update_action_ratings (void)
 
void show_actor_health_bar (Actor *target)
 
void hide_actor_health_bar (Actor *target)
 
void update_health_bars (void)
 
s32 try_inflict_status (Actor *actor, s32 statusTypeKey, s32 statusTurnsKey)
 
s32 inflict_status_set_duration (Actor *actor, s32 statusTypeKey, s32 statusDurationKey, s32 duration)
 
void set_part_pal_adjustment (ActorPart *part, s32 palAdjust)
 
void clear_part_pal_adjustment (ActorPart *part)
 
void clear_actor_static_pal_adjustments (Actor *actor)
 
void set_part_glow_pal (ActorPart *part, s32 glowState)
 
void set_actor_glow_pal (Actor *actor, s32 glowState)
 
void clear_part_glow_pal (ActorPart *part)
 
void clear_actor_glow_pal (Actor *actor)
 
void set_part_flash_mode (ActorPart *part, s32 flashState)
 
void set_actor_flash_mode (Actor *actor, s32 flashState)
 
void clear_part_flash_mode (ActorPart *part)
 
void clear_actor_flash_mode (Actor *actor)
 
void add_part_decoration (ActorPart *part, s32 decorationIndex, s32 decorationType)
 
void add_actor_decoration (Actor *actor, s32 decorationIndex, s32 decorationType)
 
void remove_part_decoration (ActorPart *part, s32 decorationIndex)
 
void remove_actor_decoration (Actor *actor, s32 decorationIndex)
 
s32 player_team_is_ability_active (Actor *actor, s32 ability)
 
void create_part_shadow (s32 actorID, s32 partID)
 
void remove_part_shadow (s32 actorID, s32 partID)
 
void create_part_shadow_by_ref (UNK_TYPE arg0, ActorPart *part)
 
void remove_player_buffs (s32 buffs)
 
void btl_update_ko_status (void)
 
void btl_appendGfx_prim_quad (u8 r, u8 g, u8 b, u8 a, u16 left, u16 top, u16 right, u16 bottom)
 
void btl_draw_prim_quad (u8 r, u8 g, u8 b, u8 a, u16 left, u16 top, u16 arg6, u16 arg7)
 
void reset_all_actor_sounds (Actor *actor)
 
void hide_foreground_models_unchecked (void)
 
void show_foreground_models_unchecked (void)
 
void hide_foreground_models (void)
 
void show_foreground_models (void)
 
void start_rumble_type (u32 type)
 

Variables

f32 D_802938A4 = 0.0f
 
s16 D_802938A8 = 4
 
EffectInstancegDamageCountEffects []
 
s32 gDamageCountTimers []
 
Gfx D_80293970 []
 
s32 bCurRumbleScript = 0
 
s32 bMarioDefenseTable []
 
s32 bPlayerStatusTable []
 
ActorBlueprint bPlayerActorBlueprint
 
ActorPartBlueprint bMarioParts []
 
PartnerDMAData bPartnerDmaTable []
 
EvtScript EVS_BattleRumble_Long
 
EvtScript EVS_BattleRumble_HitMin
 
EvtScript EVS_BattleRumble_HitLight
 
EvtScript EVS_BattleRumble_HitHeavy
 
EvtScript EVS_BattleRumble_HitExtreme
 
EvtScript EVS_BattleRumble_HitMax
 
EvtScript EVS_BattleRumble_PlayerMin
 
EvtScript EVS_BattleRumble_PlayerLight
 
EvtScript EVS_BattleRumble_PlayerHeavy
 
EvtScript EVS_BattleRumble_PlayerExtreme
 
EvtScript EVS_BattleRumble_PlayerMax
 

Macro Definition Documentation

◆ CHECK_DEFENSE

#define CHECK_DEFENSE ( element)
Value:
} \
} \
s32 lookup_defense(s32 *defenseTable, s32 elementKey)
Definition 190B20.c:1757
BSS s32 PopupMenu_SelectedIndex

Function Documentation

◆ get_npc_anim_for_status()

s32 get_npc_anim_for_status ( AnimID * animations,
s32 statusKey )

Definition at line 1674 of file 190B20.c.

1674 {
1676
1677 if (animations == nullptr) {
1678 return 0;
1679 }
1680
1681 foundAnim = 0;
1682 while (animations[DICTIONARY_KEY] != nullptr) {
1683 if (animations[DICTIONARY_KEY] == STATUS_KEY_NORMAL) {
1684 foundAnim = animations[DICTIONARY_VALUE];
1685 }
1686 if (animations[DICTIONARY_KEY] == statusKey) {
1687 foundAnim = animations[DICTIONARY_VALUE];
1688 break;
1689 }
1690 animations += DICTIONARY_SIZE;
1691 }
1692 return foundAnim;
1693}
u32 AnimID
@ STATUS_KEY_NORMAL
Definition enums.h:2802
@ DICTIONARY_KEY
Definition enums.h:4819
@ DICTIONARY_SIZE
Definition enums.h:4821
@ DICTIONARY_VALUE
Definition enums.h:4820

Referenced by appendGfx_npc_actor(), create_actor(), load_partner_actor(), and load_player_actor().

◆ create_target_list()

void create_target_list ( Actor * actor,
b32 targetHomePos )

Definition at line 56 of file 190B20.c.

56 {
57 s32 numTargets = 0;
60 Actor* playerActor = battleStatus->playerActor;
61 Actor* partnerActor = battleStatus->partnerActor;
66 s8* targetIndexList;
67 s32 numParts;
68 s32 i, j;
69 f32 targetX, targetY, targetZ;
70 f32 f2, f12, f14;
73 s32 hiddenByDarkness = false;
77
78 // a target has been manually selected
79 if (battleStatus->curTargetListFlags & TARGET_FLAG_OVERRIDE) {
80 actor->targetListLength = -1;
81 return;
82 }
83
84 // ------------------------------------------------------------------------
85 // build a list of all possible targets from the appropriate actor classes
86
87 // try adding the player
88 if (battleStatus->curTargetListFlags & TARGET_FLAG_PLAYER) {
90 targetDataList->partID = 1;
91 if (!targetHomePos) {
92 targetDataList->truePos.x = playerActor->curPos.x + playerActor->size.x * 0.3 * playerActor->scalingFactor;
93 targetDataList->truePos.y = playerActor->curPos.y + playerActor->size.y * 0.9 * playerActor->scalingFactor;
94 targetDataList->truePos.z = playerActor->curPos.z;
95 } else {
96 targetDataList->truePos.x = playerActor->homePos.x + playerActor->size.x * 0.3 * playerActor->scalingFactor;
97 targetDataList->truePos.y = playerActor->homePos.y + playerActor->size.y * 0.9 * playerActor->scalingFactor;
98 targetDataList->truePos.z = playerActor->homePos.z;
99 }
100 targetDataList->priorityOffset = -100;
101 numTargets++;
103 }
104
105 // try adding the partner
106 if (battleStatus->curTargetListFlags & TARGET_FLAG_PARTNER) {
107 if (partnerActor != nullptr) {
108 targetDataList->actorID = ACTOR_PARTNER;
109 targetDataList->partID = 1;
110 if (!targetHomePos) {
111 targetDataList->truePos.x = partnerActor->curPos.x + partnerActor->size.x * 0.1 * partnerActor->scalingFactor;
112 targetDataList->truePos.y = partnerActor->curPos.y + partnerActor->size.y * 0.8 * partnerActor->scalingFactor;
113 targetDataList->truePos.z = partnerActor->curPos.z;
114 } else {
115 targetDataList->truePos.x = partnerActor->homePos.x + partnerActor->size.x * 0.1 * partnerActor->scalingFactor;
116 targetDataList->truePos.y = partnerActor->homePos.y + partnerActor->size.y * 0.8 * partnerActor->scalingFactor;
117 targetDataList->truePos.z = partnerActor->homePos.z;
118 }
119 targetDataList->priorityOffset = -50;
120 numTargets++;
122 }
123 }
124
125 // try adding enemies
126 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
127 targetActor = battleStatus->enemyActors[i];
128 if (targetActor == nullptr) {
129 continue;
130 }
131 if ((battleStatus->curTargetListFlags & TARGET_FLAG_PARTNER) || (battleStatus->curTargetListFlags & TARGET_FLAG_PLAYER)) {
132 // skip adding enemies if either player or partner targeting is set
133 break;
134 }
135 // check each part of the current enemy
136 targetPart = targetActor->partsTable;
137 numParts = targetActor->numParts;
138 for (j = 0; j < numParts; targetPart = targetPart->nextPart, j++) {
139 if (!(targetPart->flags & ACTOR_PART_FLAG_NO_TARGET)) {
141
143 sampleRow = !targetHomePos; // required to match
144 if (sampleRow) {
145 targetX = targetActor->curPos.x;
146 targetY = targetActor->curPos.y;
147 targetZ = targetActor->curPos.z;
148 } else {
149 targetX = targetActor->homePos.x;
150 targetY = targetActor->homePos.y;
151 targetZ = targetActor->homePos.z;
152 }
153 targetX += targetPart->partOffset.x * targetActor->scalingFactor;
154 if (!(targetActor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
155 targetY += targetPart->partOffset.y * targetActor->scalingFactor;
156 }
157 targetZ += targetPart->partOffset.z * targetActor->scalingFactor;
158 f12 = targetX;
159 targetX = targetActor->scalingFactor;
160 targetX = f12 + targetPart->targetOffset.x * targetX;
161 f2 = targetY;
162 f14 = targetZ + 5.0f;
163 if (!(targetActor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
164 targetY = f2 + targetPart->targetOffset.y * targetActor->scalingFactor;
165 }
166 } else {
167 targetY = targetPart->absolutePos.y;
168 targetZ = targetPart->absolutePos.z;
169 f12 = targetPart->absolutePos.x;
170 f2 = targetY;
171 f14 = targetZ + 5.0f;
172 targetX = f12 + targetPart->targetOffset.x;
173 if (!(targetActor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
174 targetY = f2 + targetPart->targetOffset.y;
175 }
176 }
177
178 targetDataList->actorID = ACTOR_CLASS_ENEMY | i;
179 targetDataList->partID = partBlueprint->index;
180 targetDataList->truePos.x = targetX;
181 targetDataList->truePos.y = targetY;
182 targetDataList->truePos.z = targetZ;
183 targetDataList->priorityOffset = 0;
184
186 targetDataList->priorityOffset = 100;
187 }
188 targetDataList->priorityOffset += targetPart->targetPriorityOffset;
189 targetDataList->sortPos.x = f12 + targetDataList->priorityOffset * 100;
190 targetDataList->sortPos.y = f2;
191 targetDataList->sortPos.z = f14;
192
193 // determine nearest target row
194 if (targetDataList->sortPos.y < 40) {
195 targetDataList->row = 0;
196 } else if (targetDataList->sortPos.y < 85) {
197 targetDataList->row = 1;
198 } else if (targetDataList->sortPos.y < 100) {
199 targetDataList->row = 2;
200 } else {
201 targetDataList->row = 3;
202 }
203
204 // determine nearest target column
205 if (targetDataList->sortPos.x < 25) {
206 targetDataList->column = 0;
207 } else if (targetDataList->sortPos.x < 65) {
208 targetDataList->column = 1;
209 } else if (targetDataList->sortPos.x < 105) {
210 targetDataList->column = 2;
211 } else {
212 targetDataList->column = 3;
213 }
214
215 // determine nearest target layer
216 if (targetDataList->sortPos.z < -30) {
217 targetDataList->layer = 0;
218 } else {
219 targetDataList->layer = 1;
220 }
221
222 numTargets++;
224 }
225 }
226 }
227
228 // ------------------------------------------------------------------------
229 // remove targets based on simple criteria (coarse pass)
230
231 actor->selectedTargetIndex = 0;
233
234 sampleCol = battleStatus->sampleTargetHomeIndex % 4;
235 sampleRow = battleStatus->sampleTargetHomeIndex / 4;
236
237 targetDataList = actor->targetData;
239
240 // remove targets, first pass
241 for (i = 0; i < numTargets; i++) {
243 targetActor = get_actor(target->actorID);
245
246 // always keep player and partner actors
247 if (target->actorID == ACTOR_PLAYER || target->actorID == ACTOR_PARTNER) {
248 continue;
249 }
250
251 // sanity check condition -- function should never reach this point with this flag set
252 if (battleStatus->curTargetListFlags & TARGET_FLAG_OVERRIDE) {
253 removeTarget = true;
255 }
256
257 // skip any target if the battle is dark
258 if (!(gBattleStatus.flags2 & BS_FLAGS2_IGNORE_DARKNESS) && battleStatus->darknessMode > 0) {
260 if (overlayZoom >= 215.0f) {
261 removeTarget = true;
262 hiddenByDarkness = true;
264 }
265 }
266
267 // skip targets not designated as the primary target for this actor
268 if (battleStatus->curTargetListFlags & TARGET_FLAG_PRIMARY_ONLY) {
272 ) {
273 removeTarget = true;
275 }
276 }
277
278 // target passed all checks, do not remove
279 removeTarget = false;
280
282 if (removeTarget) {
283 for (j = i; j < numTargets - 1; j++) {
284 actor->targetData[j] = actor->targetData[j + 1];
285 }
286 numTargets--;
287 i--;
288 }
289 }
290
291 // ------------------------------------------------------------------------
292 // remove targets based on target flag criteria (fine pass)
293
294 for (i = 0; i < numTargets; i++) {
296 targetActor = get_actor(target->actorID);
298
299 // always keep player and partner actors
300 if (target->actorID == ACTOR_PLAYER || target->actorID == ACTOR_PARTNER) {
301 continue;
302 }
303 if ((battleStatus->curTargetListFlags & TARGET_FLAG_JUMP_LIKE) && (targetPart->targetFlags & ACTOR_PART_TARGET_NO_JUMP)) {
304 removeTarget = true;
306 }
307 if ((battleStatus->curTargetListFlags & TARGET_FLAG_SMASH_LIKE) && (targetPart->targetFlags & ACTOR_PART_TARGET_NO_SMASH)) {
308 removeTarget = true;
310 }
311 if ((battleStatus->curTargetListFlags & TARGET_FLAG_TATTLE) && ((targetActor->flags & ACTOR_FLAG_NO_TATTLE) || (targetPart->flags & ACTOR_PART_FLAG_NO_TATTLE))) {
312 removeTarget = true;
314 }
315 if ((battleStatus->curTargetListFlags & TARGET_FLAG_AIRLIFT) && (targetActor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
316 removeTarget = true;
318 }
319 if (!(battleStatus->curTargetListFlags & TARGET_FLAG_ALLOW_TARGET_ONLY) && (targetActor->flags & ACTOR_FLAG_TARGET_ONLY)) {
320 removeTarget = true;
322 }
323 if ((battleStatus->curTargetListFlags & TARGET_FLAG_NO_CEILING) && (targetActor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
324 removeTarget = true;
326 }
327 if ((battleStatus->curTargetListFlags & TARGET_FLAG_GROUND) && target->row != 0) {
328 removeTarget = true;
330 }
331 if ((battleStatus->curTargetListFlags & TARGET_FLAG_NOT_HIGH) && target->row >= 2) {
332 removeTarget = true;
334 }
335 if ((battleStatus->curTargetListFlags & TARGET_FLAG_NOT_GROUND) && target->row <= 0) {
336 removeTarget = true;
338 }
339
340 if ((battleStatus->curTargetListFlags & TARGET_FLAG_NOT_BELOW)
342 ) {
343 // search the target list for any targets below the current target (same column, higher row)
344 // skip the current target if any are found
345 s32 foundAbove = false;
346
347 for (j = 0; j < numTargets; j++) {
349 if (target != otherTarget) {
350 if (target->layer == otherTarget->layer
351 && target->column == otherTarget->column
352 && target->row < otherTarget->row
353 ) {
354 foundAbove = true;
355 break;
356 }
357 }
358 }
359
360 if (foundAbove) {
361 removeTarget = true;
363 }
364 }
365
366 if (battleStatus->curTargetListFlags & TARGET_FLAG_NOT_BEHIND) {
367 // search the target list for any targets in front of the current target (same row, lower column)
368 // skip the current target if any are found
369 s32 foundInFront = false;
370
371 for (j = 0; j < numTargets; j++) {
373 if (target != otherTarget) {
374 if (target->layer == otherTarget->layer
375 && target->row == otherTarget->row
376 && target->column > otherTarget->column
377 ) {
378 foundInFront = true;
379 break;
380 }
381 }
382 }
383
384 if (foundInFront) {
385 removeTarget = true;
387 }
388 }
389
390 if ((battleStatus->curTargetListFlags & TARGET_FLAG_NOT_FLYING) && (targetActor->flags & ACTOR_FLAG_FLYING)) {
391 removeTarget = true;
393 }
394 if ((battleStatus->curTargetListFlags & TARGET_FLAG_DIR_RIGHT) && target->row == sampleRow + 1) {
395 removeTarget = true;
397 }
398 if ((battleStatus->curTargetListFlags & TARGET_FLAG_DIR_LEFT) && target->row == sampleRow - 1) {
399 removeTarget = true;
401 }
402 if ((battleStatus->curTargetListFlags & TARGET_FLAG_DIR_BELOW) && target->column == sampleCol - 1) {
403 removeTarget = true;
405 }
406 if ((battleStatus->curTargetListFlags & TARGET_FLAG_DIR_ABOVE) && target->column == sampleCol + 1) {
407 removeTarget = true;
409 }
410 if ((battleStatus->curTargetListFlags & TARGET_FLAG_DIR_RIGHT) && target->row < sampleRow) {
411 removeTarget = true;
413 }
414 if ((battleStatus->curTargetListFlags & TARGET_FLAG_DIR_LEFT) && target->row > sampleRow) {
415 removeTarget = true;
417 }
418 if ((battleStatus->curTargetListFlags & TARGET_FLAG_DIR_BELOW) && target->column > sampleCol) {
419 removeTarget = true;
421 }
422 if ((battleStatus->curTargetListFlags & TARGET_FLAG_DIR_ABOVE) && target->column < sampleCol) {
423 removeTarget = true;
425 }
426
427 // target passed all checks, do not remove
428 removeTarget = false;
429
431 if (removeTarget) {
432 for (j = i; j < numTargets - 1; j++) {
433 actor->targetData[j] = actor->targetData[j + 1];
434 }
435 numTargets--;
436 i--;
437 }
438 }
439
441 if (numTargets == 0 && hiddenByDarkness) {
443 } else {
445 }
446
447 targetDataList = actor->targetData;
448
450 targetIndexList = actor->targetIndexList;
451 for (i = 0; i < numTargets; i++) {
452 targetIndexList[i] = i;
453 }
454
455 // sort targets by priority
456 for (i = 0; i < numTargets - 1; i++) {
457 for (j = i + 1; j < numTargets; j++) {
458 s32 index1 = targetIndexList[i];
459 s32 index2 = targetIndexList[j];
462 if (target->truePos.x + target->priorityOffset * 10 > otherTarget->truePos.x + otherTarget->priorityOffset * 10) {
463 targetIndexList[i] = targetIndexList[j];
464 targetIndexList[j] = index1;
465 }
466 }
467 }
468}
ActorPart * get_actor_part(Actor *actor, s32 partID)
Definition 190B20.c:923
s8 selectedTargetIndex
f32 scalingFactor
struct SelectableTarget targetData[24]
Vec3f homePos
Vec2bu size
Vec3f curPos
s8 targetIndexList[24]
s8 targetListLength
@ ACTOR_CLASS_ENEMY
Definition enums.h:2112
@ SCREEN_LAYER_BACK
Definition enums.h:2369
@ ACTOR_PART_TARGET_NO_SMASH
Definition enums.h:1902
@ ACTOR_PART_TARGET_NO_JUMP
Definition enums.h:1901
@ BS_FLAGS2_NO_TARGET_AVAILABLE
Definition enums.h:3647
@ BS_FLAGS2_IGNORE_DARKNESS
Definition enums.h:3648
@ TARGET_FLAG_SMASH_LIKE
Definition enums.h:1886
@ TARGET_FLAG_OVERRIDE
Definition enums.h:1897
@ TARGET_FLAG_PRIMARY_ONLY
Definition enums.h:1889
@ TARGET_FLAG_TATTLE
Definition enums.h:1891
@ TARGET_FLAG_JUMP_LIKE
Definition enums.h:1885
@ TARGET_FLAG_AIRLIFT
Definition enums.h:1884
@ TARGET_FLAG_NOT_BELOW
Definition enums.h:1888
@ TARGET_FLAG_DIR_RIGHT
Definition enums.h:1893
@ TARGET_FLAG_DIR_LEFT
Definition enums.h:1894
@ TARGET_FLAG_ALLOW_TARGET_ONLY
Definition enums.h:1890
@ TARGET_FLAG_PLAYER
Definition enums.h:1878
@ TARGET_FLAG_NOT_HIGH
Definition enums.h:1879
@ TARGET_FLAG_NOT_FLYING
Definition enums.h:1880
@ TARGET_FLAG_DIR_ABOVE
Definition enums.h:1896
@ TARGET_FLAG_NOT_BEHIND
Definition enums.h:1887
@ TARGET_FLAG_NO_CEILING
Definition enums.h:1892
@ TARGET_FLAG_PARTNER
Definition enums.h:1883
@ TARGET_FLAG_GROUND
Definition enums.h:1877
@ TARGET_FLAG_DIR_BELOW
Definition enums.h:1895
@ TARGET_FLAG_NOT_GROUND
Definition enums.h:1881
@ ACTOR_PLAYER
Definition enums.h:2118
@ ACTOR_PARTNER
Definition enums.h:2119
@ ACTOR_FLAG_FLYING
Quake Hammer can't hit.
Definition enums.h:3363
@ ACTOR_FLAG_MINOR_TARGET
Definition enums.h:3361
@ ACTOR_FLAG_UPSIDE_DOWN
HP bar offset below actor (e.g. Swooper when upside-down).
Definition enums.h:3365
@ ACTOR_FLAG_LOW_PRIORITY_TARGET
Definition enums.h:3360
@ ACTOR_FLAG_NO_TATTLE
Definition enums.h:3362
@ ACTOR_FLAG_TARGET_ONLY
Battle ends even if undefeated. No turn.
Definition enums.h:3368
@ ACTOR_PART_FLAG_PRIMARY_TARGET
Definition enums.h:3396
@ ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION
Definition enums.h:3395
@ ACTOR_PART_FLAG_NO_TATTLE
Definition enums.h:3390
@ ACTOR_PART_FLAG_IGNORE_BELOW_CHECK
Definition enums.h:3388
@ ACTOR_PART_FLAG_NO_TARGET
Cannot be targeted.
Definition enums.h:3394
@ ACTOR_PART_FLAG_MINOR_TARGET
Definition enums.h:3389
Actor * get_actor(s32 actorID)
Definition actor_api.c:155
void get_screen_overlay_params(s32, u8 *type, f32 *zoom)
#define ARRAY_COUNT(arr)
Definition macros.h:39
BattleStatus gBattleStatus
Definition battle.cpp:14

Referenced by create_current_pos_target_list(), and create_home_target_list().

◆ set_actor_pal_adjustment()

void set_actor_pal_adjustment ( Actor * actor,
s32 palAdjust )

Definition at line 2337 of file 190B20.c.

2337 {
2338 for (ActorPart* part = actor->partsTable; part != nullptr; part = part->nextPart) {
2339 if (!(part->flags & ACTOR_PART_FLAG_INVISIBLE)
2340 && (part->idleAnimations != nullptr)
2342 ) {
2344 }
2345 }
2346}
void set_part_pal_adjustment(ActorPart *part, s32 palAdjust)
Definition 190B20.c:2325
struct ActorPart * partsTable
@ ACTOR_PART_FLAG_NO_DECORATIONS
Definition enums.h:3385
@ ACTOR_PART_FLAG_INVISIBLE
Definition enums.h:3384

Referenced by appendGfx_npc_actor(), appendGfx_player_actor(), and inflict_status().

◆ create_current_pos_target_list()

void create_current_pos_target_list ( Actor * actor)

◆ create_home_target_list()

void create_home_target_list ( Actor * actor)

Definition at line 476 of file 190B20.c.

476 {
477 create_target_list(actor, true);
478}

◆ func_80263064()

s32 func_80263064 ( Actor * actor,
Actor * targetActor,
b32 unused )
Bug
part list position is not advanced, all further loop iterations will be stuck here

Definition at line 480 of file 190B20.c.

480 {
481 s32 count = 0;
484 s32 numParts;
486 f32 x, y, z;
487 s32 i;
488
489 if (targetActor == nullptr) {
490 return count;
491 }
492
493 numParts = targetActor->numParts;
494 part = targetActor->partsTable;
495
496 for (i = 0; i < numParts; i++) {
497 if (part->flags & ACTOR_PART_FLAG_NO_TARGET) {
498 part = part->nextPart;
499 continue;
500 }
501
502 if (!(part->flags & ACTOR_PART_FLAG_PRIMARY_TARGET)) {
504 // nanaian: I think this is intended and should probably be a break. this flag makes multi-target attacks select this part only
505 continue;
506 }
507
509
511 x = targetActor->curPos.x;
512 y = targetActor->curPos.y;
513 z = targetActor->curPos.z;
514
515 x += part->partOffset.x;
516 if (!(targetActor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
517 y += part->partOffset.y;
518 } else {
519 y -= part->partOffset.y;
520 }
521 z += part->partOffset.z;
522
523 x += part->targetOffset.x;
524 if (!(targetActor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
525 y += part->targetOffset.y;
526 } else {
527 y -= part->targetOffset.y;
528 }
529 } else {
530 x = part->absolutePos.x;
531 y = part->absolutePos.y;
532 z = part->absolutePos.z;
533
534 x += part->targetOffset.x;
535 if (!(targetActor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
536 y += part->targetOffset.y;
537 } else {
538 y -= part->targetOffset.y;
539 }
540 }
541
542 actor->targetActorID = target->actorID = targetActor->actorID;
543 actor->targetPartID = target->partID = partData->index;
544 target->truePos.x = x;
545 target->truePos.y = y;
546 target->truePos.z = z;
547 target->priorityOffset = 0;
548 target++;
549 count++;
550
551 part = part->nextPart;
552 }
553
554 actor->targetListLength = count;
555 return count;
556}
ActorPartBlueprint * staticData
s16 targetActorID
struct ActorPart * nextPart

Referenced by func_80263230(), and func_8026324C().

◆ func_80263230()

s32 func_80263230 ( Actor * actor,
Actor * targetActor )

Definition at line 558 of file 190B20.c.

558 {
559 return func_80263064(actor, targetActor, false);
560}
s32 func_80263064(Actor *actor, Actor *targetActor, b32 unused)
Definition 190B20.c:480

Referenced by btl_state_update_first_strike(), and dispatch_damage_event_actor().

◆ func_8026324C()

s32 func_8026324C ( Actor * actor,
Actor * targetActor )

Definition at line 562 of file 190B20.c.

562 {
563 return func_80263064(actor, targetActor, true);
564}

◆ btl_check_can_change_partner()

void btl_check_can_change_partner ( void )

Definition at line 566 of file 190B20.c.

566 {
569 Actor* partner = battleStatus->partnerActor;
570
571 battleStatus->changePartnerAllowed = 0;
572 if (partner != nullptr) {
574 s32 i;
575
576 battleStatus->changePartnerAllowed = 1;
577 partnersEnabled = 0;
578
579 for (i = 0; i < ARRAY_COUNT(playerData->partners); i++) {
580 if (playerData->partners[i].enabled) {
582 }
583 }
584
585 if (partnersEnabled >= 2) {
586 if (partner->koStatus == STATUS_KEY_KO) {
587 battleStatus->changePartnerAllowed = 0;
588 } else if (partner->debuff == STATUS_KEY_FROZEN) {
589 battleStatus->changePartnerAllowed = 0;
590 } else if (playerData->curPartner == PARTNER_GOOMPA) {
591 battleStatus->changePartnerAllowed = -1;
592 }
593 } else {
594 battleStatus->changePartnerAllowed = -1;
595 }
596 } else {
597 battleStatus->changePartnerAllowed = -1;
598 }
599}
@ STATUS_KEY_FROZEN
Definition enums.h:2808
@ STATUS_KEY_KO
Definition enums.h:2814
@ PARTNER_GOOMPA
Definition enums.h:2924
PlayerData gPlayerData
Definition 77480.c:39

Referenced by btl_state_update_partner_menu(), and btl_state_update_player_menu().

◆ btl_init_menu_items()

void btl_init_menu_items ( void )

Definition at line 601 of file 190B20.c.

601 {
603 Actor* player = battleStatus->playerActor;
606 s32 i;
607
608 battleStatus->menuStatus[0] = 0;
609 hasValidItem = false;
610
611 for (i = 0; i < ARRAY_COUNT(playerData->invItems); i++) {
612 s16 itemID = playerData->invItems[i];
613
614 if (itemID != ITEM_NONE) {
615 ItemData* itemData = &gItemTable[itemID];
616
617 if (itemData->typeFlags & ITEM_TYPE_FLAG_BATTLE_USABLE) {
618 battleStatus->moveCategory = BTL_MENU_TYPE_ITEMS;
619 battleStatus->moveArgument = playerData->invItems[i];
620 battleStatus->curTargetListFlags = itemData->targetFlags;
622
623 if (player->targetListLength != 0) {
624 battleStatus->menuStatus[0]++;
625 hasValidItem = true;
626 }
627 }
628 }
629 }
630
631 if (!hasValidItem) {
632 battleStatus->menuStatus[0] = 0;
633 }
634}
void create_current_pos_target_list(Actor *actor)
Definition 190B20.c:472
s16 invItems[10]
@ BTL_MENU_TYPE_ITEMS
Definition enums.h:3828
@ ITEM_TYPE_FLAG_BATTLE_USABLE
Definition enums.h:1861
ItemData gItemTable[]

Referenced by btl_state_update_partner_menu(), and btl_state_update_player_menu().

◆ btl_are_all_enemies_defeated()

s32 btl_are_all_enemies_defeated ( void )

Definition at line 636 of file 190B20.c.

636 {
638 Actor* enemy;
639 s32 enemiesStillAlive = false;
640 s32 i;
641
642 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
643 enemy = battleStatus->enemyActors[i];
644 if (enemy != nullptr) {
646 enemiesStillAlive = true;
647 }
648 }
649 }
650 return !enemiesStillAlive;
651}
@ ACTOR_FLAG_NO_DMG_APPLY
Damage is not applied to actor HP.
Definition enums.h:3374

Referenced by btl_check_enemies_defeated(), and btl_state_update_partner_move().

◆ btl_check_enemies_defeated()

◆ btl_check_player_defeated()

◆ count_power_plus()

s32 count_power_plus ( s32 damageType)

Definition at line 671 of file 190B20.c.

671 {
672 s32 count;
673 s32 i;
674
676 return 0;
677 }
678
679 count = 0;
680 for (i = 0; i < ARRAY_COUNT(gPlayerData.equippedBadges); i++) {
682
683 if (gMoveTable[moveID].category == MOVE_TYPE_ATTACK_UP && moveID == MOVE_POWER_PLUS) {
685 count++;
686 }
687 }
688 }
689
690 return count;
691}
s16 equippedBadges[64]
@ PEACH_FLAG_IS_PEACH
Definition enums.h:2474
@ BS_FLAGS1_INCLUDE_POWER_UPS
Definition enums.h:3604
@ MOVE_TYPE_ATTACK_UP
Definition enums.h:4804
@ DAMAGE_TYPE_JUMP
Definition enums.h:2892
GameStatus * gGameStatusPtr
Definition main_loop.c:31
MoveData gMoveTable[]

Referenced by calc_player_damage_enemy().

◆ deduct_current_move_fp()

void deduct_current_move_fp ( void )

Definition at line 693 of file 190B20.c.

693 {
696 Actor* actor = battleStatus->playerActor;
697 s32 fpCost = gMoveTable[battleStatus->selectedMoveID].costFP;
698
699 if (fpCost != 0) {
702 if (fpCost < 1) {
703 fpCost = 1;
704 }
705 }
706
707 playerData->curFP -= fpCost;
708}
s32 player_team_is_ability_active(Actor *actor, s32 ability)
Definition 190B20.c:2495
@ ABILITY_FLOWER_SAVER
Definition enums.h:460
@ ABILITY_FLOWER_FANATIC
Definition enums.h:474

Referenced by btl_state_update_change_partner(), and btl_state_update_partner_move().

◆ reset_actor_turn_info()

void reset_actor_turn_info ( void )

Definition at line 710 of file 190B20.c.

710 {
712 Actor* actor;
713 s32 i;
714
715 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
716 actor = battleStatus->enemyActors[i];
717 if (actor != nullptr) {
718 actor->hpChangeCounter = 0;
719 actor->damageCounter = 0;
720 actor->actionRatingCombo = 0;
721 }
722 }
723
724 actor = battleStatus->playerActor;
725 actor->hpChangeCounter = 0;
726 actor->damageCounter = 0;
727 actor->actionRatingCombo = 0;
728
729 actor = battleStatus->partnerActor;
730 if (actor != nullptr) {
731 actor->hpChangeCounter = 0;
732 actor->damageCounter = 0;
733 actor->actionRatingCombo = 0;
734 }
735}
s8 actionRatingCombo
s16 damageCounter
s16 hpChangeCounter

Referenced by btl_state_update_begin_partner_turn(), btl_state_update_begin_player_turn(), btl_state_update_enemy_move(), btl_state_update_enemy_striking_first(), btl_state_update_first_strike(), btl_state_update_partner_move(), btl_state_update_partner_striking_first(), btl_state_update_player_move(), btl_state_update_switch_to_partner(), btl_state_update_switch_to_player(), and btl_state_update_transfer_turn().

◆ set_actor_anim()

void set_actor_anim ( s32 actorID,
s32 partID,
AnimID animID )

Definition at line 737 of file 190B20.c.

737 {
738 if ((s32) animID >= 0) {
739 Actor* actor = get_actor(actorID);
741
742 switch (actorID & ACTOR_CLASS_MASK) {
744 part = &actor->partsTable[0];
745 if (part->curAnimation != animID) {
746 part->curAnimation = animID;
747 spr_update_player_sprite(PLAYER_SPRITE_MAIN, animID, part->animationRate);
748 }
749 break;
751 if (partID != 0) {
752 part = get_actor_part(actor, partID);
753
754 if (part == nullptr) {
755 part = &actor->partsTable[0];
756 }
757 } else {
758 part = &actor->partsTable[0];
759 }
760
761 if (part->curAnimation != animID) {
762 part->curAnimation = animID;
763 spr_update_sprite(part->spriteInstanceID, animID, part->animationRate);
764 part->animNotifyValue = spr_get_notify_value(part->spriteInstanceID);
765 }
766 break;
768 part = get_actor_part(actor, partID);
769 if (part->curAnimation != animID) {
770 part->curAnimation = animID;
771 spr_update_sprite(part->spriteInstanceID, animID, part->animationRate);
772 part->animNotifyValue = spr_get_notify_value(part->spriteInstanceID);
773 }
774 break;
775 }
776 }
777}
@ ACTOR_CLASS_PLAYER
Definition enums.h:2110
@ ACTOR_CLASS_PARTNER
Definition enums.h:2111
@ ACTOR_CLASS_MASK
Definition enums.h:2113
s32 spr_get_notify_value(s32 spriteInstanceID)
Definition sprite.c:1158
s32 spr_update_sprite(s32 spriteInstanceID, s32 animID, f32 timeScale)
Definition sprite.c:1061
s32 spr_update_player_sprite(s32 spriteInstanceID, s32 animID, f32 timeScale)
Definition sprite.c:820
@ PLAYER_SPRITE_MAIN
Definition sprite.h:30

Referenced by btl_set_player_idle_anims(), btl_state_update_celebration(), btl_state_update_partner_menu(), btl_state_update_peach_menu(), btl_state_update_player_menu(), and btl_state_update_twink_menu().

◆ set_actor_anim_by_ref()

void set_actor_anim_by_ref ( Actor * actor,
ActorPart * part,
AnimID anim )

Definition at line 779 of file 190B20.c.

779 {
780 if ((s32) anim >= 0) {
781 switch (actor->actorID & ACTOR_CLASS_MASK) {
783 if (part->curAnimation != anim) {
784 part->curAnimation = anim;
785 spr_update_player_sprite(PLAYER_SPRITE_MAIN, anim, part->animationRate);
786 }
787 break;
790 if (part->curAnimation != anim) {
791 part->curAnimation = anim;
792 spr_update_sprite(part->spriteInstanceID, anim, part->animationRate);
793 part->animNotifyValue = spr_get_notify_value(part->spriteInstanceID);
794 }
795 break;
796 }
797 }
798}

◆ set_actor_anim_rate()

void set_actor_anim_rate ( s32 actorID,
s32 partID,
f32 rate )

Definition at line 800 of file 190B20.c.

800 {
801 Actor* actor = get_actor(actorID);
803
804 switch (actorID & ACTOR_CLASS_MASK) {
806 if (partID != 0) {
807 part = get_actor_part(actor, partID);
808 if (part != nullptr) {
809 part->animationRate = rate;
810 return;
811 }
812 }
813 actor->partsTable[0].animationRate = rate;
814 break;
817 part = get_actor_part(actor, partID);
818 part->animationRate = rate;
819 break;
820 }
821}

◆ set_actor_yaw()

void set_actor_yaw ( s32 actorID,
s32 yaw )

Definition at line 823 of file 190B20.c.

823 {
824 get_actor(actorID)->yaw = yaw;
825}

◆ set_part_yaw()

void set_part_yaw ( s32 actorID,
s32 partID,
s32 value )

Definition at line 827 of file 190B20.c.

827 {
828 get_actor_part(get_actor(actorID), partID)->yaw = value;
829}

◆ set_part_flag_bits()

void set_part_flag_bits ( s32 actorID,
s32 partID,
s32 flags )

Definition at line 831 of file 190B20.c.

831 {
832 Actor* actor = get_actor(actorID);
834
835 switch (actorID & ACTOR_CLASS_MASK) {
837 actor->flags |= flags;
838 break;
841 if (partID == 0) {
842 actor->flags |= flags;
843 } else {
844 part = get_actor_part(actor, partID);
845 part->flags |= flags;
846 }
847 break;
848 }
849}
s8 flags
Definition demo_api.c:15

◆ clear_part_flag_bits()

void clear_part_flag_bits ( s32 actorID,
s32 partID,
s32 flags )

Definition at line 851 of file 190B20.c.

851 {
852 Actor* actor = get_actor(actorID);
854
855 switch (actorID & ACTOR_CLASS_MASK) {
857 actor->flags &= ~flags;
858 break;
861 if (partID == 0) {
862 actor->flags &= ~flags;
863 } else {
864 part = get_actor_part(actor, partID);
865 part->flags &= ~flags;
866 }
867 break;
868 }
869}

◆ add_xz_vec3f()

void add_xz_vec3f ( Vec3f * vector,
f32 speed,
f32 angleDeg )

Definition at line 871 of file 190B20.c.

871 {
875
876 vector->x += speed * sinAngleRad;
877 vector->z += -speed * cosAngleRad;
878}
f32 cos_rad(f32 x)
Definition 43F0.c:717
f32 sin_rad(f32 x)
Definition 43F0.c:713
#define DEG_TO_RAD(deg)
Definition macros.h:145

◆ add_xz_vec3f_copy1()

void add_xz_vec3f_copy1 ( Vec3f * vector,
f32 speed,
f32 angleDeg )

Definition at line 880 of file 190B20.c.

880 {
884
885 vector->x += speed * sinAngleRad;
886 vector->z += -speed * cosAngleRad;
887}

◆ add_xz_vec3f_copy2()

void add_xz_vec3f_copy2 ( Vec3f * vector,
f32 speed,
f32 angleDeg )

Definition at line 889 of file 190B20.c.

889 {
893
894 vector->x += speed * sinAngleRad;
895 vector->z += -speed * cosAngleRad;
896}

◆ play_movement_dust_effects()

void play_movement_dust_effects ( s32 var0,
f32 xPos,
f32 yPos,
f32 zPos,
f32 angleDeg )

Definition at line 898 of file 190B20.c.

898 {
899 f32 theta;
902
903 if (var0 == 2) {
905 } else if (var0 == 1) {
906 D_802938A8 = 4;
907 } else if (D_802938A8++ >= 4) {
908 D_802938A8 = 0;
913 0,
914 xPos + (sinTheta * 24.0f * 0.2f),
915 yPos + 1.5f,
916 zPos + (cosTheta * 24.0f * 0.2f),
917 sinTheta,
919 );
920 }
921}
f32 D_802938A4
Definition 190B20.c:9
s16 D_802938A8
Definition 190B20.c:11
#define clamp_angle

◆ get_actor_part()

◆ load_player_actor()

void load_player_actor ( void )

Definition at line 940 of file 190B20.c.

940 {
942 Actor* player;
944 DecorationTable* decorations;
946 s32 i;
947
948 player = battleStatus->playerActor = heap_malloc(sizeof(*player));
949
950 ASSERT(player != nullptr);
951
952 player->ordinal = battleStatus->nextActorOrdinal++;
953 player->footStepCounter = 0;
954 player->flags = 0;
957
959 player->homePos.x = player->curPos.x = -130.0f;
960 player->homePos.y = player->curPos.y = 0.0f;
961 player->homePos.z = player->curPos.z = -10.0f;
962 } else {
963 player->homePos.x = player->curPos.x = -95.0f;
964 player->homePos.y = player->curPos.y = 0.0f;
965 player->homePos.z = player->curPos.z = 0.0f;
966 }
967
968 player->headOffset.x = 0;
969 player->headOffset.y = 0;
970 player->headOffset.z = 0;
971 player->rot.x = 0.0f;
972 player->rot.y = 0.0f;
973 player->rot.z = 0.0f;
974 player->rotPivotOffset.x = 0;
975 player->rotPivotOffset.y = 0;
976 player->rotPivotOffset.z = 0;
977 player->verticalRenderOffset = 0;
978 player->yaw = 0.0f;
980 player->scale.x = 1.0f;
981 player->scale.y = 1.0f;
982 player->scale.z = 1.0f;
983 player->scaleModifier.x = 1.0f;
984 player->scaleModifier.y = 1.0f;
985 player->scaleModifier.z = 1.0f;
986 player->size.x = player->actorBlueprint->size.x;
987 player->size.y = player->actorBlueprint->size.y;
988 player->actorID = 0;
989 player->healthBarPos.x = player->curPos.x;
990 player->healthBarPos.y = player->curPos.y;
991 player->healthBarPos.z = player->curPos.z;
992 player->scalingFactor = 1.0f;
993 player->attackResultEffect = nullptr;
994 player->actionRatingCombo = 0;
995 player->actionRatingTime = 0;
996 player->statusIconOffset.x = 0;
997 player->statusIconOffset.y = 0;
998 player->statusTextOffset.x = 0;
999 player->statusTextOffset.y = 0;
1000 player->idleSource = nullptr;
1001 player->takeTurnSource = nullptr;
1002 player->handleEventSource = nullptr;
1003 player->handlePhaseSource = nullptr;
1004 player->idleScript = nullptr;
1005 player->takeTurnScript = nullptr;
1006 player->handleEventScript = nullptr;
1007 player->handlePhaseScript = nullptr;
1008 player->turnPriority = 0;
1010 player->debuff = 0;
1011 player->debuffDuration = 0;
1012 player->staticStatus = 0;
1013 player->staticDuration = 0;
1014 player->stoneStatus = 0;
1015 player->stoneDuration = 0;
1016 player->koStatus = 0;
1017 player->koDuration = 0;
1018 player->transparentStatus = 0;
1019 player->transparentDuration = 0;
1020 player->isGlowing = false;
1021 player->unk_21E = 0;
1022 player->disableDismissTimer = 0;
1023 player->attackBoost = 0;
1024 player->defenseBoost = 0;
1025 player->chillOutAmount = 0;
1026 player->chillOutTurns = 0;
1027 player->statusAfflicted = 0;
1028 player->actorTypeData1[0] = bActorSoundTable[player->actorType].walk[0];
1029 player->actorTypeData1[1] = bActorSoundTable[player->actorType].walk[1];
1030 player->actorTypeData1[2] = bActorSoundTable[player->actorType].fly[0];
1031 player->actorTypeData1[3] = bActorSoundTable[player->actorType].fly[1];
1032 player->actorTypeData1[4] = bActorSoundTable[player->actorType].jump;
1033 player->actorTypeData1[5] = bActorSoundTable[player->actorType].hurt;
1034 player->actorTypeData1b[0] = bActorSoundTable[player->actorType].delay[0];
1035 player->actorTypeData1b[1] = bActorSoundTable[player->actorType].delay[1];
1036
1037 for (i = 0; i < ARRAY_COUNT(player->loopingSoundID); i++) {
1038 player->loopingSoundID[i] = 0;
1039 }
1040
1041 part = heap_malloc(sizeof(*part));
1042 player->partsTable = part;
1043
1044 ASSERT(part != nullptr)
1045
1046 player->numParts = 1;
1047 part->staticData = bMarioParts;
1048 part->partOffset.x = 0;
1049 part->partOffset.y = 0;
1050 part->partOffset.z = 0;
1051 part->partOffset.x = 12;
1052 part->partOffset.y = 32;
1053 part->partOffset.z = 5;
1054 part->decorationTable = nullptr;
1055 part->flags = 0;
1056 part->targetFlags = 0;
1057 part->partOffsetFloat.x = 0.0f;
1058 part->partOffsetFloat.y = 0.0f;
1059 part->partOffsetFloat.z = 0.0f;
1060 part->rotPivotOffset.x = 0;
1061 part->rotPivotOffset.y = 0;
1062 part->rotPivotOffset.z = 0;
1063 part->visualOffset.x = 0;
1064 part->visualOffset.y = 0;
1065 part->visualOffset.z = 0;
1066 part->absolutePos.x = 0.0f;
1067 part->absolutePos.y = 0.0f;
1068 part->absolutePos.z = 0.0f;
1069 part->defenseTable = bMarioDefenseTable;
1070
1073 } else {
1074 part->idleAnimations = bMarioIdleAnims;
1075 }
1076
1077 part->eventFlags = 0;
1078 part->elementalImmunities = 0;
1079 part->opacity = 255;
1080 part->size.y = player->size.y;
1081 part->size.x = player->size.x;
1082 part->yaw = 0.0f;
1083 part->targetOffset.x = 0;
1084 part->targetOffset.y = 0;
1085 part->targetPriorityOffset = 0;
1086 part->rot.x = 0.0f;
1087 part->rot.y = 0.0f;
1088 part->rot.z = 0.0f;
1089 part->scale.x = 1.0f;
1090 part->scale.y = 1.0f;
1091 part->scale.z = 1.0f;
1092 part->verticalStretch = 1;
1093 part->palAnimPosOffset[0] = 0;
1094 part->palAnimPosOffset[1] = 0;
1095 part->animationRate = 1.0f;
1096 part->curAnimation = get_npc_anim_for_status(part->idleAnimations, 1U);
1097 part->nextPart = nullptr;
1098 part->partTypeData[0] = bActorSoundTable[player->actorType].walk[0];
1099 part->partTypeData[1] = bActorSoundTable[player->actorType].walk[1];
1100 part->partTypeData[2] = bActorSoundTable[player->actorType].fly[0];
1101 part->partTypeData[3] = bActorSoundTable[player->actorType].fly[1];
1102 part->partTypeData[4] = bActorSoundTable[player->actorType].jump;
1103 part->partTypeData[5] = bActorSoundTable[player->actorType].hurt;
1104 part->actorTypeData2b[0] = bActorSoundTable[player->actorType].delay[0];
1105 part->actorTypeData2b[1] = bActorSoundTable[player->actorType].delay[1];
1106
1107 if (part->idleAnimations != nullptr) {
1108 s32 j;
1109
1110 part->decorationTable = heap_malloc(sizeof(*decorations));
1111 decorations = part->decorationTable;
1112
1113 ASSERT(decorations != nullptr);
1114
1116 decorations->glowState = GLOW_PAL_OFF;
1117 decorations->flashState = 0;
1118 decorations->flashEnabled = FLASH_PAL_OFF;
1119 decorations->blurUnused = 0;
1120 decorations->blurBufferPos = 0;
1121
1122 for (j = 0; j < ARRAY_COUNT(decorations->posX); j++) {
1123 decorations->posX[j] = player->curPos.x;
1124 decorations->posY[j] = player->curPos.y;
1125 decorations->posZ[j] = player->curPos.z;
1126 }
1127
1128 decorations->blurDrawCount = 3;
1129 decorations->blurEnableCount = 0;
1130 decorations->blurDisableDelay = 0;
1131
1132 for (j = 0; j < ARRAY_COUNT(decorations->effect); j++) {
1133 decorations->effect[j] = nullptr;
1134 decorations->type[j] = 0;
1135 }
1136 }
1137
1138 partMovement = part->movement = heap_malloc(sizeof(*partMovement));
1139 ASSERT(partMovement != nullptr);
1140
1141 player->shadow.id = create_shadow_type(SHADOW_VARYING_CIRCLE, player->curPos.x, player->curPos.y, player->curPos.z);
1142 player->shadowScale = player->size.x / 24.0;
1144 player->disableEffect = fx_disable_x(0, -142.0f, 34.0f, 1.0f, 0);
1145 player->icePillarEffect = nullptr;
1146
1149 player->staticDuration = 127;
1150 }
1151}
s32 bMarioDefenseTable[]
Definition actors.c:105
ActorPartBlueprint bMarioParts[]
Definition actors.c:154
ActorBlueprint bPlayerActorBlueprint
Definition actors.c:135
s32 get_npc_anim_for_status(AnimID *, s32)
Definition 190B20.c:1674
s32 bPlayerStatusTable[]
Definition actors.c:110
Vec2b statusIconOffset
struct EffectInstance * disableEffect
struct Evt * handlePhaseScript
struct EffectInstance * attackResultEffect
struct Evt * takeTurnScript
struct EffectInstance * effect[2]
s8 transparentStatus
EvtScript * handleEventSource
Vec2b statusTextOffset
EvtScript * idleSource
s8 disableDismissTimer
f32 shadowScale
struct ActorBlueprint * actorBlueprint
s32 actorTypeData1[6]
s8 verticalRenderOffset
u8 footStepCounter
Vec3s headOffset
struct Evt * idleScript
union Actor::@38 shadow
struct Evt * handleEventScript
s16 actorTypeData1b[2]
Vec3s rotPivotOffset
EvtScript * handlePhaseSource
Vec3f scaleModifier
struct EffectInstance * icePillarEffect
Vec3s healthBarPos
s32 loopingSoundID[2]
s8 chillOutAmount
s16 hudElementDataIndex
EvtScript * takeTurnSource
s8 statusAfflicted
s8 staticDuration
s32 * statusTable
s8 debuffDuration
s8 transparentDuration
s8 actionRatingTime
Vec3f scale
#define ASSERT(condition)
@ GLOW_PAL_OFF
Definition enums.h:2244
@ DEMO_BTL_FLAG_PARTNER_ACTING
Definition enums.h:3577
@ ACTOR_PAL_ADJUST_NONE
Definition enums.h:2227
@ SHADOW_VARYING_CIRCLE
Definition enums.h:2521
@ BS_FLAGS2_PEACH_BATTLE
Definition enums.h:3643
@ STATUS_KEY_STATIC
Definition enums.h:2812
@ FLASH_PAL_OFF
Definition enums.h:2256
@ ABILITY_ZAP_TAP
Definition enums.h:455
@ RENDER_MODE_ALPHATEST
Definition enums.h:3310
s32 is_ability_active(s32 arg0)
Definition inventory.c:1735
s32 create_status_icon_set(void)
s32 create_shadow_type(s32 type, f32 x, f32 y, f32 z)
Definition entity.c:1525
void * heap_malloc(s32 size)
Definition heap.c:34
s32 walk[2]
Definition battle.h:235
s16 delay[2]
Number of frames to wait between walk/fly sounds. Negative values are in distance.
Definition battle.h:239
s32 fly[2]
Definition battle.h:236
EXTERN_C ActorSounds bActorSoundTable[]
Definition battle.h:242
s32 bPeachIdleAnims[]
Definition actors.c:99
u32 bMarioIdleAnims[]
Definition actors.c:30

Referenced by btl_state_update_normal_start().

◆ load_partner_actor()

void load_partner_actor ( void )

Definition at line 1153 of file 190B20.c.

1153 {
1156 Actor* partnerActor;
1158 Evt* takeTurnScript;
1159 s32 partCount;
1162 f32 x;
1163 f32 y;
1164 f32 z;
1165 ActorPart* part;
1166 s32 i;
1167 s32 i2;
1168
1169 currentPartner = playerData->curPartner;
1170 battleStatus->partnerActor = nullptr;
1171
1175
1176 ASSERT(actorBP != nullptr);
1177
1178 nuPiReadRom(partnerData->dmaStart, partnerData->dmaDest, partnerData->dmaEnd - partnerData->dmaStart);
1180 x = -95.0f;
1181 y = partnerData->y;
1182 z = 0.0f;
1184 } else {
1185 x = -130.0f;
1186 y = partnerData->y;
1187 z = -10.0f;
1188 }
1189 partCount = actorBP->partCount;
1190 battleStatus->partnerActor = heap_malloc(sizeof(*partnerActor));
1191 partnerActor = battleStatus->partnerActor;
1192
1193 ASSERT(partnerActor != nullptr);
1194
1195 actorBP->level = playerData->partners[playerData->curPartner].level;
1196 partnerActor->ordinal = battleStatus->nextActorOrdinal++;
1197 partnerActor->footStepCounter = 0;
1198 partnerActor->actorBlueprint = actorBP;
1199 partnerActor->actorType = actorBP->type;
1200 partnerActor->flags = actorBP->flags;
1201 partnerActor->homePos.x = partnerActor->curPos.x = x;
1202 partnerActor->homePos.y = partnerActor->curPos.y = y;
1203 partnerActor->homePos.z = partnerActor->curPos.z = z;
1204 partnerActor->headOffset.x = 0;
1205 partnerActor->headOffset.y = 0;
1206 partnerActor->headOffset.z = 0;
1207 partnerActor->curHP = actorBP->maxHP;
1208 partnerActor->numParts = partCount;
1209 partnerActor->idleSource = nullptr;
1210 partnerActor->takeTurnSource = actorBP->initScript;
1211 partnerActor->handleEventSource = nullptr;
1212 partnerActor->handlePhaseSource = nullptr;
1213 partnerActor->idleScript = nullptr;
1214 partnerActor->takeTurnScript = nullptr;
1215 partnerActor->handleEventScript = nullptr;
1216 partnerActor->handlePhaseScript = nullptr;
1217 partnerActor->turnPriority = 0;
1218 partnerActor->enemyIndex = 0;
1219 partnerActor->yaw = 0.0f;
1220 partnerActor->rot.x = 0.0f;
1221 partnerActor->rot.y = 0.0f;
1222 partnerActor->rot.z = 0.0f;
1223 partnerActor->rotPivotOffset.x = 0;
1224 partnerActor->rotPivotOffset.y = 0;
1225 partnerActor->rotPivotOffset.z = 0;
1226 partnerActor->scale.x = 1.0f;
1227 partnerActor->scale.y = 1.0f;
1228 partnerActor->scale.z = 1.0f;
1229 partnerActor->scaleModifier.x = 1.0f;
1230 partnerActor->scaleModifier.y = 1.0f;
1231 partnerActor->scaleModifier.z = 1.0f;
1232 partnerActor->verticalRenderOffset = 0;
1233 partnerActor->size.x = actorBP->size.x;
1234 partnerActor->size.y = actorBP->size.y;
1235 partnerActor->healthBarPos.x = partnerActor->homePos.x;
1236 partnerActor->healthBarPos.y = partnerActor->homePos.y;
1237 partnerActor->healthBarPos.z = partnerActor->homePos.z;
1238 partnerActor->scalingFactor = 1.0f;
1239 partnerActor->attackResultEffect = nullptr;
1240 partnerActor->actionRatingCombo = 0;
1241 partnerActor->actionRatingTime = 0;
1242 partnerActor->statusIconOffset.x = 0;
1243 partnerActor->statusIconOffset.y = 0;
1244 partnerActor->statusTextOffset.x = 0;
1245 partnerActor->statusTextOffset.y = 0;
1246 partnerActor->renderMode = RENDER_MODE_ALPHATEST;
1247 partnerActor->actorID = ACTOR_PARTNER;
1248 partnerActor->statusTable = actorBP->statusTable;
1249 partnerActor->debuff = 0;
1250 partnerActor->debuffDuration = 0;
1251 partnerActor->staticStatus = 0;
1252 partnerActor->staticDuration = 0;
1253 partnerActor->stoneStatus = 0;
1254 partnerActor->stoneDuration = 0;
1255 partnerActor->koStatus = 0;
1256 partnerActor->koDuration = 0;
1257 partnerActor->transparentStatus = 0;
1258 partnerActor->transparentDuration = 0;
1259 partnerActor->isGlowing = false;
1260 partnerActor->unk_21E = 0;
1261 partnerActor->disableDismissTimer = 0;
1262 partnerActor->attackBoost = 0;
1263 partnerActor->defenseBoost = 0;
1264 partnerActor->chillOutAmount = 0;
1265 partnerActor->chillOutTurns = 0;
1266 partnerActor->statusAfflicted = 0;
1267 partnerActor->actorTypeData1[0] = bActorSoundTable[partnerActor->actorType].walk[0];
1268 partnerActor->actorTypeData1[1] = bActorSoundTable[partnerActor->actorType].walk[1];
1269 partnerActor->actorTypeData1[2] = bActorSoundTable[partnerActor->actorType].fly[0];
1270 partnerActor->actorTypeData1[3] = bActorSoundTable[partnerActor->actorType].fly[1];
1271 partnerActor->actorTypeData1[4] = bActorSoundTable[partnerActor->actorType].jump;
1272 partnerActor->actorTypeData1[5] = bActorSoundTable[partnerActor->actorType].hurt;
1273 partnerActor->actorTypeData1b[0] = bActorSoundTable[partnerActor->actorType].delay[0];
1274 partnerActor->actorTypeData1b[1] = bActorSoundTable[partnerActor->actorType].delay[1];
1275
1276 for (i2 = 0; i2 < ARRAY_COUNT(partnerActor->loopingSoundID); i2++) {
1277 partnerActor->loopingSoundID[i2] = 0;
1278 }
1279
1280 part = heap_malloc(sizeof(*part));
1281 partnerActor->partsTable = part;
1282
1283 ASSERT(part != nullptr);
1284
1285 for (i = 0; i < partCount; i++) {
1287 part->decorationTable = nullptr;
1288 part->staticData = ActorPartBlueprint;
1289
1291 part->targetFlags = 0;
1292
1293 part->partOffsetFloat.x = part->partOffset.x = ActorPartBlueprint->posOffset.x;
1294 part->partOffsetFloat.y = part->partOffset.y = ActorPartBlueprint->posOffset.y;
1295 part->partOffsetFloat.z = part->partOffset.z = ActorPartBlueprint->posOffset.z;
1296
1297 part->visualOffset.x = 0;
1298 part->visualOffset.y = 0;
1299 part->visualOffset.z = 0;
1300 part->absolutePos.x = 0.0f;
1301 part->absolutePos.y = 0.0f;
1302 part->absolutePos.z = 0.0f;
1303 part->defenseTable = ActorPartBlueprint->defenseTable;
1304 part->idleAnimations = ActorPartBlueprint->idleAnimations;
1305 part->eventFlags = ActorPartBlueprint->eventFlags;
1306 part->elementalImmunities = ActorPartBlueprint->elementImmunityFlags;
1307 part->opacity = ActorPartBlueprint->opacity;
1308 part->size.y = partnerActor->size.y;
1309 part->size.x = partnerActor->size.x;
1310 part->yaw = 0.0f;
1311 part->targetOffset.x = ActorPartBlueprint->targetOffset.x;
1312 part->targetOffset.y = ActorPartBlueprint->targetOffset.y;
1313 part->targetPriorityOffset = 0;
1314 part->rotPivotOffset.x = 0;
1315 part->rotPivotOffset.y = 0;
1316 part->rotPivotOffset.z = 0;
1317 part->rot.x = 0.0f;
1318 part->rot.y = 0.0f;
1319 part->rot.z = 0.0f;
1320 part->scale.x = 1.0f;
1321 part->scale.y = 1.0f;
1322 part->scale.z = 1.0f;
1323 part->verticalStretch = 1;
1324 part->palAnimPosOffset[0] = 0;
1325 part->palAnimPosOffset[1] = 0;
1326 part->partTypeData[0] = bActorSoundTable[partnerActor->actorType].walk[0];
1327 part->partTypeData[1] = bActorSoundTable[partnerActor->actorType].walk[1];
1328 part->partTypeData[2] = bActorSoundTable[partnerActor->actorType].fly[0];
1329 part->partTypeData[3] = bActorSoundTable[partnerActor->actorType].fly[1];
1330 part->partTypeData[4] = bActorSoundTable[partnerActor->actorType].jump;
1331 part->partTypeData[5] = bActorSoundTable[partnerActor->actorType].hurt;
1332 part->actorTypeData2b[0] = bActorSoundTable[partnerActor->actorType].delay[0];
1333 part->actorTypeData2b[1] = bActorSoundTable[partnerActor->actorType].delay[1];
1334
1335 if (part->idleAnimations != nullptr) {
1336 DecorationTable* decorations;
1337 s32 j;
1338
1339 part->decorationTable = heap_malloc(sizeof(*decorations));
1340 decorations = part->decorationTable;
1341
1342 ASSERT(decorations != nullptr);
1343
1345 decorations->glowState = GLOW_PAL_OFF;
1346 decorations->flashState = 0;
1347 decorations->flashEnabled = FLASH_PAL_OFF;
1348 decorations->blurUnused = 0;
1349 decorations->blurBufferPos = 0;
1350
1351 for (j = 0; j < ARRAY_COUNT(decorations->posX); j++) {
1352 decorations->posX[j] = partnerActor->curPos.x;
1353 decorations->posY[j] = partnerActor->curPos.y;
1354 decorations->posZ[j] = partnerActor->curPos.z;
1355 }
1356
1357 decorations->blurDrawCount = 3;
1358 decorations->blurEnableCount = 0;
1359 decorations->blurDisableDelay = 0;
1360
1361 for (j = 0; j < ARRAY_COUNT(decorations->effect); j++) {
1362 decorations->effect[j] = nullptr;
1363 decorations->type[j] = 0;
1364 }
1365 }
1366
1367 if (!(part->flags & ACTOR_PART_FLAG_SKIP_MOVEMENT_ALLOC)) {
1368 part->movement = heap_malloc(sizeof(*part->movement));
1369 ASSERT(part->movement != nullptr);
1370 }
1371
1372 part->animationRate = 1.0f;
1373 part->curAnimation = 0;
1374 part->spriteInstanceID = -1;
1375
1376 if (part->idleAnimations != nullptr) {
1377 part->curAnimation = get_npc_anim_for_status(part->idleAnimations, 1);
1378 part->spriteInstanceID = spr_load_npc_sprite(part->curAnimation | SPRITE_ID_TAIL_ALLOCATE, nullptr);
1379 }
1380
1381 if (i + 1 >= partCount) {
1382 part->nextPart = nullptr;
1383 continue;
1384 }
1385
1386 part->nextPart = heap_malloc(sizeof(*part->nextPart));
1387 part = part->nextPart;
1388 if (part == nullptr) {
1389 PANIC();
1390 }
1391
1392 part->nextPart = nullptr;
1393 }
1394
1395 partnerActor->shadow.id = create_shadow_type(SHADOW_VARYING_CIRCLE, partnerActor->curPos.x, partnerActor->curPos.y, partnerActor->curPos.z);
1396 partnerActor->shadowScale = partnerActor->size.x / 24.0;
1398 partnerActor->disableEffect = fx_disable_x(0, -142.0f, 34.0f, 1.0f, 0);
1399 partnerActor->icePillarEffect = nullptr;
1400
1401 takeTurnScript = start_script(partnerActor->takeTurnSource, EVT_PRIORITY_A, 0);
1402 partnerActor->takeTurnScriptID = takeTurnScript->id;
1403 takeTurnScript->owner1.actorID = ACTOR_PARTNER;
1404 }
1405}
PartnerDMAData bPartnerDmaTable[]
Definition partner_dma.c:26
s32 takeTurnScriptID
struct ActorBlueprint * ActorBlueprint
union Evt::@10 owner1
Initially -1.
@ BS_FLAGS1_PLAYER_IN_BACK
Definition enums.h:3622
@ PARTNER_NONE
Definition enums.h:2919
@ ACTOR_PART_FLAG_SKIP_MOVEMENT_ALLOC
Definition enums.h:3400
@ ACTOR_PART_FLAG_NO_SHADOW
Definition enums.h:3386
@ EVT_PRIORITY_A
Definition evt.h:154
Evt * start_script(EvtScript *source, s32 priority, s32 initialState)
#define PANIC()
Definition macros.h:54
s32 spr_load_npc_sprite(s32 animID, u32 *extraAnimList)
Definition sprite.c:1015
@ SPRITE_ID_TAIL_ALLOCATE
Definition sprite.h:18

Referenced by btl_state_update_change_partner(), and btl_state_update_normal_start().

◆ create_actor()

Actor * create_actor ( Formation formation)

Definition at line 1407 of file 190B20.c.

1407 {
1409 Actor* actor;
1411 ActorPart* part;
1412 Evt* takeTurnScript;
1413 s32 partCount;
1414 f32 x, y, z;
1415 DecorationTable* decorations;
1416 s32 i, j, k;
1417
1418 if (formation->home.index >= EVT_LIMIT) {
1419 x = StandardActorHomePositions[formation->home.index].x;
1420 y = StandardActorHomePositions[formation->home.index].y;
1421 z = StandardActorHomePositions[formation->home.index].z;
1422 } else {
1423 x = formation->home.vec->x;
1424 y = formation->home.vec->y;
1425 z = formation->home.vec->z;
1426 }
1427
1428 formationActor = formation->actor;
1429 partCount = formationActor->partCount;
1430
1431 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
1432 if (battleStatus->enemyActors[i] == nullptr) {
1433 break;
1434 }
1435 }
1436
1437 actor = battleStatus->enemyActors[i] = heap_malloc(sizeof(*actor));
1438
1439 ASSERT(actor != nullptr);
1440
1441 actor->ordinal = battleStatus->nextActorOrdinal++;
1442 actor->footStepCounter = 0;
1444 actor->actorType = formationActor->type;
1445 actor->flags = formationActor->flags;
1446 actor->homePos.x = actor->curPos.x = x;
1447 actor->homePos.y = actor->curPos.y = y;
1448 actor->homePos.z = actor->curPos.z = z;
1449 actor->headOffset.x = 0;
1450 actor->headOffset.y = 0;
1451 actor->headOffset.z = 0;
1452 actor->maxHP = actor->curHP = formationActor->maxHP;
1453 actor->numParts = partCount;
1454 actor->idleSource = nullptr;
1455 actor->takeTurnSource = formationActor->initScript;
1456 actor->handleEventSource = nullptr;
1457 actor->handlePhaseSource = nullptr;
1458 actor->idleScript = nullptr;
1459 actor->takeTurnScript = nullptr;
1460 actor->handleEventScript = nullptr;
1461 actor->turnPriority = formation->priority;
1462 actor->enemyIndex = i;
1463 actor->yaw = 0.0f;
1464 actor->rot.x = 0.0f;
1465 actor->rot.y = 0.0f;
1466 actor->rot.z = 0.0f;
1467 actor->rotPivotOffset.x = 0;
1468 actor->rotPivotOffset.y = 0;
1469 actor->rotPivotOffset.z = 0;
1470 actor->scale.x = 1.0f;
1471 actor->scale.y = 1.0f;
1472 actor->scale.z = 1.0f;
1473 actor->scaleModifier.x = 1.0f;
1474 actor->scaleModifier.y = 1.0f;
1475 actor->scaleModifier.z = 1.0f;
1476 actor->verticalRenderOffset = 0;
1477 actor->extraCoinBonus = 0;
1478 actor->size.x = formationActor->size.x;
1479 actor->size.y = formationActor->size.y;
1480 actor->scalingFactor = 1.0f;
1481 actor->statusIconOffset.x = 0;
1482 actor->statusIconOffset.y = 0;
1483 actor->statusTextOffset.x = 0;
1484 actor->statusTextOffset.y = 0;
1485 actor->healthBarOffset.x = 0;
1486 actor->healthBarOffset.y = 0;
1487 actor->healthBarHideTime = 0;
1488 actor->attackResultEffect = nullptr;
1489 actor->actionRatingCombo = 0;
1490 actor->actionRatingTime = 0;
1491
1492 actor->healthBarPos.x = actor->curPos.x + formationActor->healthBarOffset.x;
1493 actor->healthBarPos.y = actor->curPos.y + formationActor->healthBarOffset.y;
1494 actor->healthBarPos.z = actor->curPos.z;
1495 if (actor->flags & ACTOR_FLAG_UPSIDE_DOWN) {
1496 actor->healthBarPos.y = actor->curPos.y - actor->size.y - formationActor->healthBarOffset.y;
1497 }
1498
1499 actor->statusTable = formationActor->statusTable;
1500 actor->debuff = 0;
1501 actor->debuffDuration = 0;
1502 actor->staticStatus = 0;
1503 actor->staticDuration = 0;
1504 actor->stoneStatus = 0;
1505 actor->stoneDuration = 0;
1506 actor->koStatus = 0;
1507 actor->koDuration = 0;
1508 actor->transparentStatus = 0;
1509 actor->transparentDuration = 0;
1510 actor->isGlowing = false;
1511 actor->unk_21E = 0;
1512 actor->disableDismissTimer = 0;
1513 actor->attackBoost = 0;
1514 actor->defenseBoost = 0;
1515 actor->chillOutAmount = 0;
1516 actor->chillOutTurns = 0;
1517 actor->statusAfflicted = 0;
1518 actor->actorTypeData1[0] = bActorSoundTable[actor->actorType].walk[0];
1519 actor->actorTypeData1[1] = bActorSoundTable[actor->actorType].walk[1];
1520 actor->actorTypeData1[2] = bActorSoundTable[actor->actorType].fly[0];
1521 actor->actorTypeData1[3] = bActorSoundTable[actor->actorType].fly[1];
1522 actor->actorTypeData1[4] = bActorSoundTable[actor->actorType].jump;
1523 actor->actorTypeData1[5] = bActorSoundTable[actor->actorType].hurt;
1524 actor->actorTypeData1b[0] = bActorSoundTable[actor->actorType].delay[0];
1525 actor->actorTypeData1b[1] = bActorSoundTable[actor->actorType].delay[1];
1526
1527 for (i = 0; i < ARRAY_COUNT(actor->loopingSoundID); i++) {
1528 actor->loopingSoundID[i] = 0;
1529 }
1530
1531 actor->state.varTable[0] = formation->var0;
1532 actor->state.varTable[1] = formation->var1;
1533 actor->state.varTable[2] = formation->var2;
1534 actor->state.varTable[3] = formation->var3;
1536 actor->instigatorValue = 0;
1537 part = heap_malloc(sizeof(*part));
1538 actor->partsTable = part;
1539 ASSERT(part != nullptr);
1540
1541 for (j = 0; j < partCount; j++) {
1543
1544 part->decorationTable = nullptr;
1545 part->staticData = actorPartBP;
1547 part->targetFlags = 0;
1548
1549 part->partOffsetFloat.x = part->partOffset.x = actorPartBP->posOffset.x;
1550 part->partOffsetFloat.y = part->partOffset.y = actorPartBP->posOffset.y;
1551 part->partOffsetFloat.z = part->partOffset.z = actorPartBP->posOffset.z;
1552
1553 part->visualOffset.x = 0;
1554 part->visualOffset.y = 0;
1555 part->visualOffset.z = 0;
1556
1557 part->absolutePos.x = actor->curPos.x;
1558 part->absolutePos.y = actor->curPos.y;
1559 part->absolutePos.z = actor->curPos.z;
1560 part->curPos.x = actor->curPos.x;
1561 part->curPos.y = actor->curPos.y;
1562 part->curPos.z = actor->curPos.z;
1563 part->defenseTable = actorPartBP->defenseTable;
1564 part->idleAnimations = actorPartBP->idleAnimations;
1565 part->eventFlags = actorPartBP->eventFlags;
1566 part->elementalImmunities = actorPartBP->elementImmunityFlags;
1567 part->opacity = actorPartBP->opacity;
1568 if (part->opacity < 255) {
1570 }
1571 part->size.y = actor->size.y;
1572 part->size.x = actor->size.x;
1573 part->yaw = 0.0f;
1574 part->targetOffset.x = actorPartBP->targetOffset.x;
1575 part->targetOffset.y = actorPartBP->targetOffset.y;
1576 part->targetPriorityOffset = 0;
1577 part->projectileTargetOffset.x = actorPartBP->projectileTargetOffset.x;
1578 part->projectileTargetOffset.y = actorPartBP->projectileTargetOffset.y;
1579 part->rot.x = 0.0f;
1580 part->rot.y = 0.0f;
1581 part->rot.z = 0.0f;
1582 part->rotPivotOffset.x = 0;
1583 part->rotPivotOffset.y = 0;
1584 part->rotPivotOffset.z = 0;
1585 part->scale.x = 1.0f;
1586 part->scale.y = 1.0f;
1587 part->scale.z = 1.0f;
1588 part->verticalStretch = 1;
1589 part->palAnimPosOffset[0] = 0;
1590 part->palAnimPosOffset[1] = 0;
1591 part->partTypeData[0] = bActorSoundTable[actor->actorType].walk[0];
1592 part->partTypeData[1] = bActorSoundTable[actor->actorType].walk[1];
1593 part->partTypeData[2] = bActorSoundTable[actor->actorType].fly[0];
1594 part->partTypeData[3] = bActorSoundTable[actor->actorType].fly[1];
1595 part->partTypeData[4] = bActorSoundTable[actor->actorType].jump;
1596 part->partTypeData[5] = bActorSoundTable[actor->actorType].hurt;
1597 part->actorTypeData2b[0] = bActorSoundTable[actor->actorType].delay[0];
1598 part->actorTypeData2b[1] = bActorSoundTable[actor->actorType].delay[1];
1599
1600 if (part->idleAnimations != nullptr && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
1601 part->decorationTable = heap_malloc(sizeof(*decorations));
1602 decorations = part->decorationTable;
1603 ASSERT(decorations != nullptr);
1604
1606 decorations->glowState = GLOW_PAL_OFF;
1607 decorations->flashState = 0;
1608 decorations->flashEnabled = FLASH_PAL_OFF;
1609 decorations->blurUnused = 0;
1610 decorations->blurBufferPos = 0;
1611
1612 for (k = 0; k < ARRAY_COUNT(decorations->posX); k++) {
1613 decorations->posX[k] = actor->curPos.x;
1614 decorations->posY[k] = actor->curPos.y;
1615 decorations->posZ[k] = actor->curPos.z;
1616 }
1617
1618 decorations->blurDrawCount = 3;
1619 decorations->blurEnableCount = 0;
1620 decorations->blurDisableDelay = 0;
1621
1622 for (k = 0; k < ARRAY_COUNT(decorations->effect); k++) {
1623 decorations->effect[k] = nullptr;
1624 decorations->type[k] = 0;
1625 }
1626
1627 }
1628
1629 if (!(part->flags & ACTOR_PART_FLAG_SKIP_MOVEMENT_ALLOC)) {
1630 part->movement = heap_malloc(sizeof(*part->movement));
1631 ASSERT(part->movement != nullptr);
1632 }
1633
1634 if (actor->flags & ACTOR_FLAG_TARGET_ONLY) {
1636 }
1637
1638 part->animationRate = 1.0f;
1639 part->curAnimation = 0;
1640 part->spriteInstanceID = -1;
1641
1642 if (part->idleAnimations != nullptr) {
1643 part->curAnimation = get_npc_anim_for_status(part->idleAnimations, 1) & ~SPRITE_ID_TAIL_ALLOCATE;
1644 part->spriteInstanceID = spr_load_npc_sprite(part->curAnimation, nullptr);
1645 }
1646
1647 if (j + 1 >= partCount) {
1648 part->nextPart = nullptr;
1649 continue;
1650 }
1651
1652 part->nextPart = heap_malloc(sizeof(*part->nextPart));
1653 part = part->nextPart;
1654 if (part == nullptr) {
1655 PANIC();
1656 }
1657
1658 part->nextPart = nullptr;
1659 }
1660
1661 actor->healthFraction = 25;
1662 actor->actorID = actor->enemyIndex | ACTOR_CLASS_ENEMY;
1663 takeTurnScript = start_script(actor->takeTurnSource, EVT_PRIORITY_A, 0);
1664 actor->takeTurnScriptID = takeTurnScript->id;
1665 takeTurnScript->owner1.enemyID = actor->enemyIndex | ACTOR_CLASS_ENEMY;
1666 actor->shadow.id = create_shadow_type(SHADOW_VARYING_CIRCLE, actor->curPos.x, actor->curPos.y, actor->curPos.z);
1667 actor->shadowScale = actor->size.x / 24.0;
1668 actor->disableEffect = fx_disable_x(0, -142.0f, 34.0f, 1.0f, 0);
1669 actor->icePillarEffect = nullptr;
1671 return actor;
1672}
Vec2b healthBarOffset
s8 healthFraction
s8 extraCoinBonus
ActorState state
s8 instigatorValue
s8 healthBarHideTime
@ RENDER_MODE_SURFACE_XLU_LAYER3
Definition enums.h:3333
@ ACTOR_PART_FLAG_TARGET_ONLY
Definition enums.h:3393
#define EVT_LIMIT
Definition macros.h:48
Vec3s StandardActorHomePositions[]
Definition actors.c:165

Referenced by btl_state_update_normal_start().

◆ get_player_anim_for_status()

s32 get_player_anim_for_status ( s32 statusKey)

Definition at line 1695 of file 190B20.c.

1695 {
1698 Actor* player = battleStatus->playerActor;
1699 u32* anim = &player->partsTable->idleAnimations[0];
1700 s32 ret;
1701
1702 if (anim == nullptr) {
1703 return 0;
1704 }
1705 ret = 0;
1706
1707 if (!(battleStatus->flags2 & BS_FLAGS2_PEACH_BATTLE)) {
1708 // switch to danger override animations
1709 if (playerData->curHP <= DANGER_THRESHOLD) {
1712 }
1715 }
1718 }
1719 }
1720
1721 // switch to poisoned override animations
1722 if (player->debuff == STATUS_KEY_POISON) {
1725 }
1728 }
1731 }
1732 }
1733
1734 // switch to dizzy override animations
1735 if (player->debuff == STATUS_KEY_DIZZY) {
1738 }
1739 }
1740 }
1741
1742 // search IdleAnimations to get animID for key
1743 while (*anim != nullptr) {
1744 if (*anim == STATUS_KEY_NORMAL) {
1745 ret = anim[1];
1746 }
1747 if (*anim == statusKey) {
1748 ret = anim[1];
1749 break;
1750 }
1751 anim += 2;
1752 }
1753
1754 return ret;
1755}
u32 * idleAnimations
@ STATUS_KEY_INACTIVE_DIZZY
Definition enums.h:2825
@ STATUS_KEY_THINKING
Definition enums.h:2829
@ STATUS_KEY_WEARY
Definition enums.h:2830
@ STATUS_KEY_INACTIVE_WEARY
Definition enums.h:2823
@ STATUS_KEY_DANGER
Definition enums.h:2827
@ STATUS_KEY_INACTIVE
Definition enums.h:2819
@ STATUS_KEY_DIZZY
Definition enums.h:2805
@ STATUS_KEY_POISON
Definition enums.h:2810
#define DANGER_THRESHOLD
Definition battle.h:276

Referenced by appendGfx_player_actor(), and btl_state_update_player_menu().

◆ lookup_defense()

s32 lookup_defense ( s32 * defenseTable,
s32 elementKey )

Definition at line 1757 of file 190B20.c.

1757 {
1758 s32 normalDefense = 0;
1759
1760 while (defenseTable[DICTIONARY_KEY] != ELEMENT_END) {
1761 if (defenseTable[DICTIONARY_KEY] == ELEMENT_NORMAL) {
1762 normalDefense = defenseTable[DICTIONARY_VALUE];
1763 }
1764
1765 if (defenseTable[DICTIONARY_KEY] == elementKey) {
1766 normalDefense = defenseTable[DICTIONARY_VALUE];
1767 break;
1768 }
1769 defenseTable += DICTIONARY_SIZE;
1770 }
1771
1772 // Fall back to normal defense if given element is not specified in table
1773 return normalDefense;
1774}
@ ELEMENT_END
Definition enums.h:2147
@ ELEMENT_NORMAL
Definition enums.h:2148

Referenced by get_defense().

◆ lookup_status_chance()

s32 lookup_status_chance ( s32 * statusTable,
s32 statusKey )

Definition at line 1776 of file 190B20.c.

1776 {
1777 s32 defaultChance = 0;
1778
1779 while (statusTable[DICTIONARY_KEY] != STATUS_END) {
1780 if (statusTable[DICTIONARY_KEY] == STATUS_KEY_DEFAULT) {
1781 defaultChance = statusTable[DICTIONARY_VALUE];
1782 }
1783
1784 if (statusTable[DICTIONARY_KEY] == statusKey) {
1785 defaultChance = statusTable[DICTIONARY_VALUE];
1786 break;
1787 }
1788 statusTable += DICTIONARY_SIZE;
1789 }
1790
1791 // Fall back to normal chance if given element is not specified in table
1792 return defaultChance;
1793}
@ STATUS_END
Definition enums.h:2801
@ STATUS_KEY_DEFAULT
Definition enums.h:2803

Referenced by inflict_status_set_duration(), and try_inflict_status().

◆ lookup_status_duration_mod()

s32 lookup_status_duration_mod ( s32 * statusTable,
s32 statusKey )

Definition at line 1795 of file 190B20.c.

1795 {
1796 s32 defaultTurnMod = 0;
1797
1798 while (statusTable[DICTIONARY_KEY] != ELEMENT_END) {
1799 if (statusTable[DICTIONARY_KEY] == STATUS_TURN_MOD_DEFAULT) {
1800 defaultTurnMod = statusTable[DICTIONARY_VALUE];
1801 }
1802
1803 if (statusTable[DICTIONARY_KEY] == statusKey) {
1804 defaultTurnMod = statusTable[DICTIONARY_VALUE];
1805 break;
1806 }
1807 statusTable += DICTIONARY_SIZE;
1808 }
1809
1810 // Fall back to normal duration if given element is not specified in table
1811 return defaultTurnMod;
1812}
@ STATUS_TURN_MOD_DEFAULT
Definition enums.h:2832

Referenced by try_inflict_status().

◆ inflict_status()

s32 inflict_status ( Actor * target,
s32 statusTypeKey,
s32 duration )

Definition at line 1814 of file 190B20.c.

1814 {
1816 EffectInstance* effect;
1817
1818 switch (statusTypeKey) {
1819 case STATUS_KEY_UNUSED:
1820 case STATUS_KEY_DIZZY:
1822 case STATUS_KEY_SLEEP:
1823 case STATUS_KEY_FROZEN:
1824 case STATUS_KEY_STOP:
1825 case STATUS_KEY_POISON:
1826 case STATUS_KEY_SHRINK:
1828 !is_ability_active(ABILITY_BERSERKER) && battleStatus->hustleTurns == 0)) {
1829
1830 if (target->actorID != ACTOR_PARTNER) {
1831 if (target->debuff != statusTypeKey) {
1832 target->statusAfflicted = statusTypeKey;
1833 }
1834 target->disableEffect->data.disableX->koDuration = 0;
1835 target->debuff = statusTypeKey;
1836 target->debuffDuration = duration;
1837 if ((s8)duration > 9) {
1838 target->debuffDuration = 9;
1839 }
1840
1841 switch (statusTypeKey) {
1842 case STATUS_KEY_FROZEN:
1843 if (target->actorID != ACTOR_PARTNER) {
1844 effect = target->icePillarEffect;
1845 if (effect != nullptr) {
1847 }
1848 target->icePillarEffect = fx_ice_pillar(0, target->curPos.x, target->curPos.y,
1849 target->curPos.z, 1.0f, 0);
1850 create_status_debuff(target->hudElementDataIndex, STATUS_KEY_FROZEN);
1851 }
1852 return true;
1853 case STATUS_KEY_SLEEP:
1855 create_status_debuff(target->hudElementDataIndex, STATUS_KEY_SLEEP);
1856 return true;
1859 create_status_debuff(target->hudElementDataIndex, STATUS_KEY_PARALYZE);
1860 return true;
1861 case STATUS_KEY_DIZZY:
1862 create_status_debuff(target->hudElementDataIndex, STATUS_KEY_DIZZY);
1863 return true;
1864 case STATUS_KEY_UNUSED:
1866 create_status_debuff(target->hudElementDataIndex, STATUS_KEY_UNUSED);
1867 return true;
1868 case STATUS_KEY_POISON:
1870 create_status_debuff(target->hudElementDataIndex, STATUS_KEY_POISON);
1871 return true;
1872 case STATUS_KEY_SHRINK:
1873 create_status_debuff(target->hudElementDataIndex, STATUS_KEY_SHRINK);
1874 return true;
1875 }
1876 }
1877 return true;
1878 } else {
1879 return false;
1880 }
1881 break;
1882 case STATUS_KEY_STATIC:
1883 if (target->actorID != ACTOR_PARTNER) {
1884 target->staticStatus = statusTypeKey;
1885 target->staticDuration = duration;
1886 if ((s8)duration > 9) {
1887 target->staticDuration = 9;
1888 }
1889 target->statusAfflicted = STATUS_KEY_STATIC;
1891 create_status_static(target->hudElementDataIndex, STATUS_KEY_STATIC);
1892 }
1893 return true;
1894 case STATUS_KEY_STONE:
1895 if (target->actorID != ACTOR_PARTNER) {
1896 target->stoneStatus = STATUS_KEY_STONE;
1897 target->stoneDuration = duration;
1898 if ((s8)duration > 9) {
1899 target->stoneDuration = 9;
1900 }
1901 target->statusAfflicted = STATUS_KEY_STONE;
1902 }
1903 return true;
1904 case STATUS_KEY_KO:
1905 if (target->koStatus < statusTypeKey) {
1906 target->koStatus = STATUS_KEY_KO;
1907 target->koDuration = duration;
1908 if ((s8)duration > 9) {
1909 target->koDuration = 9;
1910 }
1911 target->statusAfflicted = STATUS_KEY_KO;
1912 }
1913 return true;
1915 if (target->actorID != ACTOR_PARTNER) {
1916 target->transparentStatus = STATUS_KEY_TRANSPARENT;
1917 target->transparentDuration = duration;
1918 if ((s8)duration > 9) {
1919 target->transparentDuration = 9;
1920 }
1921 target->statusAfflicted = STATUS_KEY_TRANSPARENT;
1923 }
1924 return true;
1925 case 0:
1926 case STATUS_KEY_NORMAL:
1927 case STATUS_KEY_DEFAULT:
1928 default:
1929 return true;
1930 }
1931}
void set_actor_pal_adjustment(Actor *actor, s32 palAdjust)
Definition 190B20.c:2337
struct DisableXFXData * disableX
Definition effects.h:2529
EffectInstanceDataPtr data
Definition effects.h:2605
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3551
@ ACTOR_PAL_ADJUST_FEAR
Definition enums.h:2230
@ ACTOR_PAL_ADJUST_POISON
Definition enums.h:2231
@ ACTOR_PAL_ADJUST_PARALYZE
Definition enums.h:2232
@ ACTOR_PAL_ADJUST_SLEEP
Definition enums.h:2228
@ ACTOR_PAL_ADJUST_STATIC
Definition enums.h:2229
@ STATUS_KEY_PARALYZE
Definition enums.h:2806
@ STATUS_KEY_TRANSPARENT
Definition enums.h:2815
@ STATUS_KEY_SLEEP
Definition enums.h:2807
@ STATUS_KEY_UNUSED
Definition enums.h:2804
@ STATUS_KEY_STONE
Definition enums.h:2813
@ STATUS_KEY_STOP
Definition enums.h:2809
@ STATUS_KEY_SHRINK
Definition enums.h:2811
@ ABILITY_BERSERKER
Definition enums.h:457
@ ABILITY_FEELING_FINE
Definition enums.h:450
void create_status_debuff(s32, s32)
void create_status_transparent(s32, s32)
void create_status_static(s32, s32)

Referenced by calc_item_damage_enemy(), dispatch_damage_event_partner(), inflict_partner_ko(), inflict_status_set_duration(), and try_inflict_status().

◆ inflict_partner_ko()

s32 inflict_partner_ko ( Actor * target,
s32 statusTypeKey,
s32 duration )

Definition at line 1933 of file 190B20.c.

1933 {
1935 if (statusTypeKey != target->koStatus) {
1938 } else {
1939 target->koDuration += duration;
1940 if (target->koDuration > 9) {
1941 target->koDuration = 9;
1942 }
1943 }
1944 }
1945
1946 return true;
1947}
s32 inflict_status(Actor *target, s32 statusTypeKey, s32 duration)
Definition 190B20.c:1814
@ SOUND_INFLICT_KO
Definition enums.h:1548
void sfx_play_sound(s32 soundID)

Referenced by calc_enemy_damage_target().

◆ get_defense()

s32 get_defense ( Actor * actor,
s32 * defenseTable,
s32 elementFlags )

Definition at line 1949 of file 190B20.c.

1949 {
1951 s32 minDefense = 255;
1952
1953 if (defenseTable != nullptr) {
1954
1955 #define CHECK_DEFENSE(element) \
1956 if (elementFlags & DAMAGE_TYPE_##element) { \
1957 elemDefense = lookup_defense(defenseTable, ELEMENT_##element); \
1958 if (elemDefense < minDefense) { \
1959 minDefense = elemDefense; \
1960 } \
1961 } \
1962
1974
1975 #undef CHECK_DEFENSE
1976 }
1977
1978 // If no element flags were set, fall back to normal defense.
1979 if (minDefense == 255) {
1980 elemDefense = lookup_defense(defenseTable, ELEMENT_NORMAL);
1981 if (elemDefense < 255) {
1983 }
1984 }
1985
1987 if (minDefense == 99) {
1988 // Immune
1989 minDefense = 999;
1990 } else if (minDefense > 0) {
1991 minDefense = 0;
1992 }
1993 }
1994
1995 return minDefense;
1996}
#define CHECK_DEFENSE(element)
@ DAMAGE_TYPE_IGNORE_DEFENSE
Definition enums.h:2911

Referenced by calc_enemy_damage_target(), calc_item_damage_enemy(), calc_partner_damage_enemy(), and calc_player_damage_enemy().

◆ show_primary_damage_popup()

void show_primary_damage_popup ( f32 posX,
f32 posY,
f32 posZ,
s32 damageAmt,
b32 angle )

Definition at line 1999 of file 190B20.c.

1999 {
2000 s32 i;
2001
2002 for (i = 0; i < 1; i++) {
2003 if (gDamageCountEffects[i] == nullptr) {
2004 break;
2005 }
2006 }
2007
2008 if (i > 0) {
2009 i = 0;
2011 gDamageCountEffects[i] = nullptr;
2012 }
2013
2014 if (angle == 0) {
2015 angle = -55;
2016 } else {
2017 angle = 55;
2018 }
2019
2020 fx_damage_indicator(0, posX, posY, posZ, 10.0f, angle, damageAmt, &gDamageCountEffects[i]);
2021 gDamageCountTimers[i] = 40;
2022}
s32 gDamageCountTimers[]
Definition 190B20.c:22
EffectInstance * gDamageCountEffects[]
Definition 190B20.c:13
struct DamageIndicatorFXData * damageIndicator
Definition effects.h:2494

Referenced by calc_enemy_damage_target(), calc_item_damage_enemy(), calc_partner_damage_enemy(), and calc_player_damage_enemy().

◆ show_next_damage_popup()

void show_next_damage_popup ( f32 posX,
f32 posY,
f32 posZ,
s32 damageAmt,
b32 angle )

Definition at line 2025 of file 190B20.c.

2025 {
2026 s32 i;
2027
2028 for (i = 0; i < ARRAY_COUNT(gDamageCountEffects); i++) {
2029 if (gDamageCountEffects[i] == nullptr) {
2030 break;
2031 }
2032 }
2033
2034 if (i > ARRAY_COUNT(gDamageCountEffects) - 1) {
2035 i = 0;
2037 gDamageCountEffects[i] = nullptr;
2038 }
2039
2040 if (angle == 0) {
2041 angle = -55;
2042 } else {
2043 angle = 55;
2044 }
2045
2046 fx_damage_indicator(0, posX, posY, posZ, 10.0f, angle, damageAmt, &gDamageCountEffects[i]);
2047 gDamageCountTimers[i] = 40;
2048}

Referenced by calc_enemy_damage_target(), calc_item_damage_enemy(), calc_partner_damage_enemy(), calc_player_damage_enemy(), dispatch_damage_event_actor(), dispatch_damage_event_partner(), and dispatch_damage_event_player().

◆ update_damage_popups()

void update_damage_popups ( void )

Definition at line 2050 of file 190B20.c.

2050 {
2051 s32 i;
2052
2053 for (i = 0; i < ARRAY_COUNT(gDamageCountEffects); i++) {
2054 if (gDamageCountEffects[i] != nullptr) {
2055 gDamageCountTimers[i]--;
2056 if (gDamageCountTimers[i] == 0) {
2058 gDamageCountEffects[i] = nullptr;
2059 }
2060 }
2061 };
2062}

Referenced by btl_update().

◆ show_damage_fx()

void show_damage_fx ( Actor * actor,
f32 x,
f32 y,
f32 z,
s32 damage )

Definition at line 2064 of file 190B20.c.

2064 {
2066 s32 intensity;
2067
2068 if (damage < 3) {
2069 intensity = DAMAGE_INTENSITY_LIGHT;
2070 } else if (damage < 5) {
2071 intensity = DAMAGE_INTENSITY_MEDIUM;
2072 } else if (damage < 9) {
2073 intensity = DAMAGE_INTENSITY_HEAVY;
2074 } else {
2075 intensity = DAMAGE_INTENSITY_EXTREME;
2076 }
2077
2078 if (battleStatus->curAttackElement & DAMAGE_TYPE_FIRE) {
2079 fx_ring_blast(0, x, y, z, 1.0f, 24);
2080 } else if (battleStatus->curAttackElement & DAMAGE_TYPE_SHOCK) {
2081 apply_shock_effect(actor);
2082 } else if (battleStatus->curAttackElement & DAMAGE_TYPE_WATER) {
2083 fx_water_splash(0, x, y, z, 1.0f, 24);
2084 } else {
2085 fx_firework(0, x, y, z, 1.0, intensity);
2086 }
2087}
@ DAMAGE_INTENSITY_EXTREME
Definition enums.h:3543
@ DAMAGE_INTENSITY_LIGHT
Definition enums.h:3540
@ DAMAGE_INTENSITY_HEAVY
Definition enums.h:3542
@ DAMAGE_INTENSITY_MEDIUM
Definition enums.h:3541
@ DAMAGE_TYPE_SHOCK
Definition enums.h:2890
@ DAMAGE_TYPE_FIRE
Definition enums.h:2886
@ DAMAGE_TYPE_WATER
Definition enums.h:2887
void apply_shock_effect(Actor *)

Referenced by calc_enemy_damage_target(), calc_item_damage_enemy(), calc_partner_damage_enemy(), calc_player_damage_enemy(), dispatch_damage_event_actor(), dispatch_damage_event_partner(), and dispatch_damage_event_player().

◆ show_action_rating()

void show_action_rating ( s32 rating,
Actor * actor,
f32 x,
f32 y,
f32 z )

Definition at line 2090 of file 190B20.c.

2090 {
2092 Actor* player;
2093 s32 new_var; // TODO required to match
2094 s32 type;
2095
2096 actor->attackResultEffect = actor->attackResultEffect; // TODO required to match
2097 player = battleStatus->playerActor;
2098
2099 if (actor->attackResultEffect == nullptr) {
2100 type = 0;
2101 switch (rating) {
2102 case ACTION_RATING_NICE:
2103 type = 0;
2104 actor->actionRatingCombo = 1;
2105 break;
2106 case ACTION_RATING_MISS:
2107 type = 4;
2108 actor->actionRatingCombo = 0;
2109 break;
2111 type = 3;
2112 actor->actionRatingCombo = 0;
2113 break;
2115 type = 2;
2116 actor->actionRatingCombo = 2;
2117 break;
2119 type = 0;
2120 actor->actionRatingCombo = 0;
2121 break;
2123 type = player->actionRatingCombo;
2124 player->actionRatingCombo++;
2125 if (player->actionRatingCombo > 2) {
2126 player->actionRatingCombo = 2;
2127 }
2128 break;
2129 }
2130 actor->attackResultEffect = fx_attack_result_text(type, x, y, z - 10.0f, 12.0f, 90);
2131 actor->actionRatingTime = 80;
2132 new_var = 2; // TODO required to match
2133 } else {
2135 type = actor->actionRatingCombo;
2136 new_var = rating; // TODO required to match
2137 switch (new_var) { // TODO required to match
2138 case ACTION_RATING_NICE:
2139 actor->actionRatingCombo++;
2140 if (actor->actionRatingCombo > 2) {
2141 actor->actionRatingCombo = 2;
2142 }
2143 break;
2144 case ACTION_RATING_MISS:
2145 type = 4;
2146 break;
2148 type = 3;
2149 break;
2151 type = 2;
2152 break;
2154 type = 0;
2155 break;
2157 type = player->actionRatingCombo;
2158 player->actionRatingCombo++;
2159 if (player->actionRatingCombo > 2) {
2160 player->actionRatingCombo = 2;
2161 }
2162 break;
2163 }
2164 actor->attackResultEffect = fx_attack_result_text(type, x, y, z - 10.0f, 12.0f, 90);
2165 actor->actionRatingTime = 80;
2166 }
2167}
struct AttackResultTextFXData * attackResultText
Definition effects.h:2536
@ ACTION_RATING_SUPER
sets nice hits = 2
Definition enums.h:2008
@ ACTION_RATING_NICE_SUPER_COMBO
'Nice' but becomes 'Super' if nice hits > 2
Definition enums.h:2010
@ ACTION_RATING_NICE_NO_COMBO
clears nice hits
Definition enums.h:2009
@ ACTION_RATING_MISS
clears nice hits
Definition enums.h:2006
@ ACTION_RATING_LUCKY
clears nice hits
Definition enums.h:2007
@ ACTION_RATING_NICE
sets nice hits = 1
Definition enums.h:2005

Referenced by calc_enemy_damage_target(), calc_item_damage_enemy(), calc_partner_damage_enemy(), and calc_player_damage_enemy().

◆ cancel_action_rating_combo()

void cancel_action_rating_combo ( Actor * target)

Definition at line 2169 of file 190B20.c.

2169 {
2170 target->actionRatingCombo = 0;
2171}

Referenced by calc_enemy_damage_target(), calc_item_damage_enemy(), calc_partner_damage_enemy(), and calc_player_damage_enemy().

◆ update_action_ratings()

void update_action_ratings ( void )

Definition at line 2173 of file 190B20.c.

2173 {
2175 Actor* actor;
2176 s32 i;
2177
2178 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
2179 actor = gBattleStatus.enemyActors[i];
2180 if (actor != nullptr) {
2181 if (actor->actionRatingTime == 60) {
2182 if (actor->attackResultEffect != nullptr) {
2184 }
2185 }
2186 if (actor->actionRatingTime == 5) {
2187 if (actor->attackResultEffect != nullptr) {
2189 actor->attackResultEffect = nullptr;
2190 }
2191 }
2192 if (actor->actionRatingTime > 0) {
2193 actor->actionRatingTime--;
2194 }
2195 }
2196 }
2197
2198 actor = battleStatus->playerActor;
2199 if (actor != nullptr) {
2200 if (actor->actionRatingTime == 60) {
2201 if (actor->attackResultEffect != nullptr) {
2203 }
2204 }
2205 if (actor->actionRatingTime == 5) {
2206 if (actor->attackResultEffect != nullptr) {
2208 actor->attackResultEffect = nullptr;
2209 }
2210 }
2211 if (actor->actionRatingTime > 0) {
2212 actor->actionRatingTime--;
2213 }
2214 }
2215
2216 actor = battleStatus->partnerActor;
2217 if (actor != nullptr) {
2218 if (actor->actionRatingTime == 60) {
2219 if (actor->attackResultEffect != nullptr) {
2221 }
2222 }
2223 if (actor->actionRatingTime == 5) {
2224 if (actor->attackResultEffect != nullptr) {
2226 actor->attackResultEffect = nullptr;
2227 }
2228 }
2229 if (actor->actionRatingTime > 0) {
2230 actor->actionRatingTime--;
2231 }
2232 }
2233}
struct Actor * enemyActors[24]

Referenced by btl_update().

◆ show_actor_health_bar()

void show_actor_health_bar ( Actor * target)

Definition at line 2235 of file 190B20.c.

2235 {
2236 target->healthBarHideTime = -1;
2238}
@ ACTOR_FLAG_HEALTH_BAR_HIDDEN
Definition enums.h:3372

Referenced by calc_enemy_damage_target(), calc_item_damage_enemy(), calc_partner_damage_enemy(), and calc_player_damage_enemy().

◆ hide_actor_health_bar()

void hide_actor_health_bar ( Actor * target)

Definition at line 2240 of file 190B20.c.

2240 {
2241 target->healthBarHideTime = 0;
2243}

◆ update_health_bars()

void update_health_bars ( void )

Definition at line 2245 of file 190B20.c.

2245 {
2246 s32 i;
2247
2248 for (i = 0; i < ARRAY_COUNT(gBattleStatus.enemyActors); i++) {
2249 Actor* enemy = gBattleStatus.enemyActors[i];
2250
2251 if (enemy != nullptr) {
2252 if (enemy->healthBarHideTime > 0) {
2253 enemy->healthBarHideTime--;
2254 if (enemy->healthBarHideTime == 0) {
2256 }
2257 }
2258 }
2259 }
2260}

Referenced by btl_update().

◆ try_inflict_status()

s32 try_inflict_status ( Actor * actor,
s32 statusTypeKey,
s32 statusTurnsKey )

Definition at line 2262 of file 190B20.c.

2262 {
2264 s32 chance;
2265 s32 duration;
2266
2267 if (battleStatus->statusChance == STATUS_KEY_IGNORE_RES) {
2268 duration = battleStatus->statusDuration;
2271 }
2272
2273 duration = 0;
2274
2275 if (actor->statusTable != nullptr) {
2276 if (!(battleStatus->curAttackStatus & STATUS_FLAG_RIGHT_ON)) {
2278 } else {
2280 if (chance != 0) {
2281 chance = 100;
2282 }
2283 }
2284
2285 if (chance > 0) {
2286 chance = (chance * battleStatus->statusChance) / 100;
2287 if (chance > 0 && chance >= rand_int(100)) {
2288 duration = 3;
2290 }
2291 }
2292 } else {
2293 duration = 3;
2294 }
2295
2296 if (duration > 0) {
2297 if (battleStatus->curAttackStatus & STATUS_FLAG_USE_DURATION) {
2298 duration = battleStatus->statusDuration;
2300 inflict_status(actor, statusTypeKey, duration);
2301 } else {
2302 inflict_status(actor, statusTypeKey, duration);
2303
2304 }
2305 } else {
2306 duration = 0;
2307 }
2308 return duration;
2309}
s32 lookup_status_duration_mod(s32 *statusTable, s32 statusKey)
Definition 190B20.c:1795
s32 inflict_status_set_duration(Actor *actor, s32 statusTypeKey, s32 statusDurationKey, s32 duration)
Definition 190B20.c:2311
s32 lookup_status_chance(s32 *statusTable, s32 statusKey)
Definition 190B20.c:1776
#define rand_int
@ STATUS_FLAG_RIGHT_ON
Definition enums.h:2863
@ STATUS_FLAG_USE_DURATION
Definition enums.h:2864
#define STATUS_KEY_IGNORE_RES
Definition macros.h:233

Referenced by calc_enemy_damage_target(), calc_item_damage_enemy(), calc_partner_damage_enemy(), and calc_player_damage_enemy().

◆ inflict_status_set_duration()

s32 inflict_status_set_duration ( Actor * actor,
s32 statusTypeKey,
s32 statusDurationKey,
s32 duration )

Definition at line 2311 of file 190B20.c.

2311 {
2312 s32 statusDuration = 0;
2313
2314 if (actor->statusTable == nullptr || lookup_status_chance(actor->statusTable, statusTypeKey) > 0) {
2315 statusDuration = duration;
2316 }
2317
2318 if (statusDuration > 0) {
2319 return inflict_status(actor, statusTypeKey, statusDuration);
2320 } else {
2321 return 0;
2322 }
2323}

Referenced by btl_state_update_normal_start(), and try_inflict_status().

◆ set_part_pal_adjustment()

void set_part_pal_adjustment ( ActorPart * part,
s32 palAdjust )

Definition at line 2325 of file 190B20.c.

2325 {
2326 if (part->idleAnimations != nullptr && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
2327 DecorationTable* decorations = part->decorationTable;
2328
2329 if (decorations->paletteAdjustment != palAdjust) {
2330 decorations->paletteAdjustment = palAdjust;
2331 decorations->palAnimState = 0;
2332 decorations->resetPalAdjust = true;
2333 }
2334 }
2335}

Referenced by set_actor_pal_adjustment().

◆ clear_part_pal_adjustment()

void clear_part_pal_adjustment ( ActorPart * part)

Definition at line 2348 of file 190B20.c.

2348 {
2349 if (part->idleAnimations != nullptr && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
2350 part->decorationTable->paletteAdjustment = ACTOR_PAL_ADJUST_NONE;
2351 }
2352}

Referenced by calc_enemy_damage_target(), calc_partner_damage_enemy(), and calc_player_damage_enemy().

◆ clear_actor_static_pal_adjustments()

void clear_actor_static_pal_adjustments ( Actor * actor)

Definition at line 2354 of file 190B20.c.

2354 {
2355 for (ActorPart* part = actor->partsTable; part != nullptr; part = part->nextPart) {
2356 DecorationTable* decorations = part->decorationTable;
2357
2359 && !(part->flags & ACTOR_PART_FLAG_INVISIBLE)
2360 && (part->idleAnimations != nullptr)
2362 ) {
2365 ) {
2367 }
2368 }
2369 }
2370}
@ ACTOR_PAL_ADJUST_BLEND_PALETTES_VARYING_INTERVALS
Definition enums.h:2239
@ ACTOR_PAL_ADJUST_BLEND_PALETTES_UNIFORM_INTERVALS
Definition enums.h:2238

◆ set_part_glow_pal()

void set_part_glow_pal ( ActorPart * part,
s32 glowState )

Definition at line 2372 of file 190B20.c.

2372 {
2373 if (part->idleAnimations != nullptr && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
2374 DecorationTable* decorations = part->decorationTable;
2375
2376 if (decorations->glowState != glowState) {
2377 decorations->glowState = glowState;
2378 decorations->glowUnk1 = 0;
2379 decorations->glowStateChanged = true;
2380 }
2381 }
2382}

Referenced by set_actor_glow_pal().

◆ set_actor_glow_pal()

void set_actor_glow_pal ( Actor * actor,
s32 glowState )

Definition at line 2384 of file 190B20.c.

2384 {
2385 for (ActorPart* part = actor->partsTable; part != nullptr; part = part->nextPart) {
2387 && (part->idleAnimations != nullptr)
2389 ) {
2390 set_part_glow_pal(part, glowState);
2391 }
2392 }
2393}
void set_part_glow_pal(ActorPart *part, s32 glowState)
Definition 190B20.c:2372

Referenced by appendGfx_npc_actor(), appendGfx_player_actor(), and btl_delete_actor().

◆ clear_part_glow_pal()

void clear_part_glow_pal ( ActorPart * part)

Definition at line 2395 of file 190B20.c.

2395 {
2396 if (part->idleAnimations != nullptr && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
2397 part->decorationTable->glowState = GLOW_PAL_OFF;
2398 }
2399}

◆ clear_actor_glow_pal()

void clear_actor_glow_pal ( Actor * actor)

Definition at line 2401 of file 190B20.c.

2401 {
2402 for (ActorPart* part = actor->partsTable; part != nullptr; part = part->nextPart) {
2403 DecorationTable* decorations = part->decorationTable;
2404
2406 && part->idleAnimations != nullptr
2408 ) {
2409 decorations->glowState = GLOW_PAL_OFF;
2410 }
2411 }
2412}

◆ set_part_flash_mode()

void set_part_flash_mode ( ActorPart * part,
s32 flashState )

Definition at line 2414 of file 190B20.c.

2414 {
2415 if (part->idleAnimations != nullptr && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
2416 DecorationTable* decorations = part->decorationTable;
2417
2418 if (decorations->flashState != flashState) {
2419 decorations->flashState = flashState;
2420 decorations->flashMode = FLASH_MODE_LIGHT;
2421 decorations->flashStateChanged = true;
2422 }
2423 }
2424}
@ FLASH_MODE_LIGHT
Definition enums.h:2249

Referenced by set_actor_flash_mode().

◆ set_actor_flash_mode()

void set_actor_flash_mode ( Actor * actor,
s32 flashState )

Definition at line 2426 of file 190B20.c.

2426 {
2427 for (ActorPart* part = actor->partsTable; part != nullptr; part = part->nextPart) {
2429 && part->decorationTable != nullptr
2431 && part->idleAnimations != nullptr
2432 ) {
2433 set_part_flash_mode(part, flashState);
2434 }
2435 }
2436}
void set_part_flash_mode(ActorPart *part, s32 flashState)
Definition 190B20.c:2414

Referenced by calc_enemy_damage_target(), calc_item_damage_enemy(), calc_partner_damage_enemy(), calc_player_damage_enemy(), dispatch_damage_event_actor(), dispatch_damage_event_partner(), and dispatch_damage_event_player().

◆ clear_part_flash_mode()

void clear_part_flash_mode ( ActorPart * part)

Definition at line 2438 of file 190B20.c.

2438 {
2439 if (part->idleAnimations != nullptr && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
2440 part->decorationTable->flashState = 0;
2441 }
2442}

Referenced by part_flash_on().

◆ clear_actor_flash_mode()

void clear_actor_flash_mode ( Actor * actor)

Definition at line 2444 of file 190B20.c.

2444 {
2445 for (ActorPart* part = actor->partsTable; part != nullptr; part = part->nextPart) {
2446 DecorationTable* decorations = part->decorationTable;
2447
2449 && (part->idleAnimations != nullptr)
2451 ) {
2452 decorations->flashState = 0;
2453 }
2454 }
2455}

◆ add_part_decoration()

void add_part_decoration ( ActorPart * part,
s32 decorationIndex,
s32 decorationType )

Definition at line 2457 of file 190B20.c.

2457 {
2458 if ((part->idleAnimations) && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
2459 DecorationTable* decorations = part->decorationTable;
2460
2462 decorations->type[decorationIndex] = decorationType;
2463 decorations->changed[decorationIndex] = true;
2464 decorations->state[decorationIndex] = 0;
2466 }
2467}
void _remove_part_decoration(ActorPart *part, s32 decorationIndex)
void _add_part_decoration(ActorPart *)

Referenced by add_actor_decoration().

◆ add_actor_decoration()

void add_actor_decoration ( Actor * actor,
s32 decorationIndex,
s32 decorationType )

Definition at line 2469 of file 190B20.c.

2469 {
2470 for (ActorPart* part = actor->partsTable; part != nullptr; part = part->nextPart) {
2472 && part->idleAnimations
2474 ) {
2475 add_part_decoration(part, decorationIndex, decorationType);
2476 }
2477 }
2478}
void add_part_decoration(ActorPart *part, s32 decorationIndex, s32 decorationType)
Definition 190B20.c:2457

◆ remove_part_decoration()

void remove_part_decoration ( ActorPart * part,
s32 decorationIndex )

Definition at line 2480 of file 190B20.c.

Referenced by remove_actor_decoration().

◆ remove_actor_decoration()

void remove_actor_decoration ( Actor * actor,
s32 decorationIndex )

Definition at line 2484 of file 190B20.c.

2484 {
2485 for (ActorPart* part = actor->partsTable; part != nullptr; part = part->nextPart) {
2487 && part->idleAnimations != nullptr
2489 ) {
2491 }
2492 }
2493}
void remove_part_decoration(ActorPart *part, s32 decorationIndex)
Definition 190B20.c:2480

Referenced by btl_delete_actor(), and btl_delete_player_actor().

◆ player_team_is_ability_active()

◆ create_part_shadow()

void create_part_shadow ( s32 actorID,
s32 partID )

Definition at line 2515 of file 190B20.c.

2515 {
2516 ActorPart* part = get_actor_part(get_actor(actorID), partID);
2517
2519 part->shadowIndex = create_shadow_type(SHADOW_VARYING_CIRCLE, part->curPos.x, part->curPos.y, part->curPos.z);
2520 part->shadowScale = part->size.x / 24.0;
2521}

◆ remove_part_shadow()

void remove_part_shadow ( s32 actorID,
s32 partID )

Definition at line 2523 of file 190B20.c.

2523 {
2524 ActorPart* part = get_actor_part(get_actor(actorID), partID);
2525
2527 delete_shadow(part->shadowIndex);
2528}
void delete_shadow(s32)
Definition entity.c:626

◆ create_part_shadow_by_ref()

void create_part_shadow_by_ref ( UNK_TYPE arg0,
ActorPart * part )

Definition at line 2530 of file 190B20.c.

2530 {
2532 part->shadowIndex = create_shadow_type(SHADOW_VARYING_CIRCLE, part->curPos.x, part->curPos.y, part->curPos.z);
2533 part->shadowScale = part->size.x / 24.0;
2534}

◆ remove_player_buffs()

void remove_player_buffs ( s32 buffs)

Definition at line 2536 of file 190B20.c.

2536 {
2538 Actor* player = battleStatus->playerActor;
2539 Actor* partner = battleStatus->partnerActor;
2541
2543 battleStatus->jumpCharge = 0;
2545 }
2547 battleStatus->hammerCharge = 0;
2549 }
2550 if (buffs & PLAYER_BUFF_STONE) {
2551 player->stoneDuration = 0;
2552 player->stoneStatus = 0;
2553 }
2554 if (buffs & PLAYER_BUFF_HUSTLE) {
2555 battleStatus->hustleTurns = 0;
2557 }
2558 if ((buffs & PLAYER_BUFF_STATIC) && (player->staticStatus != 0)) {
2559 player->staticDuration = 0;
2560 player->staticStatus = 0;
2562 }
2563 if ((buffs & PLAYER_BUFF_TRANSPARENT) && (player->transparentStatus != 0)) {
2564 player->transparentDuration = 0;
2565 player->transparentStatus = 0;
2568 }
2569 if ((buffs & PLAYER_BUFF_WATER_BLOCK) && (battleStatus->waterBlockTurnsLeft != 0)) {
2570 battleStatus->waterBlockTurnsLeft = 0;
2571 battleStatus->buffEffect->data.partnerBuff->unk_0C[FX_BUFF_DATA_WATER_BLOCK].turnsLeft = 0;
2572 battleStatus->waterBlockEffect->flags |= FX_INSTANCE_FLAG_DISMISS;
2573
2574 fx_water_block(FX_WATER_BLOCK_DESTROY, player->curPos.x, player->curPos.y + 18.0f, player->curPos.z + 5.0f, 1.5f, 10);
2575 fx_water_splash(0, player->curPos.x - 10.0f, player->curPos.y + 5.0f, player->curPos.z + 5.0f, 1.0f, 24);
2576 fx_water_splash(0, player->curPos.x - 15.0f, player->curPos.y + 32.0f, player->curPos.z + 5.0f, 1.0f, 24);
2577 fx_water_splash(1, player->curPos.x + 15.0f, player->curPos.y + 22.0f, player->curPos.z + 5.0f, 1.0f, 24);
2578
2579 battleStatus->waterBlockEffect = nullptr;
2581 }
2582 if ((buffs & PLAYER_BUFF_TURBO_CHARGE) && (battleStatus->turboChargeTurnsLeft != 0)) {
2583 battleStatus->turboChargeTurnsLeft = 0;
2584 battleStatus->buffEffect->data.partnerBuff->unk_0C[FX_BUFF_DATA_TURBO_CHARGE].turnsLeft = 0;
2585 }
2586 if ((buffs & PLAYER_BUFF_CLOUD_NINE) && (battleStatus->cloudNineTurnsLeft != 0)) {
2587 battleStatus->cloudNineTurnsLeft = 0;
2588 battleStatus->buffEffect->data.partnerBuff->unk_0C[FX_BUFF_DATA_CLOUD_NINE].turnsLeft = 0;
2589 remove_effect(battleStatus->cloudNineEffect);
2590 battleStatus->cloudNineEffect = nullptr;
2591 }
2592
2593 if (partner != nullptr && (buffs & PLAYER_BUFF_PARTNER_GLOWING)) {
2594 partner->isGlowing = false;
2596 }
2597}
#define remove_effect
@ FX_WATER_BLOCK_DESTROY
Definition effects.h:1540
@ FX_BUFF_DATA_TURBO_CHARGE
Definition effects.h:2320
@ FX_BUFF_DATA_CLOUD_NINE
Definition effects.h:2319
@ FX_BUFF_DATA_WATER_BLOCK
Definition effects.h:2318
@ PLAYER_BUFF_PARTNER_GLOWING
Definition enums.h:2795
@ PLAYER_BUFF_JUMP_CHARGE
Definition enums.h:2786
@ PLAYER_BUFF_WATER_BLOCK
Definition enums.h:2794
@ PLAYER_BUFF_STONE
Definition enums.h:2788
@ PLAYER_BUFF_TURBO_CHARGE
Definition enums.h:2793
@ PLAYER_BUFF_CLOUD_NINE
Definition enums.h:2792
@ PLAYER_BUFF_TRANSPARENT
Definition enums.h:2791
@ PLAYER_BUFF_STATIC
Definition enums.h:2790
@ PLAYER_BUFF_HAMMER_CHARGE
Definition enums.h:2787
@ PLAYER_BUFF_HUSTLE
Definition enums.h:2789
@ SOUND_DESTROY_WATER_BLOCK
Definition enums.h:1018
void remove_status_static(s32)
void remove_status_transparent(s32)

◆ btl_update_ko_status()

void btl_update_ko_status ( void )

Definition at line 2599 of file 190B20.c.

2599 {
2601 Actor* player = battleStatus->playerActor;
2602 Actor* partner = battleStatus->partnerActor;
2603 s32 koDuration = player->koDuration;
2604 s32 i;
2605
2606 player->koDuration = player->debuffDuration;
2607 if (player->koDuration > 0) {
2608 player->koStatus = STATUS_KEY_KO;
2609 player->disableEffect->data.disableX->koDuration = player->koDuration;
2610
2611 if (koDuration == 0) {
2613 }
2614 }
2615
2616 if (partner != nullptr) {
2617 if (partner->koDuration < partner->debuffDuration) {
2618 partner->koStatus = STATUS_KEY_KO;
2619 partner->koDuration = partner->debuffDuration;
2620 }
2621
2622 if (partner->koDuration > 0) {
2623 partner->koStatus = STATUS_KEY_KO;
2624 partner->disableEffect->data.disableX->koDuration = partner->koDuration;
2625 }
2626 }
2627
2628 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
2629 Actor* enemy = battleStatus->enemyActors[i];
2630
2631 if (enemy != nullptr) {
2632 enemy->koDuration = enemy->debuffDuration;
2633 if (enemy->koDuration > 0) {
2634 enemy->koStatus = STATUS_KEY_KO;
2636 }
2637 }
2638 }
2639}

Referenced by btl_state_update_enemy_move(), btl_state_update_partner_move(), and btl_state_update_player_move().

◆ btl_appendGfx_prim_quad()

void btl_appendGfx_prim_quad ( u8 r,
u8 g,
u8 b,
u8 a,
u16 left,
u16 top,
u16 right,
u16 bottom )

◆ btl_draw_prim_quad()

void btl_draw_prim_quad ( u8 r,
u8 g,
u8 b,
u8 a,
u16 left,
u16 top,
u16 arg6,
u16 arg7 )

Definition at line 2661 of file 190B20.c.

2661 {
2662 u16 right = left + arg6;
2663 u16 bottom = top + arg7;
2664
2666}
void btl_appendGfx_prim_quad(u8 r, u8 g, u8 b, u8 a, u16 left, u16 top, u16 right, u16 bottom)
Definition 190B20.c:2641

Referenced by btl_draw_enemy_health_bars(), and btl_main_menu_draw().

◆ reset_all_actor_sounds()

void reset_all_actor_sounds ( Actor * actor)

Definition at line 2668 of file 190B20.c.

2668 {
2669 ActorPart* partIt = &actor->partsTable[0];
2670
2671 actor->actorTypeData1[0] = bActorSoundTable[actor->actorType].walk[0];
2672 actor->actorTypeData1[1] = bActorSoundTable[actor->actorType].walk[1];
2673 actor->actorTypeData1[2] = bActorSoundTable[actor->actorType].fly[0];
2674 actor->actorTypeData1[3] = bActorSoundTable[actor->actorType].fly[1];
2675 actor->actorTypeData1[4] = bActorSoundTable[actor->actorType].jump;
2676 actor->actorTypeData1[5] = bActorSoundTable[actor->actorType].hurt;
2677 actor->actorTypeData1b[0] = bActorSoundTable[actor->actorType].delay[0];
2678 actor->actorTypeData1b[1] = bActorSoundTable[actor->actorType].delay[1];
2679
2680 while (partIt != nullptr) {
2681 partIt->partTypeData[0] = actor->actorTypeData1[0];
2682 partIt->partTypeData[1] = actor->actorTypeData1[1];
2683 partIt->partTypeData[2] = actor->actorTypeData1[2];
2684 partIt->partTypeData[3] = actor->actorTypeData1[3];
2685 partIt->partTypeData[4] = actor->actorTypeData1[4];
2686 partIt->partTypeData[5] = actor->actorTypeData1[5];
2687 partIt->actorTypeData2b[0] = actor->actorTypeData1b[0];
2688 partIt->actorTypeData2b[1] = actor->actorTypeData1b[1];
2689 partIt = partIt->nextPart;
2690 }
2691}

Referenced by btl_state_update_enemy_move(), btl_state_update_partner_move(), and btl_state_update_player_move().

◆ hide_foreground_models_unchecked()

void hide_foreground_models_unchecked ( void )

Definition at line 2693 of file 190B20.c.

2693 {
2694 Stage* stage = gBattleStatus.curStage;
2695
2696 if (stage != nullptr && stage->foregroundModelList != nullptr) {
2697 s32* idList = stage->foregroundModelList;
2698 while (*idList != STAGE_MODEL_LIST_END) {
2699 s32 id = *idList++;
2700 if (id >= 0) {
2702 model->flags |= MODEL_FLAG_HIDDEN;
2703 }
2704 }
2705 }
2706}
@ MODEL_FLAG_HIDDEN
Definition enums.h:3943
s32 get_model_list_index_from_tree_index(s32 treeIndex)
Definition model.c:3393
struct Model * get_model_from_list_index(s32 listIndex)
Definition model.c:3312
Definition model.h:59
s32 * foregroundModelList
Definition battle.h:188
#define STAGE_MODEL_LIST_END
Definition battle.h:8
struct Stage * curStage

Referenced by tattle_cam_pre_render().

◆ show_foreground_models_unchecked()

void show_foreground_models_unchecked ( void )

Definition at line 2708 of file 190B20.c.

2708 {
2709 Stage* stage = gBattleStatus.curStage;
2710
2711 if (stage != nullptr && stage->foregroundModelList != nullptr) {
2712 s32* idList = stage->foregroundModelList;
2713 while (*idList != STAGE_MODEL_LIST_END) {
2714 s32 id = *idList++;
2715 if (id >= 0) {
2717 model->flags &= ~MODEL_FLAG_HIDDEN;
2718 }
2719 }
2720 }
2721}

Referenced by tattle_cam_post_render().

◆ hide_foreground_models()

void hide_foreground_models ( void )

Definition at line 2723 of file 190B20.c.

2723 {
2724 Stage* stage = gBattleStatus.curStage;
2725
2726 if (stage != nullptr && stage->foregroundModelList != nullptr) {
2727 s32* idList = stage->foregroundModelList;
2728 while (*idList != STAGE_MODEL_LIST_END) {
2729 s32 id = *idList++;
2730 if (id < 0) {
2731 break;
2732 } else {
2734 model->flags |= MODEL_FLAG_HIDDEN;
2735 }
2736
2737 }
2738 }
2739}

◆ show_foreground_models()

void show_foreground_models ( void )

Definition at line 2741 of file 190B20.c.

2741 {
2742 Stage* stage = gBattleStatus.curStage;
2743
2744 if (stage != nullptr && stage->foregroundModelList != nullptr) {
2745 s32* idList = stage->foregroundModelList;
2746 while (*idList != STAGE_MODEL_LIST_END) {
2747 s32 id = *idList++;
2748 if (id < 0) {
2749 break;
2750 } else {
2752 model->flags &= ~MODEL_FLAG_HIDDEN;
2753 }
2754 }
2755 }
2756}

◆ start_rumble_type()

void start_rumble_type ( u32 type)

Definition at line 2828 of file 190B20.c.

2828 {
2829 if (bCurRumbleScript != 0) {
2831 }
2832
2833 switch (type) {
2834 case BTL_RUMBLE_STOP:
2835 break;
2836 case BTL_RUMBLE_LONG:
2838 break;
2839 case BTL_RUMBLE_HIT_MIN:
2841 break;
2844 break;
2847 break;
2850 break;
2851 case BTL_RUMBLE_HIT_MAX:
2853 break;
2860 break;
2861 }
2862}
EvtScript EVS_BattleRumble_Long
Definition 190B20.c:2760
EvtScript EVS_BattleRumble_HitLight
Definition 190B20.c:2774
EvtScript EVS_BattleRumble_PlayerMin
Definition 190B20.c:2798
EvtScript EVS_BattleRumble_HitHeavy
Definition 190B20.c:2780
EvtScript EVS_BattleRumble_HitMin
Definition 190B20.c:2768
EvtScript EVS_BattleRumble_HitMax
Definition 190B20.c:2792
EvtScript EVS_BattleRumble_HitExtreme
Definition 190B20.c:2786
s32 bCurRumbleScript
Definition 190B20.c:44
@ BTL_RUMBLE_PLAYER_MIN
Definition enums.h:3858
@ BTL_RUMBLE_HIT_HEAVY
Definition enums.h:3855
@ BTL_RUMBLE_STOP
Definition enums.h:3851
@ BTL_RUMBLE_PLAYER_HEAVY
Definition enums.h:3860
@ BTL_RUMBLE_HIT_MIN
Definition enums.h:3853
@ BTL_RUMBLE_HIT_LIGHT
Definition enums.h:3854
@ BTL_RUMBLE_PLAYER_MAX
Definition enums.h:3862
@ BTL_RUMBLE_PLAYER_EXTREME
Definition enums.h:3861
@ BTL_RUMBLE_HIT_MAX
Definition enums.h:3857
@ BTL_RUMBLE_HIT_EXTREME
Definition enums.h:3856
@ BTL_RUMBLE_LONG
Definition enums.h:3852
@ BTL_RUMBLE_PLAYER_LIGHT
Definition enums.h:3859
@ EVT_FLAG_RUN_IMMEDIATELY
don't wait for next update_scripts call
Definition evt.h:162
void kill_script_by_ID(s32 id)

Variable Documentation

◆ D_802938A4

f32 D_802938A4 = 0.0f

Definition at line 9 of file 190B20.c.

Referenced by play_movement_dust_effects().

◆ D_802938A8

s16 D_802938A8 = 4

Definition at line 11 of file 190B20.c.

Referenced by play_movement_dust_effects().

◆ gDamageCountEffects

EffectInstance* gDamageCountEffects[]
Initial value:
= {
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr,
}

Definition at line 13 of file 190B20.c.

13 {
14 nullptr, nullptr, nullptr, nullptr,
15 nullptr, nullptr, nullptr, nullptr,
16 nullptr, nullptr, nullptr, nullptr,
17 nullptr, nullptr, nullptr, nullptr,
18 nullptr, nullptr, nullptr, nullptr,
19 nullptr, nullptr, nullptr, nullptr,
20};

Referenced by show_next_damage_popup(), show_primary_damage_popup(), and update_damage_popups().

◆ gDamageCountTimers

s32 gDamageCountTimers[]
Initial value:
= {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
}

Definition at line 22 of file 190B20.c.

22 {
23 0, 0, 0, 0,
24 0, 0, 0, 0,
25 0, 0, 0, 0,
26 0, 0, 0, 0,
27 0, 0, 0, 0,
28 0, 0, 0, 0,
29};

Referenced by show_next_damage_popup(), show_primary_damage_popup(), and update_damage_popups().

◆ D_80293970

◆ bCurRumbleScript

s32 bCurRumbleScript = 0

Definition at line 44 of file 190B20.c.

Referenced by start_rumble_type().

◆ bMarioDefenseTable

s32 bMarioDefenseTable[]
extern

Definition at line 105 of file actors.c.

105 {
108};

Referenced by load_player_actor().

◆ bPlayerStatusTable

s32 bPlayerStatusTable[]
extern

Definition at line 110 of file actors.c.

110 {
113 STATUS_KEY_SLEEP, 100,
116 STATUS_KEY_DIZZY, 100,
121 STATUS_KEY_STOP, 100,
133};
@ STATUS_TURN_MOD_PARALYZE
Definition enums.h:2839
@ STATUS_TURN_MOD_SLEEP
Definition enums.h:2833
@ STATUS_TURN_MOD_DIZZY
Definition enums.h:2837
@ STATUS_TURN_MOD_UNUSED
Definition enums.h:2836
@ STATUS_TURN_MOD_POISON
Definition enums.h:2838
@ STATUS_TURN_MOD_STOP
Definition enums.h:2842
@ STATUS_TURN_MOD_FROZEN
Definition enums.h:2835
@ STATUS_TURN_MOD_STATIC
Definition enums.h:2834
@ STATUS_TURN_MOD_SHRINK
Definition enums.h:2840

Referenced by load_player_actor().

◆ bPlayerActorBlueprint

ActorBlueprint bPlayerActorBlueprint
extern

Definition at line 135 of file actors.c.

135 {
136 .type = ACTOR_TYPE_PLAYER,
137 .maxHP = 99,
138 .statusTable = bPlayerStatusTable,
139
140 .escapeChance = 0,
141 .airLiftChance = 0,
142 .hurricaneChance = 0,
143 .spookChance = 0,
144 .upAndAwayChance = 0,
145 .spinSmashReq = 4,
146 .powerBounceChance = 80,
147
148 .size = { 33, 43 },
149 .healthBarOffset = { 0, 0 },
150 .statusIconOffset = { -10, 30 },
151 .statusTextOffset = { 10, 30 },
152};
s32 bPlayerStatusTable[]
Definition actors.c:110

Referenced by load_player_actor().

◆ bMarioParts

ActorPartBlueprint bMarioParts[]
extern

Definition at line 154 of file actors.c.

154 {
155 {
156 .index = 1,
157 .posOffset = { 0, 0, 0 },
158 .targetOffset = { 0, 32 },
159 .opacity = 255,
160 .idleAnimations = bMarioIdleAnims,
161 .defenseTable = bMarioDefenseTable,
162 },
163};
s32 bMarioDefenseTable[]
Definition actors.c:105
u32 bMarioIdleAnims[]
Definition actors.c:30

Referenced by load_player_actor().

◆ bPartnerDmaTable

PartnerDMAData bPartnerDmaTable[]
extern

Definition at line 26 of file partner_dma.c.

Referenced by load_partner_actor().

◆ EVS_BattleRumble_Long

EvtScript EVS_BattleRumble_Long
Initial value:
= {
}
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:214
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:577
#define Return
Kills the current EVT thread.
Definition macros.h:218

Definition at line 2760 of file 190B20.c.

2760 {
2761 Call(N(StartRumbleWithParams), 256, 30)
2762 Call(N(StartRumbleWithParams), 200, 15)
2763 Call(N(StartRumbleWithParams), 50, 15)
2764 Return
2765 End
2766};

Referenced by start_rumble_type().

◆ EVS_BattleRumble_HitMin

EvtScript EVS_BattleRumble_HitMin
Initial value:
= {
}

Definition at line 2768 of file 190B20.c.

2768 {
2769 Call(N(StartRumbleWithParams), 100, 20)
2770 Return
2771 End
2772};

Referenced by start_rumble_type().

◆ EVS_BattleRumble_HitLight

EvtScript EVS_BattleRumble_HitLight
Initial value:
= {
}

Definition at line 2774 of file 190B20.c.

2774 {
2775 Call(N(StartRumbleWithParams), 150, 20)
2776 Return
2777 End
2778};

Referenced by start_rumble_type().

◆ EVS_BattleRumble_HitHeavy

EvtScript EVS_BattleRumble_HitHeavy
Initial value:
= {
}

Definition at line 2780 of file 190B20.c.

2780 {
2781 Call(N(StartRumbleWithParams), 200, 30)
2782 Return
2783 End
2784};

Referenced by start_rumble_type().

◆ EVS_BattleRumble_HitExtreme

EvtScript EVS_BattleRumble_HitExtreme
Initial value:
= {
}

Definition at line 2786 of file 190B20.c.

2786 {
2787 Call(N(StartRumbleWithParams), 256, 40)
2788 Return
2789 End
2790};

Referenced by start_rumble_type().

◆ EVS_BattleRumble_HitMax

EvtScript EVS_BattleRumble_HitMax
Initial value:
= {
}

Definition at line 2792 of file 190B20.c.

2792 {
2793 Call(N(StartRumbleWithParams), 256, 60)
2794 Return
2795 End
2796};

Referenced by start_rumble_type().

◆ EVS_BattleRumble_PlayerMin

EvtScript EVS_BattleRumble_PlayerMin
Initial value:
= {
}

Definition at line 2798 of file 190B20.c.

2798 {
2799 Call(N(StartRumbleWithParams), 100, 20)
2800 Return
2801 End
2802};

Referenced by start_rumble_type().

◆ EVS_BattleRumble_PlayerLight

EvtScript EVS_BattleRumble_PlayerLight
Initial value:
= {
}

Definition at line 2804 of file 190B20.c.

2804 {
2805 Call(N(StartRumbleWithParams), 150, 20)
2806 Return
2807 End
2808};

◆ EVS_BattleRumble_PlayerHeavy

EvtScript EVS_BattleRumble_PlayerHeavy
Initial value:
= {
}

Definition at line 2810 of file 190B20.c.

2810 {
2811 Call(N(StartRumbleWithParams), 200, 30)
2812 Return
2813 End
2814};

◆ EVS_BattleRumble_PlayerExtreme

EvtScript EVS_BattleRumble_PlayerExtreme
Initial value:
= {
}

Definition at line 2816 of file 190B20.c.

2816 {
2817 Call(N(StartRumbleWithParams), 256, 40)
2818 Return
2819 End
2820};

◆ EVS_BattleRumble_PlayerMax

EvtScript EVS_BattleRumble_PlayerMax
Initial value:
= {
}

Definition at line 2822 of file 190B20.c.

2822 {
2823 Call(N(StartRumbleWithParams), 256, 60)
2824 Return
2825 End
2826};