Add the ability to see the star state of a gem.

This commit is contained in:
Jeremy Rand 2016-07-20 23:55:29 -05:00
parent 2b92b2684a
commit 3573f8e9d4
4 changed files with 48 additions and 5 deletions

View File

@ -26,6 +26,8 @@ void __fastcall__ drawOrangeGem(tSquare square);
void __fastcall__ drawGreyGem(tSquare square);
void __fastcall__ drawPurpleGem(tSquare square);
void __fastcall__ starGem(tSquare square);
void __fastcall__ selectSquare(tSquare square);

View File

@ -10,6 +10,7 @@
.export _drawGreenGem, _drawPurpleGem, _drawYellowGem
.export _drawBlueGem, _drawRedGem, _drawGreyGem
.export _drawOrangeGem, _drawBgSquare, _selectSquare
.export _starGem
.include "apple2.inc"
@ -415,6 +416,42 @@ square: .BYTE $0
jmp _drawGem
.endproc
.proc _starGem
; A is the square position (from 0 to 63)
; 0 through 7 are on the top row
sta square
and #7
asl
asl
inc A
inc A
sta xPos
lda square
lsr
lsr
lsr
; Get line addrs
tax
lda bgLoLines2,X
clc
adc xPos
sta line2addr
lda bgHiLines2,X
sta line2addr+1
sta HISCR
lda #$ff
sta (line2addr)
rts
; Locals
xPos: .BYTE $0
square: .BYTE $0
.endproc
.DATA
lineAddrs:

View File

@ -362,6 +362,9 @@ static bool dropGems(void)
GEM_TYPE_AT_SQUARE(destSquare) = gemType;
GEM_STARRED_AT_SQUARE(destSquare) = GEM_STARRED_AT_SQUARE(square);
gSquareRefresh(destSquare);
GEM_TYPE_AT_SQUARE(square) = GEM_NONE;
GEM_STARRED_AT_SQUARE(square) = false;
gSquareRefresh(square);
destY--;
destSquare = XY_TO_SQUARE(x, destY);
}
@ -369,18 +372,16 @@ static bool dropGems(void)
}
if (destSquare != NUM_SQUARES) {
// DEBUG
if (result)
cgetc();
cgetc();
// DBEUG
for (y = destY; y >= 0; y--) {
square = XY_TO_SQUARE(x, y);
GEM_TYPE_AT_SQUARE(square) = randomGem();
GEM_STARRED_AT_SQUARE(square) = false;
gSquareRefresh(destSquare);
gSquareRefresh(square);
}
// DEBUG
if (result)
cgetc();
cgetc();
// DBEUG
}
}

View File

@ -120,6 +120,9 @@ static void refreshSquare(tSquare square)
{
drawBgSquare(square);
drawGemAtSquare(square);
if (gemIsStarredAtSquare(square))
starGem(square);
}