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

Contents of /users/chema/TINE/missions/mission8.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: 5909 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 ;; Mission 8. Asteroid sower at Edorqu (10) in galaxy 4
3
4
5 .(
6 // Jump table to mission functions
7 // These are kind of event handlers
8 // OnPlayerXXX. The idea is patching these with the necessary jumps. If returns C=1 it means
9 // that text is to be plotted to screen (brief or debrief).
10
11 OnPlayerLaunch
12 clc
13 rts
14 .byt 00
15 OnPlayerDock
16 jmp CheckSuccess
17 OnPlayerHyper
18 jmp CheckSuccess
19 OnExplodeShip
20 jmp CheckAsteroid
21 OnDockedShip
22 jmp CheckImpact
23 OnHyperShip
24 clc
25 rts
26 .byt 00
27 OnEnteringSystem
28 jmp LaunchMission
29 OnNewEncounter
30 clc
31 rts
32 .byt 00
33
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 0 ; If not zero, no other ships are created
54
55 // Some internal variables and code
56
57 Asteroids .dsb 3
58 NAsteroids .byt 5
59 DAsteroids .byt 8
60 Failure .byt 0
61
62 LaunchMission
63 .(
64 lda _mission
65 cmp #THISMISSION
66 bne next
67
68 ; Will we launch it?
69 jsr IndRnd
70 cmp #40
71 bcs nolaunch
72
73 inc _mission
74
75 lda #<str_MissionBrief1
76 sta TXTPTRLO
77 lda #>str_MissionBrief1
78 sta TXTPTRHI
79 sec
80 rts
81
82
83 next
84 ; Maybe at destination
85 lda _mission
86 cmp #THISMISSION+1
87 bne nolaunch
88
89
90 lda _galaxynum
91 cmp #4
92 bne nolaunch
93
94 lda _currentplanet
95 cmp #10
96 bne nolaunch
97
98 inc _mission
99
100 inc AvoidOtherShips
101
102 jsr CreateAsteroids
103
104 lda #<str_MissionBrief
105 sta TXTPTRLO
106 lda #>str_MissionBrief
107 sta TXTPTRHI
108 sec
109 rts
110
111 .)
112 nolaunch
113 clc
114 rts
115
116 CheckSuccess
117 .(
118 lda _mission
119 ; 0=Not launched yet, 1=Launched but never arrived at system
120 cmp #THISMISSION+2
121 bcc nolaunch
122
123 ; Mission has been launched
124 ; and asteroids created.. check success
125 ; If state is 2 then not all asteroids have been destroyed
126 ; If state is 3 then success
127
128 cmp #THISMISSION+3
129 bne MissionFailed
130
131 lda #NEXTMISSION
132 sta _mission
133
134 dec AvoidOtherShips ; This may not be necessary
135
136 lda #<str_MissionDebrief
137 sta TXTPTRLO
138 lda #>str_MissionDebrief
139 sta TXTPTRHI
140
141 dec NeedsDiskLoad
142 sec
143 rts
144 .)
145 MissionFailed
146 .(
147 lda #NEXTMISSIONFAIL
148 sta _mission
149
150 dec AvoidOtherShips
151
152 lda #<str_MissionDebriefFail
153 sta TXTPTRLO
154 lda #>str_MissionDebriefFail
155 sta TXTPTRHI
156
157 sec
158 rts
159
160 .)
161
162
163 CheckAsteroid
164 .(
165 lda Failure
166 bne isnot
167
168 jsr IsAsteroid
169 beq isnot
170
171 dec DAsteroids
172 beq last
173
174 lda NAsteroids
175 beq isnot
176
177 ; Not the last one... create
178 sty sav_y+1
179 jsr IndRnd
180 and #%11
181 tay
182 lda pos_tabhi,y
183 tax
184 lda pos_tablo,y
185 jsr Create1Asteroid
186 txa
187 beq isnot
188 sav_y
189 ldy #0 ; SMC
190 sta Asteroids,y
191 dec NAsteroids
192 clc
193 rts
194
195 last
196 inc _mission
197 lda #<str_Done
198 sta tmp0
199 lda #>str_Done
200 sta tmp0+1
201 ldx #0
202 jsr IndFlightMessage
203
204 isnot
205 clc
206 rts
207 .)
208
209 CheckImpact
210 .(
211 jsr IsAsteroid
212 beq isnot
213 dec Failure
214 lda #<str_Impact
215 sta tmp0
216 lda #>str_Impact
217 sta tmp0+1
218 ldx #0
219 jsr IndFlightMessage
220 isnot
221 clc
222 rts
223 .)
224
225 IsAsteroid
226 .(
227 txa
228 ldy #2
229 loop
230 cmp Asteroids,y
231 beq positive
232 dey
233 bpl loop
234 negative
235 tax
236 lda #0
237 rts
238 positive
239 tax
240 lda #0
241 sta Asteroids,y
242 lda #$ff
243 rts
244 .)
245
246
247 POS1
248 .word -4000
249 .word -4000
250 .word -9000
251 POS2
252 .word 4000
253 .word -4000
254 .word -9000
255 POS3
256 .word 4000
257 .word 4000
258 .word -9000
259 POS4
260 .word -4000
261 .word 4000
262 .word -9000
263
264 pos_tablo
265 .byt <POS1,<POS2,<POS3,<POS4
266 pos_tabhi
267 .byt >POS1,>POS2,>POS3,>POS4
268
269
270 CreateAsteroids
271 .(
272 lda #<POS1
273 ldx #>POS1
274 jsr Create1Asteroid
275 stx Asteroids
276 lda #<POS2
277 ldx #>POS2
278 jsr Create1Asteroid
279 stx Asteroids+1
280 lda #<POS3
281 ldx #>POS3
282 jsr Create1Asteroid
283 stx Asteroids+2
284 rts
285 .)
286
287
288 Create1Asteroid
289 .(
290 sta tmp0
291 stx tmp0+1
292
293 lda #(SHIP_ASTEROID)
294 jsr IndAddSpaceObject
295 cpx #0
296 beq end
297
298 lda #(FLG_FLY_TO_PLANET)
299 sta _flags,x
300 lda #(IS_AICONTROLED|FLG_DEFENCELESS)
301 sta _ai_state,x
302 lda #2
303 sta _target,x
304 ; Make it rotate
305 lda #3
306 sta _rotz,x
307 end
308 rts
309 .)
310
311
312 str_Done
313 .asc "Well done! You saved us"
314 .byt 0
315
316 str_Impact
317 .asc "IMPACT! Mission Failed"
318 .byt 0
319
320 str_Summary
321 .byt 2
322 .asc "Current mission:"
323 .byt 13
324 .byt 2
325 .asc "Go to Edorqu (gal 4) and"
326 .byt 13
327 .byt 2
328 .asc "ask for Marcus Thaid."
329 .byt 0
330
331 str_MissionBrief1
332 .asc "Greetings. Hasler here."
333 .byt 13
334 .asc "I got some more info for you."
335 .byt 13
336 .asc "I know where the secret lab where"
337 .byt 13
338 .asc "Dr. Zantor worked is located."
339 .byt 13
340 .asc "You should go to Edorqu (gal 4),"
341 .byt 13
342 .asc "visit UH-Investments and ask for"
343 .byt 13
344 .asc "Marcus Thaid."
345 .byt 0
346
347 str_MissionBrief
348 .asc "S.O.S -- S.O.S"
349 .byt 13
350 .byt 13
351 .asc "Several asteroids are on"
352 .byt 13
353 .asc "collision course to the planet."
354 .byt 13
355 .byt 13
356 .asc "Destroy them before their impact!"
357 .byt 0
358
359
360 str_MissionDebriefFail
361 .asc "Due to the impact, millions"
362 .byt 13
363 .asc "died. UH-Investments was"
364 .byt 13
365 .asc "totally devasted."
366 .byt 0
367
368
369 str_MissionDebrief
370 .asc "Dr. Thaid here. What you saw was"
371 .byt 13
372 .asc "a deliberate attack! And they"
373 .byt 13
374 .asc "used our tech! but Zantor was not"
375 .byt 13
376 .asc "a traitor, for sure. I found a"
377 .byt 13
378 .asc "possible countermeasure for these"
379 .byt 13
380 .asc "attacks. Carry this data to the"
381 .byt 13
382 .asc "intel center at Usaorer (gal 5)."
383 .byt 11
384 .asc "More things here..."
385 .byt 13
386 .asc "More things here..."
387 .byt 13
388 .asc "More things here..."
389 .byt 13
390 .asc "More things here..."
391
392 .byt 0
393 .)
394

  ViewVC Help
Powered by ViewVC 1.1.26