Skip to content

Commit

Permalink
Added displays for last run stat and playback speed in practice mode
Browse files Browse the repository at this point in the history
  • Loading branch information
123jimin committed Jul 24, 2020
1 parent 5965c05 commit 9646124
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
16 changes: 10 additions & 6 deletions Main/src/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2532,27 +2532,31 @@ class Game_Impl : public Game
}
lua_setfield(L, -1, "scoreReplays");

//progress
// progress
m_LuaUpdateProgress(L);

//hispeed
// hispeed
lua_pushstring(L, "hispeed");
lua_pushnumber(L, m_hispeed);
lua_settable(L, -3);
//bpm
// playback speed
lua_pushstring(L, "playbackSpeed");
lua_pushnumber(L, m_playOptions.playbackSpeed);
lua_settable(L, -3);
// bpm
lua_pushstring(L, "bpm");
lua_pushnumber(L, m_currentTiming->GetBPM());
lua_settable(L, -3);
//gauge
// gauge
lua_pushstring(L, "gauge");
lua_pushnumber(L, m_scoring.currentGauge);
lua_settable(L, -3);
//combo state
// combo state
lua_pushstring(L, "comboState");
lua_pushnumber(L, m_scoring.comboState);
lua_settable(L, -3);

//hidden/sudden
// hidden/sudden
lua_pushstring(L, "hiddenFade");
lua_pushnumber(L, m_track->hiddenFadewindow);
lua_settable(L, -3);
Expand Down
24 changes: 19 additions & 5 deletions bin/skins/Default/scripts/gameplay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -347,15 +347,21 @@ function render(deltaTime)
draw_practice(deltaTime);
end

if gameplay.autoplay or gameplay.practice_setup then
local play_mode = ""

if gameplay.practice_setup
then play_mode = "Practice Setup"
elseif gameplay.autoplay
then play_mode = "Autoplay"
elseif gameplay.playbackSpeed ~= nil and gameplay.playbackSpeed < 1
then play_mode = string.format("Speed: x%.2f", gameplay.playbackSpeed)
end

if play_mode ~= "" then
gfx.LoadSkinFont("NotoSans-Regular.ttf")
gfx.FontSize(30)
gfx.TextAlign(gfx.TEXT_ALIGN_TOP + gfx.TEXT_ALIGN_CENTER)
gfx.FillColor(255,255,255)
local play_mode = ""
if gameplay.practice_setup then play_mode = "Practice Setup"
elseif gameplay.autoplay then play_mode = "Autoplay"
else play_mode = "UNKNOWN" end
gfx.Text(play_mode, desw/2, yshift)
end
end
Expand Down Expand Up @@ -1133,6 +1139,8 @@ local mission_str = ""

local count_play = 0
local count_success = 0
local last_run = ""
local last_timing = ""

-- Called when the practice starts
function practice_start(mission_type, mission_threshold, mission_description)
Expand All @@ -1145,6 +1153,8 @@ end
function practice_end_run(playCount, successCount, isSuccessful, scoring)
count_play = playCount
count_success = successCount
last_run = string.format("Last run: %d (%d-%d)", scoring.score, scoring.goods, scoring.misses)
last_timing = string.format("Hit delta: %d±%dms", scoring.meanHitDelta, scoring.meanHitDeltaAbs)
end

-- Called when user enters the setup again
Expand Down Expand Up @@ -1172,6 +1182,10 @@ function draw_practice(deltaTime)
if count_play > 0 then
local play_stat = string.format("Clear rate: %d/%d (%.1f%%)", count_success, count_play, (100.0 * count_success / count_play))
gfx.Text(play_stat, 0, 30)

gfx.FontSize(20)
gfx.Text(last_run, 0, 55)
gfx.Text(last_timing, 0, 75)
end

gfx.Restore()
Expand Down

0 comments on commit 9646124

Please sign in to comment.