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)
 
void btl_init_menu_boots (void)
 
void btl_init_menu_hammer (void)
 
void btl_init_menu_partner (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 func_80266970 (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 statusKey)
 
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:
if (elementFlags & DAMAGE_TYPE_##element) { \
elemDefense = lookup_defense(defenseTable, ELEMENT_##element); \
if (elemDefense < minDefense) { \
minDefense = elemDefense; \
} \
} \
s32 lookup_defense(s32 *defenseTable, s32 elementKey)
Definition 190B20.c:2027

Function Documentation

◆ get_npc_anim_for_status()

s32 get_npc_anim_for_status ( AnimID * animations,
s32 statusKey )

Definition at line 1944 of file 190B20.c.

1944 {
1945 AnimID foundAnim;
1946
1947 if (animations == NULL) {
1948 return 0;
1949 }
1950
1951 foundAnim = 0;
1952 while (animations[DICTIONARY_KEY] != NULL) {
1953 if (animations[DICTIONARY_KEY] == STATUS_KEY_NORMAL) {
1954 foundAnim = animations[DICTIONARY_VALUE];
1955 }
1956 if (animations[DICTIONARY_KEY] == statusKey) {
1957 foundAnim = animations[DICTIONARY_VALUE];
1958 break;
1959 }
1960 animations += DICTIONARY_SIZE;
1961 }
1962 return foundAnim;
1963}
u32 AnimID
@ STATUS_KEY_NORMAL
Definition enums.h:2197
@ DICTIONARY_KEY
Definition enums.h:5234
@ DICTIONARY_SIZE
Definition enums.h:5236
@ DICTIONARY_VALUE
Definition enums.h:5235

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;
58 BattleStatus* battleStatus = &gBattleStatus;
59 SelectableTarget* targetDataList = actor->targetData;
60 Actor* playerActor = battleStatus->playerActor;
61 Actor* partnerActor = battleStatus->partnerActor;
62 SelectableTarget* target;
63 SelectableTarget* otherTarget;
64 Actor* targetActor;
65 ActorPart* targetPart;
66 s8* targetIndexList;
67 s32 numParts;
68 s32 i, j;
69 f32 targetX, targetY, targetZ;
70 f32 f2, f12, f14;
71 u8 overlayType;
72 f32 overlayZoom;
73 s32 hiddenByDarkness = FALSE;
74 s32 sampleCol;
75 s32 sampleRow;
76 s32 removeTarget;
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) {
89 targetDataList->actorID = ACTOR_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++;
102 targetDataList++;
103 }
104
105 // try adding the partner
106 if (battleStatus->curTargetListFlags & TARGET_FLAG_PARTNER) {
107 if (partnerActor != NULL) {
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++;
121 targetDataList++;
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 == NULL) {
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)) {
140 ActorPartBlueprint* partBlueprint = targetPart->staticData;
141
142 if (!(targetPart->flags & ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION)) {
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
185 if ((targetActor->flags & ACTOR_FLAG_TARGET_ONLY) && !(targetActor->flags & ACTOR_FLAG_LOW_PRIORITY_TARGET)) {
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++;
223 targetDataList++;
224 }
225 }
226 }
227
228 // ------------------------------------------------------------------------
229 // remove targets based on simple criteria (coarse pass)
230
231 actor->selectedTargetIndex = 0;
232 actor->targetListLength = numTargets;
233
234 sampleCol = battleStatus->sampleTargetHomeIndex % 4;
235 sampleRow = battleStatus->sampleTargetHomeIndex / 4;
236
237 targetDataList = actor->targetData;
238 numTargets = actor->targetListLength;
239
240 // remove targets, first pass
241 for (i = 0; i < numTargets; i++) {
242 target = &targetDataList[i];
243 targetActor = get_actor(target->actorID);
244 targetPart = get_actor_part(targetActor, target->partID);
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;
254 goto FIRST_PASS_REMOVE;
255 }
256
257 // skip any target if the battle is dark
258 if (!(gBattleStatus.flags2 & BS_FLAGS2_IGNORE_DARKNESS) && battleStatus->darknessMode > 0) {
259 get_screen_overlay_params(SCREEN_LAYER_BACK, &overlayType, &overlayZoom);
260 if (overlayZoom >= 215.0f) {
261 removeTarget = TRUE;
262 hiddenByDarkness = TRUE;
263 goto FIRST_PASS_REMOVE;
264 }
265 }
266
267 // skip targets not designated as the primary target for this actor
268 if (battleStatus->curTargetListFlags & TARGET_FLAG_PRIMARY_ONLY) {
269 if (!(targetPart->flags & ACTOR_PART_FLAG_PRIMARY_TARGET)
270 || targetActor->flags & ACTOR_FLAG_MINOR_TARGET
271 || targetPart->flags & ACTOR_PART_FLAG_MINOR_TARGET
272 ) {
273 removeTarget = TRUE;
274 goto FIRST_PASS_REMOVE;
275 }
276 }
277
278 // target passed all checks, do not remove
279 removeTarget = FALSE;
280
281 FIRST_PASS_REMOVE:
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++) {
295 target = &targetDataList[i];
296 targetActor = get_actor(target->actorID);
297 targetPart = get_actor_part(targetActor, target->partID);
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;
305 goto SECOND_PASS_REMOVE;
306 }
307 if ((battleStatus->curTargetListFlags & TARGET_FLAG_SMASH_LIKE) && (targetPart->targetFlags & ACTOR_PART_TARGET_NO_SMASH)) {
308 removeTarget = TRUE;
309 goto SECOND_PASS_REMOVE;
310 }
311 if ((battleStatus->curTargetListFlags & TARGET_FLAG_TATTLE) && ((targetActor->flags & ACTOR_FLAG_NO_TATTLE) || (targetPart->flags & ACTOR_PART_FLAG_NO_TATTLE))) {
312 removeTarget = TRUE;
313 goto SECOND_PASS_REMOVE;
314 }
315 if ((battleStatus->curTargetListFlags & TARGET_FLAG_AIRLIFT) && (targetActor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
316 removeTarget = TRUE;
317 goto SECOND_PASS_REMOVE;
318 }
319 if (!(battleStatus->curTargetListFlags & TARGET_FLAG_ALLOW_TARGET_ONLY) && (targetActor->flags & ACTOR_FLAG_TARGET_ONLY)) {
320 removeTarget = TRUE;
321 goto SECOND_PASS_REMOVE;
322 }
323 if ((battleStatus->curTargetListFlags & TARGET_FLAG_NO_CEILING) && (targetActor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
324 removeTarget = TRUE;
325 goto SECOND_PASS_REMOVE;
326 }
327 if ((battleStatus->curTargetListFlags & TARGET_FLAG_GROUND) && target->row != 0) {
328 removeTarget = TRUE;
329 goto SECOND_PASS_REMOVE;
330 }
331 if ((battleStatus->curTargetListFlags & TARGET_FLAG_NOT_HIGH) && target->row >= 2) {
332 removeTarget = TRUE;
333 goto SECOND_PASS_REMOVE;
334 }
335 if ((battleStatus->curTargetListFlags & TARGET_FLAG_NOT_GROUND) && target->row <= 0) {
336 removeTarget = TRUE;
337 goto SECOND_PASS_REMOVE;
338 }
339
340 if ((battleStatus->curTargetListFlags & TARGET_FLAG_NOT_BELOW)
341 && !(targetPart->flags & ACTOR_PART_FLAG_IGNORE_BELOW_CHECK)
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++) {
348 otherTarget = &targetDataList[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;
362 goto SECOND_PASS_REMOVE;
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++) {
372 otherTarget = &targetDataList[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;
386 goto SECOND_PASS_REMOVE;
387 }
388 }
389
390 if ((battleStatus->curTargetListFlags & TARGET_FLAG_NOT_FLYING) && (targetActor->flags & ACTOR_FLAG_FLYING)) {
391 removeTarget = TRUE;
392 goto SECOND_PASS_REMOVE;
393 }
394 if ((battleStatus->curTargetListFlags & TARGET_FLAG_DIR_RIGHT) && target->row == sampleRow + 1) {
395 removeTarget = TRUE;
396 goto SECOND_PASS_REMOVE;
397 }
398 if ((battleStatus->curTargetListFlags & TARGET_FLAG_DIR_LEFT) && target->row == sampleRow - 1) {
399 removeTarget = TRUE;
400 goto SECOND_PASS_REMOVE;
401 }
402 if ((battleStatus->curTargetListFlags & TARGET_FLAG_DIR_BELOW) && target->column == sampleCol - 1) {
403 removeTarget = TRUE;
404 goto SECOND_PASS_REMOVE;
405 }
406 if ((battleStatus->curTargetListFlags & TARGET_FLAG_DIR_ABOVE) && target->column == sampleCol + 1) {
407 removeTarget = TRUE;
408 goto SECOND_PASS_REMOVE;
409 }
410 if ((battleStatus->curTargetListFlags & TARGET_FLAG_DIR_RIGHT) && target->row < sampleRow) {
411 removeTarget = TRUE;
412 goto SECOND_PASS_REMOVE;
413 }
414 if ((battleStatus->curTargetListFlags & TARGET_FLAG_DIR_LEFT) && target->row > sampleRow) {
415 removeTarget = TRUE;
416 goto SECOND_PASS_REMOVE;
417 }
418 if ((battleStatus->curTargetListFlags & TARGET_FLAG_DIR_BELOW) && target->column > sampleCol) {
419 removeTarget = TRUE;
420 goto SECOND_PASS_REMOVE;
421 }
422 if ((battleStatus->curTargetListFlags & TARGET_FLAG_DIR_ABOVE) && target->column < sampleCol) {
423 removeTarget = TRUE;
424 goto SECOND_PASS_REMOVE;
425 }
426
427 // target passed all checks, do not remove
428 removeTarget = FALSE;
429
430 SECOND_PASS_REMOVE:
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
440 actor->targetListLength = numTargets;
441 if (numTargets == 0 && hiddenByDarkness) {
443 } else {
444 gBattleStatus.flags2 &= ~BS_FLAGS2_NO_TARGET_AVAILABLE;
445 }
446
447 targetDataList = actor->targetData;
448
449 numTargets = actor->targetListLength;
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];
460 target = &targetDataList[index1];
461 otherTarget = &targetDataList[index2];
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:1191
ActorPartBlueprint * staticData
s16 targetPriorityOffset
s8 selectedTargetIndex
f32 scalingFactor
struct ActorPart * partsTable
struct SelectableTarget targetData[24]
Vec3f homePos
Vec2bu size
Vec3f curPos
s8 targetIndexList[24]
s8 targetListLength
struct ActorPart * nextPart
@ ACTOR_CLASS_ENEMY
Definition enums.h:2079
@ SCREEN_LAYER_BACK
Definition enums.h:2383
@ ACTOR_PART_TARGET_NO_SMASH
Definition enums.h:1876
@ ACTOR_PART_TARGET_NO_JUMP
Definition enums.h:1875
@ BS_FLAGS2_NO_TARGET_AVAILABLE
Definition enums.h:3614
@ BS_FLAGS2_IGNORE_DARKNESS
Definition enums.h:3615
@ TARGET_FLAG_SMASH_LIKE
Definition enums.h:1860
@ TARGET_FLAG_OVERRIDE
Definition enums.h:1871
@ TARGET_FLAG_PRIMARY_ONLY
Definition enums.h:1863
@ TARGET_FLAG_TATTLE
Definition enums.h:1865
@ TARGET_FLAG_JUMP_LIKE
Definition enums.h:1859
@ TARGET_FLAG_AIRLIFT
Definition enums.h:1858
@ TARGET_FLAG_NOT_BELOW
Definition enums.h:1862
@ TARGET_FLAG_DIR_RIGHT
Definition enums.h:1867
@ TARGET_FLAG_DIR_LEFT
Definition enums.h:1868
@ TARGET_FLAG_ALLOW_TARGET_ONLY
Definition enums.h:1864
@ TARGET_FLAG_PLAYER
Definition enums.h:1852
@ TARGET_FLAG_NOT_HIGH
Definition enums.h:1853
@ TARGET_FLAG_NOT_FLYING
Definition enums.h:1854
@ TARGET_FLAG_DIR_ABOVE
Definition enums.h:1870
@ TARGET_FLAG_NOT_BEHIND
Definition enums.h:1861
@ TARGET_FLAG_NO_CEILING
Definition enums.h:1866
@ TARGET_FLAG_PARTNER
Definition enums.h:1857
@ TARGET_FLAG_GROUND
Definition enums.h:1851
@ TARGET_FLAG_DIR_BELOW
Definition enums.h:1869
@ TARGET_FLAG_NOT_GROUND
Definition enums.h:1855
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_PARTNER
Definition enums.h:2086
@ ACTOR_FLAG_FLYING
Quake Hammer can't hit.
Definition enums.h:3329
@ ACTOR_FLAG_MINOR_TARGET
Definition enums.h:3327
@ ACTOR_FLAG_UPSIDE_DOWN
HP bar offset below actor (e.g. Swooper when upside-down).
Definition enums.h:3331
@ ACTOR_FLAG_LOW_PRIORITY_TARGET
Definition enums.h:3326
@ ACTOR_FLAG_NO_TATTLE
Definition enums.h:3328
@ ACTOR_FLAG_TARGET_ONLY
Battle ends even if undefeated. No turn.
Definition enums.h:3334
@ ACTOR_PART_FLAG_PRIMARY_TARGET
Definition enums.h:3362
@ ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION
Definition enums.h:3361
@ ACTOR_PART_FLAG_NO_TATTLE
Definition enums.h:3356
@ ACTOR_PART_FLAG_IGNORE_BELOW_CHECK
Definition enums.h:3354
@ ACTOR_PART_FLAG_NO_TARGET
Cannot be targeted.
Definition enums.h:3360
@ ACTOR_PART_FLAG_MINOR_TARGET
Definition enums.h:3355
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:40
struct Actor * partnerActor
struct Actor * playerActor
struct Actor * enemyActors[24]
BattleStatus gBattleStatus
Definition battle.c:11

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 2607 of file 190B20.c.

2607 {
2608 for (ActorPart* part = actor->partsTable; part != NULL; part = part->nextPart) {
2609 if (!(part->flags & ACTOR_PART_FLAG_INVISIBLE)
2610 && (part->idleAnimations != NULL)
2611 && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)
2612 ) {
2613 set_part_pal_adjustment(part, palAdjust);
2614 }
2615 }
2616}
void set_part_pal_adjustment(ActorPart *part, s32 palAdjust)
Definition 190B20.c:2595
@ ACTOR_PART_FLAG_NO_DECORATIONS
Definition enums.h:3351
@ ACTOR_PART_FLAG_INVISIBLE
Definition enums.h:3350

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;
482 SelectableTarget* target = actor->targetData;
483 ActorPartBlueprint* partData;
484 s32 numParts;
485 ActorPart* part;
486 f32 x, y, z;
487 s32 i;
488
489 if (targetActor == NULL) {
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
508 partData = part->staticData;
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}
s16 targetActorID

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 {
567 BattleStatus* battleStatus = &gBattleStatus;
568 PlayerData* playerData = &gPlayerData;
569 Actor* partner = battleStatus->partnerActor;
570
571 battleStatus->changePartnerAllowed = 0;
572 if (partner != NULL) {
573 s32 partnersEnabled;
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) {
581 partnersEnabled++;
582 }
583 }
584
585 if (partnersEnabled >= 2) {
586 if (partner->koStatus == STATUS_KEY_DAZE) {
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}
PartnerData partners[12]
@ STATUS_KEY_FROZEN
Definition enums.h:2203
@ STATUS_KEY_DAZE
Definition enums.h:2209
@ PARTNER_GOOMPA
Definition enums.h:2890
PlayerData gPlayerData
Definition 77480.c:40

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 {
602 BattleStatus* battleStatus = &gBattleStatus;
603 Actor* player = battleStatus->playerActor;
604 PlayerData* playerData = &gPlayerData;
605 s32 hasValidItem;
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:4229
@ ITEM_TYPE_FLAG_BATTLE_USABLE
Definition enums.h:1835
s8 moveCategory
0 = jump, 1 = hammer, 5 = partner, ...
s8 menuStatus[4]
-1 = automatically pick the first move, 0 = disabled, 1 = enabled
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 {
637 BattleStatus* battleStatus = &gBattleStatus;
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 != NULL) {
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:3340

Referenced by btl_check_enemies_defeated(), and btl_state_update_partner_move().

◆ btl_check_enemies_defeated()

◆ btl_check_player_defeated()

◆ btl_init_menu_boots()

void btl_init_menu_boots ( void )

Definition at line 671 of file 190B20.c.

671 {
672 BattleStatus* battleStatus = &gBattleStatus;
673 PlayerData* playerData = &gPlayerData;
674 Actor* player = battleStatus->playerActor;
675 MoveData* move;
676 s32 i;
677 s32 moveCount;
678 s32 hasAnyBadgeMoves;
679 s32 fpCost;
680
681 // If you don't have boots equipped, disable this menu
682 if (playerData->bootsLevel == -1) {
683 battleStatus->menuStatus[1] = 0;
684 return;
685 }
686
687 for (i = 0; i < ARRAY_COUNT(battleStatus->submenuMoves); i++) {
688 battleStatus->submenuMoves[i] = MOVE_NONE;
689 }
690
691 // Standard jump move
692 moveCount = 1;
693 battleStatus->submenuMoves[0] = playerData->bootsLevel + MOVE_JUMP1;
694 battleStatus->submenuIcons[0] = ITEM_PARTNER_ATTACK;
695
696 // Jump badges
697 for (i = 0; i < ARRAY_COUNT(playerData->equippedBadges); i++) {
698 s16 badge = playerData->equippedBadges[i];
699
700 if (badge != ITEM_NONE) {
701 MoveData* moveTable = gMoveTable;
702 u8 moveID = gItemTable[badge].moveID;
703
704 move = &moveTable[moveID];
705 if (move->category == MOVE_TYPE_JUMP) {
706 battleStatus->submenuMoves[moveCount] = moveID;
707 battleStatus->submenuIcons[moveCount] = playerData->equippedBadges[i];
708 moveCount++;
709 }
710 }
711 }
712
713 battleStatus->submenuMoveCount = moveCount;
714
715 hasAnyBadgeMoves = FALSE;
716 for (i = 0; i < battleStatus->submenuMoveCount; i++) {
717 move = &gMoveTable[battleStatus->submenuMoves[i]];
718
719 // Calculate FP cost
720 fpCost = move->costFP;
721 if (fpCost != 0) {
724 if (fpCost < 1) {
725 fpCost = 1;
726 }
727 }
728
729 // See if there are any targets for this move
730 battleStatus->moveCategory = BTL_MENU_TYPE_JUMP;
731 battleStatus->moveArgument = playerData->bootsLevel;
732 battleStatus->curTargetListFlags = move->flags; // Controls target filters
734
735 // If there are targets, enable the move
736 if (player->targetListLength != 0) {
737 hasAnyBadgeMoves = TRUE;
739 }
740
741 // If you don't have enough FP, disable the move
742 if (playerData->curFP < fpCost) {
744 }
745
746 // If there are no targets available, disable the move
747 if (player->targetListLength == 0) {
749 }
751 battleStatus->submenuStatus[moveCount] = BATTLE_SUBMENU_STATUS_NO_TARGETS;
752 }
753 }
754
755 if (!hasAnyBadgeMoves) {
756 // Only the standard jump is available - no badge moves.
757 // Selecting this submenu should immediately pick the standard jump move
758 battleStatus->menuStatus[1] = -1;
759 } else {
760 // Enable this submenu
761 battleStatus->menuStatus[1] = 1;
762 }
763}
s32 player_team_is_ability_active(Actor *actor, s32 ability)
Definition 190B20.c:2765
s16 equippedBadges[64]
@ BTL_MENU_TYPE_JUMP
Definition enums.h:4227
@ BATTLE_SUBMENU_STATUS_ENABLED
Definition enums.h:5227
@ BATTLE_SUBMENU_STATUS_NO_TARGETS
Definition enums.h:5229
@ BATTLE_SUBMENU_STATUS_NOT_ENOUGH_FP
Definition enums.h:5228
@ BATTLE_SUBMENU_STATUS_NO_TARGETS_2
Definition enums.h:5230
@ MOVE_TYPE_JUMP
Definition enums.h:5214
@ ABILITY_FLOWER_SAVER
Definition enums.h:460
@ ABILITY_FLOWER_FANATIC
Definition enums.h:474
s16 submenuIcons[24]
MoveData gMoveTable[]

Referenced by btl_state_update_player_menu().

◆ btl_init_menu_hammer()

void btl_init_menu_hammer ( void )

Definition at line 765 of file 190B20.c.

765 {
766 BattleStatus* battleStatus = &gBattleStatus;
767 PlayerData* playerData = &gPlayerData;
768 Actor* player = battleStatus->playerActor;
769 MoveData* move;
770 s32 i;
771 s32 moveCount;
772 s32 hasAnyBadgeMoves;
773 s32 fpCost;
774
775 // If you don't have a hammer, disable this menu
776 if (playerData->hammerLevel == -1) {
777 battleStatus->menuStatus[2] = 0;
778 return;
779 }
780
781 for (i = 0; i < ARRAY_COUNT(battleStatus->submenuMoves); i++) {
782 battleStatus->submenuMoves[i] = 0;
783 }
784
785 // Standard hammer move
786 moveCount = 1;
787 battleStatus->submenuMoves[0] = playerData->hammerLevel + MOVE_HAMMER1;
788 battleStatus->submenuIcons[0] = ITEM_PARTNER_ATTACK;
789
790 // Hammer badges
791 for (i = 0; i < ARRAY_COUNT(playerData->equippedBadges); i++) {
792 s16 badge = playerData->equippedBadges[i];
793 if (badge != MOVE_NONE) {
794 MoveData* moveTable = gMoveTable;
795 u8 moveID = gItemTable[badge].moveID;
796 move = &moveTable[moveID];
797 if (move->category == MOVE_TYPE_HAMMER) {
798 battleStatus->submenuMoves[moveCount] = moveID;
799 battleStatus->submenuIcons[moveCount] = playerData->equippedBadges[i];
800 moveCount++;
801 }
802 }
803 }
804
805 battleStatus->submenuMoveCount = moveCount;
806
807 hasAnyBadgeMoves = FALSE;
808 for (i = 0; i < battleStatus->submenuMoveCount; i++) {
809 move = &gMoveTable[battleStatus->submenuMoves[i]];
810
811 // Calculate FP cost
812 fpCost = move->costFP;
813 if (fpCost != 0) {
816 if (fpCost < 1) {
817 fpCost = 1;
818 }
819 }
820
821 // See if there are any targets for this move
822 battleStatus->moveCategory = BTL_MENU_TYPE_SMASH;
823 battleStatus->moveArgument = playerData->hammerLevel;
824 battleStatus->curTargetListFlags = move->flags;
826
827 // If there are targets, enable the move
828 if (player->targetListLength != 0) {
829 hasAnyBadgeMoves = TRUE;
830 battleStatus->submenuStatus[i] = 1;
831 }
832
833 // If you don't have enough FP, disable the move
834 if (playerData->curFP < fpCost) {
835 battleStatus->submenuStatus[i] = 0;
836 }
837
838 // If there are no targets available, disable the move
839 if (player->targetListLength == 0) {
841 }
843 battleStatus->submenuStatus[moveCount] = BATTLE_SUBMENU_STATUS_NO_TARGETS;
844 }
845 }
846
847 if (!hasAnyBadgeMoves) {
848 // Only the standard hammer is available - no badge moves.
849 // Selecting this submenu should immediately pick the standard hammer move
850 battleStatus->menuStatus[2] = -1;
851 } else {
852 // Enable this submenu
853 battleStatus->menuStatus[2] = 1;
854 }
855}
@ BTL_MENU_TYPE_SMASH
Definition enums.h:4228
@ MOVE_TYPE_HAMMER
Definition enums.h:5213

Referenced by btl_state_update_player_menu().

◆ btl_init_menu_partner()

void btl_init_menu_partner ( void )

Definition at line 857 of file 190B20.c.

857 {
858 PlayerData* playerData = &gPlayerData;
859 BattleStatus* battleStatus = &gBattleStatus;
860 Actor* player = battleStatus->playerActor;
861 Actor* partner = battleStatus->partnerActor;
862 s32 fpCost;
863 s32 i;
864 s32 hasAnyBadgeMoves;
865
866 for (i = 0; i < ARRAY_COUNT(battleStatus->submenuMoves); i++) {
867 battleStatus->submenuMoves[i] = 0;
868 }
869
870 // In the move table (enum MoveIDs), partners get move IDs set up like this:
871 //
872 // Move ID offset | Description | Goombario example
873 // ----------------+----------------------+-------------------
874 // 0 | No rank only | Headbonk
875 // 1 | Super rank only | Headbonk (2)
876 // 2 | Ultra rank only | Headbonk (3)
877 // 3 | Always unlocked | Tattle
878 // 4 | Unlocked after super | Charge
879 // 5 | Unlocked after ultra | Multibonk
880
881 battleStatus->submenuMoveCount = partner->actorBlueprint->level + 2;
882
883 // Offsets 0,1,2
884 battleStatus->submenuMoves[0] =
885 playerData->curPartner * 6
886 + (MOVE_HEADBONK1 - 6)
887 + partner->actorBlueprint->level;
888
889 // Offsets 3,4,5
890 for (i = 1; i < battleStatus->submenuMoveCount; i++) {
891 battleStatus->submenuMoves[i] =
892 playerData->curPartner * 6
893 + (MOVE_TATTLE - 6)
894 + (i - 1);
895 }
896
897 hasAnyBadgeMoves = FALSE;
898 for (i = 0; i < battleStatus->submenuMoveCount; i++){
899 MoveData* move = &gMoveTable[battleStatus->submenuMoves[i]];
900
901 fpCost = move->costFP;
902 if (fpCost != 0) {
905 if (fpCost < 1) {
906 fpCost = 1;
907 }
908 }
909
911 battleStatus->moveArgument = partner->actorBlueprint->level;
912 battleStatus->curTargetListFlags = move->flags;
914
915 if (partner->targetListLength != 0){
916 hasAnyBadgeMoves = TRUE;
918 }
919
920 if (partner->targetListLength == 0) {
922 }
923
924 if (playerData->curFP < fpCost) {
926 }
929 }
930 }
931
932 if (!hasAnyBadgeMoves) {
933 battleStatus->menuStatus[3] = -1;
934 } else {
935 battleStatus->menuStatus[3] = 1;
936 }
937}
struct ActorBlueprint * actorBlueprint
@ BTL_MENU_TYPE_CHANGE_PARTNER
Definition enums.h:4232

Referenced by btl_state_update_partner_menu().

◆ count_power_plus()

s32 count_power_plus ( s32 damageType)

Definition at line 939 of file 190B20.c.

939 {
940 s32 count;
941 s32 i;
942
944 return 0;
945 }
946
947 count = 0;
948 for (i = 0; i < ARRAY_COUNT(gPlayerData.equippedBadges); i++) {
950
951 if (gMoveTable[moveID].category == MOVE_TYPE_ATTACK_UP && moveID == MOVE_POWER_PLUS) {
953 count++;
954 }
955 }
956 }
957
958 return count;
959}
@ PEACH_FLAG_IS_PEACH
Definition enums.h:2488
@ BS_FLAGS1_INCLUDE_POWER_UPS
Definition enums.h:3571
@ MOVE_TYPE_ATTACK_UP
Definition enums.h:5219
@ DAMAGE_TYPE_JUMP
Definition enums.h:2858
GameStatus * gGameStatusPtr
Definition main_loop.c:32

