/[projet1]/users/chema/TINE/missions/tutorial1.s
Defence Force logotype

Contents of /users/chema/TINE/missions/tutorial1.s

Parent Directory Parent Directory | Revision Log Revision Log


Revision 344 - (show annotations)
Tue Jun 15 09:53:43 2010 UTC (9 years, 11 months ago) by Chema
File size: 4499 byte(s)
Expanded the print routine to handle strings with more than 256 characters. Also expanded it and the print_incomming_message routine to handle text with several pages (New page is code 11, as 12 is flashing attribute).

Expanded some briefings in tutorial0 and 1 and currently working on mission8 text.

Tested mission8, which is working.
1
2 ;; Tutorial 1. basic firing
3
4 .(
5 // Jump table to mission functions
6 // These are kind of event handlers
7 // OnPlayerXXX. The idea is patching these with the necessary jumps. If returns C=1 it means
8 // that text is to be plotted to screen (brief or debrief).
9
10 OnPlayerLaunch
11 jmp PlayerLaunch
12 OnPlayerDock
13 jmp PlayerDock
14 OnPlayerHyper
15 clc
16 rts
17 .byt 00
18 OnExplodeShip
19 jsr CheckTarget
20 OnDockedShip
21 clc
22 rts
23 .byt 00
24 OnHyperShip
25 clc
26 rts
27 .byt 00
28 OnEnteringSystem
29 clc
30 rts
31 .byt 00
32 OnNewEncounter
33 jmp HelpMessage
34
35 // OnScoopObject return with carry =1 if it has handled the scooping, so the main program
36 // avoids doing so.
37
38 OnScoopObject
39 clc
40 rts
41 .byt 00
42
43 // OnGameLoaded, called whenever the game has been loaded from disk, for initializing things...
44 OnGameLoaded
45 clc
46 rts
47 .byt 00
48
49 // Some public variables
50 NeedsDiskLoad .byt 0 ; Will be set to $ff when a new mission needs to be loaded from disk
51 MissionSummary .word str_Summary
52 MissionCargo .byt 0 ; Cargo for this mission
53 AvoidOtherShips .byt $ff ; If not zero, no other ships are created
54
55 // Some internal variables and code
56
57 nTargets .byt 5
58
59 POS1
60 .word 0
61 .word 0
62 .word -2000
63 POS2
64 .word -2000
65 .word 0
66 .word -2000
67 POS3
68 .word 2000
69 .word 0
70 .word -2000
71 POS4
72 .word -2000
73 .word 0
74 .word -1000
75 POS5
76 .word 2000
77 .word 0
78 .word -1000
79 POS6
80 .word 0
81 .word 0
82 .word 0
83
84
85 PlayerLaunch
86 .(
87 ; What needs to be done when player launches?
88 ; basically either brief mission or load cargo.
89
90 ; Check mission state
91 lda _mission
92 cmp #THISMISSION
93 beq firststart
94 clc
95 rts
96
97 firststart
98 lda _galaxynum
99 cmp #1
100 bne nolaunch
101 lda _currentplanet
102 cmp #7 ;Lave
103 bne nolaunch
104
105 ; Launch mission, increment state to 1
106 inc _mission
107
108 ; Create targets
109 lda #6
110 sta nTargets
111 lda #<POS1
112 sta tmp0
113 lda #>POS1
114 sta tmp0+1
115 loop
116 lda #SHIP_SPLINTER
117 jsr IndAddSpaceObject
118
119 lda tmp0
120 clc
121 adc #6
122 sta tmp0
123 bcc nocarry
124 inc tmp0+1
125 nocarry
126 dec nTargets
127 bne loop
128
129 lda #6
130 sta nTargets
131
132 ; Prepare brief message
133 lda #<str_MissionBrief
134 sta TXTPTRLO
135 lda #>str_MissionBrief
136 sta TXTPTRHI
137
138 ; Return with message to be printed
139 sec
140 rts
141 .)
142
143 nolaunch
144 clc
145 rts
146
147
148 PlayerDock
149 .(
150 lda _galaxynum
151 cmp #1
152 bne nolaunch
153 lda _currentplanet
154 cmp #7 ;Lave
155 bne nolaunch
156
157 lda nTargets
158 beq success
159
160 lda #THISMISSION
161 sta _mission
162
163 ; Prepare debriefing
164 lda #<str_MissionDebrief2
165 sta TXTPTRLO
166 lda #>str_MissionDebrief2
167 sta TXTPTRHI
168 sec
169 rts
170
171 success
172 ; Set next mission
173 lda #NEXTMISSION
174 sta _mission
175
176
177 ; Prepare debriefing
178 lda #<str_MissionDebrief
179 sta TXTPTRLO
180 lda #>str_MissionDebrief
181 sta TXTPTRHI
182
183 ; Flag that we need to load mission from disk
184 dec NeedsDiskLoad
185
186 ; Return with message to be printed.
187 sec
188 rts
189 .)
190
191
192 HelpMessage
193 .(
194 lda _mission
195 cmp #THISMISSION+1
196 beq doit
197 retme
198 clc
199 rts
200 doit
201 lda nTargets
202 beq retme
203
204 lda #<str_msg
205 sta tmp0
206 lda #>str_msg
207 sta tmp0+1
208 ldx #0
209 jsr IndFlightMessage
210 clc
211 rts
212 .)
213
214
215 CheckTarget
216 .(
217 jsr IndGetShipType
218 cmp #SHIP_SPLINTER
219 bne ret
220 dec nTargets
221 bne onemore
222 lda #<str_all
223 ldy #>str_all
224 jmp printit
225 onemore
226 lda #<str_hit
227 ldy #>str_hit
228 printit
229 sty tmp0+1
230 sta tmp0
231 ldx #0
232 jsr IndFlightMessage
233 ret
234 clc
235 rts
236 .)
237
238 str_MissionBrief
239 .asc "Let's practice targetting now."
240 .byt 13
241 .asc "Use the scanner to locate ships"
242 .byt 13
243 .asc "around you. You can target them"
244 .byt 13
245 .asc "with your compass using SPACE,"
246 .byt 13
247 .asc "which is vital in dogfighting."
248 .byt 13
249 .byt 13
250 .asc "Fire with A and destroy all the"
251 .byt 13
252 .asc "targets. Then land back in Lave."
253 .byt 13
254 .asc "Watch the laser temperature, and use"
255 .byt 13
256 .asc "Power redir (P) to cool them quicker."
257 .byt 0
258
259 str_msg
260 .asc "Destroy all targets"
261 .byt 0
262 str_hit
263 .asc "Good shot, commander!"
264 .byt 0
265 str_all
266 .asc "Well done! Now land"
267 .byt 0
268
269
270 str_MissionDebrief
271 .asc "Well done Commander."
272 .byt 13
273 .asc "Next tutorial will train you in basic"
274 .byt 13
275 .asc "combat, so review the ship main"
276 .byt 13
277 .asc "controls and launch again when ready."
278 .byt 0
279
280 str_MissionDebrief2
281 .asc "You have not destroyed all the targets."
282 .byt 13
283 .asc "Launch and try again."
284 .byt 0
285
286
287 str_Summary
288 .byt 2
289 .asc "Tutorial 2:"
290 .byt 13
291 .byt 2
292 .asc "Destroy all targets"
293 .byt 13
294 .byt 0
295
296 .)
297
298

  ViewVC Help
Powered by ViewVC 1.1.26