-
Notifications
You must be signed in to change notification settings - Fork 0
/
polygon.s
4827 lines (4063 loc) · 96.6 KB
/
polygon.s
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
TEXTEST equ 1
OBJECT_TYPE equ 0 ; 0 = triangle - "gfx/lava4.neo"
; 1 = square - "gfx/textmap/text_caltropa.neo"
; 2 = torus
; 3 = cube
; 4 = caltrop
pOLSize equ 30 ; struct size
pOLItems equ 17 ; nr of objects
POLYGON_PREP_PANELS equ 1
DRAW_YLINES_OFFSET equ 16
Z_ON equ 0
SEP_UV equ 0
; todo:
; - toggle for rotation code
; - presentation
;
BENCHMARK equ 1
ENVMAP_TT equ 0
IFD DEMOSYSTEM
IFD STANDALONE
ELSE
STANDALONE equ 1
ENDC
ELSE
STANDALONE equ 0
ENDC
IFEQ STANDALONE
TRUE equ 0
FALSE equ 1
true equ 0
false equ 1
POLYGON_EFFECT_VBL equ 500
POLYGON_TORUS_SELECT equ 1
OUTTRO_CINEMASCOPE equ 0
ENDC
incdir gfx
incdir lib
incdir msx
incdir res/smfx
section DATA
IFEQ STANDALONE
include macro.s
initAndRun init_effect
init_effect
jsr init_demo
IFEQ POLYGON_PREP_PANELS
jsr prepLogos
ENDC
jsr init_polygons
move.w #32000,effect_vbl_counter
jsr polygons_mainloop
init_demo
move.w #$000,$ffff8240
move.l #memBase+65536,d0
sub.w d0,d0
move.l d0,screenpointer
move.l d0,screen1
add.l #$10000,d0
move.l d0,screenpointer2
move.l d0,screen2
rts
ENDC
init_polygons
; pointers
move.l screen1,d0
move.l d0,screenpointer
move.l screen2,d0
move.l d0,screenpointer2
add.l #$20000,d0
move.l d0,divtablepointer_polygon
add.l #$20000,d0
move.l d0,texturepointer_polygon
add.l #$20000,d0
move.l d0,texturepointer_polygon2
add.l #$20000,d0
move.l d0,texturepointer_polygon3
move.l d0,d1
add.l #$12000,d1
move.l d1,canvasPointer_text_polygon
add.l #128*128,d1
move.l d1,justDoItPointer
add.l #12800,d1
move.l d1,smfxPointer
add.l #6400,d1
move.l d1,motusPointer
add.l #8000,d1
move.l d1,currentSourceFacesPointer
add.l #6000,d1
move.l d1,currentVerticesPointer
add.l #6000,d1
move.l d1,currentNormalsPointer
add.l #6000,d1
move.l d1,currentPointsPointer
add.l #6000,d1
move.l d1,currentDestFacesPointer
add.l #6000,d1
move.l d1,localListPointer
add.l #6*200,d1
move.l d1,textPtr
; move.b #0,$ffffc123
;f move.l #.xvbl,$70
move.w #$777,timer_b_open_curtain+2
move.w #pOLSize*OBJECT_TYPE,polygonObjectListOff
lea caltropTextcrk,a0
move.l textPtr,a1
; lea caltropText,a1
jsr cranker
; move.w #$777,$ffff8242
move.l screenpointer,$ffff8200
IFNE STANDALONE
move.w allYellow,timer_b_open1+2
move.w allBlue,timer_b_open2+2
move.w allRed,timer_b_open3+2
move.w allGreen,timer_b_open4+2
move.w allGrey,timer_b_open5+2
ENDC
move.l #diagTrans,$70
; lea caltropText+128,a0
move.l textPtr,a0
add.w #128,a0
move.l texturepointer_polygon2,a1
move.l #180-1,d6
jsr planarToChunky_text_polygon_cube
lea cubeTextcrk,a0
move.l textPtr,a1
; lea cubeText,a1
jsr cranker
move.l textPtr,a0
add.w #128,a0
; lea cubeText+128,a0
move.l texturepointer_polygon,a1
move.l #160-1,d6
jsr planarToChunky_text_polygon_cube
lea cube1Pal,a0
lea cubeFade1,a2 ; dest pal
jsr calcFade
lea cube2Pal,a0
lea cubeFade2,a2
jsr calcFade
lea cube3Pal,a0
lea cubeFade3,a2
jsr calcFade
lea cube4Pal,a0
lea cubeFade4,a2
jsr calcFade
lea cube5Pal,a0
lea cubeFade5,a2
jsr calcFade
IFEQ STANDALONE
lea torusText+128,a0
move.l texturepointer_polygon3,a1
jsr planarToChunky_text_polygon_torus
lea torusPal,a0
lea torusFade,a2 ; dest pal
jsr calcFade
ELSE
lea torusTextcrk,a0
; lea torusText,a1
move.l textPtr,a1
jsr cranker
; lea torusText+128,a0
move.l textPtr,a0
add.w #128,a0
move.l texturepointer_polygon3,a1
jsr planarToChunky_text_polygon_torus
lea torusPal,a0
lea torusFade,a2 ; dest pal
jsr calcFade
ENDC
lea justdoitcrk,a0
move.l justDoItPointer,a1
jsr cranker
lea smfxcrk,a0
move.l smfxPointer,a1
jsr cranker
lea motuscrk,a0
move.l motusPointer,a1
jsr cranker
lea caltrop1Pal,a0 ; start pal
lea caltrop1Fade,a2 ; dest pal
jsr calcFade
lea caltrop2Pal,a0 ; start pal
lea caltrop2Fade,a2 ; dest pal
jsr calcFade
lea caltrop3Pal,a0 ; start pal
lea caltrop3Fade,a2 ; dest pal
jsr calcFade
lea caltrop4Pal,a0
lea caltrop4Fade,a2
jsr calcFade
lea trianglePal,a0
lea triangleFade,a2
jsr calcFade
lea squarePal,a0
lea squareFade,a2
jsr calcFade
jsr setObject
jsr initDivTable_polygon
jsr initDivTable_polygon_pivot
move.w #0,yTopp
move.w #75,yBotp
jsr generateOptimizedTabs_polygon
jsr clearCanvas_polygon
; move.b #0,$ffffc123
move.w #0,effectcount
move.w #0,vblcount
move.w #6,d7
.ttt
tst.w $466.w
beq .ttt
move.w #0,$466.w
dbra d7,.ttt
; cmp.w #$4e75,removeDiagonalBlock
; bne .ttt
; moveq #0,d0
; move.w cummulativeCount,d0 ; $00001164
; move.b #0,$ffffc123
move.w #$777,d0
lea $ffff8240+2,a1
REPT 15
move.w d0,(a1)+
ENDR
move.w #$2700,sr
move.l #polygon_vbl,$70
move.w #$2300,sr
rts
.xvbl
addq.w #1,$466.w
rte
IFEQ STANDALONE
canvas_y_offset dc.l -70*160
ENDC
textPtr dc.l 0
breakOn dc.w 0
screen1top dc.w 0
screen1bot dc.w 0
screen2top dc.w 0
screen2bot dc.w 0
currentFadePalPointer dc.l 0
polygonObjectListOff dc.w 0
polygonObjectList
;1 envmap toggle (w)
;2 nr of frames (w)
;3 nr of vbl
;3 object_init (l)
;4 texture_pointer (l)
;5 color ramp
; envmap toggle, nr_frames, vbl_frames
; _current X,Y,Z
; _step X,Y,Z
;-------- part 1
; thin triangle
dc.w 0,185,3 ;envmap? nr_frames vbl_effect ;140
dc.w 0,0,0 ;startx starty startz
dc.w 7,0,0 ;x rotate y rotate z rotate
dc.l init_Triangle ;object init rout
dc.l texturepointer_polygon3 ;texture pointer
dc.l triangleFade ;fade palette
; fatter square
dc.w 0,185,3 ;320
dc.w 0,0,0
dc.w 7,-14,0
dc.l init_Square
dc.l texturepointer_polygon3
dc.l squareFade
; draw the SMFX
dc.w 0,1,3
dc.w 0,0,0
dc.w 0,0,0
dc.l putJustDoItRight
dc.l texturepointer_polygon3
dc.l whiteFade
; fat torus
dc.w 0,380,3 ;620
dc.w 0,0,0
dc.w -10,-14,18
dc.l init_Torus
dc.l texturepointer_polygon3
dc.l torusFade
; clear the right part
dc.w 0,1,3
dc.w 0,0,0
dc.w 0,0,0
dc.l clearRight
dc.l texturepointer_polygon3
dc.l whiteFade
;-------- part 2
;2.1
dc.w -1,100,2 ;envmap? nr_frames vbl_effect ;140
dc.w 2,192,0 ;startx starty startz
dc.w 0,0,11 ;x rotate y rotate z rotate
dc.l init_Caltrop2 ;object init rout
dc.l texturepointer_polygon2 ;texture pointer
dc.l caltrop4Fade ;fade palette
;2.2
dc.w -1,95,2 ;320
dc.w 0,0,0
dc.w 0,14,0
dc.l init_Caltrop2
dc.l texturepointer_polygon2
dc.l caltrop3Fade
; draw the SMFX
dc.w 0,1,2
dc.w 0,0,0
dc.w 0,0,0
dc.l putSMFXRight
dc.l texturepointer_polygon3
dc.l whiteFade
dc.w -1,205,2 ;1020
dc.w 0,0,0
dc.w -12,-13,4
dc.l init_Caltrop2
dc.l texturepointer_polygon2
dc.l caltrop1Fade
; clear the right part
dc.w 0,1,2
dc.w 0,0,0
dc.w 0,0,0
dc.l clearRight
dc.l texturepointer_polygon3
dc.l whiteFade
;-------- part 3
;2.1
dc.w -1,100,2 ;envmap? nr_frames vbl_effect ;140
dc.w 0,0,0 ;startx starty startz
dc.w 7,0,0 ;x rotate y rotate z rotate
dc.l init_Cubewrap ;object init rout
dc.l texturepointer_polygon ;texture pointer
dc.l cubeFade1 ;fade palette
;2.2
dc.w -1,100,2 ;320
dc.w 80,0,0
dc.w -7,0,0
dc.l init_Cubewrap
dc.l texturepointer_polygon
dc.l cubeFade2
;2.1
dc.w -1,98,2 ;envmap? nr_frames vbl_effect ;140
dc.w 0,0,0 ;startx starty startz
dc.w 7,0,0 ;x rotate y rotate z rotate
dc.l init_Cubewrap ;object init rout
dc.l texturepointer_polygon ;texture pointer
dc.l cubeFade3 ;fade palette
;2.2
dc.w -1,94,2 ;320
dc.w 512,0,-256
dc.w 0,0,-6
dc.l init_Cubewrapfix
dc.l texturepointer_polygon
dc.l cubeFade4
; draw the SMFX
dc.w 0,1,2
dc.w 0,0,0
dc.w 0,0,0
dc.l putMotusRight
dc.l texturepointer_polygon3
dc.l whiteFade
NR_CUBE_FRAMES equ 360+8
CUBE_ROT_X equ 10
CUBE_ROT_Y equ 15
CUBE_ROT_Z equ 7
dc.w -1,NR_CUBE_FRAMES,2 ;1420
dc.w 256*2-NR_CUBE_FRAMES/2*CUBE_ROT_X,256*3-NR_CUBE_FRAMES/2*CUBE_ROT_Y,256*2-NR_CUBE_FRAMES/2*CUBE_ROT_Z
; dc.w 0,0,0
dc.w CUBE_ROT_X,CUBE_ROT_Y,7
dc.l initCubeEndFix
dc.l texturepointer_polygon
dc.l cubeFade5
; dc.w -1,900,2
; dc.w 256*2,256*3,256*2
; dc.w 0,0,0
; dc.l haxCubeParts
; dc.l texturepointer_polygon
; dc.l cubeHeartFade
dc.w -1,5000,2
dc.w 256*2,256*3,256*2
dc.w 0,0,0
dc.l dummyRout
dc.l texturepointer_polygon
dc.l cubeHeartFade2
;haxCubeParts
; lea destFaces_Cube,a6
; movem.w .heart,d0-d1
; lea .list,a5
; movem.l (a6,d0.w),d2/d3/d4
; movem.l (a6,d1.w),d5/d6/d7
;
; REPT 5
; move.w (a5)+,d0
; move.w (a5)+,d1
; movem.l d2/d3/d4,(a6,d0.w)
; movem.l d5/d6/d7,(a6,d1.w)
; ENDR
; rts
;
;.heart
; dc.w 9*26+14,3*26+14 ; heart
;
;.list
; dc.w 6*26+14,14
; dc.w 7*26+14,1*26+14
; dc.w 8*26+14,2*26+14
; dc.w 10*26+14,4*26+14
; dc.w 11*26+14,5*26+14
dummyRout
rts
initCubeEndFix
jsr init_Cube
move.w #0,vblcount
rts
init_Cubewrapfix
lea destFaces_Cube+26+14,a5 ; dest 1
lea destFaces_Cube+7*26+14,a6 ; dest 2
movem.l .res1,d0-d5
movem.l d0-d2,(a5)
movem.l d3-d5,(a6)
jsr init_Cube
rts
.res1
dc.w 55<<7,156<<7,104<<7,107<<7,104<<7,156<<7
.res2
dc.w 55<<7,156<<7,55<<7,107<<7,104<<7,107<<7
init_Cubewrap
jsr init_Cube
lea .list,a2
add.w .listOff,a2
add.w #4,.listOff
lea destFaces_Cube,a0
move.l a0,a1
add.w (a2)+,a0
add.w (a2)+,a1
lea destFaces_Cube+26+14,a5 ; dest 1
lea destFaces_Cube+7*26+14,a6 ; dest 2
REPT 3
move.l (a0)+,(a6)+
move.l (a1)+,(a5)+
ENDR
.skip
rts
.w dc.w 1
.list
dc.w 8*26+14,2*26+14 ; heart
dc.w 10*26+14,4*26+14 ; diamond
dc.w 9*26+14,3*26+14 ; heart
dc.w 6*26+14,14
.listOff
dc.w 0
trianglePal
; dc.w $000,$200,$300,$400,$510,$520,$620,$630,$631,$731,$742,$753,$763,$764,$774,$775 ; orange (original)
; dc.w $777,$013,$113,$123,$124,$224,$234,$235,$245,$345,$346,$356,$366,$367,$467,$567 ; metallic blue
; dc.w $000,$013,$113,$123,$124,$235,$236,$245,$345,$355,$456,$466,$577,$677,$777,$707 ; metallic blue brighter
dc.w $777,$011,$011,$012,$022,$123,$133,$234,$244,$345,$355,$456,$567,$777,$777,$777 ; FINAL (?)
squarePal
; dc.w $777,$002,$003,$004,$014,$024,$025,$035,$135,$136,$246,$356,$366,$466,$467,$567 ; orange (original)
; dc.w $777,$125,$126,$236,$336,$436,$426,$435,$545,$654,$753,$763,$773,$774,$775,$776 ; purple (original)
; dc.w $777,$003,$004,$104,$105,$106,$206,$216,$316,$317,$417,$427,$537,$647,$757,$767 ; purple (original)
; dc.w $777,$300,$400,$410,$420,$520,$620,$630,$631,$731,$742,$753,$763,$765,$766,$776 ; orange
; dc.w $777,$070,$070,$221,$233,$332,$433,$443,$544,$654,$655,$665,$766,$777,$777,$777 ; greyred
dc.w $777,$070,$070,$110,$120,$230,$330,$341,$441,$452,$552,$563,$663,$674,$775,$777 ; green
; dc.w $777,$070,$070,$230,$330,$340,$440,$451,$551,$562,$662,$673,$774,$775,$777,$777 ; green yellow
torusPal
dc.w $777,$111,$000,$111,$312,$323,$423,$523,$623,$733,$743,$753,$761,$773,$775,$777
caltrop1Pal
dc.w $777,$666,$555,$454,$444,$344,$234,$323,$223,$412,$122,$301,$211,$111,$000,$240
caltrop2Pal
dc.w $777,$676,$565,$464,$454,$354,$244,$333,$233,$422,$132,$311,$211,$121,$000,$240
caltrop3Pal
dc.w $777,$767,$656,$555,$545,$445,$335,$424,$324,$513,$223,$402,$312,$212,$000,$240
caltrop4Pal
dc.w $777,$754,$643,$542,$532,$432,$322,$411,$311,$500,$210,$400,$300,$200,$000,$240
cubeHeartFade
REPT 9
dc.w $777,$777,$777,$777,$510,$777,$777,$777,$777,$777,$777,$777,$777,$777,$777,$400
ENDR
cubeHeartFade2
IFEQ OUTTRO_CINEMASCOPE
dc.w $111,$111,$111,$111,$400,$111,$111,$111,$111,$111,$111,$111,$111,$111,$111,$510
dc.w $111,$111,$111,$111,$400,$111,$111,$111,$111,$111,$111,$111,$111,$111,$111,$510
dc.w $111,$111,$111,$111,$400,$111,$111,$111,$111,$111,$111,$111,$111,$111,$111,$510
ELSE
dc.w $000,$000,$000,$000,$400,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$510
dc.w $000,$000,$000,$000,$400,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$510
dc.w $000,$000,$000,$000,$400,$000,$000,$000,$000,$000,$000,$000,$000,$000,$000,$510
ENDC
dc.w $111,$111,$111,$111,$400,$111,$111,$111,$111,$111,$111,$111,$111,$111,$111,$510
dc.w $222,$222,$222,$222,$510,$222,$222,$222,$222,$222,$222,$222,$222,$222,$222,$510
dc.w $333,$333,$333,$333,$610,$333,$333,$333,$333,$333,$333,$333,$333,$333,$333,$510
dc.w $444,$444,$444,$444,$721,$444,$444,$444,$444,$444,$444,$444,$444,$444,$444,$700
dc.w $555,$555,$555,$555,$720,$555,$555,$555,$555,$555,$555,$555,$555,$555,$555,$600
dc.w $666,$666,$666,$666,$610,$666,$666,$666,$666,$666,$666,$666,$666,$666,$666,$500
dc.w $777,$777,$777,$777,$510,$777,$777,$777,$777,$777,$777,$777,$777,$777,$777,$400
cube1Pal
; dc.w $777,$442,$332,$552,$510,$220,$421,$321,$764,$653,$542,$320,$310,$210,$000,$400
; dc.w $777,$444,$333,$555,$222,$222,$333,$333,$777,$666,$444,$222,$222,$222,$000,$222 ; altpal grey
; dc.w $777,$344,$233,$455,$122,$122,$233,$233,$677,$566,$344,$122,$122,$122,$000,$122 ; greenblue
dc.w $777,$432,$332,$443,$221,$221,$221,$221,$665,$554,$443,$221,$110,$110,$000,$110
cube2Pal
; dc.w $777,$442,$332,$552,$510,$220,$421,$321,$764,$653,$542,$320,$310,$210,$000,$400
; dc.w $777,$353,$243,$463,$421,$131,$332,$232,$675,$564,$453,$231,$220,$120,$000,$310 ; altpal
; dc.w $777,$444,$333,$555,$511,$222,$333,$333,$777,$666,$333,$222,$222,$222,$000,$400 ; altpal grey
; *** *** ***
; dc.w $777,$345,$234,$456,$421,$123,$234,$234,$677,$567,$453,$123,$123,$123,$001,$400 ; metallic with red heart
dc.w $777,$433,$333,$444,$421,$222,$222,$222,$666,$555,$444,$222,$111,$111,$001,$400
cube3Pal
; dc.w $777,$442,$332,$552,$510,$220,$421,$321,$764,$653,$542,$320,$310,$210,$000,$400
; dc.w $777,$344,$234,$454,$412,$122,$323,$223,$666,$555,$444,$222,$211,$111,$000,$301 ; altpal
dc.w $777,$444,$334,$554,$512,$222,$423,$323,$766,$655,$544,$322,$311,$211,$001,$401
cube4Pal
; dc.w $777,$442,$332,$552,$510,$220,$421,$321,$764,$653,$542,$320,$310,$210,$000,$400
; dc.w $777,$444,$334,$554,$512,$222,$423,$323,$766,$655,$544,$322,$311,$211,$001,$401 ; altpal
dc.w $777,$443,$333,$553,$511,$221,$422,$322,$765,$654,$543,$321,$310,$210,$000,$400 ; almost cube5pal
cube5Pal
dc.w $777,$442,$332,$552,$510,$220,$421,$321,$764,$653,$542,$320,$310,$210,$000,$400
triangleFade ds.b 32*9
squareFade ds.b 32*9
cubeFade1 ds.b 32*9
cubeFade2 ds.b 32*9
cubeFade3 ds.b 32*9
cubeFade4 ds.b 32*9
cubeFade5 ds.b 32*9
caltrop1Fade ds.b 32*9
caltrop2Fade ds.b 32*9
caltrop3Fade ds.b 32*9
caltrop4Fade ds.b 32*9
torusFade ds.b 32*9
;12*32*9
whiteFade
REPT 9
REPT 16
dc.w $777
ENDR
ENDR
putJustDoItRight
; lea justdoit_logo+128,a0
; lea justDoItBuffer,a0
move.l justDoItPointer,a0
move.l screenpointer,a1
move.l screenpointer2,a2
add.w #96+160,a1
add.w #96+160,a2
move.w #199-1,d7
.cp
.x set 0
REPT 8
move.l (a0)+,d0
move.l d0,(a1)+
move.l d0,(a2)+
move.l (a0)+,d0
move.l d0,(a1)+
move.l d0,(a2)+
.x set .x+8
ENDR
lea 96(a1),a1
lea 96(a2),a2
dbra d7,.cp
rts
putSMFXRight
; lea smfx_logo+128,a0
; lea smfxLogoBuffer,a0
move.l smfxPointer,a0
move.l screenpointer,a1
move.l screenpointer2,a2
; add.w #80+160,a0
add.w #120+160,a1
add.w #120+160,a2
move.w #199-1,d7
.cp
.x set 0
REPT 4
move.l (a0)+,d0
move.l d0,(a1)+
move.l d0,(a2)+
move.l (a0)+,d0
move.l d0,(a1)+
move.l d0,(a2)+
.x set .x+8
ENDR
lea 128(a1),a1
lea 128(a2),a2
dbra d7,.cp
rts
putMotusRight
; lea motus_logo+128,a0
; lea motusLogoBuffer,a0
move.l motusPointer,a0
move.l screenpointer,a1
move.l screenpointer2,a2
add.w #14*8+160,a1
add.w #14*8+160,a2
move.w #199-1,d7
.cp
.x set 0
REPT 5
move.l (a0)+,d0
move.l d0,(a1)+
move.l d0,(a2)+
move.l (a0)+,d0
move.l d0,(a1)+
move.l d0,(a2)+
.x set .x+8
ENDR
lea 120(a1),a1
lea 120(a2),a2
dbra d7,.cp
rts
clearRightWrap
move.w #-1,polyTransOn
clearRight
; moveq #0,d0
; move.w vblcount,d0
; move.b #0,$ffffc123
move.l screenpointer,a1
move.l screenpointer2,a2
add.w #80,a1
add.w #80,a2
move.w #200-1,d7
moveq #0,d0
.cl
.x set 0
REPT 10
move.l d0,.x(a1)
move.l d0,.x+4(a1)
move.l d0,.x(a2)
move.l d0,.x+4(a2)
.x set .x+8
ENDR
lea 160(a1),a1
lea 160(a2),a2
dbra d7,.cl
rts
polyTransOn dc.w 0
setObject
lea polygonObjectList,a0
add.w polygonObjectListOff,a0
move.w (a0)+,envmap_toggle
move.w (a0)+,objectSwitchTimer
move.w (a0)+,mainloopsmc+2
movem.w (a0)+,d0-d2
movem.w d0-d2,_currentStepX_polygon
movem.w (a0)+,d0-d2
move.w d0,rot_smc1x+2
move.w d0,rot_smc2x+2
move.w d1,rot_smc1y+2
move.w d1,rot_smc2y+2
move.w d2,rot_smc1z+2
move.w d2,rot_smc2z+2
IFEQ TEXTEST
move.w #32000,objectSwitchTimer
ENDC
move.l (a0)+,a1
move.l (a0)+,a2
move.l (a0)+,currentFadePalPointer
move.l (a2),current_texturePointer
add.w #pOLSize,polygonObjectListOff
cmp.w #pOLSize*pOLItems,polygonObjectListOff
bne .ok
move.w #0,polygonObjectListOff
.ok
jsr (a1)
move.w #5,polygonFadePalInWaiter
move.w objectSwitchTimer,d0
sub.w #30,d0
move.w d0,polygonFadePalOutWaiter
rts
polygons_mainloop
move.w #0,$466.w
mainloopsmc
cmp.w #2,$466.w
blt mainloopsmc
; cmp.w #4,$466.w
; bne .ll
; move.b #0,$ffffc123
;.ll
move.w #0,$466.w
tst.w polyTransOn
bne .skippidy
tst.w effect_vbl_counter
blt .end
addq.w #1,effectcount
tst.w switchObject
beq .ttt
move.w #0,switchObject
jsr setObject
.ttt
tst.w envmap_toggle
bne .doNormal
.doEnvmap
jsr doConcaveEnvmap
jmp .mapdone
.doNormal
jsr doConcave
.mapdone
.done
jsr c2p_2to4_optimized_polygon
move.l screenpointer2,$ffff8200
move.l screenpointer2,d0
move.l screenpointer,screenpointer2
move.l d0,screenpointer
.skippidy
jmp mainloopsmc
; cmp.b #$39,$fffffc02.w ; spacebar to exit
; bne mainloopsmc ;
.end
rts
.waiter dc.w 0
doConvex
jsr clearCanvas_polygon_opt
jsr calculateRotatedProjection_polygon
move.w current_number_of_faces,d7
subq.w #1,d7
move.w #75,yTopp
move.w #0,yBotp
move.l currentDestFacesPointer,a6
.doFace
subq.w #1,(a6)+
blt .notvis
move.l a6,a0
pusha6
pushd7
jsr drawTrianglePoly
popd7
popa6
.notvis
lea 12(a6),a6
dbra d7,.doFace
rts
envmap_toggle dc.w 0
doConcaveEnvmap
jsr clearCanvas_polygon_opt
jsr calculateRotatedProjection_polygonEnvmap
jsr sortFaces
jsr doQuickSort
move.w #75,yTopp
move.w #0,yBotp
move.w nr_faces_to_draw,d7
blt .nofaces
; lea localList,a6
move.l localListPointer,a6
.doFace
move.w (a6)+,a0
move.l (a6)+,a0
pusha6
pushd7
jsr drawTriangleEnvmap
popd7
popa6
.cont
dbra d7,.doFace
.nofaces
rts
.uv1 dc.l 0
.uv2 dc.l 0
.uv3 dc.l 0
doConcave
jsr clearCanvas_polygon_opt
jsr calculateRotatedProjection_polygon
jsr sortFaces
jsr doQuickSort
move.w #75,yTopp
move.w #0,yBotp
move.w nr_faces_to_draw,d7
blt .nofaces
; lea localList,a6
move.l localListPointer,a6
.doFace
move.w (a6)+,a0
move.l (a6)+,a0
IFEQ SEP_UV
movem.l 12(a0),d0-d2
ENDC
movem.l d0-d2/d7/a6,-(a7)
jsr drawTrianglePoly
IFEQ SEP_UV
movem.l (a7)+,d0-d2/d7/a6
move.l -4(a6),a0
movem.l d0-d2,12(a0)
ENDC
.cont
dbra d7,.doFace
.nofaces
rts
.uv1 dc.l 0
.uv2 dc.l 0
.uv3 dc.l 0
polygon_vbl
addq.w #1,$466.w
addq.w #1,cummulativeCount
addq.w #1,vblcount
subq.w #1,effect_vbl_counter
;Start up Timer B each VBL
clr.b $fffffa1b.w ;Timer B control (stop)
bset #0,$fffffa07.w ;Interrupt enable A (Timer B)
bset #0,$fffffa13.w ;Interrupt mask A (Timer B)
move.l #timer_b_open_curtain_stable,$120.w
move.b #188,$fffffa21.w ;Timer B data
move.b #4,$fffffa1b.w ;Timer B control (delay mode)
bclr #3,$fffffa17.w ;Automatic end of interrupt
sub.w #1,objectSwitchTimer