Referenced by calc_player_damage_enemy().

◆ deduct_current_move_fp()

void deduct_current_move_fp ( void )

Definition at line 961 of file 190B20.c.

961 {
962 BattleStatus* battleStatus = &gBattleStatus;
963 PlayerData* playerData = &gPlayerData;
964 Actor* actor = battleStatus->playerActor;
965 s32 fpCost = gMoveTable[battleStatus->selectedMoveID].costFP;
966
967 if (fpCost != 0) {
970 if (fpCost < 1) {
971 fpCost = 1;
972 }
973 }
974
975 playerData->curFP -= fpCost;
976}

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 978 of file 190B20.c.

978 {
979 BattleStatus* battleStatus = &gBattleStatus;
980 Actor* actor;
981 s32 i;
982
983 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
984 actor = battleStatus->enemyActors[i];
985 if (actor != NULL) {
986 actor->hpChangeCounter = 0;
987 actor->damageCounter = 0;
988 actor->actionRatingCombo = 0;
989 }
990
991 }
992 actor = battleStatus->playerActor;
993 actor->hpChangeCounter = 0;
994 actor->damageCounter = 0;
995 actor->actionRatingCombo = 0;
996
997 actor = battleStatus->partnerActor;
998 if (actor != NULL) {
999 actor->hpChangeCounter = 0;
1000 actor->damageCounter = 0;
1001 actor->actionRatingCombo = 0;
1002 }
1003}
s8 actionRatingCombo
s16 damageCounter
s16 hpChangeCounter

Referenced by btl_state_update_9(), 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(), and btl_state_update_switch_to_player().

◆ set_actor_anim()

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

Definition at line 1005 of file 190B20.c.

1005 {
1006 if ((s32) animID >= 0) {
1007 Actor* actor = get_actor(actorID);
1008 ActorPart* part;
1009
1010 switch (actorID & ACTOR_CLASS_MASK) {
1011 case ACTOR_CLASS_PLAYER:
1012 part = &actor->partsTable[0];
1013 if (part->curAnimation != animID) {
1014 part->curAnimation = animID;
1016 }
1017 break;
1019 if (partID != 0) {
1020 part = get_actor_part(actor, partID);
1021
1022 if (part == NULL) {
1023 part = &actor->partsTable[0];
1024 }
1025 } else {
1026 part = &actor->partsTable[0];
1027 }
1028
1029 if (part->curAnimation != animID) {
1030 part->curAnimation = animID;
1031 spr_update_sprite(part->spriteInstanceID, animID, part->animationRate);
1033 }
1034 break;
1035 case ACTOR_CLASS_ENEMY:
1036 part = get_actor_part(actor, partID);
1037 if (part->curAnimation != animID) {
1038 part->curAnimation = animID;
1039 spr_update_sprite(part->spriteInstanceID, animID, part->animationRate);
1041 }
1042 break;
1043 }
1044 }
1045}
@ ACTOR_CLASS_PLAYER
Definition enums.h:2077
@ ACTOR_CLASS_PARTNER
Definition enums.h:2078
@ ACTOR_CLASS_MASK
Definition enums.h:2080
s32 spr_update_sprite(s32 spriteInstanceID, s32 animID, f32 timeScale)
Definition sprite.c:1072
s32 spr_get_notify_value(s32 spriteIndex)
Definition sprite.c:1174
s32 spr_update_player_sprite(s32 spriteInstanceID, s32 animID, f32 timeScale)
Definition sprite.c:823
@ PLAYER_SPRITE_MAIN
Definition sprite.h:26

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 1047 of file 190B20.c.

1047 {
1048 if ((s32) anim >= 0) {
1049 switch (actor->actorID & ACTOR_CLASS_MASK) {
1050 case ACTOR_CLASS_PLAYER:
1051 if (part->curAnimation != anim) {
1052 part->curAnimation = anim;
1054 }
1055 break;
1057 case ACTOR_CLASS_ENEMY:
1058 if (part->curAnimation != anim) {
1059 part->curAnimation = anim;
1062 }
1063 break;
1064 }
1065 }
1066}

◆ set_actor_anim_rate()

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

Definition at line 1068 of file 190B20.c.

1068 {
1069 Actor* actor = get_actor(actorID);
1070 ActorPart* part;
1071
1072 switch (actorID & ACTOR_CLASS_MASK) {
1074 if (partID != 0) {
1075 part = get_actor_part(actor, partID);
1076 if (part != NULL) {
1077 part->animationRate = rate;
1078 return;
1079 }
1080 }
1081 actor->partsTable[0].animationRate = rate;
1082 break;
1083 case ACTOR_CLASS_PLAYER:
1084 case ACTOR_CLASS_ENEMY:
1085 part = get_actor_part(actor, partID);
1086 part->animationRate = rate;
1087 break;
1088 }
1089}

◆ set_actor_yaw()

void set_actor_yaw ( s32 actorID,
s32 yaw )

Definition at line 1091 of file 190B20.c.

1091 {
1092 get_actor(actorID)->yaw = yaw;
1093}

◆ set_part_yaw()

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

Definition at line 1095 of file 190B20.c.

1095 {
1096 get_actor_part(get_actor(actorID), partID)->yaw = value;
1097}

◆ set_part_flag_bits()

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

Definition at line 1099 of file 190B20.c.

