From 739d89add08835d6254bf17acd8089f29f94d066 Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Mon, 28 Jun 2021 23:12:06 -0400 Subject: [PATCH] Display the position of the players score after upload. --- BuGS/globalScores.c | 19 +++++++++++++++++-- BuGS/globalScores.h | 4 ++++ BuGS/main.rez | 2 +- BuGS/score.s | 44 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 3 deletions(-) diff --git a/BuGS/globalScores.c b/BuGS/globalScores.c index 33c728a..668a1d1 100644 --- a/BuGS/globalScores.c +++ b/BuGS/globalScores.c @@ -170,6 +170,7 @@ Boolean hasGlobalHighScores = FALSE; tScoresResponse highScoreResponse; Word globalScoreAge = 0; tSetHighScoreRequestWithHash setHighScoreRequest; +char globalScoreInfo[GAME_NUM_TILES_WIDE + 1]; // Implementation @@ -691,7 +692,7 @@ BOOLEAN sendHighScore(void) break; case 0x10: - uploadSpin1(); + uploadSpin3(); break; case 0x18: @@ -701,5 +702,19 @@ BOOLEAN sendHighScore(void) } } while (networkGlobals->gameNetworkState > GAME_NETWORK_TCP_UNCONNECTED); - return (networkGlobals->gameNetworkState == GAME_NETWORK_TCP_UNCONNECTED); + if (networkGlobals->gameNetworkState != GAME_NETWORK_TCP_UNCONNECTED) + return FALSE; + + sprintf(globalScoreInfo, " %u OF %u SCORES", networkGlobals->setHighScoreResponse.position, networkGlobals->setHighScoreResponse.numberOfScores); + for (cycleCount = strlen(globalScoreInfo); cycleCount < sizeof(globalScoreInfo); cycleCount++) { + globalScoreInfo[cycleCount] = ' '; + } + globalScoreInfo[GAME_NUM_TILES_WIDE] = '\0'; + displayScorePosition(); + + for (cycleCount = 4 * 60; cycleCount > 0; cycleCount--) { + waitForVbl(); + } + + return TRUE; } diff --git a/BuGS/globalScores.h b/BuGS/globalScores.h index 5f727e3..221738b 100644 --- a/BuGS/globalScores.h +++ b/BuGS/globalScores.h @@ -12,6 +12,7 @@ #include +#include "tileData.h" typedef struct tHighScore { @@ -20,6 +21,8 @@ typedef struct tHighScore unsigned long score; } tHighScore; +extern char globalScoreInfo[GAME_NUM_TILES_WIDE + 1]; + extern unsigned int myUserId; extern void initNetwork(void); @@ -34,6 +37,7 @@ extern void uploadSpin1(void); extern void uploadSpin2(void); extern void uploadSpin3(void); extern void displayConnectionString(void); +extern void displayScorePosition(void); #endif /* define _GUARD_PROJECTBuGS_FILEglobalScores_ */ diff --git a/BuGS/main.rez b/BuGS/main.rez index 3d6950d..ea4fa35 100644 --- a/BuGS/main.rez +++ b/BuGS/main.rez @@ -63,7 +63,7 @@ resource rVersion (1) { { 1, /* Major version number in BCD */ 9, /* Minor version number in BCD */ - 1, /* Bug version number in BCD */ + 2, /* Bug version number in BCD */ beta, /* Development phase */ 0 /* Release number */ }, diff --git a/BuGS/score.s b/BuGS/score.s index 2d03b41..4548b26 100644 --- a/BuGS/score.s +++ b/BuGS/score.s @@ -781,6 +781,7 @@ checkHighScore_isInvalid anop bra checkHighScore_nextKey checkHighScore_doneInitials anop + _overwriteGameTile TILE_EMPTY lda settings+SETTINGS_HIGH_SCORE_OFFSET+HIGH_SCORE_WHO_OFFSET-3,y sta setHighScoreRequest+2 lda settings+SETTINGS_HIGH_SCORE_OFFSET+HIGH_SCORE_WHO_OFFSET-1,y @@ -879,5 +880,48 @@ uploadSpin3 entry _overwriteGameTile TILE_EMPTY _overwriteGameTile TILE_SOLID1 rtl + + +displayScorePosition entry + ldx #GAME_NUM_TILES_WIDE*22 + _overwriteGameTile TILE_EMPTY + _overwriteGameTile TILE_LETTER_Y + _overwriteGameTile TILE_LETTER_O + _overwriteGameTile TILE_LETTER_U + _overwriteGameTile TILE_LETTER_R + _overwriteGameTile TILE_EMPTY + _overwriteGameTile TILE_LETTER_S + _overwriteGameTile TILE_LETTER_C + _overwriteGameTile TILE_LETTER_O + _overwriteGameTile TILE_LETTER_R + _overwriteGameTile TILE_LETTER_E + _overwriteGameTile TILE_EMPTY + _overwriteGameTile TILE_LETTER_G + _overwriteGameTile TILE_LETTER_L + _overwriteGameTile TILE_LETTER_O + _overwriteGameTile TILE_LETTER_B + _overwriteGameTile TILE_LETTER_A + _overwriteGameTile TILE_LETTER_L + _overwriteGameTile TILE_LETTER_L + _overwriteGameTile TILE_LETTER_Y + _overwriteGameTile TILE_EMPTY + _overwriteGameTile TILE_LETTER_I + _overwriteGameTile TILE_LETTER_S + _overwriteGameTile TILE_SYMBOL_COLON + _overwriteGameTile TILE_EMPTY + + ldx #GAME_NUM_TILES_WIDE*24 + ldy #0 +displayScorePosition_loop anop + lda globalScoreInfo,y + and #$ff + beq displayScorePosition_done + jsl asciiToTileType + jsl overwriteGameTile + iny + bra displayScorePosition_loop + +displayScorePosition_done anop + rtl end