diff --git a/data/system.base.def b/data/system.base.def index 8aa4df10..c05b5311 100644 --- a/data/system.base.def +++ b/data/system.base.def @@ -1586,9 +1586,9 @@ menu.itemname.menugame.airamping = "AI Ramping" menu.itemname.menugame.quickcontinue = "Quick Continue" menu.itemname.menugame.autoguard = "Auto-Guard" - menu.itemname.menugame.stunbar = "Dizzy" - menu.itemname.menugame.guardbar = "Guard Break" - menu.itemname.menugame.redlifebar = "Red Life" + menu.itemname.menugame.dizzy = "Dizzy" + menu.itemname.menugame.guardbreak = "Guard Break" + menu.itemname.menugame.redlife = "Red Life" menu.itemname.menugame.teamduplicates = "Team Duplicates" menu.itemname.menugame.teamlifeshare = "Team Life Share" menu.itemname.menugame.teampowershare = "Team Power Share" @@ -1653,7 +1653,7 @@ menu.itemname.menuvideo.fullscreen = "Fullscreen" menu.itemname.menuvideo.keepaspect = "Keep Aspect Ratio" menu.itemname.menuvideo.windowscalemode = "Bilinear Filtering" - menu.itemname.menuvideo.vretrace = "VSync" + menu.itemname.menuvideo.vsync = "VSync" menu.itemname.menuvideo.msaa = "MSAA" menu.itemname.menuvideo.shaders = "Shaders" ;reserved submenu ; This list is populated with shaders existing in 'external/shaders' directory diff --git a/external/script/global.lua b/external/script/global.lua index ff473e4e..b18cfb25 100644 --- a/external/script/global.lua +++ b/external/script/global.lua @@ -207,7 +207,7 @@ function boolToInt(bool) end function engineInfo() - return string.format('Frames: %d, VSync: %d; Speed: %d/%d%%; FPS: %.3f', roundtime(), gameOption('Video.VRetrace'), tickspersecond(), gamespeed(), gamefps()) + return string.format('Frames: %d, VSync: %d; Speed: %d/%d%%; FPS: %.3f', roundtime(), gameOption('Video.VSync'), tickspersecond(), gamespeed(), gamefps()) end function playerInfo() diff --git a/external/script/motif.lua b/external/script/motif.lua index 77f27734..301e480d 100644 --- a/external/script/motif.lua +++ b/external/script/motif.lua @@ -1230,9 +1230,9 @@ local motif = --menu_itemname_airamping = 'AI Ramping', --Ikemen feature --menu_itemname_quickcontinue = 'Quick Continue', --Ikemen feature --menu_itemname_autoguard = 'Auto-Guard', --Ikemen feature - --menu_itemname_stunbar = 'Dizzy', --Ikemen feature - --menu_itemname_guardbar = 'Guard Break', --Ikemen feature - --menu_itemname_redlifebar = 'Red Life', --Ikemen feature + --menu_itemname_dizzy = 'Dizzy', --Ikemen feature + --menu_itemname_guardbreak = 'Guard Break', --Ikemen feature + --menu_itemname_redlife = 'Red Life', --Ikemen feature --menu_itemname_teamduplicates = 'Team Duplicates', --Ikemen feature --menu_itemname_teamlifeshare = 'Team Life Share', --Ikemen feature --menu_itemname_teampowershare = 'Team Power Share', --Ikemen feature @@ -1261,7 +1261,7 @@ local motif = --menu_itemname_resolution = 'Resolution', --Ikemen feature --menu_itemname_customres = 'Custom', --Ikemen feature --menu_itemname_fullscreen = 'Fullscreen', --Ikemen feature - --menu_itemname_vretrace = 'VSync', --Ikemen feature + --menu_itemname_vsync = 'VSync', --Ikemen feature --menu_itemname_msaa = 'MSAA', --Ikemen feature --menu_itemname_shaders = 'Shaders', --Ikemen feature --menu_itemname_noshader = 'Disable', --Ikemen feature @@ -1973,9 +1973,9 @@ function motif.setBaseOptionInfo() motif.option_info.menu_itemname_menugame_airamping = "AI Ramping" motif.option_info.menu_itemname_menugame_quickcontinue = "Quick Continue" motif.option_info.menu_itemname_menugame_autoguard = "Auto-Guard" - motif.option_info.menu_itemname_menugame_stunbar = "Dizzy" - motif.option_info.menu_itemname_menugame_guardbar = "Guard Break" - motif.option_info.menu_itemname_menugame_redlifebar = "Red Life" + motif.option_info.menu_itemname_menugame_dizzy = "Dizzy" + motif.option_info.menu_itemname_menugame_guardbreak = "Guard Break" + motif.option_info.menu_itemname_menugame_redlife = "Red Life" motif.option_info.menu_itemname_menugame_teamduplicates = "Team Duplicates" motif.option_info.menu_itemname_menugame_teamlifeshare = "Team Life Share" motif.option_info.menu_itemname_menugame_teampowershare = "Team Power Share" @@ -2038,7 +2038,7 @@ function motif.setBaseOptionInfo() motif.option_info.menu_itemname_menuvideo_resolution_customres = "Custom" motif.option_info.menu_itemname_menuvideo_resolution_back = "Back" motif.option_info.menu_itemname_menuvideo_fullscreen = "Fullscreen" - motif.option_info.menu_itemname_menuvideo_vretrace = "VSync" + motif.option_info.menu_itemname_menuvideo_vsync = "VSync" motif.option_info.menu_itemname_menuvideo_keepaspect = "Keep Aspect Ratio" motif.option_info.menu_itemname_menuvideo_windowscalemode = "Bilinear Filtering" motif.option_info.menu_itemname_menuvideo_msaa = "MSAA" @@ -2109,9 +2109,9 @@ function motif.setBaseOptionInfo() "menugame_airamping", "menugame_quickcontinue", "menugame_autoguard", - "menugame_stunbar", - "menugame_guardbar", - "menugame_redlifebar", + "menugame_dizzy", + "menugame_guardbreak", + "menugame_redlife", "menugame_teamduplicates", "menugame_teamlifeshare", "menugame_teampowershare", @@ -2172,7 +2172,7 @@ function motif.setBaseOptionInfo() "menuvideo_resolution_customres", "menuvideo_resolution_back", "menuvideo_fullscreen", - "menuvideo_vretrace", + "menuvideo_vsync", "menuvideo_keepaspect", "menuvideo_windowscalemode", "menuvideo_msaa", diff --git a/external/script/options.lua b/external/script/options.lua index a6af8716..372ed489 100644 --- a/external/script/options.lua +++ b/external/script/options.lua @@ -190,8 +190,8 @@ options.t_itemname = { --modifyGameOption('Video.WindowHeight', 0) modifyGameOption('Video.Fullscreen', false) --modifyGameOption('Video.Borderless', false) - --modifyGameOption('Video.PngSpriteFilter', true) - modifyGameOption('Video.VRetrace', 1) + --modifyGameOption('Video.RGBSpriteBilinearFilter', true) + modifyGameOption('Video.VSync', 1) modifyGameOption('Video.MSAA', 0) --modifyGameOption('Video.WindowCentered', true) modifyGameOption('Video.ExternalShaders', {}) @@ -227,7 +227,7 @@ options.t_itemname = { v.vardisplay = options.f_vardisplay(v.itemname) end toggleFullscreen(gameOption('Video.Fullscreen')) - toggleVsync(gameOption('Video.VRetrace')) + toggleVSync(gameOption('Video.VSync')) updateVolume() options.modified = true options.needReload = true @@ -442,7 +442,7 @@ options.t_itemname = { return true end, --Dizzy - ['stunbar'] = function(t, item, cursorPosY, moveTxt) + ['dizzy'] = function(t, item, cursorPosY, moveTxt) if main.f_input(main.t_players, {'$F', '$B', 'pal', 's'}) then sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) if gameOption('Options.Dizzy') then @@ -456,7 +456,7 @@ options.t_itemname = { return true end, --Guard Break - ['guardbar'] = function(t, item, cursorPosY, moveTxt) + ['guardbreak'] = function(t, item, cursorPosY, moveTxt) if main.f_input(main.t_players, {'$F', '$B', 'pal', 's'}) then sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) if gameOption('Options.GuardBreak') then @@ -470,7 +470,7 @@ options.t_itemname = { return true end, --Red Life - ['redlifebar'] = function(t, item, cursorPosY, moveTxt) + ['redlife'] = function(t, item, cursorPosY, moveTxt) if main.f_input(main.t_players, {'$F', '$B', 'pal', 's'}) then sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) if gameOption('Options.RedLife') then @@ -857,16 +857,16 @@ options.t_itemname = { return true end, --VSync - ['vretrace'] = function(t, item, cursorPosY, moveTxt) + ['vsync'] = function(t, item, cursorPosY, moveTxt) if main.f_input(main.t_players, {'$F', '$B', 'pal', 's'}) then sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) - if gameOption('Video.VRetrace') == 1 then - modifyGameOption('Video.VRetrace', 0) + if gameOption('Video.VSync') == 1 then + modifyGameOption('Video.VSync', 0) else - modifyGameOption('Video.VRetrace', 1) + modifyGameOption('Video.VSync', 1) end - toggleVsync() - t.items[item].vardisplay = options.f_definedDisplay(gameOption('Video.VRetrace'), {[1] = motif.option_info.menu_valuename_enabled}, motif.option_info.menu_valuename_disabled) + toggleVSync(gameOption('Video.VSync')) + t.items[item].vardisplay = options.f_definedDisplay(gameOption('Video.VSync'), {[1] = motif.option_info.menu_valuename_enabled}, motif.option_info.menu_valuename_disabled) options.modified = true end return true @@ -1057,7 +1057,7 @@ options.t_itemname = { end return true end, - --Panning Width + --Panning Range ['panningrange'] = function(t, item, cursorPosY, moveTxt) if main.f_input(main.t_players, {'$F'}) and gameOption('Sound.PanningRange') < 100 then sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) @@ -1386,7 +1386,7 @@ options.t_vardisplay = { ['gamespeed'] = function() return options.f_boolDisplay(gameOption('Options.GameSpeed') == 0, motif.option_info.menu_valuename_normal, options.f_boolDisplay(gameOption('Options.GameSpeed') < 0, motif.option_info.menu_valuename_slow:gsub('%%i', tostring(0-gameOption('Options.GameSpeed'))), motif.option_info.menu_valuename_fast:gsub('%%i', tostring(gameOption('Options.GameSpeed'))))) end, - ['guardbar'] = function() + ['guardbreak'] = function() return options.f_boolDisplay(gameOption('Options.GuardBreak')) end, ['helpermax'] = function() @@ -1480,7 +1480,7 @@ options.t_vardisplay = { ['ratiorecoverybonus'] = function() return gameOption('Options.Ratio.Recovery.Bonus') .. '%' end, - ['redlifebar'] = function() + ['redlife'] = function() return options.f_boolDisplay(gameOption('Options.RedLife')) end, ['renderer'] = function() @@ -1513,7 +1513,7 @@ options.t_vardisplay = { ['stereoeffects'] = function() return options.f_boolDisplay(gameOption('Sound.StereoEffects'), motif.option_info.menu_valuename_enabled, motif.option_info.menu_valuename_disabled) end, - ['stunbar'] = function() + ['dizzy'] = function() return options.f_boolDisplay(gameOption('Options.Dizzy')) end, ['teamduplicates'] = function() @@ -1531,8 +1531,8 @@ options.t_vardisplay = { ['turnsrecoverybonus'] = function() return gameOption('Options.Turns.Recovery.Bonus') .. '%' end, - ['vretrace'] = function() - return options.f_definedDisplay(gameOption('Video.VRetrace'), {[1] = motif.option_info.menu_valuename_enabled}, motif.option_info.menu_valuename_disabled) + ['vsync'] = function() + return options.f_definedDisplay(gameOption('Video.VSync'), {[1] = motif.option_info.menu_valuename_enabled}, motif.option_info.menu_valuename_disabled) end, ['windowscalemode'] = function() return options.f_boolDisplay(gameOption('Video.WindowScaleMode'), motif.option_info.menu_valuename_enabled, motif.option_info.menu_valuename_disabled) diff --git a/src/bytecode.go b/src/bytecode.go index 2658961a..c36817c6 100644 --- a/src/bytecode.go +++ b/src/bytecode.go @@ -650,7 +650,6 @@ const ( OC_ex_receivedhits OC_ex_redlife OC_ex_round - OC_ex_roundrestarted OC_ex_roundtime OC_ex_score OC_ex_scoretotal @@ -748,6 +747,12 @@ const ( OC_ex2_clsnvar_top OC_ex2_clsnvar_right OC_ex2_clsnvar_bottom + OC_ex2_debug_accel + OC_ex2_debug_clsndraw + OC_ex2_debug_debugdraw + OC_ex2_debug_statusdraw + OC_ex2_debug_wireframedraw + OC_ex2_debug_roundrestarted OC_ex2_explodvar_anim OC_ex2_explodvar_animelem OC_ex2_explodvar_pos_x @@ -3001,8 +3006,6 @@ func (be BytecodeExp) run_ex(c *Char, i *int, oc *Char) { case OC_ex_round: v2 := sys.bcStack.Pop() be.round(sys.bcStack.Top(), v2) - case OC_ex_roundrestarted: - sys.bcStack.PushB(sys.roundResetFlg) case OC_ex_roundtime: sys.bcStack.PushI(int32(sys.tickCount)) case OC_ex_score: @@ -3293,6 +3296,18 @@ func (be BytecodeExp) run_ex2(c *Char, i *int, oc *Char) { } } sys.bcStack.PushF(v * (c.localscl / oc.localscl)) + case OC_ex2_debug_accel: + sys.bcStack.PushF(sys.accel) + case OC_ex2_debug_clsndraw: + sys.bcStack.PushB(sys.clsnDraw) + case OC_ex2_debug_debugdraw: + sys.bcStack.PushB(sys.debugDraw) + case OC_ex2_debug_statusdraw: + sys.bcStack.PushB(sys.statusDraw) + case OC_ex2_debug_wireframedraw: + sys.bcStack.PushB(sys.wireframeDraw) + case OC_ex2_debug_roundrestarted: + sys.bcStack.PushB(sys.roundResetFlg) // BEGIN FALLTHROUGH (explodvar) case OC_ex2_explodvar_vel_x: correctScale = true diff --git a/src/compiler.go b/src/compiler.go index 2fc42861..1a5c659a 100644 --- a/src/compiler.go +++ b/src/compiler.go @@ -3727,6 +3727,31 @@ func (c *Compiler) expValue(out *BytecodeExp, in *string, out.append(OC_ex_, OC_ex_combocount) case "consecutivewins": out.append(OC_ex_, OC_ex_consecutivewins) + case "debug": + if err := c.checkOpeningBracket(in); err != nil { + return bvNone(), err + } + out.append(OC_ex2_) + switch c.token { + case "accel": + out.append(OC_ex2_debug_accel) + case "clsndraw": + out.append(OC_ex2_debug_clsndraw) + case "debugdraw": + out.append(OC_ex2_debug_debugdraw) + case "statusdraw": + out.append(OC_ex2_debug_statusdraw) + case "wireframedraw": + out.append(OC_ex2_debug_wireframedraw) + case "roundrestarted": + out.append(OC_ex2_debug_roundrestarted) + default: + return bvNone(), Error("Invalid data: " + c.token) + } + c.token = c.tokenizer(in) + if err := c.checkClosingBracket(); err != nil { + return bvNone(), err + } case "decisiveround": out.append(OC_ex_, OC_ex_decisiveround) case "defence": @@ -4151,8 +4176,6 @@ func (c *Compiler) expValue(out *BytecodeExp, in *string, out.append(OC_ex_, OC_ex_receivedhits) case "redlife": out.append(OC_ex_, OC_ex_redlife) - case "roundrestarted": - out.append(OC_ex_, OC_ex_roundrestarted) case "roundtime": out.append(OC_ex_, OC_ex_roundtime) case "score": diff --git a/src/config.go b/src/config.go index 864ee834..124d7700 100644 --- a/src/config.go +++ b/src/config.go @@ -149,22 +149,22 @@ type Config struct { StartStage string `ini:"StartStage"` } `ini:"Debug"` Video struct { - RenderMode string `ini:"RenderMode"` - GameWidth int32 `ini:"GameWidth"` - GameHeight int32 `ini:"GameHeight"` - WindowWidth int `ini:"WindowWidth"` - WindowHeight int `ini:"WindowHeight"` - VRetrace int `ini:"VRetrace"` - Fullscreen bool `ini:"Fullscreen"` - Borderless bool `ini:"Borderless"` - PngSpriteFilter bool `ini:"PngSpriteFilter"` - MSAA int32 `ini:"MSAA"` - WindowCentered bool `ini:"WindowCentered"` - ExternalShaders []string `ini:"ExternalShaders"` - WindowScaleMode bool `ini:"WindowScaleMode"` - KeepAspect bool `ini:"KeepAspect"` - EnableModel bool `ini:"EnableModel"` - EnableModelShadow bool `ini:"EnableModelShadow"` + RenderMode string `ini:"RenderMode"` + GameWidth int32 `ini:"GameWidth"` + GameHeight int32 `ini:"GameHeight"` + WindowWidth int `ini:"WindowWidth"` + WindowHeight int `ini:"WindowHeight"` + VSync int `ini:"VSync"` + Fullscreen bool `ini:"Fullscreen"` + Borderless bool `ini:"Borderless"` + RGBSpriteBilinearFilter bool `ini:"RGBSpriteBilinearFilter"` + MSAA int32 `ini:"MSAA"` + WindowCentered bool `ini:"WindowCentered"` + ExternalShaders []string `ini:"ExternalShaders"` + WindowScaleMode bool `ini:"WindowScaleMode"` + KeepAspect bool `ini:"KeepAspect"` + EnableModel bool `ini:"EnableModel"` + EnableModelShadow bool `ini:"EnableModelShadow"` } `ini:"Video"` Sound struct { SampleRate int32 `ini:"SampleRate"` diff --git a/src/image.go b/src/image.go index 1d51b607..59e3bfc6 100644 --- a/src/image.go +++ b/src/image.go @@ -687,7 +687,7 @@ func (s *Sprite) SetPxl(px []byte) { func (s *Sprite) SetRaw(data []byte, sprWidth int32, sprHeight int32, sprDepth int32) { sys.mainThreadTask <- func() { - s.Tex = gfx.newTexture(sprWidth, sprHeight, sprDepth, sys.cfg.Video.PngSpriteFilter) + s.Tex = gfx.newTexture(sprWidth, sprHeight, sprDepth, sys.cfg.Video.RGBSpriteBilinearFilter) s.Tex.SetData(data) } } diff --git a/src/resources/defaultConfig.ini b/src/resources/defaultConfig.ini index dea5e284..41273e46 100644 --- a/src/resources/defaultConfig.ini +++ b/src/resources/defaultConfig.ini @@ -190,12 +190,13 @@ WindowHeight = 0 Fullscreen = 0 ; Toggles borderless fullscreen mode (ignored if Fullscreen = 0) Borderless = 0 -; Toggles bilinear filtering. -PngSpriteFilter = 1 -; Toggles vertical retrace synchronization (V-Sync). -VRetrace = 1 -; Multisample anti-aliasing samples. Most modern GPUs support 2, 4, and 8. -; Higher values result in better quality, but are slower. +; Toggles bilinear filtering for sprites using RGB color formats (non-indexed). +RGBSpriteBilinearFilter = 1 +; Toggles syncing frame rate with display refresh rate to prevent screen tearing. +; May increase input lag. +VSync = 1 +; Multisample anti-aliasing samples. Acceptable values are powers of 2 (2 to 32). +; Higher values provide better visual quality but may decrease performance. MSAA = 0 ; Toggles centring initial window position. WindowCentered = 1 @@ -304,7 +305,6 @@ IP.localhost = 127.0.0.1 [Input] ; If enabled, button inputs will wait one additional frame before registering, ; making button combinations easier to perform but adding one frame of input lag. -; For now, this option only works in local play, not in netplay. ButtonAssist = 1 ; Allows setting how simultaneous opposing cardinal directions should be resolved ; 0: No resolution (allows pressing both directions at the same time) (Mugen) diff --git a/src/script.go b/src/script.go index fa97d115..1e72edb3 100644 --- a/src/script.go +++ b/src/script.go @@ -817,7 +817,7 @@ func systemScriptInit(l *lua.LState) { return 0 }) luaRegister(l, "enterReplay", func(*lua.LState) int { - if sys.cfg.Video.VRetrace >= 0 { + if sys.cfg.Video.VSync >= 0 { sys.window.SetSwapInterval(1) // broken frame skipping when set to 0 } sys.chars = [len(sys.chars)][]*Char{} @@ -839,8 +839,8 @@ func systemScriptInit(l *lua.LState) { return 0 }) luaRegister(l, "exitReplay", func(*lua.LState) int { - if sys.cfg.Video.VRetrace >= 0 { - sys.window.SetSwapInterval(sys.cfg.Video.VRetrace) + if sys.cfg.Video.VSync >= 0 { + sys.window.SetSwapInterval(sys.cfg.Video.VSync) } if sys.fileInput != nil { sys.fileInput.Close() @@ -2931,15 +2931,15 @@ func systemScriptInit(l *lua.LState) { } return 0 }) - luaRegister(l, "toggleVsync", func(*lua.LState) int { + luaRegister(l, "toggleVSync", func(*lua.LState) int { if !nilArg(l, 1) { - sys.cfg.Video.VRetrace = int(numArg(l, 1)) - } else if sys.cfg.Video.VRetrace == 0 { - sys.cfg.Video.VRetrace = 1 + sys.cfg.Video.VSync = int(numArg(l, 1)) + } else if sys.cfg.Video.VSync == 0 { + sys.cfg.Video.VSync = 1 } else { - sys.cfg.Video.VRetrace = 0 + sys.cfg.Video.VSync = 0 } - sys.window.SetSwapInterval(sys.cfg.Video.VRetrace) + sys.window.SetSwapInterval(sys.cfg.Video.VSync) return 0 }) luaRegister(l, "updateVolume", func(l *lua.LState) int { diff --git a/src/system_glfw.go b/src/system_glfw.go index 8953dc03..4844a134 100644 --- a/src/system_glfw.go +++ b/src/system_glfw.go @@ -85,8 +85,8 @@ func (s *System) newWindow(w, h int) (*Window, error) { window.SetCharModsCallback(charCallback) // V-Sync - if s.cfg.Video.VRetrace >= 0 { - glfw.SwapInterval(s.cfg.Video.VRetrace) + if s.cfg.Video.VSync >= 0 { + glfw.SwapInterval(s.cfg.Video.VSync) } ret := &Window{window, s.cfg.Config.WindowTitle, fullscreen, x, y, w, h} @@ -173,8 +173,8 @@ func (w *Window) toggleFullscreen() { } w.SetInputMode(glfw.CursorMode, glfw.CursorHidden) } - if sys.cfg.Video.VRetrace != -1 { - glfw.SwapInterval(sys.cfg.Video.VRetrace) + if sys.cfg.Video.VSync != -1 { + glfw.SwapInterval(sys.cfg.Video.VSync) } w.fullscreen = !w.fullscreen }