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

Go to the source code of this file.

Macros

#define LERP_COMPONENT(a, b, alpha)   ((a) * (255 - (alpha)) + (b) * (alpha)) / 255;
 
#define PAL_ANIM_END   0xFF
 

Enumerations

enum  StandardPalettes { STANDARD_PAL_POISON = 1 , STANDARD_PAL_DIZZY = 2 , STANDARD_PAL_STATIC = 3 }
 
enum  PalSwapState { PAL_SWAP_HOLD_A = 0 , PAL_SWAP_A_TO_B = 1 , PAL_SWAP_HOLD_B = 2 , PAL_SWAP_B_TO_A = 3 }
 
enum  { STATIC_DEFAULT = 0 , STATIC_BRIGHT = 1 , STATIC_DARK = 2 }
 
enum  { WATT_DEFAULT = 0 , WATT_BRIGHTEST = 1 , WATT_BRIGHTER = 2 }
 

Functions

void update_player_actor_shadow (void)
 
void appendGfx_npc_actor (s32 isPartner, s32 actorIndex)
 
void create_status_chill_out (s32 iconID)
 
void enable_status_static (s32 iconID)
 
void enable_status_chill_out (s32 iconID)
 
void enable_status_debuff (s16)
 
void enable_status_transparent (s16)
 
void enable_status_icon_boost_jump (s32 iconID)
 
void enable_status_icon_boost_hammer (s32 iconID)
 
s32 get_npc_anim_for_status (u32 *, s32)
 
void set_actor_pal_adjustment (Actor *actor, s32 arg1)
 
void create_status_icon_boost_hammer (s32 iconID)
 
void create_status_icon_boost_jump (s32 iconID)
 
void create_status_icon_peril (s32 iconID)
 
void create_status_icon_danger (s32 iconID)
 
void set_status_icons_offset (s32 iconID, s32 offsetY, s32 arg2)
 
void set_status_icons_properties (s32 iconID, f32 x, f32 y, f32 z, s32 arg, s32 arg2, s32 radius, s32 offsetY)
 
void appendGfx_npc_actor_reflection (s32, Actor *)
 
void make_flash_palettes (ActorPart *)
 
void func_unkA_draw_npc (ActorPart *, s32, Matrix4f)
 
void func_unkB_draw_npc (ActorPart *, s32, Matrix4f)
 
void func_unkA_draw_player (ActorPart *, s32, Matrix4f)
 
void func_unkB_draw_player (ActorPart *, s32, Matrix4f)
 
void part_glow_on (b32 arg0, ActorPart *part, s32 yaw, b32 arg3)
 
void part_flash_on (b32 arg0, ActorPart *part, s32 yaw, b32 arg3)
 
void add_part_decor_none (ActorPart *, s32)
 
void add_part_decor_golden_flames (ActorPart *, s32)
 
void add_part_decor_sweat (ActorPart *, s32)
 
void add_part_decor_seeing_stars (ActorPart *, s32)
 
void add_part_decor_red_flames (ActorPart *, s32)
 
void add_part_decor_smoky_trail (ActorPart *, s32)
 
void add_part_decor_fiery_trail (ActorPart *, s32)
 
void add_part_decor_whirlwind (ActorPart *, s32)
 
void add_part_decor_steam (ActorPart *, s32)
 
void add_part_decor_sparkles (ActorPart *, s32)
 
void add_part_decor_bowser_aura (ActorPart *, s32)
 
void add_part_decor_radiating_stars (ActorPart *, s32)
 
void render_without_adjusted_palettes (b32 arg0, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation)
 
void render_with_sleep_palettes (b32 arg0, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation)
 
void render_with_static_palettes (b32 arg0, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation)
 
void render_with_fear_palettes (b32 arg0, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation)
 
void render_with_poison_palettes (b32 arg0, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation)
 
void render_with_paralyze_palettes (b32 arg0, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation)
 
void render_with_berserk_palettes (b32 arg0, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation)
 
void render_with_watt_idle_palettes (b32 arg0, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation)
 
void render_with_watt_attack_palettes (b32 arg0, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation)
 
void render_with_player_debuff_palettes (b32 arg0, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation, s32 isPoison)
 
void render_with_pal_blending (b32 arg0, ActorPart *part, s32 yaw, s32 arg3, Matrix4f mtx, s32 skipAnimation)
 
void render_with_palset_blending (b32 arg0, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation)
 
s32 update_part_glow (b32 isNpcSprite, ActorPart *part, s32 yaw, b32 isReflection)
 
s32 update_part_flash (b32 isNpcSprite, ActorPart *part, s32 yaw, b32 isReflection)
 
s32 get_player_anim_for_status (s32 animID)
 
void clear_part_flash_mode (ActorPart *part)
 
s32 get_flash_damage_intensity (ActorPart *part)
 
void mtx_mirror_y (Matrix4f mtx)
 
void enable_actor_blur (Actor *actor)
 
void disable_actor_blur (Actor *actor)
 
void reset_actor_blur (Actor *actor)
 
void force_disable_actor_blur (Actor *actor)
 
void enable_partner_blur (void)
 
void disable_partner_blur (void)
 
void reset_partner_blur (void)
 
void force_disable_partner_blur (void)
 
void enable_player_blur (void)
 
void disable_player_blur (void)
 
void reset_player_blur (void)
 
void force_disable_player_blur (void)
 
void force_disable_player_blur_immediately (void)
 
void update_player_actor_blur_history (Actor *actor)
 
void appendGfx_player_actor_blur (Actor *actor)
 
void update_nonplayer_actor_blur_history (b32 isPartner, Actor *actor)
 
void appendGfx_nonplayer_actor_blur (b32 isPartner, Actor *actor)
 
void update_enemy_actor_blur_history (Actor *actor)
 
void appendGfx_enemy_actor_blur (void *data)
 
void update_partner_actor_blur_history (Actor *actor)
 
void appendGfx_partner_actor_blur (void *data)
 
void update_nonplayer_actor_shadow (b32 isPartner, Actor *actor)
 
void update_enemy_shadows (void)
 
void update_hero_shadows (void)
 
void func_80255FD8 (void)
 
void appendGfx_enemy_actor (void *data)
 
void appendGfx_partner_actor (void *data)
 
void appendGfx_enemy_actor_reflection (void *data)
 
void appendGfx_partner_actor_reflection (void *data)
 
void appendGfx_player_actor (void *arg0)
 
void appendGfx_player_actor_reflection (void *arg0)
 
s32 render_with_adjusted_palettes (b32 isNpcSprite, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation)
 
void part_glow_off (b32 isNpcSprite, ActorPart *part, s32 yaw, b32 isReflection)
 
void part_flash_off (b32 isNpcSprite, ActorPart *part, s32 yaw, b32 isReflection)
 
void _add_part_decoration (ActorPart *actorPart)
 
void _remove_part_decoration (ActorPart *part, s32 idx)
 
void remove_part_decor_none (ActorPart *part, s32 idx)
 
void remove_part_decor_golden_flames (ActorPart *part, s32 idx)
 
void remove_part_decor_sweat (ActorPart *part, s32 idx)
 
void remove_part_decor_seeing_stars (ActorPart *part, s32 idx)
 
void remove_part_decor_red_flames (ActorPart *part, s32 idx)
 
void remove_part_decor_smoky_trail (ActorPart *part, s32 idx)
 
void remove_part_decor_fiery_trail (ActorPart *part, s32 idx)
 
void remove_part_decor_whirlwind (ActorPart *part, s32 idx)
 
void remove_part_decor_steam (ActorPart *part, s32 idx)
 
void remove_part_decor_sparkles (ActorPart *part, s32 idx)
 
void remove_part_decor_bowser_aura (ActorPart *part, s32 idx)
 
void remove_part_decor_radiating_stars (ActorPart *part, s32 idx)
 

Variables

u8 StaticPalettesAnim []
 
s16 FearPaletteAnimXOffsets [] = { -2, 2, 0, 0, -2, 2, 0, 0, 0, 0, -2, 2, 0, 0, 0, 0, 0, 0, 0xFF }
 
s16 ParalyzePaletteAnimXOffsets [] = { -2, 2, 0, 0, -2, 2, 0, 0, 0, 0, -2, 2, 0, 0, 0, 0, 0, 0, 0xFF }
 
u8 bWattIdlePalettesAnim []
 
u8 WattAttackPalettesAnim []
 
s16 SparkleSpawnIntervals [] = { -1, 15, 10, 7, 5, 3, 2, 1 }
 

Macro Definition Documentation

◆ LERP_COMPONENT

#define LERP_COMPONENT ( a,
b,
alpha )   ((a) * (255 - (alpha)) + (b) * (alpha)) / 255;

◆ PAL_ANIM_END

Enumeration Type Documentation

◆ StandardPalettes

Enumerator
STANDARD_PAL_POISON 
STANDARD_PAL_DIZZY 
STANDARD_PAL_STATIC 

Definition at line 7 of file actor_rendering.c.

7 {
11};
@ STANDARD_PAL_STATIC
@ STANDARD_PAL_DIZZY
@ STANDARD_PAL_POISON

◆ PalSwapState

Enumerator
PAL_SWAP_HOLD_A 
PAL_SWAP_A_TO_B 
PAL_SWAP_HOLD_B 
PAL_SWAP_B_TO_A 

Definition at line 18 of file actor_rendering.c.

18 {
23};
@ PAL_SWAP_HOLD_A
@ PAL_SWAP_HOLD_B
@ PAL_SWAP_B_TO_A
@ PAL_SWAP_A_TO_B

◆ anonymous enum

anonymous enum
Enumerator
STATIC_DEFAULT 
STATIC_BRIGHT 
STATIC_DARK 

Definition at line 26 of file actor_rendering.c.

26 {
28 STATIC_BRIGHT = 1,
29 STATIC_DARK = 2,
30};
@ STATIC_BRIGHT
@ STATIC_DARK
@ STATIC_DEFAULT

◆ anonymous enum

anonymous enum
Enumerator
WATT_DEFAULT 
WATT_BRIGHTEST 
WATT_BRIGHTER 

Definition at line 67 of file actor_rendering.c.

67 {
68 WATT_DEFAULT = 0,
70 WATT_BRIGHTER = 2,
71};
@ WATT_BRIGHTER
@ WATT_DEFAULT
@ WATT_BRIGHTEST

Function Documentation

◆ update_player_actor_shadow()

void update_player_actor_shadow ( void )

Definition at line 1393 of file actor_rendering.c.

1393 {
1394 BattleStatus* battleStatus = &gBattleStatus;
1395 Camera* camera = &gCameras[CAM_BATTLE];
1396 Actor* player = battleStatus->playerActor;
1397 ActorPart* parts = player->partsTable;
1398 Shadow* shadow;
1399 f32 x, y, z, distance;
1400
1402
1403 if (player->flags & ACTOR_FLAG_BLUR_ENABLED) {
1405 }
1406
1407 shadow = get_shadow_by_index(player->shadow.id);
1408 shadow->flags &= ~ENTITY_FLAG_HIDDEN;
1409
1410 if (!battleStatus->outtaSightActive) {
1411 shadow->alpha = 128;
1412 } else {
1413 shadow->alpha = 40;
1414 }
1415
1416 distance = 32767.0f;
1417 x = player->curPos.x + player->headOffset.x;
1418 z = player->curPos.z + player->headOffset.z;
1419 y = player->curPos.y + player->headOffset.y + 12.0;
1420 npc_raycast_down_sides(0, &x, &y, &z, &distance);
1421
1422 if (distance > 200.0f) {
1423 shadow->flags |= ENTITY_FLAG_HIDDEN;
1424 }
1425 shadow->pos.x = x;
1426 shadow->pos.y = y;
1427 shadow->pos.z = z;
1428 shadow->rot.y = clamp_angle(player->yaw - camera->curYaw);
1429 set_standard_shadow_scale(shadow, distance);
1430 shadow->scale.x *= player->shadowScale * player->scalingFactor;
1431
1432 if (parts->opacity >= 255 && !(parts->flags & ACTOR_PART_FLAG_TRANSPARENT)) {
1434 } else {
1436 }
1437}
void update_player_actor_blur_history(Actor *actor)
f32 shadowScale
Vec3s headOffset
f32 scalingFactor
union Actor::@38 shadow
struct ActorPart * partsTable
Vec3f curPos
Vec3f scale
#define npc_raycast_down_sides
#define clamp_angle
@ RENDER_MODE_SURFACE_XLU_LAYER3
Definition enums.h:3299
@ RENDER_MODE_ALPHATEST
Definition enums.h:3276
@ ENTITY_FLAG_HIDDEN
Definition enums.h:2613
@ ACTOR_FLAG_BLUR_ENABLED
Definition enums.h:3344
@ ACTOR_PART_FLAG_TRANSPARENT
Definition enums.h:3357
@ CAM_BATTLE
Definition enums.h:1801
void set_standard_shadow_scale(Shadow *shadow, f32 scale)
Definition entity.c:1674
Shadow * get_shadow_by_index(s32 index)
Definition entity.c:534
s32 spr_update_player_sprite(s32 spriteInstanceID, s32 animID, f32 timeScale)
Definition sprite.c:823
@ PLAYER_SPRITE_MAIN
Definition sprite.h:26
struct Actor * playerActor
Camera gCameras[4]
Definition cam_main.c:17
BattleStatus gBattleStatus
Definition battle.c:11

Referenced by update_hero_shadows().

◆ appendGfx_npc_actor()

void appendGfx_npc_actor ( s32 isPartner,
s32 actorIndex )

Definition at line 832 of file actor_rendering.c.

832 {
833 BattleStatus* battleStatus = &gBattleStatus;
834 Matrix4f mtxRotX, mtxRotY, mtxRotZ, mtxRotation;
835 Matrix4f mtxScale, mtxScaleMod;
836 Matrix4f mtxPivotOn, mtxPivotOff, mtxTranslate;
837 Matrix4f mtxTemp, mtxActor, mtxTransform, mtxPartScale;
838 Actor* actor;
839 ActorPart* part;
840 EffectInstance* effect;
841 s32 numParts;
842 f32 actorPosX, actorPosY, actorPosZ;
843 f32 partPosX, partPosY, partPosZ, partYaw;
844 u32 lastAnim;
845 s32 animChanged;
846 s32 palChanged;
847 s32 decorChanged;
848 s32 i;
849
850 if (!isPartner) {
851 actor = battleStatus->enemyActors[actorIndex];
852 } else {
853 actor = battleStatus->partnerActor;
854 }
855 actorPosX = actor->curPos.x + actor->headOffset.x;
856 if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
857 actorPosY = actor->curPos.y + actor->headOffset.y + actor->verticalRenderOffset;
858 } else {
859 actorPosY = actor->curPos.y - actor->headOffset.y + actor->verticalRenderOffset;
860 }
861 actorPosZ = actor->curPos.z + actor->headOffset.z;
862
863 actor->disableEffect->data.disableX->pos.x = actorPosX +
865 actor->disableEffect->data.disableX->pos.y = actorPosY +
867 actor->disableEffect->data.disableX->pos.z = actorPosZ;
868
870 if (actor->disableDismissTimer != 0) {
871 actor->disableDismissTimer--;
873 } else {
874 actor->disableEffect->data.disableX->scale = (actor->scalingFactor * 0.75);
875 }
876 } else {
878 actor->disableDismissTimer = 10;
879 }
880 if (actor->debuff == STATUS_KEY_FROZEN) {
881 effect = actor->icePillarEffect;
882 if (actor->icePillarEffect != NULL) {
885 {
886 effect->data.icePillar->pos.x = actorPosX;
887 effect->data.icePillar->pos.y = actorPosY;
888 effect->data.icePillar->pos.z = actorPosZ;
889 effect->data.icePillar->scale = actor->size.y / 24.0;
890 } else {
894 }
895 }
896 } else {
897 effect = actor->icePillarEffect;
898 if (effect != NULL) {
900 actor->icePillarEffect = NULL;
901 }
902 }
903 set_status_icons_properties(actor->hudElementDataIndex, actorPosX, actorPosY, actorPosZ,
908
909 if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
911 actor->size.y * actor->scalingFactor,
912 actor->size.x * actor->scalingFactor);
913 } else {
915 -actor->size.y * actor->scalingFactor,
916 actor->size.x * actor->scalingFactor);
917 }
918
919 if (actor->debuff == STATUS_KEY_SHRINK) {
920 actor->scalingFactor += ((0.4 - actor->scalingFactor) / 6.0);
921 } else {
922 actor->scalingFactor += ((1.0 - actor->scalingFactor) / 6.0);
923 }
924
925 if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
926 guTranslateF(mtxPivotOn,
927 -actor->rotPivotOffset.x * actor->scalingFactor,
928 -actor->rotPivotOffset.y * actor->scalingFactor,
929 -actor->rotPivotOffset.z * actor->scalingFactor);
930 guTranslateF(mtxPivotOff,
931 actor->rotPivotOffset.x * actor->scalingFactor,
932 actor->rotPivotOffset.y * actor->scalingFactor,
933 actor->rotPivotOffset.z * actor->scalingFactor);
934 } else {
935 guTranslateF(mtxPivotOn,
936 -actor->rotPivotOffset.x * actor->scalingFactor,
937 actor->rotPivotOffset.y * actor->scalingFactor,
938 -actor->rotPivotOffset.z * actor->scalingFactor);
939 guTranslateF(mtxPivotOff,
940 actor->rotPivotOffset.x * actor->scalingFactor,
941 -actor->rotPivotOffset.y * actor->scalingFactor,
942 actor->rotPivotOffset.z * actor->scalingFactor);
943 }
944 guRotateF(mtxRotX, actor->rot.x, 1.0f, 0.0f, 0.0f);
945 guRotateF(mtxRotY, actor->rot.y, 0.0f, 1.0f, 0.0f);
946 guRotateF(mtxRotZ, actor->rot.z, 0.0f, 0.0f, 1.0f);
947 guMtxCatF(mtxRotY, mtxRotX, mtxTemp);
948 guMtxCatF(mtxTemp, mtxRotZ, mtxRotation);
949 guScaleF(mtxScale,
950 actor->scale.x * SPRITE_WORLD_SCALE_D * actor->scalingFactor,
951 actor->scale.y * SPRITE_WORLD_SCALE_D * actor->scalingFactor,
952 actor->scale.z * SPRITE_WORLD_SCALE_D);
953 guScaleF(mtxScaleMod, actor->scaleModifier.x, actor->scaleModifier.y, actor->scaleModifier.z);
954 guMtxCatF(mtxPivotOn, mtxScale, mtxTemp);
955 guMtxCatF(mtxTemp, mtxScaleMod, mtxScale);
956 guMtxCatF(mtxScale, mtxRotation, mtxTransform);
957 guMtxCatF(mtxTransform, mtxPivotOff, mtxActor);
958
959 part = actor->partsTable;
960 numParts = actor->numParts;
961 for (i = 0; i < numParts; i++) {
963 partPosX = actorPosX + part->partOffset.x + part->visualOffset.x;
964 if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
965 partPosY = actorPosY + part->partOffset.y + part->visualOffset.y;
966 } else {
967 partPosY = (actorPosY - part->partOffset.y) - part->visualOffset.y;
968 }
969 partPosZ = actorPosZ + part->partOffset.z + part->visualOffset.z;
970 partYaw = part->yaw = actor->yaw;
971 } else {
972 partPosX = part->absolutePos.x + part->visualOffset.x;
973 partPosY = part->absolutePos.y + part->visualOffset.y;
974 partPosZ = part->absolutePos.z + part->visualOffset.z;
975 guScaleF(mtxPartScale,
978 actor->scale.z * SPRITE_WORLD_SCALE_D);
979 partYaw = part->yaw;
980 }
981 part->curPos.x = partPosX;
982 part->curPos.y = partPosY;
983 part->curPos.z = partPosZ;
984
985 if (part->flags & ACTOR_PART_FLAG_INVISIBLE) {
986 part = part->nextPart;
987 continue;
988 }
989 if (part->idleAnimations == NULL) {
990 part = part->nextPart;
991 continue;
992 }
993
996 } else {
997 part->flags &= ~ACTOR_PART_FLAG_TRANSPARENT;
998 }
999
1000 lastAnim = part->curAnimation;
1001 animChanged = FALSE;
1002 palChanged = FALSE;
1003 decorChanged = FALSE;
1004
1005 if (isPartner) {
1008 ) {
1009 if (actor->koStatus == 0) {
1012 animChanged = TRUE;
1013 }
1015 palChanged = TRUE;
1017 decorChanged = TRUE;
1018 }
1019 if (isPartner && (gPlayerData.curPartner == PARTNER_WATT)) {
1020 if (!palChanged) {
1022 }
1023 palChanged = TRUE;
1024 }
1025 }
1026 if (actor->isGlowing) {
1027 if (!decorChanged) {
1029 }
1030 decorChanged = TRUE;
1031 }
1032 if (actor->debuff == STATUS_KEY_POISON) {
1033 if (!palChanged) {
1035 }
1036 palChanged = TRUE;
1037 }
1038 if (actor->debuff == STATUS_KEY_PARALYZE) {
1039 if (!palChanged) {
1041 }
1042 palChanged = TRUE;
1043 }
1044 if (actor->debuff == STATUS_KEY_FEAR) {
1045 if (!palChanged) {
1047 }
1048 palChanged = TRUE;
1049 }
1050 if (actor->staticStatus == STATUS_KEY_STATIC) {
1051 if (!palChanged) {
1053 }
1054 palChanged = TRUE;
1055 }
1056 if (!palChanged && !(part->flags & ACTOR_PART_FLAG_HAS_PAL_EFFECT)) {
1058 }
1059 if (!decorChanged && !(part->flags & ACTOR_PART_FLAG_HAS_PAL_EFFECT)) {
1061 }
1062
1063 // adjust idle animation for status
1064 if (actor->flags & ACTOR_FLAG_USING_IDLE_ANIM) {
1065 if (!(part->flags & ACTOR_PART_FLAG_NO_STATUS_ANIMS)) {
1066 if (actor->debuff == STATUS_KEY_FROZEN) {
1067 if (!animChanged) {
1069 animChanged = TRUE;
1070 }
1071 } else if (actor->debuff != STATUS_KEY_SHRINK) {
1072 if (actor->debuff == STATUS_KEY_POISON) {
1073 if (!animChanged) {
1075 animChanged = TRUE;
1076 }
1077 } else if (actor->debuff == STATUS_KEY_DIZZY) {
1078 if (!animChanged) {
1080 animChanged = TRUE;
1081 }
1082 } else if (actor->debuff == STATUS_KEY_FEAR) {
1083 if (!animChanged) {
1085 animChanged = TRUE;
1086 }
1087 } else if (actor->debuff == STATUS_KEY_SLEEP) {
1088 if (!animChanged) {
1090 animChanged = TRUE;
1091 }
1092 } else if (actor->debuff == STATUS_KEY_PARALYZE) {
1093 if (!animChanged) {
1095 animChanged = TRUE;
1096 }
1097 }
1098 }
1099
1100 if (actor->staticStatus == STATUS_KEY_STATIC) {
1101 if (!animChanged) {
1103 animChanged = TRUE;
1104 }
1105 }
1106 if (!animChanged) {
1108 }
1109
1110 if (isPartner) {
1111 if (actor->koStatus == STATUS_KEY_DAZE) {
1113 animChanged = TRUE;
1114 } else {
1118 }
1119 }
1120 }
1121 if (actor->debuff == STATUS_KEY_STOP) {
1124 } else if (!animChanged) {
1128 }
1129 }
1130 }
1131 }
1132
1134 if (actor->debuff == STATUS_KEY_POISON) {
1136 } else if (actor->debuff == STATUS_KEY_DIZZY) {
1138 } else if (actor->debuff == STATUS_KEY_SLEEP) {
1140 } else if (actor->debuff == STATUS_KEY_PARALYZE) {
1142 } else if (actor->debuff == STATUS_KEY_SHRINK) {
1144 } else if (actor->debuff == STATUS_KEY_FROZEN) {
1146 }
1147 if (actor->staticStatus == STATUS_KEY_STATIC) {
1149 }
1152 }
1153 if (actor->chillOutAmount != 0) {
1155 }
1156 } else {
1161 }
1162 if (part->spriteInstanceID >= 0) {
1163 if (lastAnim != part->curAnimation) {
1166 }
1167 }
1168 if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
1169 guTranslateF(mtxPivotOn,
1170 -part->rotPivotOffset.x * actor->scalingFactor,
1171 -part->rotPivotOffset.y * actor->scalingFactor,
1172 -part->rotPivotOffset.z * actor->scalingFactor);
1173 guTranslateF(mtxPivotOff,
1174 part->rotPivotOffset.x * actor->scalingFactor,
1175 part->rotPivotOffset.y * actor->scalingFactor,
1176 part->rotPivotOffset.z * actor->scalingFactor);
1177 } else {
1178 guTranslateF(mtxPivotOn,
1179 -part->rotPivotOffset.x * actor->scalingFactor,
1180 part->rotPivotOffset.y * actor->scalingFactor,
1181 -part->rotPivotOffset.z * actor->scalingFactor);
1182 guTranslateF(mtxPivotOff,
1183 part->rotPivotOffset.x * actor->scalingFactor,
1184 -part->rotPivotOffset.y * actor->scalingFactor,
1185 part->rotPivotOffset.z * actor->scalingFactor);
1186 }
1187 guTranslateF(mtxTranslate,
1188 partPosX + part->palAnimPosOffset[0],
1189 partPosY + part->palAnimPosOffset[1],
1190 partPosZ);
1191 guRotateF(mtxRotX, part->rot.x, 1.0f, 0.0f, 0.0f);
1192 guRotateF(mtxRotY, part->rot.y, 0.0f, 1.0f, 0.0f);
1193 guRotateF(mtxRotZ, part->rot.z, 0.0f, 0.0f, 1.0f);
1194 guMtxCatF(mtxRotY, mtxRotX, mtxTemp);
1195 guMtxCatF(mtxTemp, mtxRotZ, mtxRotation);
1196 guScaleF(mtxScale, part->scale.x, part->scale.y * part->verticalStretch, part->scale.z);
1197 guMtxCatF(mtxScale, mtxPivotOn, mtxTransform);
1198 guMtxCatF(mtxTransform, mtxRotation, mtxTemp);
1199 guMtxCatF(mtxTemp, mtxPivotOff, mtxTransform);
1200
1202 guMtxCatF(mtxTransform, mtxActor, mtxTemp);
1203 } else {
1204 guMtxCatF(mtxTransform, mtxPartScale, mtxTemp);
1205 }
1206 guMtxCatF(mtxTemp, mtxTranslate, mtxTransform);
1207
1208 part->curPos.x = partPosX + part->palAnimPosOffset[0];
1209 part->curPos.y = partPosY + part->palAnimPosOffset[1];
1210 part->curPos.z = partPosZ;
1211
1212 if (part->spriteInstanceID >= 0) {
1213 if (!isPartner) {
1214 update_part_glow(TRUE, part, partYaw, FALSE);
1215 update_part_flash(TRUE, part, partYaw, FALSE);
1216 render_with_adjusted_palettes(SPRITE_MODE_NPC, part, partYaw, mtxTransform, 0);
1217 } else {
1218 update_part_glow(TRUE, part, clamp_angle(180.0f - partYaw), FALSE);
1219 update_part_flash(TRUE, part, clamp_angle(180.0f - partYaw), FALSE);
1220 render_with_adjusted_palettes(SPRITE_MODE_NPC, part, clamp_angle(180.0f - partYaw), mtxTransform, 0);
1221 }
1222
1224 }
1225
1226 part = part->nextPart;
1227 }
1228}
void set_actor_pal_adjustment(Actor *actor, s32 arg1)
Definition 190B20.c:2607
void enable_status_transparent(s16)
s32 get_npc_anim_for_status(u32 *, s32)
Definition 190B20.c:1944
s32 update_part_glow(b32 isNpcSprite, ActorPart *part, s32 yaw, b32 isReflection)
void _add_part_decoration(ActorPart *actorPart)
s32 render_with_adjusted_palettes(b32 isNpcSprite, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation)
void enable_status_chill_out(s32 iconID)
void enable_status_debuff(s16)
void enable_status_static(s32 iconID)
s32 update_part_flash(b32 isNpcSprite, ActorPart *part, s32 yaw, b32 isReflection)
void set_status_icons_properties(s32 iconID, f32 x, f32 y, f32 z, s32 arg, s32 arg2, s32 radius, s32 offsetY)
void set_status_icons_offset(s32 iconID, s32 offsetY, s32 arg2)
void create_status_chill_out(s32 iconID)
Vec2b statusIconOffset
struct EffectInstance * disableEffect
s16 palAnimPosOffset[2]
u32 * idleAnimations
s8 transparentStatus
Vec2b statusTextOffset
s8 disableDismissTimer
struct ActorBlueprint * actorBlueprint
s8 verticalRenderOffset
Vec3s rotPivotOffset
Vec3f scaleModifier
struct EffectInstance * icePillarEffect
s8 chillOutAmount
Vec2bu size
f32 Matrix4f[4][4]
s16 hudElementDataIndex
struct ActorPart * nextPart
Vec3s rotPivotOffset
Vec3f scale
#define guRotateF
#define guTranslateF
#define guMtxCatF
#define guScaleF
struct DisableXFXData * disableX
Definition effects.h:2529
struct IcePillarFXData * icePillar
Definition effects.h:2593
EffectData data
Definition effects.h:2605
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3517
@ GLOW_PAL_OFF
Definition enums.h:2258
@ GLOW_PAL_ON
Definition enums.h:2259
@ BS_FLAGS1_TATTLE_OPEN
Definition enums.h:3567
@ BS_FLAGS1_SHOW_PLAYER_DECORATIONS
Definition enums.h:3568
@ ACTOR_PAL_ADJUST_FEAR
Definition enums.h:2244
@ ACTOR_PAL_ADJUST_WATT_IDLE
Definition enums.h:2248
@ ACTOR_PAL_ADJUST_POISON
Definition enums.h:2245
@ ACTOR_PAL_ADJUST_PARALYZE
Definition enums.h:2246
@ ACTOR_PAL_ADJUST_STATIC
Definition enums.h:2243
@ ACTOR_PAL_ADJUST_PLAYER_DEBUFF
Definition enums.h:2250
@ ACTOR_PAL_ADJUST_NONE
Definition enums.h:2241
@ BS_FLAGS2_OVERRIDE_INACTIVE_PARTNER
Definition enums.h:3608
@ BS_FLAGS2_PARTNER_TURN_USED
Definition enums.h:3606
@ STATUS_KEY_PARALYZE
Definition enums.h:2201
@ STATUS_KEY_FROZEN
Definition enums.h:2203
@ STATUS_KEY_TRANSPARENT
Definition enums.h:2210
@ STATUS_KEY_STATIC
Definition enums.h:2207
@ STATUS_KEY_FEAR
Definition enums.h:2199
@ STATUS_KEY_SLEEP
Definition enums.h:2202
@ STATUS_KEY_STOP
Definition enums.h:2204
@ STATUS_KEY_INACTIVE
Definition enums.h:2214
@ STATUS_KEY_SHRINK
Definition enums.h:2206
@ STATUS_KEY_DIZZY
Definition enums.h:2200
@ STATUS_KEY_POISON
Definition enums.h:2205
@ STATUS_KEY_NORMAL
Definition enums.h:2197
@ STATUS_KEY_DAZE
Definition enums.h:2209
@ ACTOR_FLAG_SHOW_STATUS_ICONS
Definition enums.h:3343
@ ACTOR_FLAG_UPSIDE_DOWN
HP bar offset below actor (e.g. Swooper when upside-down).
Definition enums.h:3331
@ ACTOR_FLAG_USING_IDLE_ANIM
Definition enums.h:3342
@ PARTNER_WATT
Definition enums.h:2891
@ ACTOR_PART_FLAG_NO_STATUS_ANIMS
Definition enums.h:3364
@ ACTOR_PART_FLAG_HAS_PAL_EFFECT
Definition enums.h:3363
@ ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION
Definition enums.h:3361
@ ACTOR_PART_FLAG_INVISIBLE
Definition enums.h:3350
void create_status_debuff(s32, s32)
void create_status_transparent(s32, s32)
void create_status_static(s32, s32)
void set_actor_glow_pal(Actor *actor, s32 arg1)
Definition 190B20.c:2654
#define NPC_DISPOSE_POS_Z
Definition macros.h:161
#define SPRITE_WORLD_SCALE_D
Definition macros.h:140
#define NPC_DISPOSE_POS_X
Definition macros.h:159
#define NPC_DISPOSE_POS_Y
Definition macros.h:160
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
@ SPRITE_MODE_NPC
Definition sprite.h:34
Vec2b statusIconOffset
Definition battle.h:150
Vec2b statusTextOffset
Definition battle.h:151
struct Actor * partnerActor
struct Actor * enemyActors[24]
PlayerData gPlayerData
Definition 77480.c:40