1099 {
1100 Actor* actor = get_actor(actorID);
1101 ActorPart* part;
1102
1103 switch (actorID & ACTOR_CLASS_MASK) {
1104 case ACTOR_CLASS_PLAYER:
1105 actor->flags |= flags;
1106 break;
1108 case ACTOR_CLASS_ENEMY:
1109 if (partID == 0) {
1110 actor->flags |= flags;
1111 } else {
1112 part = get_actor_part(actor, partID);
1113 part->flags |= flags;
1114 }
1115 break;
1116 }
1117}
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 1119 of file 190B20.c.

1119 {
1120 Actor* actor = get_actor(actorID);
1121 ActorPart* part;
1122
1123 switch (actorID & ACTOR_CLASS_MASK) {
1124 case ACTOR_CLASS_PLAYER:
1125 actor->flags &= ~flags;
1126 break;
1128 case ACTOR_CLASS_ENEMY:
1129 if (partID == 0) {
1130 actor->flags &= ~flags;
1131 } else {
1132 part = get_actor_part(actor, partID);
1133 part->flags &= ~flags;
1134 }
1135 break;
1136 }
1137}

◆ add_xz_vec3f()

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

Definition at line 1139 of file 190B20.c.

1139 {
1140 f32 angleRad = DEG_TO_RAD(angleDeg);
1141 f32 sinAngleRad = sin_rad(angleRad);
1142 f32 cosAngleRad = cos_rad(angleRad);
1143
1144 vector->x += speed * sinAngleRad;
1145 vector->z += -speed * cosAngleRad;
1146}
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:134

◆ add_xz_vec3f_copy1()

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

Definition at line 1148 of file 190B20.c.

1148 {
1149 f32 angleRad = DEG_TO_RAD(angleDeg);
1150 f32 sinAngleRad = sin_rad(angleRad);
1151 f32 cosAngleRad = cos_rad(angleRad);
1152
1153 vector->x += speed * sinAngleRad;
1154 vector->z += -speed * cosAngleRad;
1155}

◆ add_xz_vec3f_copy2()

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

Definition at line 1157 of file 190B20.c.

1157 {
1158 f32 angleRad = DEG_TO_RAD(angleDeg);
1159 f32 sinAngleRad = sin_rad(angleRad);
1160 f32 cosAngleRad = cos_rad(angleRad);
1161
1162 vector->x += speed * sinAngleRad;
1163 vector->z += -speed * cosAngleRad;
1164}

◆ play_movement_dust_effects()

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

Definition at line 1166 of file 190B20.c.

1166 {
1167 f32 theta;
1168 f32 sinTheta;
1169 f32 cosTheta;
1170
1171 if (var0 == 2) {
1172 fx_landing_dust(0, xPos, yPos + 0.0f, zPos, D_802938A4);
1173 } else if (var0 == 1) {
1174 D_802938A8 = 4;
1175 } else if (D_802938A8++ >= 4) {
1176 D_802938A8 = 0;
1177 theta = DEG_TO_RAD(clamp_angle(-angleDeg));
1178 sinTheta = sin_rad(theta);
1179 cosTheta = cos_rad(theta);
1180 fx_walking_dust(
1181 0,
1182 xPos + (sinTheta * 24.0f * 0.2f),
1183 yPos + 1.5f,
1184 zPos + (cosTheta * 24.0f * 0.2f),
1185 sinTheta,
1186 cosTheta
1187 );
1188 }
1189}
f32 D_802938A4
Definition 190B20.c:9
s16 D_802938A8
Definition 190B20.c:11
#define clamp_angle

◆ get_actor_part()

ActorPart * get_actor_part ( Actor * actor,
s32 partID )

◆ load_player_actor()

void load_player_actor ( void )

Definition at line 1208 of file 190B20.c.

1208 {
1209 BattleStatus* battleStatus = &gBattleStatus;
1210 Actor* player;
1211 ActorPart* part;
1212 DecorationTable* decorations;
1213 ActorPartMovement* partMovement;
1214 s32 i;
1215 s32 j;
1216
1217 player = battleStatus->playerActor = heap_malloc(sizeof(*player));
1218
1219 ASSERT(player != NULL);
1220
1221 player->unk_134 = battleStatus->unk_93++;
1222 player->footStepCounter = 0;
1223 player->flags = 0;
1226
1228 player->homePos.x = player->curPos.x = -130.0f;
1229 player->homePos.y = player->curPos.y = 0.0f;
1230 player->homePos.z = player->curPos.z = -10.0f;
1231 } else {
1232 player->homePos.x = player->curPos.x = -95.0f;
1233 player->homePos.y = player->curPos.y = 0.0f;
1234 player->homePos.z = player->curPos.z = 0.0f;
1235 }
1236
1237 player->headOffset.x = 0;
1238 player->headOffset.y = 0;
1239 player->headOffset.z = 0;
1240 player->rot.x = 0.0f;
1241 player->rot.y = 0.0f;
1242 player->rot.z = 0.0f;
1243 player->rotPivotOffset.x = 0;
1244 player->rotPivotOffset.y = 0;
1245 player->rotPivotOffset.z = 0;
1246 player->verticalRenderOffset = 0;
1247 player->yaw = 0.0f;
1249 player->scale.x = 1.0f;
1250 player->scale.y = 1.0f;
1251 player->scale.z = 1.0f;
1252 player->scaleModifier.x = 1.0f;
1253 player->scaleModifier.y = 1.0f;
1254 player->scaleModifier.z = 1.0f;
1255 player->size.x = player->actorBlueprint->size.x;
1256 player->size.y = player->actorBlueprint->size.y;
1257 player->actorID = 0;
1258 player->healthBarPos.x = player->curPos.x;
1259 player->healthBarPos.y = player->curPos.y;
1260 player->healthBarPos.z = player->curPos.z;
1261 player->scalingFactor = 1.0f;
1262 player->attackResultEffect = NULL;
1263 player->actionRatingCombo = 0;
1264 player->actionRatingTime = 0;
1265 player->statusIconOffset.x = 0;
1266 player->statusIconOffset.y = 0;
1267 player->statusTextOffset.x = 0;
1268 player->statusTextOffset.y = 0;
1269 player->idleSource = NULL;
1270 player->takeTurnSource = NULL;
1271 player->handleEventSource = NULL;
1272 player->handlePhaseSource = NULL;
1273 player->idleScript = NULL;
1274 player->takeTurnScript = NULL;
1275 player->handleEventScript = NULL;
1276 player->handlePhaseScript = NULL;
1277 player->turnPriority = 0;
1279 player->debuff = 0;
1280 player->debuffDuration = 0;
1281 player->staticStatus = 0;
1282 player->staticDuration = 0;
1283 player->stoneStatus = 0;
1284 player->stoneDuration = 0;
1285 player->koStatus = 0;
1286 player->koDuration = 0;
1287 player->transparentStatus = 0;
1288 player->transparentDuration = 0;
1289 player->isGlowing = FALSE;
1290 player->unk_21E = 0;
1291 player->disableDismissTimer = 0;
1292 player->attackBoost = 0;
1293 player->defenseBoost = 0;
1294 player->chillOutAmount = 0;
1295 player->chillOutTurns = 0;
1296 player->statusAfflicted = 0;
1297 player->actorTypeData1[0] = bActorSoundTable[player->actorType].walk[0];
1298 player->actorTypeData1[1] = bActorSoundTable[player->actorType].walk[1];
1299 player->actorTypeData1[2] = bActorSoundTable[player->actorType].fly[0];
1300 player->actorTypeData1[3] = bActorSoundTable[player->actorType].fly[1];
1301 player->actorTypeData1[4] = bActorSoundTable[player->actorType].jump;
1302 player->actorTypeData1[5] = bActorSoundTable[player->actorType].hurt;
1303 player->actorTypeData1b[0] = bActorSoundTable[player->actorType].delay[0];
1304 player->actorTypeData1b[1] = bActorSoundTable[player->actorType].delay[1];
1305
1306 for (i = 0; i < ARRAY_COUNT(player->loopingSoundID); i++) {
1307 player->loopingSoundID[i] = 0;
1308 }
1309
1310 part = heap_malloc(sizeof(*part));
1311 player->partsTable = part;
1312
1313 ASSERT(part != NULL)
1314
1315 player->numParts = 1;
1316 part->staticData = bMarioParts;
1317 part->partOffset.x = 0;
1318 part->partOffset.y = 0;
1319 part->partOffset.z = 0;
1320 part->partOffset.x = 12;
1321 part->partOffset.y = 32;
1322 part->partOffset.z = 5;
1323 part->decorationTable = NULL;
1324 part->flags = 0;
1325 part->targetFlags = 0;
1326 part->partOffsetFloat.x = 0.0f;
1327 part->partOffsetFloat.y = 0.0f;
1328 part->partOffsetFloat.z = 0.0f;
1329 part->rotPivotOffset.x = 0;
1330 part->rotPivotOffset.y = 0;
1331 part->rotPivotOffset.z = 0;
1332 part->visualOffset.x = 0;
1333 part->visualOffset.y = 0;
1334 part->visualOffset.z = 0;
1335 part->absolutePos.x = 0.0f;
1336 part->absolutePos.y = 0.0f;
1337 part->absolutePos.z = 0.0f;
1339
1342 } else {
1344 }
1345
1346 part->eventFlags = 0;
1347 part->elementalImmunities = 0;
1348 part->opacity = 255;
1349 part->size.y = player->size.y;
1350 part->size.x = player->size.x;
1351 part->yaw = 0.0f;
1352 part->targetOffset.x = 0;
1353 part->targetOffset.y = 0;
1354 part->targetPriorityOffset = 0;
1355 part->rot.x = 0.0f;
1356 part->rot.y = 0.0f;
1357 part->rot.z = 0.0f;
1358 part->scale.x = 1.0f;
1359 part->scale.y = 1.0f;
1360 part->scale.z = 1.0f;
1361 part->verticalStretch = 1;
1362 part->palAnimPosOffset[0] = 0;
1363 part->palAnimPosOffset[1] = 0;
1364 part->animationRate = 1.0f;
1366 part->nextPart = NULL;
1367 part->partTypeData[0] = bActorSoundTable[player->actorType].walk[0];
1368 part->partTypeData[1] = bActorSoundTable[player->actorType].walk[1];
1369 part->partTypeData[2] = bActorSoundTable[player->actorType].fly[0];
1370 part->partTypeData[3] = bActorSoundTable[player->actorType].fly[1];
1371 part->partTypeData[4] = bActorSoundTable[player->actorType].jump;
1372 part->partTypeData[5] = bActorSoundTable[player->actorType].hurt;
1373 part->actorTypeData2b[0] = bActorSoundTable[player->actorType].delay[0];
1374 part->actorTypeData2b[1] = bActorSoundTable[player->actorType].delay[1];
1375
1376 if (part->idleAnimations != NULL) {
1377 s32 j;
1378
1379 part->decorationTable = heap_malloc(sizeof(*decorations));
1380 decorations = part->decorationTable;
1381
1382 ASSERT(decorations != NULL);
1383
1385 decorations->glowState = GLOW_PAL_OFF;
1386 decorations->flashState = 0;
1387 decorations->flashEnabled = FLASH_PAL_OFF;
1388 decorations->blurUnused = 0;
1389 decorations->blurBufferPos = 0;
1390
1391 for (j = 0; j < ARRAY_COUNT(decorations->posX); j++) {
1392 decorations->posX[j] = player->curPos.x;
1393 decorations->posY[j] = player->curPos.y;
1394 decorations->posZ[j] = player->curPos.z;
1395 }
1396
1397 decorations->blurDrawCount = 3;
1398 decorations->blurEnableCount = 0;
1399 decorations->blurDisableDelay = 0;
1400
1401 for (j = 0; j < ARRAY_COUNT(decorations->effect); j++) {
1402 decorations->effect[j] = NULL;
1403 decorations->type[j] = 0;
1404 }
1405 }
1406
1407 partMovement = part->movement = heap_malloc(sizeof(*partMovement));
1408 ASSERT(partMovement != NULL);
1409
1410 player->shadow.id = create_shadow_type(SHADOW_VARYING_CIRCLE, player->curPos.x, player->curPos.y, player->curPos.z);
1411 player->shadowScale = player->size.x / 24.0;
1413 player->disableEffect = fx_disable_x(0, -142.0f, 34.0f, 1.0f, 0);
1414 player->icePillarEffect = NULL;
1415
1418 player->staticDuration = 127;
1419 }
1420}
s32 bMarioDefenseTable[]
Definition actors.c:128
ActorPartBlueprint bMarioParts[]
Definition actors.c:177
ActorBlueprint bPlayerActorBlueprint
Definition actors.c:158
s32 get_npc_anim_for_status(AnimID *, s32)
Definition 190B20.c:1944
s32 bPlayerStatusTable[]
Definition actors.c:133
Vec2b statusIconOffset
struct EffectInstance * disableEffect
struct Evt * handlePhaseScript
struct EffectInstance * attackResultEffect
struct Evt * takeTurnScript
s16 palAnimPosOffset[2]
struct EffectInstance * effect[2]
u32 * idleAnimations
s8 transparentStatus
struct ActorPartMovement * movement
EvtScript * handleEventSource
Vec2b statusTextOffset
EvtScript * idleSource
s8 disableDismissTimer
f32 shadowScale
s32 elementalImmunities
s32 actorTypeData1[6]
s8 verticalRenderOffset
u8 footStepCounter
Vec3s headOffset
struct Evt * idleScript
union Actor::@38 shadow
s32 partTypeData[6]
struct Evt * handleEventScript
Vec3f partOffsetFloat
s16 actorTypeData1b[2]
Vec3s rotPivotOffset
EvtScript * handlePhaseSource
Vec3f scaleModifier
struct EffectInstance * icePillarEffect
Vec3s healthBarPos
s32 loopingSoundID[2]
s8 chillOutAmount
s16 hudElementDataIndex
EvtScript * takeTurnSource
s16 actorTypeData2b[2]
s8 statusAfflicted
struct DecorationTable * decorationTable
s8 staticDuration
s32 * statusTable
s8 debuffDuration
Vec3s rotPivotOffset
s8 transparentDuration
s8 actionRatingTime
Vec3f scale
#define ASSERT(condition)
@ GLOW_PAL_OFF
Definition enums.h:2258
@ DEMO_BTL_FLAG_PARTNER_ACTING
Definition enums.h:3544
@ ACTOR_PAL_ADJUST_NONE
Definition enums.h:2241
@ SHADOW_VARYING_CIRCLE
Definition enums.h:2535
@ BS_FLAGS2_PEACH_BATTLE
Definition enums.h:3610
@ STATUS_KEY_STATIC
Definition enums.h:2207
@ FLASH_PAL_OFF
Definition enums.h:2270
@ ABILITY_ZAP_TAP
Definition enums.h:455
@ RENDER_MODE_ALPHATEST
Definition enums.h:3276
s32 is_ability_active(s32 arg0)
Definition inventory.c:1725
s32 create_status_icon_set(void)
s32 create_shadow_type(s32 type, f32 x, f32 y, f32 z)
Definition entity.c:1528
void * heap_malloc(s32 size)
Definition heap.c:34
s32 walk[2]
Definition battle.h:235
ActorSounds bActorSoundTable[]
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
s32 bPeachIdleAnims[]
Definition actors.c:122
u32 bMarioIdleAnims[]
Definition actors.c:53

Referenced by btl_state_update_normal_start().

◆ load_partner_actor()

void load_partner_actor ( void )

Definition at line 1422 of file 190B20.c.

