查看: 3160|回复: 2

[已经过期] 关于地图缩放和视角固定的问题

[复制链接]
梦石
0
星屑
3794
在线时间
842 小时
注册时间
2017-12-13
回帖
248
发表于 2021-1-10 18:54:33 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 alt236679 于 2021-1-10 18:54 编辑

我现在的做法以及其原因跟→这位朋友一模一样……不过我的脚本没有报错
四楼说的没错,这样的确会变卡。但是我发现只要不让地图滚动,其实也没那么卡,而且也不怎么用得上给角色行走的那么大的地图
但是在论坛找了视角固定的脚本,报错是不报错,但是都没有效果,直接去Game_Player改第303行也没用……

watashi用到的脚本:
RGSS3 地图缩放 Ver1.02 by 星潟
  1. #==============================================================================
  2. # ■ RGSS3 地图缩放 Ver1.02 by 星潟
  3. #------------------------------------------------------------------------------
  4. # 和标题一样,可以缩放地图。
  5. # 注意,地图缩放状态会存储于存档数据文件中。
  6. #==============================================================================
  7. # 使用脚本:
  8. #------------------------------------------------------------------------------
  9. # map_zoom(150)
  10. #
  11. # 地图大小变为150%。
  12. #------------------------------------------------------------------------------
  13. # map_zoom(300)
  14. #
  15. # 地图大小变为300%。
  16. #------------------------------------------------------------------------------
  17. # map_zoom
  18. #
  19. # 地图大小重置。
  20. #==============================================================================
  21. # 缩放不能小于100%,也不能大于2000%。
  22. # 因此、100为最小值、2000为最大值。
  23. #==============================================================================
  24. module ZoomFrequency
  25.   
  26.   #设定缩放图片更新频率。
  27.   #设定多少帧更新一次图像。
  28.   #数值越大,更新速度越慢。
  29.   #1代表每帧都更新、为最大响应速度。
  30.   
  31.   Number = 3
  32.   
  33. end
  34. class Game_System
  35.   attr_accessor :zoom_mode
  36.   #--------------------------------------------------------------------------
  37.   # ズームモード
  38.   #--------------------------------------------------------------------------
  39.   def zoom_mode
  40.     @zoom_mode ||= 100
  41.   end
  42. end
  43. class Spriteset_Map
  44.   #--------------------------------------------------------------------------
  45.   # ビューポートの作成
  46.   #--------------------------------------------------------------------------
  47.   alias create_viewports_zoommap create_viewports
  48.   def create_viewports
  49.     create_viewports_zoommap
  50.     @zoommap = ZoomMap.new(@viewport1,@viewport2)
  51.   end
  52.   #--------------------------------------------------------------------------
  53.   # 更新処理
  54.   #--------------------------------------------------------------------------
  55.   alias update_zoommap update
  56.   def update
  57.     update_zoommap
  58.     @zoommap.update
  59.   end
  60.   #--------------------------------------------------------------------------
  61.   # 解放処理
  62.   #--------------------------------------------------------------------------
  63.   alias dispose_zoommap dispose
  64.   def dispose
  65.     @zoommap.dispose
  66.     dispose_zoommap
  67.   end
  68. end
  69. class ZoomMap < Sprite_Base
  70.   #--------------------------------------------------------------------------
  71.   # 初期化
  72.   #--------------------------------------------------------------------------
  73.   def initialize(v1,v2)
  74.     super(v2)
  75.     @viewport_data = v1
  76.     @zoom_rate = $game_system.zoom_mode
  77.     @frequency = ZoomFrequency::Number - 1
  78.   end
  79.   #--------------------------------------------------------------------------
  80.   # 解放
  81.   #--------------------------------------------------------------------------
  82.   def dispose
  83.     self.bitmap.dispose if self.bitmap && !self.bitmap.disposed?
  84.     super
  85.   end
  86.   #--------------------------------------------------------------------------
  87.   # 更新処理
  88.   #--------------------------------------------------------------------------
  89.   def update
  90.     self.visible = @zoom_rate != 100
  91.     @frequency += 1
  92.     flag1 = @frequency >= ZoomFrequency::Number
  93.     @frequency = 0 if flag1
  94.     flag2 = flag1 && self.bitmap && !self.bitmap.disposed?
  95.     if flag2
  96.       self.bitmap.dispose
  97.       self.bitmap = nil
  98.     end
  99.     if $game_system.zoom_mode != 100 or @zoom_rate != 100
  100.       if @zoom_rate != $game_system.zoom_mode
  101.         d = (@zoom_rate - $game_system.zoom_mode).abs.to_i
  102.         case d
  103.         when 0..9;i = 2
  104.         when 10..99;i = 4
  105.         when 100..199;i = 8
  106.         when 200..399;i = 16
  107.         when 400..799;i = 32
  108.         else; i = 64
  109.         end
  110.         flag3 = @zoom_rate < $game_system.zoom_mode
  111.         @zoom_rate += (@zoom_rate < $game_system.zoom_mode) ? i : -i
  112.         @zoom_rate = $game_system.zoom_mode if (flag3 ? @zoom_rate > $game_system.zoom_mode : @zoom_rate < $game_system.zoom_mode)
  113.       end
  114.       zm = @zoom_rate.to_f / 100
  115.       @viewport_data.z += 10000000
  116.       self.bitmap = Graphics.snap_to_bitmap if flag2 or !self.bitmap
  117.       w = self.bitmap.width
  118.       h = self.bitmap.height
  119.       wd1 = ((w * zm / 2) - w / 2) / zm + (($game_player.screen_x - w / 2).to_f)
  120.       wd2 = (w * zm - w) / zm
  121.       hd1 = ((h * zm / 2) - h / 2) / zm + (($game_player.screen_y - 16 - h / 2).to_f)
  122.       hd2 = (h * zm - h) / zm
  123.       wd1 = 0 if wd1 < 0
  124.       wd1 = wd2 if wd1 > wd2
  125.       hd1 = 0 if hd1 < 0
  126.       hd1 = hd2 if hd1 > hd2
  127.       self.ox = wd1
  128.       self.oy = hd1
  129.       self.zoom_x = zm
  130.       self.zoom_y = zm
  131.       self.visible = true
  132.       @viewport_data.z -= 10000000
  133.     end
  134.     super
  135.   end
  136. end
  137. class Game_Interpreter
  138.   #--------------------------------------------------------------------------
  139.   # ズーム
  140.   #--------------------------------------------------------------------------
  141.   def map_zoom(rate = 100)
  142.     $game_system.zoom_mode = rate
  143.     $game_system.zoom_mode = 100 if rate < 100
  144.     $game_system.zoom_mode = 2000 if rate > 2000
  145.   end
  146. end
