-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisplay_weapon.s
More file actions
116 lines (102 loc) · 2.42 KB
/
display_weapon.s
File metadata and controls
116 lines (102 loc) · 2.42 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
displayWeapon:
call preselectWeapon
mov SELECTED_WEAPON, r0
bnz DSWP01
return
DSWP01:
cmp r0, #ID_PISTOL
bne DSWP03
tst AMMO_PISTOL
bnz displayPistol
clr SELECTED_WEAPON
br displayWeapon
DSWP03:
cmp r0, #ID_PLASMA_GUN
bne DSWP05
tst AMMO_PLASMA
bnz displayPlasmaGun
clr SELECTED_WEAPON
br displayWeapon
DSWP05:
clr SELECTED_WEAPON
br displayWeapon
; This routine checks to see if currently selected
; weapon is zero. And if it is, then it checks inventories
; of other weapons to decide which item to automatically
; select for the user.
preselectWeapon:
.equiv SELECTED_WEAPON, .+2
tst #0
bze PRSW01
return
PRSW01:
tst AMMO_PISTOL
bze PRSW02
mov #ID_PISTOL, SELECTED_WEAPON
return
PRSW02:
tst AMMO_PLASMA
bze PRSW04
mov #ID_PLASMA_GUN, SELECTED_WEAPON
return
PRSW04:
; Nothing found in inventory at this point, so set
; selected-item to zero.
clr SELECTED_WEAPON
br displayBlankWeapon ; call:return
displayPlasmaGun:
mov #WEAPON1A, r4
call displayIconWeapon
mov AMMO_PLASMA, r1
br displayWeaponAmount
displayPistol:
mov #PISTOL1A, r4
call displayIconWeapon
mov AMMO_PISTOL, r1
displayWeaponAmount:
.ifdef COLOR_TILES
mov #TEXT_BUFFER+(OFFS_DISPLAY_WEAPON+(SCREEN_WIDTH*4)+3)*2, r5
.else
mov #TEXT_BUFFER+OFFS_DISPLAY_WEAPON+(SCREEN_WIDTH*4)+3, r5
.endif
jmp displayDecimalNumber
displayBlankWeapon:
mov #EMPTYA, r4
br displayIconWeapon ; call:return
displayIconItem:
mov #TRUE, redraw_window
mov #TEXT_BUFFER+OFFS_DISPLAY_ITEM, r5
br displayIcon
displayIconWeapon:
.ifdef COLOR_TILES
mov #TEXT_BUFFER+OFFS_DISPLAY_WEAPON*2, r5
.else
mov #TEXT_BUFFER+OFFS_DISPLAY_WEAPON, r5
.endif
displayIcon:
mov #4, r1
10$:
mov (r4)+, (r5)+
mov (r4)+, (r5)+
mov (r4)+, (r5)+
.ifdef COLOR_TILES
mov (r4)+, (r5)+
mov (r4)+, (r5)+
mov (r4)+, (r5)+
add #(SCREEN_WIDTH-6)*2, r5
.else
add #SCREEN_WIDTH-6, r5
.endif
sob r1, 10$
.ifdef COLOR_TILES
mov #0x2000, r0
.rept 6
mov r0, (r5)+
.endr
.else
mov #0x2020, r0
.rept 3
mov r0, (r5)+
.endr
.endif
return