diff --git a/src/game/behaviors/chuckya.inc.c b/src/game/behaviors/chuckya.inc.c index db48b0cc..b9eef282 100644 --- a/src/game/behaviors/chuckya.inc.c +++ b/src/game/behaviors/chuckya.inc.c @@ -1,4 +1,20 @@ // chuckya.inc.c + +// this was used in my port of backstage to new showfloor, uncomment the code below if the game doesn't compile +/*Gfx *geo_update_held_mario_pos(s32 run, UNUSED struct GraphNode *node, Mat4 mtx) { + if (run == TRUE) { + Mat4 sp20; + struct Object *obj = (struct Object *) gCurGraphNodeObject; + if (obj->prevObj != NULL) { + create_transformation_from_matrices(sp20, mtx, *gCurGraphNodeCamera->matrixPtr); + obj_update_pos_from_parent_transformation(sp20, obj->prevObj); + obj_set_gfx_pos_from_pos(obj->prevObj); + } + } + + return NULL; +}*/ + s32 update_angle_from_move_flags(s32 *angle) { if (o->oMoveFlags & OBJ_MOVE_HIT_WALL) { *angle = o->oWallAngle; diff --git a/src/game/behaviors/ukiki.inc.c b/src/game/behaviors/ukiki.inc.c index 9a77ff9d..62be6960 100644 --- a/src/game/behaviors/ukiki.inc.c +++ b/src/game/behaviors/ukiki.inc.c @@ -1,38 +1,8 @@ /** * @file Contains behavior for the ukiki objects. - * - * Cap ukiki is the ukiki that steals Mario's cap. - * Cage ukiki is the ukiki that triggers the cage star. */ -void ukiki_held_loop(void) { - o->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE; - cur_obj_init_animation(2); // broken - cur_obj_set_pos_relative(gMarioObject, 0, 60.0f, 100.0f); - cur_obj_become_intangible(); -} - - - -/** - * Unused copy of geo_update_projectile_pos_from_parent. Perhaps a copy paste mistake. - */ -Gfx *geo_update_projectile_pos_from_parent_copy(s32 run,UNUSED struct GraphNode *node, Mat4 mtx) { - if (run == TRUE) { - Mat4 mtx2; - struct Object *obj = (struct Object *) gCurGraphNodeObject; // TODO: change global type to Object pointer - - if (obj->prevObj != NULL) { - create_transformation_from_matrices(mtx2, mtx, *gCurGraphNodeCamera->matrixPtr); - obj_update_pos_from_parent_transformation(mtx2, obj->prevObj); - obj_set_gfx_pos_from_pos(obj->prevObj); - } - } - - return NULL; -} - /** * Chooses random idle taunts and loops them a random number of times. */ @@ -99,8 +69,6 @@ void idle_ukiki_taunt(void) { */ void ukiki_act_idle(void) { idle_ukiki_taunt(); - - if (o->oDistanceToMario > 700.0f && o->oDistanceToMario < 1000.0f) { o->oAction = UKIKI_ACT_RUN; } else if (o->oDistanceToMario <= 700.0f && o->oDistanceToMario > 200.0f) { @@ -108,7 +76,9 @@ void ukiki_act_idle(void) { o->oAction = UKIKI_ACT_TURN_TO_MARIO; } } - + else if (o->oDistanceToMario < 300.0f) { + o->oAction = UKIKI_ACT_RUN; + } // Jump away from Mario after stealing his cap. if (o->oUkikiTextState == UKIKI_TEXT_STOLE_CAP) { @@ -131,20 +101,14 @@ void ukiki_act_idle(void) { o->oUkikiTextState = UKIKI_TEXT_HAS_CAP; } - - if (o->oBhvParams2ndByte == UKIKI_BP_CAP) { - if (o->oPosY < -1550.0f) { - o->oAction = UKIKI_ACT_RETURN_HOME; - } - } } + /** * Ukiki attempts to run home, which is often impossible depending on terrain. * Only used for the cap ukiki. */ void ukiki_act_return_home(void) { - UNUSED u8 filler[4]; cur_obj_init_animation_with_sound(UKIKI_ANIM_RUN); o->oMoveAngleYaw = cur_obj_angle_to_home(); @@ -202,11 +166,9 @@ void ukiki_act_turn_to_mario(void) { o->oAction = UKIKI_ACT_IDLE; } - - if (o->oDistanceToMario > 500.0f) { - o->oAction = UKIKI_ACT_RUN; - -} +if (o->oDistanceToMario < 300.0f) { + o->oAction = UKIKI_ACT_RUN; + } } /** @@ -216,8 +178,6 @@ void ukiki_act_run(void) { s32 fleeMario = TRUE; s16 goalYaw = o->oAngleToMario + 0x8000; - - if (o->oTimer == 0) { o->oUkikiChaseFleeRange = random_float() * 100.0f + 350.0f; } @@ -277,33 +237,22 @@ void ukiki_act_jump(void) { } } -/** - * Waypoints that lead from the top of the mountain to the cage. - */ - - -/** - * Travel to the cage, wait for Mario, jump to it, and ride it to - * our death. Ukiki is a tad suicidal. - */ - - /** * A struct of Ukiki's sounds based on his current * SoundState number. */ struct SoundState sUkikiSoundStates[] = { - {1, 1, 10, SOUND_OBJ_UKIKI_STEP_DEFAULT}, + {0, 0, 0, NO_SOUND}, {0, 0, 0, NO_SOUND}, {0, 0, 0, NO_SOUND}, {0, 0, 0, NO_SOUND}, - {1, 0, -1, SOUND_OBJ_UKIKI_CHATTER_SHORT}, - {1, 0, -1, SOUND_OBJ_UKIKI_CHATTER_LONG}, + {0, 0, 0, NO_SOUND}, + {0, 0, 0, NO_SOUND}, {0, 0, 0, NO_SOUND}, {0, 0, 0, NO_SOUND}, - {1, 0, -1, SOUND_OBJ_UKIKI_CHATTER_LONG}, - {1, 0, -1, SOUND_OBJ_UKIKI_STEP_LEAVES}, - {1, 0, -1, SOUND_OBJ_UKIKI_CHATTER_IDLE}, + {0, 0, 0, NO_SOUND}, + {0, 0, 0, NO_SOUND}, + {0, 0, 0, NO_SOUND}, {0, 0, 0, NO_SOUND}, {0, 0, 0, NO_SOUND}, }; @@ -345,47 +294,42 @@ void ukiki_free_loop(void) { } } -/** - * Unused function for timing ukiki's blinking. - * Image still present in Ukiki's actor graphics. - * - * Possibly unused so AnimState could be used for wearing a cap? - */ -UNUSED static void ukiki_blink_timer(void) { - if (gGlobalTimer % 50 < 7) { - o->oAnimState = UKIKI_ANIM_STATE_EYE_CLOSED; - } else { - o->oAnimState = UKIKI_ANIM_STATE_DEFAULT; - } +void bhv_ukiki_held(void) { + o->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE; + cur_obj_set_pos_relative(gMarioObject, 0, 60.0f, 100.0f); + cur_obj_become_intangible(); } -/** +void bhv_ukiki_dropped(void) { + cur_obj_get_dropped(); + o->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE; + cur_obj_init_animation(0); + o->oHeldState = HELD_FREE; + cur_obj_become_tangible(); + o->oForwardVel = 3.0f; + o->oAction = UKIKI_ACT_IDLE; +} +/** * The main behavior function for ukiki. Chooses which behavior to use * dependent on the held state and whick ukiki it is (cage or cap). */ void bhv_ukiki_loop(void) { switch (o->oHeldState) { case HELD_FREE: - //! @bug (PARTIAL_UPDATE) - o->oUkikiTextboxTimer = 0; ukiki_free_loop(); break; case HELD_HELD: - cur_obj_unrender_set_action_and_anim(UKIKI_ANIM_HELD, 0); - obj_copy_pos(o, gMarioObject); - ukiki_held_loop(); - + bhv_ukiki_held(); + break; case HELD_THROWN: case HELD_DROPPED: - cur_obj_get_dropped(); + bhv_ukiki_dropped(); break; } - o->oAnimState = UKIKI_ANIM_STATE_DEFAULT; - o->oInteractStatus = 0; diff --git a/src/game/interaction.c b/src/game/interaction.c index f1bf262c..f75768c1 100644 --- a/src/game/interaction.c +++ b/src/game/interaction.c @@ -1172,7 +1172,6 @@ u32 check_object_grab_mario(struct MarioState *m, UNUSED u32 interactType, struc m->usedObj = o; update_mario_sound_and_camera(m); - play_sound(SOUND_MARIO_ATTACKED, m->marioObj->header.gfx.cameraToObject); return set_mario_action(m, ACT_GRABBED, 0); } } diff --git a/src/game/mario_actions_airborne.c b/src/game/mario_actions_airborne.c index b6ba9cb0..e9dde62c 100644 --- a/src/game/mario_actions_airborne.c +++ b/src/game/mario_actions_airborne.c @@ -957,9 +957,7 @@ s32 act_thrown_forward(struct MarioState *m) { } else { landAction = ACT_FORWARD_GROUND_KB; } - - play_sound_if_no_flag(m, SOUND_MARIO_WAAAOOOW, MARIO_MARIO_SOUND_PLAYED); - + if (common_air_knockback_step(m, landAction, ACT_HARD_FORWARD_GROUND_KB, 0x002D, m->forwardVel) == AIR_STEP_NONE) { pitch = atan2s(m->forwardVel, -m->vel[1]);