复制代码


スクロール禁止 ver1.0 by USK

  1. #==============================================================================
  2. # ★スクロール禁止 ver1.0 by USK
  3. #------------------------------------------------------------------------------
  4. # ・特定のスイッチがオンのときスクロールを禁止します。
  5. #==============================================================================
  6. =begin
  7. ・21行目のFixDisplayFlagVで設定した番号のスイッチがオンのとき
  8.   縦スクロールが禁止されます。
  9. ・22行目のFixDisplayFlagHで設定した番号のスイッチがオンのとき
  10.   横スクロールが禁止されます。
  11. =end

  12. #==============================================================================
  13. # ■ Game_Map
  14. #==============================================================================

  15. class Game_Map
  16.   #--------------------------------------------------------------------------
  17.   # ● 設定
  18.   #--------------------------------------------------------------------------
  19.   FixDisplayFlag = 4
  20.   #--------------------------------------------------------------------------
  21.   # ●
  22.   #--------------------------------------------------------------------------
  23.   alias :fix_display_scroll_down  :scroll_down
  24.   alias :fix_display_scroll_left  :scroll_left
  25.   alias :fix_display_scroll_right :scroll_right
  26.   alias :fix_display_scroll_up    :scroll_up
  27.   alias :fix_display_refresh      :refresh
  28.   alias :fix_display_valid?       :valid?
  29.   #--------------------------------------------------------------------------
  30.   # ●
  31.   #--------------------------------------------------------------------------
  32.   def fix_display?
  33.     $game_switches[FixDisplayFlag] #|| $game_switches[FixDisplayFlag]
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ●
  37.   #--------------------------------------------------------------------------
  38.   def need_centering?
  39.     ret = !fix_display? &&
  40.           SceneManager.scene.is_a?(Scene_Map) &&
  41.           @on_fix_display
  42.     @on_fix_display = fix_display?
  43.     ret
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ●
  47.   #--------------------------------------------------------------------------
  48.   def centering
  49.     div = 20
  50.     x = @display_x
  51.     dx = $game_player.x - (Graphics.width / 32 - 1) / 2.0 - x
  52.     dx /= div
  53.     y = @display_y
  54.     dy = $game_player.y - (Graphics.height / 32 - 1) / 2.0 - y
  55.     dy /= div
  56.     div.times do
  57.       set_display_pos(x, y)
  58.       x += dx
  59.       y += dy
  60.       scene = SceneManager.scene
  61.       scene.update_basic
  62.       scene.instance_variable_get(:@spriteset).update
  63.     end
  64.   end
  65.   #--------------------------------------------------------------------------
  66.   # ● リフレッシュ
  67.   #--------------------------------------------------------------------------
  68.   def refresh
  69.     centering if need_centering?
  70.     fix_display_refresh
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # ● 下にスクロール
  74.   #--------------------------------------------------------------------------
  75.   def scroll_down(distance)
  76.     fix_display_scroll_down(distance) unless $game_switches[FixDisplayFlag]
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   # ● 左にスクロール
  80.   #--------------------------------------------------------------------------
  81.   def scroll_left(distance)
  82.     fix_display_scroll_left(distance) unless $game_switches[FixDisplayFlag]
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # ● 右にスクロール
  86.   #--------------------------------------------------------------------------
  87.   def scroll_right(distance)
  88.     fix_display_scroll_right(distance) unless $game_switches[FixDisplayFlag]
  89.   end
  90.   #--------------------------------------------------------------------------
  91.   # ● 上にスクロール
  92.   #--------------------------------------------------------------------------
  93.   def scroll_up(distance)
  94.     fix_display_scroll_up(distance) unless $game_switches[FixDisplayFlag]
  95.   end
  96.   #--------------------------------------------------------------------------
  97.   # ● 有効座標判定
  98.   #--------------------------------------------------------------------------
  99.   def valid?(x, y)
  100.     ret = fix_display_valid?(x, y)
  101.     if $game_switches[FixDisplayFlag]
  102.       ret &&= y >= @display_y && y < @display_y + (Graphics.height >> 5)
  103.     end
  104.     if $game_switches[FixDisplayFlag]
  105.       ret &&= x >= @display_x && x < @display_x + (Graphics.width >> 5)
  106.     end
  107.     ret
  108.   end
  109. end
