mirror of
https://github.com/blondie7575/GSCats.git
synced 2025-01-08 12:30:24 +00:00
Added mining and currency spend for weapons
This commit is contained in:
parent
7d3ae38f8f
commit
ee42046090
10
font.s
10
font.s
@ -196,12 +196,12 @@ s_Number:
|
||||
qbyte $00F00F00
|
||||
|
||||
s_Dollar:
|
||||
qbyte $000F0F00
|
||||
qbyte $00FFFFF0
|
||||
qbyte $0F0F0F00
|
||||
qbyte $00FFFF00
|
||||
qbyte $000F0FF0
|
||||
qbyte $0FFFFF00
|
||||
qbyte $0F000FF0
|
||||
qbyte $0F000FF0
|
||||
qbyte $0FFFFFF0
|
||||
qbyte $00FFFF00
|
||||
qbyte $00000000
|
||||
|
||||
s_Percent:
|
||||
qbyte $0FF000F0
|
||||
|
@ -372,6 +372,7 @@ fire:
|
||||
stz fireRequested
|
||||
ldy currentPlayer
|
||||
jsr playerFire
|
||||
jsr renderPlayerHeader
|
||||
rts
|
||||
|
||||
|
||||
|
BIN
gscats.2mg
BIN
gscats.2mg
Binary file not shown.
37
inventory.s
37
inventory.s
@ -29,7 +29,7 @@ renderInventory:
|
||||
tya
|
||||
clc
|
||||
adc #playerData
|
||||
adc #PD_INVENTORY
|
||||
adc #PD_PRICES
|
||||
sta PARAML1
|
||||
|
||||
; Compute initial VRAM position ($E1-relative)
|
||||
@ -114,13 +114,22 @@ renderInventoryItem_unselected:
|
||||
lda (PARAML1),y
|
||||
sta PARAML0
|
||||
jsr intToString
|
||||
|
||||
; Prepend currency prefix to counter string
|
||||
BITS8A
|
||||
lda intToStringResult
|
||||
inc
|
||||
sta intToStringPrefix
|
||||
lda #':' ; Colon maps to dollar sign in tiny number font
|
||||
sta intToStringResult
|
||||
BITS16
|
||||
|
||||
sec
|
||||
pla
|
||||
sbc #($2000 - 160*2)-1 ; Font engine wants VRAM-relative
|
||||
tax
|
||||
lda #intToStringResult
|
||||
jsr DrawNumber
|
||||
lda #intToStringPrefix
|
||||
jsr DrawTinyNumber
|
||||
|
||||
renderInventoryItem_done:
|
||||
RESTORE_AXY
|
||||
@ -133,3 +142,25 @@ renderInventoryItem_abort:
|
||||
renderInventoryItemIndex:
|
||||
.word 0
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; awardTreats
|
||||
;
|
||||
; PARAML0 = Amount to award
|
||||
;
|
||||
awardTreats:
|
||||
SAVE_AY
|
||||
|
||||
ldy currentPlayer
|
||||
PLAYERPTR_Y
|
||||
|
||||
clc
|
||||
lda playerData+PD_TREATS,y
|
||||
adc PARAML0
|
||||
sta playerData+PD_TREATS,y
|
||||
|
||||
ldy currentPlayer
|
||||
jsr renderPlayerHeader
|
||||
|
||||
RESTORE_AY
|
||||
rts
|
||||
|
53
player.s
53
player.s
@ -7,6 +7,7 @@
|
||||
|
||||
|
||||
playerData:
|
||||
;;;;;;;;;;;; PLAYER 1 ;;;;;;;;;;;;;;
|
||||
; gameobject data
|
||||
.word 0 ; X pos in pixels (from left terrain edge)
|
||||
.word 0 ; Y pos in pixels (from bottom terrain edge)
|
||||
@ -20,13 +21,15 @@ playerData:
|
||||
.word 100 ; Anger
|
||||
.byte 8,"SPROCKET " ; Name
|
||||
.word 1 ; Base Sprite
|
||||
.word 0,5,5,0,0,0,0,0 ; Inventory
|
||||
.word 0,5,7,0,0,0,0,0 ; Prices
|
||||
.word 0 ; Current weapon
|
||||
.word 7 ; Treats
|
||||
|
||||
.repeat 88
|
||||
.repeat 86
|
||||
.byte 0 ; Padding to 256-byte boundary
|
||||
.endrepeat
|
||||
|
||||
;;;;;;;;;;;; PLAYER 2 ;;;;;;;;;;;;;;
|
||||
; gameobject data
|
||||
.word 0 ; X pos in pixels (from left terrain edge)
|
||||
.word 0 ; Y pos in pixels (from bottom terrain edge)
|
||||
@ -35,15 +38,16 @@ playerData:
|
||||
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
|
||||
.word 155 ; Angle in degrees from +X
|
||||
.word 155 ; Angle in degrees from +X
|
||||
.word 2 ; Power
|
||||
.word 100 ; Anger
|
||||
.word 100 ; Anger
|
||||
.byte 8,"TINKER " ; Name
|
||||
.word 0 ; Base Sprite
|
||||
.word 0,5,5,0,0,0,0,0 ; Inventory
|
||||
.word 0,5,7,0,0,0,0,0 ; Prices
|
||||
.word 0 ; Current weapon
|
||||
.word 7 ; Treats
|
||||
|
||||
.repeat 88
|
||||
.repeat 86
|
||||
.byte 0 ; Padding to 256-byte boundary
|
||||
.endrepeat
|
||||
|
||||
@ -52,8 +56,9 @@ PD_POWER = 134
|
||||
PD_ANGER = 136
|
||||
PD_NAME = 138
|
||||
PD_BASESPRITE = 148
|
||||
PD_INVENTORY = 150
|
||||
PD_PRICES = 150
|
||||
PD_CURRWEAPON = 166
|
||||
PD_TREATS = 168
|
||||
PD_SIZE = 256
|
||||
|
||||
.macro PLAYERPTR_Y
|
||||
@ -172,30 +177,32 @@ playerDeltaPowerClampHigh:
|
||||
; playerFire
|
||||
;
|
||||
; Y = Player index
|
||||
; Trashes SCRATCHL
|
||||
; Trashes SCRATCHL,SCRATCHL2
|
||||
;
|
||||
playerFire:
|
||||
SAVE_AX
|
||||
SAVE_AXY
|
||||
PLAYERPTR_Y
|
||||
|
||||
; Check for inventory
|
||||
; Check that we can afford it
|
||||
lda playerData+PD_CURRWEAPON,y
|
||||
pha
|
||||
asl
|
||||
tax
|
||||
beq playerFire_infiniteAmmo ; Weapon 0 is always infinite
|
||||
stx SCRATCHL
|
||||
lda #playerData+PD_INVENTORY
|
||||
lda #playerData+PD_PRICES
|
||||
clc
|
||||
adc SCRATCHL
|
||||
sta SCRATCHL
|
||||
lda (SCRATCHL),y
|
||||
beq playerFire_abort
|
||||
dec ; Consume ammo
|
||||
sta (SCRATCHL),y
|
||||
dec inventoryDirty
|
||||
sta SCRATCHL
|
||||
|
||||
playerFire_infiniteAmmo:
|
||||
lda playerData+PD_TREATS,y
|
||||
cmp SCRATCHL
|
||||
bmi playerFire_abort
|
||||
|
||||
sec ; Spend money
|
||||
sbc SCRATCHL
|
||||
sta playerData+PD_TREATS,y
|
||||
|
||||
; Prepare projectile parameters
|
||||
pla
|
||||
@ -213,7 +220,7 @@ playerFire_infiniteAmmo:
|
||||
jsr fireProjectile
|
||||
|
||||
playerFire_done:
|
||||
RESTORE_AX
|
||||
RESTORE_AXY
|
||||
rts
|
||||
|
||||
playerFire_abort:
|
||||
@ -358,6 +365,14 @@ renderPlayerHeader:
|
||||
ldx #96 + 321
|
||||
jsr drawNumber
|
||||
|
||||
lda #treatsStr
|
||||
ldx #126 + 321
|
||||
jsr DrawString
|
||||
|
||||
lda playerData+PD_TREATS,y
|
||||
ldx #130 + 321
|
||||
jsr drawNumber
|
||||
|
||||
RESTORE_AXY
|
||||
rts
|
||||
|
||||
@ -367,5 +382,7 @@ powerStr:
|
||||
pstring "+: "
|
||||
angerStr:
|
||||
pstring "): "
|
||||
treatsStr:
|
||||
pstring "$ "
|
||||
|
||||
|
||||
|
35
projectile.s
35
projectile.s
@ -104,8 +104,9 @@ projectileTypes:
|
||||
.addr 0 ; Render
|
||||
.addr 0 ; Cleanup
|
||||
.word 1 ; Directional
|
||||
.word 1 ; Mining
|
||||
|
||||
.repeat 12
|
||||
.repeat 10
|
||||
.byte 0 ; Padding to 32-byte boundary
|
||||
.endrepeat
|
||||
|
||||
@ -120,8 +121,9 @@ projectileTypes:
|
||||
.addr 0 ; Render
|
||||
.addr 0 ; Cleanup
|
||||
.word 0 ; Directional
|
||||
.word 0 ; Mining
|
||||
|
||||
.repeat 12
|
||||
.repeat 10
|
||||
.byte 0 ; Padding to 32-byte boundary
|
||||
.endrepeat
|
||||
|
||||
@ -136,8 +138,10 @@ projectileTypes:
|
||||
.addr renderFan ; Render
|
||||
.addr deleteFan ; Cleanup
|
||||
.word 1 ; Directional
|
||||
.word 0 ; Mining
|
||||
|
||||
.repeat 12
|
||||
.repeat 10
|
||||
|
||||
.byte 0 ; Padding to 32-byte boundary
|
||||
.endrepeat
|
||||
|
||||
@ -152,6 +156,7 @@ PT_UPDATE = 12
|
||||
PT_RENDER = 14
|
||||
PT_CLEANUP = 16
|
||||
PT_DIRECTIONAL = 18
|
||||
PT_MINING = 20
|
||||
|
||||
.macro PROJECTILEPTR_Y
|
||||
tya ; Pointer to projectile structure from index
|
||||
@ -890,14 +895,14 @@ processTerrainImpact:
|
||||
lda projectileData+GO_POSX,y
|
||||
clc
|
||||
adc #GAMEOBJECTWIDTH/2+1 ; A fudge that makes crater location look better in this direction, and tunneling work better
|
||||
bra processTerrainStoreContinue
|
||||
bra processTerrainImpactStoreContinue
|
||||
|
||||
processTerrainImpactNegative:
|
||||
lda projectileData+GO_POSX,y
|
||||
clc
|
||||
adc #GAMEOBJECTWIDTH/4-1 ; A fudge that makes crater location look better in this direction, and tunneling work better
|
||||
|
||||
processTerrainStoreContinue:
|
||||
processTerrainImpactStoreContinue:
|
||||
sta PARAML0
|
||||
pha ; Dirt explosion will need this
|
||||
lda projectileData+GO_POSY,y
|
||||
@ -916,7 +921,7 @@ processTerrainStoreContinue:
|
||||
|
||||
jsr craterTerrain
|
||||
|
||||
jsr unclipTerrain
|
||||
jsr unclipTerrain
|
||||
|
||||
; Recompile the rows affected by the crater
|
||||
clc
|
||||
@ -943,4 +948,22 @@ processTerrainStoreContinue:
|
||||
sta PARAML0
|
||||
jsr createDirtExplosion
|
||||
|
||||
; Cash in the dirt if needed
|
||||
ldy projectileActive
|
||||
lda projectileData+JD_TYPE,y
|
||||
tay
|
||||
PROJECTILETYPEPTR_Y
|
||||
|
||||
lda projectileTypes+PT_MINING,y
|
||||
beq processTerrainImpactDone
|
||||
lda craterTerrainAccumulator
|
||||
lsr ; Dirt to treats conversion rate
|
||||
lsr
|
||||
lsr
|
||||
inc ; Ensure minimum one treat
|
||||
sta PARAML0
|
||||
jsr awardTreats
|
||||
|
||||
processTerrainImpactDone:
|
||||
rts
|
||||
|
||||
|
@ -12,7 +12,7 @@ F_CURRPOS: .word 0 ;current top left char position
|
||||
F_NUMPTR = $06 ;pointer to string (including length byte) / DP
|
||||
|
||||
|
||||
DrawNumber:
|
||||
DrawTinyNumber:
|
||||
SAVE_AXY
|
||||
|
||||
sta F_NUMPTR
|
||||
@ -85,6 +85,7 @@ DigitTable:
|
||||
.addr s_7
|
||||
.addr s_8
|
||||
.addr s_9
|
||||
.addr s_SmallDollar ; Use ASCII code for colon
|
||||
|
||||
DigitData:
|
||||
|
||||
@ -158,3 +159,10 @@ s_9:
|
||||
fontword $00F0
|
||||
fontword $00F0
|
||||
|
||||
s_SmallDollar: ; Use ASCII code for colon
|
||||
.dbyt $a66a
|
||||
.dbyt $6F66
|
||||
.dbyt $6666
|
||||
.dbyt $a66a
|
||||
.dbyt $aaaa
|
||||
|
||||
|
13
terrain.s
13
terrain.s
@ -69,6 +69,7 @@ renderTerrainDone:
|
||||
craterTerrain:
|
||||
SAVE_AX
|
||||
|
||||
stz craterTerrainAccumulator
|
||||
lda #TERRAINWIDTH ; Convert X pos to terrain-right byte count
|
||||
sec
|
||||
sbc PARAML0
|
||||
@ -108,11 +109,17 @@ craterTerrainLoop:
|
||||
adc PARAML1 ; Convert to terrain-space
|
||||
bmi craterTerrainZero
|
||||
sta SCRATCHL2
|
||||
sec
|
||||
lda (PARAML0),y
|
||||
cmp SCRATCHL2
|
||||
sbc SCRATCHL2
|
||||
bmi craterTerrainLoop
|
||||
|
||||
lda SCRATCHL2 ; Circle value is lower, so use that
|
||||
; Circle value is lower, so use that
|
||||
clc
|
||||
adc craterTerrainAccumulator ; Track total crater material
|
||||
sta craterTerrainAccumulator
|
||||
|
||||
lda SCRATCHL2 ; Replace terrain height with cratered value
|
||||
sta (PARAML0),y
|
||||
bra craterTerrainLoop
|
||||
|
||||
@ -128,6 +135,8 @@ craterTerrainDone:
|
||||
RESTORE_AX
|
||||
rts
|
||||
|
||||
craterTerrainAccumulator:
|
||||
.word 0
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; clipTerrain
|
||||
|
Loading…
Reference in New Issue
Block a user