1422 {
1423 PlayerData* playerData = &gPlayerData;
1424 BattleStatus* battleStatus = &gBattleStatus;
1425 Actor* partnerActor;
1426 ActorBlueprint* actorBP;
1427 Evt* takeTurnScript;
1428 s32 partCount;
1429 s32 currentPartner;
1430 PartnerDMAData* partnerData;
1431 f32 x;
1432 f32 y;
1433 f32 z;
1434 ActorPart* part;
1435 s32 i;
1436 s32 i2;
1437
1438 currentPartner = playerData->curPartner;
1439 battleStatus->partnerActor = NULL;
1440
1441 if (currentPartner != PARTNER_NONE) {
1442 partnerData = &bPartnerDmaTable[currentPartner];
1443 actorBP = partnerData->ActorBlueprint;
1444
1445 ASSERT(actorBP != NULL);
1446
1447 nuPiReadRom(partnerData->dmaStart, partnerData->dmaDest, partnerData->dmaEnd - partnerData->dmaStart);
1449 x = -95.0f;
1450 y = partnerData->y;
1451 z = 0.0f;
1453 } else {
1454 x = -130.0f;
1455 y = partnerData->y;
1456 z = -10.0f;
1457 }
1458 partCount = actorBP->partCount;
1459 battleStatus->partnerActor = heap_malloc(sizeof(*partnerActor));
1460 partnerActor = battleStatus->partnerActor;
1461
1462 ASSERT(partnerActor != NULL);
1463
1464 actorBP->level = playerData->partners[playerData->curPartner].level;
1465 partnerActor->unk_134 = battleStatus->unk_93++;
1466 partnerActor->footStepCounter = 0;
1467 partnerActor->actorBlueprint = actorBP;
1468 partnerActor->actorType = actorBP->type;
1469 partnerActor->flags = actorBP->flags;
1470 partnerActor->homePos.x = partnerActor->curPos.x = x;
1471 partnerActor->homePos.y = partnerActor->curPos.y = y;
1472 partnerActor->homePos.z = partnerActor->curPos.z = z;
1473 partnerActor->headOffset.x = 0;
1474 partnerActor->headOffset.y = 0;
1475 partnerActor->headOffset.z = 0;
1476 partnerActor->curHP = actorBP->maxHP;
1477 partnerActor->numParts = partCount;
1478 partnerActor->idleSource = NULL;
1479 partnerActor->takeTurnSource = actorBP->initScript;
1480 partnerActor->handleEventSource = NULL;
1481 partnerActor->handlePhaseSource = NULL;
1482 partnerActor->idleScript = NULL;
1483 partnerActor->takeTurnScript = NULL;
1484 partnerActor->handleEventScript = NULL;
1485 partnerActor->handlePhaseScript = NULL;
1486 partnerActor->turnPriority = 0;
1487 partnerActor->enemyIndex = 0;
1488 partnerActor->yaw = 0.0f;
1489 partnerActor->rot.x = 0.0f;
1490 partnerActor->rot.y = 0.0f;
1491 partnerActor->rot.z = 0.0f;
1492 partnerActor->rotPivotOffset.x = 0;
1493 partnerActor->rotPivotOffset.y = 0;
1494 partnerActor->rotPivotOffset.z = 0;
1495 partnerActor->scale.x = 1.0f;
1496 partnerActor->scale.y = 1.0f;
1497 partnerActor->scale.z = 1.0f;
1498 partnerActor->scaleModifier.x = 1.0f;
1499 partnerActor->scaleModifier.y = 1.0f;
1500 partnerActor->scaleModifier.z = 1.0f;
1501 partnerActor->verticalRenderOffset = 0;
1502 partnerActor->size.x = actorBP->size.x;
1503 partnerActor->size.y = actorBP->size.y;
1504 partnerActor->healthBarPos.x = partnerActor->homePos.x;
1505 partnerActor->healthBarPos.y = partnerActor->homePos.y;
1506 partnerActor->healthBarPos.z = partnerActor->homePos.z;
1507 partnerActor->scalingFactor = 1.0f;
1508 partnerActor->attackResultEffect = NULL;
1509 partnerActor->actionRatingCombo = 0;
1510 partnerActor->actionRatingTime = 0;
1511 partnerActor->statusIconOffset.x = 0;
1512 partnerActor->statusIconOffset.y = 0;
1513 partnerActor->statusTextOffset.x = 0;
1514 partnerActor->statusTextOffset.y = 0;
1515 partnerActor->renderMode = RENDER_MODE_ALPHATEST;
1516 partnerActor->actorID = ACTOR_PARTNER;
1517 partnerActor->statusTable = actorBP->statusTable;
1518 partnerActor->debuff = 0;
1519 partnerActor->debuffDuration = 0;
1520 partnerActor->staticStatus = 0;
1521 partnerActor->staticDuration = 0;
1522 partnerActor->stoneStatus = 0;
1523 partnerActor->stoneDuration = 0;
1524 partnerActor->koStatus = 0;
1525 partnerActor->koDuration = 0;
1526 partnerActor->transparentStatus = 0;
1527 partnerActor->transparentDuration = 0;
1528 partnerActor->isGlowing = FALSE;
1529 partnerActor->unk_21E = 0;
1530 partnerActor->disableDismissTimer = 0;
1531 partnerActor->attackBoost = 0;
1532 partnerActor->defenseBoost = 0;
1533 partnerActor->chillOutAmount = 0;
1534 partnerActor->chillOutTurns = 0;
1535 partnerActor->statusAfflicted = 0;
1536 partnerActor->actorTypeData1[0] = bActorSoundTable[partnerActor->actorType].walk[0];
1537 partnerActor->actorTypeData1[1] = bActorSoundTable[partnerActor->actorType].walk[1];
1538 partnerActor->actorTypeData1[2] = bActorSoundTable[partnerActor->actorType].fly[0];
1539 partnerActor->actorTypeData1[3] = bActorSoundTable[partnerActor->actorType].fly[1];
1540 partnerActor->actorTypeData1[4] = bActorSoundTable[partnerActor->actorType].jump;
1541 partnerActor->actorTypeData1[5] = bActorSoundTable[partnerActor->actorType].hurt;
1542 partnerActor->actorTypeData1b[0] = bActorSoundTable[partnerActor->actorType].delay[0];
1543 partnerActor->actorTypeData1b[1] = bActorSoundTable[partnerActor->actorType].delay[1];
1544
1545 for (i2 = 0; i2 < ARRAY_COUNT(partnerActor->loopingSoundID); i2++) {
1546 partnerActor->loopingSoundID[i2] = 0;
1547 }
1548
1549 part = heap_malloc(sizeof(*part));
1550 partnerActor->partsTable = part;
1551
1552 ASSERT(part != NULL);
1553
1554 for (i = 0; i < partCount; i++) {
1556 part->decorationTable = NULL;
1558
1560 part->targetFlags = 0;
1561
1565
1566 part->visualOffset.x = 0;
1567 part->visualOffset.y = 0;
1568 part->visualOffset.z = 0;
1569 part->absolutePos.x = 0.0f;
1570 part->absolutePos.y = 0.0f;
1571 part->absolutePos.z = 0.0f;
1577 part->size.y = partnerActor->size.y;
1578 part->size.x = partnerActor->size.x;
1579 part->yaw = 0.0f;
1582 part->targetPriorityOffset = 0;
1583 part->rotPivotOffset.x = 0;
1584 part->rotPivotOffset.y = 0;
1585 part->rotPivotOffset.z = 0;
1586 part->rot.x = 0.0f;
1587 part->rot.y = 0.0f;
1588 part->rot.z = 0.0f;
1589 part->scale.x = 1.0f;
1590 part->scale.y = 1.0f;
1591 part->scale.z = 1.0f;
1592 part->verticalStretch = 1;
1593 part->palAnimPosOffset[0] = 0;
1594 part->palAnimPosOffset[1] = 0;
1595 part->partTypeData[0] = bActorSoundTable[partnerActor->actorType].walk[0];
1596 part->partTypeData[1] = bActorSoundTable[partnerActor->actorType].walk[1];
1597 part->partTypeData[2] = bActorSoundTable[partnerActor->actorType].fly[0];
1598 part->partTypeData[3] = bActorSoundTable[partnerActor->actorType].fly[1];
1599 part->partTypeData[4] = bActorSoundTable[partnerActor->actorType].jump;
1600 part->partTypeData[5] = bActorSoundTable[partnerActor->actorType].hurt;
1601 part->actorTypeData2b[0] = bActorSoundTable[partnerActor->actorType].delay[0];
1602 part->actorTypeData2b[1] = bActorSoundTable[partnerActor->actorType].delay[1];
1603
1604 if (part->idleAnimations != NULL) {
1605 DecorationTable* decorations;
1606 s32 j;
1607
1608 part->decorationTable = heap_malloc(sizeof(*decorations));
1609 decorations = part->decorationTable;
1610
1611 ASSERT(decorations != NULL);
1612
1614 decorations->glowState = GLOW_PAL_OFF;
1615 decorations->flashState = 0;
1616 decorations->flashEnabled = FLASH_PAL_OFF;
1617 decorations->blurUnused = 0;
1618 decorations->blurBufferPos = 0;
1619
1620 for (j = 0; j < ARRAY_COUNT(decorations->posX); j++) {
1621 decorations->posX[j] = partnerActor->curPos.x;
1622 decorations->posY[j] = partnerActor->curPos.y;
1623 decorations->posZ[j] = partnerActor->curPos.z;
1624 }
1625
1626 decorations->blurDrawCount = 3;
1627 decorations->blurEnableCount = 0;
1628 decorations->blurDisableDelay = 0;
1629
1630 for (j = 0; j < ARRAY_COUNT(decorations->effect); j++) {
1631 decorations->effect[j] = NULL;
1632 decorations->type[j] = 0;
1633 }
1634 }
1635
1637 part->movement = heap_malloc(sizeof(*part->movement));
1638 ASSERT(part->movement != NULL);
1639 }
1640
1641 part->animationRate = 1.0f;
1642 part->curAnimation = 0;
1643 part->spriteInstanceID = -1;
1644
1645 if (part->idleAnimations != NULL) {
1648 }
1649
1650 if (i + 1 >= partCount) {
1651 part->nextPart = NULL;
1652 continue;
1653 }
1654
1655 part->nextPart = heap_malloc(sizeof(*part->nextPart));
1656 part = part->nextPart;
1657 if (part == NULL) {
1658 PANIC();
1659 }
1660
1661 part->nextPart = NULL;
1662 }
1663
1664 partnerActor->shadow.id = create_shadow_type(SHADOW_VARYING_CIRCLE, partnerActor->curPos.x, partnerActor->curPos.y, partnerActor->curPos.z);
1665 partnerActor->shadowScale = partnerActor->size.x / 24.0;
1667 partnerActor->disableEffect = fx_disable_x(0, -142.0f, 34.0f, 1.0f, 0);
1668 partnerActor->icePillarEffect = NULL;
1669
1670 takeTurnScript = start_script(partnerActor->takeTurnSource, EVT_PRIORITY_A, 0);
1671 partnerActor->takeTurnScriptID = takeTurnScript->id;
1672 takeTurnScript->owner1.actorID = ACTOR_PARTNER;
1673 }
1674}
PartnerDMAData bPartnerDmaTable[]
Definition partner_dma.c:26
s32 takeTurnScriptID
struct ActorBlueprint * ActorBlueprint
union Evt::@8 owner1
Initially -1.
@ BS_FLAGS1_PLAYER_IN_BACK
Definition enums.h:3589
@ PARTNER_NONE
Definition enums.h:2885
@ ACTOR_PART_FLAG_SKIP_MOVEMENT_ALLOC
Definition enums.h:3366
@ ACTOR_PART_FLAG_NO_SHADOW
Definition enums.h:3352
@ EVT_PRIORITY_A
Definition evt.h:153
Evt * start_script(EvtScript *source, s32 priority, s32 initialState)
#define PANIC()
Definition macros.h:55
s32 spr_load_npc_sprite(s32 animID, u32 *extraAnimList)
Definition sprite.c:1026
@ SPRITE_ID_TAIL_ALLOCATE
Definition sprite.h:14
struct ActorPartBlueprint * partsData
Definition battle.h:137
EvtScript * initScript
Definition battle.h:138
s32 * statusTable
Definition battle.h:139

Referenced by btl_state_update_change_partner(), and btl_state_update_normal_start().

◆ create_actor()

Actor * create_actor ( Formation formation)

Definition at line 1676 of file 190B20.c.

