mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-10-19 03:32:41 +00:00
Keep BETTERCAM/bubbled players within the minimum Y bounds of levels
Players/cameras were able to clip inside of island-like levels previously. I have hardcoded sane minimum Y values for the following courses: WF, CCM, PSS, BITDW, TTM, RR, BITS
This commit is contained in:
parent
4cb49d3946
commit
f88aee251e
4 changed files with 32 additions and 0 deletions
|
@ -456,3 +456,15 @@ void render_game(void) {
|
|||
D_8032CE74 = NULL;
|
||||
D_8032CE78 = 0;
|
||||
}
|
||||
|
||||
void get_area_minimum_y(u8* hasMinY, f32* minY) {
|
||||
switch (gCurrCourseNum) {
|
||||
case COURSE_WF: *hasMinY = TRUE; *minY = 8; break;
|
||||
case COURSE_CCM: *hasMinY = TRUE; *minY = (gCurrAreaIndex == 2) ? -5856 : -5068; break;
|
||||
case COURSE_PSS: *hasMinY = TRUE; *minY = -4600; break;
|
||||
case COURSE_BITDW: *hasMinY = TRUE; *minY = -3416; break;
|
||||
case COURSE_TTM: *hasMinY = (gCurrAreaIndex == 1) ? TRUE : FALSE; *minY = -6000; break;
|
||||
case COURSE_RR: *hasMinY = TRUE; *minY = -4790; break;
|
||||
case COURSE_BITS: *hasMinY = TRUE; *minY = -5065; break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,4 +163,6 @@ void play_transition(s16 transType, s16 time, u8 red, u8 green, u8 blue);
|
|||
void play_transition_after_delay(s16 transType, s16 time, u8 red, u8 green, u8 blue, s16 delay);
|
||||
void render_game(void);
|
||||
|
||||
void get_area_minimum_y(u8* hasMinY, f32* minY);
|
||||
|
||||
#endif // AREA_H
|
||||
|
|
|
@ -562,6 +562,14 @@ static void newcam_set_pan(void) {
|
|||
newcam_pan_z = newcam_pan_z*(min(newcam_distance/newcam_distance_target,1));
|
||||
}
|
||||
|
||||
static void newcam_level_bounds() {
|
||||
u8 hasMinY = FALSE;
|
||||
f32 minY = 0;
|
||||
get_area_minimum_y(&hasMinY, &minY);
|
||||
if (!hasMinY) { return; }
|
||||
newcam_pos[1] = MAX(newcam_pos[1], minY);
|
||||
}
|
||||
|
||||
static void newcam_position_cam(void) {
|
||||
f32 floorY = 0;
|
||||
f32 floorY2 = 0;
|
||||
|
@ -595,6 +603,7 @@ static void newcam_position_cam(void) {
|
|||
if (newcam_modeflags & NC_FLAG_FOCUSZ)
|
||||
newcam_lookat[2] = newcam_pos_target[2]-newcam_pan_z;
|
||||
|
||||
newcam_level_bounds();
|
||||
if (newcam_modeflags & NC_FLAG_COLLISION) {
|
||||
newcam_collision();
|
||||
newcam_bounding_box();
|
||||
|
|
|
@ -969,6 +969,15 @@ s32 act_bubbled(struct MarioState* m) {
|
|||
m->vel[i] = (oldVel[i] * 0.9f + m->vel[i] * 0.1f);
|
||||
}
|
||||
|
||||
// enforce minimum y for the level
|
||||
u8 hasMinY = FALSE;
|
||||
f32 minY = 0;
|
||||
get_area_minimum_y(&hasMinY, &minY);
|
||||
if (hasMinY && m->pos[1] < minY) {
|
||||
m->vel[1] = MAX(0, m->vel[1]);
|
||||
m->pos[1] += 25;
|
||||
}
|
||||
|
||||
// move player
|
||||
switch (perform_air_step(m, 0)) {
|
||||
case AIR_STEP_LANDED:
|
||||
|
|
Loading…
Reference in a new issue