|
|
1.1 root 1:
2: outstanding introduced/emulation bugs:
3: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4:
1.1.1.2 root 5: search for 'XXX' in fe2.s to find comments on known breakage.
1.1 root 6:
1.1.1.3 root 7: 462(a5) arg d1:
8:
9: 0x0 last thingy? always player's ship?
10: 0x2 *hmm...*
11: 0x4 *crash!*
12: 0x6 prox mine
13: 0x8 prox mine
14: 0xa missile
15: 0xc smart missile
16: 0xe naval missile
17: 0x10 nuclear missile
18: 0x12 escape capsule
19: 0x14 interplanetary shuttle
20: 0x16 lifter
21: 0x18 osprey
22: 0x1a falcon attack fighter
23: 0x1c hawk airfighter
24: 0x1e kestrel
25: 0x20 eagle
26: 0x22 eagle II
27: 0x24 eagle III
28: 0x26 sidewinder
29: 0x28 krait
30: 0x2a gecko
31: 0x2c adder
32: 0x2e viper
33: 0x30 cobra 1
34: 0x32 moray starboat
35: 0x34 cobra 3
36: 0x36 constrictor
37: 0x38 asp
38: 0x3a transporter
39: 0x3c lion
40: 0x3e tiger
41: 0x40 imperial courier
42: 0x42 python
43: 0x44 imperial trader
44: 0x46 anaconda
45: 0x48 puma
46: 0x4a boa
47: 0x4c panther clipper
48: 0x4e big thargoid ship...
49: 0x50 lynx bulk carrier
50: 0x52 long range cruiser
51: 0x54 lave type small space station
52: 0x56 hoop type space station
53: 0x58 orbital city
54: 0x5a 4-berth starport with hills and a river and crap
55: 0x5c more landscape poo. starport?
56: 0x5e 6-berth starport with scenery.
57: 0x60 another 6-berth starport + scenery
58: 0x62 2-berth starport (merlin) + big greenhouses and junk
59: 0x64 6-berth starport on a big lump of green. how odd. intro?
60: 0x66 no atmosphere type starport. 2 flashy light towers. dirty industry, etc
61: 0x68 " ". 4 towers.
62: 0x6a " ". smaller.
63: 0x6c " ". lots of industry and greenhouses on this one.
64: 0x6e 5 tower thing. industry. not a starport apparently.
65: 0x70 " ". +big fuckoff radar dish
66: 0x72 " ". +greenhouses
67: 0x74 " ". +2 thargoid things.
68: 0x76 Hm. you die. this must be something really big.
69: 0x78 mb-4 mining machine
70: 0x7a see 0x76
71: 0x7c an asteroid
72: 0x7e,0x80,0x82,0x84 see 0x76
73: ... do more ...
1.1 root 74:
75: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
76:
1.1.1.2 root 77: for calling FmtStr:
78: d0 = format type described below
79: d4 = colour
80: d5 = x
81: d6 = y
82: d7 = 0 ??
1.1 root 83:
84: d0:
1.1.1.2 root 85: < 0x3000 string 'd0' in stringtable L3e878, which contains
86: only "hello there" and "how are you" :-)
1.1 root 87: 0x3015 "%08x" hex (in d3)
88: 0x3014 "%08x" hex (in d2)
89: 0x3013 "%08x" hex (in d1)
90: 0x3012 HH:MM:SS (in d3)
91: 0x3011 HH:MM:SS (in d2)
92: 0x3010 HH:MM:SS (in d1)
93: 0x300f dd-mon-year (day of year in d3)
94: 0x300e dd-mon-year (in d2)
95: 0x300d dd-mon-year (in d1)
96: 0x300c int32 3 dec places (in d3)
97: 0x300b int32 3 dec places (in d2)
98: 0x300a int32 3 dec places (in d1)
99: 0x3009 int32 2 dec places (in d3)
100: 0x3008 int32 2 dec places (in d2)
101: 0x3007 int32 2 dec places (in d1)
102: 0x3006 int32 1 dec place (in d3)
103: 0x3005 int32 1 dec place (in d2)
104: 0x3004 int32 1 dec place (in d1)
105: 0x3003 int32 (in d3)
106: 0x3002 int32 (in d2)
107: 0x3001 int32 (in d1)
108: 0x3000 erm, like, do last thing printed.
1.1.1.2 root 109:
110: 0x4xxx use string xxx from stringtable A6_game_strings(a6)
111: 0x80xx - 0xa2xx
112: use string xxx from stringtable in module given by:
113: 12 + a6 + (((d0*2) & 0xffff)>>7)
114: (The module string table is then obtained by jumping
115: to 40(addr), the address calculated above.
116: ( mod0 = 0x80xx, mod1 = 0x82xx, ... )
117:
118: hm. that there copy thingy is 0x98d8
119:
1.1 root 120:
121: SFX indices:
122: ~~~~~~~~~~~~~
123:
124: 0 ui_beep
125: 1 laser0
126: 2 laser1
127: 3 laser2
128: 4 launch_granted
129: 5 station_door_open
130: 6 explode1
131: 7 ??
132: 8 explode2
133: 9 explode3
134: 10 explode4
135: 11 explode5
136: 12 explode6
137: 13 explode7
138: 14 explode8
139: 15 explode9
140: 16 explode10
141: 17 laser_burn
142: 18 ??
143: 19 hyperspace (loop)
144: 20 hyperspace_end
145: 21 send_message
146: 22 fire_missile
147: 23 noise (loop)
148: 24 ECM
149: 25 warning!
150: 26 retract wheels (?)
151: 27 <silence?>
152: 28 select object
153: 29 bing
154: 30 big bing!
155: 31 launch_noise
156: 32 dildo
157:
158: modfuncs:
159: ~~~~~~~~~
160: 4(a4) - init
161: 20(a4) - every turn in 3d view
1.1.1.2 root 162: 40(a4) - get string-table
163:
164:
1.1.1.4 ! root 165: MOSTLY 3D RENDERER
! 166: ~~~~~~~~~~~~~~~~~~
! 167: notation example: normal{4} means 4 byte long type nicknamed 'normal'
! 168:
! 169: 220 byte stackframe in A6 setup by PutGameData3DObj, Put...3DObj, etc
! 170: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! 171:
! 172: LONG -220(a6) pointer to normals{4} in 3d model
! 173: LONG -216(a6) pointer to vertices{4} in 3d model
! 174: LONG -212(a6) a6 as passed to PutGameData3DObj... (higher stackframe..)
! 175: WORD -208(a6) obj scale - from 10(objmodel)
! 176: WORD*3 -198(a6) lightsource vector
! 177: WORD -192(a6) <cleared on init>
! 178: WORD -156(a6) <cleared on init>
! 179: LONG*4 -104(a6) lightsource tint palette
! 180: WORD -64(a6) <cleared on init>
! 181: WORD*16 -36(a6) obj rot matrix (3x3)
! 182: LONG -4(a6) pointer to obj model
1.1 root 183:
1.1.1.4 ! root 184:
! 185:
! 186: the 3d model the renderer has pointer to in a5:
1.1.1.2 root 187: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
188: size offset
1.1.1.4 ! root 189: WORD 0 offset to bytecode (added to a5 for ProjectObj3D)
! 190: WORD 2 offset to vertices
! 191: WORD 4 num vertices * 64 - size of a4 vertex struct made in SetupNProjectObj
! 192: WORD 6 offset to normals
! 193: WORD 8 4*num normals + 4
! 194: WORD 10 scale
! 195: WORD 12 ???
! 196: WORD 14 another scale thingy?
1.1.1.2 root 197:
1.1.1.4 ! root 198: Entering projection functions, type read with (a5)+, Passed to project funcs in d6.w.
1.1.1.2 root 199:
200: Then different projector functions read their vertex,color,other crap from (a5)+,
201: and on return to Project3DObj the next word will be another projection func index.
202: Eg: for ProjectQuad_1:
203: Bytes 0,1,2,3 of (a5) are the 4 vertex ids.
204: WORD 4 is colour index of some kind.
205: for ProjectTriangle_1:
206: Bytes 0,1,2 are 3 vertex ids.
207: Byte 4 is colour index.
208:
209:
210: for shoving objects into the renderer:
211:
212: Caller (ejemplo DrawBGStars):
213: # Creates 286 byte stackframe with
214: lea -286(a7),a7
215: move.l a7,a6
216:
217: { bg stars
218: 20(a6) = 0.l
219: 24(a6) = 0.l
220: 28(a6) = $200.l
221: 90(a6) = $b0.w
222: }
223: { hyperspace cloud (during hyperspace)
224: 20(a6) = 0.l
225: 24(a6) = 0.l
226: 28(a6) = some value (bigger = more distant :)
227: 90(a6) = $ba.w
228: 116(a6) = 0.w
229: 122(a6) = $ffff.w
230: }
231:
232:
233: call Put3DObj:
234: d0 = 90(a6).w
235: a5 = Address of gamedata obj num 'd0.w'.
236:
237: a4 = a6
238:
239: # make 220 byte stackframe
240: link a6,#-220
241:
1.1.1.3 root 242: # this is the object rotate matrix.
1.1.1.2 root 243: copy 32 bytes: -36(a6) = 0(a4) [caller stackframe]
244:
245: # so (in viewing coords)
246: -16(a6) = x
247: -12(a6) = y
248: -8(a6) = z
249:
250: # game data shit
251: -208(a6) = WORD 10(a5)
252:
253: -212(a6) = LONG a4 [caller stackframe]
254: -156(a6) = 0.w
255: -192(a6) = 0.w
256:
257: # flags Z if obj is onscreen
258: call 3DObjClipOffscreen
259: if not Z: return
260:
261: -64(a6) = 0.w
1.1.1.3 root 262: * this is an extra color tint value, but is only applied
263: * if object color (rgb444) bits 4 and 8 are zero.
1.1.1.2 root 264: -154(a6) = $111.w
265: # lighting vector:
266: copy 3 LONGs: -198(a6) = L60e2 (which is normally 556(a6))
267: copy 4 LONGs: -104(a6) = L60f6 (which is normally 576(a6))
268:
269: call CalcZnLighting
270:
271:
272:
273: # Destroy stackframe
274: lea 286(a7),a7
1.1.1.3 root 275:
276:
277: # THIS HERE is a truth table of how object colours are tinted.
278: # obj_col.w is the rgb444 value in the object model, usually in d6
279: * when 3DPrimCullNLight is called
280: * light_col.w is the value returned by 3DPrimCullNLight in (a0)
281: * extra_col is value passed to Put3DObj, in -154(a6).w
282:
283: obj_col bit: 4 8
284: col:
285: light_col + obj_col 0 0
286: obj_col 0 1
287: light_col + obj_col + extra_col 1 0
288: obj_col + extra_col 1 1
289:
290:
1.1.1.2 root 291: call CalcZnLighting:
292: d0-2 = z,y,z
293: d3 = 0
294: d5 = $4000
295: d4 = abs (z)
296: # find a shift value (d3) to keep abs (x,y,z) coords < $4000
297: while (d4 >= $4000) {
298: d3 += 1
299: d4 >>= 1
300: }
301:
302: d4 = abs (x)
303: d4 >>= d3
304: while (d4 >= $4000) {
305: d3 += 1
306: d4 >>= 1
307: }
308:
309: d4 = abs (y)
310: d4 >>= d3
311: while (d4 >= $4000) {
312: d3 += 1
313: d4 >>= 1
314: }
315:
316: # all LONG
317: x >>= d3
318: y >>= d3
319: z >>= d3
320:
321: # save shift val
322: -44(a6) = WORD d3
323: d3 += 7
324: d4 -= WORD -208(a6)
325:
326: if (d3 < 0) {
327: d3 = abs (d3)
328: -44(a6) += WORD d3
329: WORD x >>= d3
330: WORD y >>= d3
331: WORD z >>= d3
332: }
333: x = -x
334: y = -y
335: z = -z
336:
337: # WORD 3x3 matrix M[9] at -36(a6)
338: x1 = HIGH WORD 2*(x*M[0] + y*M[1] + z*M[2])
339: y1 = HIGH WORD 2*(x*M[3] + y*M[4] + z*M[5])
340: z1 = HIGH WORD 2*(x*M[6] + y*M[7] + z*M[8])
341: -50(a6) = WORD x1,y1,z1
342:
343: # Lighting vector
344: x,y,z = -198(a6)
345: x2 = HIGH WORD 2*(x*M[0] + y*M[1] + z*M[2])
346: y2 = HIGH WORD 2*(x*M[3] + y*M[4] + z*M[5])
347: z2 = HIGH WORD 2*(x*M[6] + y*M[7] + z*M[8])
348: -42(a6) = WORD x2,y2,z2
349: return
350:
351:
352: # flags Z if obj is onscreen
353: call 3DObjClipOffscreen:
354: # a5 still game data shit
355: x,y,z = viewing coords
356: d3 = LONG (WORD 14(a5) << WORD -208(a6))
357: z += d3
358: # object behind viewer
359: if z < 0: return
360: x = abs x
361: y = abs y
362: x -= d3
363: if x >= 0 goto l3966e
364: x = 0
365: l3966e:
366: if x > z: return
367: y -= d3
368: if y >= 0: goto l39678
369: y = 0
370: l39678:
371: y *= 2
372: if y > z: return
373: x = 0
374: return
375:
376: L3e14e:
377: -216(a6) = LONG (gamedata + 2(gamedata).w)
378: #alloc stackframe:
379: a7 -= WORD 4(gamedata)
380: a4 = a7
381: # and then some more
382: a7 -= WORD 8(gamedata)
383: a7 -= $c0
384: # save gamedata obj pointer
385: -4(a6) = LONG a5
386: -220(a6) = LONG gamedata + 6(gamedata).w
387:
388: # -208(a6) is 10(a5)
389: d4 = WORD -208(a6)
390: d4 -= WORD 8
391: # that shift val
392: d4 -= -44(a6)
393:
394: if (d4 > 0) {
395: shift each value in vector3 -50(a6) >> d4.
396: }
397: # we are the only caller of this func
398: call L39690:
399: # a4 is the stackframe allocated previously
400: # a4 has 4(gamedata).w bytes below it and
401: # 8(gamedata).w + $c0 bytes above.
402: a0 = a4 + 18
403: -160(a0) = 0.w
404: -128(a0) = 0.w
405: -96(a0) = 0.w
406: -64(a0) = 0.w
407: -32(a0) = 0.w
408: # and then it is wiped according to the length in d0,
409: # every 32 fuckheads
410: return
411: # also only caller of this one
412: call L3a00c:
413: a0 = 4(a7)
414: d1 = 8(gamedata).w # which is frame size above a4...
415: # wtf is -98(a6)...
416: (a0)+ = LONG -98(a6)
417: d1 >>= 1
418: d1 -= 3
419: if (d1 < 0) return
420: do {
421: (a0)+ = #$8080.w
422: } while (--d1 != -1)
423: return
424: # OK. so this a4 stackframe now looks like:
425: # from 4(a7) to -160(a4) (len 8(gamedata).w) filled with $8080
426: # -160(a4) to (4(gamedata).w + a4), every 32-bytes = 0.w
427: #
428: # The bit below a4 with 32-byte chunks is for storing model vertices
429: # transformed to viewing coords. It goes like this:
430: # WORD*2 0 projected 2D x,y coords
431: # LONG*3 4 20 + viewing transform
432: # WORD 18 zero if this vertex has not been setup yet
433: # LONG*3 20 model coords transformed by model rotation
434: #
435: -152(a6) = $2.b
436: a5 += WORD 0(a5)
437:
438: # phew..
439: call Project3DObj....
440:
441: lea -224(a6),a7
442: return
443:
444: 3DPrimCullNLight:
445: ARG d0 = WORD (BYTE color id thingy)*2
446: a1 = LONG -220(a6) # gamedata + 6(gamedata).w
447:
448: bclr #1,d0
449: if (bit 1 was set) {
450: # XXX finish...
451: }
452: d1,d3 = WORD -4(a1,d0.w)
453: d0 = d1
454: d1 <<= 8
455: d2 = d3
456: d2 &= 0xff00
457: d3 <<= 8
458: d0 >>= 7
459: d0 &= 0xfffe
460:
461: For ProjectCoords:
462: Input:
463: model coords 3xl 20(a0)
464: world coords 3xl -16(a6)
465: Output:
466: model+world 3xl 4(a0)
1.1.1.3 root 467: z-component ^^ l 12(a0)
1.1.1.2 root 468: 2d projection 2xw 0(a0)
1.1 root 469:
1.1.1.3 root 470: Draw3DView:
471: pos = primitives_base
472:
473: for (;;) {
474: FUCK:
475: push pos;
476:
477: if (pos[8].l) {
478: pos = pos[8].l
479: continue;
480: }
481: break;
482: }
483:
484: call L386ce + pos[12].w
485:
486: for (;;) {
487: pop pos
488:
489: if (pos[4].l) {
490: pos = pos[4].l
491: goto FUCK
492: }
493: peek pos
494:
495: call L386ce + pos[12].w
496: }
497:
498: ###################
499: 2d primitive numbers:
500:
501: 0x5a - bezier section of complex polygon
502:
503: ProjectPlanet:
504: ~~~~~~~~~~~~~~
505:
506: Allocates 214 bytes on stack in a3.
507:
508: 32(a3).w = (d6 {as passed to function} >> 4) & 0xfffe
509: 194(a3).l = a5 {as passed} + 4
510: # planet feature detail
511: 172(a3).w = 16 + optdetail2
512: # load some crap into a0:
513: lea 0(a4,d0.w),a0 where d0 = (a5)+ byte extended to word << 5
514: 120(a3).w*3 = x,y,z of planet (fucked around with in some way. these notes are crap)
515: 36(a3) = 8 words containing some unknown shit.
516: 56(a3) = 2 words of shite
517: 80(a3) = 4 longs of shite
518: 60(a3) = 2 words of shite
519: 206(a3).w = $10
520: 96(a3).w = $5
521: 48(a3) = 2 words
522: 64(a3) = 2 words
523: 52(a3) = 2 words
524: 76(a3) = 2 words
525:
526: # the ship object that is read (a5)
527: (d6.w >> 4) & 0xfffe -> 32(a3)
528: (a5)+.l
529: (a5)+.w * 4
530: (a5)+.w
531: lea 56(a5),a5
532: (a5)+.w * 4
533:
534: if (a5)+.w == 0: goto poop1
535:
536: poop2: oh fuck this is horrible
537:
538: poop1:
539:
540:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.