Referenced by appendGfx_enemy_actor(), and appendGfx_partner_actor().

◆ create_status_chill_out()

void create_status_chill_out ( s32 iconID)

Definition at line 1144 of file status_icons.c.

1144 {
1145 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1146
1147 statusIcon->flags &= ~STATUS_ICON_FLAG_STATUS_CHILL_OUT;
1148 if (!statusIcon->status4.active) {
1149 statusIcon->status4.active = TRUE;
1150 statusIcon->status4.activeTask = TRUE;
1151 }
1152}
HudComplexStatusIcon status4
BSS HudStatusIcon * D_800A0F44

Referenced by appendGfx_npc_actor().

◆ enable_status_static()

void enable_status_static ( s32 iconID)

Definition at line 1108 of file status_icons.c.

1108 {
1109 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1110
1111 statusIcon->flags |= STATUS_ICON_FLAG_STATIC;
1112}
@ STATUS_ICON_FLAG_STATIC

Referenced by appendGfx_npc_actor(), and appendGfx_player_actor().

◆ enable_status_chill_out()

void enable_status_chill_out ( s32 iconID)

Definition at line 1167 of file status_icons.c.

1167 {
1168 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1169
1171}
@ STATUS_ICON_FLAG_STATUS_CHILL_OUT

Referenced by appendGfx_npc_actor(), and appendGfx_player_actor().

◆ enable_status_debuff()

void enable_status_debuff ( s16 )

◆ enable_status_transparent()

void enable_status_transparent ( s16 )

◆ enable_status_icon_boost_jump()

void enable_status_icon_boost_jump ( s32 iconID)

Definition at line 1199 of file status_icons.c.

1199 {
1200 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1201
1202 statusIcon->flags |= STATUS_ICON_FLAG_BOOST_JUMP;
1203}
@ STATUS_ICON_FLAG_BOOST_JUMP

Referenced by appendGfx_player_actor().

◆ enable_status_icon_boost_hammer()

void enable_status_icon_boost_hammer ( s32 iconID)

Definition at line 1231 of file status_icons.c.

1231 {
1232 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1233
1234 statusIcon->flags |= STATUS_ICON_FLAG_BOOST_HAMMER;
1235}
@ STATUS_ICON_FLAG_BOOST_HAMMER

Referenced by appendGfx_player_actor().

◆ get_npc_anim_for_status()

s32 get_npc_anim_for_status ( u32 * 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
@ 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().

◆ set_actor_pal_adjustment()

void set_actor_pal_adjustment ( Actor * actor,
s32 arg1 )

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

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

◆ create_status_icon_boost_hammer()

void create_status_icon_boost_hammer ( s32 iconID)

Definition at line 1205 of file status_icons.c.

1205 {
1206 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1207 s32 hudElement;
1208
1209 statusIcon->flags &= ~STATUS_ICON_FLAG_BOOST_HAMMER;
1210 if (!statusIcon->boostHammer.active) {
1211 statusIcon->boostHammer.active = TRUE;
1215 statusIcon->boostHammer.activeElementID = hudElement;
1216 }
1217}
s32 hud_element_create(HudScript *anim)
Creates a new HUD element and returns its ID.
void hud_element_set_flags(s32 id, s32 flags)
Turns on the given flags.
@ HUD_ELEMENT_FLAG_DISABLED
Definition hud_element.h:74
@ HUD_ELEMENT_FLAG_80
Definition hud_element.h:80
HudScript HES_BoostHammerBegin
HudSimpleStatusIcon boostHammer

Referenced by appendGfx_player_actor().

◆ create_status_icon_boost_jump()

void create_status_icon_boost_jump ( s32 iconID)

Definition at line 1173 of file status_icons.c.

1173 {
1174 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1175 s32 hudElement;
1176
1177 statusIcon->flags &= ~STATUS_ICON_FLAG_BOOST_JUMP;
1178 if (!statusIcon->boostJump.active) {
1179 statusIcon->boostJump.active = TRUE;
1183 statusIcon->boostJump.activeElementID = hudElement;
1184 }
1185}
HudSimpleStatusIcon boostJump
HudScript HES_BoostJumpBegin

Referenced by appendGfx_player_actor().

◆ create_status_icon_peril()

void create_status_icon_peril ( s32 iconID)

Definition at line 1295 of file status_icons.c.

1295 {
1296 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1297 s32 hudElement;
1298
1299 statusIcon->flags &= ~STATUS_ICON_FLAG_PERIL;
1300 if (!statusIcon->peril.active) {
1301 statusIcon->peril.active = TRUE;
1302 hudElement = hud_element_create(&HES_Peril);
1305 statusIcon->peril.activeElementID = hudElement;
1306 }
1307}
HudSimpleStatusIcon peril
HudScript HES_Peril

Referenced by appendGfx_player_actor().

◆ create_status_icon_danger()

void create_status_icon_danger ( s32 iconID)

Definition at line 1324 of file status_icons.c.

1324 {
1325 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1326 s32 hudElement;
1327
1328 statusIcon->flags &= ~STATUS_ICON_FLAG_DANGER;
1329 if (!statusIcon->danger.active) {
1330 statusIcon->danger.active = TRUE;
1331 hudElement = hud_element_create(&HES_Danger);
1334 statusIcon->danger.activeElementID = hudElement;
1335 }
1336}
HudScript HES_Danger
HudSimpleStatusIcon danger

Referenced by appendGfx_player_actor().

◆ set_status_icons_offset()

void set_status_icons_offset ( s32 iconID,
s32 offsetY,
s32 arg2 )

Definition at line 1047 of file status_icons.c.

1047 {
1048 HudStatusIcon* statusIcon = &D_800A0F44[iconID];
1049
1050 statusIcon->offsetY = offsetY;
1051 statusIcon->offsetX = offsetX;
1052}

Referenced by appendGfx_npc_actor(), and appendGfx_player_actor().

◆ set_status_icons_properties()

void set_status_icons_properties ( s32 iconID,
f32 x,
f32 y,
f32 z,
s32 arg,
s32 arg2,
s32 radius,
s32 offsetY )

Definition at line 1031 of file status_icons.c.

1031 {
1032 HudStatusIcon* icon = &D_800A0F44[iconID];
1033
1034 icon->worldPos.x = x;
1035 icon->worldPos.y = y;
1036 icon->worldPos.z = z;
1037 icon->status1Radius = radius + 17;
1038 icon->status1OffsetY = offsetY;
1039 icon->status2Radius = radius + 17;
1040 icon->status2OffsetY = offsetY + 17;
1041 icon->status3Radius = radius + 17;
1042 icon->status3OffsetY = offsetY + 34;
1043 icon->status4Radius = radius + 17;
1044 icon->status4OffsetY = offsetY + 51;
1045}

Referenced by appendGfx_npc_actor(), and appendGfx_player_actor().

◆ appendGfx_npc_actor_reflection()

void appendGfx_npc_actor_reflection ( s32 flipYaw,
Actor * actor )

Definition at line 1230 of file actor_rendering.c.

1230 {
1231 Matrix4f mtxRotX, mtxRotY, mtxRotZ, mtxRotation, mtxScale;
1232 Matrix4f mtxPivotOn, mtxPivotOff, mtxTranslate;
1233 Matrix4f mtxTemp, mtxTransform, mtxMirror;
1234 Matrix4f mtxActor, mtxPartScale;
1235 ActorPart* part;
1236 f32 actorPosX, actorPosY, actorPosZ;
1237 f32 partPosX, partPosY, partPosZ;
1238 f32 partYaw;
1239 s32 numParts;
1240 s32 i;
1241
1242 actorPosX = actor->curPos.x + actor->headOffset.x;
1243 if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
1244 actorPosY = actor->curPos.y + actor->headOffset.y;
1245 } else {
1246 actorPosY = actor->curPos.y - actor->headOffset.y;
1247 }
1248 actorPosZ = actor->curPos.z + actor->headOffset.z - 5.0f;
1249
1250 if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
1251 guTranslateF(mtxPivotOn,
1252 -actor->rotPivotOffset.x * actor->scalingFactor,
1253 -actor->rotPivotOffset.y * actor->scalingFactor,
1254 -actor->rotPivotOffset.z * actor->scalingFactor);
1255 guTranslateF(mtxPivotOff,
1256 actor->rotPivotOffset.x * actor->scalingFactor,
1257 actor->rotPivotOffset.y * actor->scalingFactor,
1258 actor->rotPivotOffset.z * actor->scalingFactor);
1259 } else {
1260 guTranslateF(mtxPivotOn,
1261 -actor->rotPivotOffset.x * actor->scalingFactor,
1262 actor->rotPivotOffset.y * actor->scalingFactor,
1263 -actor->rotPivotOffset.z * actor->scalingFactor);
1264 guTranslateF(mtxPivotOff,
1265 actor->rotPivotOffset.x * actor->scalingFactor,
1266 -actor->rotPivotOffset.y * actor->scalingFactor,
1267 actor->rotPivotOffset.z * actor->scalingFactor);
1268 }
1269
1270 guRotateF(mtxRotX, actor->rot.x, 1.0f, 0.0f, 0.0f);
1271 guRotateF(mtxRotY, actor->rot.y, 0.0f, 1.0f, 0.0f);
1272 guRotateF(mtxRotZ, actor->rot.z, 0.0f, 0.0f, 1.0f);
1273 guMtxCatF(mtxRotY, mtxRotX, mtxTemp);
1274 guMtxCatF(mtxTemp, mtxRotZ, mtxRotation);
1275
1276 guScaleF(mtxScale,
1277 actor->scale.x * SPRITE_WORLD_SCALE_D * actor->scalingFactor,
1278 actor->scale.y * SPRITE_WORLD_SCALE_D * actor->scalingFactor,
1279 actor->scale.z * SPRITE_WORLD_SCALE_D);
1280
1281 guMtxCatF(mtxPivotOn, mtxScale, mtxTemp);
1282 guMtxCatF(mtxTemp, mtxRotation, mtxTransform);
1283 guMtxCatF(mtxTransform, mtxPivotOff, mtxActor);
1284
1285 part = actor->partsTable;
1286 numParts = actor->numParts;
1287 for (i = 0; i < numParts; i++) {
1288 // determine part position
1290 partPosX = actorPosX + part->partOffset.x + part->visualOffset.x;
1291 if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
1292 partPosY = actorPosY + part->partOffset.y + part->visualOffset.y;
1293 } else {
1294 partPosY = actorPosY - part->partOffset.y - part->visualOffset.y;
1295 }
1296 partPosZ = actorPosZ + part->partOffset.z + part->visualOffset.z;
1297 partYaw = part->yaw = actor->yaw;
1298 } else {
1299 partPosX = part->absolutePos.x + part->visualOffset.x;
1300 partPosY = part->absolutePos.y + part->visualOffset.y;
1301 partPosZ = part->absolutePos.z + part->visualOffset.z;
1302 guScaleF(mtxPartScale,
1303 actor->scale.x * SPRITE_WORLD_SCALE_D,
1304 actor->scale.y * SPRITE_WORLD_SCALE_D,
1305 actor->scale.z * SPRITE_WORLD_SCALE_D);
1306 partYaw = part->yaw;
1307 }
1308
1309 if (part->flags & ACTOR_PART_FLAG_INVISIBLE) {
1310 part = part->nextPart;
1311 continue;
1312 }
1313 if (part->idleAnimations == NULL) {
1314 part = part->nextPart;
1315 continue;
1316 }
1317
1318 if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
1319 guTranslateF(mtxPivotOn,
1320 -part->rotPivotOffset.x * actor->scalingFactor,
1321 -part->rotPivotOffset.y * actor->scalingFactor,
1322 -part->rotPivotOffset.z * actor->scalingFactor);
1323 guTranslateF(mtxPivotOff,
1324 part->rotPivotOffset.x * actor->scalingFactor,
1325 part->rotPivotOffset.y * actor->scalingFactor,
1326 part->rotPivotOffset.z * actor->scalingFactor);
1327 } else {
1328 guTranslateF(mtxPivotOn,
1329 -part->rotPivotOffset.x * actor->scalingFactor,
1330 part->rotPivotOffset.y * actor->scalingFactor,
1331 -part->rotPivotOffset.z * actor->scalingFactor);
1332 guTranslateF(mtxPivotOff,
1333 part->rotPivotOffset.x * actor->scalingFactor,
1334 -part->rotPivotOffset.y * actor->scalingFactor,
1335 part->rotPivotOffset.z * actor->scalingFactor);
1336 }
1337 guTranslateF(mtxTranslate,
1338 partPosX + part->palAnimPosOffset[0],
1339 partPosY + part->palAnimPosOffset[1],
1340 partPosZ - 1.0f);
1341
1342 guRotateF(mtxRotX, part->rot.x, 1.0f, 0.0f, 0.0f);
1343 guRotateF(mtxRotY, part->rot.y, 0.0f, 1.0f, 0.0f);
1344 guRotateF(mtxRotZ, part->rot.z, 0.0f, 0.0f, 1.0f);
1345 guMtxCatF(mtxRotY, mtxRotX, mtxTemp);
1346 guMtxCatF(mtxTemp, mtxRotZ, mtxRotation);
1347
1348 guScaleF(mtxScale, part->scale.x, part->scale.y * part->verticalStretch, part->scale.z);
1349 mtx_mirror_y(mtxMirror);
1350 guMtxCatF(mtxScale, mtxPivotOn, mtxTemp);
1351 guMtxCatF(mtxTemp, mtxRotation, mtxTransform);
1352 guMtxCatF(mtxTransform, mtxPivotOff, mtxTemp);
1354 guMtxCatF(mtxTemp, mtxActor, mtxTransform);
1355 } else {
1356 guMtxCatF(mtxTemp, mtxPartScale, mtxTransform);
1357 }
1358 guMtxCatF(mtxTransform, mtxTranslate, mtxTemp);
1359 guMtxCatF(mtxTemp, mtxMirror, mtxTransform);
1360
1361 if (flipYaw == 0) {
1362 update_part_glow(TRUE, part, partYaw, TRUE);
1363 update_part_flash(TRUE, part, partYaw, TRUE);
1364 render_with_adjusted_palettes(SPRITE_MODE_NPC, part, partYaw, mtxTransform, 1);
1365 } else {
1366 update_part_glow(TRUE, part, clamp_angle(partYaw + 180.0f), TRUE);
1367 update_part_flash(TRUE, part, clamp_angle(partYaw + 180.0f), TRUE);
1368 render_with_adjusted_palettes(SPRITE_MODE_NPC, part, clamp_angle(partYaw + 180.0f), mtxTransform, 1);
1369 }
1370
1371 part = part->nextPart;
1372 }
1373}
void mtx_mirror_y(Matrix4f mtx)

Referenced by appendGfx_enemy_actor_reflection(), and appendGfx_partner_actor_reflection().

◆ make_flash_palettes()

void make_flash_palettes ( ActorPart * part)

Definition at line 2006 of file actor_rendering.c.

2006 {
2007 DecorationTable* decorations = part->decorationTable;
2008 PAL_PTR src;
2009 PAL_PTR dest;
2010 s32 i, j;
2011
2012 for (i = 0; i < decorations->originalPalettesCount; i++) {
2013 if (decorations->adjustedPalettes[i] != NULL) {
2014 src = decorations->adjustedPalettes[i];
2015 dest = decorations->copiedPalettes[1][i];
2016
2017 for (j = 0; j < SPR_PAL_SIZE; j++) {
2018 *dest = *src | 0xFFFE; // pure white, not affecting alpha bit
2019 src++;
2020 dest++;
2021
2022 }
2023 decorations->flashPalettes[i] = decorations->copiedPalettes[1][i];
2024 }
2025 }
2026}
u16 * flashPalettes[16]
#define PAL_PTR
u16 copiedPalettes[2][27][16]
u16 * adjustedPalettes[27]
struct DecorationTable * decorationTable
#define SPR_PAL_SIZE
Definition macros.h:142

Referenced by func_unkB_draw_npc(), and func_unkB_draw_player().

◆ func_unkA_draw_npc()

void func_unkA_draw_npc ( ActorPart * part,
s32 yaw,
Matrix4f mtx )

Definition at line 2028 of file actor_rendering.c.

2028 {
2029 DecorationTable* decorations = part->decorationTable;
2030 s32 opacity = 255;
2031 s32 idMask = 0;
2032 PAL_PTR dest;
2033 PAL_PTR src;
2034 s32 i, j;
2035
2036 if (part->opacity < 255) {
2038 opacity = part->opacity;
2039 }
2040 if (part->flags & ACTOR_PART_FLAG_TRANSPARENT) {
2042 opacity = (opacity * 120) / 255;
2043 }
2044
2045 if (decorations->flashEnabled != FLASH_PAL_OFF) {
2046 decorations->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 0x10);
2047 decorations->originalPalettesCount = 0;
2048 while (decorations->originalPalettesList[decorations->originalPalettesCount] != (PAL_PTR) -1) {
2049 decorations->originalPalettesCount++;
2050 }
2051
2052 for (i = 0; i < decorations->originalPalettesCount; i++) {
2053 src = decorations->originalPalettesList[i];
2054 dest = decorations->copiedPalettes[0][i];
2055 if (src != NULL) {
2056 for (j = 0; j < ARRAY_COUNT(decorations->copiedPalettes[0][i]); j++) {
2057 *dest = *src;
2058 src++;
2059 dest++;
2060 }
2061 }
2062 }
2063
2064 for (i = 0; i < decorations->originalPalettesCount; i++) {
2065 decorations->adjustedPalettes[i] = decorations->copiedPalettes[0][i];
2066 }
2067
2068 func_unkB_draw_npc(part, yaw, mtx);
2069 } else {
2070 spr_draw_npc_sprite(part->spriteInstanceID | idMask, yaw, opacity, NULL, mtx);
2071 }
2072}
void func_unkB_draw_npc(ActorPart *, s32, Matrix4f)
@ FLASH_PAL_OFF
Definition enums.h:2270
#define ARRAY_COUNT(arr)
Definition macros.h:40
s32 spr_draw_npc_sprite(s32 spriteInstanceID, s32 yaw, s32 arg2, PAL_PTR *paletteList, Matrix4f mtx)
Definition sprite.c:1106
PAL_PTR * spr_get_npc_palettes(s32 npcSpriteID)
Definition sprite.c:1319
@ DRAW_SPRITE_OVERRIDE_ALPHA
Definition sprite.h:22

