Fix a problem on the GS where the messages on the bottom four lines in mixed text/graphics mode ended up being displayed over the graphics because the text window was setup incorrectly. Move the mouse to the square if the user jumps to another square using keyboard arrow keys or jumping to a hint.

This commit is contained in:
Jeremy Rand 2016-08-24 01:18:19 -04:00
parent 4ecae7ea50
commit fae32b84f9
4 changed files with 57 additions and 12 deletions

View File

@ -66,6 +66,15 @@ gemmask := $8A
.proc _showDblLoRes .proc _showDblLoRes
lda #0
sta WNDLFT
lda #80
sta WNDWDTH
lda #0
sta WNDTOP
lda #24
sta WNDBTM
lda TXTCLR lda TXTCLR
lda MIXCLR lda MIXCLR
lda SETAN3 lda SETAN3
@ -106,6 +115,15 @@ gemmask := $8A
cpx #0 cpx #0
bne @L2 bne @L2
lda #0
sta WNDLFT
lda #80
sta WNDWDTH
lda #20
sta WNDTOP
lda #24
sta WNDBTM
rts rts
.endproc .endproc

View File

@ -24,6 +24,7 @@ extern char a2e_stdmou_mou;
static tMouseCallbacks *gMouseCallbacks = NULL; static tMouseCallbacks *gMouseCallbacks = NULL;
static bool gMouseInstalled = false; static bool gMouseInstalled = false;
static bool gMouseInPoll = false;
bool initMouse(tMouseCallbacks *callbacks) bool initMouse(tMouseCallbacks *callbacks)
@ -65,6 +66,8 @@ bool pollMouse(void)
return result; return result;
} }
gMouseInPoll = true;
mouse_info(&mouseInfo); mouse_info(&mouseInfo);
newMouseDown = (mouseInfo.buttons != 0); newMouseDown = (mouseInfo.buttons != 0);
@ -120,6 +123,25 @@ bool pollMouse(void)
} }
} }
oldMouseDown = newMouseDown; oldMouseDown = newMouseDown;
gMouseInPoll = false;
return result; return result;
} }
void moveMouseToSquare(tSquare square)
{
uint16_t newX;
uint16_t newY;
if (!gMouseInstalled)
return;
if (gMouseInPoll)
return;
newX = (SQUARE_TO_X(square) * 35) + 18;
newY = (SQUARE_TO_Y(square) * 8) + 4;
mouse_move(newX, newY);
}

View File

@ -28,6 +28,7 @@ typedef struct tMouseCallbacks {
extern bool initMouse(tMouseCallbacks *callbacks); extern bool initMouse(tMouseCallbacks *callbacks);
extern void shutdownMouse(void); extern void shutdownMouse(void);
extern bool pollMouse(void); extern bool pollMouse(void);
extern void moveMouseToSquare(tSquare square);
#endif /* defined(__a2bejwld__mouseWrapper__) */ #endif /* defined(__a2bejwld__mouseWrapper__) */

View File

@ -321,6 +321,7 @@ static void drawBoard(void)
} }
selectSquare(gSelectedSquare); selectSquare(gSelectedSquare);
moveMouseToSquare(gSelectedSquare);
drawScore(gScoreBar); drawScore(gScoreBar);
} }
@ -378,6 +379,7 @@ static void moveDir(tDirection dir)
refreshSquare(oldSquare); refreshSquare(oldSquare);
selectSquare(gSelectedSquare); selectSquare(gSelectedSquare);
moveMouseToSquare(gSelectedSquare);
} }
@ -423,6 +425,7 @@ static void moveTwoDirs(tDirection dir1, tDirection dir2)
refreshSquare(oldSquare); refreshSquare(oldSquare);
selectSquare(gSelectedSquare); selectSquare(gSelectedSquare);
moveMouseToSquare(gSelectedSquare);
} }
@ -481,13 +484,13 @@ static bool isAppleButtonPressed(void)
static void endGame(void) static void endGame(void)
{ {
mixedTextMode();
videomode(VIDEOMODE_80x24); videomode(VIDEOMODE_80x24);
mixedTextMode();
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); cputsxy(0, 0, " No more moves - GAME OVER!!");
printf(" No more moves - GAME OVER!!\n"); gotoxy(0,1);
printf(" You made it to level %u\n\n", getLevel()); cprintf( " You made it to level %u", getLevel());
printf(" Play again (Y/N)?"); cputsxy(0, 3, " Play again (Y/N)?");
while (true) { while (true) {
switch (cgetc()) { switch (cgetc()) {
@ -525,12 +528,12 @@ static void refreshLevel(tLevel level)
{ {
bool waiting = true; bool waiting = true;
mixedTextMode();
videomode(VIDEOMODE_80x24); videomode(VIDEOMODE_80x24);
mixedTextMode();
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); gotoxy(0, 0);
printf(" Completed level %u!!\n", level); cprintf( " Completed level %u!!", level);
printf(" Press space to continue to the next level..."); cputsxy(0, 2, " Press space to continue to the next level...");
while (waiting) { while (waiting) {
switch (cgetc()) { switch (cgetc()) {
@ -554,6 +557,7 @@ static void getHint(void)
gSelectedSquare = getHintSquare(); gSelectedSquare = getHintSquare();
selectSquare(gSelectedSquare); selectSquare(gSelectedSquare);
moveMouseToSquare(gSelectedSquare);
} }
@ -750,10 +754,10 @@ static bool pollKeyboard(void)
case 'q': case 'q':
case 'Q': case 'Q':
if (gShouldSave) { if (gShouldSave) {
mixedTextMode();
videomode(VIDEOMODE_80x24); videomode(VIDEOMODE_80x24);
gotoxy(0, 20); mixedTextMode();
cprintf("\n\nSaving your game so you can continue\r\n later..."); gotoxy(0, 0);
cprintf("Saving your game so you can continue\r\n later...");
saveGame(); saveGame();
} }
quitGame(); quitGame();