Skip to content

Commit

Permalink
simplify walk animation selection
Browse files Browse the repository at this point in the history
  • Loading branch information
z64a committed Oct 8, 2024
1 parent 7dd2794 commit 5f6e105
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 42 deletions.
12 changes: 5 additions & 7 deletions src/world/action/idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,12 @@ void action_update_idle_peach(void) {
playerStatus->curSpeed = 0.0f;
playerStatus->flags &= ~PS_FLAG_AIRBORNE;

if (!(playerStatus->animFlags & PA_FLAG_INVISIBLE)) {
if (!(gGameStatusPtr->peachFlags & PEACH_FLAG_DEPRESSED)) {
suggest_player_anim_allow_backward(IdlePeachAnims[gGameStatusPtr->peachBakingIngredient]);
} else {
suggest_player_anim_allow_backward(ANIM_Peach2_SadStill);
}
} else {
if (playerStatus->animFlags & PA_FLAG_INVISIBLE) {
peach_set_disguise_anim(BasicPeachDisguiseAnims[gPlayerStatus.peachDisguise].idle);
} else if (gGameStatus.peachFlags & PEACH_FLAG_DEPRESSED) {
suggest_player_anim_allow_backward(ANIM_Peach2_SadStill);
} else {
suggest_player_anim_allow_backward(IdlePeachAnims[gGameStatus.peachBakingIngredient]);
}
}

Expand Down
6 changes: 2 additions & 4 deletions src/world/action/sneaky_parasol.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ typedef struct TransformationData {
/* 0x20 */ f32 playerYawOffset;
} TransformationData;

BSS TransformationData ParasolTransformation;

enum {
SUBSTATE_DISGUISE_INIT = 0,
SUBSTATE_USE_PARASOL = 1, // get parasol out and try copying an npc
Expand All @@ -36,10 +38,6 @@ enum {
SUBSTATE_BLOCKED = 50, // cant raise parasol due to collisions with world
};

BSS TransformationData ParasolTransformation;

TransformationData* D_802B6D80_E2B430 = &ParasolTransformation;

void parasol_update_spin(void);

Npc* parasol_get_npc(void) {
Expand Down
32 changes: 13 additions & 19 deletions src/world/action/step_up.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,23 @@ AnimID StepUpPeachAnims[] = {
[PEACH_BAKING_CAKE_WITH_BERRIES] ANIM_Peach1_CarryBerryCake,
};

void func_802B6198_E24768(void);
void action_update_step_up_set_peach_anim(void);

void action_update_step_up(void) {
PlayerStatus* playerStatus = &gPlayerStatus;
HitID colliderID;
f32 cosTheta;
f32 sinTheta;
s32 colliderID;
AnimID anim;

if (playerStatus->flags & PS_FLAG_ACTION_STATE_CHANGED) {
playerStatus->flags &= ~PS_FLAG_ACTION_STATE_CHANGED;
phys_adjust_cam_on_landing();
if (!(playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS)) {
if (!(playerStatus->animFlags & PA_FLAG_USING_WATT)) {
anim = ANIM_Mario1_Walk;
} else {
anim = ANIM_MarioW1_CarryWalk;
}
suggest_player_anim_allow_backward(anim);
if (playerStatus->animFlags & PA_FLAG_USING_PEACH_PHYSICS) {
action_update_step_up_set_peach_anim();
} else if (playerStatus->animFlags & PA_FLAG_USING_WATT) {
suggest_player_anim_allow_backward(ANIM_MarioW1_CarryWalk);
} else {
func_802B6198_E24768();
suggest_player_anim_allow_backward(ANIM_Mario1_Walk);
}
playerStatus->actionSubstate = 0;
playerStatus->timeInAir = 0;
Expand Down Expand Up @@ -76,15 +72,13 @@ void action_update_step_up(void) {
}
}

void func_802B6198_E24768(void) {
if (!(gPlayerStatus.animFlags & PA_FLAG_INVISIBLE)) {
if (!(gGameStatusPtr->peachFlags & PEACH_FLAG_DEPRESSED)) {
suggest_player_anim_allow_backward(StepUpPeachAnims[gGameStatusPtr->peachBakingIngredient]);
} else {
suggest_player_anim_allow_backward(ANIM_Peach3_WalkSad);
}
} else {
void action_update_step_up_set_peach_anim(void) {
if (gPlayerStatus.animFlags & PA_FLAG_INVISIBLE) {
peach_set_disguise_anim(BasicPeachDisguiseAnims[gPlayerStatus.peachDisguise].walk);
} else if (gGameStatus.peachFlags & PEACH_FLAG_DEPRESSED) {
suggest_player_anim_allow_backward(ANIM_Peach3_WalkSad);
} else {
suggest_player_anim_allow_backward(StepUpPeachAnims[gGameStatus.peachBakingIngredient]);
}
}

Expand Down
18 changes: 8 additions & 10 deletions src/world/action/walk.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,14 @@ void action_update_run(void) {
playerData->runningStepsTaken++;
}

void func_802B6550_E23C30(void) {
if (!(gPlayerStatus.animFlags & PA_FLAG_INVISIBLE)) {
if (!(gGameStatusPtr->peachFlags & PEACH_FLAG_DEPRESSED)) {
suggest_player_anim_allow_backward(WalkPeachAnims[gGameStatusPtr->peachBakingIngredient]);
return;
}
void action_update_walk_set_peach_anim(void) {
if (gPlayerStatus.animFlags & PA_FLAG_INVISIBLE) {
peach_set_disguise_anim(BasicPeachDisguiseAnims[gPlayerStatus.peachDisguise].walk);
} else if (gGameStatus.peachFlags & PEACH_FLAG_DEPRESSED) {
suggest_player_anim_allow_backward(ANIM_Peach3_WalkSad);
return;
} else {
suggest_player_anim_allow_backward(WalkPeachAnims[gGameStatus.peachBakingIngredient]);
}
peach_set_disguise_anim(BasicPeachDisguiseAnims[gPlayerStatus.peachDisguise].walk);
}

static void action_update_walk_peach(void) {
Expand All @@ -222,7 +220,7 @@ static void action_update_walk_peach(void) {
if (!(playerStatus->flags & PS_FLAG_CUTSCENE_MOVEMENT)) {
playerStatus->curSpeed = playerStatus->walkSpeed;
}
func_802B6550_E23C30();
action_update_walk_set_peach_anim();
}

if (playerStatus->flags & PS_FLAG_CUTSCENE_MOVEMENT) {
Expand All @@ -239,7 +237,7 @@ static void action_update_walk_peach(void) {
}

playerStatus->targetYaw = angle;
if (gGameStatusPtr->peachBakingIngredient == PEACH_BAKING_NONE) {
if (gGameStatus.peachBakingIngredient == PEACH_BAKING_NONE) {
if (sqrtf(SQ(playerStatus->stickAxis[0]) + SQ(playerStatus->stickAxis[1])) > 55.0f) {
set_action_state(ACTION_STATE_RUN);
return;
Expand Down
4 changes: 2 additions & 2 deletions ver/us/symbol_addrs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25111,7 +25111,7 @@ action_update_idle_peach = 0x802B61E4; // type:func rom:0xE23444
IdlePeachAnims = 0x802B6430; // rom:0xE23690
action_update_walk = 0x802B6000; // type:func rom:0xE236E0
action_update_run = 0x802B6288; // type:func rom:0xE23968
func_802B6550_E23C30 = 0x802B6550; // type:func rom:0xE23C30
action_update_walk_set_peach_anim = 0x802B6550; // type:func rom:0xE23C30
action_update_walk_peach = 0x802B65E8; // type:func rom:0xE23CC8
action_update_run_peach = 0x802B6738; // type:func rom:0xE23E18
WalkPeachAnims = 0x802B6910; // rom:0xE23FF0
Expand All @@ -25123,7 +25123,7 @@ action_update_step_down = 0x802B6348; // type:func rom:0xE24388
action_update_peach_falling = 0x802B647C; // type:func rom:0xE244BC
action_update_peach_step_down = 0x802B6508; // type:func rom:0xE24548
action_update_step_up = 0x802B6000; // type:func rom:0xE245D0
func_802B6198_E24768 = 0x802B6198; // type:func rom:0xE24768
action_update_step_up_set_peach_anim = 0x802B6198; // type:func rom:0xE24768
action_update_step_up_peach = 0x802B6230; // type:func rom:0xE24800
State18PeachAnims = 0x802B6300; // rom:0xE248D0
action_update_land = 0x802B6000; // type:func rom:0xE24920
Expand Down

0 comments on commit 5f6e105

Please sign in to comment.