Referenced by render_with_paralyze_palettes(), and render_without_adjusted_palettes().

◆ func_unkB_draw_npc()

void func_unkB_draw_npc ( ActorPart * part,
s32 yaw,
Matrix4f mtx )

Definition at line 2074 of file actor_rendering.c.

2074 {
2075 DecorationTable* decorations = part->decorationTable;
2076 s32 opacity = 255;
2077 s32 idMask = 0;
2078
2079 if (part->opacity < 255) {
2081 opacity = part->opacity;
2082 }
2083
2084 if (part->flags & ACTOR_PART_FLAG_TRANSPARENT) {
2086 opacity = (opacity * 120) / 255;
2087 }
2088
2089 if (decorations->flashEnabled != FLASH_PAL_OFF) {
2090 make_flash_palettes(part);
2091 spr_draw_npc_sprite(part->spriteInstanceID | DRAW_SPRITE_OVERRIDE_PALETTES | idMask, yaw, opacity, decorations->flashPalettes, mtx);
2092 } else {
2093 spr_draw_npc_sprite(part->spriteInstanceID | DRAW_SPRITE_OVERRIDE_PALETTES | idMask, yaw, opacity, decorations->adjustedPalettes, mtx);
2094 }
2095}
void make_flash_palettes(ActorPart *)
@ DRAW_SPRITE_OVERRIDE_PALETTES
Definition sprite.h:20

Referenced by func_unkA_draw_npc(), render_with_berserk_palettes(), render_with_fear_palettes(), render_with_pal_blending(), render_with_palset_blending(), render_with_paralyze_palettes(), render_with_player_debuff_palettes(), render_with_poison_palettes(), render_with_sleep_palettes(), render_with_static_palettes(), render_with_watt_attack_palettes(), and render_with_watt_idle_palettes().

◆ func_unkA_draw_player()

void func_unkA_draw_player ( ActorPart * part,
s32 yaw,
Matrix4f mtx )

Definition at line 2097 of file actor_rendering.c.

2097 {
2098 DecorationTable* decorations = part->decorationTable;
2099 s32 opacity = 255;
2100 s32 idMask = 0;
2101 PAL_PTR src;
2102 PAL_PTR dest;
2103 s32 i, j;
2104
2105 if (part->opacity < 255) {
2107 opacity = part->opacity;
2108 }
2109 if (part->flags & ACTOR_PART_FLAG_TRANSPARENT) {
2111 opacity = (opacity * 120) / 255;
2112 }
2113
2114 if (decorations->flashEnabled != FLASH_PAL_OFF) {
2115 decorations->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16);
2116 decorations->originalPalettesCount = 0;
2117
2118 while (decorations->originalPalettesList[decorations->originalPalettesCount] != (PAL_PTR) -1) {
2119 decorations->originalPalettesCount++;
2120 }
2121
2122 for (i = 0; i < decorations->originalPalettesCount; i++) {
2123 src = decorations->originalPalettesList[i];
2124 dest = decorations->copiedPalettes[0][i];
2125 if (decorations->originalPalettesList[i] != NULL) {
2126 for (j = 0; j < ARRAY_COUNT(decorations->copiedPalettes[0][i]); j++) {
2127 *dest = *src;
2128 dest++;
2129 src++;
2130 }
2131 }
2132 }
2133 for (i = 0; i < decorations->originalPalettesCount; i++) {
2134 decorations->adjustedPalettes[i] = decorations->copiedPalettes[0][i];
2135 }
2136 func_unkB_draw_player(part, yaw, mtx);
2137 } else {
2138 spr_draw_player_sprite(PLAYER_SPRITE_MAIN | idMask, yaw, opacity, NULL, mtx);
2139 }
2140}
void func_unkB_draw_player(ActorPart *, s32, Matrix4f)
s32 spr_draw_player_sprite(s32 spriteInstanceID, s32 yaw, s32 alphaIn, PAL_PTR *paletteList, Matrix4f mtx)
Definition sprite.c:872
PAL_PTR * spr_get_player_palettes(s32 spriteIndex)
Definition sprite.c:1016

Referenced by render_with_paralyze_palettes(), and render_without_adjusted_palettes().

◆ func_unkB_draw_player()

void func_unkB_draw_player ( ActorPart * part,
s32 yaw,
Matrix4f mtx )

Definition at line 2142 of file actor_rendering.c.

2142 {
2143 DecorationTable* decorations = part->decorationTable;
2144 s32 opacity = 255;
2145 s32 idMask = 0;
2146
2147 if (part->opacity < 255) {
2149 opacity = part->opacity;
2150 }
2151 if (part->flags & ACTOR_PART_FLAG_TRANSPARENT) {
2153 opacity = (opacity * 120) / 255;
2154 }
2155
2156 if (decorations->flashEnabled != FLASH_PAL_OFF) {
2157 make_flash_palettes(part);
2159 spr_draw_player_sprite(PLAYER_SPRITE_MAIN | idMask, yaw, opacity, decorations->flashPalettes, mtx);
2160 } else {
2162 spr_draw_player_sprite(PLAYER_SPRITE_MAIN | idMask, yaw, opacity, decorations->adjustedPalettes, mtx);
2163 }
2164}

Referenced by func_unkA_draw_player(), render_with_berserk_palettes(), render_with_fear_palettes(), render_with_pal_blending(), render_with_palset_blending(), render_with_paralyze_palettes(), render_with_player_debuff_palettes(), render_with_poison_palettes(), render_with_sleep_palettes(), render_with_static_palettes(), render_with_watt_attack_palettes(), and render_with_watt_idle_palettes().

◆ part_glow_on()

void part_glow_on ( b32 arg0,
ActorPart * part,
s32 yaw,
b32 arg3 )

Definition at line 3359 of file actor_rendering.c.

3359 {
3360 DecorationTable* decorations = part->decorationTable;
3361 u8 rbuf[20];
3362 u8 gbuf[20];
3363 u8 bbuf[20];
3364 s32 color;
3365 s32 alpha;
3366 s32 i;
3367
3368 if (decorations->glowStateChanged) {
3369 decorations->glowUnk1 = -2;
3370 decorations->glowUnk3 = 0;
3371 decorations->glowStateChanged = FALSE;
3372 decorations->glowUnk2 = 0;
3373 if (isNpcSprite == SPRITE_MODE_PLAYER) {
3375 } else {
3377 }
3378 }
3379
3380 decorations->glowPhase += 7;
3381
3382 if (decorations->glowPhase >= 360) {
3383 decorations->glowPhase %= 360;
3384 }
3385
3386 for (i = 0; i < ARRAY_COUNT(rbuf); i++) {
3387 rbuf[i] = (cosine(decorations->glowPhase + (25 * i)) + 1.0) * 112.0;
3388 gbuf[i] = (cosine(decorations->glowPhase + (25 * i) + 45) + 1.0) * 112.0;
3389 bbuf[i] = (cosine(decorations->glowPhase + (25 * i) + 90) + 1.0) * 112.0;
3390 }
3391
3392 alpha = 255;
3393 if (part->opacity < 255) {
3394 alpha = part->opacity;
3395 }
3396 if (part->flags & ACTOR_PART_FLAG_TRANSPARENT) {
3397 alpha = (alpha * 120) / 255;
3398 }
3399
3400 for (i = 0; i < ARRAY_COUNT(rbuf); i++) {
3401 color = (rbuf[i] << 0x18) | (gbuf[i] << 0x10) | (bbuf[i] << 8) | alpha;
3402 if (isNpcSprite == SPRITE_MODE_PLAYER) {
3404 } else {
3406 }
3407 }
3408
3409 if (!isReflection) {
3410 decorations->glowUnk3 -= 1;
3411 }
3412}
@ IMGFX_ALLOC_COLOR_BUF
Definition enums.h:5134
@ IMGFX_COLOR_BUF_SET_MODULATE
Definition enums.h:5129
f32 cosine(s16 arg0)
Definition 43F0.c:354
void set_npc_imgfx_all(s32 spriteIdx, ImgFXType imgfxType, s32 imgfxArg1, s32 imgfxArg2, s32 imgfxArg3, s32 imgfxArg4, s32 imgfxArg5)
Definition sprite.c:1254
void set_player_imgfx_all(s32 animID, ImgFXType imgfxType, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6)
Definition sprite.c:995
@ SPRITE_MODE_PLAYER
Definition sprite.h:33

Referenced by update_part_glow().

◆ part_flash_on()

void part_flash_on ( b32 arg0,
ActorPart * part,
s32 yaw,
b32 arg3 )

Definition at line 3437 of file actor_rendering.c.

3437 {
3438 DecorationTable* decorations = part->decorationTable;
3439
3440 if (decorations->flashStateChanged) {
3441 switch (get_flash_damage_intensity(part)) {
3443 decorations->flashFramesLeft = 1;
3444 decorations->flashMode = FLASH_MODE_LIGHT;
3445 break;
3447 decorations->flashFramesLeft = 8;
3448 decorations->flashMode = FLASH_MODE_MEDIUM;
3449 break;
3451 default:
3452 decorations->flashFramesLeft = 14;
3453 decorations->flashMode = FLASH_MODE_HEAVY;
3454 break;
3455 }
3456 decorations->flashEnabled = FLASH_PAL_OFF;
3457 decorations->flashStateChanged = FALSE;
3458 }
3459
3460 if (decorations->flashMode == FLASH_MODE_DISPOSE) {
3461 decorations->flashEnabled = FLASH_PAL_OFF;
3463 }
3464
3465 switch (decorations->flashMode) {
3466 case FLASH_MODE_LIGHT:
3467 switch (decorations->flashFramesLeft) {
3468 case 0:
3469 decorations->flashEnabled = FLASH_PAL_ON;
3470 decorations->flashMode = FLASH_MODE_DISPOSE;
3471 break;
3472 default:
3473 decorations->flashEnabled = FLASH_PAL_OFF;
3474 if (!isReflection) {
3475 decorations->flashFramesLeft--;
3476 }
3477 break;
3478 }
3479 break;
3480 case FLASH_MODE_MEDIUM:
3481 switch (decorations->flashFramesLeft) {
3482 case 1:
3483 case 2:
3484 case 5:
3485 case 6:
3486 decorations->flashEnabled = FLASH_PAL_ON;
3487 break;
3488 case 3:
3489 case 4:
3490 case 7:
3491 case 8:
3492 decorations->flashEnabled = FLASH_PAL_OFF;
3493 break;
3494 case 0:
3495 decorations->flashMode = FLASH_MODE_DISPOSE;
3496 break;
3497 }
3498 if (!isReflection) {
3499 decorations->flashFramesLeft--;
3500 }
3501 break;
3502 case FLASH_MODE_HEAVY:
3503 switch (decorations->flashFramesLeft) {
3504 case 1:
3505 case 2:
3506 case 5:
3507 case 6:
3508 case 9:
3509 case 10:
3510 case 13:
3511 case 14:
3512 decorations->flashEnabled = FLASH_PAL_OFF;
3513 break;
3514 case 3:
3515 case 4:
3516 case 7:
3517 case 8:
3518 case 11:
3519 case 12:
3520 decorations->flashEnabled = FLASH_PAL_ON;
3521 break;
3522 case 0:
3523 decorations->flashMode = FLASH_MODE_DISPOSE;
3524 break;
3525 }
3526 if (!isReflection) {
3527 decorations->flashFramesLeft--;
3528 }
3529 break;
3530 }
3531}
void clear_part_flash_mode(ActorPart *part)
Definition 190B20.c:2708
s32 get_flash_damage_intensity(ActorPart *part)
@ DAMAGE_INTENSITY_LIGHT
Definition enums.h:3506
@ DAMAGE_INTENSITY_HEAVY
Definition enums.h:3508
@ DAMAGE_INTENSITY_MEDIUM
Definition enums.h:3507
@ FLASH_MODE_MEDIUM
Definition enums.h:2264
@ FLASH_MODE_HEAVY
Definition enums.h:2265
@ FLASH_MODE_DISPOSE
Definition enums.h:2266
@ FLASH_MODE_LIGHT
Definition enums.h:2263
@ FLASH_PAL_ON
Definition enums.h:2271

Referenced by update_part_flash().

◆ add_part_decor_none()

void add_part_decor_none ( ActorPart * actorPart,
s32 i )

Definition at line 3629 of file actor_rendering.c.

3629 {
3630}

Referenced by _add_part_decoration().

◆ add_part_decor_golden_flames()

void add_part_decor_golden_flames ( ActorPart * part,
s32 idx )

Definition at line 3635 of file actor_rendering.c.

3635 {
3636 DecorationTable* decorations = part->decorationTable;
3637 EffectInstance* effect;
3638 AuraFXData* data;
3639 f32 scale;
3640
3641 switch (decorations->state[idx]) {
3642 case 0:
3643 fx_aura(FX_AURA_GOLD, part->curPos.x, part->curPos.y, part->curPos.z, 0.4f, &decorations->effect[idx]);
3644 decorations->state[idx] = 1;
3645 decorations->decorData[idx].goldenFlames.scaleX = 40;
3646 decorations->decorData[idx].goldenFlames.scaleY = 40;
3647 decorations->decorData[idx].goldenFlames.offsetX = 0;
3648 break;
3649 case 1:
3650 effect = decorations->effect[idx];
3651 data = effect->data.aura;
3652 data->posA.x = part->curPos.x + decorations->decorData[idx].goldenFlames.offsetX;
3653 data->posA.y = part->curPos.y;
3654 data->posA.z = part->curPos.z;
3655 scale = decorations->decorData[idx].goldenFlames.scaleX;
3656 scale /= 100.0f;
3657 effect->data.aura->scale.x = scale;
3658 scale = decorations->decorData[idx].goldenFlames.scaleY;
3659 scale /= 100.0f;
3660 effect->data.aura->scale.y = scale;
3661 break;
3662 }
3663}
struct EffectInstance * effect[2]
DecorationData decorData[2]
DecorGoldenFlames goldenFlames
Vec2f scale
Definition effects.h:996
Vec3f posA
Definition effects.h:994
@ FX_AURA_GOLD
Definition effects.h:989
struct AuraFXData * aura
Definition effects.h:2523

Referenced by _add_part_decoration().

◆ add_part_decor_sweat()

void add_part_decor_sweat ( ActorPart * part,
s32 idx )

Definition at line 3669 of file actor_rendering.c.

3669 {
3670 DecorationTable* decorations = part->decorationTable;
3671
3672 switch (decorations->state[idx]) {
3673 case 0:
3674 if (part->yaw > 90.0f) {
3675 fx_sweat(0, part->curPos.x, part->curPos.y + part->size.y, part->curPos.z, 5.0f, 45.0f, 20);
3676 } else {
3677 fx_sweat(0, part->curPos.x, part->curPos.y + part->size.y, part->curPos.z, 5.0f, -45.0f, 20);
3678 }
3679 decorations->stateResetTimer[idx] = 10;
3680 decorations->state[idx] = TRUE;
3681 break;
3682 case 1:
3683 if (decorations->stateResetTimer[idx] != 0) {
3684 decorations->stateResetTimer[idx]--;
3685 } else {
3686 decorations->state[idx] = FALSE;
3687 }
3688 break;
3689 }
3690}

Referenced by _add_part_decoration().

◆ add_part_decor_seeing_stars()

void add_part_decor_seeing_stars ( ActorPart * part,
s32 idx )

Definition at line 3695 of file actor_rendering.c.

3695 {
3696 DecorationTable* decorations;
3697 StarsOrbitingFXData* data;
3698
3699 decorations = part->decorationTable;
3700 switch (decorations->state[idx]) {
3701 case 0:
3702 fx_stars_orbiting(0, part->curPos.x, part->curPos.y + part->size.y, part->curPos.z, 20.0f, 3, &decorations->effect[idx]);
3703 decorations->state[idx] = 1;
3704 break;
3705 case 1:
3706 data = decorations->effect[idx]->data.starsOrbiting;
3707 data->pos.x = part->curPos.x;
3708 data->pos.y = part->curPos.y + part->size.y;
3709 data->pos.z = part->curPos.z;
3710 break;
3711 }
3712}
struct StarsOrbitingFXData * starsOrbiting
Definition effects.h:2511

Referenced by _add_part_decoration().

◆ add_part_decor_red_flames()

void add_part_decor_red_flames ( ActorPart * part,
s32 idx )

Definition at line 3718 of file actor_rendering.c.

3718 {
3719 DecorationTable* decorations = part->decorationTable;
3720 EffectInstance* effect;
3721 AuraFXData* data;
3722 f32 scale;
3723
3724 switch (decorations->state[idx]) {
3725 case 0:
3726 fx_aura(FX_AURA_RED, part->curPos.x, part->curPos.y, part->curPos.z, 0.4f, &decorations->effect[idx]);
3727 decorations->state[idx] = 1;
3728 decorations->decorData[idx].redFlames.scaleX = 40;
3729 decorations->decorData[idx].redFlames.scaleY = 40;
3730 decorations->decorData[idx].redFlames.alpha = 255;
3731 decorations->decorData[idx].redFlames.offsetZ = 0;
3732 decorations->decorData[idx].redFlames.unused1 = 255;
3733 decorations->decorData[idx].redFlames.unused2 = 0;
3734 decorations->decorData[idx].redFlames.unused3 = 0;
3735 // fallthrough
3736 case 1:
3737 effect = decorations->effect[idx];
3738 data = effect->data.aura;
3739 data->posA.x = part->curPos.x;
3740 data->posA.y = part->curPos.y;
3741 data->posA.z = part->curPos.z + decorations->decorData[idx].redFlames.offsetZ;
3742
3743 scale = decorations->decorData[idx].redFlames.scaleX;
3744 scale /= 100.0f;
3745 effect->data.aura->scale.x = scale;
3746 scale = decorations->decorData[idx].redFlames.scaleY;
3747 scale /= 100.0f;
3748 effect->data.aura->scale.y = scale;
3749 effect->data.aura->primA = decorations->decorData[idx].redFlames.alpha;
3750 break;
3751 }
3752}
DecorRedFlames redFlames
@ FX_AURA_RED
Definition effects.h:987
s32 primA
Definition effects.h:998

Referenced by _add_part_decoration().

◆ add_part_decor_smoky_trail()

void add_part_decor_smoky_trail ( ActorPart * part,
s32 idx )

Definition at line 3758 of file actor_rendering.c.

3758 {
3759 DecorationTable* decorations = part->decorationTable;
3760 EffectInstance* effect;
3761
3762 switch (decorations->state[idx]) {
3763 case 0:
3764 decorations->effect[idx] = fx_effect_65(1, part->curPos.x, part->curPos.y, part->curPos.z, 1.0f, 0);
3765 decorations->state[idx] = 1;
3766 break;
3767 case 1:
3768 effect = decorations->effect[idx];
3769 effect->data.unk_65->pos.x = part->curPos.x;
3770 effect->data.unk_65->pos.y = part->curPos.y;
3771 effect->data.unk_65->pos.z = part->curPos.z;
3772 break;
3773 }
3774}
struct Effect65FXData * unk_65
Definition effects.h:2565

Referenced by _add_part_decoration().

◆ add_part_decor_fiery_trail()

void add_part_decor_fiery_trail ( ActorPart * part,
s32 idx )

Definition at line 3780 of file actor_rendering.c.

3780 {
3781 DecorationTable* decorations = part->decorationTable;
3782 EffectInstance* effect;
3783
3784 switch (decorations->state[idx]) {
3785 case 0:
3786 decorations->effect[idx] = fx_effect_65(2, part->curPos.x, part->curPos.y, part->curPos.z, 1.0f, 0);
3787 decorations->decorData[idx].fireTrail.scale = 1;
3788 decorations->state[idx] = 1;
3789 break;
3790 case 1:
3791 effect = decorations->effect[idx];
3792 effect->data.unk_65->pos.x = part->curPos.x;
3793 effect->data.unk_65->pos.y = part->curPos.y;
3794 effect->data.unk_65->pos.z = part->curPos.z;
3795 effect->data.unk_65->scale = decorations->decorData[idx].fireTrail.scale / 100.0f;
3796 break;
3797 }
3798}
DecorFireTrail fireTrail

Referenced by _add_part_decoration().

◆ add_part_decor_whirlwind()

void add_part_decor_whirlwind ( ActorPart * part,
s32 idx )

Definition at line 3804 of file actor_rendering.c.

3804 {
3805 DecorationTable* decorations = part->decorationTable;
3806 EffectInstance* effect;
3807
3808 switch (decorations->state[idx]) {
3809 case 0:
3810 decorations->effect[idx] = fx_whirlwind(2, part->curPos.x, part->curPos.y, part->curPos.z, 1.0f, 0);
3811 decorations->state[idx] = 1;
3812 break;
3813 case 1:
3814 effect = decorations->effect[idx];
3815 effect->data.whirlwind->pos.x = part->curPos.x;
3816 effect->data.whirlwind->pos.y = part->curPos.y;
3817 effect->data.whirlwind->pos.z = part->curPos.z;
3818 break;
3819 }
3820}
struct WhirlwindFXData * whirlwind
Definition effects.h:2567

Referenced by _add_part_decoration().

◆ add_part_decor_steam()

void add_part_decor_steam ( ActorPart * part,
s32 idx )

Definition at line 3826 of file actor_rendering.c.

3826 {
3827 DecorationTable* decorations = part->decorationTable;
3828 f32 angle, sinA, cosA;
3829
3830 switch (decorations->state[idx]) {
3831 case 0:
3832 decorations->stateResetTimer[idx] = 0;
3833 decorations->state[idx] = 1;
3834 // fallthrough
3835 case 1:
3836 decorations->stateResetTimer[idx]++;
3837 if (decorations->stateResetTimer[idx] >= 4) {
3838 decorations->stateResetTimer[idx] = 0;
3839 angle = DEG_TO_RAD(clamp_angle(-part->yaw));
3840 sinA = sin_rad(angle);
3841 cosA = cos_rad(angle);
3842 fx_walking_dust(0,
3843 part->curPos.x + (part->size.x * sinA * 0.2f),
3844 part->curPos.y + 1.5f,
3845 part->curPos.z + (part->size.x * cosA * 0.2f),
3846 sinA, cosA);
3847 }
3848 break;
3849 }
3850}
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

Referenced by _add_part_decoration().

◆ add_part_decor_sparkles()

void add_part_decor_sparkles ( ActorPart * part,
s32 idx )

Definition at line 3855 of file actor_rendering.c.

3855 {
3856 DecorationTable* decorations = part->decorationTable;
3857 f32 x, y, z;
3858
3859 if (SparkleSpawnIntervals[decorations->decorData[idx].sparkles.spawnInterval] >= 0) {
3860 switch (decorations->state[idx]) {
3861 case 0:
3862 decorations->stateResetTimer[idx] = 0;
3863 decorations->state[idx] = 1;
3864 // fallthrough
3865 case 1:
3866 x = part->curPos.x;
3867 y = part->curPos.y + (part->size.y / 2);
3868 z = part->curPos.z - 5.0f;
3869 if ((gGameStatusPtr->frameCounter % 4) == 0) {
3870 fx_sparkles(FX_SPARKLES_1, x, y, z, 10.0f);
3871 }
3872 decorations->stateResetTimer[idx]++;
3873 if (SparkleSpawnIntervals[decorations->decorData[idx].sparkles.spawnInterval] < decorations->stateResetTimer[idx]) {
3874 decorations->stateResetTimer[idx] = 0;
3875 fx_sparkles(FX_SPARKLES_1, x, y, z, 20.0f);
3876 }
3877 break;
3878 }
3879 }
3880}
s16 SparkleSpawnIntervals[]
DecorDataSparkles sparkles
@ FX_SPARKLES_1
Definition effects.h:235
GameStatus * gGameStatusPtr
Definition main_loop.c:32

Referenced by _add_part_decoration().

◆ add_part_decor_bowser_aura()

void add_part_decor_bowser_aura ( ActorPart * part,
s32 idx )

Definition at line 3885 of file actor_rendering.c.

3885 {
3886 DecorationTable* decorations = part->decorationTable;
3887 EffectInstance* effect;
3888 AuraFXData* data;
3889 f32 scale;
3890
3891 switch (decorations->state[idx]) {
3892 case 0:
3893 fx_aura(FX_AURA_BLUE, part->curPos.x, part->curPos.y, part->curPos.z, 1.2f, &decorations->effect[idx]);
3894 decorations->state[idx] = 1;
3895 decorations->decorData[idx].bowserAura.scaleX = 150;
3896 decorations->decorData[idx].bowserAura.scaleY = 150;
3897 decorations->decorData[idx].bowserAura.alpha = 255;
3898 decorations->decorData[idx].bowserAura.offsetZ = 0;
3899 // fallthrough
3900 case 1:
3901 effect = decorations->effect[idx];
3902 data = effect->data.aura;
3903 data->posA.x = part->curPos.x;
3904 data->posA.y = part->curPos.y;
3905 data->posA.z = part->curPos.z + decorations->decorData[idx].bowserAura.offsetZ;
3906
3907 scale = decorations->decorData[idx].bowserAura.scaleX;
3908 scale /= 100.0f;
3909 effect->data.aura->scale.x = scale;
3910 scale = decorations->decorData[idx].bowserAura.scaleY;
3911 scale /= 100.0f;
3912 effect->data.aura->scale.y = scale * (0.8 - 1e-16); // small epsilon
3913 effect->data.aura->primA = decorations->decorData[idx].bowserAura.alpha;
3914 effect->data.aura->renderYaw = part->yaw;
3915 break;
3916 }
3917}
DecorBowserAura bowserAura
f32 renderYaw
Definition effects.h:1013
@ FX_AURA_BLUE
Definition effects.h:988