1676 {
1677 BattleStatus* battleStatus = &gBattleStatus;
1678 Actor* actor;
1679 ActorBlueprint* formationActor;
1680 ActorPart* part;
1681 ActorPartBlueprint* partBP;
1682 Evt* takeTurnScript;
1683 s32 partCount;
1684 f32 x, y, z;
1685 DecorationTable* decorations;
1686 s32 i, j, k;
1687
1688 if (formation->home.index >= EVT_LIMIT) {
1689 x = StandardActorHomePositions[formation->home.index].x;
1690 y = StandardActorHomePositions[formation->home.index].y;
1691 z = StandardActorHomePositions[formation->home.index].z;
1692 } else {
1693 x = formation->home.vec->x;
1694 y = formation->home.vec->y;
1695 z = formation->home.vec->z;
1696 }
1697
1698 formationActor = formation->actor;
1699 partCount = formationActor->partCount;
1700
1701 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
1702 if (battleStatus->enemyActors[i] == NULL) {
1703 break;
1704 }
1705 }
1706
1707 actor = battleStatus->enemyActors[i] = heap_malloc(sizeof(*actor));
1708
1709 ASSERT(actor != NULL);
1710
1711 actor->unk_134 = battleStatus->unk_93++;
1712 actor->footStepCounter = 0;
1713 actor->actorBlueprint = formationActor;
1714 actor->actorType = formationActor->type;
1715 actor->flags = formationActor->flags;
1716 actor->homePos.x = actor->curPos.x = x;
1717 actor->homePos.y = actor->curPos.y = y;
1718 actor->homePos.z = actor->curPos.z = z;
1719 actor->headOffset.x = 0;
1720 actor->headOffset.y = 0;
1721 actor->headOffset.z = 0;
1722 actor->maxHP = actor->curHP = formationActor->maxHP;
1723 actor->numParts = partCount;
1724 actor->idleSource = NULL;
1725 actor->takeTurnSource = formationActor->initScript;
1726 actor->handleEventSource = NULL;
1727 actor->handlePhaseSource = NULL;
1728 actor->idleScript = NULL;
1729 actor->takeTurnScript = NULL;
1730 actor->handleEventScript = NULL;
1731 actor->turnPriority = formation->priority;
1732 actor->enemyIndex = i;
1733 actor->yaw = 0.0f;
1734 actor->rot.x = 0.0f;
1735 actor->rot.y = 0.0f;
1736 actor->rot.z = 0.0f;
1737 actor->rotPivotOffset.x = 0;
1738 actor->rotPivotOffset.y = 0;
1739 actor->rotPivotOffset.z = 0;
1740 actor->scale.x = 1.0f;
1741 actor->scale.y = 1.0f;
1742 actor->scale.z = 1.0f;
1743 actor->scaleModifier.x = 1.0f;
1744 actor->scaleModifier.y = 1.0f;
1745 actor->scaleModifier.z = 1.0f;
1746 actor->verticalRenderOffset = 0;
1747 actor->extraCoinBonus = 0;
1748 actor->size.x = formationActor->size.x;
1749 actor->size.y = formationActor->size.y;
1750 actor->scalingFactor = 1.0f;
1751 actor->statusIconOffset.x = 0;
1752 actor->statusIconOffset.y = 0;
1753 actor->statusTextOffset.x = 0;
1754 actor->statusTextOffset.y = 0;
1755 actor->healthBarOffset.x = 0;
1756 actor->healthBarOffset.y = 0;
1757 actor->healthBarHideTime = 0;
1758 actor->attackResultEffect = NULL;
1759 actor->actionRatingCombo = 0;
1760 actor->actionRatingTime = 0;
1761
1762 actor->healthBarPos.x = actor->curPos.x + formationActor->healthBarOffset.x;
1763 actor->healthBarPos.y = actor->curPos.y + formationActor->healthBarOffset.y;
1764 actor->healthBarPos.z = actor->curPos.z;
1765 if (actor->flags & ACTOR_FLAG_UPSIDE_DOWN) {
1766 actor->healthBarPos.y = actor->curPos.y - actor->size.y - formationActor->healthBarOffset.y;
1767 }
1768
1769 actor->statusTable = formationActor->statusTable;
1770 actor->debuff = 0;
1771 actor->debuffDuration = 0;
1772 actor->staticStatus = 0;
1773 actor->staticDuration = 0;
1774 actor->stoneStatus = 0;
1775 actor->stoneDuration = 0;
1776 actor->koStatus = 0;
1777 actor->koDuration = 0;
1778 actor->transparentStatus = 0;
1779 actor->transparentDuration = 0;
1780 actor->isGlowing = FALSE;
1781 actor->unk_21E = 0;
1782 actor->disableDismissTimer = 0;
1783 actor->attackBoost = 0;
1784 actor->defenseBoost = 0;
1785 actor->chillOutAmount = 0;
1786 actor->chillOutTurns = 0;
1787 actor->statusAfflicted = 0;
1788 actor->actorTypeData1[0] = bActorSoundTable[actor->actorType].walk[0];
1789 actor->actorTypeData1[1] = bActorSoundTable[actor->actorType].walk[1];
1790 actor->actorTypeData1[2] = bActorSoundTable[actor->actorType].fly[0];
1791 actor->actorTypeData1[3] = bActorSoundTable[actor->actorType].fly[1];
1792 actor->actorTypeData1[4] = bActorSoundTable[actor->actorType].jump;
1793 actor->actorTypeData1[5] = bActorSoundTable[actor->actorType].hurt;
1794 actor->actorTypeData1b[0] = bActorSoundTable[actor->actorType].delay[0];
1795 actor->actorTypeData1b[1] = bActorSoundTable[actor->actorType].delay[1];
1796
1797 for (i = 0; i < ARRAY_COUNT(actor->loopingSoundID); i++) {
1798 actor->loopingSoundID[i] = 0;
1799 }
1800
1801 actor->state.varTable[0] = formation->var0;
1802 actor->state.varTable[1] = formation->var1;
1803 actor->state.varTable[2] = formation->var2;
1804 actor->state.varTable[3] = formation->var3;
1806 actor->instigatorValue = 0;
1807 part = heap_malloc(sizeof(*part));
1808 actor->partsTable = part;
1809 ASSERT(part != NULL);
1810
1811 for (j = 0; j < partCount; j++) {
1812 ActorPartBlueprint* actorPartBP = &formationActor->partsData[j];
1813
1814 part->decorationTable = NULL;
1815 part->staticData = actorPartBP;
1816 part->flags = actorPartBP->flags | ACTOR_PART_FLAG_NO_SHADOW;
1817 part->targetFlags = 0;
1818
1819 part->partOffsetFloat.x = part->partOffset.x = actorPartBP->posOffset.x;
1820 part->partOffsetFloat.y = part->partOffset.y = actorPartBP->posOffset.y;
1821 part->partOffsetFloat.z = part->partOffset.z = actorPartBP->posOffset.z;
1822
1823 part->visualOffset.x = 0;
1824 part->visualOffset.y = 0;
1825 part->visualOffset.z = 0;
1826
1827 part->absolutePos.x = actor->curPos.x;
1828 part->absolutePos.y = actor->curPos.y;
1829 part->absolutePos.z = actor->curPos.z;
1830 part->curPos.x = actor->curPos.x;
1831 part->curPos.y = actor->curPos.y;
1832 part->curPos.z = actor->curPos.z;
1833 part->defenseTable = actorPartBP->defenseTable;
1834 part->idleAnimations = actorPartBP->idleAnimations;
1835 part->eventFlags = actorPartBP->eventFlags;
1836 part->elementalImmunities = actorPartBP->elementImmunityFlags;
1837 part->opacity = actorPartBP->opacity;
1838 if (part->opacity < 255) {
1840 }
1841 part->size.y = actor->size.y;
1842 part->size.x = actor->size.x;
1843 part->yaw = 0.0f;
1844 part->targetOffset.x = actorPartBP->targetOffset.x;
1845 part->targetOffset.y = actorPartBP->targetOffset.y;
1846 part->targetPriorityOffset = 0;
1847 part->projectileTargetOffset.x = actorPartBP->projectileTargetOffset.x;
1848 part->projectileTargetOffset.y = actorPartBP->projectileTargetOffset.y;
1849 part->rot.x = 0.0f;
1850 part->rot.y = 0.0f;
1851 part->rot.z = 0.0f;
1852 part->rotPivotOffset.x = 0;
1853 part->rotPivotOffset.y = 0;
1854 part->rotPivotOffset.z = 0;
1855 part->scale.x = 1.0f;
1856 part->scale.y = 1.0f;
1857 part->scale.z = 1.0f;
1858 part->verticalStretch = 1;
1859 part->palAnimPosOffset[0] = 0;
1860 part->palAnimPosOffset[1] = 0;
1861 part->partTypeData[0] = bActorSoundTable[actor->actorType].walk[0];
1862 part->partTypeData[1] = bActorSoundTable[actor->actorType].walk[1];
1863 part->partTypeData[2] = bActorSoundTable[actor->actorType].fly[0];
1864 part->partTypeData[3] = bActorSoundTable[actor->actorType].fly[1];
1865 part->partTypeData[4] = bActorSoundTable[actor->actorType].jump;
1866 part->partTypeData[5] = bActorSoundTable[actor->actorType].hurt;
1867 part->actorTypeData2b[0] = bActorSoundTable[actor->actorType].delay[0];
1868 part->actorTypeData2b[1] = bActorSoundTable[actor->actorType].delay[1];
1869
1870 if (part->idleAnimations != NULL && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
1871 part->decorationTable = heap_malloc(sizeof(*decorations));
1872 decorations = part->decorationTable;
1873 ASSERT(decorations != NULL);
1874
1876 decorations->glowState = GLOW_PAL_OFF;
1877 decorations->flashState = 0;
1878 decorations->flashEnabled = FLASH_PAL_OFF;
1879 decorations->blurUnused = 0;
1880 decorations->blurBufferPos = 0;
1881
1882 for (k = 0; k < ARRAY_COUNT(decorations->posX); k++) {
1883 decorations->posX[k] = actor->curPos.x;
1884 decorations->posY[k] = actor->curPos.y;
1885 decorations->posZ[k] = actor->curPos.z;
1886 }
1887
1888 decorations->blurDrawCount = 3;
1889 decorations->blurEnableCount = 0;
1890 decorations->blurDisableDelay = 0;
1891
1892 for (k = 0; k < ARRAY_COUNT(decorations->effect); k++) {
1893 decorations->effect[k] = NULL;
1894 decorations->type[k] = 0;
1895 }
1896
1897 }
1898
1900 part->movement = heap_malloc(sizeof(*part->movement));
1901 ASSERT(part->movement != NULL);
1902 }
1903
1904 if (actor->flags & ACTOR_FLAG_TARGET_ONLY) {
1906 }
1907
1908 part->animationRate = 1.0f;
1909 part->curAnimation = 0;
1910 part->spriteInstanceID = -1;
1911
1912 if (part->idleAnimations != NULL) {
1913 part->curAnimation = get_npc_anim_for_status(part->idleAnimations, 1) & ~SPRITE_ID_TAIL_ALLOCATE;
1915 }
1916
1917 if (j + 1 >= partCount) {
1918 part->nextPart = NULL;
1919 continue;
1920 }
1921
1922 part->nextPart = heap_malloc(sizeof(*part->nextPart));
1923 part = part->nextPart;
1924 if (part == NULL) {
1925 PANIC();
1926 }
1927
1928 part->nextPart = NULL;
1929 }
1930
1931 actor->healthFraction = 25;
1932 actor->actorID = actor->enemyIndex | ACTOR_CLASS_ENEMY;
1933 takeTurnScript = start_script(actor->takeTurnSource, EVT_PRIORITY_A, 0);
1934 actor->takeTurnScriptID = takeTurnScript->id;
1935 takeTurnScript->owner1.enemyID = actor->enemyIndex | ACTOR_CLASS_ENEMY;
1936 actor->shadow.id = create_shadow_type(SHADOW_VARYING_CIRCLE, actor->curPos.x, actor->curPos.y, actor->curPos.z);
1937 actor->shadowScale = actor->size.x / 24.0;
1938 actor->disableEffect = fx_disable_x(0, -142.0f, 34.0f, 1.0f, 0);
1939 actor->icePillarEffect = NULL;
1941 return actor;
1942}
Vec2b healthBarOffset
s8 healthFraction
Vec2b projectileTargetOffset
s8 extraCoinBonus
ActorState state
s8 instigatorValue
s8 healthBarHideTime
@ RENDER_MODE_SURFACE_XLU_LAYER3
Definition enums.h:3299
@ ACTOR_PART_FLAG_TARGET_ONLY
Definition enums.h:3359
#define EVT_LIMIT
Definition macros.h:47
Vec2b healthBarOffset
Definition battle.h:149
Vec3s StandardActorHomePositions[]
Definition actors.c:188

Referenced by btl_state_update_normal_start().

◆ get_player_anim_for_status()

s32 get_player_anim_for_status ( s32 statusKey)

Definition at line 1965 of file 190B20.c.

1965 {
1966 BattleStatus* battleStatus = &gBattleStatus;
1967 PlayerData* playerData = &gPlayerData;
1968 Actor* player = battleStatus->playerActor;
1969 u32* anim = &player->partsTable->idleAnimations[0];
1970 s32 ret;
1971
1972 if (anim == NULL) {
1973 return 0;
1974 }
1975 ret = 0;
1976
1977 if (!(battleStatus->flags2 & BS_FLAGS2_PEACH_BATTLE)) {
1978 // switch to danger override animations
1979 if (playerData->curHP <= DANGER_THRESHOLD) {
1980 if (statusKey == STATUS_KEY_NORMAL) {
1981 statusKey = STATUS_KEY_DANGER;
1982 }
1983 if (statusKey == STATUS_KEY_INACTIVE) {
1984 statusKey = STATUS_KEY_INACTIVE_WEARY;
1985 }
1986 if (statusKey == STATUS_KEY_THINKING) {
1987 statusKey = STATUS_KEY_WEARY;
1988 }
1989 }
1990
1991 // switch to poisoned override animations
1992 if (player->debuff == STATUS_KEY_POISON) {
1993 if (statusKey == STATUS_KEY_NORMAL) {
1994 statusKey = STATUS_KEY_DANGER;
1995 }
1996 if (statusKey == STATUS_KEY_INACTIVE) {
1997 statusKey = STATUS_KEY_INACTIVE_WEARY;
1998 }
1999 if (statusKey == STATUS_KEY_THINKING) {
2000 statusKey = STATUS_KEY_WEARY;
2001 }
2002 }
2003
2004 // switch to dizzy override animations
2005 if (player->debuff == STATUS_KEY_DIZZY) {
2006 if (statusKey == STATUS_KEY_INACTIVE) {
2007 statusKey = STATUS_KEY_INACTIVE_DIZZY;
2008 }
2009 }
2010 }
2011
2012 // search IdleAnimations to get animID for key
2013 while (*anim != NULL) {
2014 if (*anim == 1) {
2015 ret = anim[1];
2016 }
2017 if (*anim == statusKey) {
2018 ret = anim[1];
2019 break;
2020 }
2021 anim += 2;
2022 }
2023
2024 return ret;
2025}
@ STATUS_KEY_INACTIVE_DIZZY
Definition enums.h:2220
@ STATUS_KEY_THINKING
Definition enums.h:2224
@ STATUS_KEY_WEARY
Definition enums.h:2225
@ STATUS_KEY_INACTIVE_WEARY
Definition enums.h:2218
@ STATUS_KEY_DANGER
Definition enums.h:2222
@ STATUS_KEY_INACTIVE
Definition enums.h:2214
@ STATUS_KEY_DIZZY
Definition enums.h:2200
@ STATUS_KEY_POISON
Definition enums.h:2205
#define DANGER_THRESHOLD
Definition battle.h:266

Referenced by appendGfx_player_actor(), and btl_state_update_player_menu().

◆ lookup_defense()

s32 lookup_defense ( s32 * defenseTable,
s32 elementKey )

Definition at line 2027 of file 190B20.c.

2027 {
2028 s32 normalDefense = 0;
2029
2030 while (defenseTable[DICTIONARY_KEY] != ELEMENT_END) {
2031 if (defenseTable[DICTIONARY_KEY] == ELEMENT_NORMAL) {
2032 normalDefense = defenseTable[DICTIONARY_VALUE];
2033 }
2034
2035 if (defenseTable[DICTIONARY_KEY] == elementKey) {
2036 normalDefense = defenseTable[DICTIONARY_VALUE];
2037 break;
2038 }
2039 defenseTable += DICTIONARY_SIZE;
2040 }
2041
2042 // Fall back to normal defense if given element is not specified in table
2043 return normalDefense;
2044}
@ ELEMENT_END
Definition enums.h:2114
@ ELEMENT_NORMAL
Definition enums.h:2115

Referenced by get_defense().

◆ lookup_status_chance()

s32 lookup_status_chance ( s32 * statusTable,
s32 statusKey )

Definition at line 2046 of file 190B20.c.

2046 {
2047 s32 defaultChance = 0;
2048
2049 while (statusTable[DICTIONARY_KEY] != STATUS_END) {
2050 if (statusTable[DICTIONARY_KEY] == STATUS_KEY_DEFAULT) {
2051 defaultChance = statusTable[DICTIONARY_VALUE];
2052 }
2053
2054 if (statusTable[DICTIONARY_KEY] == statusKey) {
2055 defaultChance = statusTable[DICTIONARY_VALUE];
2056 break;
2057 }
2058 statusTable += DICTIONARY_SIZE;
2059 }
2060
2061 // Fall back to normal chance if given element is not specified in table
2062 return defaultChance;
2063}
@ STATUS_END
Definition enums.h:2196
@ STATUS_KEY_DEFAULT
Definition enums.h:2198

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 2065 of file 190B20.c.

2065 {
2066 s32 defaultTurnMod = 0;
2067
2068 while (statusTable[DICTIONARY_KEY] != ELEMENT_END) {
2069 if (statusTable[DICTIONARY_KEY] == STATUS_TURN_MOD_DEFAULT) {
2070 defaultTurnMod = statusTable[DICTIONARY_VALUE];
2071 }
2072
2073 if (statusTable[DICTIONARY_KEY] == statusKey) {
2074 defaultTurnMod = statusTable[DICTIONARY_VALUE];
2075 break;
2076 }
2077 statusTable += DICTIONARY_SIZE;
2078 }
2079
2080 // Fall back to normal duration if given element is not specified in table
2081 return defaultTurnMod;
2082}
@ STATUS_TURN_MOD_DEFAULT
Definition enums.h:2227

Referenced by try_inflict_status().

◆ inflict_status()

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

Definition at line 2084 of file 190B20.c.

2084 {
2085 BattleStatus* battleStatus = &gBattleStatus;
2086 EffectInstance* effect;
2087
2088 switch (statusTypeKey) {
2089 case STATUS_KEY_FEAR:
2090 case STATUS_KEY_DIZZY:
2092 case STATUS_KEY_SLEEP:
2093 case STATUS_KEY_FROZEN:
2094 case STATUS_KEY_STOP:
2095 case STATUS_KEY_POISON:
2096 case STATUS_KEY_SHRINK:
2098 !is_ability_active(ABILITY_BERSERKER) && battleStatus->hustleTurns == 0)) {
2099
2100 if (target->actorID != ACTOR_PARTNER) {
2101 if (target->debuff != statusTypeKey) {
2102 target->statusAfflicted = statusTypeKey;
2103 }
2104 target->disableEffect->data.disableX->koDuration = 0;
2105 target->debuff = statusTypeKey;
2106 target->debuffDuration = duration;
2107 if ((s8)duration > 9) {
2108 target->debuffDuration = 9;
2109 }
2110
2111 switch (statusTypeKey) {
2112 case STATUS_KEY_FROZEN:
2113 if (target->actorID != ACTOR_PARTNER) {
2114 effect = target->icePillarEffect;
2115 if (effect != NULL) {
2117 }
2118 target->icePillarEffect = fx_ice_pillar(0, target->curPos.x, target->curPos.y,
2119 target->curPos.z, 1.0f, 0);
2121 }
2122 return TRUE;
2123 case STATUS_KEY_SLEEP:
2126 return TRUE;
2130 return TRUE;
2131 case STATUS_KEY_DIZZY:
2133 return TRUE;
2134 case STATUS_KEY_FEAR:
2137 return TRUE;
2138 case STATUS_KEY_POISON:
2141 return TRUE;
2142 case STATUS_KEY_SHRINK:
2144 return TRUE;
2145 }
2146 }
2147 return TRUE;
2148 } else {
2149 return FALSE;
2150 }
2151 break;
2152 case STATUS_KEY_STATIC:
2153 if (target->actorID != ACTOR_PARTNER) {
2154 target->staticStatus = statusTypeKey;
2155 target->staticDuration = duration;
2156 if ((s8)duration > 9) {
2157 target->staticDuration = 9;
2158 }
2162 }
2163 return TRUE;
2164 case STATUS_KEY_STONE:
2165 if (target->actorID != ACTOR_PARTNER) {
2166 target->stoneStatus = STATUS_KEY_STONE;
2167 target->stoneDuration = duration;
2168 if ((s8)duration > 9) {
2169 target->stoneDuration = 9;
2170 }
2172 }
2173 return TRUE;
2174 case STATUS_KEY_DAZE:
2175 if (target->koStatus < statusTypeKey) {
2176 target->koStatus = STATUS_KEY_DAZE;
2177 target->koDuration = duration;
2178 if ((s8)duration > 9) {
2179 target->koDuration = 9;
2180 }
2182 }
2183 return TRUE;
2185 if (target->actorID != ACTOR_PARTNER) {
2187 target->transparentDuration = duration;
2188 if ((s8)duration > 9) {
2189 target->transparentDuration = 9;
2190 }
2193 }
2194 return TRUE;
2195 case 0:
2196 case STATUS_KEY_NORMAL:
2197 case STATUS_KEY_DEFAULT:
2198 default:
2199 return TRUE;
2200 }
2201}
void set_actor_pal_adjustment(Actor *actor, s32 palAdjust)
Definition 190B20.c:2607
struct DisableXFXData * disableX
Definition effects.h:2529
EffectData data
Definition effects.h:2605
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3517
@ ACTOR_PAL_ADJUST_FEAR
Definition enums.h:2244
@ ACTOR_PAL_ADJUST_POISON
Definition enums.h:2245
@ ACTOR_PAL_ADJUST_PARALYZE
Definition enums.h:2246
@ ACTOR_PAL_ADJUST_SLEEP
Definition enums.h:2242
@ ACTOR_PAL_ADJUST_STATIC
Definition enums.h:2243
@ STATUS_KEY_PARALYZE
Definition enums.h:2201
@ STATUS_KEY_TRANSPARENT
Definition enums.h:2210
@ STATUS_KEY_FEAR
Definition enums.h:2199
@ STATUS_KEY_SLEEP
Definition enums.h:2202
@ STATUS_KEY_STONE
Definition enums.h:2208
@ STATUS_KEY_STOP
Definition enums.h:2204
@ STATUS_KEY_SHRINK
Definition enums.h:2206
@ 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 2203 of file 190B20.c.

