score send criteria change and fix replay record oob bug

This commit is contained in:
RandomityGuy 2025-02-14 20:13:09 +05:30
parent ad0e867b48
commit 06d0c6d98e
2 changed files with 6 additions and 2 deletions

View file

@ -291,7 +291,9 @@ class Replay {
public function endFrame() { public function endFrame() {
// Do not record frames beyond par time/5 minutes to limit file size, if we aren't explicitly recording // Do not record frames beyond par time/5 minutes to limit file size, if we aren't explicitly recording
if (!MarbleGame.instance.toRecord && currentRecordFrame.clockTime > Math.min(300, MarbleGame.instance.world.mission.qualifyTime)) { if (!MarbleGame.instance.toRecord
&& currentRecordFrame != null
&& currentRecordFrame.clockTime > Math.min(300, MarbleGame.instance.world.mission.qualifyTime)) {
currentRecordFrame = null; currentRecordFrame = null;
return; return;
} }

View file

@ -444,13 +444,15 @@ class EndGameGui extends GuiControl {
lbPath = 'custom/${mission.id}'; lbPath = 'custom/${mission.id}';
Leaderboards.getScores(lbPath, All, (scores) -> { Leaderboards.getScores(lbPath, All, (scores) -> {
var hasMyScore = false; var hasMyScore = false;
var myTopScoreLB = 0.0;
for (score in scores) { for (score in scores) {
if (score.name == Settings.highscoreName) { if (score.name == Settings.highscoreName) {
hasMyScore = true; hasMyScore = true;
myTopScoreLB = score.score;
break; break;
} }
} }
if (!hasMyScore) { if (!hasMyScore || (hasMyScore && myTopScoreLB > timeState.gameplayClock)) {
Leaderboards.submitScore(lbPath, timeState.gameplayClock, MarbleGame.instance.world.rewindUsed, (sendReplay, rowId) -> { Leaderboards.submitScore(lbPath, timeState.gameplayClock, MarbleGame.instance.world.rewindUsed, (sendReplay, rowId) -> {
if (sendReplay && !mission.isClaMission) { if (sendReplay && !mission.isClaMission) {
Leaderboards.submitReplay(rowId, replayData); Leaderboards.submitReplay(rowId, replayData);