mirror of
https://github.com/blondie7575/GSCats.git
synced 2024-11-29 06:49:51 +00:00
Fixed several rendering and input bugs
This commit is contained in:
parent
4525010273
commit
c7efb24fe7
@ -52,6 +52,9 @@ gameplayLoop:
|
|||||||
jsr renderPlayers
|
jsr renderPlayers
|
||||||
|
|
||||||
gameplayLoopKbd:
|
gameplayLoopKbd:
|
||||||
|
lda projectileActive
|
||||||
|
bpl gameplayLoopProjectiles ; Skip input during shots
|
||||||
|
|
||||||
; Check for keys down
|
; Check for keys down
|
||||||
jsr kbdScan
|
jsr kbdScan
|
||||||
|
|
||||||
@ -72,6 +75,7 @@ gameplayLoopFire:
|
|||||||
jsr fire
|
jsr fire
|
||||||
|
|
||||||
gameplayLoopProjectiles:
|
gameplayLoopProjectiles:
|
||||||
|
sta KBDSTROBE
|
||||||
jsr unrenderProjectiles
|
jsr unrenderProjectiles
|
||||||
jsr updateProjectiles
|
jsr updateProjectiles
|
||||||
jsr renderProjectiles
|
jsr renderProjectiles
|
||||||
@ -137,7 +141,7 @@ scrollMap:
|
|||||||
asl
|
asl
|
||||||
sta leftScreenEdge
|
sta leftScreenEdge
|
||||||
clc
|
clc
|
||||||
adc #160-GAMEOBJECTWIDTH/4
|
adc #160-GAMEOBJECTWIDTH/4-1
|
||||||
sta rightScreenEdge
|
sta rightScreenEdge
|
||||||
|
|
||||||
jsr clipTerrain
|
jsr clipTerrain
|
||||||
@ -199,6 +203,8 @@ currentPlayer:
|
|||||||
.word 0
|
.word 0
|
||||||
gameOver:
|
gameOver:
|
||||||
.word -1 ; Player index of winner
|
.word -1 ; Player index of winner
|
||||||
|
projectileActive:
|
||||||
|
.word -1
|
||||||
|
|
||||||
|
|
||||||
; Position of map viewing window. Can be visualized in two ways:
|
; Position of map viewing window. Can be visualized in two ways:
|
||||||
@ -210,4 +216,4 @@ mapScrollPos:
|
|||||||
leftScreenEdge:
|
leftScreenEdge:
|
||||||
.word 0
|
.word 0
|
||||||
rightScreenEdge:
|
rightScreenEdge:
|
||||||
.word 160-GAMEOBJECTWIDTH/4
|
.word 160-GAMEOBJECTWIDTH/4-1
|
||||||
|
15
gameobject.s
15
gameobject.s
@ -203,6 +203,11 @@ renderGameobjectDone:
|
|||||||
; X
|
; X
|
||||||
lda ptr+GO_POSX,y
|
lda ptr+GO_POSX,y
|
||||||
lsr
|
lsr
|
||||||
|
cmp leftScreenEdge
|
||||||
|
bmi unrenderGameobjectSkip ; Gameobject is off left edge of screen
|
||||||
|
cmp rightScreenEdge
|
||||||
|
bpl unrenderGameobjectSkip ; Gameobject is off right edge of screen
|
||||||
|
|
||||||
sec
|
sec
|
||||||
sbc leftScreenEdge
|
sbc leftScreenEdge
|
||||||
sta SCRATCHL
|
sta SCRATCHL
|
||||||
@ -211,6 +216,10 @@ renderGameobjectDone:
|
|||||||
sec
|
sec
|
||||||
lda #200
|
lda #200
|
||||||
sbc ptr+GO_POSY,y
|
sbc ptr+GO_POSY,y
|
||||||
|
bmi unrenderGameobjectSkip ; Gameobject is off top edge of screen
|
||||||
|
cmp #200 - GAMEOBJECTHEIGHT
|
||||||
|
bpl unrenderGameobjectSkip ; Gameobject is off bottom edge of screen
|
||||||
|
|
||||||
asl
|
asl
|
||||||
tax
|
tax
|
||||||
lda vramYOffset,x
|
lda vramYOffset,x
|
||||||
@ -218,6 +227,12 @@ renderGameobjectDone:
|
|||||||
adc SCRATCHL
|
adc SCRATCHL
|
||||||
tax ; X now contains the VRAM offset of the upper left corner
|
tax ; X now contains the VRAM offset of the upper left corner
|
||||||
|
|
||||||
|
bra unrenderGameobjectBackground
|
||||||
|
|
||||||
|
unrenderGameobjectSkip:
|
||||||
|
jmp unrenderGameobjectDone
|
||||||
|
|
||||||
|
unrenderGameobjectBackground:
|
||||||
lda ptr+GO_BACKGROUND,y
|
lda ptr+GO_BACKGROUND,y
|
||||||
sta VRAM,x
|
sta VRAM,x
|
||||||
iny
|
iny
|
||||||
|
BIN
gscats.2mg
BIN
gscats.2mg
Binary file not shown.
6
player.s
6
player.s
@ -13,7 +13,7 @@ playerData:
|
|||||||
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Saved background
|
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Saved background
|
||||||
|
|
||||||
.word 45 ; Angle in degrees from +X
|
.word 45 ; Angle in degrees from +X
|
||||||
.word 2 ; Power
|
.word 1 ; Power
|
||||||
.word 100 ; Anger
|
.word 100 ; Anger
|
||||||
.byte 8,"SPROCKET " ; Name
|
.byte 8,"SPROCKET " ; Name
|
||||||
.word 0,0,0,0,0,0 ;Padding
|
.word 0,0,0,0,0,0 ;Padding
|
||||||
@ -23,8 +23,8 @@ playerData:
|
|||||||
.word 0 ; Y pos in pixels (from bottom terrain edge)
|
.word 0 ; Y pos in pixels (from bottom terrain edge)
|
||||||
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Saved background
|
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Saved background
|
||||||
|
|
||||||
.word 135 ; Angle in degrees from +X
|
.word 45 ; Angle in degrees from +X
|
||||||
.word 3 ; Power
|
.word 1 ; Power
|
||||||
.word 100 ; Anger
|
.word 100 ; Anger
|
||||||
.byte 8,"TINKER " ; Name
|
.byte 8,"TINKER " ; Name
|
||||||
.word 0,0,0,0,0,0 ;Padding
|
.word 0,0,0,0,0,0 ;Padding
|
||||||
|
16
projectile.s
16
projectile.s
@ -17,12 +17,14 @@ projectileData:
|
|||||||
.word 0 ; Velocity X (8.8 fixed point)
|
.word 0 ; Velocity X (8.8 fixed point)
|
||||||
.word 0 ; Velocity Y (8.8 fixed point)
|
.word 0 ; Velocity Y (8.8 fixed point)
|
||||||
.word 0 ; Type
|
.word 0 ; Type
|
||||||
|
.word 1 ; New?
|
||||||
|
|
||||||
JD_PRECISEX = 36 ; Byte offsets into projectile data structure
|
JD_PRECISEX = 36 ; Byte offsets into projectile data structure
|
||||||
JD_PRECISEY = 38
|
JD_PRECISEY = 38
|
||||||
JD_VX = 40
|
JD_VX = 40
|
||||||
JD_VY = 42
|
JD_VY = 42
|
||||||
JD_TYPE = 44
|
JD_TYPE = 44
|
||||||
|
JD_NEW = 46
|
||||||
|
|
||||||
GRAVITY = $ffff ; 8.8 fixed point
|
GRAVITY = $ffff ; 8.8 fixed point
|
||||||
|
|
||||||
@ -122,6 +124,10 @@ fireProjectile:
|
|||||||
jsr mult88
|
jsr mult88
|
||||||
sta projectileData+JD_VY,y
|
sta projectileData+JD_VY,y
|
||||||
|
|
||||||
|
lda #1
|
||||||
|
sta projectileData+JD_NEW,y
|
||||||
|
stz projectileActive
|
||||||
|
|
||||||
RESTORE_AXY
|
RESTORE_AXY
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -246,6 +252,8 @@ updateProjectilesDelete:
|
|||||||
jsr deleteProjectile
|
jsr deleteProjectile
|
||||||
lda #1
|
lda #1
|
||||||
sta turnRequested
|
sta turnRequested
|
||||||
|
lda #-1
|
||||||
|
sta projectileActive
|
||||||
bra updateProjectilesDone
|
bra updateProjectilesDone
|
||||||
|
|
||||||
updateProjectilesPlayerHit:
|
updateProjectilesPlayerHit:
|
||||||
@ -294,7 +302,13 @@ renderProjectilesDone:
|
|||||||
unrenderProjectiles:
|
unrenderProjectiles:
|
||||||
pha
|
pha
|
||||||
lda projectileData
|
lda projectileData
|
||||||
bpl unrenderProjectilesDoIt
|
bpl unrenderProjectilesActive
|
||||||
|
jmp unrenderProjectilesDone
|
||||||
|
|
||||||
|
unrenderProjectilesActive:
|
||||||
|
lda projectileData+JD_NEW
|
||||||
|
beq unrenderProjectilesDoIt
|
||||||
|
stz projectileData+JD_NEW
|
||||||
jmp unrenderProjectilesDone
|
jmp unrenderProjectilesDone
|
||||||
|
|
||||||
unrenderProjectilesDoIt:
|
unrenderProjectilesDoIt:
|
||||||
|
Loading…
Reference in New Issue
Block a user