2203 {
2204 if (statusTypeKey == STATUS_KEY_DAZE) {
2205 if (statusTypeKey != target->koStatus) {
2206 inflict_status(target, STATUS_KEY_DAZE, duration);
2208 } else {
2209 target->koDuration += duration;
2210 if (target->koDuration > 9) {
2211 target->koDuration = 9;
2212 }
2213 }
2214 }
2215
2216 return TRUE;
2217}
s32 inflict_status(Actor *target, s32 statusTypeKey, s32 duration)
Definition 190B20.c:2084
@ SOUND_INFLICT_KO
Definition enums.h:1545
void sfx_play_sound(s32 soundID)
Definition sfx.c:517

Referenced by calc_enemy_damage_target().

◆ get_defense()

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

Definition at line 2219 of file 190B20.c.

2219 {
2220 s32 elemDefense;
2221 s32 minDefense = 255;
2222
2223 if (defenseTable != NULL) {
2224
2225 #define CHECK_DEFENSE(element) \
2226 if (elementFlags & DAMAGE_TYPE_##element) { \
2227 elemDefense = lookup_defense(defenseTable, ELEMENT_##element); \
2228 if (elemDefense < minDefense) { \
2229 minDefense = elemDefense; \
2230 } \
2231 } \
2232
2233 CHECK_DEFENSE(FIRE);
2234 CHECK_DEFENSE(WATER);
2235 CHECK_DEFENSE(ICE);
2236 CHECK_DEFENSE(MAGIC);
2237 CHECK_DEFENSE(SMASH);
2238 CHECK_DEFENSE(JUMP);
2239 CHECK_DEFENSE(COSMIC);
2240 CHECK_DEFENSE(BLAST);
2241 CHECK_DEFENSE(SHOCK);
2242 CHECK_DEFENSE(QUAKE);
2243 CHECK_DEFENSE(THROW);
2244
2245 #undef CHECK_DEFENSE
2246 }
2247
2248 // If no element flags were set, fall back to normal defense.
2249 if (minDefense == 255) {
2250 elemDefense = lookup_defense(defenseTable, ELEMENT_NORMAL);
2251 if (elemDefense < 255) {
2252 minDefense = elemDefense;
2253 }
2254 }
2255
2256 if (elementFlags & DAMAGE_TYPE_IGNORE_DEFENSE) {
2257 if (minDefense == 99) {
2258 // Immune
2259 minDefense = 999;
2260 } else if (minDefense > 0) {
2261 minDefense = 0;
2262 }
2263 }
2264
2265 return minDefense;
2266}
#define CHECK_DEFENSE(element)
@ DAMAGE_TYPE_IGNORE_DEFENSE
Definition enums.h:2877

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 2269 of file 190B20.c.

2269 {
2270 s32 i;
2271
2272 for (i = 0; i < 1; i++) {
2273 if (gDamageCountEffects[i] == NULL) {
2274 break;
2275 }
2276 }
2277
2278 if (i > 0) {
2279 i = 0;
2281 gDamageCountEffects[i] = NULL;
2282 }
2283
2284 if (angle == 0) {
2285 angle = -55;
2286 } else {
2287 angle = 55;
2288 }
2289
2290 fx_damage_indicator(0, posX, posY, posZ, 10.0f, angle, damageAmt, &gDamageCountEffects[i]);
2291 gDamageCountTimers[i] = 40;
2292}
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 2295 of file 190B20.c.

2295 {
2296 s32 i;
2297
2298 for (i = 0; i < ARRAY_COUNT(gDamageCountEffects); i++) {
2299 if (gDamageCountEffects[i] == NULL) {
2300 break;
2301 }
2302 }
2303
2304 if (i > ARRAY_COUNT(gDamageCountEffects) - 1) {
2305 i = 0;
2307 gDamageCountEffects[i] = NULL;
2308 }
2309
2310 if (angle == 0) {
2311 angle = -55;
2312 } else {
2313 angle = 55;
2314 }
2315
2316 fx_damage_indicator(0, posX, posY, posZ, 10.0f, angle, damageAmt, &gDamageCountEffects[i]);
2317 gDamageCountTimers[i] = 40;
2318}

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 2320 of file 190B20.c.

2320 {
2321 s32 i;
2322
2323 for (i = 0; i < ARRAY_COUNT(gDamageCountEffects); i++) {
2324 if (gDamageCountEffects[i] != NULL) {
2325 gDamageCountTimers[i]--;
2326 if (gDamageCountTimers[i] == 0) {
2328 gDamageCountEffects[i] = NULL;
2329 }
2330 }
2331 };
2332}

Referenced by btl_update().

◆ show_damage_fx()

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

Definition at line 2334 of file 190B20.c.

2334 {
2335 BattleStatus* battleStatus = &gBattleStatus;
2336 s32 intensity;
2337
2338 if (damage < 3) {
2339 intensity = DAMAGE_INTENSITY_LIGHT;
2340 } else if (damage < 5) {
2341 intensity = DAMAGE_INTENSITY_MEDIUM;
2342 } else if (damage < 9) {
2343 intensity = DAMAGE_INTENSITY_HEAVY;
2344 } else {
2345 intensity = DAMAGE_INTENSITY_EXTREME;
2346 }
2347
2348 if (battleStatus->curAttackElement & DAMAGE_TYPE_FIRE) {
2349 fx_ring_blast(0, x, y, z, 1.0f, 24);
2350 } else if (battleStatus->curAttackElement & DAMAGE_TYPE_SHOCK) {
2351 apply_shock_effect(actor);
2352 } else if (battleStatus->curAttackElement & DAMAGE_TYPE_WATER) {
2353 fx_water_splash(0, x, y, z, 1.0f, 24);
2354 } else {
2355 fx_firework(0, x, y, z, 1.0, intensity);
2356 }
2357}
@ DAMAGE_INTENSITY_EXTREME
Definition enums.h:3509
@ DAMAGE_INTENSITY_LIGHT
Definition enums.h:3506
@ DAMAGE_INTENSITY_HEAVY
Definition enums.h:3508
@ DAMAGE_INTENSITY_MEDIUM
Definition enums.h:3507
@ DAMAGE_TYPE_SHOCK
Definition enums.h:2856
@ DAMAGE_TYPE_FIRE
Definition enums.h:2852
@ DAMAGE_TYPE_WATER
Definition enums.h:2853
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 2360 of file 190B20.c.

2360 {
2361 BattleStatus* battleStatus = &gBattleStatus;
2362 Actor* player;
2363 s32 new_var; // TODO required to match
2364 s32 type;
2365
2366 actor->attackResultEffect = actor->attackResultEffect; // TODO required to match
2367 player = battleStatus->playerActor;
2368
2369 if (actor->attackResultEffect == NULL) {
2370 type = 0;
2371 switch (rating) {
2372 case ACTION_RATING_NICE:
2373 type = 0;
2374 actor->actionRatingCombo = 1;
2375 break;
2376 case ACTION_RATING_MISS:
2377 type = 4;
2378 actor->actionRatingCombo = 0;
2379 break;
2381 type = 3;
2382 actor->actionRatingCombo = 0;
2383 break;
2385 type = 2;
2386 actor->actionRatingCombo = 2;
2387 break;
2389 type = 0;
2390 actor->actionRatingCombo = 0;
2391 break;
2393 type = player->actionRatingCombo;
2394 player->actionRatingCombo++;
2395 if (player->actionRatingCombo > 2) {
2396 player->actionRatingCombo = 2;
2397 }
2398 break;
2399 }
2400 actor->attackResultEffect = fx_attack_result_text(type, x, y, z - 10.0f, 12.0f, 90);
2401 actor->actionRatingTime = 80;
2402 new_var = 2; // TODO required to match
2403 } else {
2405 type = actor->actionRatingCombo;
2406 new_var = rating; // TODO required to match
2407 switch (new_var) { // TODO required to match
2408 case ACTION_RATING_NICE:
2409 actor->actionRatingCombo++;
2410 if (actor->actionRatingCombo > 2) {
2411 actor->actionRatingCombo = 2;
2412 }
2413 break;
2414 case ACTION_RATING_MISS:
2415 type = 4;
2416 break;
2418 type = 3;
2419 break;
2421 type = 2;
2422 break;
2424 type = 0;
2425 break;
2427 type = player->actionRatingCombo;
2428 player->actionRatingCombo++;
2429 if (player->actionRatingCombo > 2) {
2430 player->actionRatingCombo = 2;
2431 }
2432 break;
2433 }
2434 actor->attackResultEffect = fx_attack_result_text(type, x, y, z - 10.0f, 12.0f, 90);
2435 actor->actionRatingTime = 80;
2436 }
2437}
struct AttackResultTextFXData * attackResultText
Definition effects.h:2536
@ ACTION_RATING_SUPER
sets nice hits = 2
Definition enums.h:1982
@ ACTION_RATING_NICE_SUPER_COMBO
'Nice' but becomes 'Super' if nice hits > 2
Definition enums.h:1984
@ ACTION_RATING_NICE_NO_COMBO
clears nice hits
Definition enums.h:1983
@ ACTION_RATING_MISS
clears nice hits
Definition enums.h:1980
@ ACTION_RATING_LUCKY
clears nice hits
Definition enums.h:1981
@ ACTION_RATING_NICE
sets nice hits = 1
Definition enums.h:1979

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

◆ func_80266970()

void func_80266970 ( Actor * target)

Definition at line 2439 of file 190B20.c.

2439 {
2440 target->actionRatingCombo = 0;
2441}

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 2443 of file 190B20.c.

2443 {
2444 BattleStatus* battleStatus = &gBattleStatus;
2445 Actor* actor;
2446 s32 i;
2447
2448 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
2449 actor = gBattleStatus.enemyActors[i];
2450 if (actor != NULL) {
2451 if (actor->actionRatingTime == 60) {
2452 if (actor->attackResultEffect != NULL) {
2454 }
2455 }
2456 if (actor->actionRatingTime == 5) {
2457 if (actor->attackResultEffect != NULL) {
2459 actor->attackResultEffect = NULL;
2460 }
2461 }
2462 if (actor->actionRatingTime > 0) {
2463 actor->actionRatingTime--;
2464 }
2465 }
2466 }
2467
2468 actor = battleStatus->playerActor;
2469 if (actor != NULL) {
2470 if (actor->actionRatingTime == 60) {
2471 if (actor->attackResultEffect != NULL) {
2473 }
2474 }
2475 if (actor->actionRatingTime == 5) {
2476 if (actor->attackResultEffect != NULL) {
2478 actor->attackResultEffect = NULL;
2479 }
2480 }
2481 if (actor->actionRatingTime > 0) {
2482 actor->actionRatingTime--;
2483 }
2484 }
2485
2486 actor = battleStatus->partnerActor;
2487 if (actor != NULL) {
2488 if (actor->actionRatingTime == 60) {
2489 if (actor->attackResultEffect != NULL) {
2491 }
2492 }
2493 if (actor->actionRatingTime == 5) {
2494 if (actor->attackResultEffect != NULL) {
2496 actor->attackResultEffect = NULL;
2497 }
2498 }
2499 if (actor->actionRatingTime > 0) {
2500 actor->actionRatingTime--;
2501 }
2502 }
2503}

Referenced by btl_update().

◆ show_actor_health_bar()

void show_actor_health_bar ( Actor * target)

Definition at line 2505 of file 190B20.c.

2505 {
2506 target->healthBarHideTime = -1;
2508}
@ ACTOR_FLAG_HEALTH_BAR_HIDDEN
Definition enums.h:3338

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 2510 of file 190B20.c.

2510 {
2511 target->healthBarHideTime = 0;
2512 target->flags &= ~ACTOR_FLAG_HEALTH_BAR_HIDDEN;
2513}

◆ update_health_bars()

void update_health_bars ( void )

Definition at line 2515 of file 190B20.c.

2515 {
2516 s32 i;
2517
2518 for (i = 0; i < ARRAY_COUNT(gBattleStatus.enemyActors); i++) {
2519 Actor* enemy = gBattleStatus.enemyActors[i];
2520
2521 if (enemy != NULL) {
2522 if (enemy->healthBarHideTime > 0) {
2523 enemy->healthBarHideTime--;
2524 if (enemy->healthBarHideTime == 0) {
2525 enemy->flags &= ~ACTOR_FLAG_HEALTH_BAR_HIDDEN;
2526 }
2527 }
2528 }
2529 }
2530}

Referenced by btl_update().

◆ try_inflict_status()

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

Definition at line 2532 of file 190B20.c.

2532 {
2533 BattleStatus* battleStatus = &gBattleStatus;
2534 s32 chance;
2535 s32 duration;
2536
2537 if (battleStatus->statusChance == STATUS_KEY_IGNORE_RES) {
2538 duration = battleStatus->statusDuration;
2539 duration += lookup_status_duration_mod(actor->statusTable, statusKey);
2540 return inflict_status_set_duration(actor, statusTypeKey, statusKey, duration);
2541 }
2542
2543 duration = 0;
2544
2545 if (actor->statusTable != NULL) {
2546 if (!(battleStatus->curAttackStatus & STATUS_FLAG_RIGHT_ON)) {
2547 chance = lookup_status_chance(actor->statusTable, statusTypeKey);
2548 } else {
2549 chance = lookup_status_chance(actor->statusTable, statusTypeKey);
2550 if (chance != 0) {
2551 chance = 100;
2552 }
2553 }
2554
2555 if (chance > 0) {
2556 chance = (chance * battleStatus->statusChance) / 100;
2557 if (chance > 0 && chance >= rand_int(100)) {
2558 duration = 3;
2559 duration += lookup_status_duration_mod(actor->statusTable, statusKey);
2560 }
2561 }
2562 } else {
2563 duration = 3;
2564 }
2565
2566 if (duration > 0) {
2567 if (battleStatus->curAttackStatus < 0) {
2568 duration = battleStatus->statusDuration;
2569 duration += lookup_status_duration_mod(actor->statusTable, statusKey);
2570 inflict_status(actor, statusTypeKey, duration);
2571 } else {
2572 inflict_status(actor, statusTypeKey, duration);
2573
2574 }
2575 } else {
2576 duration = 0;
2577 }
2578 return duration;
2579}
s32 lookup_status_duration_mod(s32 *statusTable, s32 statusKey)
Definition 190B20.c:2065
s32 inflict_status_set_duration(Actor *actor, s32 statusTypeKey, s32 statusDurationKey, s32 duration)
Definition 190B20.c:2581
s32 lookup_status_chance(s32 *statusTable, s32 statusKey)
Definition 190B20.c:2046
#define rand_int
@ STATUS_FLAG_RIGHT_ON
Definition enums.h:2829
#define STATUS_KEY_IGNORE_RES
Definition macros.h:222

Referenced by calc_enemy_damage_target().

◆ inflict_status_set_duration()

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

Definition at line 2581 of file 190B20.c.