Referenced by _add_part_decoration().

◆ add_part_decor_radiating_stars()

void add_part_decor_radiating_stars ( ActorPart * part,
s32 idx )

Definition at line 3923 of file actor_rendering.c.

3923 {
3924 DecorationTable* decorations = part->decorationTable;
3925 EnergyInOutFXData* data;
3926 f32 scale;
3927
3928 switch (decorations->state[idx]) {
3929 case 0:
3930 decorations->effect[idx] = fx_energy_in_out(4, part->curPos.x, part->curPos.y, part->curPos.z, 1.2f, 0);
3931 decorations->state[idx] = 1;
3932 decorations->decorData[idx].stars.scalePct = 120;
3933 decorations->decorData[idx].stars.offsetY = 0;
3934 // fallthrough
3935 case 1:
3936 data = decorations->effect[idx]->data.energyInOut;
3937 scale = decorations->decorData[idx].stars.scalePct;
3938 scale /= 100.0f;
3939 data->unk_44 = scale;
3940 data->pos.x = part->curPos.x;
3941 data->pos.y = (part->curPos.y + (scale * 41.0f));
3942 data->pos.z = (part->curPos.z + decorations->decorData[idx].stars.offsetY);
3943 break;
3944 }
3945}
DecorDataStars stars
struct EnergyInOutFXData * energyInOut
Definition effects.h:2571

Referenced by _add_part_decoration().

◆ render_without_adjusted_palettes()

void render_without_adjusted_palettes ( b32 arg0,
ActorPart * part,
s32 yaw,
Matrix4f mtx,
b32 skipAnimation )

Definition at line 2166 of file actor_rendering.c.

2166 {
2167 DecorationTable* decorations = part->decorationTable;
2168
2169 if (decorations->resetPalAdjust) {
2170 part->verticalStretch = 1;
2171 part->palAnimPosOffset[0] = 0;
2172 part->palAnimPosOffset[1] = 0;
2173 decorations->resetPalAdjust = FALSE;
2174 }
2175 if (isNpcSprite == SPRITE_MODE_PLAYER) {
2176 func_unkA_draw_player(part, yaw, mtx);
2177 } else {
2178 func_unkA_draw_npc(part, yaw, mtx);
2179 }
2180}
void func_unkA_draw_npc(ActorPart *, s32, Matrix4f)
void func_unkA_draw_player(ActorPart *, s32, Matrix4f)

Referenced by render_with_adjusted_palettes().

◆ render_with_sleep_palettes()

void render_with_sleep_palettes ( b32 arg0,
ActorPart * part,
s32 yaw,
Matrix4f mtx,
b32 skipAnimation )

Definition at line 2182 of file actor_rendering.c.

2182 {
2183 DecorationTable* decorations = part->decorationTable;
2184 s32 i, j;
2185
2186 if (decorations->resetPalAdjust) {
2187 if (isNpcSprite == SPRITE_MODE_PLAYER) {
2188 decorations->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16);
2189 decorations->originalPalettesCount = 0;
2190 while ((s32)decorations->originalPalettesList[decorations->originalPalettesCount] != -1) {
2191 decorations->originalPalettesCount++;
2192 }
2193 } else {
2194 decorations->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 16);
2195 decorations->originalPalettesCount = 0;
2196 while ((s32)decorations->originalPalettesList[decorations->originalPalettesCount] != -1) {
2197 decorations->originalPalettesCount++;
2198 }
2199 }
2200 decorations->palAnimState = 0;
2201 decorations->resetPalAdjust = FALSE;
2202 }
2203
2204 for (i = 0; i < decorations->originalPalettesCount; i++) {
2205 PAL_PTR palIn = decorations->originalPalettesList[i];
2206 PAL_PTR palOut = decorations->copiedPalettes[0][i];
2207 decorations->adjustedPalettes[i] = palOut;
2208 if (palIn != NULL) {
2209 for (j = 0; j < SPR_PAL_SIZE; j++) {
2210 u8 r = UNPACK_PAL_R(*palIn);
2211 u8 g = UNPACK_PAL_G(*palIn);
2212 u8 b = UNPACK_PAL_B(*palIn);
2213 u8 a = UNPACK_PAL_A(*palIn);
2214 palIn++;
2215
2216 // make colors darker and bluer
2217 r *= 0.2;
2218 g *= 0.4;
2219 b *= 0.7;
2220
2221 *palOut++ = PACK_PAL_RGBA(r, g, b, a);
2222 }
2223 }
2224 }
2225 switch (decorations->palAnimState) {
2226 case 0:
2227 case 1:
2228 if (isNpcSprite == SPRITE_MODE_PLAYER) {
2229 func_unkB_draw_player(part, yaw, mtx);
2230 } else {
2231 func_unkB_draw_npc(part, yaw, mtx);
2232 }
2233 break;
2234 }
2235}
#define UNPACK_PAL_B(color)
Definition macros.h:269
#define UNPACK_PAL_R(color)
Definition macros.h:267
#define UNPACK_PAL_A(color)
Definition macros.h:270
#define UNPACK_PAL_G(color)
Definition macros.h:268
#define PACK_PAL_RGBA(r, g, b, a)
Definition macros.h:272

Referenced by render_with_adjusted_palettes().

◆ render_with_static_palettes()

void render_with_static_palettes ( b32 arg0,
ActorPart * part,
s32 yaw,
Matrix4f mtx,
b32 skipAnimation )

Definition at line 2237 of file actor_rendering.c.

2237 {
2238 DecorationTable* decorations = part->decorationTable;
2239 PAL_PTR palIn;
2240 PAL_PTR palOut;
2241 s32 i, j;
2242 s32 paletteType;
2243 s32 staticPalIdx;
2244
2245 if (decorations->resetPalAdjust) {
2246 if (isNpcSprite == SPRITE_MODE_PLAYER) {
2247 decorations->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16);
2248 decorations->originalPalettesCount = 0;
2249 while ((s32)decorations->originalPalettesList[decorations->originalPalettesCount] != -1) {
2250 decorations->originalPalettesCount++;
2251 }
2253 } else {
2254 decorations->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 16);
2255 decorations->originalPalettesCount = 0;
2256 while ((s32)decorations->originalPalettesList[decorations->originalPalettesCount] != -1) {
2257 decorations->originalPalettesCount++;
2258 }
2260 }
2261
2262 for (i = 0; i < decorations->originalPalettesCount; i++) {
2263 palIn = decorations->originalPalettesList[i];
2264 palOut = decorations->copiedPalettes[0][i];
2265 if (palIn != NULL) {
2266 for (j = 0; j < SPR_PAL_SIZE; j++) {
2267 *palOut++ = *palIn++;
2268 }
2269 }
2270 }
2271
2272 decorations->palAnimState = -2;
2273 decorations->palBlendAlpha = 0;
2274 decorations->resetPalAdjust = FALSE;
2275 decorations->nextPalTime = 0;
2276 }
2277
2278 if (!skipAnimation) {
2279 if (decorations->nextPalTime == 0) {
2280 decorations->palAnimState += 2;
2281 if (StaticPalettesAnim[decorations->palAnimState] == PAL_ANIM_END) {
2282 decorations->palAnimState = 0;
2283 }
2284 decorations->nextPalTime = StaticPalettesAnim[decorations->palAnimState + 1] / 2;
2285 }
2286 paletteType = StaticPalettesAnim[decorations->palAnimState];
2287 decorations->nextPalTime--;
2288 } else {
2289 paletteType = StaticPalettesAnim[decorations->palAnimState];
2290 }
2291
2292 switch (paletteType) {
2293 case STATIC_DEFAULT: // no change
2294 for (i = 0; i < decorations->spriteColorVariations; i++) {
2295 palIn = decorations->originalPalettesList[i];
2296 palOut = decorations->copiedPalettes[0][i];
2297 if (palIn != NULL) {
2298 for (j = 0; j < SPR_PAL_SIZE; j++) {
2299 *palOut++ = *palIn++;
2300 }
2301 }
2302 }
2303 break;
2304 case STATIC_BRIGHT: // bright yellow
2305 for (i = 0; i < decorations->spriteColorVariations; i++) {
2306 staticPalIdx = decorations->spriteColorVariations * STANDARD_PAL_STATIC + i;
2307 palIn = decorations->originalPalettesList[staticPalIdx];
2308 palOut = decorations->copiedPalettes[0][i];
2309 if (palIn != NULL) {
2310 for (j = 0; j < SPR_PAL_SIZE; j++) {
2311 *palOut++ = *palIn++;
2312 }
2313 }
2314 }
2315 break;
2316 case STATIC_DARK: // darkened via code
2317 for (i = 0; i < decorations->spriteColorVariations; i++) {
2318 palIn = decorations->originalPalettesList[i];
2319 palOut = decorations->copiedPalettes[0][i];
2320 if (palIn != NULL) {
2321 for (j = 0; j < SPR_PAL_SIZE; j++) {
2322 u8 r = UNPACK_PAL_R(*palIn);
2323 u8 g = UNPACK_PAL_G(*palIn);
2324 u8 b = UNPACK_PAL_B(*palIn);
2325 u8 a = UNPACK_PAL_A(*palIn);
2326 palIn++;
2327
2328 r *= 0.1;
2329 g *= 0.1;
2330 b *= 0.1;
2331
2332 *palOut++ = PACK_PAL_RGBA(r, g, b, a);
2333 }
2334 }
2335 }
2336 break;
2337 }
2338
2339 for (i = 0; i < decorations->originalPalettesCount; i++) {
2340 decorations->adjustedPalettes[i] = decorations->copiedPalettes[0][i];
2341 }
2342
2343 if (isNpcSprite == SPRITE_MODE_PLAYER) {
2344 func_unkB_draw_player(part, yaw, mtx);
2345 } else {
2346 func_unkB_draw_npc(part, yaw, mtx);
2347 }
2348
2349 if (!skipAnimation) {
2350 decorations->palBlendAlpha--;
2351 }
2352}
#define PAL_ANIM_END
u8 StaticPalettesAnim[]
s32 spr_get_npc_color_variations(s32 npcSpriteID)
Definition sprite.c:1329
#define SPR_PLAYER_COLOR_VARIATIONS
Definition sprite.h:6

Referenced by render_with_adjusted_palettes().

◆ render_with_fear_palettes()

void render_with_fear_palettes ( b32 arg0,
ActorPart * part,
s32 yaw,
Matrix4f mtx,
b32 skipAnimation )

Definition at line 2354 of file actor_rendering.c.

2354 {
2355 DecorationTable* decorations = part->decorationTable;
2356 PAL_PTR palIn;
2357 PAL_PTR palOut;
2358 s32 i, j;
2359 s32 temp;
2360
2361 if (decorations->resetPalAdjust) {
2362 if (isNpcSprite == SPRITE_MODE_PLAYER) {
2363 decorations->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16);
2364 decorations->originalPalettesCount = 2;
2365 while ((s32)decorations->originalPalettesList[decorations->originalPalettesCount] != -1) {
2366 decorations->originalPalettesCount++;
2367 }
2368 } else {
2369 decorations->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 16);
2370 decorations->originalPalettesCount = 0;
2371 while ((s32)decorations->originalPalettesList[decorations->originalPalettesCount] != -1) {
2372 decorations->originalPalettesCount++;
2373 }
2374 }
2375
2376 decorations->palAnimState = 0;
2377 decorations->palBlendAlpha = 0;
2378 decorations->nextPalTime = 0;
2379 decorations->resetPalAdjust = FALSE;
2380 }
2381
2382 for (i = 0; i < decorations->originalPalettesCount; i++) {
2383 palIn = decorations->originalPalettesList[i];
2384 palOut = decorations->copiedPalettes[0][i];
2385 decorations->adjustedPalettes[i] = palOut;
2386 if (palIn != NULL) {
2387 for (j = 0; j < SPR_PAL_SIZE; j++) {
2388 u8 r = UNPACK_PAL_R(*palIn);
2389 u8 g = UNPACK_PAL_G(*palIn);
2390 u8 b = UNPACK_PAL_B(*palIn);
2391 u8 a = UNPACK_PAL_A(*palIn);
2392 palIn++;
2393
2394 // darken the color
2395 r /= 2;
2396 g /= 2;
2397 b /= 2;
2398
2399 *palOut++ = PACK_PAL_RGBA(r, g, b, a);
2400 }
2401 }
2402 }
2403
2404 if (decorations->nextPalTime <= 0) {
2405 part->palAnimPosOffset[0] = FearPaletteAnimXOffsets[abs(decorations->nextPalTime)];
2406 if (part->palAnimPosOffset[0] == PAL_ANIM_END) {
2407 part->palAnimPosOffset[0] = 0;
2408 // 30-90
2409 decorations->nextPalTime = rand_int(60) + 30;
2410 }
2411 }
2412
2413 if (!skipAnimation) {
2414 decorations->nextPalTime--;
2415 }
2416
2417 if (isNpcSprite == SPRITE_MODE_PLAYER) {
2418 func_unkB_draw_player(part, yaw, mtx);
2419 } else {
2420 func_unkB_draw_npc(part, yaw, mtx);
2421 }
2422}
s16 FearPaletteAnimXOffsets[]
#define rand_int

Referenced by render_with_adjusted_palettes().

◆ render_with_poison_palettes()

void render_with_poison_palettes ( b32 arg0,
ActorPart * part,
s32 yaw,
Matrix4f mtx,
b32 skipAnimation )

Definition at line 2424 of file actor_rendering.c.

2424 {
2425 DecorationTable* decorations = part->decorationTable;
2426 PAL_PTR palIn;
2427 PAL_PTR palOut;
2428 s32 i, j;
2429
2430 if (decorations->resetPalAdjust) {
2431 if (isNpcSprite == SPRITE_MODE_PLAYER) {
2432 decorations->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16);
2433 decorations->originalPalettesCount = 0;
2434 while ((s32)decorations->originalPalettesList[decorations->originalPalettesCount] != -1) {
2435 decorations->originalPalettesCount++;
2436 }
2438 } else {
2439 decorations->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 16);
2440 decorations->originalPalettesCount = 0;
2441 while ((s32)decorations->originalPalettesList[decorations->originalPalettesCount] != -1) {
2442 decorations->originalPalettesCount++;
2443 }
2445 }
2446
2447 decorations->palAnimState = 0;
2448 decorations->palBlendAlpha = 0;
2449 decorations->resetPalAdjust = FALSE;
2450 }
2451
2452 for (i = 0; i < decorations->originalPalettesCount; i++) {
2453 palIn = decorations->originalPalettesList[i];
2454 palOut = decorations->copiedPalettes[0][i];
2455 if (palIn != NULL) {
2456 for (j = 0; j < SPR_PAL_SIZE; j++) {
2457 *palOut++ = *palIn++;
2458 }
2459 }
2460 }
2461 for (i = 0; i < decorations->spriteColorVariations; i++) {
2462 palIn = decorations->originalPalettesList[decorations->spriteColorVariations + i];
2463 palOut = decorations->copiedPalettes[0][i];
2464 if (palIn != NULL) {
2465 for (j = 0; j < SPR_PAL_SIZE; j++) {
2466 *palOut++ = *palIn++;
2467 }
2468 }
2469 }
2470
2471 for (i = 0; i < decorations->originalPalettesCount; i++) {
2472 decorations->adjustedPalettes[i] = decorations->copiedPalettes[0][i];
2473 }
2474
2475 if (isNpcSprite == SPRITE_MODE_PLAYER) {
2476 func_unkB_draw_player(part, yaw, mtx);
2477 } else {
2478 func_unkB_draw_npc(part, yaw, mtx);
2479 }
2480}

Referenced by render_with_adjusted_palettes().

◆ render_with_paralyze_palettes()

void render_with_paralyze_palettes ( b32 arg0,
ActorPart * part,
s32 yaw,
Matrix4f mtx,
b32 skipAnimation )

Definition at line 2482 of file actor_rendering.c.

2482 {
2483 DecorationTable* decorations = part->decorationTable;
2484 PAL_PTR palIn;
2485 PAL_PTR palOut;
2486 s32 i, j;
2487
2488 if (decorations->resetPalAdjust) {
2489 if (isNpcSprite == SPRITE_MODE_PLAYER) {
2490 decorations->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16);
2491 decorations->originalPalettesCount = 0;
2492 while ((s32)decorations->originalPalettesList[decorations->originalPalettesCount] != -1) {
2493 decorations->originalPalettesCount++;
2494 }
2495 } else {
2496 decorations->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 16);
2497 decorations->originalPalettesCount = 0;
2498 while ((s32)decorations->originalPalettesList[decorations->originalPalettesCount] != -1) {
2499 decorations->originalPalettesCount++;
2500 }
2501 }
2502
2503 decorations->palAnimState = 0;
2504 decorations->nextPalTime = 0;
2505 decorations->palBlendAlpha = 10;
2506 decorations->resetPalAdjust = FALSE;
2507 }
2508
2509 for (i = 0; i < decorations->originalPalettesCount; i++) {
2510 palIn = decorations->originalPalettesList[i];
2511 palOut = decorations->copiedPalettes[0][i];
2512 if (palIn != NULL) {
2513 for (j = 0; j < SPR_PAL_SIZE; j++) {
2514 u8 r = UNPACK_PAL_R(*palIn);
2515 u8 g = UNPACK_PAL_G(*palIn);
2516 u8 b = UNPACK_PAL_B(*palIn);
2517 u8 a = UNPACK_PAL_A(*palIn);
2518 palIn++;
2519 r += 4;
2520 if (r > 31) {
2521 r = 31;
2522 }
2523 g += 4;
2524 if (g > 31) {
2525 g = 31;
2526 }
2527 b += 4;
2528 if (b > 31) {
2529 b = 31;
2530 }
2531
2532 *palOut++ = PACK_PAL_RGBA(r, g, b, a);
2533 }
2534 }
2535 }
2536
2537 for (i = 0; i < decorations->originalPalettesCount; i++) {
2538 decorations->adjustedPalettes[i] = decorations->copiedPalettes[0][i];
2539 }
2540
2541 switch (decorations->palAnimState) {
2542 case 0:
2543 case 1:
2544 if (decorations->nextPalTime <= 0) {
2545 part->palAnimPosOffset[1] = ParalyzePaletteAnimXOffsets[abs(decorations->nextPalTime)];
2546 if (part->palAnimPosOffset[1] == PAL_ANIM_END) {
2547 part->palAnimPosOffset[1] = 0;
2548 decorations->nextPalTime = rand_int(60) + 30; // 30-90
2549 }
2550 }
2551
2552 if (!skipAnimation) {
2553 decorations->nextPalTime--;
2554 }
2555
2556 switch (decorations->palBlendAlpha) {
2557 case 10:
2558 case 12:
2559 if (isNpcSprite == SPRITE_MODE_PLAYER) {
2560 func_unkB_draw_player(part, yaw, mtx);
2561 } else {
2562 func_unkB_draw_npc(part, yaw, mtx);
2563 }
2564 break;
2565 case 13:
2566 decorations->palBlendAlpha = 0;
2567 // fallthrough
2568 default:
2569 if (isNpcSprite == SPRITE_MODE_PLAYER) {
2570 func_unkA_draw_player(part, yaw, mtx);
2571 } else {
2572 func_unkA_draw_npc(part, yaw, mtx);
2573 }
2574 break;
2575 }
2576
2577 if (!skipAnimation) {
2578 decorations->palBlendAlpha++;
2579 }
2580 break;
2581 }
2582}
s16 ParalyzePaletteAnimXOffsets[]

Referenced by render_with_adjusted_palettes().

◆ render_with_berserk_palettes()

void render_with_berserk_palettes ( b32 arg0,
ActorPart * part,
s32 yaw,
Matrix4f mtx,
b32 skipAnimation )

Definition at line 2584 of file actor_rendering.c.

2584 {
2585 DecorationTable* decorations = part->decorationTable;
2586 s32 i, j;
2587
2588 if (decorations->resetPalAdjust) {
2589 if (isNpcSprite == SPRITE_MODE_PLAYER) {
2590 decorations->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16);
2591 decorations->originalPalettesCount = 0;
2592 while ((s32)decorations->originalPalettesList[decorations->originalPalettesCount] != -1) {
2593 decorations->originalPalettesCount++;
2594 }
2595 decorations->palAnimState = 0;
2596 } else {
2597 decorations->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 16);
2598 decorations->originalPalettesCount = 0;
2599 while ((s32)decorations->originalPalettesList[decorations->originalPalettesCount] != -1) {
2600 decorations->originalPalettesCount++;
2601 }
2602 decorations->palAnimState = 0;
2603 }
2604 decorations->palBlendAlpha = 0;
2605 decorations->palAnimState = 0;
2606 decorations->resetPalAdjust = FALSE;
2607 }
2608
2609 // adjust each palette
2610 for (i = 0; i < decorations->originalPalettesCount; i++) {
2611 PAL_PTR palIn = decorations->originalPalettesList[i];
2612 PAL_PTR palOut = decorations->copiedPalettes[0][i];
2613 if (palIn != NULL) {
2614 for (j = 0; j < SPR_PAL_SIZE; j++) {
2615 u8 r = UNPACK_PAL_R(*palIn);
2616 u8 g = UNPACK_PAL_G(*palIn);
2617 u8 b = UNPACK_PAL_B(*palIn);
2618 u8 a = UNPACK_PAL_A(*palIn);
2619 palIn++;
2620
2621 // make each color darker and redder
2622 r *= 0.8;
2623 g *= 0.6;
2624 b *= 0.1;
2625
2626 *palOut++ = PACK_PAL_RGBA(r, g, b, a);
2627 }
2628 }
2629 }
2630
2631 for (i = 0; i < decorations->originalPalettesCount; i++) {
2632 decorations->adjustedPalettes[i] = decorations->copiedPalettes[0][i];
2633 }
2634
2635 if (isNpcSprite == SPRITE_MODE_PLAYER) {
2636 func_unkB_draw_player(part, yaw, mtx);
2637 } else {
2638 func_unkB_draw_npc(part, yaw, mtx);
2639 }
2640}

Referenced by render_with_adjusted_palettes().

◆ render_with_watt_idle_palettes()

void render_with_watt_idle_palettes ( b32 arg0,
ActorPart * part,
s32 yaw,
Matrix4f mtx,
b32 skipAnimation )

Definition at line 2642 of file actor_rendering.c.

2642 {
2643 DecorationTable* decorations = part->decorationTable;
2644 PAL_PTR palIn;
2645 PAL_PTR palOut;
2646 s32 i, j;
2647 s32 palIdx;
2648 s32 brightnessLevel;
2649
2650 if (decorations->resetPalAdjust) {
2651 if (isNpcSprite == SPRITE_MODE_PLAYER) {
2652 decorations->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16);
2653 decorations->originalPalettesCount = 0;
2654 while ((s32)decorations->originalPalettesList[decorations->originalPalettesCount] != -1) {
2655 decorations->originalPalettesCount++;
2656 }
2658 } else {
2659 decorations->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 16);
2660 decorations->originalPalettesCount = 0;
2661 while ((s32)decorations->originalPalettesList[decorations->originalPalettesCount] != -1) {
2662 decorations->originalPalettesCount++;
2663 }
2665 }
2666
2667 for (i = 0; i < decorations->originalPalettesCount; i++) {
2668 palIn = decorations->originalPalettesList[i];
2669 palOut = decorations->copiedPalettes[0][i];
2670 if (palIn != NULL) {
2671 for (j = 0; j < SPR_PAL_SIZE; j++) {
2672 *palOut++ = *palIn++;
2673 }
2674 }
2675 }
2676
2677 decorations->palAnimState = -2;
2678 decorations->palBlendAlpha = 0;
2679 decorations->resetPalAdjust = FALSE;
2680 decorations->nextPalTime = 0;
2681 }
2682
2683 if (!skipAnimation) {
2684 if (decorations->nextPalTime == 0) {
2685 decorations->palAnimState += 2;
2686 if (bWattIdlePalettesAnim[decorations->palAnimState] == PAL_ANIM_END) {
2687 decorations->palAnimState = 0;
2688 }
2689 decorations->nextPalTime = bWattIdlePalettesAnim[decorations->palAnimState + 1] / 2;
2690 }
2691 brightnessLevel = bWattIdlePalettesAnim[decorations->palAnimState];
2692 decorations->nextPalTime--;
2693 } else {
2694 //@bug if only called with skipAnimation set, palAnimPos will always be -2 and the array access is OOB
2695 brightnessLevel = bWattIdlePalettesAnim[decorations->palAnimState];
2696 }
2697
2698 switch (brightnessLevel) {
2699 case WATT_DEFAULT:
2700 for (i = 0; i < decorations->spriteColorVariations; i++) {
2701 // use watt's base palettes
2702 palIn = decorations->originalPalettesList[i];
2703 palOut = decorations->copiedPalettes[0][i];
2704 if (palIn != NULL) {
2705 for (j = 0; j < SPR_PAL_SIZE; j++) {
2706 *palOut++ = *palIn++;
2707 }
2708 }
2709 }
2710 break;
2711 case WATT_BRIGHTEST:
2712 for (i = 0; i < decorations->spriteColorVariations; i++) {
2713 // use watt's Brightest palettes
2714 palIdx = decorations->spriteColorVariations * SPR_PAL_BattleWatt_Brightest + i;
2715 palIn = decorations->originalPalettesList[palIdx];
2716 palOut = decorations->copiedPalettes[0][i];
2717 if (palIn != NULL) {
2718 for (j = 0; j < SPR_PAL_SIZE; j++) {
2719 *palOut++ = *palIn++;
2720 }
2721 }
2722 }
2723 break;
2724 case WATT_BRIGHTER:
2725 for (i = 0; i < decorations->spriteColorVariations; i++) {
2726 // use watt's Brighter palettes
2727 palIdx = decorations->spriteColorVariations * SPR_PAL_BattleWatt_Brighter + i;
2728 palIn = decorations->originalPalettesList[palIdx];
2729 palOut = decorations->copiedPalettes[0][i];
2730 if (palIn != NULL) {
2731 for (j = 0; j < SPR_PAL_SIZE; j++) {
2732 *palOut++ = *palIn++;
2733 }
2734 }
2735 }
2736 break;
2737 }
2738
2739 for (i = 0; i < decorations->originalPalettesCount; i++) {
2740 decorations->adjustedPalettes[i] = decorations->copiedPalettes[0][i];
2741 }
2742
2743 if (isNpcSprite == SPRITE_MODE_PLAYER) {
2744 func_unkB_draw_player(part, yaw, mtx);
2745 } else {
2746 func_unkB_draw_npc(part, yaw, mtx);
2747 }
2748
2749 if (!skipAnimation) {
2750 decorations->palBlendAlpha--;
2751 }
2752}
u8 bWattIdlePalettesAnim[]

