mirror of
https://github.com/jeremysrand/BuGS.git
synced 2025-02-06 06:29:50 +00:00
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:
parent
9a77919702
commit
fb36a28e98
21
BuGS/game.s
21
BuGS/game.s
@ -121,7 +121,7 @@ gameLoop_skipScoreAgeDec anop
|
|||||||
|
|
||||||
jsl checkKeyboard
|
jsl checkKeyboard
|
||||||
|
|
||||||
jsl waitForVbl
|
jsl waitForBeam
|
||||||
|
|
||||||
lda shouldQuit
|
lda shouldQuit
|
||||||
beq gameDone
|
beq gameDone
|
||||||
@ -1182,14 +1182,27 @@ waitForKey_loop anop
|
|||||||
rtl
|
rtl
|
||||||
|
|
||||||
|
|
||||||
waitForVbl entry
|
waitForBeam entry
|
||||||
vblLoop anop
|
beamLoop anop
|
||||||
lda >VERTICAL_COUNTER ; load the counter value
|
lda >VERTICAL_COUNTER ; load the counter value
|
||||||
and #$80ff ; mask out the VBL bits
|
and #$80ff ; mask out the VBL bits
|
||||||
asl a ; shift the word around
|
asl a ; shift the word around
|
||||||
adc #0 ; move MSB -> LSB
|
adc #0 ; move MSB -> LSB
|
||||||
cmp #$1c8
|
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
|
rtl
|
||||||
|
|
||||||
|
|
||||||
|
@ -248,8 +248,6 @@ void shutdownNetwork(void)
|
|||||||
|
|
||||||
void pollNetwork(void)
|
void pollNetwork(void)
|
||||||
{
|
{
|
||||||
Word errorCode;
|
|
||||||
|
|
||||||
if (!networkToolsStarted)
|
if (!networkToolsStarted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -414,13 +412,17 @@ void pollNetwork(void)
|
|||||||
gameNetworkState = GAME_NETWORK_PROTOCOL_FAILED;
|
gameNetworkState = GAME_NETWORK_PROTOCOL_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((setHighScoreResponse.responseType != RESPONSE_TYPE_STATUS) ||
|
if (setHighScoreResponse.responseType != RESPONSE_TYPE_STATUS) {
|
||||||
(!setHighScoreResponse.success)) {
|
TCPIPAbortTCP(ipid);
|
||||||
|
TCPIPLogout(ipid);
|
||||||
|
gameNetworkState = GAME_NETWORK_PROTOCOL_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!setHighScoreResponse.success) {
|
||||||
TCPIPAbortTCP(ipid);
|
TCPIPAbortTCP(ipid);
|
||||||
TCPIPLogout(ipid);
|
TCPIPLogout(ipid);
|
||||||
gameNetworkState = GAME_NETWORK_PROTOCOL_FAILED;
|
gameNetworkState = GAME_NETWORK_PROTOCOL_FAILED;
|
||||||
}
|
}
|
||||||
// TODO - I don't think we are getting out of this state successfully...
|
|
||||||
|
|
||||||
globalScoreAge = 0;
|
globalScoreAge = 0;
|
||||||
gameNetworkState = GAME_NETWORK_REQUEST_SCORES;
|
gameNetworkState = GAME_NETWORK_REQUEST_SCORES;
|
||||||
@ -452,7 +454,6 @@ void sendHighScore(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
setHighScoreRequest.setHighScoreRequest.requestType = REQUEST_TYPE_SET_SCORE;
|
setHighScoreRequest.setHighScoreRequest.requestType = REQUEST_TYPE_SET_SCORE;
|
||||||
setHighScoreRequest.setHighScoreRequest.who[3] = '\0';
|
setHighScoreRequest.setHighScoreRequest.who[3] = '\0';
|
||||||
|
|
||||||
@ -465,13 +466,14 @@ void sendHighScore(void)
|
|||||||
TCPIPAbortTCP(ipid);
|
TCPIPAbortTCP(ipid);
|
||||||
TCPIPLogout(ipid);
|
TCPIPLogout(ipid);
|
||||||
gameNetworkState = GAME_NETWORK_SOCKET_ERROR;
|
gameNetworkState = GAME_NETWORK_SOCKET_ERROR;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gameNetworkState = GAME_NETWORK_WAITING_FOR_SCORE_ACK;
|
gameNetworkState = GAME_NETWORK_WAITING_FOR_SCORE_ACK;
|
||||||
bytesRead = 0;
|
bytesRead = 0;
|
||||||
|
|
||||||
timeout = 10*60;
|
timeout = 10*60;
|
||||||
while (gameNetworkState != GAME_NETWORK_SCORES_RETRIEVED) {
|
while (gameNetworkState != GAME_NETWORK_REQUEST_SCORES) {
|
||||||
waitForVbl();
|
waitForVbl();
|
||||||
pollNetwork();
|
pollNetwork();
|
||||||
timeout--;
|
timeout--;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user