复制代码


  1. # 在这里设置 ,现在是默认,打开1号开关的时候,屏幕不滚动。
  2. module KRST
  3. SWI_1 = 4 #这个开关打开时,采用默认的滚屏方式
  4. SWI_2 = 4 #这个开关打开时,不滚屏
  5. end

  6. #==============================================================================
  7. # ■ 弹性滚动地图 V 1.00 BY SLICK
  8. #------------------------------------------------------------------------------
  9. #  处理主角的类。事件启动的判定、以及地图的滚动等功能。
  10. # 本类的实例请参考 $game_player。
  11. #==============================================================================

  12. class Game_Player < Game_Character
  13.   #--------------------------------------------------------------------------
  14.   # ● 更新画面
  15.   #--------------------------------------------------------------------------
  16.   def update
  17.     last_real_x = @real_x
  18.     last_real_y = @real_y
  19.     last_moving = moving?
  20.     move_by_input
  21.     super
  22.     if $game_switches[KRST::SWI_1]
  23.       update_scroll(last_real_x, last_real_y)  unless  $game_switches[KRST::SWI_2]
  24.     else
  25.       update_scroll2(last_real_x, last_real_y)
  26.     end
  27.     update_vehicle
  28.     update_nonmoving(last_moving) unless moving?
  29.     @followers.update
  30.   end
  31.   #--------------------------------------------------------------------------
  32.   # ● 更新卷动(弹性
  33.   #--------------------------------------------------------------------------
  34.   def update_scroll2(last_real_x, last_real_y)
  35.     ax1 = $game_map.adjust_x(last_real_x)
  36.     ay1 = $game_map.adjust_y(last_real_y)
  37.     ax2 = $game_map.adjust_x(@real_x)
  38.     ay2 = $game_map.adjust_y(@real_y)
  39.     basicspd = 2 ** real_move_speed / 1024.0
  40.     slowmove = basicspd * 2
  41.     fastmove = basicspd * 3
  42.     if ax2 < center_x - 1
  43.       if ax2 < center_x - 3
  44.         $game_map.scroll_left(fastmove)
  45.       else
  46.         $game_map.scroll_left(slowmove)
  47.       end
  48.     elsif ax2 > center_x + 1
  49.       if ax2 > center_x + 3
  50.         $game_map.scroll_right(fastmove)
  51.       else
  52.         $game_map.scroll_right(slowmove)
  53.       end
  54.     end
  55.     if ay2 < center_y - 1
  56.       if ay2 < center_y - 3
  57.         $game_map.scroll_up(fastmove)
  58.       else
  59.         $game_map.scroll_up(slowmove)
  60.       end
  61.     elsif ay2 > center_y + 1
  62.       if ay2 > center_y + 3
  63.         $game_map.scroll_down(fastmove)
  64.       else
  65.         $game_map.scroll_down(slowmove)
  66.       end
  67.     end
  68.   end  
  69. end