Referenced by render_with_adjusted_palettes().

◆ render_with_watt_attack_palettes()

void render_with_watt_attack_palettes ( b32 arg0,
ActorPart * part,
s32 yaw,
Matrix4f mtx,
b32 skipAnimation )

Definition at line 2754 of file actor_rendering.c.

2754 {
2755 DecorationTable* decorations = part->decorationTable;
2756 PAL_PTR palIn;
2757 PAL_PTR palOut;
2758 s32 i, j;
2759 s32 palIdx;
2760 s32 brightness;
2761
2762 if (decorations->resetPalAdjust) {
2763 if (isNpcSprite == SPRITE_MODE_PLAYER) {
2764 decorations->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16);
2765 decorations->originalPalettesCount = 0;
2766 while ((s32)decorations->originalPalettesList[decorations->originalPalettesCount] != -1) {
2767 decorations->originalPalettesCount++;
2768 }
2770 } else {
2771 decorations->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 16);
2772 decorations->originalPalettesCount = 0;
2773 while ((s32)decorations->originalPalettesList[decorations->originalPalettesCount] != -1) {
2774 decorations->originalPalettesCount++;
2775 }
2777 }
2778
2779 for (i = 0; i < decorations->originalPalettesCount; i++) {
2780 palIn = decorations->originalPalettesList[i];
2781 palOut = decorations->copiedPalettes[0][i];
2782 if (palIn != NULL) {
2783 for (j = 0; j < SPR_PAL_SIZE; j++) {
2784 *palOut++ = *palIn++;
2785 }
2786 }
2787 }
2788
2789 decorations->palAnimState = -2;
2790 decorations->palBlendAlpha = 0;
2791 decorations->resetPalAdjust = FALSE;
2792 decorations->nextPalTime = 0;
2793 }
2794
2795 if (!skipAnimation) {
2796 if (decorations->nextPalTime == 0) {
2797 decorations->palAnimState += 2;
2798 if (WattAttackPalettesAnim[decorations->palAnimState] == PAL_ANIM_END) {
2799 decorations->palAnimState = 0;
2800 }
2801 decorations->nextPalTime = WattAttackPalettesAnim[decorations->palAnimState + 1] / 2;
2802 }
2803 brightness = WattAttackPalettesAnim[decorations->palAnimState];
2804 decorations->nextPalTime--;
2805 } else {
2806 //@bug if only called with skipAnimation set, palAnimPos will always be -2 and the array access is OOB
2807 brightness = WattAttackPalettesAnim[decorations->palAnimState];
2808 }
2809
2810 switch (brightness) {
2811 case WATT_DEFAULT:
2812 for (i = 0; i < decorations->spriteColorVariations; i++) {
2813 palIn = decorations->originalPalettesList[i];
2814 palOut = decorations->copiedPalettes[0][i];
2815 if (palIn != NULL) {
2816 for (j = 0; j < SPR_PAL_SIZE; j++) {
2817 *palOut++ = *palIn++;
2818 }
2819 }
2820 }
2821 break;
2822 case WATT_BRIGHTEST:
2823 for (i = 0; i < decorations->spriteColorVariations; i++) {
2824 // use watt's Brightest palettes
2825 palIdx = decorations->spriteColorVariations * SPR_PAL_BattleWatt_Brightest + i;
2826 palIn = decorations->originalPalettesList[palIdx];
2827 palOut = decorations->copiedPalettes[0][i];
2828 if (palIn != NULL) {
2829 for (j = 0; j < SPR_PAL_SIZE; j++) {
2830 *palOut++ = *palIn++;
2831 }
2832 }
2833 }
2834 break;
2835 case WATT_BRIGHTER:
2836 for (i = 0; i < decorations->spriteColorVariations; i++) {
2837 // use watt's Brighter palettes
2838 palIdx = decorations->spriteColorVariations * SPR_PAL_BattleWatt_Brighter + i;
2839 palIn = decorations->originalPalettesList[palIdx];
2840 palOut = decorations->copiedPalettes[0][i];
2841 if (palIn != NULL) {
2842 for (j = 0; j < SPR_PAL_SIZE; j++) {
2843 *palOut++ = *palIn++;
2844 }
2845 }
2846 }
2847 break;
2848 }
2849
2850 for (i = 0; i < decorations->originalPalettesCount; i++) {
2851 decorations->adjustedPalettes[i] = decorations->copiedPalettes[0][i];
2852 }
2853
2854 if (isNpcSprite == SPRITE_MODE_PLAYER) {
2855 func_unkB_draw_player(part, yaw, mtx);
2856 } else {
2857 func_unkB_draw_npc(part, yaw, mtx);
2858 }
2859
2860 if (!skipAnimation) {
2861 decorations->palBlendAlpha--;
2862 }
2863}
u8 WattAttackPalettesAnim[]

Referenced by render_with_adjusted_palettes().

◆ render_with_player_debuff_palettes()

void render_with_player_debuff_palettes ( b32 arg0,
ActorPart * part,
s32 yaw,
Matrix4f mtx,
b32 skipAnimation,
s32 isPoison )

Definition at line 2865 of file actor_rendering.c.

2865 {
2866 DecorationTable* decorations = part->decorationTable;
2867 PAL_PTR color2;
2868 PAL_PTR color1;
2869 PAL_PTR palOut;
2870 s32 i, j;
2871 u8 blendAlpha;
2872
2873 if (decorations->resetPalAdjust) {
2874 if (isNpcSprite == SPRITE_MODE_PLAYER) {
2875 decorations->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16);
2876 decorations->originalPalettesCount = 0;
2877 while ((s32)decorations->originalPalettesList[decorations->originalPalettesCount] != -1) {
2878 decorations->originalPalettesCount++;
2879 }
2880
2883 } else {
2885 }
2886 } else {
2887 decorations->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 16);
2888 decorations->originalPalettesCount = 0;
2889 while ((s32)decorations->originalPalettesList[decorations->originalPalettesCount] != -1) {
2890 decorations->originalPalettesCount++;
2891 }
2893 }
2894
2895 if (decorations->resetPalAdjust == TRUE) {
2896 decorations->palAnimState = 0;
2897 decorations->palBlendAlpha = 0;
2898 } else {
2899 decorations->palAnimState = 0;
2900 decorations->palBlendAlpha = 255;
2901 }
2902
2903 for (i = 0; i < decorations->originalPalettesCount; i++) {
2904 color2 = decorations->originalPalettesList[i];
2905 color1 = decorations->copiedPalettes[0][i];
2906 decorations->adjustedPalettes[i] = color1;
2907 if (color2 != NULL) {
2908 for (j = 0; j < SPR_PAL_SIZE; j++) {
2909 *color1++ = *color2++;
2910 }
2911 }
2912 }
2913
2914 if (isPoison) {
2915 for (i = 0; i < decorations->spriteColorVariations; i++) {
2916 color2 = decorations->originalPalettesList[decorations->spriteColorVariations + i];
2917 palOut = decorations->copiedPalettes[0][i];
2918 for (j = 0; j < SPR_PAL_SIZE; j++) {
2919 *palOut++ = *color2++;
2920 }
2921 }
2922 }
2923
2924 decorations->nextPalTime = 10;
2925 decorations->palBlendAlpha = 0;
2926 decorations->palAnimState = 0;
2927 decorations->resetPalAdjust = FALSE;
2928 }
2929
2930 if (decorations->palAnimState == 0) {
2931 if (!skipAnimation && decorations->nextPalTime != 0) {
2932 decorations->nextPalTime--;
2933 } else {
2934 if (!skipAnimation) {
2935 decorations->palBlendAlpha += 2560;
2936 if (decorations->palBlendAlpha > 255 * 100) {
2937 decorations->palBlendAlpha = 255 * 100;
2938 }
2939 }
2940 blendAlpha = decorations->palBlendAlpha / 100;
2941 for (i = 0; i < decorations->spriteColorVariations; i++) {
2942 if (!isPoison) {
2943 color2 = decorations->originalPalettesList[i];
2944 } else {
2945 color2 = decorations->originalPalettesList[decorations->spriteColorVariations * STANDARD_PAL_POISON + i];
2946 }
2947 color1 = decorations->originalPalettesList[decorations->spriteColorVariations * STANDARD_PAL_DIZZY + i];
2948 palOut = decorations->copiedPalettes[0][i];
2949
2950 for (j = 0; j < SPR_PAL_SIZE; j++) {
2951 u8 r2 = UNPACK_PAL_R(*color2);
2952 u8 g2 = UNPACK_PAL_G(*color2);
2953 u8 b2 = UNPACK_PAL_B(*color2);
2954 u8 r1 = UNPACK_PAL_R(*color1);
2955 u8 g1 = UNPACK_PAL_G(*color1);
2956 u8 b1 = UNPACK_PAL_B(*color1);
2957 u8 a1 = UNPACK_PAL_A(*color1);
2958 color2++;
2959 color1++;
2960
2961 r1 = LERP_COMPONENT(r2, r1, blendAlpha);
2962 g1 = LERP_COMPONENT(g2, g1, blendAlpha);
2963 b1 = LERP_COMPONENT(b2, b1, blendAlpha);
2964
2965 *palOut++ = PACK_PAL_RGBA(r1, g1, b1, a1);
2966 }
2967 }
2968 if (blendAlpha == 255) {
2969 decorations->palAnimState = 1;
2970 }
2971 }
2972 }
2973
2974 for (i = 0; i < decorations->originalPalettesCount; i++) {
2975 decorations->adjustedPalettes[i] = decorations->copiedPalettes[0][i];
2976 }
2977
2978 switch (decorations->palAnimState) {
2979 case 0:
2980 case 1:
2981 if (isNpcSprite == SPRITE_MODE_PLAYER) {
2982 func_unkB_draw_player(part, yaw, mtx);
2983 } else {
2984 func_unkB_draw_npc(part, yaw, mtx);
2985 }
2986 break;
2987 }
2988}
#define LERP_COMPONENT(a, b, alpha)
@ BS_FLAGS2_PEACH_BATTLE
Definition enums.h:3610
#define SPR_PEACH_BTL_PAL_STRIDE
Definition sprite.h:7

Referenced by render_with_adjusted_palettes().

◆ render_with_pal_blending()

void render_with_pal_blending ( b32 arg0,
ActorPart * part,
s32 yaw,
s32 arg3,
Matrix4f mtx,
s32 skipAnimation )

Definition at line 2990 of file actor_rendering.c.

2990 {
2991 DecorationTable* decorations = part->decorationTable;
2992 PAL_PTR color1;
2993 PAL_PTR color2;
2994 PAL_PTR outColor;
2995 s32 i, j;
2996 u8 blendAlpha;
2997 u8 r2, g2, b2, a1;
2998 u8 r1, g1, b1;
2999
3000 if (decorations->resetPalAdjust != 0) {
3001 if (isNpcSprite == SPRITE_MODE_PLAYER) {
3002 decorations->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16);
3003 decorations->originalPalettesCount = 0;
3004 while ((s32)decorations->originalPalettesList[decorations->originalPalettesCount] != -1) {
3005 decorations->originalPalettesCount++;
3006 }
3007 } else {
3008 decorations->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 16);
3009 decorations->originalPalettesCount = 0;
3010 while ((s32)decorations->originalPalettesList[decorations->originalPalettesCount] != -1) {
3011 decorations->originalPalettesCount++;
3012 }
3013 }
3014
3015 if (decorations->resetPalAdjust == 1) {
3016 decorations->palAnimState = 0;
3017 decorations->palBlendAlpha = 0;
3018 } else {
3019 decorations->palAnimState = 0;
3020 decorations->palBlendAlpha = 255;
3021 }
3022
3023 for (i = 0; i < decorations->originalPalettesCount; i++) {
3024 color2 = decorations->originalPalettesList[i];
3025 color1 = decorations->copiedPalettes[0][i];
3026 decorations->adjustedPalettes[i] = color1;
3027 if (color2 != NULL) {
3028 for (j = 0; j < SPR_PAL_SIZE; j++) {
3029 *color1++ = *color2++;
3030 }
3031 }
3032 }
3033
3034 if (!hasDifferentIntervals) {
3035 decorations->palswapTimeAtoB = decorations->palswapTimeHoldA;
3036 decorations->palswapTimeHoldB = decorations->palswapTimeAtoB;
3037 decorations->palswapTimeBtoA = decorations->palswapTimeAtoB;
3038 decorations->palswapTimeHoldA = 0;
3039 }
3040
3041 decorations->nextPalTime = decorations->palswapTimeHoldA;
3042 decorations->palBlendAlpha = 0;
3043 decorations->palAnimState = PAL_SWAP_HOLD_A;
3044 decorations->resetPalAdjust = FALSE;
3045 }
3046
3047 // blending from A -> B
3048 switch (decorations->palAnimState) {
3049 case PAL_SWAP_HOLD_A:
3050 if (skipAnimation) {
3051 break;
3052 }
3053 if (decorations->nextPalTime != 0) {
3054 decorations->nextPalTime--;
3055 break;
3056 }
3057 decorations->palBlendAlpha = 0;
3058 decorations->palAnimState = PAL_SWAP_A_TO_B;
3059 // fallthrough
3060 case PAL_SWAP_A_TO_B:
3061 if (!skipAnimation) {
3062 decorations->palBlendAlpha += 25600 / decorations->palswapTimeAtoB;
3063 if (decorations->palBlendAlpha > 255 * 100) {
3064 decorations->palBlendAlpha = 255 * 100;
3065 }
3066 }
3067 blendAlpha = decorations->palBlendAlpha / 100;
3068 // blend two palettes
3069 color2 = decorations->originalPalettesList[decorations->blendPalA];
3070 color1 = decorations->originalPalettesList[decorations->blendPalB];
3071 outColor = decorations->adjustedPalettes[0] = decorations->copiedPalettes[0][0];
3072
3073 for (j = 0; j < SPR_PAL_SIZE; j++) {
3074 r2 = UNPACK_PAL_R(*color2);
3075 g2 = UNPACK_PAL_G(*color2);
3076 b2 = UNPACK_PAL_B(*color2);
3077 r1 = UNPACK_PAL_R(*color1);
3078 g1 = UNPACK_PAL_G(*color1);
3079 b1 = UNPACK_PAL_B(*color1);
3080 a1 = UNPACK_PAL_A(*color1);
3081 color2++;
3082 color1++;
3083
3084 r1 = LERP_COMPONENT(r2, r1, blendAlpha);
3085 g1 = LERP_COMPONENT(g2, g1, blendAlpha);
3086 b1 = LERP_COMPONENT(b2, b1, blendAlpha);
3087
3088 *outColor++ = PACK_PAL_RGBA(r1, g1, b1, a1);
3089 }
3090
3091 if (blendAlpha == 255) {
3092 decorations->palAnimState = PAL_SWAP_HOLD_B;
3093 decorations->nextPalTime = decorations->palswapTimeHoldB;
3094 }
3095 break;
3096 }
3097
3098 // blending from B -> A
3099 switch (decorations->palAnimState) {
3100 case PAL_SWAP_HOLD_B:
3101 if (skipAnimation) {
3102 break;
3103 }
3104 if (decorations->nextPalTime != 0) {
3105 decorations->nextPalTime--;
3106 break;
3107 }
3108 decorations->palBlendAlpha = 0;
3109 decorations->palAnimState = PAL_SWAP_B_TO_A;
3110 // fallthrough
3111 case PAL_SWAP_B_TO_A:
3112 if (!skipAnimation) {
3113 decorations->palBlendAlpha += 25600 / decorations->palswapTimeBtoA;
3114 if (decorations->palBlendAlpha > 255 * 100) {
3115 decorations->palBlendAlpha = 255 * 100;
3116 }
3117 }
3118 blendAlpha = decorations->palBlendAlpha / 100;
3119 // blend two palettes
3120 color2 = decorations->originalPalettesList[decorations->blendPalB];
3121 color1 = decorations->originalPalettesList[decorations->blendPalA];
3122 outColor = decorations->copiedPalettes[0][0];
3123 decorations->adjustedPalettes[0] = outColor;
3124
3125 for (j = 0; j < SPR_PAL_SIZE; j++) {
3126 r2 = UNPACK_PAL_R(*color2);
3127 g2 = UNPACK_PAL_G(*color2);
3128 b2 = UNPACK_PAL_B(*color2);
3129 r1 = UNPACK_PAL_R(*color1);
3130 g1 = UNPACK_PAL_G(*color1);
3131 b1 = UNPACK_PAL_B(*color1);
3132 a1 = UNPACK_PAL_A(*color1);
3133 color2++;
3134 color1++;
3135
3136 r1 = LERP_COMPONENT(r2, r1, blendAlpha);
3137 g1 = LERP_COMPONENT(g2, g1, blendAlpha);
3138 b1 = LERP_COMPONENT(b2, b1, blendAlpha);
3139
3140 *outColor++ = PACK_PAL_RGBA(r1, g1, b1, a1);
3141 }
3142 if (blendAlpha == 255) {
3143 decorations->palAnimState = PAL_SWAP_HOLD_A;
3144 decorations->nextPalTime = decorations->palswapTimeHoldA;
3145 }
3146 break;
3147 }
3148
3149 switch (decorations->palAnimState) {
3150 case PAL_SWAP_HOLD_A:
3151 case PAL_SWAP_A_TO_B:
3152 case PAL_SWAP_HOLD_B:
3153 case PAL_SWAP_B_TO_A:
3154 if (isNpcSprite == SPRITE_MODE_PLAYER) {
3155 func_unkB_draw_player(part, yaw, mtx);
3156 } else {
3157 func_unkB_draw_npc(part, yaw, mtx);
3158 }
3159 break;
3160 }
3161}

Referenced by render_with_adjusted_palettes().

◆ render_with_palset_blending()

void render_with_palset_blending ( b32 arg0,
ActorPart * part,
s32 yaw,
Matrix4f mtx,
b32 skipAnimation )

Definition at line 3163 of file actor_rendering.c.

3163 {
3164 DecorationTable* decorations = part->decorationTable;
3165 PAL_PTR color1;
3166 PAL_PTR color2;
3167 PAL_PTR outColor;
3168 s32 i, j;
3169 u8 blendAlpha;
3170 u8 r2, g2, b2, a1;
3171 u8 r1, g1, b1;
3172
3173 // copy palettes from sprite data
3174 if (decorations->resetPalAdjust != 0) {
3175 if (isNpcSprite == SPRITE_MODE_PLAYER) {
3176 decorations->originalPalettesList = spr_get_player_palettes(part->curAnimation >> 16);
3177 decorations->originalPalettesCount = 0;
3178 while (decorations->originalPalettesList[decorations->originalPalettesCount] != (PAL_PTR) -1) {
3179 decorations->originalPalettesCount++;
3180 }
3181 } else {
3182 decorations->originalPalettesList = spr_get_npc_palettes(part->curAnimation >> 16);
3183 decorations->originalPalettesCount = 0;
3184 while (decorations->originalPalettesList[decorations->originalPalettesCount] != (PAL_PTR) -1) {
3185 decorations->originalPalettesCount++;
3186 }
3188 }
3189
3190 if (decorations->resetPalAdjust == 1) {
3191 decorations->palAnimState = PAL_SWAP_HOLD_A;
3192 decorations->palBlendAlpha = 0;
3193 } else {
3194 decorations->palAnimState = PAL_SWAP_HOLD_A;
3195 decorations->palBlendAlpha = 255;
3196 }
3197
3198 for (i = 0; i < decorations->originalPalettesCount; i++) {
3199 color2 = decorations->originalPalettesList[i];
3200 color1 = decorations->copiedPalettes[0][i];
3201 decorations->adjustedPalettes[i] = color1;
3202 if (color2 != NULL) {
3203 for (j = 0; j < SPR_PAL_SIZE; j++) {
3204 *color1++ = *color2++;
3205 }
3206 }
3207 }
3208
3209 decorations->nextPalTime = decorations->palswapTimeHoldA;
3210 decorations->palBlendAlpha = 0;
3211 decorations->palAnimState = PAL_SWAP_HOLD_A;
3212 decorations->resetPalAdjust = FALSE;
3213 }
3214
3215 // blending from A -> B
3216 switch (decorations->palAnimState) {
3217 case PAL_SWAP_HOLD_A:
3218 if (skipAnimation) {
3219 break;
3220 }
3221 if (decorations->nextPalTime != 0) {
3222 decorations->nextPalTime--;
3223 break;
3224 }
3225 decorations->palBlendAlpha = 0;
3226 decorations->palAnimState = PAL_SWAP_A_TO_B;
3227 // fallthrough
3228 case PAL_SWAP_A_TO_B:
3229 if (!skipAnimation) {
3230 decorations->palBlendAlpha += 25600 / decorations->palswapTimeAtoB;
3231 if (decorations->palBlendAlpha > 255 * 100) {
3232 decorations->palBlendAlpha = 255 * 100;
3233 }
3234 }
3235 blendAlpha = decorations->palBlendAlpha / 100;
3236 // blend all palettes from two palette sets
3237 for (i = 0; i < decorations->spriteColorVariations; i++) {
3238 color2 = decorations->originalPalettesList[decorations->blendPalA * decorations->spriteColorVariations + i];
3239 color1 = decorations->originalPalettesList[decorations->blendPalB * decorations->spriteColorVariations + i];
3240 outColor = decorations->copiedPalettes[0][i];
3241 decorations->adjustedPalettes[i] = outColor;
3242
3243 for (j = 0; j < SPR_PAL_SIZE; j++) {
3244 r2 = UNPACK_PAL_R(*color2);
3245 g2 = UNPACK_PAL_G(*color2);
3246 b2 = UNPACK_PAL_B(*color2);
3247 r1 = UNPACK_PAL_R(*color1);
3248 g1 = UNPACK_PAL_G(*color1);
3249 b1 = UNPACK_PAL_B(*color1);
3250 a1 = UNPACK_PAL_A(*color1);
3251 color2++;
3252 color1++;
3253
3254 r1 = LERP_COMPONENT(r2, r1, blendAlpha);
3255 g1 = LERP_COMPONENT(g2, g1, blendAlpha);
3256 b1 = LERP_COMPONENT(b2, b1, blendAlpha);
3257
3258 *outColor++ = PACK_PAL_RGBA(r1, g1, b1, a1);
3259 }
3260 }
3261 if (blendAlpha == 255) {
3262 decorations->palAnimState = PAL_SWAP_HOLD_B;
3263 decorations->nextPalTime = decorations->palswapTimeHoldB;
3264 }
3265 break;
3266 }
3267
3268 switch (decorations->palAnimState) {
3269 case PAL_SWAP_HOLD_B:
3270 if (skipAnimation) {
3271 break;
3272 }
3273 if (decorations->nextPalTime != 0) {
3274 decorations->nextPalTime--;
3275 break;
3276 }
3277 decorations->palBlendAlpha = 0;
3278 decorations->palAnimState = PAL_SWAP_B_TO_A;
3279 // fallthrough
3280 case PAL_SWAP_B_TO_A:
3281 if (!skipAnimation) {
3282 decorations->palBlendAlpha += 25600 / decorations->palswapTimeBtoA;
3283 if (decorations->palBlendAlpha > 255 * 100) {
3284 decorations->palBlendAlpha = 255 * 100;
3285 }
3286 }
3287 blendAlpha = decorations->palBlendAlpha / 100;
3288 // blend all palettes from two palette sets
3289 for (i = 0; i < decorations->spriteColorVariations; i++) {
3290 color2 = decorations->originalPalettesList[decorations->blendPalA * decorations->spriteColorVariations + i];
3291 color1 = decorations->originalPalettesList[decorations->blendPalB * decorations->spriteColorVariations + i];
3292 outColor = decorations->copiedPalettes[0][i];
3293 decorations->adjustedPalettes[i] = outColor;
3294
3295 for (j = 0; j < SPR_PAL_SIZE; j++) {
3296 r2 = UNPACK_PAL_R(*color2);
3297 g2 = UNPACK_PAL_G(*color2);
3298 b2 = UNPACK_PAL_B(*color2);
3299 r1 = UNPACK_PAL_R(*color1);
3300 g1 = UNPACK_PAL_G(*color1);
3301 b1 = UNPACK_PAL_B(*color1);
3302 a1 = UNPACK_PAL_A(*color1);
3303 color2++;
3304 color1++;
3305
3306 r1 = LERP_COMPONENT(r2, r1, blendAlpha);
3307 g1 = LERP_COMPONENT(g2, g1, blendAlpha);
3308 b1 = LERP_COMPONENT(b2, b1, blendAlpha);
3309
3310 *outColor++ = PACK_PAL_RGBA(r1, g1, b1, a1);
3311 }
3312 }
3313 if (blendAlpha == 255) {
3314 decorations->palAnimState = PAL_SWAP_HOLD_A;
3315 decorations->nextPalTime = decorations->palswapTimeHoldA;
3316 }
3317 break;
3318 }
3319
3320 switch (decorations->palAnimState) {
3321 case PAL_SWAP_HOLD_A:
3322 case PAL_SWAP_A_TO_B:
3323 case PAL_SWAP_HOLD_B:
3324 case PAL_SWAP_B_TO_A:
3325 if (isNpcSprite == SPRITE_MODE_PLAYER) {
3326 func_unkB_draw_player(part, yaw, mtx);
3327 } else {
3328 func_unkB_draw_npc(part, yaw, mtx);
3329 }
3330 break;
3331 }
3332}

