With this commit, processing of the result of a score set request is working. The connection seems to drop during the game and I don't want to poll the network during the game so the next steps will be to close and re-open the connection between games.

This commit is contained in:
Jeremy Rand 2021-06-03 00:32:56 -04:00
parent 9a77919702
commit fb36a28e98
2 changed files with 26 additions and 11 deletions

View File

@ -121,7 +121,7 @@ gameLoop_skipScoreAgeDec anop
jsl checkKeyboard
jsl waitForVbl
jsl waitForBeam
lda shouldQuit
beq gameDone
@ -1182,15 +1182,28 @@ waitForKey_loop anop
rtl
waitForVbl entry
vblLoop anop
waitForBeam entry
beamLoop anop
lda >VERTICAL_COUNTER ; load the counter value
and #$80ff ; mask out the VBL bits
asl a ; shift the word around
adc #0 ; move MSB -> LSB
cmp #$1c8
bge vblLoop
bge beamLoop
rtl
waitForVbl entry
vblLoop1 anop
short m
lda #$fe
cmp >READ_VBL
bpl vblLoop1
vblLoop2 anop
cmp >READ_VBL
bmi vblLoop2
long m
rtl
shouldQuit dc i2'1'

View File

@ -248,8 +248,6 @@ void shutdownNetwork(void)
void pollNetwork(void)
{
Word errorCode;
if (!networkToolsStarted)
return;
@ -414,13 +412,17 @@ void pollNetwork(void)
gameNetworkState = GAME_NETWORK_PROTOCOL_FAILED;
}
if ((setHighScoreResponse.responseType != RESPONSE_TYPE_STATUS) ||
(!setHighScoreResponse.success)) {
if (setHighScoreResponse.responseType != RESPONSE_TYPE_STATUS) {
TCPIPAbortTCP(ipid);
TCPIPLogout(ipid);
gameNetworkState = GAME_NETWORK_PROTOCOL_FAILED;
}
if (!setHighScoreResponse.success) {
TCPIPAbortTCP(ipid);
TCPIPLogout(ipid);
gameNetworkState = GAME_NETWORK_PROTOCOL_FAILED;
}
// TODO - I don't think we are getting out of this state successfully...
globalScoreAge = 0;
gameNetworkState = GAME_NETWORK_REQUEST_SCORES;
@ -452,7 +454,6 @@ void sendHighScore(void)
return;
}
setHighScoreRequest.setHighScoreRequest.requestType = REQUEST_TYPE_SET_SCORE;
setHighScoreRequest.setHighScoreRequest.who[3] = '\0';
@ -465,13 +466,14 @@ void sendHighScore(void)
TCPIPAbortTCP(ipid);
TCPIPLogout(ipid);
gameNetworkState = GAME_NETWORK_SOCKET_ERROR;
return;
}
gameNetworkState = GAME_NETWORK_WAITING_FOR_SCORE_ACK;
bytesRead = 0;
timeout = 10*60;
while (gameNetworkState != GAME_NETWORK_SCORES_RETRIEVED) {
while (gameNetworkState != GAME_NETWORK_REQUEST_SCORES) {
waitForVbl();
pollNetwork();
timeout--;