2017-08-15 19:40:14 +00:00
|
|
|
;
|
|
|
|
; players
|
|
|
|
; Code and data structures related to the players
|
|
|
|
;
|
|
|
|
; Created by Quinn Dunki on 8/13/17
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
playerData:
|
|
|
|
; gameobject data
|
2017-09-02 19:32:40 +00:00
|
|
|
.word 0 ; X pos in pixels (from left terrain edge)
|
|
|
|
.word 0 ; Y pos in pixels (from bottom terrain edge)
|
2017-08-27 05:34:49 +00:00
|
|
|
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Saved background
|
2017-09-30 00:53:05 +00:00
|
|
|
.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 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
2017-08-15 19:40:14 +00:00
|
|
|
|
2017-09-13 16:56:34 +00:00
|
|
|
.word 90 ; Angle in degrees from +X
|
2017-09-05 19:48:30 +00:00
|
|
|
.word 1 ; Power
|
2017-09-04 00:20:24 +00:00
|
|
|
.word 100 ; Anger
|
2017-09-03 00:31:12 +00:00
|
|
|
.byte 8,"SPROCKET " ; Name
|
2017-09-30 00:53:05 +00:00
|
|
|
|
|
|
|
.repeat 108
|
|
|
|
.byte 0 ; Padding to 256-byte boundary
|
|
|
|
.endrepeat
|
2017-09-03 00:31:12 +00:00
|
|
|
|
|
|
|
; gameobject data
|
|
|
|
.word 0 ; X pos in pixels (from left 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
|
2017-09-30 00:53:05 +00:00
|
|
|
.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 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
2017-09-03 00:31:12 +00:00
|
|
|
|
2017-09-30 00:53:05 +00:00
|
|
|
.word 135 ; Angle in degrees from +X
|
2017-09-05 19:48:30 +00:00
|
|
|
.word 1 ; Power
|
2017-09-04 00:20:24 +00:00
|
|
|
.word 100 ; Anger
|
2017-09-03 00:31:12 +00:00
|
|
|
.byte 8,"TINKER " ; Name
|
2017-08-15 19:40:14 +00:00
|
|
|
|
2017-09-30 00:53:05 +00:00
|
|
|
.repeat 108
|
|
|
|
.byte 0 ; Padding to 256-byte boundary
|
|
|
|
.endrepeat
|
|
|
|
|
|
|
|
PD_ANGLE = 132
|
|
|
|
PD_POWER = 134
|
|
|
|
PD_ANGER = 136
|
|
|
|
PD_NAME = 138
|
|
|
|
PD_SIZE = 256
|
2017-08-16 01:03:19 +00:00
|
|
|
|
|
|
|
.macro PLAYERPTR_Y
|
|
|
|
tya ; Pointer to player structure from index
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
2017-09-03 00:31:12 +00:00
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
2017-09-30 00:53:05 +00:00
|
|
|
asl
|
|
|
|
asl
|
2017-08-16 01:03:19 +00:00
|
|
|
tay
|
|
|
|
.endmacro
|
|
|
|
|
|
|
|
|
2017-09-02 19:32:40 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; playerCreate
|
|
|
|
;
|
|
|
|
; A = Player X pos
|
2017-09-03 00:31:12 +00:00
|
|
|
; Y = Index
|
|
|
|
; Trashes SCRATCHL
|
2017-09-02 19:32:40 +00:00
|
|
|
;
|
|
|
|
playerCreate:
|
2017-09-03 00:31:12 +00:00
|
|
|
pha
|
|
|
|
PLAYERPTR_Y
|
|
|
|
sty SCRATCHL
|
|
|
|
pla
|
|
|
|
|
|
|
|
sta playerData+GO_POSX,y
|
2017-09-02 19:32:40 +00:00
|
|
|
lda #playerData
|
2017-09-03 00:31:12 +00:00
|
|
|
clc
|
|
|
|
adc SCRATCHL
|
2017-09-02 19:32:40 +00:00
|
|
|
sta PARAML0
|
|
|
|
jsr placeGameObjectOnTerrain
|
|
|
|
rts
|
|
|
|
|
2017-09-03 00:31:12 +00:00
|
|
|
|
2017-08-16 01:03:19 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; playerDeltaAngle
|
|
|
|
;
|
|
|
|
; Y = Player index
|
|
|
|
; X = Delta
|
|
|
|
;
|
|
|
|
playerDeltaAngle:
|
|
|
|
SAVE_AXY
|
|
|
|
PLAYERPTR_Y
|
|
|
|
|
|
|
|
txa
|
|
|
|
clc
|
|
|
|
adc playerData+PD_ANGLE,y
|
|
|
|
bmi playerDeltaAngleClampLow
|
|
|
|
cmp #180
|
|
|
|
bpl playerDeltaAngleClampHigh
|
|
|
|
|
|
|
|
playerDeltaAngleStore:
|
|
|
|
sta playerData+PD_ANGLE,y
|
|
|
|
RESTORE_AXY
|
|
|
|
rts
|
|
|
|
|
|
|
|
playerDeltaAngleClampLow:
|
|
|
|
lda #0
|
|
|
|
bra playerDeltaAngleStore
|
|
|
|
|
|
|
|
playerDeltaAngleClampHigh:
|
|
|
|
lda #180
|
|
|
|
bra playerDeltaAngleStore
|
|
|
|
|
2017-08-15 19:40:14 +00:00
|
|
|
|
2017-09-05 19:55:27 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; playerDeltaPower
|
|
|
|
;
|
|
|
|
; Y = Player index
|
|
|
|
; X = Delta
|
|
|
|
;
|
|
|
|
playerDeltaPower:
|
|
|
|
SAVE_AXY
|
|
|
|
PLAYERPTR_Y
|
|
|
|
|
|
|
|
txa
|
|
|
|
clc
|
|
|
|
adc playerData+PD_POWER,y
|
|
|
|
beq playerDeltaPowerClampLow
|
|
|
|
cmp #15
|
|
|
|
bpl playerDeltaPowerClampHigh
|
|
|
|
|
|
|
|
playerDeltaPowerStore:
|
|
|
|
sta playerData+PD_POWER,y
|
|
|
|
RESTORE_AXY
|
|
|
|
rts
|
|
|
|
|
|
|
|
playerDeltaPowerClampLow:
|
|
|
|
lda #1
|
|
|
|
bra playerDeltaPowerStore
|
|
|
|
|
|
|
|
playerDeltaPowerClampHigh:
|
|
|
|
lda #15
|
|
|
|
bra playerDeltaPowerStore
|
|
|
|
|
|
|
|
|
2017-08-21 00:51:12 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; playerFire
|
|
|
|
;
|
|
|
|
; Y = Player index
|
|
|
|
;
|
|
|
|
playerFire:
|
2017-09-03 03:52:19 +00:00
|
|
|
pha
|
2017-08-21 00:51:12 +00:00
|
|
|
PLAYERPTR_Y
|
|
|
|
|
2017-08-27 05:34:49 +00:00
|
|
|
lda playerData+GO_POSX,y
|
2017-08-21 00:51:12 +00:00
|
|
|
sta projectileParams
|
2017-08-27 05:34:49 +00:00
|
|
|
lda playerData+GO_POSY,y
|
2017-08-25 04:45:05 +00:00
|
|
|
clc
|
|
|
|
adc #GAMEOBJECTHEIGHT
|
2017-08-21 00:51:12 +00:00
|
|
|
sta projectileParams+2
|
|
|
|
lda playerData+PD_ANGLE,y
|
|
|
|
sta projectileParams+4
|
|
|
|
lda playerData+PD_POWER,y
|
|
|
|
sta projectileParams+6
|
|
|
|
jsr fireProjectile
|
|
|
|
|
2017-09-03 03:52:19 +00:00
|
|
|
pla
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; playerIntersectRect
|
|
|
|
;
|
|
|
|
; Y = Player index
|
|
|
|
; rectParams = Rectangle to intersect with us
|
|
|
|
; A => non zero if rectangle is intersecting player
|
|
|
|
;
|
|
|
|
playerIntersectRect:
|
2017-09-30 00:53:05 +00:00
|
|
|
phy
|
2017-09-03 03:52:19 +00:00
|
|
|
PLAYERPTR_Y
|
|
|
|
|
|
|
|
lda playerData+GO_POSX,y
|
|
|
|
sta rectParams2+0
|
|
|
|
lda playerData+GO_POSY,y
|
|
|
|
sta rectParams2+2
|
|
|
|
lda #GAMEOBJECTWIDTH
|
|
|
|
sta rectParams2+4
|
|
|
|
lda #GAMEOBJECTHEIGHT
|
|
|
|
sta rectParams2+6
|
|
|
|
|
2017-09-30 00:53:05 +00:00
|
|
|
jsr intersectRectRect
|
|
|
|
ply
|
2017-08-21 00:51:12 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
|
2017-08-16 02:04:22 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; renderPlayers
|
|
|
|
;
|
|
|
|
;
|
|
|
|
renderPlayers:
|
2017-09-30 20:01:36 +00:00
|
|
|
RENDER_GAMEOBJECT playerData,Spr_000
|
|
|
|
RENDER_GAMEOBJECT playerData+PD_SIZE,Spr_000
|
2017-08-16 02:04:22 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
|
2017-08-15 19:40:14 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; renderPlayerHeader
|
|
|
|
;
|
|
|
|
; Y = Player index to render
|
|
|
|
;
|
|
|
|
renderPlayerHeader:
|
|
|
|
SAVE_AXY
|
2017-08-16 01:03:19 +00:00
|
|
|
PLAYERPTR_Y
|
2017-08-15 19:40:14 +00:00
|
|
|
|
|
|
|
ldx #0
|
2017-09-03 00:31:12 +00:00
|
|
|
tya
|
|
|
|
clc
|
|
|
|
adc #playerData
|
|
|
|
adc #PD_NAME
|
|
|
|
jsr DrawString
|
|
|
|
|
|
|
|
ldx #48
|
2017-08-15 19:40:14 +00:00
|
|
|
lda #angleStr
|
|
|
|
jsr DrawString
|
|
|
|
|
2017-08-16 01:03:19 +00:00
|
|
|
lda playerData+PD_ANGLE,y
|
2017-09-04 00:20:24 +00:00
|
|
|
ldx #56
|
2017-08-15 19:40:14 +00:00
|
|
|
jsr drawNumber
|
|
|
|
|
2017-09-04 00:20:24 +00:00
|
|
|
ldx #68
|
2017-08-20 22:15:46 +00:00
|
|
|
lda #powerStr
|
|
|
|
jsr DrawString
|
|
|
|
|
|
|
|
lda playerData+PD_POWER,y
|
2017-09-04 00:20:24 +00:00
|
|
|
ldx #76
|
|
|
|
jsr drawNumber
|
|
|
|
|
|
|
|
ldx #88
|
|
|
|
lda #angerStr
|
|
|
|
jsr DrawString
|
|
|
|
|
|
|
|
lda playerData+PD_ANGER,y
|
|
|
|
ldx #96
|
2017-08-20 22:15:46 +00:00
|
|
|
jsr drawNumber
|
|
|
|
|
2017-08-15 19:40:14 +00:00
|
|
|
RESTORE_AXY
|
|
|
|
rts
|
|
|
|
|
|
|
|
angleStr:
|
2017-09-04 00:20:24 +00:00
|
|
|
pstring "*: "
|
2017-08-20 22:15:46 +00:00
|
|
|
powerStr:
|
2017-09-04 00:20:24 +00:00
|
|
|
pstring "+: "
|
|
|
|
angerStr:
|
|
|
|
pstring "): "
|
2017-08-20 22:15:46 +00:00
|
|
|
|
|
|
|
|