Skip to content

Commit

Permalink
Widescreen: Avoid clipping world Y position for FIELD mode world scri…
Browse files Browse the repository at this point in the history
…pt movements

Fix #474 chocobo issue and fship_22 world/background movement.
  • Loading branch information
tangtang95 authored and julianxhokaxhiu committed Sep 24, 2022
1 parent 3977d5c commit b0bec44
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/ff7/field/background.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,19 +500,13 @@ namespace ff7::field
float half_width = 160 + std::min(53, cameraRangeSize / 2 - 160);

point->x += widescreen.getHorizontalOffset();
if(widescreen.isResetVerticalPos()) point->y = 0;
point->y += widescreen.getVerticalOffset();

if (widescreen.getMode() == WM_EXTEND_ONLY) return;

if (point->x > camera_range.right - half_width)
point->x = camera_range.right - half_width;
if (point->x < camera_range.left + half_width)
point->x = camera_range.left + half_width;
if (point->y > camera_range.bottom - 120)
point->y = camera_range.bottom - 120;
if (point->y < camera_range.top + 120)
point->y = camera_range.top + 120;
}

void engine_set_game_engine_world_coord_float_661B23(int field_world_x, int field_world_y)
Expand Down Expand Up @@ -593,7 +587,7 @@ namespace ff7::field
world_pos = {*ff7_externals.field_curr_delta_world_pos_x, *ff7_externals.field_curr_delta_world_pos_y};

if(is_fieldmap_wide())
ff7_field_clip_with_camera_range(&world_pos);
field_widescreen_width_clip_with_camera_range(&world_pos);

*ff7_externals.scripted_world_initial_pos_x = world_pos.x;
*ff7_externals.scripted_world_initial_pos_y = world_pos.y;
Expand Down

0 comments on commit b0bec44

Please sign in to comment.