merged nightly's revert commit

This commit is contained in:
Reonu
2021-10-03 19:37:48 +03:00
parent 28c89246fd
commit e92abdb242
48 changed files with 179 additions and 142 deletions

View File

@@ -170,7 +170,9 @@ static s32 lower_cell_index(s32 coord) {
// Include extra cell if close to boundary
//! Some wall checks are larger than the buffer, meaning wall checks can
// miss walls that are near a cell border.
if ((coord % CELL_SIZE) < 50) index--;
if (coord % CELL_SIZE < 50) {
index -= 1;
}
if (index < 0) index = 0;
@@ -196,7 +198,9 @@ static s32 upper_cell_index(s32 coord) {
// Include extra cell if close to boundary
//! Some wall checks are larger than the buffer, meaning wall checks can
// miss walls that are near a cell border.
if ((coord % CELL_SIZE) > (CELL_SIZE - 50)) index++;
if (coord % CELL_SIZE > CELL_SIZE - 50) {
index += 1;
}
if (index > (NUM_CELLS - 1)) {
index = (NUM_CELLS - 1);
@@ -333,12 +337,12 @@ static void load_static_surfaces(TerrainData **data, TerrainData *vertexData, s3
s32 flags = surf_has_no_cam_collision(surfaceType);
numSurfaces = *(*data);
(*data)++;
*data += 1;
for (i = 0; i < numSurfaces; i++) {
if (*surfaceRooms != NULL) {
room = *(*surfaceRooms);
(*surfaceRooms)++;
*surfaceRooms += 1;
}
surface = read_surface_data(vertexData, data);
@@ -365,7 +369,7 @@ static void load_static_surfaces(TerrainData **data, TerrainData *vertexData, s3
#else
*data += 3;
if (hasForce) {
(*data)++;
*data += 1;
}
#endif
}

View File

@@ -76,7 +76,7 @@ void bhv_activated_back_and_forth_platform_update(void) {
// and one more frame of "lag" after it finally reaches 0 here,
// Mario actually has to wait 22 frames before the platform starts moving.
if (o->oActivatedBackAndForthPlatformCountdown != 0) {
o->oActivatedBackAndForthPlatformCountdown--;
o->oActivatedBackAndForthPlatformCountdown -= 1;
} else {
// After the wait period is over, we start moving, by adding the velocity
// to the positional offset.

View File

@@ -63,7 +63,7 @@ void bhv_animates_on_floor_switch_press_loop(void) {
}
if (o->oFloorSwitchPressAnimationDoubleFrame < 9) {
o->oFloorSwitchPressAnimationDoubleFrame++;
o->oFloorSwitchPressAnimationDoubleFrame += 1;
}
} else if ((o->oFloorSwitchPressAnimationDoubleFrame -= 2) < 0) {
o->oFloorSwitchPressAnimationDoubleFrame = 0;

View File

@@ -36,7 +36,7 @@ void bubba_act_0(void) {
} else if (o->oTimer > 30 && o->oDistanceToMario < 2000.0f) {
o->oAction = 1;
} else if (o->oBubbaRandomTimer != 0) {
o->oBubbaRandomTimer--;
o->oBubbaRandomTimer -= 1;
} else {
o->oBubbaTargetYaw = obj_random_fixed_turn(0x2000);
o->oBubbaRandomTimer = random_linear_offset(100, 100);

View File

@@ -150,7 +150,7 @@ static void chain_chomp_sub_act_turn(void) {
o->oChainChompTargetPitch = obj_get_pitch_from_vel();
}
} else {
o->oTimer--;
o->oTimer -= 1;
}
} else {
o->oForwardVel = 0.0f;
@@ -235,7 +235,7 @@ static void chain_chomp_released_lunge_around(void) {
if (o->oChainChompNumLunges == 0) {
if (cur_obj_rotate_yaw_toward(o->oAngleToMario, 0x320)) {
if (o->oTimer > 60) {
o->oChainChompNumLunges++;
o->oChainChompNumLunges += 1;
// enable wall collision
o->oWallHitboxRadius = 200.0f;
}

View File

@@ -24,7 +24,7 @@ void clam_act_0(void) {
cur_obj_play_sound_2(SOUND_GENERAL_CLAM_SHELL2);
o->oAction = 1;
} else if (o->oClamShakeTimer != 0) {
o->oClamShakeTimer--;
o->oClamShakeTimer -= 1;
cur_obj_shake_y(3.0f);
}
}

View File

@@ -49,7 +49,7 @@ void bhv_coffin_spawner_loop(void) {
}
}
o->oAction++;
o->oAction += 1;
}
} else if (o->activeFlags & ACTIVE_FLAG_IN_DIFFERENT_ROOM) {
o->oAction = COFFIN_SPAWNER_ACT_COFFINS_UNLOADED;

View File

@@ -9,7 +9,7 @@ void bhv_end_birds_1_loop(void) {
gCurrentObject->oIntroLakituEndBirds1DestX = -554.f;
gCurrentObject->oIntroLakituEndBirds1DestY = 3044.f;
gCurrentObject->oIntroLakituEndBirds1DestZ = -1314.f;
gCurrentObject->oAction = 1;
gCurrentObject->oAction += 1;
break;
case 1:
vec3f_set(pos, gCurrentObject->oIntroLakituEndBirds1DestX, gCurrentObject->oIntroLakituEndBirds1DestY,

View File

@@ -10,7 +10,7 @@ void bhv_end_birds_2_loop(void) {
switch (gCurrentObject->oAction) {
case 0:
cur_obj_scale(0.7f);
gCurrentObject->oAction = 1;
gCurrentObject->oAction += 1;
break;
case 1:
vec3f_get_dist_and_angle(gCamera->pos, gCamera->focus, &dist, &pitch, &yaw);

View File

@@ -77,7 +77,7 @@ static void enemy_lakitu_update_speed_and_angle(void) {
// Turn toward mario except right after throwing a spiny
if (o->oEnemyLakituFaceForwardCountdown != 0) {
o->oEnemyLakituFaceForwardCountdown--;
o->oEnemyLakituFaceForwardCountdown -= 1;
} else {
obj_face_yaw_approach(o->oAngleToMario, 0x600);
}
@@ -96,7 +96,7 @@ static void enemy_lakitu_sub_act_no_spiny(void) {
cur_obj_init_animation_with_sound(1);
if (o->oEnemyLakituSpinyCooldown != 0) {
o->oEnemyLakituSpinyCooldown--;
o->oEnemyLakituSpinyCooldown -= 1;
} else if (o->oEnemyLakituNumSpinies < 3 && o->oDistanceToMario < 800.0f
&& abs_angle_diff(o->oAngleToMario, o->oFaceAngleYaw) < 0x4000) {
struct Object *spiny = spawn_object(o, MODEL_SPINY_BALL, bhvSpiny);
@@ -105,7 +105,7 @@ static void enemy_lakitu_sub_act_no_spiny(void) {
spiny->oAction = SPINY_ACT_HELD_BY_LAKITU;
obj_init_animation_with_sound(spiny, spiny_egg_seg5_anims_050157E4, 0);
o->oEnemyLakituNumSpinies++;
o->oEnemyLakituNumSpinies += 1;
o->oSubAction = ENEMY_LAKITU_SUB_ACT_HOLD_SPINY;
o->oEnemyLakituSpinyCooldown = 30;
}
@@ -120,7 +120,7 @@ static void enemy_lakitu_sub_act_hold_spiny(void) {
cur_obj_init_anim_extend(3);
if (o->oEnemyLakituSpinyCooldown != 0) {
o->oEnemyLakituSpinyCooldown--;
o->oEnemyLakituSpinyCooldown -= 1;
}
// TODO: Check if anything interesting happens if we bypass this with speed
else if (o->oDistanceToMario > o->oDrawingDistance - 100.0f

View File

@@ -40,7 +40,7 @@ static void eyerok_boss_act_wake_up(void) {
if (o->oTimer > 5) {
if (o->oSubAction == 0) {
seq_player_lower_volume(SEQ_PLAYER_LEVEL, 60, 40);
o->oSubAction++;
o->oSubAction += 1;
}
if (o->oEyerokBossOffsetFromHome == 0.0f && mario_ready_to_speak() != 0) {
@@ -75,18 +75,18 @@ static void eyerok_boss_act_fight(void) {
o->oEyerokBossAttackCountdown = 1;
}
} else {
o->oEyerokBossAttackCountdown--;
o->oEyerokBossAttackCountdown -= 1;
}
if (o->oEyerokBossAttackCountdown != 0 && o->oEyerokBossAttackCountdown != 1) {
o->oEyerokBossAttackPhase++;
o->oEyerokBossAttackPhase += 1;
if ((o->oEyerokBossActiveHand = o->oEyerokBossAttackPhase & 0x1) == 0) {
o->oEyerokBossActiveHand = -1;
}
}
}
} else {
o->oEyerokBossAttackPhase++;
o->oEyerokBossAttackPhase += 1;
if (eyerok_check_mario_relative_z(400)) {
o->oEyerokBossAttackCountdown = -8;
@@ -116,7 +116,7 @@ static void eyerok_boss_act_die(void) {
if (cur_obj_update_dialog_with_cutscene(MARIO_DIALOG_LOOK_UP, DIALOG_FLAG_NONE, CUTSCENE_DIALOG, DIALOG_118)) {
spawn_default_star(0.0f, -900.0f, -3700.0f);
} else {
o->oTimer--;
o->oTimer -= 1;
}
} else if (o->oTimer > 120) {
stop_background_music(SEQUENCE_ARGS(4, SEQ_EVENT_BOSS));
@@ -152,7 +152,7 @@ static s32 eyerok_hand_check_attacked(void) {
o->oAction = EYEROK_HAND_ACT_ATTACKED;
o->oVelY = 30.0f;
} else {
o->parentObj->oEyerokBossNumHands--;
o->parentObj->oEyerokBossNumHands -= 1;
o->oAction = EYEROK_HAND_ACT_DIE;
o->oVelY = 50.0f;
}
@@ -179,7 +179,7 @@ static void eyerok_hand_act_sleep(void) {
if (o->parentObj->oAction != EYEROK_BOSS_ACT_SLEEP
&& ++o->oEyerokHandWakeUpTimer > -3 * o->oBehParams2ndByte) {
if (cur_obj_check_if_near_animation_end()) {
o->parentObj->oEyerokBossNumHands++;
o->parentObj->oEyerokBossNumHands += 1;
o->oAction = EYEROK_HAND_ACT_IDLE;
o->collisionData = segmented_to_virtual(&ssl_seg7_collision_07028274);
} else {
@@ -264,14 +264,14 @@ static void eyerok_hand_act_show_eye(void) {
if (!eyerok_hand_check_attacked()) {
if (o->parentObj->oEyerokBossActiveHand == 0) {
if (o->oAnimState < 3) {
o->oAnimState++;
o->oAnimState += 1;
} else if (cur_obj_check_if_near_animation_end()) {
o->oAction = EYEROK_HAND_ACT_CLOSE;
}
} else {
if (o->oEyerokHandEyeShownTimer--) {
if (o->oEyerokHandAnimStateIndex != 0) {
o->oEyerokHandAnimStateIndex--;
o->oEyerokHandAnimStateIndex -= 1;
}
o->oAnimState = sEyerokAnimStatesList[o->oEyerokHandAnimStateIndex];
} else {

View File

@@ -56,7 +56,7 @@ static void fire_piranha_plant_act_hide(void) {
0.04f * o->oFirePiranhaPlantNeutralScale)) {
cur_obj_become_intangible();
if (o->oFirePiranhaPlantActive) {
sNumActiveFirePiranhaPlants--;
sNumActiveFirePiranhaPlants -= 1;
o->oFirePiranhaPlantActive = FALSE;
if ((u16)(o->oBehParams >> 16) != 0 && o->oHealth == 0) {
@@ -72,7 +72,7 @@ static void fire_piranha_plant_act_hide(void) {
cur_obj_play_sound_2(SOUND_OBJ_PIRANHA_PLANT_APPEAR);
o->oFirePiranhaPlantActive = TRUE;
sNumActiveFirePiranhaPlants++;
sNumActiveFirePiranhaPlants += 1;
cur_obj_unhide();
o->oAction = FIRE_PIRANHA_PLANT_ACT_GROW;
@@ -127,7 +127,7 @@ void bhv_fire_piranha_plant_update(void) {
if (obj_check_attacks(&sFirePiranhaPlantHitbox, o->oAction)) {
if (--o->oHealth < 0) {
if (o->oFirePiranhaPlantActive) {
sNumActiveFirePiranhaPlants--;
sNumActiveFirePiranhaPlants -= 1;
}
} else {
cur_obj_init_animation_with_sound(2);

View File

@@ -45,7 +45,7 @@ static void fly_guy_act_idle(void) {
o->oAction = FLY_GUY_ACT_APPROACH_MARIO;
} else {
o->oFlyGuyUnusedJitter = o->oMoveAngleYaw + sFlyGuyJitterAmounts[o->oFlyGuyIdleTimer];
o->oFlyGuyIdleTimer++;
o->oFlyGuyIdleTimer += 1;
}
}
}
@@ -190,7 +190,7 @@ void bhv_fly_guy_update(void) {
}
// Oscillate up and down
o->oFlyGuyOscTimer++;
o->oFlyGuyOscTimer += 1;
o->oPosY += coss(0x400 * o->oFlyGuyOscTimer) * 1.5f;
switch (o->oAction) {

View File

@@ -270,7 +270,7 @@ void bhv_book_switch_loop(void) {
if (o->oAction != 0) {
if (o->parentObj->oBookSwitchManagerNumCorrectChoices == o->oBehParams2ndByte) {
play_sound(SOUND_GENERAL2_RIGHT_ANSWER, gGlobalSoundSource);
o->parentObj->oBookSwitchManagerNumCorrectChoices++;
o->parentObj->oBookSwitchManagerNumCorrectChoices += 1;
} else {
rand01 = random_u16() & 0x1;
z = gMarioObject->oPosZ + 1.5f * gMarioStates[0].vel[2];

View File

@@ -95,7 +95,7 @@ void bhv_goomba_triplet_spawner_update(void) {
}
}
o->oAction++;
o->oAction += 1;
}
} else if (o->oDistanceToMario > 4000.0f) {
// If mario is too far away, enter the unloaded action. The goombas
@@ -194,7 +194,7 @@ static void goomba_act_walk(void) {
o->oGoombaRelativeSpeed = 4.0f / 3.0f;
if (o->oGoombaWalkTimer != 0) {
o->oGoombaWalkTimer--;
o->oGoombaWalkTimer -= 1;
} else {
if (random_u16() & 3) {
o->oGoombaTargetYaw = obj_random_fixed_turn(0x2000);

View File

@@ -59,7 +59,7 @@ void haunted_chair_act_0(void) {
}
} else if (o->oHauntedChairSpinTimer != 0) {
if (o->oDistanceToMario < 500.0f) {
o->oHauntedChairSpinTimer--;
o->oHauntedChairSpinTimer -= 1;
}
o->oTimer = 0.0f;
} else {

View File

@@ -43,9 +43,9 @@ s32 intro_lakitu_set_pos_and_focus(struct Object *obj, struct CutsceneSplinePoin
s32 splineFinished = 0;
s16 splineSegment = obj->oIntroLakituSplineSegment;
if ((move_point_along_spline(newFocus, offset, &splineSegment, &(obj->oIntroLakituSplineSegmentProgress)) == 1)
|| (move_point_along_spline(newOffset, focus, &splineSegment, &(obj->oIntroLakituSplineSegmentProgress)) == 1))
splineFinished++;
if ((move_point_along_spline(newFocus, offset, &splineSegment, &(o->oIntroLakituSplineSegmentProgress)) == 1)
|| (move_point_along_spline(newOffset, focus, &splineSegment, &(o->oIntroLakituSplineSegmentProgress)) == 1))
splineFinished += 1;
obj->oIntroLakituSplineSegment = splineSegment;
intro_lakitu_set_offset_from_camera(obj, newOffset);
@@ -64,11 +64,10 @@ void bhv_intro_lakitu_loop(void) {
gCurrentObject->oIntroLakituSplineSegmentProgress = 0.f;
gCurrentObject->oIntroLakituCloud =
spawn_object_relative_with_scale(1, 0, 0, 0, 2.f, gCurrentObject, MODEL_MIST, bhvCloud);
if (gCamera->cutscene == CUTSCENE_END_WAVING) {
if (gCamera->cutscene == CUTSCENE_END_WAVING)
gCurrentObject->oAction = 100;
} else {
gCurrentObject->oAction = 1;
}
else
gCurrentObject->oAction += 1;
break;
case 1:
@@ -83,7 +82,7 @@ void bhv_intro_lakitu_loop(void) {
if (intro_lakitu_set_pos_and_focus(gCurrentObject, gIntroLakituStartToPipeOffsetFromCamera,
gIntroLakituStartToPipeFocus) == 1)
gCurrentObject->oAction = 2;
gCurrentObject->oAction += 1;
switch (gCurrentObject->oTimer) {
#if defined(VERSION_US) || defined(VERSION_SH)
@@ -120,7 +119,7 @@ void bhv_intro_lakitu_loop(void) {
#else
if (gCutsceneTimer > 720) {
#endif
gCurrentObject->oAction = 3;
gCurrentObject->oAction += 1;
gCurrentObject->oIntroLakituDistToBirdsX = 1400.f;
gCurrentObject->oIntroLakituDistToBirdsZ = -4096.f;
gCurrentObject->oIntroLakituEndBirds1DestZ = 2048.f;
@@ -182,7 +181,7 @@ void bhv_intro_lakitu_loop(void) {
gCurrentObject->oMoveAngleYaw = 0x9000;
gCurrentObject->oFaceAnglePitch = gCurrentObject->oMoveAnglePitch / 2;
gCurrentObject->oFaceAngleYaw = gCurrentObject->oMoveAngleYaw;
gCurrentObject->oAction++;
gCurrentObject->oAction += 1;
break;
case 101:
@@ -197,7 +196,7 @@ void bhv_intro_lakitu_loop(void) {
0x200);
}
if (gCurrentObject->oTimer > 105) {
gCurrentObject->oAction++;
gCurrentObject->oAction += 1;
gCurrentObject->oMoveAnglePitch = 0xE00;
}
gCurrentObject->oFaceAnglePitch = 0;

View File

@@ -20,7 +20,7 @@ void intro_peach_set_pos_and_opacity(struct Object *obj, f32 targetOpacity, f32
void bhv_intro_peach_loop(void) {
switch (gCurrentObject->oAction) {
case 0:
gCurrentObject->oAction = 1;
gCurrentObject->oAction += 1;
gCurrentObject->oFaceAnglePitch = 0x400;
gCurrentObject->oFaceAngleYaw = 0x7500;
gCurrentObject->oFaceAngleRoll = -0x3700;
@@ -34,13 +34,13 @@ void bhv_intro_peach_loop(void) {
intro_peach_set_pos_and_opacity(gCurrentObject, 0.f, 0.f);
if (gCurrentObject->oTimer > 20)
gCurrentObject->oAction = 2;
gCurrentObject->oAction += 1;
break;
case 2:
intro_peach_set_pos_and_opacity(gCurrentObject, 255.f, 3.f);
if ((gCurrentObject->oTimer > 100) && (get_dialog_id() == DIALOG_NONE))
gCurrentObject->oAction = 3;
gCurrentObject->oAction += 1;
break;
case 3:
intro_peach_set_pos_and_opacity(gCurrentObject, 0.f, 8.f);

View File

@@ -63,7 +63,7 @@ static void klepto_anim_dive(void) {
obj_move_pitch_approach(o->oKleptoPitchToTarget, 600);
if (klepto_set_and_check_if_anim_at_end() != 0) {
if (o->oKleptoDiveTimer != 0) {
o->oKleptoDiveTimer++;
o->oKleptoDiveTimer += 1;
} else if (o->oKleptoPitchToTarget > -100) {
o->oKleptoDiveTimer = random_linear_offset(60, 60);
}
@@ -234,7 +234,7 @@ static void klepto_act_dive_at_mario(void) {
o->oKleptoYawToTarget = o->oAngleToMario;
if (dy < 160.0f) {
o->oSubAction++;
o->oSubAction += 1;
}
}

View File

@@ -133,7 +133,7 @@ static void koopa_walk_start(void) {
obj_forward_vel_approach(3.0f * o->oKoopaAgility, 0.3f * o->oKoopaAgility);
if (cur_obj_init_anim_and_check_if_end(11)) {
o->oSubAction++;
o->oSubAction += 1;
o->oKoopaCountdown = random_linear_offset(30, 100);
}
}
@@ -146,9 +146,9 @@ static void koopa_walk(void) {
koopa_play_footstep_sound(2, 17);
if (o->oKoopaCountdown != 0) {
o->oKoopaCountdown--;
o->oKoopaCountdown -= 1;
} else if (cur_obj_check_if_near_animation_end()) {
o->oSubAction++;
o->oSubAction += 1;
}
}
@@ -244,7 +244,7 @@ static void koopa_shelled_act_lying(void) {
cur_obj_init_anim_extend(5);
koopa_dive_update_speed(0.3f);
} else if (o->oKoopaCountdown != 0) {
o->oKoopaCountdown--;
o->oKoopaCountdown -= 1;
cur_obj_extend_animation_if_at_end();
} else if (cur_obj_init_anim_and_check_if_end(6)) {
o->oAction = KOOPA_SHELLED_ACT_STOPPED;
@@ -350,7 +350,7 @@ static void koopa_unshelled_act_run(void) {
obj_bounce_off_walls_edges_objects(&o->oKoopaTargetYaw))) {
// Otherwise run around randomly
if (o->oKoopaUnshelledTimeUntilTurn != 0) {
o->oKoopaUnshelledTimeUntilTurn--;
o->oKoopaUnshelledTimeUntilTurn -= 1;
} else {
o->oKoopaTargetYaw = obj_random_fixed_turn(0x2000);
}
@@ -424,7 +424,7 @@ static void koopa_unshelled_act_dive(void) {
}
koopa_dive_update_speed(0.5f);
} else if (o->oKoopaCountdown != 0) {
o->oKoopaCountdown--;
o->oKoopaCountdown -= 1;
cur_obj_extend_animation_if_at_end();
} else if (cur_obj_init_anim_and_check_if_end(6)) {
o->oAction = KOOPA_UNSHELLED_ACT_RUN;
@@ -491,7 +491,7 @@ static void koopa_the_quick_act_wait_before_race(void) {
koopa_shelled_act_stopped();
if (o->oKoopaTheQuickInitTextboxCooldown != 0) {
o->oKoopaTheQuickInitTextboxCooldown--;
o->oKoopaTheQuickInitTextboxCooldown -= 1;
} else if (cur_obj_can_mario_activate_textbox_2(400.0f, 400.0f)) {
//! The next action doesn't execute until next frame, giving mario one
// frame where he can jump, and thus no longer be ready to speak.
@@ -650,10 +650,11 @@ static void koopa_the_quick_act_race(void) {
break;
case KOOPA_THE_QUICK_SUB_ACT_JUMP:
// We could perform a goomba double jump if we could deactivate ktq
// We could perform a goomba double jump if we could deactivate
// ktq
if (o->oMoveFlags & OBJ_MOVE_MASK_ON_GROUND) {
if (cur_obj_init_anim_and_check_if_end(13)) {
o->oSubAction--;
o->oSubAction -= 1;
}
koopa_the_quick_detect_bowling_ball();

Some files were not shown because too many files have changed in this diff Show More