复制代码


另一个视角固定→弹性滚动地图 V 1.00 BY SLICK
  1. # 在这里设置 ,现在是默认,打开1号开关的时候,屏幕不滚动。
  2. module KRST
  3. SWI_1 = 4 #这个开关打开时,采用默认的滚屏方式
  4. SWI_2 = 4 #这个开关打开时,不滚屏
  5. end

  6. #==============================================================================
  7. # ■ 弹性滚动地图 V 1.00 BY SLICK
  8. #------------------------------------------------------------------------------
  9. #  处理主角的类。事件启动的判定、以及地图的滚动等功能。
  10. # 本类的实例请参考 $game_player。
  11. #==============================================================================

  12. class Game_Player < Game_Character
  13.   #--------------------------------------------------------------------------
  14.   # ● 更新画面
  15.   #--------------------------------------------------------------------------
  16.   def update
  17.     last_real_x = @real_x
  18.     last_real_y = @real_y
  19.     last_moving = moving?
  20.     move_by_input
  21.     super
  22.     if $game_switches[KRST::SWI_1]
  23.       update_scroll(last_real_x, last_real_y)  unless  $game_switches[KRST::SWI_2]
  24.     else
  25.       update_scroll2(last_real_x, last_real_y)
  26.     end
  27.     update_vehicle
  28.     update_nonmoving(last_moving) unless moving?
  29.     @followers.update
  30.   end
  31.   #--------------------------------------------------------------------------
  32.   # ● 更新卷动(弹性
  33.   #--------------------------------------------------------------------------
  34.   def update_scroll2(last_real_x, last_real_y)
  35.     ax1 = $game_map.adjust_x(last_real_x)
  36.     ay1 = $game_map.adjust_y(last_real_y)
  37.     ax2 = $game_map.adjust_x(@real_x)
  38.     ay2 = $game_map.adjust_y(@real_y)
  39.     basicspd = 2 ** real_move_speed / 1024.0
  40.     slowmove = basicspd * 2
  41.     fastmove = basicspd * 3
  42.     if ax2 < center_x - 1
  43.       if ax2 < center_x - 3
  44.         $game_map.scroll_left(fastmove)
  45.       else
  46.         $game_map.scroll_left(slowmove)
  47.       end
  48.     elsif ax2 > center_x + 1
  49.       if ax2 > center_x + 3
  50.         $game_map.scroll_right(fastmove)
  51.       else
  52.         $game_map.scroll_right(slowmove)
  53.       end
  54.     end
  55.     if ay2 < center_y - 1
  56.       if ay2 < center_y - 3
  57.         $game_map.scroll_up(fastmove)
  58.       else
  59.         $game_map.scroll_up(slowmove)
  60.       end
  61.     elsif ay2 > center_y + 1
  62.       if ay2 > center_y + 3
  63.         $game_map.scroll_down(fastmove)
  64.       else
  65.         $game_map.scroll_down(slowmove)
  66.       end
  67.     end
  68.   end  
  69. end
复制代码


已经排查过了,不存在跟其他脚本冲突的问题
想知道有没有解决方法或者可以替换的脚本>< 如果没有甚至完全不切实际的话,大佬们就可以来骂我的这个做法蠢了(。)
不过好在我还活着。
我挺过来了。
如果没有你,我是不会走到今天的。
所以……谢谢你。衷心谢谢你。
希望未来更加光明。
这里是士官生泰勒,原属瓦里亚号,通话结束。

【连接结束】
梦石
0
星屑
3794
在线时间
842 小时
注册时间
2017-12-13
回帖
248
 楼主| 发表于 2021-1-11 21:43:07 | 显示全部楼层
没有人(残念)
还有一个小问题虽然也没必要问……我现在换了新电脑,系统显示开的125%缩放,不然看不清,结果rm编辑器和游戏测试画面就变得很糊,也不知道变得有多糊,但是就是变糊了(?)
Snipaste_2021-01-11_21-40-13.png 这样子对比起来就很明显了
其它软件也有部分是这种情况

点评

对着启动软件右键-属性-兼容性-更改高DPI设置,勾选“替代高DPI缩放行为”,点确定,再启动就不会糊了(但是看上去会小)  发表于 2021-1-12 21:10
不过好在我还活着。
我挺过来了。
如果没有你,我是不会走到今天的。
所以……谢谢你。衷心谢谢你。
希望未来更加光明。
这里是士官生泰勒,原属瓦里亚号,通话结束。

【连接结束】
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部