Referenced by render_with_adjusted_palettes().

◆ update_part_glow()

s32 update_part_glow ( b32 isNpcSprite,
ActorPart * part,
s32 yaw,
b32 isReflection )

Definition at line 3334 of file actor_rendering.c.

3334 {
3335 if (!(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
3336 switch (part->decorationTable->glowState) {
3337 case GLOW_PAL_OFF:
3338 part_glow_off(isNpcSprite, part, yaw, isReflection);
3339 return 0;
3340 case GLOW_PAL_ON:
3341 part_glow_on(isNpcSprite, part, yaw, isReflection);
3342 break;
3343 }
3344 }
3345 return 0;
3346}
void part_glow_on(b32 arg0, ActorPart *part, s32 yaw, b32 arg3)
void part_glow_off(b32 isNpcSprite, ActorPart *part, s32 yaw, b32 isReflection)

Referenced by appendGfx_npc_actor(), appendGfx_npc_actor_reflection(), appendGfx_player_actor(), and appendGfx_player_actor_reflection().

◆ update_part_flash()

s32 update_part_flash ( b32 isNpcSprite,
ActorPart * part,
s32 yaw,
b32 isReflection )

Definition at line 3414 of file actor_rendering.c.

3414 {
3415 if (!(part->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
3416 switch (part->decorationTable->flashState) {
3417 case 0:
3418 part_flash_off(isNpcSprite, part, yaw, isReflection);
3419 return 0;
3420 case 1:
3421 part_flash_on(isNpcSprite, part, yaw, isReflection);
3422 return 0;
3423 }
3424 }
3425 return 0;
3426}
void part_flash_off(b32 isNpcSprite, ActorPart *part, s32 yaw, b32 isReflection)
void part_flash_on(b32 arg0, ActorPart *part, s32 yaw, b32 arg3)

Referenced by appendGfx_npc_actor(), appendGfx_npc_actor_reflection(), appendGfx_player_actor(), and appendGfx_player_actor_reflection().

◆ get_player_anim_for_status()

s32 get_player_anim_for_status ( s32 animID)

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
#define DANGER_THRESHOLD
Definition battle.h:266

Referenced by appendGfx_player_actor().

◆ 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().

◆ get_flash_damage_intensity()

s32 get_flash_damage_intensity ( ActorPart * part)

Definition at line 165 of file actor_rendering.c.

165 {
166 s32 ret;
167
170 } else if (gBattleStatus.lastAttackDamage < 5) {
172 } else if (gBattleStatus.lastAttackDamage < 9) {
174 } else {
176 }
177
178 return ret;
179}
@ DAMAGE_INTENSITY_EXTREME
Definition enums.h:3509

Referenced by part_flash_on().

◆ mtx_mirror_y()

void mtx_mirror_y ( Matrix4f mtx)

Definition at line 181 of file actor_rendering.c.

181 {
182 guMtxIdentF(mtx);
183 mtx[0][0] = 1.0f;
184 mtx[1][1] = -1.0f;
185 mtx[2][2] = 1.0f;
186 mtx[3][3] = 1.0f;
187}

Referenced by appendGfx_npc_actor_reflection(), and appendGfx_player_actor_reflection().

◆ enable_actor_blur()

void enable_actor_blur ( Actor * actor)

Definition at line 189 of file actor_rendering.c.

189 {
190 ActorPart* partsTable = actor->partsTable;
191 DecorationTable* decorations = partsTable->decorationTable;
192 s32 i, j;
193 s32 numParts;
194
195 decorations->blurDisableDelay = 0;
196 decorations->blurEnableCount++;
198 partsTable = actor->partsTable;
199 numParts = actor->numParts;
200
201 for (i = 0; i < numParts; i++) {
202 if (partsTable->idleAnimations != NULL && !(partsTable->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
203 decorations = partsTable->decorationTable;
204 decorations->blurUnused = 0;
205 decorations->blurBufferPos = 0;
206 for (j = 0; j < ARRAY_COUNT(decorations->posX); j++) {
207 decorations->posX[j] = partsTable->curPos.x;
208 decorations->posY[j] = partsTable->curPos.y;
209 decorations->posZ[j] = partsTable->curPos.z;
210 decorations->yaw[j] = actor->yaw;
211 decorations->rotPivotOffsetX[j] = (s32)(actor->rotPivotOffset.x * actor->scalingFactor);
212 decorations->rotPivotOffsetY[j] = (s32)(actor->rotPivotOffset.y * actor->scalingFactor);
213
214 decorations->rotX[j] = clamp_angle(actor->rot.x) * 0.5f;
215 decorations->rotY[j] = clamp_angle(actor->rot.y) * 0.5f;
216 decorations->rotZ[j] = clamp_angle(actor->rot.z) * 0.5f;
217 }
218 }
219 partsTable = partsTable->nextPart;
220 }
221}

Referenced by enable_partner_blur().

◆ disable_actor_blur()

void disable_actor_blur ( Actor * actor)

Definition at line 223 of file actor_rendering.c.

223 {
224 ActorPart* actorPart = actor->partsTable;
225
226 if ((actorPart->idleAnimations != NULL) && !(actorPart->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
227 DecorationTable* decorations = actorPart->decorationTable;
228
229 if (decorations->blurEnableCount != 0) {
230 decorations->blurEnableCount--;
231 if (decorations->blurEnableCount == 0) {
232 decorations->blurDisableDelay = 20;
233 }
234 }
235 }
236}

Referenced by disable_partner_blur().

◆ reset_actor_blur()

void reset_actor_blur ( Actor * actor)

Definition at line 238 of file actor_rendering.c.

238 {
239 ActorPart* actorPart = actor->partsTable;
240
241 if ((actorPart->idleAnimations != NULL) && !(actorPart->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
242 DecorationTable* decorations = actorPart->decorationTable;
243
244 if (decorations->blurEnableCount != 0) {
245 decorations->blurEnableCount--;
246 if (decorations->blurEnableCount == 0) {
247 actor->flags &= ~ACTOR_FLAG_BLUR_ENABLED;
248 decorations->blurDisableDelay = 1;
249 }
250 }
251 }
252}

Referenced by reset_partner_blur().

◆ force_disable_actor_blur()

void force_disable_actor_blur ( Actor * actor)

Definition at line 254 of file actor_rendering.c.

254 {
255 ActorPart* actorPart = actor->partsTable;
256
257 if (actorPart->idleAnimations != NULL && !(actorPart->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
258 DecorationTable* decorations = actorPart->decorationTable;
259
260 decorations->blurEnableCount = 0;
261 decorations->blurDisableDelay = 20;
262 }
263}

Referenced by force_disable_partner_blur().

◆ enable_partner_blur()

void enable_partner_blur ( void )

Definition at line 265 of file actor_rendering.c.

265 {
267}
void enable_actor_blur(Actor *actor)

◆ disable_partner_blur()

void disable_partner_blur ( void )

Definition at line 269 of file actor_rendering.c.

269 {
271}
void disable_actor_blur(Actor *actor)

◆ reset_partner_blur()

void reset_partner_blur ( void )

Definition at line 273 of file actor_rendering.c.

273 {
275}
void reset_actor_blur(Actor *actor)

◆ force_disable_partner_blur()

void force_disable_partner_blur ( void )

Definition at line 277 of file actor_rendering.c.

277 {
279}
void force_disable_actor_blur(Actor *actor)

◆ enable_player_blur()

void enable_player_blur ( void )

Definition at line 281 of file actor_rendering.c.

281 {
282 Actor* playerActor = gBattleStatus.playerActor;
283 ActorPart* partsTable = playerActor->partsTable;
284 DecorationTable* decorations = partsTable->decorationTable;
285 s32 i;
286
287 decorations->blurDisableDelay = 0;
288 decorations->blurEnableCount++;
289 playerActor->flags |= ACTOR_FLAG_BLUR_ENABLED;
290 decorations->blurUnused = 0;
291 decorations->blurBufferPos = 0;
292
293 for (i = 0; i < ARRAY_COUNT(decorations->posX); i++) {
294 decorations->posX[i] = partsTable->curPos.x;
295 decorations->posY[i] = partsTable->curPos.y;
296 decorations->posZ[i] = partsTable->curPos.z;
297 decorations->yaw[i] = playerActor->yaw;
298 decorations->rotPivotOffsetX[i] = playerActor->rotPivotOffset.x * playerActor->scalingFactor;
299 decorations->rotPivotOffsetY[i] = playerActor->rotPivotOffset.y * playerActor->scalingFactor;
300
301 decorations->rotX[i] = clamp_angle(playerActor->rot.x) * 0.5f;
302 decorations->rotY[i] = clamp_angle(playerActor->rot.y) * 0.5f;
303 decorations->rotZ[i] = clamp_angle(playerActor->rot.z) * 0.5f;
304 }
305}

◆ disable_player_blur()

void disable_player_blur ( void )

Definition at line 307 of file actor_rendering.c.

307 {
308 Actor* playerActor = gBattleStatus.playerActor;
309 ActorPart* partsTable = playerActor->partsTable;
310 DecorationTable* decorations = partsTable->decorationTable;
311
312 if (decorations->blurEnableCount != 0) {
313 decorations->blurEnableCount--;
314 if (decorations->blurEnableCount == 0) {
315 decorations->blurDisableDelay = 20;
316 }
317 }
318}

◆ reset_player_blur()

void reset_player_blur ( void )

Definition at line 320 of file actor_rendering.c.

320 {
321 Actor* playerActor = gBattleStatus.playerActor;
322 ActorPart* partsTable = playerActor->partsTable;
323 DecorationTable* decorations = partsTable->decorationTable;
324
325 if (decorations->blurEnableCount != 0) {
326 decorations->blurEnableCount--;
327 if (decorations->blurEnableCount == 0) {
328 playerActor->flags &= ~ACTOR_FLAG_BLUR_ENABLED;
329 decorations->blurDisableDelay = 1;
330 }
331 }
332}

◆ force_disable_player_blur()

void force_disable_player_blur ( void )

Definition at line 334 of file actor_rendering.c.

334 {
335 Actor* playerActor = gBattleStatus.playerActor;
336 ActorPart* partsTable = playerActor->partsTable;
337 DecorationTable* decorations = partsTable->decorationTable;
338
339 decorations->blurEnableCount = 0;
340 decorations->blurDisableDelay = 20;
341}

◆ force_disable_player_blur_immediately()

void force_disable_player_blur_immediately ( void )

Definition at line 343 of file actor_rendering.c.

343 {
344 Actor* playerActor = gBattleStatus.playerActor;
345 ActorPart* partsTable = playerActor->partsTable;
346 DecorationTable* decorations = partsTable->decorationTable;
347
348 playerActor->flags &= ~ACTOR_FLAG_BLUR_ENABLED;
349 decorations->blurEnableCount = 0;
350 decorations->blurDisableDelay = 1;
351}

◆ update_player_actor_blur_history()

void update_player_actor_blur_history ( Actor * actor)

Definition at line 353 of file actor_rendering.c.

353 {
354 ActorPart* partsTable = actor->partsTable;
355 DecorationTable* decorations = partsTable->decorationTable;
356
357 if (!(partsTable->flags & ACTOR_PART_FLAG_INVISIBLE) && partsTable->idleAnimations != NULL) {
358 s32 i = decorations->blurBufferPos;
359
360 decorations->posX[i] = partsTable->curPos.x;
361 decorations->posY[i] = partsTable->curPos.y;
362 decorations->posZ[i] = partsTable->curPos.z;
363 decorations->yaw[i] = actor->yaw;
364
365 decorations->rotPivotOffsetX[i] = actor->rotPivotOffset.x * actor->scalingFactor;
366 decorations->rotPivotOffsetY[i] = actor->rotPivotOffset.y * actor->scalingFactor;
367
368 decorations->rotX[i] = clamp_angle(actor->rot.x) * 0.5f;
369 decorations->rotY[i] = clamp_angle(actor->rot.y) * 0.5f;
370 decorations->rotZ[i] = clamp_angle(actor->rot.z) * 0.5f;
371
372 i++;
373 if (i >= ARRAY_COUNT(decorations->posX)) {
374 i = 0;
375 }
376 decorations->blurBufferPos = i;
377 }
378}

Referenced by update_player_actor_shadow().

◆ appendGfx_player_actor_blur()

void appendGfx_player_actor_blur ( Actor * actor)

Definition at line 380 of file actor_rendering.c.

380 {
381 Matrix4f mtxRotX, mtxRotY, mtxRotZ, mtxRotation;
382 Matrix4f mtxScale;
383 Matrix4f mtxPivotOn, mtxPivotOff, mtxTranslate;
384 Matrix4f mtxTransform, mtxTemp;
385 s32 strideIdx;
386 s32 drawIdx;
387 s32 yaw;
388 ActorPart* partTable;
389 DecorationTable* decorations;
390 f32 rotX, rotY, rotZ;
391 s32 prevOpacity;
392 s32 opacity;
393 s32 pivotOffsetX;
394 s32 pivotOffsetY;
395 s32 bufPos;
396 s32 blurOpacityBase;
397 s32 opacityLossIncrement;
398 f32 x, y, z;
399
400 partTable = actor->partsTable;
401 decorations = partTable->decorationTable;
402 if (decorations->blurDisableDelay != 0) {
403 decorations->blurDisableDelay--;
404 if (decorations->blurDisableDelay == 0) {
405 actor->flags &= ~ACTOR_FLAG_BLUR_ENABLED;
406 return;
407 }
408 }
409
410 if (!(partTable->flags & ACTOR_PART_FLAG_INVISIBLE) && partTable->idleAnimations != NULL) {
411 bufPos = decorations->blurBufferPos;
412 strideIdx = 0;
413 drawIdx = 0;
414
415 while (TRUE) {
416 bufPos--;
417 strideIdx++;
418 if (bufPos < 0) {
419 bufPos = ARRAY_COUNT(decorations->posX) - 1;
420 }
421 if (bufPos == decorations->blurBufferPos) {
422 break;
423 }
424
425 // only draw every third blur frame
426 if (strideIdx < 3) {
427 continue;
428 }
429
430 strideIdx = 0;
431 drawIdx++;
432
433 if (decorations->blurDrawCount < drawIdx) {
434 break;
435 }
436
437 opacity = partTable->opacity;
438
439 x = decorations->posX[bufPos];
440 y = decorations->posY[bufPos];
441 z = decorations->posZ[bufPos];
442
443 yaw = decorations->yaw[bufPos];
444
445 pivotOffsetX = decorations->rotPivotOffsetX[bufPos];
446 pivotOffsetY = decorations->rotPivotOffsetY[bufPos];
447
448 rotX = decorations->rotX[bufPos] * 2;
449 rotY = decorations->rotY[bufPos] * 2;
450 rotZ = decorations->rotZ[bufPos] * 2;
451
452 blurOpacityBase = 120;
453 opacityLossIncrement = 20;
454 if (opacity < 50) {
455 blurOpacityBase = 50;
456 opacityLossIncrement = 8;
457 } else if (opacity < 100) {
458 blurOpacityBase = 70;
459 opacityLossIncrement = 10;
460 } else if (opacity < 150) {
461 blurOpacityBase = 100;
462 opacityLossIncrement = 15;
463 }
464
465 guTranslateF(mtxTranslate, x, y, z);
466 guTranslateF(mtxPivotOn, -pivotOffsetX, -pivotOffsetY, 0.0f);
467 guTranslateF(mtxPivotOff, pivotOffsetX, pivotOffsetY, 0.0f);
468 guRotateF(mtxRotX, rotX, 1.0f, 0.0f, 0.0f);
469 guRotateF(mtxRotY, rotY, 0.0f, 1.0f, 0.0f);
470 guRotateF(mtxRotZ, rotZ, 0.0f, 0.0f, 1.0f);
471 guMtxCatF(mtxRotX, mtxRotY, mtxTransform);
472 guMtxCatF(mtxTransform, mtxRotZ, mtxRotation);
473 guScaleF(mtxScale, actor->scale.x * SPRITE_WORLD_SCALE_D * actor->scalingFactor,
474 actor->scale.y * SPRITE_WORLD_SCALE_D * actor->scalingFactor * partTable->verticalStretch,
475 actor->scale.z * SPRITE_WORLD_SCALE_D);
476 guMtxCatF(mtxScale, mtxPivotOn, mtxTemp);
477 guMtxCatF(mtxTemp, mtxRotation, mtxTransform);
478 guMtxCatF(mtxTransform, mtxPivotOff, mtxTemp);
479 guMtxCatF(mtxTemp, mtxTranslate, mtxTransform);
480 prevOpacity = partTable->opacity;
481 partTable->opacity = blurOpacityBase - (drawIdx * opacityLossIncrement);
482 render_with_adjusted_palettes(SPRITE_MODE_PLAYER, partTable, clamp_angle(yaw + 180), mtxTransform, 1);
483 partTable->opacity = prevOpacity;
484 }
485 }
486}

Referenced by btl_render_actors().

◆ update_nonplayer_actor_blur_history()

void update_nonplayer_actor_blur_history ( b32 isPartner,
Actor * actor )

Definition at line 488 of file actor_rendering.c.

488 {
489 s32 numParts = actor->numParts;
490 ActorPart* partsTable = actor->partsTable;
491 DecorationTable* decorations;
492 s32 i, j;
493
494 for (i = 0; i < numParts; i++) {
495 if (partsTable->flags & ACTOR_PART_FLAG_INVISIBLE || partsTable->idleAnimations == NULL || partsTable->flags & ACTOR_PART_FLAG_NO_DECORATIONS) {
496 partsTable = partsTable->nextPart;
497 } else {
498 decorations = partsTable->decorationTable;
499 j = decorations->blurBufferPos;
500
501 decorations->posX[j] = partsTable->curPos.x;
502 decorations->posY[j] = partsTable->curPos.y;
503 decorations->posZ[j] = partsTable->curPos.z;
504 decorations->yaw[j] = actor->yaw;
505
506 decorations->rotPivotOffsetX[j] = actor->rotPivotOffset.x;
507 decorations->rotPivotOffsetY[j] = actor->rotPivotOffset.y;
508
509 decorations->rotX[j] = clamp_angle(actor->rot.x) * 0.5f;
510 decorations->rotY[j] = clamp_angle(actor->rot.y) * 0.5f;
511 decorations->rotZ[j] = clamp_angle(actor->rot.z) * 0.5f;
512
513 j++;
514 if (j >= ARRAY_COUNT(decorations->posX)) {
515 j = 0;
516 }
517 decorations->blurBufferPos = j;
518 }
519 }
520}

Referenced by update_enemy_actor_blur_history(), and update_partner_actor_blur_history().

◆ appendGfx_nonplayer_actor_blur()

void appendGfx_nonplayer_actor_blur ( b32 isPartner,
Actor * actor )

Definition at line 522 of file actor_rendering.c.

522 {
523 DecorationTable* decorations;
524 ActorPart* partTable;
525 Matrix4f mtxRotX, mtxRotY, mtxRotZ, mtxRotation;
526 Matrix4f mtxScale, mtxTranslate;
527 Matrix4f mtxTemp, mtxTransform;
528 Matrix4f mtxPivotOn, mtxPivotOff;
529 Matrix4f mtxActor, mtxPartScale;
530 s32 numParts;
531 s32 i, bufPos, strideIdx, drawIdx;
532 f32 x, y, z;
533 f32 rotX, rotY, rotZ;
534 s32 yaw;
535 s32 opacity;
536 s32 pivotX;
537 s32 pivotY;
538 s32 blurOpacityBase;
539 s32 opacityLossIncrement;
540 s32 blurOpacity;
541 s32 flags;
542
543 guRotateF(mtxRotX, actor->rot.x, 1.0f, 0.0f, 0.0f);
544 guRotateF(mtxRotY, actor->rot.y, 0.0f, 1.0f, 0.0f);
545 guRotateF(mtxRotZ, actor->rot.z, 0.0f, 0.0f, 1.0f);
546 guMtxCatF(mtxRotX, mtxRotY, mtxTemp);
547 guMtxCatF(mtxTemp, mtxRotZ, mtxRotation);
548 guScaleF(mtxScale, actor->scale.x * SPRITE_WORLD_SCALE_D * actor->scalingFactor,
549 actor->scale.y * SPRITE_WORLD_SCALE_D * actor->scalingFactor,
550 actor->scale.z * SPRITE_WORLD_SCALE_D);
551 guMtxCatF(mtxScale, mtxRotation, mtxActor);
552
553 numParts = actor->numParts;
554 partTable = actor->partsTable;
555 for (i = 0; i < numParts; i++) {
556 if ((partTable->idleAnimations == NULL) || (partTable->flags & ACTOR_PART_FLAG_NO_DECORATIONS)) {
557 partTable = partTable->nextPart;
558 continue;
559 }
560
561 decorations = partTable->decorationTable;
562 if (decorations->blurDisableDelay != 0) {
563 decorations->blurDisableDelay--;
564 if (decorations->blurDisableDelay == 0) {
565 actor->flags &= ~ACTOR_FLAG_BLUR_ENABLED;
566 partTable = partTable->nextPart;
567 continue;
568 }
569 }
570
571 if (partTable->flags & ACTOR_PART_FLAG_INVISIBLE) {
572 partTable = partTable->nextPart;
573 continue;
574 }
575
577 guScaleF(mtxPartScale, actor->scale.x * SPRITE_WORLD_SCALE_D, actor->scale.y * SPRITE_WORLD_SCALE_D, actor->scale.z * SPRITE_WORLD_SCALE_D);
578 }
579
580 bufPos = decorations->blurBufferPos;
581 strideIdx = 0;
582 drawIdx = 0;
583
584 while (TRUE) {
585 bufPos--;
586 strideIdx++;
587
588 if (bufPos < 0) {
589 bufPos = ACTOR_BLUR_FRAMES - 1;
590 }
591
592 if (bufPos == decorations->blurBufferPos) {
593 break;
594 }
595
596 // only draw every third blur frame
597 if (strideIdx < 3) {
598 continue;
599 }
600
601 strideIdx = 0;
602 drawIdx++;
603
604 if (decorations->blurDrawCount < drawIdx) {
605 break;
606 }
607
608 opacity = partTable->opacity;
609
610 x = decorations->posX[bufPos];
611 y = decorations->posY[bufPos];
612 z = decorations->posZ[bufPos];
613
614 yaw = decorations->yaw[bufPos];
615
616 pivotX = decorations->rotPivotOffsetX[bufPos];
617 pivotY = decorations->rotPivotOffsetY[bufPos];
618
619 rotX = decorations->rotX[bufPos] * 2;
620 rotY = decorations->rotY[bufPos] * 2;
621 rotZ = decorations->rotZ[bufPos] * 2;
622
623 blurOpacityBase = 120;
624 opacityLossIncrement = 20;
625 if (opacity < 50) {
626 blurOpacityBase = 50;
627 opacityLossIncrement = 8;
628 } else if (opacity < 100) {
629 blurOpacityBase = 70;
630 opacityLossIncrement = 10;
631 } else if (opacity < 150) {
632 blurOpacityBase = 100;
633 opacityLossIncrement = 15;
634 }
635
636 if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
637 guTranslateF(mtxPivotOn, -pivotX, -pivotY, 0.0f);
638 guTranslateF(mtxPivotOff, pivotX, pivotY, 0.0f);
639 } else {
640 guTranslateF(mtxPivotOn, -pivotX, pivotY, 0.0f);
641 guTranslateF(mtxPivotOff, pivotX, -pivotY, 0.0f);
642 }
643
644 guTranslateF(mtxTranslate, x, y, z);
645 guRotateF(mtxRotX, rotX, 1.0f, 0.0f, 0.0f);
646 guRotateF(mtxRotY, rotY, 0.0f, 1.0f, 0.0f);
647 guRotateF(mtxRotZ, rotZ, 0.0f, 0.0f, 1.0f);
648 guMtxCatF(mtxRotY, mtxRotX, mtxTemp);
649 guMtxCatF(mtxTemp, mtxRotZ, mtxRotation);
650 guScaleF(mtxScale, partTable->scale.x, partTable->scale.y * partTable->verticalStretch, partTable->scale.z);
651 guMtxCatF(mtxScale, mtxPivotOn, mtxTransform);
652 guMtxCatF(mtxTransform, mtxRotation, mtxTemp);
653 guMtxCatF(mtxTemp, mtxPivotOff, mtxTransform);
654
655 if (!(partTable->flags & ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION)) {
656 guMtxCatF(mtxTransform, mtxActor, mtxTemp);
657 } else {
658 guMtxCatF(mtxTransform, mtxPartScale, mtxTemp);
659 }
660 guMtxCatF(mtxTemp, mtxTranslate, mtxTransform);
661
663 blurOpacity = blurOpacityBase - drawIdx * opacityLossIncrement;
664 if (!isPartner) {
665 spr_draw_npc_sprite(partTable->spriteInstanceID | flags, yaw, blurOpacity, 0, mtxTransform);
666 } else {
667 spr_draw_npc_sprite(partTable->spriteInstanceID | flags, clamp_angle(yaw + 180), blurOpacity, 0, mtxTransform);
668 }
669 }
670 }
671}
#define ACTOR_BLUR_FRAMES
s8 flags
Definition demo_api.c:15

Referenced by appendGfx_enemy_actor_blur(), and appendGfx_partner_actor_blur().

◆ update_enemy_actor_blur_history()

void update_enemy_actor_blur_history ( Actor * actor)

Definition at line 673 of file actor_rendering.c.

673 {
675}
void update_nonplayer_actor_blur_history(b32 isPartner, Actor *actor)

Referenced by update_nonplayer_actor_shadow().

◆ appendGfx_enemy_actor_blur()

void appendGfx_enemy_actor_blur ( void * data)

Definition at line 677 of file actor_rendering.c.

677 {
678 Actor* actor = data;
679
680 appendGfx_nonplayer_actor_blur(FALSE, actor);
681}
void appendGfx_nonplayer_actor_blur(b32 isPartner, Actor *actor)

Referenced by btl_render_actors().

◆ update_partner_actor_blur_history()

void update_partner_actor_blur_history ( Actor * actor)

Definition at line 683 of file actor_rendering.c.

683 {
685}

Referenced by update_nonplayer_actor_shadow().

◆ appendGfx_partner_actor_blur()

void appendGfx_partner_actor_blur ( void * data)

Definition at line 687 of file actor_rendering.c.

687 {
688 Actor* actor = data;
689
691}

Referenced by btl_render_actors().

◆ update_nonplayer_actor_shadow()

void update_nonplayer_actor_shadow ( b32 isPartner,
Actor * actor )

Definition at line 693 of file actor_rendering.c.

693 {
694 Camera* camera = &gCameras[CAM_BATTLE];
695 ActorPart* actorPart;
696 Shadow* shadow;
697 s32 numParts;
698 f32 x1, y1, z1;
699 f32 x2, y2, z2;
700 f32 dist;
701 s32 spriteID;
702 f32 yaw;
703 s32 i;
704
705 if (actor != NULL) {
706 shadow = get_shadow_by_index(actor->shadow.id);
707 shadow->flags |= ENTITY_FLAG_HIDDEN;
708 if (!(actor->flags & ACTOR_FLAG_INVISIBLE)) {
709 if (actor->flags & ACTOR_FLAG_BLUR_ENABLED) {
710 if (!isPartner) {
712 } else {
714 }
715 }
716
718 x1 = actor->curPos.x + actor->headOffset.x;
719 if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
720 y1 = actor->curPos.y + actor->headOffset.y;
721 } else {
722 y1 = actor->curPos.y - actor->headOffset.y;
723 }
724 z1 = actor->curPos.z + actor->headOffset.z;
725 numParts = actor->numParts;
726 actorPart = actor->partsTable;
727
728 for (i = 0; i < numParts; i++) {
729 if (!(actorPart->flags & ACTOR_PART_FLAG_INVISIBLE) && actorPart->idleAnimations != NULL) {
730 spriteID = actorPart->spriteInstanceID;
731 if (spriteID >= 0) {
732 spr_update_sprite(spriteID, actorPart->curAnimation, actorPart->animationRate);
734 }
735
736 if (!(actorPart->flags & ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION)) {
737 x2 = x1 + actorPart->partOffset.x + actorPart->visualOffset.x;
738 if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
739 y2 = y1 + actorPart->partOffset.y + actorPart->visualOffset.y;
740 } else {
741 y2 = y1 - actorPart->partOffset.y - actorPart->visualOffset.y;
742 }
743 z2 = z1 + actorPart->partOffset.z + actorPart->visualOffset.z;
744 yaw = actorPart->yaw = actor->yaw;
745 } else {
746 x2 = actorPart->absolutePos.x + actorPart->visualOffset.x;
747 y2 = actorPart->absolutePos.y + actorPart->visualOffset.y;
748 z2 = actorPart->absolutePos.z + actorPart->visualOffset.z;
749 yaw = actorPart->yaw;
750 }
751 actorPart->curPos.x = x2;
752 actorPart->curPos.y = y2;
753 actorPart->curPos.z = z2;
754
755 if (!(actorPart->flags & ACTOR_PART_FLAG_NO_SHADOW)) {
756 shadow = get_shadow_by_index(actorPart->shadowIndex);
757 shadow->flags &= ~ENTITY_FLAG_HIDDEN;
758 x1 = actorPart->curPos.x;
759 if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
760 y1 = actorPart->curPos.y + 12.0;
761 } else {
762 y1 = actorPart->curPos.y - 12.0;
763 }
764 z1 = actorPart->curPos.z;
765
766 dist = 32767.0f;
767 npc_raycast_down_sides(0, &x1, &y1, &z1, &dist);
768
769 if (200.0f < dist) {
770 shadow->flags |= ENTITY_FLAG_HIDDEN;
771 }
772 shadow->pos.x = x1;
773 shadow->pos.y = y1;
774 shadow->pos.z = z1;
775 shadow->rot.y = clamp_angle(yaw - camera->curYaw);
776 set_standard_shadow_scale(shadow, dist);
777 shadow->scale.x *= actorPart->shadowScale;
778 }
779 if (actorPart->opacity < 255 || actorPart->flags & ACTOR_PART_FLAG_TRANSPARENT) {
781 }
782 }
783 actorPart = actorPart->nextPart;
784 }
785
786 shadow = get_shadow_by_index(actor->shadow.id);
787 if (!(actor->flags & ACTOR_FLAG_NO_SHADOW)) {
788 shadow->flags &= ~ENTITY_FLAG_HIDDEN;
789 }
790
791 x1 = actor->curPos.x + actor->headOffset.x;
792 if (!(actor->flags & ACTOR_FLAG_UPSIDE_DOWN)) {
793 y1 = actor->curPos.y + actor->headOffset.y + 12.0;
794 } else {
795 y1 = actor->curPos.y - actor->headOffset.y + 12.0;
796 }
797 z1 = actor->curPos.z + actor->headOffset.z;
798
799 dist = 32767.0f;
800 npc_raycast_down_sides(0, &x1, &y1, &z1, &dist);
801
802 if (200.0f < dist) {
803 shadow->flags |= ENTITY_FLAG_HIDDEN;
804 }
805 shadow->pos.x = x1;
806 shadow->pos.y = y1;
807 shadow->pos.z = z1 + bActorOffsets[actor->actorType].shadow;
808 shadow->rot.y = clamp_angle(actor->yaw - camera->curYaw);
809 set_standard_shadow_scale(shadow, dist);
810 shadow->scale.x *= actor->shadowScale * actor->scalingFactor;
811 }
812 }
813}
void update_enemy_actor_blur_history(Actor *actor)
void update_partner_actor_blur_history(Actor *actor)
@ ACTOR_FLAG_INVISIBLE
Actor is not rendered.
Definition enums.h:3324
@ ACTOR_FLAG_NO_SHADOW
Hide shadow.
Definition enums.h:3325
@ ACTOR_PART_FLAG_NO_SHADOW
Definition enums.h:3352
ActorOffsets bActorOffsets[]

