mirror of
https://github.com/jeremysrand/BuGS.git
synced 2024-12-29 13:29:27 +00:00
Add the code to add head segments once the centipede reaches the bottom of the screen.
This commit is contained in:
parent
6969da19b9
commit
a7d1db68e2
@ -14,7 +14,7 @@
|
|||||||
buildForAnalyzing = "YES">
|
buildForAnalyzing = "YES">
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "9D0B917C1F526C2D004D7E0B"
|
BlueprintIdentifier = "9D1716822491C49300C83148"
|
||||||
BuildableName = "BuGS"
|
BuildableName = "BuGS"
|
||||||
BlueprintName = "BuGS"
|
BlueprintName = "BuGS"
|
||||||
ReferencedContainer = "container:BuGS.xcodeproj">
|
ReferencedContainer = "container:BuGS.xcodeproj">
|
||||||
@ -29,8 +29,6 @@
|
|||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||||
<Testables>
|
<Testables>
|
||||||
</Testables>
|
</Testables>
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</TestAction>
|
</TestAction>
|
||||||
<LaunchAction
|
<LaunchAction
|
||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
@ -49,7 +47,7 @@
|
|||||||
<MacroExpansion>
|
<MacroExpansion>
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "9D0B917C1F526C2D004D7E0B"
|
BlueprintIdentifier = "9D1716822491C49300C83148"
|
||||||
BuildableName = "BuGS"
|
BuildableName = "BuGS"
|
||||||
BlueprintName = "BuGS"
|
BlueprintName = "BuGS"
|
||||||
ReferencedContainer = "container:BuGS.xcodeproj">
|
ReferencedContainer = "container:BuGS.xcodeproj">
|
||||||
@ -81,8 +79,6 @@
|
|||||||
isEnabled = "YES">
|
isEnabled = "YES">
|
||||||
</CommandLineArgument>
|
</CommandLineArgument>
|
||||||
</CommandLineArguments>
|
</CommandLineArguments>
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</LaunchAction>
|
</LaunchAction>
|
||||||
<ProfileAction
|
<ProfileAction
|
||||||
buildConfiguration = "Release"
|
buildConfiguration = "Release"
|
||||||
@ -93,7 +89,7 @@
|
|||||||
<MacroExpansion>
|
<MacroExpansion>
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "9D0B917C1F526C2D004D7E0B"
|
BlueprintIdentifier = "9D1716822491C49300C83148"
|
||||||
BuildableName = "BuGS"
|
BuildableName = "BuGS"
|
||||||
BlueprintName = "BuGS"
|
BlueprintName = "BuGS"
|
||||||
ReferencedContainer = "container:BuGS.xcodeproj">
|
ReferencedContainer = "container:BuGS.xcodeproj">
|
||||||
|
@ -249,11 +249,23 @@ updateSegments_spriteOffsetCont anop
|
|||||||
sta segmentSpriteOffset
|
sta segmentSpriteOffset
|
||||||
|
|
||||||
updateSegments_skipSpriteOffset anop
|
updateSegments_skipSpriteOffset anop
|
||||||
|
lda #SEGMENT_MAX_OFFSET+2
|
||||||
|
sta segmentEmptyOffset
|
||||||
ldx #SEGMENT_MAX_OFFSET
|
ldx #SEGMENT_MAX_OFFSET
|
||||||
updateSegments_nextSegment anop
|
updateSegments_nextSegment anop
|
||||||
lda segmentStates,x
|
lda segmentStates,x
|
||||||
bne updateSegments_cont
|
bne updateSegments_cont
|
||||||
|
stx segmentEmptyOffset
|
||||||
|
lda segmentPosOffset,x
|
||||||
|
beq updateSegments_emptyWrapPos
|
||||||
|
dec a
|
||||||
|
dec a
|
||||||
|
sta segmentPosOffset,x
|
||||||
jmp updateSegments_skipSegment
|
jmp updateSegments_skipSegment
|
||||||
|
updateSegments_emptyWrapPos anop
|
||||||
|
lda #SEGMENT_MAX_POSITION_OFFSET
|
||||||
|
sta segmentPosOffset,x
|
||||||
|
jmp updateSegments_skipSegment
|
||||||
updateSegments_cont anop
|
updateSegments_cont anop
|
||||||
cmp #SEGMENT_STATE_BODY
|
cmp #SEGMENT_STATE_BODY
|
||||||
bne updateSegments_headOrExploding
|
bne updateSegments_headOrExploding
|
||||||
@ -383,11 +395,89 @@ updateSegments_headCont anop
|
|||||||
updateSegments_skipSegment anop
|
updateSegments_skipSegment anop
|
||||||
dex
|
dex
|
||||||
dex
|
dex
|
||||||
bmi updateSegments_done
|
bmi updateSegments_maybeAdd
|
||||||
jmp updateSegments_nextSegment
|
jmp updateSegments_nextSegment
|
||||||
|
updateSegments_maybeAdd anop
|
||||||
|
lda segmentsAddEnabled
|
||||||
|
bne updateSegments_done
|
||||||
|
lda segmentEmptyOffset
|
||||||
|
cmp #SEGMENT_MAX_OFFSET+2
|
||||||
|
bge updateSegments_done
|
||||||
|
lda numSegments
|
||||||
|
beq updateSegments_done
|
||||||
|
cmp #SEGMENT_MAX_NUM
|
||||||
|
bge updateSegments_done
|
||||||
|
lda segmentPixelOffset
|
||||||
|
and #3
|
||||||
|
cmp #1
|
||||||
|
bne updateSegments_done
|
||||||
|
jsl rand0_to_65534
|
||||||
|
and #31
|
||||||
|
bne updateSegments_done
|
||||||
|
jmp updateSegmentAddSegment
|
||||||
updateSegments_done anop
|
updateSegments_done anop
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
|
updateSegmentAddSegment entry
|
||||||
|
inc numSegments
|
||||||
|
ldx segmentEmptyOffset
|
||||||
|
|
||||||
|
lda #SEGMENT_STATE_HEAD
|
||||||
|
sta segmentStates,x
|
||||||
|
|
||||||
|
lda #SEGMENT_SPEED_FAST
|
||||||
|
sta segmentSpeed,x
|
||||||
|
|
||||||
|
ldy segmentPosOffset,x
|
||||||
|
|
||||||
|
lda #SEGMENT_DIR_DOWN
|
||||||
|
sta segmentVerticalDir,y
|
||||||
|
|
||||||
|
jsl rand0_to_65534
|
||||||
|
and #$0080
|
||||||
|
beq updateSegmentAddSegment_leftSide
|
||||||
|
|
||||||
|
lda #SEGMENT_DIR_LEFT
|
||||||
|
sta segmentHorizontalDir,y
|
||||||
|
|
||||||
|
lda #SEGMENT_FACING_LEFT
|
||||||
|
sta segmentFacing,y
|
||||||
|
|
||||||
|
ldx #((GAME_NUM_TILES_WIDE*(GAME_NUM_TILES_TALL-6))-1)*SIZEOF_TILE_INFO
|
||||||
|
|
||||||
|
lda tileScreenOffset,x
|
||||||
|
sta segmentScreenOffsets,y
|
||||||
|
|
||||||
|
txa
|
||||||
|
sta segmentTileOffsetsUL,y
|
||||||
|
sta segmentTileOffsetsLL,y
|
||||||
|
sta segmentCurrentTile,y
|
||||||
|
lda tileRight,x
|
||||||
|
sta segmentTileOffsetsUR,y
|
||||||
|
sta segmentTileOffsetsLR,y
|
||||||
|
rtl
|
||||||
|
|
||||||
|
updateSegmentAddSegment_leftSide anop
|
||||||
|
lda #SEGMENT_DIR_RIGHT
|
||||||
|
sta segmentHorizontalDir,y
|
||||||
|
|
||||||
|
lda #SEGMENT_FACING_RIGHT
|
||||||
|
sta segmentFacing,y
|
||||||
|
|
||||||
|
ldx #(GAME_NUM_TILES_WIDE*(GAME_NUM_TILES_TALL-7))*SIZEOF_TILE_INFO
|
||||||
|
lda tileScreenOffset,x
|
||||||
|
sec
|
||||||
|
sbc #6
|
||||||
|
sta segmentScreenOffsets,y
|
||||||
|
|
||||||
|
txa
|
||||||
|
sta segmentTileOffsetsUR,y
|
||||||
|
sta segmentTileOffsetsLR,y
|
||||||
|
sta segmentCurrentTile,y
|
||||||
|
lda tileLeft,x
|
||||||
|
sta segmentTileOffsetsUL,y
|
||||||
|
sta segmentTileOffsetsLL,y
|
||||||
|
rtl
|
||||||
|
|
||||||
updateSegmentExplodingNoWrap entry
|
updateSegmentExplodingNoWrap entry
|
||||||
lda segmentFacing+2,y
|
lda segmentFacing+2,y
|
||||||
@ -506,12 +596,18 @@ updateSegmentLeftFast_dirDown anop
|
|||||||
cmp #(NUM_GAME_TILES-GAME_NUM_TILES_WIDE)*SIZEOF_TILE_INFO
|
cmp #(NUM_GAME_TILES-GAME_NUM_TILES_WIDE)*SIZEOF_TILE_INFO
|
||||||
blt updateSegmentLeftFast_doDown
|
blt updateSegmentLeftFast_doDown
|
||||||
; If the head segment was poisoned, it is no longer poisoned once the head is going up again.
|
; If the head segment was poisoned, it is no longer poisoned once the head is going up again.
|
||||||
|
lda #SEGMENT_DIR_UP
|
||||||
|
sta segmentVerticalDir,y
|
||||||
ldx segmentBeingUpdated
|
ldx segmentBeingUpdated
|
||||||
|
lda segmentStates,x
|
||||||
|
cmp #SEGMENT_STATE_HEAD
|
||||||
|
beq updateSegmentLeftFast_notPoisoned
|
||||||
lda #SEGMENT_STATE_HEAD
|
lda #SEGMENT_STATE_HEAD
|
||||||
sta segmentStates,x
|
sta segmentStates,x
|
||||||
lda #SEGMENT_DIR_UP
|
|
||||||
sta segmentVerticalDir,y
|
|
||||||
bra updateSegmentLeftFast_doUp
|
bra updateSegmentLeftFast_doUp
|
||||||
|
updateSegmentLeftFast_notPoisoned anop
|
||||||
|
stz segmentsAddEnabled
|
||||||
|
bra updateSegmentLeftFast_doUp
|
||||||
|
|
||||||
updateSegmentLeftFast_doDown anop
|
updateSegmentLeftFast_doDown anop
|
||||||
lda segmentScreenOffsets,y
|
lda segmentScreenOffsets,y
|
||||||
@ -641,12 +737,18 @@ updateSegmentLeftSlow_dirDown anop
|
|||||||
cmp #(NUM_GAME_TILES-GAME_NUM_TILES_WIDE)*SIZEOF_TILE_INFO
|
cmp #(NUM_GAME_TILES-GAME_NUM_TILES_WIDE)*SIZEOF_TILE_INFO
|
||||||
blt updateSegmentLeftSlow_doDown
|
blt updateSegmentLeftSlow_doDown
|
||||||
; If the head segment was poisoned, it is no longer poisoned once the head is going up again.
|
; If the head segment was poisoned, it is no longer poisoned once the head is going up again.
|
||||||
|
lda #SEGMENT_DIR_UP
|
||||||
|
sta segmentVerticalDir,y
|
||||||
ldx segmentBeingUpdated
|
ldx segmentBeingUpdated
|
||||||
|
lda segmentStates,x
|
||||||
|
cmp #SEGMENT_STATE_HEAD
|
||||||
|
beq updateSegmentLeftSlow_notPoisoned
|
||||||
lda #SEGMENT_STATE_HEAD
|
lda #SEGMENT_STATE_HEAD
|
||||||
sta segmentStates,x
|
sta segmentStates,x
|
||||||
lda #SEGMENT_DIR_UP
|
|
||||||
sta segmentVerticalDir,y
|
|
||||||
bra updateSegmentLeftSlow_doUp
|
bra updateSegmentLeftSlow_doUp
|
||||||
|
updateSegmentLeftSlow_notPoisoned anop
|
||||||
|
stz segmentsAddEnabled
|
||||||
|
bra updateSegmentLeftSlow_doUp
|
||||||
|
|
||||||
updateSegmentLeftSlow_doDown anop
|
updateSegmentLeftSlow_doDown anop
|
||||||
lda segmentScreenOffsets,y
|
lda segmentScreenOffsets,y
|
||||||
@ -1074,12 +1176,18 @@ updateSegmentRightFast_dirDown anop
|
|||||||
cmp #(NUM_GAME_TILES-GAME_NUM_TILES_WIDE)*SIZEOF_TILE_INFO
|
cmp #(NUM_GAME_TILES-GAME_NUM_TILES_WIDE)*SIZEOF_TILE_INFO
|
||||||
blt updateSegmentRightFast_doDown
|
blt updateSegmentRightFast_doDown
|
||||||
; If the head segment was poisoned, it is no longer poisoned once the head is going up again.
|
; If the head segment was poisoned, it is no longer poisoned once the head is going up again.
|
||||||
|
lda #SEGMENT_DIR_UP
|
||||||
|
sta segmentVerticalDir,y
|
||||||
ldx segmentBeingUpdated
|
ldx segmentBeingUpdated
|
||||||
|
lda segmentStates,x
|
||||||
|
cmp #SEGMENT_STATE_HEAD
|
||||||
|
beq updateSegmentRightFast_notPoisoned
|
||||||
lda #SEGMENT_STATE_HEAD
|
lda #SEGMENT_STATE_HEAD
|
||||||
sta segmentStates,x
|
sta segmentStates,x
|
||||||
lda #SEGMENT_DIR_UP
|
|
||||||
sta segmentVerticalDir,y
|
|
||||||
bra updateSegmentRightFast_doUp
|
bra updateSegmentRightFast_doUp
|
||||||
|
updateSegmentRightFast_notPoisoned anop
|
||||||
|
stz segmentsAddEnabled
|
||||||
|
bra updateSegmentRightFast_doUp
|
||||||
|
|
||||||
updateSegmentRightFast_doDown anop
|
updateSegmentRightFast_doDown anop
|
||||||
lda segmentScreenOffsets,y
|
lda segmentScreenOffsets,y
|
||||||
@ -1209,11 +1317,17 @@ updateSegmentRightSlow_dirDown anop
|
|||||||
cmp #(NUM_GAME_TILES-GAME_NUM_TILES_WIDE)*SIZEOF_TILE_INFO
|
cmp #(NUM_GAME_TILES-GAME_NUM_TILES_WIDE)*SIZEOF_TILE_INFO
|
||||||
blt updateSegmentRightSlow_doDown
|
blt updateSegmentRightSlow_doDown
|
||||||
; If the head segment was poisoned, it is no longer poisoned once the head is going up again.
|
; If the head segment was poisoned, it is no longer poisoned once the head is going up again.
|
||||||
ldx segmentBeingUpdated
|
lda #SEGMENT_DIR_UP
|
||||||
|
sta segmentVerticalDir,y
|
||||||
|
ldx segmentBeingUpdated
|
||||||
|
lda segmentStates,x
|
||||||
|
cmp #SEGMENT_STATE_HEAD
|
||||||
|
beq updateSegmentRightSlow_notPoisoned
|
||||||
lda #SEGMENT_STATE_HEAD
|
lda #SEGMENT_STATE_HEAD
|
||||||
sta segmentStates,x
|
sta segmentStates,x
|
||||||
lda #SEGMENT_DIR_UP
|
bra updateSegmentRightSlow_doUp
|
||||||
sta segmentVerticalDir,y
|
updateSegmentRightSlow_notPoisoned anop
|
||||||
|
stz segmentsAddEnabled
|
||||||
bra updateSegmentRightSlow_doUp
|
bra updateSegmentRightSlow_doUp
|
||||||
|
|
||||||
updateSegmentRightSlow_doDown anop
|
updateSegmentRightSlow_doDown anop
|
||||||
@ -1469,6 +1583,8 @@ addSlowHeadSegment entry
|
|||||||
inc numSegments
|
inc numSegments
|
||||||
lda #5
|
lda #5
|
||||||
sta segmentPixelOffset
|
sta segmentPixelOffset
|
||||||
|
lda #1
|
||||||
|
sta segmentsAddEnabled
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
@ -1517,6 +1633,8 @@ addFastHeadSegment entry
|
|||||||
inc numSegments
|
inc numSegments
|
||||||
lda #5
|
lda #5
|
||||||
sta segmentPixelOffset
|
sta segmentPixelOffset
|
||||||
|
lda #1
|
||||||
|
sta segmentsAddEnabled
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
@ -1579,6 +1697,7 @@ shootRandomSegment_hasSegments anop
|
|||||||
|
|
||||||
|
|
||||||
numSegments dc i2'0'
|
numSegments dc i2'0'
|
||||||
|
segmentsAddEnabled dc i2'1'
|
||||||
|
|
||||||
; The method used to track a segments position and other details on the screen are a bit
|
; The method used to track a segments position and other details on the screen are a bit
|
||||||
; funky. In order to have body segments follow a head segment, we keep information from
|
; funky. In order to have body segments follow a head segment, we keep information from
|
||||||
@ -1610,6 +1729,7 @@ SEGMENT_SPRITE_LAST_OFFSET gequ 7*4
|
|||||||
segmentSpriteOffset dc i2'0'
|
segmentSpriteOffset dc i2'0'
|
||||||
segmentPixelOffset dc i2'0'
|
segmentPixelOffset dc i2'0'
|
||||||
segmentBeingUpdated dc i2'0'
|
segmentBeingUpdated dc i2'0'
|
||||||
|
segmentEmptyOffset dc i2'0'
|
||||||
|
|
||||||
|
|
||||||
headJumpTable anop
|
headJumpTable anop
|
||||||
|
@ -8,7 +8,7 @@ s6d2 =
|
|||||||
|
|
||||||
s7d1 = /Users/jrand/Library/Developer/Xcode/DerivedData/BuGS-bffpexoblaghkzcbtjtzxeulnuto/Build/Products/Debug/BuGS.2mg
|
s7d1 = /Users/jrand/Library/Developer/Xcode/DerivedData/BuGS-bffpexoblaghkzcbtjtzxeulnuto/Build/Products/Debug/BuGS.2mg
|
||||||
|
|
||||||
g_limit_speed = 0
|
g_limit_speed = 3
|
||||||
|
|
||||||
|
|
||||||
bram1[00] = 00 00 00 01 00 00 0d 06 02 01 01 00 01 00 00 00
|
bram1[00] = 00 00 00 01 00 00 0d 06 02 01 01 00 01 00 00 00
|
||||||
|
Loading…
Reference in New Issue
Block a user