Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: debug trigger; fix: VSync option #2226

Merged
merged 1 commit into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions data/system.base.def
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion external/script/global.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
24 changes: 12 additions & 12 deletions external/script/motif.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
36 changes: 18 additions & 18 deletions external/script/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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', {})
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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])
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand All @@ -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)
Expand Down
21 changes: 18 additions & 3 deletions src/bytecode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
27 changes: 25 additions & 2 deletions src/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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":
Expand Down
32 changes: 16 additions & 16 deletions src/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
2 changes: 1 addition & 1 deletion src/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/resources/defaultConfig.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Loading
Loading