Skip to content

Commit

Permalink
Display the position of the players score after upload.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremysrand committed Jun 29, 2021
1 parent 701585d commit 739d89a
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 3 deletions.
19 changes: 17 additions & 2 deletions BuGS/globalScores.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ Boolean hasGlobalHighScores = FALSE;
tScoresResponse highScoreResponse;
Word globalScoreAge = 0;
tSetHighScoreRequestWithHash setHighScoreRequest;
char globalScoreInfo[GAME_NUM_TILES_WIDE + 1];


// Implementation
Expand Down Expand Up @@ -691,7 +692,7 @@ BOOLEAN sendHighScore(void)
break;

case 0x10:
uploadSpin1();
uploadSpin3();
break;

case 0x18:
Expand All @@ -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;
}
4 changes: 4 additions & 0 deletions BuGS/globalScores.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <types.h>

#include "tileData.h"

typedef struct tHighScore
{
Expand All @@ -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);
Expand All @@ -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_ */
2 changes: 1 addition & 1 deletion BuGS/main.rez
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
},
Expand Down
44 changes: 44 additions & 0 deletions BuGS/score.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 739d89a

Please sign in to comment.