2581 {
2582 s32 statusDuration = 0;
2583
2584 if (actor->statusTable == NULL || lookup_status_chance(actor->statusTable, statusTypeKey) > 0) {
2585 statusDuration = duration;
2586 }
2587
2588 if (statusDuration > 0) {
2589 return inflict_status(actor, statusTypeKey, statusDuration);
2590 } else {
2591 return 0;
2592 }
2593}

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 2595 of file 190B20.c.

2595 {
2596 if (part->idleAnimations != NULL && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
2597 DecorationTable* decorations = part->decorationTable;
2598
2599 if (decorations->paletteAdjustment != palAdjust) {
2600 decorations->paletteAdjustment = palAdjust;
2601 decorations->palAnimState = 0;
2602 decorations->resetPalAdjust = TRUE;
2603 }
2604 }
2605}

Referenced by set_actor_pal_adjustment().

◆ clear_part_pal_adjustment()

void clear_part_pal_adjustment ( ActorPart * part)

Definition at line 2618 of file 190B20.c.

2618 {
2619 if (part->idleAnimations != NULL && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
2621 }
2622}

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 2624 of file 190B20.c.

2624 {
2625 for (ActorPart* part = actor->partsTable; part != NULL; part = part->nextPart) {
2626 DecorationTable* decorations = part->decorationTable;
2627
2628 if (!(part->flags & ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION)
2629 && !(part->flags & ACTOR_PART_FLAG_INVISIBLE)
2630 && (part->idleAnimations != NULL)
2631 && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)
2632 ) {
2635 ) {
2637 }
2638 }
2639 }
2640}
@ ACTOR_PAL_ADJUST_BLEND_PALETTES_VARYING_INTERVALS
Definition enums.h:2253
@ ACTOR_PAL_ADJUST_BLEND_PALETTES_UNIFORM_INTERVALS
Definition enums.h:2252

◆ set_part_glow_pal()

void set_part_glow_pal ( ActorPart * part,
s32 glowState )

Definition at line 2642 of file 190B20.c.

2642 {
2643 if (part->idleAnimations != NULL && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
2644 DecorationTable* decorations = part->decorationTable;
2645
2646 if (decorations->glowState != glowState) {
2647 decorations->glowState = glowState;
2648 decorations->glowUnk1 = 0;
2649 decorations->glowStateChanged = TRUE;
2650 }
2651 }
2652}

Referenced by set_actor_glow_pal().

◆ set_actor_glow_pal()

void set_actor_glow_pal ( Actor * actor,
s32 glowState )

Definition at line 2654 of file 190B20.c.

2654 {
2655 for (ActorPart* part = actor->partsTable; part != NULL; part = part->nextPart) {
2657 && (part->idleAnimations != NULL)
2658 && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)
2659 ) {
2660 set_part_glow_pal(part, glowState);
2661 }
2662 }
2663}
void set_part_glow_pal(ActorPart *part, s32 glowState)
Definition 190B20.c:2642

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 2665 of file 190B20.c.

2665 {
2666 if (part->idleAnimations != NULL && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
2668 }
2669}

◆ clear_actor_glow_pal()

void clear_actor_glow_pal ( Actor * actor)

Definition at line 2671 of file 190B20.c.

2671 {
2672 for (ActorPart* part = actor->partsTable; part != NULL; part = part->nextPart) {
2673 DecorationTable* decorations = part->decorationTable;
2674
2676 && part->idleAnimations != NULL
2677 && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)
2678 ) {
2679 decorations->glowState = GLOW_PAL_OFF;
2680 }
2681 }
2682}

◆ set_part_flash_mode()

void set_part_flash_mode ( ActorPart * part,
s32 flashState )

Definition at line 2684 of file 190B20.c.

2684 {
2685 if (part->idleAnimations != NULL && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
2686 DecorationTable* decorations = part->decorationTable;
2687
2688 if (decorations->flashState != flashState) {
2689 decorations->flashState = flashState;
2690 decorations->flashMode = FLASH_MODE_LIGHT;
2691 decorations->flashStateChanged = TRUE;
2692 }
2693 }
2694}
@ FLASH_MODE_LIGHT
Definition enums.h:2263

Referenced by set_actor_flash_mode().

◆ set_actor_flash_mode()

void set_actor_flash_mode ( Actor * actor,
s32 flashState )

Definition at line 2696 of file 190B20.c.

2696 {
2697 for (ActorPart* part = actor->partsTable; part != NULL; part = part->nextPart) {
2699 && part->decorationTable != NULL
2700 && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)
2701 && part->idleAnimations != NULL
2702 ) {
2703 set_part_flash_mode(part, flashState);
2704 }
2705 }
2706}
void set_part_flash_mode(ActorPart *part, s32 flashState)
Definition 190B20.c:2684

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 2708 of file 190B20.c.

2708 {
2709 if (part->idleAnimations != NULL && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
2710 part->decorationTable->flashState = 0;
2711 }
2712}

Referenced by part_flash_on().

◆ clear_actor_flash_mode()

void clear_actor_flash_mode ( Actor * actor)

Definition at line 2714 of file 190B20.c.

2714 {
2715 for (ActorPart* part = actor->partsTable; part != NULL; part = part->nextPart) {
2716 DecorationTable* decorations = part->decorationTable;
2717
2719 && (part->idleAnimations != NULL)
2720 && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)
2721 ) {
2722 decorations->flashState = 0;
2723 }
2724 }
2725}

◆ add_part_decoration()

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

Definition at line 2727 of file 190B20.c.

2727 {
2728 if ((part->idleAnimations) && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
2729 DecorationTable* decorations = part->decorationTable;
2730
2731 _remove_part_decoration(part, decorationIndex);
2732 decorations->type[decorationIndex] = decorationType;
2733 decorations->changed[decorationIndex] = TRUE;
2734 decorations->state[decorationIndex] = 0;
2736 }
2737}
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 2739 of file 190B20.c.

2739 {
2740 for (ActorPart* part = actor->partsTable; part != NULL; part = part->nextPart) {
2742 && part->idleAnimations
2743 && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)
2744 ) {
2745 add_part_decoration(part, decorationIndex, decorationType);
2746 }
2747 }
2748}
void add_part_decoration(ActorPart *part, s32 decorationIndex, s32 decorationType)
Definition 190B20.c:2727

◆ remove_part_decoration()

void remove_part_decoration ( ActorPart * part,
s32 decorationIndex )

Definition at line 2750 of file 190B20.c.

2750 {
2751 _remove_part_decoration(part, decorationIndex);
2752}

Referenced by remove_actor_decoration().

◆ remove_actor_decoration()

void remove_actor_decoration ( Actor * actor,
s32 decorationIndex )

Definition at line 2754 of file 190B20.c.

2754 {
2755 for (ActorPart* part = actor->partsTable; part != NULL; part = part->nextPart) {
2757 && part->idleAnimations != NULL
2758 && !(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)
2759 ) {
2760 remove_part_decoration(part, decorationIndex);
2761 }
2762 }
2763}
void remove_part_decoration(ActorPart *part, s32 decorationIndex)
Definition 190B20.c:2750

Referenced by btl_delete_actor(), and btl_delete_player_actor().

◆ player_team_is_ability_active()

s32 player_team_is_ability_active ( Actor * actor,
s32 ability )

Definition at line 2765 of file 190B20.c.

2765 {
2766 s32 actorClass = actor->actorID & ACTOR_CLASS_MASK;
2767 s32 hasAbility = FALSE;
2768
2769 switch (actorClass) {
2770 case ACTOR_CLASS_PLAYER:
2772 hasAbility = is_ability_active(ability);
2773 }
2774 break;
2776 hasAbility = is_partner_ability_active(ability);
2777 break;
2778 case ACTOR_CLASS_ENEMY:
2779 break;
2780 }
2781
2782 return hasAbility;
2783}
s32 is_partner_ability_active(s32)
Definition inventory.c:2061

Referenced by appendGfx_player_actor(), btl_init_menu_boots(), btl_init_menu_hammer(), btl_init_menu_partner(), btl_state_update_change_partner(), btl_state_update_partner_menu(), btl_state_update_player_menu(), calc_enemy_damage_target(), calc_enemy_test_target(), calc_partner_test_enemy(), calc_player_damage_enemy(), calc_player_test_enemy(), and deduct_current_move_fp().

◆ create_part_shadow()

void create_part_shadow ( s32 actorID,
s32 partID )

Definition at line 2785 of file 190B20.c.

2785 {
2786 ActorPart* part = get_actor_part(get_actor(actorID), partID);
2787
2788 part->flags &= ~ACTOR_PART_FLAG_NO_SHADOW;
2790 part->shadowScale = part->size.x / 24.0;
2791}

◆ remove_part_shadow()

void remove_part_shadow ( s32 actorID,
s32 partID )

Definition at line 2793 of file 190B20.c.

2793 {
2794 ActorPart* part = get_actor_part(get_actor(actorID), partID);
2795
2798}
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 2800 of file 190B20.c.

2800 {
2801 part->flags &= ~ACTOR_PART_FLAG_NO_SHADOW;
2803 part->shadowScale = part->size.x / 24.0;
2804}

◆ remove_player_buffs()

void remove_player_buffs ( s32 buffs)

Definition at line 2806 of file 190B20.c.

2806 {
2807 BattleStatus* battleStatus = &gBattleStatus;
2808 Actor* player = battleStatus->playerActor;
2809 Actor* partner = battleStatus->partnerActor;
2810 ActorPart* playerActorParts = player->partsTable;
2811
2812 if (buffs & PLAYER_BUFF_JUMP_CHARGE) {
2813 battleStatus->jumpCharge = 0;
2814 battleStatus->flags1 &= ~BS_FLAGS1_JUMP_CHARGED;
2815 }
2816 if (buffs & PLAYER_BUFF_HAMMER_CHARGE) {
2817 battleStatus->hammerCharge = 0;
2818 battleStatus->flags1 &= ~BS_FLAGS1_HAMMER_CHARGED;
2819 }
2820 if (buffs & PLAYER_BUFF_STONE) {
2821 player->stoneDuration = 0;
2822 player->stoneStatus = 0;
2823 }
2824 if (buffs & PLAYER_BUFF_HUSTLE) {
2825 battleStatus->hustleTurns = 0;
2826 battleStatus->flags1 &= ~BS_FLAGS1_HUSTLED;
2827 }
2828 if (buffs & PLAYER_BUFF_STATIC && (player->staticStatus != 0)) {
2829 player->staticDuration = 0;
2830 player->staticStatus = 0;
2832 }
2833 if (buffs & PLAYER_BUFF_TRANSPARENT && (player->transparentStatus != 0)) {
2834 player->transparentDuration = 0;
2835 player->transparentStatus = 0;
2836 playerActorParts->flags &= ~ACTOR_PART_FLAG_TRANSPARENT;
2838 }
2839 if (buffs & PLAYER_BUFF_WATER_BLOCK && (battleStatus->waterBlockTurnsLeft != 0)) {
2840 battleStatus->waterBlockTurnsLeft = 0;
2843
2844 fx_water_block(FX_WATER_BLOCK_DESTROY, player->curPos.x, player->curPos.y + 18.0f, player->curPos.z + 5.0f, 1.5f, 10);
2845 fx_water_splash(0, player->curPos.x - 10.0f, player->curPos.y + 5.0f, player->curPos.z + 5.0f, 1.0f, 24);
2846 fx_water_splash(0, player->curPos.x - 15.0f, player->curPos.y + 32.0f, player->curPos.z + 5.0f, 1.0f, 24);
2847 fx_water_splash(1, player->curPos.x + 15.0f, player->curPos.y + 22.0f, player->curPos.z + 5.0f, 1.0f, 24);
2848
2849 battleStatus->waterBlockEffect = NULL;
2851 }
2852 if (buffs & PLAYER_BUFF_TURBO_CHARGE && (battleStatus->turboChargeTurnsLeft != 0)) {
2853 battleStatus->turboChargeTurnsLeft = 0;
2855 }
2856 if (buffs & PLAYER_BUFF_CLOUD_NINE && (battleStatus->cloudNineTurnsLeft != 0)) {
2857 battleStatus->cloudNineTurnsLeft = 0;
2859 remove_effect(battleStatus->cloudNineEffect);
2860 battleStatus->cloudNineEffect = NULL;
2861 }
2862
2863 if (partner != NULL && (buffs & PLAYER_BUFF_PARTNER_GLOWING)) {
2864 partner->isGlowing = FALSE;
2865 gBattleStatus.flags1 &= ~BS_FLAGS1_GOOMBARIO_CHARGED;
2866 }
2867}
#define remove_effect
s16 turnsLeft
Definition effects.h:2326
struct PartnerBuffFXData * partnerBuff
Definition effects.h:2591
@ FX_WATER_BLOCK_DESTROY
Definition effects.h:1540
BuffData unk_0C[3]
Definition effects.h:2336
@ 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:2808
@ PLAYER_BUFF_JUMP_CHARGE
Definition enums.h:2799
@ PLAYER_BUFF_WATER_BLOCK
Definition enums.h:2807
@ PLAYER_BUFF_STONE
Definition enums.h:2801
@ PLAYER_BUFF_TURBO_CHARGE
Definition enums.h:2806
@ PLAYER_BUFF_CLOUD_NINE
Definition enums.h:2805
@ PLAYER_BUFF_TRANSPARENT
Definition enums.h:2804
@ PLAYER_BUFF_STATIC
Definition enums.h:2803
@ PLAYER_BUFF_HAMMER_CHARGE
Definition enums.h:2800
@ PLAYER_BUFF_HUSTLE
Definition enums.h:2802
@ SOUND_DESTROY_WATER_BLOCK
Definition enums.h:1015
void remove_status_static(s32)
void remove_status_transparent(s32)
struct EffectInstance * waterBlockEffect
struct EffectInstance * cloudNineEffect
struct EffectInstance * buffEffect

◆ btl_update_ko_status()

void btl_update_ko_status ( void )

Definition at line 2869 of file 190B20.c.

2869 {
2870 BattleStatus* battleStatus = &gBattleStatus;
2871 Actor* player = battleStatus->playerActor;
2872 Actor* partner = battleStatus->partnerActor;
2873 s32 koDuration = player->koDuration;
2874 s32 i;
2875
2876 player->koDuration = player->debuffDuration;
2877 if (player->koDuration > 0) {
2878 player->koStatus = STATUS_KEY_DAZE;
2879 player->disableEffect->data.disableX->koDuration = player->koDuration;
2880
2881 if (koDuration == 0) {
2883 }
2884 }
2885
2886 if (partner != NULL) {
2887 if (partner->koDuration < partner->debuffDuration) {
2888 partner->koStatus = STATUS_KEY_DAZE;
2889 partner->koDuration = partner->debuffDuration;
2890 }
2891
2892 if (partner->koDuration > 0) {
2893 partner->koStatus = STATUS_KEY_DAZE;
2894 partner->disableEffect->data.disableX->koDuration = partner->koDuration;
2895 }
2896 }
2897
2898 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
2899 Actor* enemy = battleStatus->enemyActors[i];
2900
2901 if (enemy != NULL) {
2902 enemy->koDuration = enemy->debuffDuration;
2903 if (enemy->koDuration > 0) {
2904 enemy->koStatus = STATUS_KEY_DAZE;
2906 }
2907 }
2908 }
2909}

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 )

Definition at line 2911 of file 190B20.c.