Referenced by update_enemy_shadows(), and update_hero_shadows().

◆ update_enemy_shadows()

void update_enemy_shadows ( void )

Definition at line 815 of file actor_rendering.c.

815 {
816 BattleStatus* battleStatus = &gBattleStatus;
817 s32 i;
818
819 for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
820 update_nonplayer_actor_shadow(FALSE, battleStatus->enemyActors[i]);
821 }
822}
void update_nonplayer_actor_shadow(b32 isPartner, Actor *actor)

Referenced by update_nonplayer_actor_shadows().

◆ update_hero_shadows()

void update_hero_shadows ( void )

Definition at line 824 of file actor_rendering.c.

Referenced by update_nonplayer_actor_shadows().

◆ func_80255FD8()

void func_80255FD8 ( void )

Definition at line 829 of file actor_rendering.c.

829 {
830}

Referenced by btl_render_actors().

◆ appendGfx_enemy_actor()

void appendGfx_enemy_actor ( void * data)

Definition at line 1375 of file actor_rendering.c.

1375 {
1376 appendGfx_npc_actor(FALSE, (s32) data);
1377}
void appendGfx_npc_actor(s32 isPartner, s32 actorIndex)

Referenced by btl_render_actors().

◆ appendGfx_partner_actor()

void appendGfx_partner_actor ( void * data)

Definition at line 1379 of file actor_rendering.c.

1379 {
1380 appendGfx_npc_actor(TRUE, (s32) data);
1381}

Referenced by btl_render_actors().

◆ appendGfx_enemy_actor_reflection()

void appendGfx_enemy_actor_reflection ( void * data)

Definition at line 1383 of file actor_rendering.c.

1383 {
1384 Actor* actor = data;
1385
1387}
void appendGfx_npc_actor_reflection(s32, Actor *)

Referenced by btl_render_actors().

◆ appendGfx_partner_actor_reflection()

void appendGfx_partner_actor_reflection ( void * data)

Definition at line 1389 of file actor_rendering.c.

Referenced by btl_render_actors().

◆ appendGfx_player_actor()

void appendGfx_player_actor ( void * arg0)

Definition at line 1439 of file actor_rendering.c.

1439 {
1440 BattleStatus* battleStatus = &gBattleStatus;
1441 PlayerData* playerData = &gPlayerData;
1442 Matrix4f mtxRotX, mtxRotY, mtxRotZ, mtxRotation;
1443 Matrix4f mtxScale;
1444 Matrix4f mtxPivotOn, mtxPivotOff, mtxTranslate;
1445 Matrix4f mtxTemp, mtxTransform;
1446
1447 Actor* partner;
1448 Actor* player;
1449 ActorPart* playerParts;
1450 EffectInstance* effect;
1451 f32 playerPosX, playerPosY, playerPosZ, playerYaw;
1452 s32 animChanged, palChanged, decorChanged, cond4;
1453 u32 lastAnim;
1454
1455 player = battleStatus->playerActor;
1456 partner = battleStatus->partnerActor;
1457 playerParts = player->partsTable;
1458
1459 playerPosX = player->curPos.x + player->headOffset.x;
1460 playerPosY = player->curPos.y + player->headOffset.y + player->verticalRenderOffset;
1461 playerPosZ = player->curPos.z + player->headOffset.z;
1462
1463 playerYaw = playerParts->yaw = player->yaw;
1464
1465 player->disableEffect->data.disableX->pos.x = playerPosX +
1466 (player->actorBlueprint->statusIconOffset.x + player->statusIconOffset.x) * player->scalingFactor;
1467 player->disableEffect->data.disableX->pos.y = playerPosY +
1468 (player->actorBlueprint->statusIconOffset.y + player->statusIconOffset.y) * player->scalingFactor;
1469 player->disableEffect->data.disableX->pos.z = playerPosZ;
1470
1472 if (player->disableDismissTimer != 0) {
1473 player->disableDismissTimer--;
1474 player->disableEffect->data.disableX->pos.y = NPC_DISPOSE_POS_Y;
1475 } else {
1476 player->disableEffect->data.disableX->scale = player->scalingFactor * 0.75;
1477 }
1478 } else {
1479 player->disableEffect->data.disableX->pos.y = NPC_DISPOSE_POS_Y;
1480 player->disableDismissTimer = 10;
1481 }
1482
1483 if (battleStatus->waterBlockTurnsLeft != 0) {
1486 {
1487 effect = battleStatus->waterBlockEffect;
1488 effect->data.waterBlock->pos.x = playerPosX;
1489 effect->data.waterBlock->pos.y = playerPosY;
1490 effect->data.waterBlock->pos.z = playerPosZ;
1491 } else {
1492 effect = battleStatus->waterBlockEffect;
1493 effect->data.waterBlock->pos.x = playerPosX;
1494 effect->data.waterBlock->pos.y = NPC_DISPOSE_POS_Y;
1495 effect->data.waterBlock->pos.z = playerPosZ;
1496 }
1497 }
1498 if (battleStatus->cloudNineTurnsLeft != 0) {
1501 {
1502 effect = battleStatus->cloudNineEffect;
1503 effect->data.endingDecals->pos.x = playerPosX;
1504 effect->data.endingDecals->pos.y = playerPosY;
1505 effect->data.endingDecals->pos.z = playerPosZ;
1506 effect->data.endingDecals->scale = player->scalingFactor;
1507 } else {
1508 effect = battleStatus->cloudNineEffect;
1509 effect->data.endingDecals->pos.x = playerPosX;
1510 effect->data.endingDecals->pos.y = NPC_DISPOSE_POS_Y;
1511 effect->data.endingDecals->pos.z = playerPosZ;
1512 }
1513 }
1514 if (player->debuff == STATUS_KEY_FROZEN) {
1515 effect = player->icePillarEffect;
1516 if (player->icePillarEffect != NULL) {
1519 {
1520 effect->data.icePillar->pos.x = playerPosX - 8.0f;
1521 effect->data.icePillar->pos.y = playerPosY;
1522 effect->data.icePillar->pos.z = playerPosZ;
1523 effect->data.icePillar->scale = player->size.y / 24.0;
1524 } else {
1525 effect->data.icePillar->pos.x = NPC_DISPOSE_POS_X;
1526 effect->data.icePillar->pos.y = NPC_DISPOSE_POS_Y;
1527 effect->data.icePillar->pos.z = NPC_DISPOSE_POS_Z;
1528 }
1529 } else {
1530 effect->data.icePillar->pos.x = NPC_DISPOSE_POS_X;
1531 effect->data.icePillar->pos.y = NPC_DISPOSE_POS_Y;
1532 effect->data.icePillar->pos.z = NPC_DISPOSE_POS_Z;
1533 }
1534 } else {
1535 effect = player->icePillarEffect;
1536 if (effect != NULL) {
1537 effect->flags |= FX_INSTANCE_FLAG_DISMISS;
1538 player->icePillarEffect = NULL;
1539 }
1540 }
1541
1544 && (player->flags & ACTOR_FLAG_SHOW_STATUS_ICONS)
1545 ) {
1546 battleStatus->buffEffect->data.partnerBuff->visible = TRUE;
1547 } else {
1548 battleStatus->buffEffect->data.partnerBuff->visible = FALSE;
1549 }
1550
1551 if (player->debuff == STATUS_KEY_SHRINK) {
1552 player->scalingFactor += (0.4 - player->scalingFactor) / 6.0;
1553 } else {
1554 player->scalingFactor += (1.0 - player->scalingFactor) / 6.0;
1555 }
1556
1557 if (player->flags & ACTOR_FLAG_SHOW_STATUS_ICONS) {
1558 if (battleStatus->hammerCharge > 0) {
1559 create_status_icon_boost_hammer(player->hudElementDataIndex);
1560 remove_status_icon_boost_jump(player->hudElementDataIndex);
1561 } else {
1562 remove_status_icon_boost_hammer(player->hudElementDataIndex);
1563 }
1564 if (battleStatus->jumpCharge > 0) {
1565 create_status_icon_boost_jump(player->hudElementDataIndex);
1566 remove_status_icon_boost_hammer(player->hudElementDataIndex);
1567 } else {
1568 remove_status_icon_boost_jump(player->hudElementDataIndex);
1569 }
1570 } else {
1571 enable_status_icon_boost_jump(player->hudElementDataIndex);
1572 enable_status_icon_boost_hammer(player->hudElementDataIndex);
1573 }
1574
1576 if (playerData->curHP <= PERIL_THRESHOLD) {
1577 create_status_icon_peril(player->hudElementDataIndex);
1578 remove_status_icon_danger(player->hudElementDataIndex);
1579 } else if (playerData->curHP <= DANGER_THRESHOLD) {
1580 remove_status_icon_peril(player->hudElementDataIndex);
1581 create_status_icon_danger(player->hudElementDataIndex);
1582 } else {
1583 remove_status_icon_peril(player->hudElementDataIndex);
1584 remove_status_icon_danger(player->hudElementDataIndex);
1585 }
1586 } else {
1587 remove_status_icon_peril(player->hudElementDataIndex);
1588 remove_status_icon_danger(player->hudElementDataIndex);
1589 }
1590
1591 if (player->transparentStatus == STATUS_KEY_TRANSPARENT) {
1592 playerParts->flags |= ACTOR_PART_FLAG_TRANSPARENT;
1593 } else {
1594 playerParts->flags &= ~ACTOR_PART_FLAG_TRANSPARENT;
1595 }
1596
1597 animChanged = FALSE;
1598 palChanged = FALSE;
1599 decorChanged = FALSE;
1600 cond4 = FALSE;
1601 lastAnim = playerParts->curAnimation;
1602
1605 && (partner != NULL))
1606 || (battleStatus->outtaSightActive > 0))
1607 && !(player->flags & ACTOR_FLAG_NO_INACTIVE_ANIM)
1608 && !((partner != NULL) && (partner->flags & ACTOR_FLAG_NO_ATTACK))
1609 ) {
1611 if ((player->debuff != STATUS_KEY_FEAR)
1612 && (player->debuff != STATUS_KEY_PARALYZE)
1613 && (player->debuff != STATUS_KEY_FROZEN)
1614 && (player->debuff != STATUS_KEY_STOP)
1615 ) {
1616 if ((player->transparentStatus != STATUS_KEY_TRANSPARENT) &&
1617 (player->stoneStatus != STATUS_KEY_STONE) &&
1618 ((battleStatus->outtaSightActive > 0) || (gBattleStatus.flags2 & BS_FLAGS2_PLAYER_TURN_USED)))
1619 {
1621 playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_INACTIVE_BERSERK);
1622 } else if (player->debuff == STATUS_KEY_SLEEP) {
1623 playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_INACTIVE_SLEEP);
1624 } else if (player->debuff == STATUS_KEY_DIZZY) {
1625 playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_INACTIVE_DIZZY);
1626 } else {
1627 playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_INACTIVE);
1628 }
1629 spr_update_player_sprite(PLAYER_SPRITE_MAIN, playerParts->curAnimation, playerParts->animationRate);
1630 animChanged = TRUE;
1631 }
1632 }
1633
1634 if (player->debuff != STATUS_KEY_POISON) {
1636 } else {
1638 }
1639 palChanged = TRUE;
1640
1642 decorChanged = TRUE;
1643 }
1644 }
1645
1646 if (player->stoneStatus == STATUS_KEY_STONE) {
1647 playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_STONE);
1648 spr_update_player_sprite(PLAYER_SPRITE_MAIN, playerParts->curAnimation, playerParts->animationRate);
1649 animChanged = TRUE;
1650
1651 if (!palChanged) {
1653 }
1655 palChanged = TRUE;
1656 enable_status_debuff(player->hudElementDataIndex);
1657 decorChanged = TRUE;
1658 enable_status_static(player->hudElementDataIndex);
1659 cond4 = TRUE;
1660
1661 enable_status_transparent(player->hudElementDataIndex);
1662 enable_status_chill_out(player->hudElementDataIndex);
1663 }
1664
1665 if ((player->flags & ACTOR_FLAG_USING_IDLE_ANIM) && !animChanged) {
1666 s32 temp = playerParts->curAnimation;
1668 playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_NORMAL);
1669 }
1670 }
1671
1673 if (!palChanged) {
1675 }
1676 palChanged = TRUE;
1677 }
1678 if (player->debuff == STATUS_KEY_POISON) {
1679 if (!palChanged) {
1681 }
1682 palChanged = TRUE;
1683 }
1684 if (player->debuff == STATUS_KEY_PARALYZE) {
1685 if (!palChanged) {
1687 }
1688 palChanged = TRUE;
1689 }
1690 if (player->staticStatus == STATUS_KEY_STATIC) {
1691 if (!palChanged) {
1693 }
1694 palChanged = TRUE;
1695 }
1696 if (battleStatus->turboChargeTurnsLeft != 0) {
1697 if (!decorChanged) {
1699 }
1700 decorChanged = TRUE;
1701 }
1703 if (!palChanged) {
1705 }
1706 palChanged = TRUE;
1707 }
1708 if (!palChanged) {
1710 }
1711 if (!decorChanged) {
1713 }
1714 if (player->flags & ACTOR_FLAG_USING_IDLE_ANIM) {
1715 if (battleStatus->hustleTurns != 0) {
1716 playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_HUSTLE);
1717 animChanged = TRUE;
1718 } else if (!animChanged) {
1721 playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_NORMAL);
1722 }
1723 }
1724
1725 if (player->debuff == STATUS_KEY_FROZEN) {
1726 if (!animChanged) {
1727 playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_FROZEN);
1728 animChanged = TRUE;
1729 }
1730 } else if (player->debuff != STATUS_KEY_SHRINK) {
1731 if (player->debuff == STATUS_KEY_POISON) {
1732 if (!animChanged) {
1733 playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_POISON);
1734 animChanged = TRUE;
1735 }
1736 } else if (player->debuff == STATUS_KEY_DIZZY) {
1737 if (!animChanged) {
1738 playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_DIZZY);
1739 animChanged = TRUE;
1740 }
1741 } else if (player->debuff == STATUS_KEY_SLEEP) {
1742 if (!animChanged) {
1743 playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_SLEEP);
1744 animChanged = TRUE;
1745 }
1746 } else if (player->debuff == STATUS_KEY_PARALYZE) {
1747 if (!animChanged) {
1748 playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_PARALYZE);
1749 animChanged = TRUE;
1750 }
1751 } else {
1753 if (!animChanged) {
1754 playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_BERSERK);
1755 animChanged = TRUE;
1756 }
1757 }
1758 }
1759 }
1761 if (!animChanged) {
1762 playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_STATIC);
1763 animChanged = TRUE;
1764 }
1765 player->staticStatus = STATUS_KEY_STATIC;
1766 player->staticDuration = 127;
1767 } else if ((player->staticStatus == STATUS_KEY_STATIC) && !animChanged) {
1768 playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_STATIC);
1769 animChanged = TRUE;
1770 }
1771 if ((player->transparentStatus == STATUS_KEY_TRANSPARENT) || (playerParts->flags & ACTOR_PART_FLAG_TRANSPARENT)) {
1772 if (!animChanged) {
1773 playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_TRANSPARENT);
1774 animChanged = TRUE;
1775 }
1776 create_status_transparent(player->hudElementDataIndex, STATUS_KEY_TRANSPARENT);
1777 }
1778 if (!animChanged) {
1779 playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_NORMAL);
1780 }
1781 }
1782
1784 if (!cond4) {
1785 if (player->debuff == STATUS_KEY_POISON) {
1786 create_status_debuff(player->hudElementDataIndex, STATUS_KEY_POISON);
1787 } else if (player->debuff == STATUS_KEY_SLEEP) {
1788 create_status_debuff(player->hudElementDataIndex, STATUS_KEY_SLEEP);
1789 } else if (player->debuff == STATUS_KEY_PARALYZE) {
1790 create_status_debuff(player->hudElementDataIndex, STATUS_KEY_PARALYZE);
1791 } else if (player->debuff == STATUS_KEY_DIZZY) {
1792 create_status_debuff(player->hudElementDataIndex, STATUS_KEY_DIZZY);
1793 } else if (player->debuff == STATUS_KEY_SHRINK) {
1794 create_status_debuff(player->hudElementDataIndex, STATUS_KEY_SHRINK);
1795 } else if (player->debuff == STATUS_KEY_FROZEN) {
1796 create_status_debuff(player->hudElementDataIndex, STATUS_KEY_FROZEN);
1797 }
1798 if (is_ability_active(ABILITY_ZAP_TAP) || (player->staticStatus == STATUS_KEY_STATIC)) {
1799 create_status_static(player->hudElementDataIndex, STATUS_KEY_STATIC);
1800 }
1801 }
1802 if ((player->transparentStatus == STATUS_KEY_TRANSPARENT) || (playerParts->flags & ACTOR_PART_FLAG_TRANSPARENT)) {
1803 create_status_transparent(player->hudElementDataIndex, STATUS_KEY_TRANSPARENT);
1804 }
1805 } else {
1806 enable_status_debuff(player->hudElementDataIndex);
1807 enable_status_static(player->hudElementDataIndex);
1808 enable_status_transparent(player->hudElementDataIndex);
1809 enable_status_chill_out(player->hudElementDataIndex);
1810 }
1811
1812 if (player->debuff != STATUS_KEY_STOP) {
1813 if (!animChanged) {
1814 s32 temp = playerParts->curAnimation;
1816 playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_NORMAL);
1817 }
1818 }
1819 } else {
1820 playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_STOP);
1821 create_status_debuff(player->hudElementDataIndex, STATUS_KEY_STOP);
1822 }
1823
1824end:
1825 set_status_icons_properties(player->hudElementDataIndex,
1826 playerPosX, playerPosY, playerPosZ,
1827 player->actorBlueprint->statusIconOffset.x * player->scalingFactor,
1828 player->actorBlueprint->statusIconOffset.y * player->scalingFactor,
1829 player->actorBlueprint->statusTextOffset.x * player->scalingFactor,
1830 player->actorBlueprint->statusTextOffset.y * player->scalingFactor);
1831 set_status_icons_offset(player->hudElementDataIndex,
1832 player->size.y * player->scalingFactor,
1833 player->size.x * player->scalingFactor);
1834
1835 playerPosX += playerParts->palAnimPosOffset[0];
1836 playerPosY += playerParts->palAnimPosOffset[1];
1837
1838 playerParts->curPos.x = playerPosX;
1839 playerParts->curPos.y = playerPosY;
1840 playerParts->curPos.z = playerPosZ;
1841 guTranslateF(mtxTranslate, playerPosX, playerPosY, playerPosZ);
1842
1843 guTranslateF(mtxPivotOn,
1844 -player->rotPivotOffset.x * player->scalingFactor,
1845 -player->rotPivotOffset.y * player->scalingFactor,
1846 -player->rotPivotOffset.z * player->scalingFactor);
1847 guTranslateF(mtxPivotOff,
1848 player->rotPivotOffset.x * player->scalingFactor,
1849 player->rotPivotOffset.y * player->scalingFactor,
1850 player->rotPivotOffset.z * player->scalingFactor);
1851
1852 guRotateF(mtxRotX, player->rot.x, 1.0f, 0.0f, 0.0f);
1853 guRotateF(mtxRotY, player->rot.y, 0.0f, 1.0f, 0.0f);
1854 guRotateF(mtxRotZ, player->rot.z, 0.0f, 0.0f, 1.0f);
1855 guMtxCatF(mtxRotY, mtxRotX, mtxTemp);
1856 guMtxCatF(mtxTemp, mtxRotZ, mtxRotation);
1857
1858 guScaleF(mtxScale,
1859 player->scale.x * SPRITE_WORLD_SCALE_D * player->scalingFactor,
1860 player->scale.y * SPRITE_WORLD_SCALE_D * player->scalingFactor * playerParts->verticalStretch,
1861 player->scale.z * SPRITE_WORLD_SCALE_D);
1862
1863 guMtxCatF(mtxScale, mtxPivotOn, mtxTemp);
1864 guMtxCatF(mtxTemp, mtxRotation, mtxTransform);
1865 guMtxCatF(mtxTransform, mtxPivotOff, mtxTemp);
1866 guMtxCatF(mtxTemp, mtxTranslate, mtxTransform);
1867
1868 if (lastAnim != playerParts->curAnimation) {
1869 spr_update_player_sprite(PLAYER_SPRITE_MAIN, playerParts->curAnimation, playerParts->animationRate);
1870 }
1871 update_part_glow(FALSE, playerParts, clamp_angle(playerYaw + 180.0f), FALSE);
1872 update_part_flash(FALSE, playerParts, clamp_angle(playerYaw + 180.0f), FALSE);
1873 render_with_adjusted_palettes(SPRITE_MODE_PLAYER, playerParts, clamp_angle(playerYaw + 180.0f), mtxTransform, 0);
1874 _add_part_decoration(playerParts);
1875}
void enable_status_icon_boost_hammer(s32 iconID)
void enable_status_icon_boost_jump(s32 iconID)
void create_status_icon_boost_jump(s32 iconID)
void create_status_icon_boost_hammer(s32 iconID)
s32 get_player_anim_for_status(s32 animID)
Definition 190B20.c:1965
void create_status_icon_peril(s32 iconID)
void create_status_icon_danger(s32 iconID)
@ ACTOR_PAL_ADJUST_PLAYER_POISON
Definition enums.h:2251
@ ACTOR_PAL_ADJUST_BERSERK
Definition enums.h:2247
@ BS_FLAGS2_PLAYER_TURN_USED
Definition enums.h:3605
@ BS_FLAGS2_NO_PLAYER_PAL_ADJUST
Definition enums.h:3617
@ BS_FLAGS2_OVERRIDE_INACTIVE_PLAYER
Definition enums.h:3607
@ BS_FLAGS2_HIDE_BUFF_COUNTERS
Definition enums.h:3616
@ STATUS_KEY_INACTIVE_SLEEP
Definition enums.h:2217
@ STATUS_KEY_INACTIVE_BERSERK
Definition enums.h:2215
@ STATUS_KEY_STONE
Definition enums.h:2208
@ STATUS_KEY_HUSTLE
Definition enums.h:2221
@ STATUS_KEY_BERSERK
Definition enums.h:2212
@ ABILITY_BERSERKER
Definition enums.h:457
@ ABILITY_ZAP_TAP
Definition enums.h:455
@ ACTOR_FLAG_NO_INACTIVE_ANIM
Definition enums.h:3345
@ ACTOR_FLAG_NO_ATTACK
Skip attack turn.
Definition enums.h:3339
s32 is_ability_active(s32 arg0)
Definition inventory.c:1725
s32 player_team_is_ability_active(Actor *actor, s32 ability)
Definition 190B20.c:2765
void remove_status_icon_boost_hammer(s32)
void remove_status_icon_boost_jump(s32)
void remove_status_icon_peril(s32)
void remove_status_icon_danger(s32)
#define PERIL_THRESHOLD
Definition battle.h:267

