diff --git a/BuGS.xcodeproj/project.pbxproj b/BuGS.xcodeproj/project.pbxproj index 4c360d2..7630ecf 100644 --- a/BuGS.xcodeproj/project.pbxproj +++ b/BuGS.xcodeproj/project.pbxproj @@ -77,7 +77,7 @@ 9D3396FF24AED09D003222B3 /* sprites.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = sprites.md; sourceTree = ""; }; 9D33970024AEFBF2003222B3 /* segments.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = segments.s; sourceTree = ""; }; 9D33970124AF9D55003222B3 /* sprites.macros */ = {isa = PBXFileReference; lastKnownFileType = text; path = sprites.macros; sourceTree = ""; }; - 9D47CBE02547BEDB00CDA5CB /* gameMushroom.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gameMushroom.s; sourceTree = ""; }; + 9D47CBE02547BEDB00CDA5CB /* gameMushroom.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gameMushroom.s; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.asm.orcam; }; 9D47CC14254A698900CDA5CB /* gamePlayer.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gamePlayer.s; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.asm.orcam; }; 9D47CCBA25525C1A00CDA5CB /* tileData.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = tileData.pl; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.perl; }; 9D53E5B32562320300E10169 /* gameShot.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gameShot.s; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.asm.orcam; }; diff --git a/BuGS/gameMushroom.s b/BuGS/gameMushroom.s index 53c0355..594f79b 100644 --- a/BuGS/gameMushroom.s +++ b/BuGS/gameMushroom.s @@ -19,12 +19,75 @@ STARTING_NUM_MUSHROOMS equ 30 resetMushrooms entry -; TODO - Write this code... + lda mushroomToRefresh + cmp #INVALID_TILE_NUM + beq resetMushrooms_startFromBeginning + tax + lda mushroomExplosionSprite + beq resetMushrooms_doneReset + sec + sbc #4 + +resetMushrooms_explode anop + sta mushroomExplosionSprite + tay + lda explosionJumpTable,y + sta resetMushrooms_jumpInst+1 + lda explosionJumpTable+2,y + sta resetMushrooms_jumpInst+3 + lda #TILE_STATE_DIRTY + sta tileDirty,x + lda tileScreenOffset,x + sec + sbc #3 + tay + jsl resetMushrooms_jumpInst + sec + rtl + +resetMushrooms_jumpInst anop + jmp >explosion1 + nop + +resetMushrooms_doneReset anop + txa + inx + inx + bra resetMushrooms_loop +resetMushrooms_startFromBeginning anop + ldx #0 + +resetMushrooms_loop anop + cpx #RHS_FIRST_TILE_OFFSET + blt resetMushrooms_keepChecking + lda #INVALID_TILE_NUM + sta mushroomToRefresh clc rtl + +resetMushrooms_keepChecking anop + lda tileType,x + beq resetMushrooms_next + cmp #TILE_MUSHROOM4 + beq resetMushrooms_next + stx mushroomToRefresh + lda #TILE_MUSHROOM4 + sta tileType,x + jsl scoreAddFive + ldx mushroomToRefresh + lda #EXPLOSION_LAST_OFFSET + bra resetMushrooms_explode + +resetMushrooms_next anop + inx + inx + bra resetMushrooms_loop + addRandomMushrooms entry stz numInfieldMushrooms + lda #INVALID_TILE_NUM + sta mushroomToRefresh ldy #STARTING_NUM_MUSHROOMS addRandomMushrooms_loop anop @@ -83,4 +146,9 @@ shootMushroom_poisonedNoScore anop shootMushroom_done anop rtl + +mushroomToRefresh dc i2'INVALID_TILE_NUM' +mushroomExplosionSprite dc i2'0' + + end diff --git a/TODO.md b/TODO.md index fcc6745..0a4d2fe 100644 --- a/TODO.md +++ b/TODO.md @@ -2,7 +2,6 @@ TODO ======= * Implement a high score list and save the high scores across restarts -* When the player dies, the mushrooms need to be reset and the score incremented for damaged and poisoned mushrooms. * Implement the code to support pausing the game * Implement the code for supporting a two player game * So much more.