2911 {
2912 gDPPipeSync(gMainGfxPos++);
2913 gSPDisplayList(gMainGfxPos++, D_80293970);
2914
2915 if (a == 255) {
2916 gDPSetRenderMode(gMainGfxPos++, G_RM_OPA_SURF, G_RM_OPA_SURF2);
2918 } else {
2919 gDPSetRenderMode(gMainGfxPos++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
2920 gDPSetCombineMode(gMainGfxPos++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
2921 }
2922
2923 gDPSetPrimColor(gMainGfxPos++, 0, 0, r, g, b, a);
2924 gDPFillRectangle(gMainGfxPos++, left, top, right, bottom);
2925
2926 gDPPipeSync(gMainGfxPos++);
2927 gDPSetRenderMode(gMainGfxPos++, G_RM_TEX_EDGE, G_RM_TEX_EDGE2);
2928 gDPSetCombineMode(gMainGfxPos++, G_CC_DECALRGBA, G_CC_DECALRGBA);
2929}
Gfx D_80293970[]
Definition 190B20.c:31
#define PM_CC_PRIM_FULL_ALPHA
Definition macros.h:283
Gfx * gMainGfxPos
Definition cam_main.c:15

Referenced by btl_draw_prim_quad().

◆ 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 2931 of file 190B20.c.

2931 {
2932 u16 right = left + arg6;
2933 u16 bottom = top + arg7;
2934
2935 btl_appendGfx_prim_quad(r, g, b, a, left, top, right, bottom);
2936}
void btl_appendGfx_prim_quad(u8 r, u8 g, u8 b, u8 a, u16 left, u16 top, u16 right, u16 bottom)
Definition 190B20.c:2911

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 2938 of file 190B20.c.

2938 {
2939 ActorPart* partIt = &actor->partsTable[0];
2940
2941 actor->actorTypeData1[0] = bActorSoundTable[actor->actorType].walk[0];
2942 actor->actorTypeData1[1] = bActorSoundTable[actor->actorType].walk[1];
2943 actor->actorTypeData1[2] = bActorSoundTable[actor->actorType].fly[0];
2944 actor->actorTypeData1[3] = bActorSoundTable[actor->actorType].fly[1];
2945 actor->actorTypeData1[4] = bActorSoundTable[actor->actorType].jump;
2946 actor->actorTypeData1[5] = bActorSoundTable[actor->actorType].hurt;
2947 actor->actorTypeData1b[0] = bActorSoundTable[actor->actorType].delay[0];
2948 actor->actorTypeData1b[1] = bActorSoundTable[actor->actorType].delay[1];
2949
2950 while (partIt != NULL) {
2951 partIt->partTypeData[0] = actor->actorTypeData1[0];
2952 partIt->partTypeData[1] = actor->actorTypeData1[1];
2953 partIt->partTypeData[2] = actor->actorTypeData1[2];
2954 partIt->partTypeData[3] = actor->actorTypeData1[3];
2955 partIt->partTypeData[4] = actor->actorTypeData1[4];
2956 partIt->partTypeData[5] = actor->actorTypeData1[5];
2957 partIt->actorTypeData2b[0] = actor->actorTypeData1b[0];
2958 partIt->actorTypeData2b[1] = actor->actorTypeData1b[1];
2959 partIt = partIt->nextPart;
2960 }
2961}

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 2963 of file 190B20.c.

2963 {
2964 Stage* stage = gBattleStatus.curStage;
2965
2966 if (stage != NULL && stage->foregroundModelList != NULL) {
2967 s32* idList = stage->foregroundModelList;
2968 while (*idList != STAGE_MODEL_LIST_END) {
2969 s32 id = *idList++;
2970 if (id >= 0) {
2972 model->flags |= MODEL_FLAG_HIDDEN;
2973 }
2974 }
2975 }
2976}
@ MODEL_FLAG_HIDDEN
Definition enums.h:4358
s32 get_model_list_index_from_tree_index(s32 treeIndex)
Definition model.c:3397
struct Model * get_model_from_list_index(s32 listIndex)
Definition model.c:3315
u16 flags
Definition model.h:60
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 2978 of file 190B20.c.

2978 {
2979 Stage* stage = gBattleStatus.curStage;
2980
2981 if (stage != NULL && stage->foregroundModelList != NULL) {
2982 s32* idList = stage->foregroundModelList;
2983 while (*idList != STAGE_MODEL_LIST_END) {
2984 s32 id = *idList++;
2985 if (id >= 0) {
2987 model->flags &= ~MODEL_FLAG_HIDDEN;
2988 }
2989 }
2990 }
2991}

Referenced by tattle_cam_post_render().

◆ hide_foreground_models()

void hide_foreground_models ( void )

Definition at line 2993 of file 190B20.c.

2993 {
2994 Stage* stage = gBattleStatus.curStage;
2995
2996 if (stage != NULL && stage->foregroundModelList != NULL) {
2997 s32* idList = stage->foregroundModelList;
2998 while (*idList != STAGE_MODEL_LIST_END) {
2999 s32 id = *idList++;
3000 if (id < 0) {
3001 break;
3002 } else {
3004 model->flags |= MODEL_FLAG_HIDDEN;
3005 }
3006
3007 }
3008 }
3009}

◆ show_foreground_models()

void show_foreground_models ( void )

Definition at line 3011 of file 190B20.c.

3011 {
3012 Stage* stage = gBattleStatus.curStage;
3013
3014 if (stage != NULL && stage->foregroundModelList != NULL) {
3015 s32* idList = stage->foregroundModelList;
3016 while (*idList != STAGE_MODEL_LIST_END) {
3017 s32 id = *idList++;
3018 if (id < 0) {
3019 break;
3020 } else {
3022 model->flags &= ~MODEL_FLAG_HIDDEN;
3023 }
3024 }
3025 }
3026}

◆ start_rumble_type()

void start_rumble_type ( u32 type)

Definition at line 3098 of file 190B20.c.

3098 {
3099 if (bCurRumbleScript != 0) {
3101 }
3102
3103 switch (type) {
3104 case BTL_RUMBLE_STOP:
3105 break;
3106 case BTL_RUMBLE_LONG:
3108 break;
3109 case BTL_RUMBLE_HIT_MIN:
3111 break;
3114 break;
3117 break;
3120 break;
3121 case BTL_RUMBLE_HIT_MAX:
3123 break;
3130 break;
3131 }
3132}
EvtScript EVS_BattleRumble_Long
Definition 190B20.c:3030
EvtScript EVS_BattleRumble_HitLight
Definition 190B20.c:3044
EvtScript EVS_BattleRumble_PlayerMin
Definition 190B20.c:3068
EvtScript EVS_BattleRumble_HitHeavy
Definition 190B20.c:3050
EvtScript EVS_BattleRumble_HitMin
Definition 190B20.c:3038
EvtScript EVS_BattleRumble_HitMax
Definition 190B20.c:3062
EvtScript EVS_BattleRumble_HitExtreme
Definition 190B20.c:3056
s32 bCurRumbleScript
Definition 190B20.c:44
@ BTL_RUMBLE_PLAYER_MIN
Definition enums.h:4259
@ BTL_RUMBLE_HIT_HEAVY
Definition enums.h:4256
@ BTL_RUMBLE_STOP
Definition enums.h:4252
@ BTL_RUMBLE_PLAYER_HEAVY
Definition enums.h:4261
@ BTL_RUMBLE_HIT_MIN
Definition enums.h:4254
@ BTL_RUMBLE_HIT_LIGHT
Definition enums.h:4255
@ BTL_RUMBLE_PLAYER_MAX
Definition enums.h:4263
@ BTL_RUMBLE_PLAYER_EXTREME
Definition enums.h:4262
@ BTL_RUMBLE_HIT_MAX
Definition enums.h:4258
@ BTL_RUMBLE_HIT_EXTREME
Definition enums.h:4257
@ BTL_RUMBLE_LONG
Definition enums.h:4253
@ BTL_RUMBLE_PLAYER_LIGHT
Definition enums.h:4260
@ EVT_FLAG_RUN_IMMEDIATELY
don't wait for next update_scripts call
Definition evt.h:161
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:
= {
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
}

Definition at line 13 of file 190B20.c.

13 {
14 NULL, NULL, NULL, NULL,
15 NULL, NULL, NULL, NULL,
16 NULL, NULL, NULL, NULL,
17 NULL, NULL, NULL, NULL,
18 NULL, NULL, NULL, NULL,
19 NULL, NULL, NULL, NULL,
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

Gfx D_80293970[]
Initial value:
= {
gsDPPipeSync(),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF),
gsDPSetCycleType(G_CYC_1CYCLE),
gsDPSetTexturePersp(G_TP_NONE),
gsDPSetTextureDetail(G_TD_CLAMP),
gsDPSetTextureLOD(G_TL_TILE),
gsDPSetTextureFilter(G_TF_POINT),
gsDPSetTextureLUT(G_TT_NONE),
gsDPSetTextureConvert(G_TC_FILT),
gsSPEndDisplayList(),
}

Definition at line 31 of file 190B20.c.

31 {
32 gsDPPipeSync(),
33 gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF),
34 gsDPSetCycleType(G_CYC_1CYCLE),
35 gsDPSetTexturePersp(G_TP_NONE),
36 gsDPSetTextureDetail(G_TD_CLAMP),
37 gsDPSetTextureLOD(G_TL_TILE),
38 gsDPSetTextureFilter(G_TF_POINT),
39 gsDPSetTextureLUT(G_TT_NONE),
40 gsDPSetTextureConvert(G_TC_FILT),
41 gsSPEndDisplayList(),
42};

Referenced by btl_appendGfx_prim_quad().

◆ bCurRumbleScript

s32 bCurRumbleScript = 0

Definition at line 44 of file 190B20.c.

Referenced by start_rumble_type().

◆ bMarioDefenseTable

s32 bMarioDefenseTable[]
extern

Definition at line 128 of file actors.c.

128 {
131};

Referenced by load_player_actor().

◆ bPlayerStatusTable

s32 bPlayerStatusTable[]
extern

Definition at line 133 of file actors.c.

133 {
136 STATUS_KEY_SLEEP, 100,
139 STATUS_KEY_DIZZY, 100,
140 STATUS_KEY_FEAR, 100,
144 STATUS_KEY_STOP, 100,
156};
@ STATUS_TURN_MOD_PARALYZE
Definition enums.h:2234
@ STATUS_TURN_MOD_SLEEP
Definition enums.h:2228
@ STATUS_TURN_MOD_DIZZY
Definition enums.h:2232
@ STATUS_TURN_MOD_POISON
Definition enums.h:2233
@ STATUS_TURN_MOD_STOP
Definition enums.h:2237
@ STATUS_TURN_MOD_FROZEN
Definition enums.h:2230
@ STATUS_TURN_MOD_STATIC
Definition enums.h:2229
@ STATUS_TURN_MOD_FEAR
Definition enums.h:2231
@ STATUS_TURN_MOD_SHRINK
Definition enums.h:2235

Referenced by load_player_actor().

◆ bPlayerActorBlueprint

ActorBlueprint bPlayerActorBlueprint
extern

Definition at line 158 of file actors.c.

158 {
159 .type = ACTOR_TYPE_PLAYER,
160 .maxHP = 99,
161 .statusTable = bPlayerStatusTable,
162
163 .escapeChance = 0,
164 .airLiftChance = 0,
165 .hurricaneChance = 0,
166 .spookChance = 0,
167 .upAndAwayChance = 0,
168 .spinSmashReq = 4,
169 .powerBounceChance = 80,
170
171 .size = { 33, 43 },
172 .healthBarOffset = { 0, 0 },
173 .statusIconOffset = { -10, 30 },
174 .statusTextOffset = { 10, 30 },
175};
s32 bPlayerStatusTable[]
Definition actors.c:133

Referenced by load_player_actor().

◆ bMarioParts

ActorPartBlueprint bMarioParts[]
extern

Definition at line 177 of file actors.c.

177 {
178 {
179 .index = 1,
180 .posOffset = { 0, 0, 0 },
181 .targetOffset = { 0, 32 },
182 .opacity = 255,
183 .idleAnimations = bMarioIdleAnims,
184 .defenseTable = bMarioDefenseTable,
185 },
186};
s32 bMarioDefenseTable[]
Definition actors.c:128
u32 bMarioIdleAnims[]
Definition actors.c:53

Referenced by load_player_actor().

◆ bPartnerDmaTable

PartnerDMAData bPartnerDmaTable[]
extern

Definition at line 26 of file partner_dma.c.

26 {
27 {},
28 BATTLE_PARTNER_ENTRY(goombario, 0),
29 BATTLE_PARTNER_ENTRY(kooper, 0),
30 BATTLE_PARTNER_ENTRY(bombette, 0),
31 BATTLE_PARTNER_ENTRY(parakarry, 30),
32 BATTLE_PARTNER_ENTRY(goompa, 0),
33 BATTLE_PARTNER_ENTRY(watt, 20),
34 BATTLE_PARTNER_ENTRY(sushie, 0),
35 BATTLE_PARTNER_ENTRY(lakilester, 10),
36 BATTLE_PARTNER_ENTRY(bow, 20),
37 {},
38 BATTLE_PARTNER_ENTRY(twink, 30),
39};
#define BATTLE_PARTNER_ENTRY(name, Y)
Definition partner_dma.c:17

Referenced by load_partner_actor().

◆ EVS_BattleRumble_Long

EvtScript EVS_BattleRumble_Long
Initial value:
= {
Call(N(StartRumbleWithParams), 256, 30)
Call(N(StartRumbleWithParams), 200, 15)
Call(N(StartRumbleWithParams), 50, 15)
}
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:213
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:576
#define Return
Kills the current EVT thread.
Definition macros.h:217

Definition at line 3030 of file 190B20.c.

3030 {
3031 Call(N(StartRumbleWithParams), 256, 30)
3032 Call(N(StartRumbleWithParams), 200, 15)
3033 Call(N(StartRumbleWithParams), 50, 15)
3034 Return
3035 End
3036};

Referenced by start_rumble_type().

◆ EVS_BattleRumble_HitMin

EvtScript EVS_BattleRumble_HitMin
Initial value:
= {
Call(N(StartRumbleWithParams), 100, 20)
}

Definition at line 3038 of file 190B20.c.

3038 {
3039 Call(N(StartRumbleWithParams), 100, 20)
3040 Return
3041 End
3042};

Referenced by start_rumble_type().

◆ EVS_BattleRumble_HitLight

EvtScript EVS_BattleRumble_HitLight
Initial value:
= {
Call(N(StartRumbleWithParams), 150, 20)
}

Definition at line 3044 of file 190B20.c.

3044 {
3045 Call(N(StartRumbleWithParams), 150, 20)
3046 Return
3047 End
3048};

Referenced by start_rumble_type().

◆ EVS_BattleRumble_HitHeavy

EvtScript EVS_BattleRumble_HitHeavy
Initial value:
= {
Call(N(StartRumbleWithParams), 200, 30)
}

Definition at line 3050 of file 190B20.c.

3050 {
3051 Call(N(StartRumbleWithParams), 200, 30)
3052 Return
3053 End
3054};

Referenced by start_rumble_type().

◆ EVS_BattleRumble_HitExtreme

EvtScript EVS_BattleRumble_HitExtreme
Initial value:
= {
Call(N(StartRumbleWithParams), 256, 40)
}

Definition at line 3056 of file 190B20.c.

3056 {
3057 Call(N(StartRumbleWithParams), 256, 40)
3058 Return
3059 End
3060};

Referenced by start_rumble_type().

◆ EVS_BattleRumble_HitMax

EvtScript EVS_BattleRumble_HitMax
Initial value:
= {
Call(N(StartRumbleWithParams), 256, 60)
}

Definition at line 3062 of file 190B20.c.

3062 {
3063 Call(N(StartRumbleWithParams), 256, 60)
3064 Return
3065 End
3066};

Referenced by start_rumble_type().

◆ EVS_BattleRumble_PlayerMin

EvtScript EVS_BattleRumble_PlayerMin
Initial value:
= {
Call(N(StartRumbleWithParams), 100, 20)
}

Definition at line 3068 of file 190B20.c.

3068 {
3069 Call(N(StartRumbleWithParams), 100, 20)
3070 Return
3071 End
3072};

Referenced by start_rumble_type().

◆ EVS_BattleRumble_PlayerLight

EvtScript EVS_BattleRumble_PlayerLight
Initial value:
= {
Call(N(StartRumbleWithParams), 150, 20)
}

Definition at line 3074 of file 190B20.c.

3074 {
3075 Call(N(StartRumbleWithParams), 150, 20)
3076 Return
3077 End
3078};

◆ EVS_BattleRumble_PlayerHeavy

EvtScript EVS_BattleRumble_PlayerHeavy
Initial value:
= {
Call(N(StartRumbleWithParams), 200, 30)
}

Definition at line 3080 of file 190B20.c.

3080 {
3081 Call(N(StartRumbleWithParams), 200, 30)
3082 Return
3083 End
3084};

◆ EVS_BattleRumble_PlayerExtreme

EvtScript EVS_BattleRumble_PlayerExtreme
Initial value:
= {
Call(N(StartRumbleWithParams), 256, 40)
}

Definition at line 3086 of file 190B20.c.

3086 {
3087 Call(N(StartRumbleWithParams), 256, 40)
3088 Return
3089 End
3090};

◆ EVS_BattleRumble_PlayerMax

EvtScript EVS_BattleRumble_PlayerMax
Initial value:
= {
Call(N(StartRumbleWithParams), 256, 60)
}

Definition at line 3092 of file 190B20.c.

3092 {
3093 Call(N(StartRumbleWithParams), 256, 60)
3094 Return
3095 End
3096};