some camera fixes

This commit is contained in:
Issac332 2026-07-19 15:26:27 +03:00
parent 3cc4835e31
commit 53c4a210ae
4 changed files with 10 additions and 10 deletions

View file

@ -282,7 +282,7 @@ class Game_Map
def scroll_down(distance)
return if @display_y_fix
@display_y = [@display_y + distance, (self.height - Graphics.height / 32 - 1) * 128].min
@display_y = [@display_y + distance, (self.height - Graphics.height / 32.0).round * 128].min
@display_y = @display_y.clamp((@display_clip_top * 128.0).to_i, (@display_clip_bottom * 128.0).to_i - Graphics.height * 4)
end
#--------------------------------------------------------------------------
@ -302,7 +302,7 @@ class Game_Map
def scroll_right(distance)
return if @display_x_fix
@display_x = [@display_x + distance, (self.width - (Graphics.width / 32)) * 128].min
@display_x = [@display_x + distance, (self.width - (Graphics.width / 32.0).round) * 128].min
@display_x = @display_x.clamp((@display_clip_left * 128.0).to_i, (@display_clip_right * 128.0).to_i - Graphics.width * 4)
end
#--------------------------------------------------------------------------

View file

@ -39,8 +39,8 @@ class Game_Player < Game_Character
# * Set Map Display Position to Center of Screen
#--------------------------------------------------------------------------
def center(x, y)
max_x = ($game_map.width - (Graphics.width / 32)) * 128
max_y = ($game_map.height - (Graphics.height / 32)) * 128
max_x = ($game_map.width - (Graphics.width / 32.0).round) * 128
max_y = ($game_map.height - (Graphics.height / 32.0).round) * 128
$game_map.display_x = [0, [x * 128 - @center_x, max_x].min].max
$game_map.display_y = [0, [y * 128 - @center_y, max_y].min].max
end

View file

@ -340,9 +340,9 @@ class Spriteset_Map
# no point in updating the sprite if offscreen
# this greatly increases performance on larger maps
elsif ((sprite.character.real_x + (sprite.ox*4) > $game_map.display_x - 128) &&
(sprite.character.real_x - (sprite.ox*4) < $game_map.display_x + ((Graphics.width / 32 + 1) * 128)) &&
(sprite.character.real_x - (sprite.ox*4) < $game_map.display_x + ((Graphics.width / 32.0).ceil * 128)) &&
(sprite.character.real_y + (sprite.oy*4) > ($game_map.display_y) - 128) &&
(sprite.character.real_y - (sprite.oy*4) < ($game_map.display_y) + (Graphics.height / 32 * 128)))
(sprite.character.real_y - (sprite.oy*4) < ($game_map.display_y) + (Graphics.height / 32.0).ceil * 128))
sprite.update
else
sprite.update_fast

View file

@ -331,8 +331,8 @@ struct TilemapPrivate {
mapViewportDirty(false),
zOrderDirty(false),
tilemapReady(false),
viewpW(shState->graphics().width() / 31 + 2),
viewpH(shState->graphics().height() / 31 + 2),
viewpW(shState->graphics().width() / 32 + 2),
viewpH(shState->graphics().height() / 32 + 2),
zlayersMax(viewpH + 5)
{
zlayerVert.resize(zlayersMax);
@ -372,8 +372,8 @@ struct TilemapPrivate {
}
int oldZLayersCount = zlayersMax;
viewpW = w / 31 + 2;
viewpH = h / 31 + 2;
viewpW = w / 32 + 2;
viewpH = h / 32 + 2;
zlayersMax = viewpH + 5;
zlayerVert.resize(zlayersMax);
zlayerBases.resize(zlayersMax + 1);