Referenced by btl_render_actors().

◆ appendGfx_player_actor_reflection()

void appendGfx_player_actor_reflection ( void * arg0)

Definition at line 1877 of file actor_rendering.c.

1877 {
1878 Matrix4f mtxRotX, mtxRotY, mtxRotZ, mtxRotation, mtxScale;
1879 Matrix4f mtxPivotOn, mtxPivotOff, mtxTranslate;
1880 Matrix4f mtxTemp, mtxTransform, mtxMirror;
1882 ActorPart* part = &player->partsTable[0];
1883 f32 playerYaw = player->yaw;
1884 f32 dx, dy, dz;
1885
1886 dx = player->curPos.x + player->headOffset.x;
1887 dx += part->palAnimPosOffset[0];
1888 dy = player->curPos.y + player->headOffset.y;
1889 dy += part->palAnimPosOffset[1];
1890 dz = player->curPos.z + player->headOffset.z - 5.0f;
1891 part->yaw = playerYaw;
1892
1893 guTranslateF(mtxTranslate, dx, dy, dz - 1.0f);
1894
1895 guTranslateF(mtxPivotOn,
1896 -player->rotPivotOffset.x * player->scalingFactor,
1897 -player->rotPivotOffset.y * player->scalingFactor,
1898 -player->rotPivotOffset.z * player->scalingFactor);
1899 guTranslateF(mtxPivotOff,
1900 player->rotPivotOffset.x * player->scalingFactor,
1901 player->rotPivotOffset.y * player->scalingFactor,
1902 player->rotPivotOffset.z * player->scalingFactor);
1903
1904 guRotateF(mtxRotX, player->rot.x, 1.0f, 0.0f, 0.0f);
1905 guRotateF(mtxRotY, player->rot.y, 0.0f, 1.0f, 0.0f);
1906 guRotateF(mtxRotZ, player->rot.z, 0.0f, 0.0f, 1.0f);
1907 guMtxCatF(mtxRotY, mtxRotX, mtxTemp);
1908 guMtxCatF(mtxTemp, mtxRotZ, mtxRotation);
1909 guScaleF(mtxScale,
1910 player->scale.x * SPRITE_WORLD_SCALE_D * player->scalingFactor,
1911 player->scale.y * SPRITE_WORLD_SCALE_D * player->scalingFactor * part->verticalStretch,
1912 player->scale.z * SPRITE_WORLD_SCALE_D);
1913 mtx_mirror_y(mtxMirror);
1914
1915 guMtxCatF(mtxScale, mtxPivotOn, mtxTemp);
1916 guMtxCatF(mtxTemp, mtxRotation, mtxTemp);
1917 guMtxCatF(mtxTemp, mtxPivotOff, mtxTemp);
1918 guMtxCatF(mtxTemp, mtxTranslate, mtxTransform);
1919 guMtxCatF(mtxTransform, mtxMirror, mtxTransform);
1920
1921 update_part_glow(FALSE, part, clamp_angle(playerYaw + 180.0f), TRUE);
1922 update_part_flash(FALSE, part, clamp_angle(playerYaw + 180.0f), TRUE);
1923 render_with_adjusted_palettes(SPRITE_MODE_PLAYER, part, clamp_angle(playerYaw + 180.0f), mtxTransform, TRUE);
1924}

Referenced by btl_render_actors().

◆ render_with_adjusted_palettes()

s32 render_with_adjusted_palettes ( b32 isNpcSprite,
ActorPart * part,
s32 yaw,
Matrix4f mtx,
b32 skipAnimation )

Definition at line 1926 of file actor_rendering.c.

1926 {
1927 s32 opacity;
1928 s32 sprDrawOpts;
1929
1931 opacity = 255;
1932 sprDrawOpts = 0;
1933 if (part->opacity < 255) {
1934 sprDrawOpts = DRAW_SPRITE_OVERRIDE_ALPHA;
1935 opacity = part->opacity;
1936 }
1937 if (part->flags & ACTOR_PART_FLAG_TRANSPARENT) {
1938 sprDrawOpts = DRAW_SPRITE_OVERRIDE_ALPHA;
1939 opacity = opacity * 120 / 255;
1940 }
1941 if (isNpcSprite == SPRITE_MODE_PLAYER) {
1942 if (opacity == 255) {
1943 spr_draw_player_sprite(PLAYER_SPRITE_MAIN, yaw, 0, NULL, mtx);
1944 } else {
1945 spr_draw_player_sprite(PLAYER_SPRITE_MAIN | sprDrawOpts, yaw, opacity, NULL, mtx);
1946 }
1947 } else {
1948 if (opacity == 255) {
1949 spr_draw_npc_sprite(part->spriteInstanceID, yaw, 0, NULL, mtx);
1950 } else {
1951 spr_draw_npc_sprite(part->spriteInstanceID | sprDrawOpts, yaw, opacity, NULL, mtx);
1952 }
1953 }
1954 return 0;
1955 }
1956
1957 switch (part->decorationTable->paletteAdjustment) {
1959 render_without_adjusted_palettes(isNpcSprite, part, yaw, mtx, skipAnimation);
1960 break;
1962 render_with_sleep_palettes(isNpcSprite, part, yaw, mtx, skipAnimation);
1963 break;
1965 render_with_static_palettes(isNpcSprite, part, yaw, mtx, skipAnimation);
1966 break;
1968 render_with_fear_palettes(isNpcSprite, part, yaw, mtx, skipAnimation);
1969 break;
1971 render_with_poison_palettes(isNpcSprite, part, yaw, mtx, skipAnimation);
1972 break;
1974 render_with_paralyze_palettes(isNpcSprite, part, yaw, mtx, skipAnimation);
1975 break;
1977 render_with_berserk_palettes(isNpcSprite, part, yaw, mtx, skipAnimation);
1978 break;
1980 render_with_watt_idle_palettes(isNpcSprite, part, yaw, mtx, skipAnimation);
1981 break;
1983 render_with_watt_attack_palettes(isNpcSprite, part, yaw, mtx, skipAnimation);
1984 break;
1986 render_with_player_debuff_palettes(isNpcSprite, part, yaw, mtx, skipAnimation, FALSE);
1987 break;
1989 render_with_player_debuff_palettes(isNpcSprite, part, yaw, mtx, skipAnimation, TRUE);
1990 break;
1992 render_with_pal_blending(isNpcSprite, part, yaw, FALSE, mtx, skipAnimation);
1993 break;
1995 render_with_pal_blending(isNpcSprite, part, yaw, TRUE, mtx, skipAnimation);
1996 break;
1998 render_with_palset_blending(isNpcSprite, part, yaw, mtx, skipAnimation);
1999 break;
2000 default:
2001 break;
2002 }
2003 return 0;
2004}
void render_with_watt_idle_palettes(b32 arg0, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation)
void render_with_player_debuff_palettes(b32 arg0, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation, s32 isPoison)
void render_with_fear_palettes(b32 arg0, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation)
void render_without_adjusted_palettes(b32 arg0, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation)
void render_with_watt_attack_palettes(b32 arg0, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation)
void render_with_sleep_palettes(b32 arg0, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation)
void render_with_berserk_palettes(b32 arg0, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation)
void render_with_pal_blending(b32 arg0, ActorPart *part, s32 yaw, s32 arg3, Matrix4f mtx, s32 skipAnimation)
void render_with_palset_blending(b32 arg0, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation)
void render_with_paralyze_palettes(b32 arg0, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation)
void render_with_static_palettes(b32 arg0, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation)
void render_with_poison_palettes(b32 arg0, ActorPart *part, s32 yaw, Matrix4f mtx, b32 skipAnimation)
@ ACTOR_PAL_ADJUST_BLEND_PALETTES_VARYING_INTERVALS
Definition enums.h:2253
@ ACTOR_PAL_ADJUST_BLEND_PALSETS
Definition enums.h:2254
@ ACTOR_PAL_ADJUST_WATT_ATTACK
Definition enums.h:2249
@ ACTOR_PAL_ADJUST_BLEND_PALETTES_UNIFORM_INTERVALS
Definition enums.h:2252
@ ACTOR_PAL_ADJUST_SLEEP
Definition enums.h:2242

Referenced by appendGfx_npc_actor(), appendGfx_npc_actor_reflection(), appendGfx_player_actor(), appendGfx_player_actor_blur(), and appendGfx_player_actor_reflection().

◆ part_glow_off()

void part_glow_off ( b32 isNpcSprite,
ActorPart * part,
s32 yaw,
b32 isReflection )

Definition at line 3348 of file actor_rendering.c.

3348 {
3349 if (part->decorationTable->glowStateChanged) {
3350 part->decorationTable->glowStateChanged = FALSE;
3351 if (isNpcSprite == SPRITE_MODE_PLAYER) {
3353 } else {
3354 set_npc_imgfx_all(part->spriteInstanceID, IMGFX_CLEAR, 0, 0, 0, 0, 0);
3355 }
3356 }
3357}
@ IMGFX_CLEAR
Definition enums.h:5117

Referenced by update_part_glow().

◆ part_flash_off()

void part_flash_off ( b32 isNpcSprite,
ActorPart * part,
s32 yaw,
b32 isReflection )

Definition at line 3428 of file actor_rendering.c.

3428 {
3429 DecorationTable* decorations = part->decorationTable;
3430
3431 if (decorations->flashStateChanged) {
3432 decorations->flashStateChanged = FALSE;
3433 }
3434 decorations->flashEnabled = FLASH_PAL_OFF;
3435}

Referenced by update_part_flash().

◆ _add_part_decoration()

void _add_part_decoration ( ActorPart * actorPart)

Definition at line 3533 of file actor_rendering.c.

3533 {
3534 DecorationTable* decorations;
3535 s32 i;
3536
3537 if (actorPart->flags & ACTOR_PART_FLAG_NO_DECORATIONS) {
3538 return;
3539 }
3540
3541 decorations = actorPart->decorationTable;
3542 for (i = 0; i < ARRAY_COUNT(decorations->type); i++) {
3543 switch (decorations->type[i]) {
3545 add_part_decor_none(actorPart, i);
3546 break;
3548 add_part_decor_golden_flames(actorPart, i);
3549 break;
3551 add_part_decor_sweat(actorPart, i);
3552 break;
3554 add_part_decor_seeing_stars(actorPart, i);
3555 break;
3557 add_part_decor_red_flames(actorPart, i);
3558 break;
3560 add_part_decor_smoky_trail(actorPart, i);
3561 break;
3563 add_part_decor_fiery_trail(actorPart, i);
3564 break;
3566 add_part_decor_whirlwind(actorPart, i);
3567 break;
3569 add_part_decor_steam(actorPart, i);
3570 break;
3572 add_part_decor_sparkles(actorPart, i);
3573 break;
3575 add_part_decor_bowser_aura(actorPart, i);
3576 break;
3578 add_part_decor_radiating_stars(actorPart, i);
3579 break;
3580 }
3581 }
3582}
void add_part_decor_steam(ActorPart *, s32)
void add_part_decor_sparkles(ActorPart *, s32)
void add_part_decor_fiery_trail(ActorPart *, s32)
void add_part_decor_golden_flames(ActorPart *, s32)
void add_part_decor_radiating_stars(ActorPart *, s32)
void add_part_decor_seeing_stars(ActorPart *, s32)
void add_part_decor_sweat(ActorPart *, s32)
void add_part_decor_smoky_trail(ActorPart *, s32)
void add_part_decor_bowser_aura(ActorPart *, s32)
void add_part_decor_whirlwind(ActorPart *, s32)
void add_part_decor_none(ActorPart *, s32)
void add_part_decor_red_flames(ActorPart *, s32)
@ ACTOR_DECORATION_NONE
Definition enums.h:2043
@ ACTOR_DECORATION_SEEING_STARS
Definition enums.h:2046
@ ACTOR_DECORATION_GREY_SMOKE_TRAIL
Definition enums.h:2048
@ ACTOR_DECORATION_RED_FLAMES
Definition enums.h:2047
@ ACTOR_DECORATION_WHIRLWIND
Definition enums.h:2050
@ ACTOR_DECORATION_RADIAL_STAR_EMITTER
Definition enums.h:2054
@ ACTOR_DECORATION_BOWSER_AURA
Definition enums.h:2053
@ ACTOR_DECORATION_SWEAT
Definition enums.h:2045
@ ACTOR_DECORATION_STEAM_EMITTER
Definition enums.h:2051
@ ACTOR_DECORATION_GOLDEN_FLAMES
Definition enums.h:2044
@ ACTOR_DECORATION_SPARKLES
Definition enums.h:2052
@ ACTOR_DECORATION_FIRE_SMOKE_TRAIL
Definition enums.h:2049

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

◆ _remove_part_decoration()

void _remove_part_decoration ( ActorPart * part,
s32 idx )

Definition at line 3584 of file actor_rendering.c.

3584 {
3585 DecorationTable* decorations = part->decorationTable;
3586
3587 switch (decorations->type[idx]) {
3589 remove_part_decor_none(part, idx);
3590 break;
3593 break;
3595 remove_part_decor_sweat(part, idx);
3596 break;
3599 break;
3602 break;
3605 break;
3608 break;
3610 remove_part_decor_whirlwind(part, idx);
3611 break;
3613 remove_part_decor_steam(part, idx);
3614 break;
3616 remove_part_decor_sparkles(part, idx);
3617 break;
3620 break;
3623 break;
3624 }
3625
3626 decorations->type[idx] = ACTOR_DECORATION_NONE;
3627}
void remove_part_decor_bowser_aura(ActorPart *part, s32 idx)
void remove_part_decor_sweat(ActorPart *part, s32 idx)
void remove_part_decor_none(ActorPart *part, s32 idx)
void remove_part_decor_steam(ActorPart *part, s32 idx)
void remove_part_decor_red_flames(ActorPart *part, s32 idx)
void remove_part_decor_seeing_stars(ActorPart *part, s32 idx)
void remove_part_decor_radiating_stars(ActorPart *part, s32 idx)
void remove_part_decor_sparkles(ActorPart *part, s32 idx)
void remove_part_decor_golden_flames(ActorPart *part, s32 idx)
void remove_part_decor_whirlwind(ActorPart *part, s32 idx)
void remove_part_decor_smoky_trail(ActorPart *part, s32 idx)
void remove_part_decor_fiery_trail(ActorPart *part, s32 idx)

Referenced by add_part_decoration(), and remove_part_decoration().

◆ remove_part_decor_none()

void remove_part_decor_none ( ActorPart * part,
s32 idx )

Definition at line 3632 of file actor_rendering.c.

3632 {
3633}

Referenced by _remove_part_decoration().

◆ remove_part_decor_golden_flames()

void remove_part_decor_golden_flames ( ActorPart * part,
s32 idx )

Definition at line 3665 of file actor_rendering.c.

3665 {
3666 part->decorationTable->effect[idx]->data.aura->fadeTime = 5;
3667}
s32 fadeTime
Definition effects.h:999

Referenced by _remove_part_decoration().

◆ remove_part_decor_sweat()

void remove_part_decor_sweat ( ActorPart * part,
s32 idx )

Definition at line 3692 of file actor_rendering.c.

3692 {
3693}

Referenced by _remove_part_decoration().

◆ remove_part_decor_seeing_stars()

void remove_part_decor_seeing_stars ( ActorPart * part,
s32 idx )

Definition at line 3714 of file actor_rendering.c.

3714 {
3716}
#define remove_effect

Referenced by _remove_part_decoration().

◆ remove_part_decor_red_flames()

void remove_part_decor_red_flames ( ActorPart * part,
s32 idx )

Definition at line 3754 of file actor_rendering.c.

3754 {
3755 part->decorationTable->effect[idx]->data.aura->fadeTime = 5;
3756}

Referenced by _remove_part_decoration().

◆ remove_part_decor_smoky_trail()

void remove_part_decor_smoky_trail ( ActorPart * part,
s32 idx )

Definition at line 3776 of file actor_rendering.c.

3776 {
3778}

Referenced by _remove_part_decoration().

◆ remove_part_decor_fiery_trail()

void remove_part_decor_fiery_trail ( ActorPart * part,
s32 idx )

Definition at line 3800 of file actor_rendering.c.

3800 {
3802}

Referenced by _remove_part_decoration().

◆ remove_part_decor_whirlwind()

void remove_part_decor_whirlwind ( ActorPart * part,
s32 idx )

Definition at line 3822 of file actor_rendering.c.

3822 {
3824}

Referenced by _remove_part_decoration().

◆ remove_part_decor_steam()

void remove_part_decor_steam ( ActorPart * part,
s32 idx )

Definition at line 3852 of file actor_rendering.c.

3852 {
3853}

Referenced by _remove_part_decoration().

◆ remove_part_decor_sparkles()

void remove_part_decor_sparkles ( ActorPart * part,
s32 idx )

Definition at line 3882 of file actor_rendering.c.

3882 {
3883}

Referenced by _remove_part_decoration().

◆ remove_part_decor_bowser_aura()

void remove_part_decor_bowser_aura ( ActorPart * part,
s32 idx )

Definition at line 3919 of file actor_rendering.c.

3919 {
3920 part->decorationTable->effect[idx]->data.aura->fadeTime = 5;
3921}

Referenced by _remove_part_decoration().

◆ remove_part_decor_radiating_stars()

void remove_part_decor_radiating_stars ( ActorPart * part,
s32 idx )

Definition at line 3947 of file actor_rendering.c.

3947 {
3949}

Referenced by _remove_part_decoration().

Variable Documentation

◆ StaticPalettesAnim

◆ FearPaletteAnimXOffsets

s16 FearPaletteAnimXOffsets[] = { -2, 2, 0, 0, -2, 2, 0, 0, 0, 0, -2, 2, 0, 0, 0, 0, 0, 0, 0xFF }

Definition at line 62 of file actor_rendering.c.

62{ -2, 2, 0, 0, -2, 2, 0, 0, 0, 0, -2, 2, 0, 0, 0, 0, 0, 0, PAL_ANIM_END };

Referenced by render_with_fear_palettes().

◆ ParalyzePaletteAnimXOffsets

s16 ParalyzePaletteAnimXOffsets[] = { -2, 2, 0, 0, -2, 2, 0, 0, 0, 0, -2, 2, 0, 0, 0, 0, 0, 0, 0xFF }

Definition at line 64 of file actor_rendering.c.

64{ -2, 2, 0, 0, -2, 2, 0, 0, 0, 0, -2, 2, 0, 0, 0, 0, 0, 0, PAL_ANIM_END };

Referenced by render_with_paralyze_palettes().

◆ bWattIdlePalettesAnim

u8 bWattIdlePalettesAnim[]
Initial value:

Definition at line 75 of file actor_rendering.c.

75 {
77 WATT_DEFAULT, 52,
79 WATT_DEFAULT, 54,
80 WATT_DEFAULT, 54,
82 WATT_DEFAULT, 28,
84 WATT_DEFAULT, 6,
86 WATT_DEFAULT, 44,
88 WATT_DEFAULT, 44,
90};

Referenced by render_with_watt_idle_palettes().

◆ WattAttackPalettesAnim

u8 WattAttackPalettesAnim[]
Initial value:

Definition at line 92 of file actor_rendering.c.

92 {
94 WATT_DEFAULT, 10,
96 WATT_DEFAULT, 14,
98 WATT_DEFAULT, 10,
100 WATT_DEFAULT, 4,
102};

Referenced by render_with_watt_attack_palettes().

◆ SparkleSpawnIntervals

s16 SparkleSpawnIntervals[] = { -1, 15, 10, 7, 5, 3, 2, 1 }

Definition at line 104 of file actor_rendering.c.

104{ -1, 15, 10, 7, 5, 3, 2, 1 };

Referenced by add_part_decor_sparkles().