-
Notifications
You must be signed in to change notification settings - Fork 2
/
PLSHOOT.ASM
63 lines (59 loc) · 2.01 KB
/
PLSHOOT.ASM
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
;; INCLUDE "../SAM/START.ASM"
;; INCLVER SAM,SINISTAR.EQU
;===============================================================================
; EQUs to remove later
;QFIRE EQU $4DAE
;GETOBJ EQU $434F ;GETOBJ
;CPLSHOT EQU $4D11 ;SAMTABLE
;IMGOBJ EQU $4332 ;GETOBJ
;===============================================================================
PUSHORG ROMSAVE
;* player shooting
ROUTINE PlShoot
TUNE QFIRE
LDA SFREE ;are there any screen workspaces available?
BEQ .1S
JSR GETOBJ ;yes, create shot save none, uses A,B,X
LDD #CPLSHOT
STD OCHAR,X
LDB PLYRANG ;use same image rotation as player
ADDB #4
ANDB #$078 ;angles 80-0F8 use 0-78
CLRA
ADDD #IPLSHOT
TFR D,U
JSR IMGOBJ ;save X,U, uses none
lda PlyrAng ;* Determine the SHORT velocity based
jsr SinCos ;* on the cosine of the player angle.
pshs A ;* Save the sine for the SHORT velocity.
SEX
RPT 3,ASLB,ROLA
ADDD OLVEL+WPLAYER
STD OLVEL,X
puls B ;* Determine the LONG velocity from player angle
SEX
RPT 4,ASLB,ROLA
ADDD OSVEL+WPLAYER
STD OSVEL,X
LDY OIDESC+WPLAYER ;coupute shot initial position
LDA OLCENT,Y
SUBA OLCENT,U
CLRB
ASRA
RORB
PSHS D
LDD OSPOS+WPLAYER
ADDA OSCENT,Y
SUBA OSCENT,U
STD OSPOS,X
STA OLEFT,X
PULS D
ADCB OLPOSF+WPLAYER
ADCA OLPOS+WPLAYER
STA OLPOS,X
STB OLPOSF,X
ADDA OHEIGHT,U
STA OTOP,X
JSR PUTOBJ ;save none, uses none
.1S RTS
PULLORG ROMSAVE