-
Notifications
You must be signed in to change notification settings - Fork 0
/
vectors.lst
executable file
·1080 lines (1080 loc) · 25.3 KB
/
vectors.lst
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
$M 128000 $S> $F< $P< $%0 $*% $O3 $A2 $E$
'
REM #KEY ColdFire v4e|Classic 68K
REM #IFK 0
REM #BRK MA
REM #EIK 1 ! ColdFire v4e
REM #LIB ColdFire
REM #EXT prx
REM #EIK 2 ! Classic 68K
REM #LIB 68000
REM #EXT prg
REM #FIK
'
IF FATAL
~FORM_ALERT(1,"[1][ This version is not suited | for this CPU. Please get | the correct archive. ][ Ok ]")
@leave
ENDIF
IF ERR=8
~FORM_ALERT(1,"[1][ Insuffisant or fragmented | memory ][ Ok ]")
@leave
ELSE
init1
init2
main
ENDIF
'
> PROCEDURE leave
IF offscreen_enabled!
V~H=off_handle&
~V_CLSBM()
V~H=-1
ENDIF
@mxfree(offscreen_pointer%)
@mxfree(offscreen_work_buffer%)
'
@restore_colors
@close_win
@mxfree(palette%)
@mxfree(mfdb_screen%)
IF ressource!
~MENU_BAR(ressource_menu%,0)
~RSRC_FREE()
ENDIF
QUIT
RETURN
'
> PROCEDURE init1
'
IF A~I<0 ! appl_init() failed?
@leave
ENDIF
'
IF _B=0
~FORM_ALERT(1,"[1][ AES not initialized ][ Quit ]")
@leave
ENDIF
'
mx_mask%=@mx_mask
mxalloc!=(_GEMDOS>=&H19)
'
magic!=GETCOOKIE(CVL("MagX"))
mint!=(_MINT<>0) ! GETCOOKIE(CVL("MiNT"))
'
IF magic! OR mint!
naes!=TRUE
ELSE IF _AES>=&H399
naes!=TRUE
ELSE
naes!=FALSE
ENDIF
'
multi!=MULTITASK?
'
@declare
@declare_effect
IF mint!=FALSE
RESERVE 32000
ENDIF
@allocate
'
~RSRC_FREE()
IF EXIST(ressource_file$)
IF RSRC_LOAD(ressource_file$)<>0
~RSRC_GADDR(0,0,ressource_menu%)
ressource!=TRUE
ENDIF
ENDIF
'
RETURN
> PROCEDURE declare
general_path$=CURDIR$
'
ressource_file$=general_path$+"VECTORS.RSC"
ressource!=FALSE
ressource_menu%=0
'
preferences_file$=general_path$+"VDI_FX.INF"
'
DIM boolean$(2)
boolean$(0)="FALSE"
boolean$(1)="TRUE"
'
hand_win&=0
xd&=0
yd&=0
ld&=0
hd&=0
wx&=_DX
wy&=_DY
wl&=_DW
wh&=_DH
win!=FALSE
aff!=FALSE
'
bitplane_number&=_B
'
pixel_width_micron&=WORK_OUT(3)
pixel_height_micron&=WORK_OUT(4)
'
monochrome!=FALSE
force_memory_allocation!=TRUE
'
offscreen_enabled!=FALSE
offscreen_size%=0
offscreen_pointer%=0
'
RETURN
> PROCEDURE declare_offscreen(offscreen_width&,offscreen_height&)
'
IF bitplane_number&<4
monochrome!=TRUE
ENDIF
'
offscreen_enabled!=FALSE
'
offscreen_work_buffer%=@mxalloc(56,3)
IF offscreen_work_buffer%>0
'
pxy%=offscreen_work_buffer% ! zone des coordonn‚es
scr_mfdb%=ADD(pxy%,16) ! descripteur de raster pour l'‚cran vdi normal
off_mfdb%=ADD(scr_mfdb%,20) ! descripteur de raster pour l'‚cran offscreen
'
' on renseigne le descripteur de l'‚cran vdi
'
LONG{ADD(scr_mfdb%,0)}=0 ! si … 0, alors il considŠre que c l'‚cran vdi normal
INT{ADD(scr_mfdb%,4)}=ADD(_DX,_DW)
INT{ADD(scr_mfdb%,6)}=ADD(_DY,_DH)
INT{ADD(scr_mfdb%,8)}=SHR&(ADD(INT{ADD(scr_mfdb%,4)},15),4)
INT{ADD(scr_mfdb%,10)}=0
INT{ADD(scr_mfdb%,12)}=bitplane_number&
INT{ADD(scr_mfdb%,14)}=0
INT{ADD(scr_mfdb%,16)}=0
INT{ADD(scr_mfdb%,18)}=0
'
' on alloue la m‚moire pour l'‚cran offscreen
'
IF force_memory_allocation!
offscreen_size%=SHR&(ADD(offscreen_width&,15),4) ! largeur en mot
MUL offscreen_size%,offscreen_height& ! * la hauteur en pixel
MUL offscreen_size%,2 ! taille de mots en octets
IF NOT monochrome!
MUL offscreen_size%,bitplane_number& ! * le nombre de plans
ENDIF
'
offscreen_pointer%=@mxalloc(ADD(offscreen_size%,32),3)
IF offscreen_pointer%<1
~FORM_ALERT(1,"[1][ Not enough memory | for offscreen bitmap ][ Ok ]")
offscreen_size%=0
ENDIF
ENDIF
'
' on remplie le descripteur de l'‚cran offscreen
'
LONG{ADD(off_mfdb%,0)}=offscreen_pointer% ! adresse de la zone m‚moire
INT{ADD(off_mfdb%,4)}=offscreen_width& ! largeur en pixel
INT{ADD(off_mfdb%,6)}=offscreen_height& ! hauteur en pixel
INT{ADD(off_mfdb%,8)}=SHR&(ADD(offscreen_width&,15),4) ! largeur en mot
INT{ADD(off_mfdb%,10)}=0 ! format sp‚cifique au hardware (sinon 1 : format VDI ‚changeable)
IF monochrome!
INT{ADD(off_mfdb%,12)}=1
ELSE
INT{ADD(off_mfdb%,12)}=bitplane_number&
ENDIF
INT{ADD(off_mfdb%,14)}=0
INT{ADD(off_mfdb%,16)}=0
INT{ADD(off_mfdb%,18)}=0
ENDIF
'
IF GETCOOKIE(CVL("EdDI"))=TRUE AND offscreen_pointer%>0
'
INTIN(0)=1
INTIN(1)=1
INTIN(2)=1
INTIN(3)=1
INTIN(4)=1
INTIN(5)=1
INTIN(6)=1
INTIN(7)=1
INTIN(8)=1
INTIN(9)=1
INTIN(10)=2
INTIN(11)=PRED(offscreen_width&)
INTIN(12)=PRED(offscreen_height&)
INTIN(13)=pixel_width_micron&
INTIN(14)=pixel_height_micron&
INTIN(15)=0
INTIN(16)=0
INTIN(17)=0
INTIN(18)=0
INTIN(19)=0
'
off_handle&=V_OPNBM(off_mfdb%,GRAF_HANDLE())
'
offscreen_enabled!=(off_handle&>0)
'
ENDIF
'
RETURN
> PROCEDURE allocate
'
palette%=@mxalloc(1536,3)
'
RETURN
> PROCEDURE init2
'
~VSF_INTERIOR(1)
~VSF_STYLE(0)
~VSF_COLOR(1)
~VSF_PERIMETER(0)
IF offscreen_enabled!
V~H=off_handle&
~VSF_INTERIOR(1)
~VSF_STYLE(0)
~VSF_COLOR(1)
~VSF_PERIMETER(0)
V~H=-1
ENDIF
@save_colors
@set_colors
'
IF ressource!
~MENU_IENABLE(ressource_menu%,3,0)
~MENU_BAR(ressource_menu%,1)
ENDIF
IF multi!=FALSE
~FORM_DIAL(3,0,0,0,0,_DX,_DY,_DW,_DH)
ENDIF
'
RETURN
'
> PROCEDURE declare_effect
LOCAL pref_len%
'
IF EXIST(preferences_file$)
'
mem_pos%=0
'
file_handle&=FOPEN(preferences_file$,0)
IF file_handle&>0
'
pref_len%=FSEEK(0,file_handle&,2)
~FSEEK(0,file_handle&,0)
'
IF pref_len%>0
mem_pos%=@mem_init(pref_len%)
'
IF mem_pos%>0
IF FREAD(file_handle&,pref_len%,mem_pos%)<>pref_len%
mem_pos%=@mem_close
ENDIF
ENDIF
ENDIF
~FCLOSE(file_handle&)
ENDIF
'
IF mem_pos%>0
'
mem_start_ptr%=mem_pos%
mem_end_ptr%=ADD(mem_pos%,pref_len%)
DO
IF BYTE{mem_start_ptr%}=13 OR BYTE{mem_start_ptr%}=10
BYTE{mem_start_ptr%}=0
ENDIF
INC mem_start_ptr%
LOOP UNTIL mem_start_ptr%>mem_end_ptr%
mem_start_ptr%=mem_pos%
'
dummy$=UPPER$(@mem_find$("VECTORS_OBJECT"))
IF dummy$="RANDOM"
univers_object&=-1
ELSE IF dummy$="FUJILOGO"
univers_object&=1
ELSE IF dummy$="BUSYBEE"
univers_object&=2
ELSE
univers_object&=0 ! default
ENDIF
'
IF univers_object&=-1
univers_object&=PRED(MAX(1,MIN(RND*4,3)))
ENDIF
'
univers_x_rot_speed&=VAL(@mem_find$("VECTORS_ROTATION_SPEED_X"))
univers_x_rot_speed&=VAL(@mem_find$("VECTORS_ROTATION_SPEED_Y"))
univers_x_rot_speed&=VAL(@mem_find$("VECTORS_ROTATION_SPEED_Z"))
univers_delay&=MAX(0,MIN(VAL(@mem_find$("VECTORS_DELAY")),200))
univers_force_offscreen!=@mem_get_flag("VECTORS_USE_OFFSCREEN",TRUE)
univers_use_monochrome!=@mem_get_flag("VECTORS_USE_MONOCHROME",FALSE)
univers_clipped!=@mem_get_flag("VECTORS_CLIPPED",TRUE)
'
ENDIF
'
~@mem_close
'
ELSE
'
univers_object&=0
univers_x_rot_speed&=2
univers_x_rot_speed&=4
univers_x_rot_speed&=6
univers_delay&=0
univers_force_offscreen!=FALSE
univers_use_monochrome!=FALSE
univers_clipped!=TRUE
'
ENDIF
RETURN
'
> FUNCTION mem_init(mem_wished_len%)
$F%
~@mem_close
mem_len%=MAX(16000,SHL(SHR(ADD(mem_wished_len%,31),4),4))
mem_start_adr%=@mxalloc(mem_len%,3)
IF mem_start_adr%<0
' alert ?
mem_start_adr%=0
ENDIF
RETURN mem_start_adr%
ENDFUNC
> FUNCTION mem_close
$F%
IF mem_start_adr%>0
@mxfree(mem_start_adr%)
mem_start_adr%=0
mem_len%=0
ENDIF
RETURN 0
ENDFUNC
> FUNCTION mem_find$(mem_key$)
LOCAL mem_find_line$,mem_find_ptr%
IF mem_start_ptr%>0 AND mem_end_ptr%>mem_start_ptr%
mem_find_ptr%=mem_start_ptr%
DO
mem_find_line$=CHAR{mem_find_ptr%}
ADD mem_find_ptr%,SUCC(LEN(mem_find_line$))
'
IF INSTR(mem_find_line$,mem_key$+"=")=1
mem_str$=MID$(mem_find_line$,ADD(LEN(mem_key$),2))
mem_pos&=INSTR(mem_str$,"#")
IF mem_pos&>0
RETURN TRIM$(LEFT$(mem_str$,PRED(mem_pos&)))
ENDIF
RETURN TRIM$(mem_str$)
ENDIF
'
LOOP UNTIL mem_find_ptr%>=mem_end_ptr%
ENDIF
RETURN ""
ENDFUNC
> FUNCTION mem_get_flag(find_str$,default_flag!)
$F%
'
IF @mem_find$(find_str$)=boolean$(ABS(NOT default_flag!))
RETURN NOT default_flag!
ENDIF
RETURN default_flag!
ENDFUNC
'
> PROCEDURE main
@create_win
@set_values
@v_hide_c
@clear_win
exit!=FALSE
DO
@draw_win
LOOP UNTIL exit!
@v_show_c
@leave
RETURN
'
> PROCEDURE create_win
hand_win&=WIND_CREATE(&X0,30,30,30,30)
IF hand_win&>0
wx&=_DX
wy&=_DY
wl&=_DW
wh&=_DH
win!=TRUE
IF WIND_OPEN(hand_win&,wx&,wy&,wl&,wh&)=0
~FORM_ALERT(1,"[1][ Can't open window ][ Quit ]")
@leave
ELSE
~WIND_GET(hand_win&,4,xd&,yd&,ld&,hd&)
ENDIF
ELSE
~FORM_ALERT(1,"[1][ No window available ][ Quit ]")
@leave
ENDIF
aff!=win!
RETURN
> PROCEDURE set_values
'
univers_x_rot&=0
univers_y_rot&=0
univers_z_rot&=0
'
IF univers_x_rot_speed&<1
univers_x_rot_speed&=1
ENDIF
IF univers_y_rot_speed&<1
univers_y_rot_speed&=1
ENDIF
IF univers_z_rot_speed&<1
univers_z_rot_speed&=1
ENDIF
IF univers_delay&<0
univers_delay&=0
ENDIF
'
point_nb_max&=256
point_nb&=0
'
DIM point_x&(point_nb_max&),point_y&(point_nb_max&),point_z&(point_nb_max&)
DIM target_x&(point_nb_max&),target_y&(point_nb_max&),target_z&(point_nb_max&)
DIM screen_x&(point_nb_max&),screen_y&(point_nb_max&),screen_s&(point_nb_max&)
DIM screen_z&(point_nb_max&),screen_o&(point_nb_max&),screen_p&(point_nb_max&)
'
DIM sintable&(512),costable&(512)
'
FOR i&=0 TO 512
sintable&(i&)=SIN((2*i&*PI)/512)*1024
NEXT i&
FOR i&=0 TO 512
costable&(i&)=COS((2*i&*PI)/512)*1024
NEXT i&
'
center_x&=ADD(xd&,DIV(ld&,2))
center_y&=ADD(yd&,DIV(hd&,2))
'
IF NOT univers_clipped!
clear_x&=xd&
clear_y&=yd&
clear_w&=ld&
clear_h&=hd&
ELSE
clear_zone&=400
clear_x&=MAX(xd&,SUB(center_x&,DIV(clear_zone&,2)))
clear_y&=MAX(yd&,SUB(center_y&,DIV(clear_zone&,2)))
clear_w&=MIN(ld&,clear_zone&)
clear_h&=MIN(hd&,clear_zone&)
ENDIF
'
center_a&=DIV(clear_w&,2)
center_b&=DIV(clear_h&,2)
'
IF univers_use_monochrome!
bitplane_number&=1
ENDIF
'
IF univers_force_offscreen!
@declare_offscreen(clear_w&,clear_h&)
IF offscreen_enabled!
V~H=off_handle&
@set_colors
V~H=-1
'
SET.SXYWH 0,0,clear_w&,clear_h&
SET.DXYWH clear_x&,clear_y&,clear_w&,clear_h&
'
ENDIF
ELSE
off_handle&=-1
offscreen_enabled!=FALSE
ENDIF
'
RETURN
> PROCEDURE close_win
IF win!=TRUE
~WIND_CLOSE(hand_win&)
~WIND_DELETE(hand_win&)
win!=FALSE
aff!=FALSE
ENDIF
RETURN
> PROCEDURE clear_win
V~H=-1
~VSF_COLOR(1)
~VS_CLIP(1,xd&,yd&,ADD(xd&,PRED(ld&)),ADD(yd&,PRED(hd&)))
~V_BAR(xd&,yd&,ADD(xd&,PRED(ld&)),ADD(yd&,PRED(hd&)))
~VS_CLIP(0,xd&,yd&,ADD(xd&,PRED(ld&)),ADD(yd&,PRED(hd&)))
RETURN
> PROCEDURE draw_win
LOCAL sq&,screen_ss&,screen_u,sz!
'
SELECT univers_object&
CASE 1 ! Fuji Logo
'
IF univers_clipped!
screen_u=0.06
ELSE
screen_u=0.03
ENDIF
'
add_point(4,0,0)
add_point(6,0,0)
add_point(7,0,0)
add_point(9,0,0)
'
add_point(4,1,0)
add_point(6,1,0)
add_point(7,1,0)
add_point(9,1,0)
'
add_point(4,2,0)
add_point(6,2,0)
add_point(7,2,0)
add_point(9,2,0)
'
add_point(4,3,0)
add_point(6,3,0)
add_point(7,3,0)
add_point(9,3,0)
'
add_point(4,4,0)
add_point(6,4,0)
add_point(7,4,0)
add_point(9,4,0)
'
add_point(3,5,0)
add_point(4,5,0)
add_point(6,5,0)
add_point(7,5,0)
add_point(9,5,0)
add_point(10,5,0)
'
add_point(3,6,0)
add_point(4,6,0)
add_point(6,6,0)
add_point(7,6,0)
add_point(9,6,0)
add_point(10,6,0)
'
add_point(2,7,0)
add_point(3,7,0)
add_point(4,7,0)
add_point(6,7,0)
add_point(7,7,0)
add_point(9,7,0)
add_point(10,7,0)
add_point(11,7,0)
'
add_point(1,8,0)
add_point(2,8,0)
add_point(3,8,0)
add_point(6,8,0)
add_point(7,8,0)
add_point(10,8,0)
add_point(11,8,0)
add_point(12,8,0)
'
add_point(0,9,0)
add_point(1,9,0)
add_point(2,9,0)
add_point(3,9,0)
add_point(6,9,0)
add_point(7,9,0)
add_point(10,9,0)
add_point(11,9,0)
add_point(12,9,0)
add_point(13,9,0)
'
add_point(0,10,0)
add_point(1,10,0)
add_point(2,10,0)
add_point(6,10,0)
add_point(7,10,0)
add_point(11,10,0)
add_point(12,10,0)
add_point(13,10,0)
'
add_point(0,11,0)
add_point(1,11,0)
add_point(2,11,0)
add_point(6,11,0)
add_point(7,11,0)
add_point(11,11,0)
add_point(12,11,0)
add_point(13,11,0)
'
add_point(0,12,0)
add_point(1,12,0)
add_point(6,12,0)
add_point(7,12,0)
add_point(12,12,0)
add_point(13,12,0)
'
add_point(1,13,0)
add_point(6,13,0)
add_point(7,13,0)
add_point(13,13,0)
'
CASE 2 ! Busy Bee
'
IF univers_clipped!
screen_u=0.06
ELSE
screen_u=0.03
ENDIF
'
add_point(4,0,0)
'
add_point(4,1,0)
add_point(10,1,0)
add_point(11,1,0)
add_point(12,1,0)
add_point(13,1,0)
'
add_point(9,2,0)
add_point(10,2,0)
add_point(14,2,0)
'
add_point(5,3,0)
add_point(6,3,0)
add_point(8,3,0)
add_point(9,3,0)
add_point(14,3,0)
'
add_point(0,4,0)
add_point(1,4,0)
add_point(5,4,0)
add_point(6,4,0)
add_point(8,4,0)
add_point(13,4,0)
'
add_point(3,5,0)
add_point(4,5,0)
add_point(7,5,0)
add_point(8,5,0)
add_point(12,5,0)
add_point(14,5,0)
'
add_point(3,6,0)
add_point(4,6,0)
add_point(6,6,0)
add_point(7,6,0)
add_point(9,6,0)
add_point(11,6,0)
add_point(13,6,0)
'
add_point(5,7,0)
add_point(6,7,0)
add_point(8,7,0)
add_point(9,7,0)
add_point(10,7,0)
'
add_point(3,8,0)
add_point(4,8,0)
add_point(5,8,0)
add_point(7,8,0)
add_point(9,8,0)
add_point(11,8,0)
add_point(12,8,0)
'
add_point(2,9,0)
add_point(3,9,0)
add_point(6,9,0)
add_point(7,9,0)
add_point(8,9,0)
add_point(9,9,0)
add_point(10,9,0)
add_point(11,9,0)
add_point(12,9,0)
add_point(13,9,0)
'
add_point(1,10,0)
add_point(2,10,0)
add_point(7,10,0)
add_point(9,10,0)
add_point(10,10,0)
'
add_point(1,11,0)
add_point(6,11,0)
add_point(8,11,0)
add_point(9,11,0)
add_point(11,11,0)
add_point(12,11,0)
add_point(13,11,0)
add_point(14,11,0)
'
add_point(1,12,0)
add_point(5,12,0)
add_point(7,12,0)
add_point(8,12,0)
add_point(10,12,0)
add_point(11,12,0)
'
add_point(1,13,0)
add_point(4,13,0)
add_point(6,13,0)
add_point(9,13,0)
add_point(11,13,0)
add_point(13,13,0)
add_point(14,13,0)
'
add_point(2,14,0)
add_point(3,14,0)
add_point(5,14,0)
add_point(11,14,0)
add_point(13,14,0)
'
DEFAULT
'
screen_u=0.3
'
IF NOT univers_clipped!
FOR i&=0 TO 11
x&=((SIN((i&/6)*PI+(PI/2))+1)-1)*240
y&=((COS((i&/6)*PI+(PI/2))+1)-1)*240
add_point(x&,y&,0)
NEXT i&
sq&=60
ELSE
FOR i&=0 TO 11
x&=((SIN((i&/6)*PI+(PI/2))+1)-1)*120
y&=((COS((i&/6)*PI+(PI/2))+1)-1)*120
add_point(x&,y&,0)
NEXT i&
sq&=35
ENDIF
'
add_point(-sq&,-sq&,-sq&)
add_point(sq&,-sq&,-sq&)
add_point(sq&,sq&,-sq&)
add_point(-sq&,sq&,-sq&)
add_point(-sq&,-sq&,sq&)
add_point(sq&,-sq&,sq&)
add_point(sq&,sq&,sq&)
add_point(-sq&,sq&,sq&)
'
ENDSELECT
'
sz!=(univers_clipped!=FALSE) AND (univers_object&=0)
'
~VSL_COLOR(0)
~VS_CLIP(1,clear_x&,clear_y&,ADD(clear_x&,PRED(clear_w&)),ADD(clear_y&,PRED(clear_h&)))
IF offscreen_enabled!
V~H=off_handle&
~VSL_COLOR(0)
~VS_CLIP(1,0,0,PRED(clear_w&),PRED(clear_h&))
V~H=-1
ENDIF
'
DO
FOR i&=0 TO PRED(point_nb&)
z=(-256)/((-256)-target_z&(i&))
'
screen_x&(i&)=target_x&(i&)*z
screen_y&(i&)=target_y&(i&)*z
screen_s&(i&)=DIV(SUB(32,target_z&(i&)*screen_u),2)
screen_z&(i&)=ADD(1000,screen_s&(i&))
'
x_rot_cos&=costable&(univers_x_rot&)
x_rot_sin&=sintable&(univers_x_rot&)
y_rot_cos&=costable&(univers_y_rot&)
y_rot_sin&=sintable&(univers_y_rot&)
z_rot_cos&=costable&(univers_z_rot&)
z_rot_sin&=sintable&(univers_z_rot&)
'
xx&=point_x&(i&)
yy&=point_y&(i&)
zz&=point_z&(i&)
'
y2&=SHR(z_rot_cos&*yy&-z_rot_sin&*xx&,10)
xx&=SHR(z_rot_cos&*xx&+z_rot_sin&*yy&,10)
'
target_y&(i&)=SHR(x_rot_cos&*y2&+x_rot_sin&*zz&,10)
zz&=SHR(x_rot_cos&*zz&-x_rot_sin&*y2&,10)
'
target_x&(i&)=SHR(y_rot_cos&*xx&-y_rot_sin&*zz&,10)
target_z&(i&)=SHR(y_rot_sin&*xx&+y_rot_cos&*zz&,10)
'
NEXT i&
'
univers_x_rot&=MOD(ADD(univers_x_rot&,univers_x_rot_speed&),512)
univers_y_rot&=MOD(ADD(univers_y_rot&,univers_y_rot_speed&),512)
univers_z_rot&=MOD(ADD(univers_z_rot&,univers_z_rot_speed&),512)
'
IF bitplane_number&>3
FOR j&=0 TO point_nb&
screen_p&(j&)=10000
NEXT j&
'
k&=0
FOR i&=0 TO PRED(point_nb&)
LET end!=FALSE
FOR j&=0 TO k&
IF screen_z&(i&)=<screen_p&(j&)
INSERT screen_o&(j&)=i&
INSERT screen_p&(j&)=screen_z&(i&)
LET end!=TRUE
ENDIF
EXIT IF end!
NEXT j&
INC k&
IF NOT end!
INSERT screen_o&(k&)=i&
INSERT screen_p&(k&)=screen_z&(i&)
ENDIF
NEXT i&
ENDIF
'
IF univers_delay&>0
~EVNT_TIMER(univers_delay&)
ENDIF
'
IF offscreen_enabled!
SELECT bitplane_number&
CASE 1,2
V~H=off_handle&
~V_BAR(0,0,PRED(clear_w&),PRED(clear_h&))
'
FOR i&=0 TO PRED(point_nb&)
IF sz!
screen_ss&=MUL(screen_s&(i&),2)
ELSE
screen_ss&=screen_s&(i&)
ENDIF
~V_ARC(ADD(center_a&,screen_x&(i&)),ADD(center_b&,screen_y&(i&)),screen_ss&,0,3600)
NEXT i&
V~H=-1
~VRT_CPYFM(1,off_mfdb%,scr_mfdb%,1,0)
CASE 4
V~H=off_handle&
~VSF_COLOR(1)
~V_BAR(0,0,PRED(clear_w&),PRED(clear_h&))
'
FOR i&=0 TO PRED(point_nb&)
j&=screen_o&(i&)
~VSF_COLOR(MAX(2,MIN(DIV(screen_s&(j&),2),15)))
IF sz!
screen_ss&=MUL(screen_s&(j&),2)
ELSE
screen_ss&=screen_s&(j&)
ENDIF
~V_CIRCLE(ADD(center_a&,screen_x&(j&)),ADD(center_b&,screen_y&(j&)),screen_ss&)
NEXT i&
V~H=-1
~VRO_CPYFM(3,off_mfdb%,scr_mfdb%)
DEFAULT
V~H=off_handle&
~VSF_COLOR(1)
~V_BAR(0,0,PRED(clear_w&),PRED(clear_h&))
'
FOR i&=0 TO PRED(point_nb&)
j&=screen_o&(i&)
~VSF_COLOR(MAX(16,MIN(MUL(screen_s&(j&),2),78)))
IF sz!
screen_ss&=MUL(screen_s&(j&),2)
ELSE
screen_ss&=screen_s&(j&)
ENDIF
~V_CIRCLE(ADD(center_a&,screen_x&(j&)),ADD(center_b&,screen_y&(j&)),screen_ss&)
NEXT i&
V~H=-1
~VRO_CPYFM(3,off_mfdb%,scr_mfdb%)
ENDSELECT
ELSE
SELECT bitplane_number&
CASE 1,2
~V_BAR(clear_x&,clear_y&,ADD(clear_x&,PRED(clear_w&)),ADD(clear_y&,PRED(clear_h&)))
'
FOR i&=0 TO PRED(point_nb&)
IF sz!
screen_ss&=MUL(screen_s&(i&),2)
ELSE
screen_ss&=screen_s&(i&)
ENDIF
~V_ARC(ADD(center_x&,screen_x&(i&)),ADD(center_y&,screen_y&(i&)),screen_ss&,0,3600)
NEXT i&
CASE 4
~VSF_COLOR(1)
~V_BAR(clear_x&,clear_y&,ADD(clear_x&,PRED(clear_w&)),ADD(clear_y&,PRED(clear_h&)))
'
FOR i&=0 TO PRED(point_nb&)
j&=screen_o&(i&)
~VSF_COLOR(MAX(2,MIN(DIV(screen_s&(j&),2),15)))
IF sz!
screen_ss&=MUL(screen_s&(j&),2)
ELSE
screen_ss&=screen_s&(j&)
ENDIF
~V_CIRCLE(ADD(center_x&,screen_x&(j&)),ADD(center_y&,screen_y&(j&)),screen_ss&)
NEXT i&
DEFAULT
~VSF_COLOR(1)
~V_BAR(clear_x&,clear_y&,ADD(clear_x&,PRED(clear_w&)),ADD(clear_y&,PRED(clear_h&)))
'
FOR i&=0 TO PRED(point_nb&)
j&=screen_o&(i&)
~VSF_COLOR(MAX(16,MIN(MUL(screen_s&(j&),2),78)))
IF sz!
screen_ss&=MUL(screen_s&(j&),2)
ELSE
screen_ss&=screen_s&(j&)
ENDIF
~V_CIRCLE(ADD(center_x&,screen_x&(j&)),ADD(center_y&,screen_y&(j&)),screen_ss&)
NEXT i&
ENDSELECT
ENDIF
'
~GRAF_MKSTATE(gm_x&,gm_y&,gm_s&,gk_s&)
IF BCONSTAT(2) OR gm_s&>0 OR gk_s&>0
exit!=TRUE
ENDIF
LOOP UNTIL exit!
'
~VS_CLIP(0,clear_x&,clear_y&,ADD(clear_x&,PRED(clear_w&)),ADD(clear_y&,PRED(clear_h&)))
IF offscreen_enabled!
V~H=off_handle&
~VS_CLIP(0,0,0,PRED(clear_w&),PRED(clear_h&))
V~H=-1
ENDIF
'
RETURN
'
> PROCEDURE add_point(px&,py&,pz&)
'
SELECT univers_object&
CASE 1
'
point_x&(point_nb&)=MUL(SUB(px&,6),20)
point_y&(point_nb&)=MUL(SUB(py&,6),20)
point_z&(point_nb&)=SUB(pz&,80)
'
target_x&(point_nb&)=MUL(SUB(px&,6),20)
target_y&(point_nb&)=MUL(SUB(py&,6),20)
target_z&(point_nb&)=SUB(pz&,80)
'
CASE 2
'
point_x&(point_nb&)=MUL(SUB(px&,7),20)
point_y&(point_nb&)=MUL(SUB(py&,7),20)
point_z&(point_nb&)=SUB(pz&,50)
'
target_x&(point_nb&)=MUL(SUB(px&,7),20)
target_y&(point_nb&)=MUL(SUB(py&,7),20)
target_z&(point_nb&)=SUB(pz&,50)
'
DEFAULT
'
point_x&(point_nb&)=px&
point_y&(point_nb&)=py&
point_z&(point_nb&)=pz&
'
target_x&(point_nb&)=px&
target_y&(point_nb&)=py&
target_z&(point_nb&)=pz&
'
ENDSELECT
'
point_nb&=MIN(SUCC(point_nb&),point_nb_max&)
'
RETURN
'
> PROCEDURE restore_colors
LOCAL tmp_c&,tmp_d&,col_r&,col_g&,col_b&
'
IF palette%>0
FOR tmp_c&=0 TO 255
tmp_d&=MUL(tmp_c&,6)
col_r&=INT{ADD(palette%,tmp_d&)}
col_g&=INT{ADD(palette%,ADD(tmp_d&,2))}
col_b&=INT{ADD(palette%,ADD(tmp_d&,4))}
~VS_COLOR(tmp_c&,col_r&,col_g&,col_b&)
NEXT tmp_c&
ENDIF
RETURN
> PROCEDURE save_colors
LOCAL tmp_c&,tmp_d&,col_r&,col_g&,col_b&
'
IF palette%>0
FOR tmp_c&=0 TO 255
~VQ_COLOR(tmp_c&,0,col_r&,col_g&,col_b&)
tmp_d&=MUL(tmp_c&,6)
INT{ADD(palette%,tmp_d&)}=col_r&
INT{ADD(palette%,ADD(tmp_d&,2))}=col_g&
INT{ADD(palette%,ADD(tmp_d&,4))}=col_b&
NEXT tmp_c&
ENDIF