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
lda #0
sta WNDLFT
lda #80
sta WNDWDTH
lda #0
sta WNDTOP
lda #24
sta WNDBTM
lda TXTCLR
lda MIXCLR
lda SETAN3
@ -106,6 +115,15 @@ gemmask := $8A
cpx #0
bne @L2
lda #0
sta WNDLFT
lda #80
sta WNDWDTH
lda #20
sta WNDTOP
lda #24
sta WNDBTM
rts
.endproc

View File

@ -24,6 +24,7 @@ extern char a2e_stdmou_mou;
static tMouseCallbacks *gMouseCallbacks = NULL;
static bool gMouseInstalled = false;
static bool gMouseInPoll = false;
bool initMouse(tMouseCallbacks *callbacks)
@ -65,6 +66,8 @@ bool pollMouse(void)
return result;
}
gMouseInPoll = true;
mouse_info(&mouseInfo);
newMouseDown = (mouseInfo.buttons != 0);
@ -120,6 +123,25 @@ bool pollMouse(void)
}
}
oldMouseDown = newMouseDown;
gMouseInPoll = false;
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 void shutdownMouse(void);
extern bool pollMouse(void);
extern void moveMouseToSquare(tSquare square);
#endif /* defined(__a2bejwld__mouseWrapper__) */

View File

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