mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-05-28 19:51:37 +00:00
Get behavior for KTQ worked out, need to do timer stuff now
This commit is contained in:
parent
53b120a7fc
commit
2c9ab25b0a
3 changed files with 22 additions and 25 deletions
|
|
@ -632,6 +632,7 @@
|
|||
#define /*0x0FC*/ oKoopaRaceEndpointRaceStatus OBJECT_FIELD_S32(0x1D)
|
||||
#define /*0x100*/ oKoopaRaceEndpointUnk100 OBJECT_FIELD_S32(0x1E)
|
||||
#define /*0x104*/ oKoopaRaceEndpointRaceEnded OBJECT_FIELD_S32(0x1F)
|
||||
#define /*0x108*/ oKoopaRaceEndpointRaceCheated OBJECT_FIELD_S32(0x20)
|
||||
|
||||
/* Koopa Shell Flame */
|
||||
#define /*0x0F4*/ oKoopaShellFlameUnkF4 OBJECT_FIELD_F32(0x1B)
|
||||
|
|
|
|||
|
|
@ -115,13 +115,14 @@ void bhv_koopa_init(void) {
|
|||
|
||||
if (o->oKoopaMovementType >= KOOPA_BP_KOOPA_THE_QUICK_BASE) {
|
||||
// koopa the quick
|
||||
if (cur_obj_nearest_object_with_behavior(bhvKoopaRaceEndpoint) != NULL) {
|
||||
o->parentObj = cur_obj_nearest_object_with_behavior(bhvKoopaRaceEndpoint);
|
||||
struct Object *koopaRaceEndpoint = cur_obj_nearest_object_with_behavior(bhvKoopaRaceEndpoint);
|
||||
if (koopaRaceEndpoint) {
|
||||
o->parentObj = koopaRaceEndpoint;
|
||||
} else {
|
||||
obj_mark_for_deletion(o);
|
||||
return;
|
||||
}
|
||||
struct SyncObject* so = sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
|
||||
struct SyncObject *so = sync_object_init(o, SYNC_DISTANCE_ONLY_EVENTS);
|
||||
if (so) {
|
||||
so->on_received_post = bhv_koopa_the_quick_on_received_post;
|
||||
so->on_sent_pre = bhv_koopa_the_quick_on_sent_pre;
|
||||
|
|
@ -200,7 +201,7 @@ static void koopa_shelled_act_stopped(void) {
|
|||
o->oForwardVel = 0.0f;
|
||||
if (cur_obj_init_anim_and_check_if_end(7)) {
|
||||
o->oAction = KOOPA_SHELLED_ACT_WALK;
|
||||
o->oKoopaTargetYaw = o->oMoveAngleYaw + 0x2000 * (s16) random_sign();
|
||||
o->oKoopaTargetYaw = o->oMoveAngleYaw + 0x2000 * (s16)random_sign();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -610,7 +611,7 @@ s32 obj_begin_race(s32 noTimer) {
|
|||
static void koopa_the_quick_act_wait_before_race(void) {
|
||||
koopa_shelled_act_stopped();
|
||||
|
||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||
struct MarioState *marioState = nearest_mario_state_to_object(o);
|
||||
|
||||
if (o->oKoopaTheQuickInitTextboxCooldown != 0) {
|
||||
o->oKoopaTheQuickInitTextboxCooldown -= 1;
|
||||
|
|
@ -632,15 +633,13 @@ u8 koopa_the_quick_act_show_init_text_continue_dialog(void) { return o->oAction
|
|||
* return to the waiting action.
|
||||
*/
|
||||
static void koopa_the_quick_act_show_init_text(void) {
|
||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||
struct MarioState *marioState = nearest_mario_state_to_object(o);
|
||||
s32 response = 0;
|
||||
if (marioState && should_start_or_continue_dialog(marioState, o) && BHV_ARR_CHECK(sKoopaTheQuickProperties, o->oKoopaTheQuickRaceIndex, struct KoopaTheQuickProperties)) {
|
||||
response = obj_update_race_proposition_dialog(&gMarioStates[0], *sKoopaTheQuickProperties[o->oKoopaTheQuickRaceIndex].initText, koopa_the_quick_act_show_init_text_continue_dialog);
|
||||
}
|
||||
|
||||
if (response == 1) {
|
||||
UNUSED s32 unused;
|
||||
|
||||
gMarioShotFromCannon = FALSE;
|
||||
o->oAction = KOOPA_THE_QUICK_ACT_RACE;
|
||||
o->oForwardVel = 0.0f;
|
||||
|
|
@ -677,7 +676,6 @@ static s32 koopa_the_quick_detect_bowling_ball(void) {
|
|||
|
||||
if (abs_angle_diff(o->oMoveAngleYaw, angleToBall) < 0x4000) {
|
||||
// The ball is in front of ktq
|
||||
|
||||
if (distToBall < 400.0f) {
|
||||
if (ballSpeedInKoopaRunDir < o->oForwardVel * 0.7f) {
|
||||
// The ball is moving slowly or toward him
|
||||
|
|
@ -739,10 +737,10 @@ static void koopa_the_quick_act_race(void) {
|
|||
case KOOPA_THE_QUICK_SUB_ACT_RUN:
|
||||
koopa_the_quick_animate_footsteps();
|
||||
|
||||
struct Object* player = nearest_player_to_object(o);
|
||||
struct Object *player = nearest_player_to_object(o);
|
||||
s32 distanceToPlayer = player ? dist_between_objects(o, player) : 10000;
|
||||
|
||||
if (o->parentObj && o->parentObj->oKoopaRaceEndpointRaceStatus != 0 && distanceToPlayer > 1500.0f
|
||||
if (o->parentObj && o->parentObj->oKoopaRaceEndpointRaceStatus != 0 && distanceToPlayer > 1500.0f
|
||||
&& (o->oPathedPrevWaypointFlags & WAYPOINT_MASK_00FF) < 28) {
|
||||
// Move faster if mario has already finished the race or
|
||||
// cheated by shooting from cannon
|
||||
|
|
@ -753,8 +751,7 @@ static void koopa_the_quick_act_race(void) {
|
|||
o->oKoopaAgility = gBehaviorValues.KoopaBobAgility;
|
||||
}
|
||||
|
||||
obj_forward_vel_approach(o->oKoopaAgility * 6.0f * downhillSteepness,
|
||||
o->oKoopaAgility * 0.1f);
|
||||
obj_forward_vel_approach(o->oKoopaAgility * 6.0f * downhillSteepness, o->oKoopaAgility * 0.1f);
|
||||
|
||||
// Move upward if we hit a wall, to climb it
|
||||
if (o->oMoveFlags & OBJ_MOVE_HIT_WALL) {
|
||||
|
|
@ -771,8 +768,7 @@ static void koopa_the_quick_act_race(void) {
|
|||
o->oForwardVel = 0.0f;
|
||||
}
|
||||
|
||||
if (bowlingBallStatus != 0
|
||||
|| (o->oPathedPrevWaypointFlags & WAYPOINT_MASK_00FF) >= 8) {
|
||||
if (bowlingBallStatus != 0 || (o->oPathedPrevWaypointFlags & WAYPOINT_MASK_00FF) >= 8) {
|
||||
o->oVelY = 80.0f;
|
||||
} else {
|
||||
o->oVelY = 40.0f;
|
||||
|
|
@ -843,19 +839,19 @@ u8 koopa_the_quick_act_after_race_continue_dialog(void) { return o->oAction == K
|
|||
static void koopa_the_quick_act_after_race(void) {
|
||||
cur_obj_init_animation_with_sound(7);
|
||||
|
||||
struct MarioState* marioState = nearest_mario_state_to_object(o);
|
||||
struct MarioState *marioState = &gMarioStates[0];
|
||||
if (!o->parentObj) { return; }
|
||||
|
||||
if (o->parentObj->oKoopaRaceEndpointUnk100 == 0) {
|
||||
if (marioState == &gMarioStates[0] && cur_obj_can_mario_activate_textbox_2(&gMarioStates[0], 400.0f, 400.0f)) {
|
||||
if (cur_obj_can_mario_activate_textbox_2(marioState, 400.0f, 400.0f)) {
|
||||
stop_background_music(SEQUENCE_ARGS(4, SEQ_LEVEL_SLIDE));
|
||||
|
||||
// Determine which text to display
|
||||
|
||||
if (o->parentObj->oKoopaRaceEndpointRaceStatus != 0) {
|
||||
if (o->parentObj->oKoopaRaceEndpointRaceStatus < 0) {
|
||||
if (o->parentObj->oKoopaRaceEndpointRaceCheated != 0) {
|
||||
// Mario cheated
|
||||
o->parentObj->oKoopaRaceEndpointRaceStatus = 0;
|
||||
//o->parentObj->oKoopaRaceEndpointRaceStatus = 0;
|
||||
o->parentObj->oKoopaRaceEndpointUnk100 = gBehaviorValues.dialogs.KoopaQuickCheatedDialog;
|
||||
} else {
|
||||
// Mario won
|
||||
|
|
@ -869,8 +865,8 @@ static void koopa_the_quick_act_after_race(void) {
|
|||
o->oFlags &= ~OBJ_FLAG_ACTIVE_FROM_AFAR;
|
||||
}
|
||||
} else if (o->parentObj->oKoopaRaceEndpointUnk100 > 0) {
|
||||
if (marioState && should_start_or_continue_dialog(marioState, o)) {
|
||||
s32 dialogResponse = cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, 1, CUTSCENE_DIALOG, o->parentObj->oKoopaRaceEndpointUnk100, koopa_the_quick_act_after_race_continue_dialog);
|
||||
if (should_start_or_continue_dialog(marioState, o)) {
|
||||
s32 dialogResponse = cur_obj_update_dialog_with_cutscene(marioState, 2, 1, CUTSCENE_DIALOG, o->parentObj->oKoopaRaceEndpointUnk100, koopa_the_quick_act_after_race_continue_dialog);
|
||||
if (dialogResponse != 0) {
|
||||
o->parentObj->oKoopaRaceEndpointUnk100 = DIALOG_NONE;
|
||||
o->oTimer = 0;
|
||||
|
|
@ -878,10 +874,10 @@ static void koopa_the_quick_act_after_race(void) {
|
|||
}
|
||||
} else if (o->parentObj->oKoopaRaceEndpointRaceStatus != 0) {
|
||||
if (o->oKoopaTheQuickRaceIndex == 0) {
|
||||
f32* starPos = gLevelValues.starPositions.KoopaBobStarPos;
|
||||
f32 *starPos = gLevelValues.starPositions.KoopaBobStarPos;
|
||||
spawn_default_star(starPos[0], starPos[1], starPos[2]);
|
||||
} else {
|
||||
f32* starPos = gLevelValues.starPositions.KoopaThiStarPos;
|
||||
f32 *starPos = gLevelValues.starPositions.KoopaThiStarPos;
|
||||
spawn_default_star(starPos[0], starPos[1], starPos[2]);
|
||||
}
|
||||
|
||||
|
|
@ -981,8 +977,9 @@ void bhv_koopa_race_endpoint_update(void) {
|
|||
if (!o->oKoopaRaceEndpointKoopaFinished) {
|
||||
play_race_fanfare();
|
||||
if (gMarioShotFromCannon) {
|
||||
o->oKoopaRaceEndpointRaceStatus = -1;
|
||||
o->oKoopaRaceEndpointRaceCheated = 1; // mario's a no good rotten cheater
|
||||
} else {
|
||||
o->oKoopaRaceEndpointRaceCheated = 0;
|
||||
o->oKoopaRaceEndpointRaceStatus = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ void bhv_ambient_light_update(void) {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
void bhv_point_light_init(void) {
|
||||
o->oLightID = le_add_light(
|
||||
// position
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue