-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathglrez.cpp
2639 lines (2596 loc) · 85.1 KB
/
glrez.cpp
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
#include <windows.h>
#include <stdio.h>
#include <math.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include "resource.h"
#include "timer.h"
#include "minifmod.h"
#define DEBUG 0 // debug [0/1]
#define START DEBUG?28:0 // part to start
#define PI 3.14159265358979323846f // pi
#define PID PI/180.0f // pi ratio
#define CR 1.0f/256.0f // color ratio
#define SNG DEBUG?0:1 // music flag
Timer *timer;
float timer_global=0;
float timer_global_previous=0;
float timer_fps=0;
float timer_fps_total=0;
float timer_fps_average=0;
float timer_fps_min=32768;
float timer_fps_max=0;
float timer_music=0;
float timer_max=0;
int frame_counter=0;
int loop_counter=DEBUG?1:-1;
bool done=false;
FMUSIC_MODULE *mod; // music handle
int mod_ord=-1; // pattern order
int mod_row=-1; // row number
int mod_prv_row=0; // previous row number
int mod_time=0; // time
//float mod_tempo=59.625f;// time for one row
bool mod_play=false; // flag
HDC hDC=NULL; // GDI device context
HGLRC hRC=NULL; // rendering context
HWND hWnd=NULL; // window handle
HINSTANCE hInstance; // instance application
int keys[256]; // keyboard array
int active=true; // window active flag
bool fullscreen=DEBUG?false:true; // fullscreen flag
bool pause=false; // pause flag
float nearplane=0.5f; // nearplane
float farplane=1000.0f; // farplane
bool polygon=true; // polygon mode
int ratio_2d=1; // 2d ratio
/* fov variable */
bool fov_flag=false; // flag
float fov_base=60; // base fov angle
float fov=fov_base; // field of view angle
float fov_angle=0; // angle
float fov_value=0; // value
/* window variable */
int window_w=800; // width
int window_h=500; // height
int screen_w; // width
int screen_h; // height
int window_color=32; // color depth
int window_depth=16; // depth buffer
/* object variable */
float p_x=0; // position x
float p_y=0; // position y
float p_z=0; // position z
float a_x=0; // angle x
float a_y=0; // angle y
float a_z=0; // angle z
float main_angle; // main angle
float main_angle_prv; // previous main angle
/* color variable */
float color_inc=0.025f; // color incrementation
float base_r=0.25f; // base r
float base_g=0.35f; // base g
float base_b=0.3f; // base b
float bgd_base_r=base_r;// red base value
float bgd_base_g=base_g;// green base value
float bgd_base_b=base_b;// blue base value
float bgd_r=0; // red value
float bgd_g=0; // green value
float bgd_b=0; // blue value
/* fog variable */
float fog_color[]={base_r,base_g,base_b,1.0f}; // fog color definition
/* liner variable */
bool liner_flag=false; // flag
int car; // ascii code
int liner_length; // text length
int liner_n; // line number
int liner_max; // line max length
int liner_line; // line increment
int liner_i; // char increment
int liner_count=0; // counter
int liner_count_start=0;// counter start
float liner_angle; // angle
int liner_w; // width
int liner_h; // height
float liner_color; // color increment
int liner_vtx[8]; // vertex array
/* text variable */
char *name="Razor 1911 - Insert No Coins";
char *txt_dos="\rLoading and decrunching data...\r\r/\\______ /\\______ ____/\\______ __\r\\____ \\/ \\__ \\/ _ \\____ \\ __/ \\____\r / _/ _/ \\/ / / / _/ _// / / / / /\r/ \\ \\ /\\ / /\\ / / \\ \\/ /\\ / / /\r\\__/\\ \\/RTX______\\___/\\__/\\ \\/ / /_/_/\r=====\\___)===\\__)============\\___)=\\/=======\rRAZOR 1911 * SHARPENING THE BLADE SINCE 1985\r\r\rInsert No Coins - FINAL VERSION!\r\r\rhotkeys:\rF1: display debug infos\rF2: wireframe rendering\rF3: enable/disable scanline\rRETURN: reset debug timer\rSPACE: fullscreen/windowed mode\rxxx: hidden part *";
char *txt_info1="\r\r\r We are proud to \r present you \r\r\"Insert No Coins\"\r\r A new release \r by Razor 1911 \r \r ";
char *txt_info2="\r\r\r - Credits - \r\r code: rez \r logo: ilkke \r music: dubmood \r\r hugs to bp,hyde \r keops and 4mat! \r\r - * - \r \r ";
char *txt_info3="\r\r\r - Greetings - \r\r Ate Bit/Equinox \r Andromeda/Live! \r D-bug/F4CG/TRSi \r Vision Factory \r TBL/Paradox/Orb \r FRequency/TPOLM \r Melon./Bomb!/FR \r\r - * - \r \r ";
char *txt_info4="\r\r\r Be oldsk00l! \r\r Show us that \rnamevoting still\r works in 2010! \r\r \r ";
char *txt_info5="\r\r\r - * - \r\r You finally \r reached the \r end of this \r small intro \r\r - * - \r \r ";
char *txt_info6="\r\r\r Ho, you are \r still here? \r\r Let it loop \r one more time \r \r ";
char *txt_info7=" our intro runs better in realtime than on youtube";
char *txt_hidden1="\r\r\r - * - \r\r Congratulations!\r\r You just found \r the hidden part!\r\r - * - \r \r ";
char *txt_hidden2="\r\r\rThanks goes to: \r\r keops: timer code \r ryg: kkrunchy \r\r4mat,coda,bubsy for\rfor bpm/sync help! \r \r ";
char *txt_hidden3="\r\r\r - Credits - \r\r code: rez \r logo: ilkke \r music: rez \r\r - * - \r \r ";
char *txt_hidden4="\r\r\r - * - \r\r Lovings to \r Maali/ShitRow! \r\r - * - \r \r ";
char *txt_happycube="\r _____\r / /|\r +----+ |\r | :D | |\r +----+/ \rHappycube is Happy!\r ";
char *txt=txt_dos;
/* cube variable */
bool cube_flag=false; // flag
int cube_n=16; // number
float cube_size=2.0f; // size
float cube_x[256]; // position x
float cube_y[256]; // position y
float cube_z[256]; // position z
float cube_a[256]; // angle
float cube_w=cube_size*0.5f;// width
float cube_h=cube_size*2.0f;// height
float cube_ratio=PID*cube_n;// ratio
float cube_angle=0; // angle
float cube_vtx[60]; // cube vertex array
float cube_tex[]={0,0.745f,0.25f,0.745f,0.25f,0.75f,0,0.75f,0,0.745f,0,0.75f,0.25f,0.75f,0.25f,0.745f,0.25f,0.735f,0,0.735f,0,0.74f,0.25f,0.74f,0,0.735f,0.25f,0.735f,0.25f,0.74f,0,0.74f,0.25f,0.75f,0.25f,1.0f,0,1.0f,0,0.75f};
float cube_col[]={0,0,0,0,0,0,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,0,0,0,0,0,0,0,0,0,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,0,0,0,0,0,0,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f,1.0f};
float circuit_tex[]={0.75f,0.75f,0.75f,1.0f,0.625f,1.0f,0.625f,0.75f,0.625f,0.75f,0.625f,1.0f,0.5f,1.0f,0.5f,0.75f};
float circuit_vtx[]={cube_w,0,cube_w,cube_w,0,-cube_w,0,0,-cube_w,0,0,cube_w,0,0,cube_w,0,0,-cube_w,-cube_w,0,-cube_w,-cube_w,0,cube_w};
float chipset_vtx[60*9];// chip vertex array
float chipset_tex[40*9];// chip texture array
/* circuit variable */
bool circuit_flag=false;// flag
/* logo variable */
bool logo_flag=false; // flag
int logo_w; // width
int logo_h; // height
int logo_margin; // margin
int logo_vtx[8]; // vertex array
float logo_tex[]={0.5f,1.0f,0.4375f,1.0f,0.4375f,0.9375f,0.5f,0.9375f};
/* loop variable */
int loop_w; // width
int loop_h; // height
int loop_margin; // margin
int loop_vtx[8]; // vertex array
float loop_tex[]={0.46484375f,0.76953125f,0.25f,0.76953125f,0.25f,0.75f,0.46484375f,0.75f};
/* razor variable */
bool razor_flag=false; // flag
int razor_n=13; // divide number
int razor_y; // position y
int razor_w; // width
int razor_h; // height
int razor_margin; // margin
int razor_radius; // synchro radius
int razor_b_vtx[24]; // back vertex array
float razor_b_col[]={0,0,0,1.0f,0,0,0,1.0f,0.125f,0,0.25f,0.25f,0.125f,0,0.25f,0.25f,0.125f,0,0.25f,0.25f,0.125f,0,0.25f,0.25f,0.25f,0,0.125f,0.25f,0.25f,0,0.125f,0.25f,0.25f,0,0.125f,0.25f,0.25f,0,0.125f,0.25f,0,0,0,1.0f,0,0,0,1.0f};
float razor_vtx[104]; // vertex array
float razor_tex[104]; // texture array
float razor_col[156]; // color array
/* glenz variable */
bool glenz_flag=false; // flag
float glenz_vtx[432]; // vertex array
float glenz_col[576]; // color array
/* intro variable */
bool intro_flag=false; // flag
int intro_n=12; // number
int intro_i=0; // counter
float intro_radius; // radius
float intro_angle=0; // angle
/* tunnel variable */
bool tunnel_flag=false; // flag
int tunnel_n1=64; // depth number
int tunnel_n2=16; // circle number
float tunnel_angle=0; // angle
float tunnel_x[64]; // position x
float tunnel_y[64]; // position y
float tunnel_z[64]; // position z
float tunnel_depth=0.25f;// depth
float tunnel_radius=1.5f;// radius
float tunnel_path=4.0f; // path radius
float tunnel_vtx[]={-0.125f,-0.1875f,0.125f,-0.1875f,0.125f,0.1875f,-0.125f,0.1875f};
float tunnel_tex[]={0.25f,0.78125f,0.3125f,0.78125f,0.3125f,0.875f,0.25f,0.875f};
int star_n=2560; // star number
float star_x[2560]; // position x
float star_y[2560]; // position y
float star_z[2560]; // position z
float star_angle[2560]; // angle
float star_vtx[]={-0.0375f,-0.0375f,0.0375f,-0.0375f,0.0375f,0.0375f,-0.0375f,0.0375f};
float star_tex[]={0.40625f,0.96875f,0.375f,0.96875f,0.375f,1.0f,0.40625f,1.0f};
/* greeting variable */
bool greeting_flag=false;// flag
float disk_vtx[72]; // vertex array
float disk_tex[48]; // texture array
float triforce_vtx[180];// vertex array
float triforce_col[180];// color array
/* copper variable */
int copper_n=10; // number
int copper_h; // height
int copper_vtx[80]; // vertex array
float copper_col[120]; // color array
/* vote variable */
bool vote_flag=false; // flag
int vote_n1=48; // number x
int vote_n2=48; // number y
float vote_w=0.5f; // space between dot
float vote_vtx[]={-0.325f,-0.325f,0.325f,-0.325f,0.325f,0.325f,-0.325f,0.325f};
/* heart variable */
bool heart_flag=false; // flag
int heart_n=12; // number
float heart_vtx[]={-0.5f,-0.5f,0.5f,-0.5f,0.5f,0.5f,-0.5f,0.5f,-0.5f,-0.5f,0.5f,-0.5f,0.5f,0.5f,-0.5f,0.5f};
float heart_tex[]={0.437f,0.8755f,0.3755f,0.8755f,0.3755f,0.937f,0.437f,0.937f,0.437f,0.8755f,0.3755f,0.8755f,0.3755f,0.937f,0.437f,0.937f};
/* end variable */
bool end_flag=false; // flag
float end_radius=-8.0f; // radius
/* tekk variable */
bool tekk_flag=false; // flag
int tekk_bar=48; // bar number
int tekk_n=64; // polygon per bar
float tekk_w=0.5f; // space between bar
float tekk_size=0.125f; // bar size
float tekk_radius=1.5f; // radius
bool tekk_zoom_flag=false;// zoom flag
float tekk_zoom_angle=0;// zoom angle
float tekk_zoom_value=0;// zoom value
float tekk_vtx[147456]; // vertex array
float tekk_col[147456]; // color array
int youtube_vtx[16]; // vertex array
/* hidden variable */
bool hidden=false; // flag
bool hidden_flag=false; // flag
float hidden_radius=27.0f;// radius
float hidden_vtx[]={-0.25f,-0.25f,0.25f,-0.25f,0.25f,0.25f,-0.25f,0.25f};
float hidden_tex[]={0.437f,0.812f,0.3755f,0.812f,0.3755f,0.8745f,0.437f,0.8745f};
float gameboy_tex[]={0.25f,0.78125f,0.3125f,0.78125f,0.3125f,0.875f,0.25f,0.875f};
/* flash variable */
bool flash_flag=false; // flag
float flash_angle=0; // angle
/* dos variable */
bool dos_flag=DEBUG?false:true;// flag
float dos_time=DEBUG?0:1.0f;
int dos_w; // width
int dos_h; // height
int dos_vtx[8]; // vertex array
int shell_vtx[8]; // vertex array
float shell_tex[]={1.0f,0.9453125f,1.0f,1.0f,0.75f,1.0f,0.75f,0.9453125f};
/* decrunch variable */
bool decrunch_flag=false;// flag
int decrunch_h=0; // height
int decrunch_y=0; // top
int decrunch_split=0; // bar split random
int decrunch_split_w; // bar split w
float decrunch_time=DEBUG?0:dos_time+2.0f;
/* debug variable */
bool debug_flag=DEBUG?true:false;// flag
bool debug_test=true; // test
int debug_w; // width
int debug_h; // height
int debug_vtx[8]; // vertex array
/* border variable */
bool border1_flag=false;// flag
bool border2_flag=false;// flag
int border_h; // height
int border_vtx[16]; // vertex array
float border_co1[]={0,0,0,0.125f,0,0,0,0.125f,0,0,0,1.0f,0,0,0,1.0f,0,0,0,1.0f,0,0,0,1.0f,0,0,0,0.125f,0,0,0,0.125f};
float border_co2[]={0.125f,0.125f,0.375f,0.125f,0.125f,0.125f,0.375f,0.125f,0,0,0,1.0f,0,0,0,1.0f,0,0,0,1.0f,0,0,0,1.0f,0.125f,0.125f,0.375f,0.125f,0.125f,0.125f,0.375f,0.125f};
/* scanline variable */
bool scanline_flag=true;// flag
int scanline_vtx[8]; // vertex array
float scanline_tex[8]; // texture array
/* synchro variable */
bool synchro_flag=false;// flag
float synchro_angle=0; // angle
float synchro_value=0; // value
bool sync2_flag=false; // flag
float sync2_angle=0; // angle
float sync2_value=0; // value
float sync2_mul; // multiplicator
/* beat variable */
bool beat_flag=false; // flag
float beat_angle=0; // angle
float beat_value=0; // value
/* fade variable */
bool fade_flag=false; // flag
float fade_angle=0; // angle
float fade_value=0; // value
/* move variable */
bool move_flag=false; // flag
float move_angle=0; // angle
float move_value=0; // value
/* speed variable */
bool speed_flag=false; // flag
float speed_angle=0; // angle
float speed_value=0; // value
int i,j,k;
float x,y,z,w,h;
float r,g,b,c;
float angle,radius,scale;
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM); // wndProc declaration
static PIXELFORMATDESCRIPTOR pfd=
{
sizeof(PIXELFORMATDESCRIPTOR),
1, // version number
PFD_DRAW_TO_WINDOW| // format must support window
PFD_SUPPORT_OPENGL| // format must support openGL
PFD_DOUBLEBUFFER, // must support double buffering
PFD_TYPE_RGBA, // request an RGBA format
window_color, // select our color depth
0,0,0,0,0,0, // color bits ignored
0, // no alpha buffer
0, // shift bit ignored
0, // no accumulation buffer
0,0,0,0, // accumulation bits ignored
window_depth, // z-buffer (depth buffer)
0, // no stencil buffer
0, // no auxiliary buffer
PFD_MAIN_PLANE, // main drawing layer
0, // reserved
0,0,0 // layer masks ignored
};
#if SNG
typedef struct
{
int length,pos;
void *data;
} MEMFILE;
MEMFILE *memfile;
HRSRC rec;
unsigned int memopen(char *name)
{
HGLOBAL handle;
memfile=(MEMFILE *)GlobalAlloc(GMEM_FIXED|GMEM_ZEROINIT,sizeof(MEMFILE));
rec=FindResource(NULL,name,RT_RCDATA);
handle=LoadResource(NULL,rec);
memfile->data=LockResource(handle);
memfile->length=SizeofResource(NULL,rec);
memfile->pos=0;
return (unsigned int)memfile;
}
void memclose(unsigned int handle)
{
MEMFILE *memfile=(MEMFILE *)handle;
GlobalFree(memfile);
}
int memread(void *buffer,int size,unsigned int handle)
{
MEMFILE *memfile=(MEMFILE *)handle;
if(memfile->pos+size>=memfile->length) size=memfile->length-memfile->pos;
memcpy(buffer,(char *)memfile->data+memfile->pos,size);
memfile->pos+=size;
return size;
}
void memseek(unsigned int handle,int pos,signed char mode)
{
MEMFILE *memfile=(MEMFILE *)handle;
if(mode==SEEK_SET) memfile->pos=pos;
else if(mode==SEEK_CUR) memfile->pos+=pos;
else if(mode==SEEK_END) memfile->pos=memfile->length+pos;
if(memfile->pos>memfile->length) memfile->pos=memfile->length;
}
int memtell(unsigned int handle)
{
MEMFILE *memfile=(MEMFILE *)handle;
return memfile->pos;
}
#endif
int load_tex(WORD file,GLint clamp,GLint mipmap)
{
HBITMAP hBMP; // bitmap handle
BITMAP BMP; // bitmap structure
hBMP=(HBITMAP)LoadImage(GetModuleHandle(NULL),MAKEINTRESOURCE(file),IMAGE_BITMAP,0,0,LR_CREATEDIBSECTION);
if(hBMP)
{
GetObject(hBMP,sizeof(BMP),&BMP);
glPixelStorei(GL_UNPACK_ALIGNMENT,4);
glBindTexture(GL_TEXTURE_2D,file);
glTexImage2D(GL_TEXTURE_2D,0,3,BMP.bmWidth,BMP.bmHeight,0,GL_BGR_EXT,GL_UNSIGNED_BYTE,BMP.bmBits);
gluBuild2DMipmaps(GL_TEXTURE_2D,3,BMP.bmWidth,BMP.bmHeight,GL_BGR_EXT,GL_UNSIGNED_BYTE,BMP.bmBits);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,mipmap);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,mipmap);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,clamp);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,clamp);
DeleteObject(hBMP);
}
return 0;
}
void init3d(GLsizei width,GLsizei height)
{
glViewport(0,0,width,height); // reset viewport
glMatrixMode(GL_PROJECTION); // select projection matrix
glLoadIdentity(); // reset projection matrix
gluPerspective(fov,(float)((float)width/(float)height),nearplane,farplane); // aspect ratio
glMatrixMode(GL_MODELVIEW); // select modelview matrix
glLoadIdentity(); // reset modelview matrix
}
void init2d(GLsizei width,GLsizei height)
{
glViewport(0,0,width,height); // reset viewport
glMatrixMode(GL_PROJECTION); // select projection matrix
glLoadIdentity(); // reset projection matrix
gluOrtho2D(0,width,height,0); // init orthographic mode
glMatrixMode(GL_MODELVIEW); // select modelview matrix
glLoadIdentity(); // reset modelview matrix
}
void calc_txt()
{
liner_length=strlen(txt);
liner_count=0;
liner_angle=main_angle;
liner_n=0;
liner_max=0;
liner_i=0;
for(i=0;i<liner_length;i++)
{
if((byte)txt[i]!=13)
{
liner_i++;
}
else
{
if(liner_i>liner_max) liner_max=liner_i;
liner_n++;
liner_i=0;
}
}
if(liner_i>liner_max) liner_max=liner_i;
fade_value=1.0f;
}
void flash()
{
flash_flag=true;
flash_angle=main_angle;
}
void fov_anim()
{
fov_flag=true;
fov_angle=main_angle;
}
void synchro()
{
synchro_flag=true;
synchro_angle=main_angle;
}
void sync2(float mul)
{
sync2_flag=true;
sync2_angle=main_angle;
sync2_mul=mul;
}
void beat()
{
beat_flag=true;
beat_angle=main_angle;
}
void fade()
{
fade_flag=true;
fade_angle=main_angle;
}
void move()
{
move_flag=true;
move_angle=main_angle;
}
void speed()
{
speed_flag=true;
speed_angle=main_angle;
}
void tekk_zoom()
{
tekk_zoom_flag=true;
tekk_zoom_angle=main_angle;
tekk_zoom_value=0;
}
void pins(int n1,int n2,float x,float y,float z,float a,float b,bool type)
{
float k=0.015625f;
a=type?a:-a;
b=type?-b:b;
float vertex[]={x+a,0,z+b,x,0,z+b,x,0,z-b,x+a,0,z-b,x+a,-y,z+b,x+a,0,z+b,x+a,0,z-b,x+a,-y,z-b,x+a,-y,z-b,x+a,0,z-b,x+a,0,z+b,x+a,-y,z+b,x+a,-y*3,z+b*0.5f,x+a,-y,z+b*0.5f,x+a,-y,z-b*0.5f,x+a,-y*3,z-b*0.5f,x+a,-y*3,z-b*0.5f,x+a,-y,z-b*0.5f,x+a,-y,z+b*0.5f,x+a,-y*3,z+b*0.5f};
float texture[]={0.3125f,0.875f+k+k,0.3125f,0.875f+k,0.25f,0.875f+k,0.25f,0.875f+k+k,0.375f,0.875f+k+k,0.375f,0.875f+k+k,0.3125f,0.875f+k,0.3125f,0.875f+k,0.3125f,0.875f+k,0.3125f,0.875f+k,0.3125f,0.875f+k,0.3125f,0.875f+k,0.375f,0.875f+k+k,0.375f,0.875f+k+k,0.3125f,0.875f+k,0.3125f,0.875f+k,0.3125f,0.875f+k,0.3125f,0.875f+k,0.3125f,0.875f+k,0.3125f,0.875f+k};
for(i=0;i<60;i++) chipset_vtx[n1+i]=vertex[i];
for(i=0;i<40;i++) chipset_tex[n2+i]=texture[i];
}
void chipset(float x,float y,float z,float a,float b)
{
float k=0.015625f;
float vertex[]={x,y,z,-x,y,z,-x,-y,z,x,-y,z,-x,y,-z,x,y,-z,x,-y,-z,-x,-y,-z,-x,y,z,-x,y,-z,-x,-y,-z,-x,-y,z,x,y,-z,x,y,z,x,-y,z,x,-y,-z,x,y,z,x,y,-z,-x,y,-z,-x,y,z};
float texture[]={0.375f,0.875f+k*3,0.25f,0.875f+k*3,0.25f,0.875f+k*2,0.375f,0.875f+k*2,0.25f,0.875f+k*3,0.375f,0.875f+k*3,0.375f,0.875f+k*2,0.25f,0.875f+k*2,0.375f,0.875f+k*4,0.25f,0.875f+k*4,0.25f,0.875f+k*3,0.375f,0.875f+k*3,0.25f,0.875f+k*4,0.375f,0.875f+k*4,0.375f,0.875f+k*3,0.25f,0.875f+k*3,0.375f,1.0f,0.25f,1.0f,0.25f,0.9375f,0.375f,0.9375f};
for(i=0;i<60;i++) chipset_vtx[i]=vertex[i];
for(i=0;i<40;i++) chipset_tex[i]=texture[i];
pins(60 ,40 ,-x,y,-z*0.75f,a,b,false);
pins(60*2,40*2,-x,y,-z*0.25f,a,b,false);
pins(60*3,40*3,-x,y, z*0.25f,a,b,false);
pins(60*4,40*4,-x,y, z*0.75f,a,b,false);
pins(60*5,40*5, x,y,-z*0.75f,a,b,true);
pins(60*6,40*6, x,y,-z*0.25f,a,b,true);
pins(60*7,40*7, x,y, z*0.25f,a,b,true);
pins(60*8,40*8, x,y, z*0.75f,a,b,true);
}
void rectangle(int x,int y,int w,int h)
{
//int vertex[]={x+w,y,x,y,x,y+h,x+w,y+h};
//glVertexPointer(2,GL_INT,0,vertex);
//glDrawArrays(GL_QUADS,0,4);
glLoadIdentity();
glBegin(GL_QUADS);
glVertex2i(x+w,y );
glVertex2i(x ,y );
glVertex2i(x ,y+h);
glVertex2i(x+w,y+h);
glEnd();
}
void cube(float w,float h)
{
float vertex[]={-w,0,w,w,0,w,w,h,w,-w,h,w,-w,0,-w,-w,h,-w,w,h,-w,w,0,-w,-w,0,-w,-w,0,w,-w,h,w,-w,h,-w,w,0,w,w,0,-w,w,h,-w,w,h,w,w,h,w,w,h,-w,-w,h,-w,-w,h,w};
for(i=0;i<60;i++) cube_vtx[i]=vertex[i];
}
void copper()
{
copper_h=screen_h/copper_n;
for(i=0;i<copper_n;i++)
{
copper_vtx[i*8 ]=screen_w;
copper_vtx[i*8+1]=copper_h*i;
copper_vtx[i*8+2]=0;
copper_vtx[i*8+3]=copper_h*i;
copper_vtx[i*8+4]=0;
copper_vtx[i*8+5]=copper_h*(i+1);
copper_vtx[i*8+6]=screen_w;
copper_vtx[i*8+7]=copper_h*(i+1);
}
}
void disk(float s)
{
float w=s/128.0f*122.0f;
float h=s;
float d=s/128.0f*6.0f;
float t=1.5f/128.0f;
glColor3f(1.0f,1.0f,1.0f);
float vertex[]={-w,-h,d,w,-h,d,w,h,d,-w,h,d,w,-h,-d,-w,-h,-d,-w,h,-d,w,h,-d,-w,-h,-d,-w,-h,d,-w,h,d,-w,h,-d,w,h,-d,w,h,d,w,-h,d,w,-h,-d,-w,h,d,w,h,d,w,h,-d,-w,h,-d,-w,-h,-d,w,-h,-d,w,-h,d,-w,-h,d};
float texture[]={0.5f+t,0,1.0f-t,0,1.0f-t,0.5f,0.5f+t,0.5f,1.0f-t,0,0.5f+t,0,0.5f+t,0.5f,1.0f-t,0.5f,0.5f+t*0.5f,0,0.5f+t*0.75f,0,0.5f+t*0.75f,0.5f,0.5f+t*0.5f,0.5f,1.0f-t*0.5f,0.5f,1.0f-t*0.75f,0.5f,1.0f-t*0.75f,0,1.0f-t*0.5f,0,0.5f+t,0.5f+t*1.0f,1.0f-t,0.5f+t*1.0f,1.0f-t,0.5f+t*0.75f,0.5f+t,0.5f+t*0.75f,0.5f+t,0.5f+t*0.5f,1.0f-t,0.5f+t*0.5f,1.0f-t,0.5f+t*0.25f,0.5f+t,0.5f+t*0.25f};
for(i=0;i<72;i++) disk_vtx[i]=vertex[i];
for(i=0;i<48;i++) disk_tex[i]=texture[i];
}
void glenz(float d1,float d2,float r1,float g1,float b1,float a)
{
float c1=(r1+g1+b1)/3.0f;
float c2=c1*0.625f;
float r2=r1*0.625f;
float g2=g1*0.625f;
float b2=b1*0.625f;
float vertex[]={-d1,d1,d1,d1,d1,d1,0,0,d2,d1,d1,-d1,-d1,d1,-d1,0,0,-d2,d1,-d1,d1,-d1,-d1,d1,0,0,d2,-d1,-d1,-d1,d1,-d1,-d1,0,0,-d2,-d1,-d1,-d1,-d1,d1,-d1,-d2,0,0,d1,-d1,d1,d1,d1,d1,d2,0,0,-d1,-d1,-d1,-d1,-d1,d1,0,-d2,0,-d1,d1,d1,-d1,d1,-d1,0,d2,0,-d1,d1,d1,-d1,-d1,d1,-d2,0,0,d1,d1,-d1,d1,-d1,-d1,d2,0,0,d1,-d1,d1,d1,-d1,-d1,0,-d2,0,d1,d1,-d1,d1,d1,d1,0,d2,0,-d1,d1,-d1,-d1,d1,d1,-d2,0,0,d1,d1,d1,d1,d1,-d1,d2,0,0,-d1,-d1,d1,d1,-d1,d1,0,-d2,0,-d1,d1,-d1,d1,d1,-d1,0,d2,0,-d1,-d1,d1,-d1,-d1,-d1,-d2,0,0,d1,-d1,-d1,d1,-d1,d1,d2,0,0,d1,-d1,-d1,-d1,-d1,-d1,0,-d2,0,d1,d1,d1,-d1,d1,d1,0,d2,0,-d1,-d1,d1,-d1,d1,d1,0,0,d2,d1,-d1,-d1,d1,d1,-d1,0,0,-d2,d1,d1,d1,d1,-d1,d1,0,0,d2,-d1,d1,-d1,-d1,-d1,-d1,0,0,-d2,d1,d1,-d1,d1,d1,d1,d2,0,0,-d1,d1,d1,-d1,d1,-d1,-d2,0,0,d1,-d1,d1,d1,-d1,-d1,d2,0,0,-d1,-d1,-d1,-d1,-d1,d1,-d2,0,0,-d1,-d1,-d1,-d1,d1,-d1,0,0,-d2,d1,-d1,d1,d1,d1,d1,0,0,d2,-d1,-d1,-d1,d1,-d1,-d1,0,-d2,0,d1,d1,-d1,-d1,d1,-d1,0,d2,0,d1,d1,-d1,d1,-d1,-d1,0,0,-d2,-d1,d1,d1,-d1,-d1,d1,0,0,d2,d1,-d1,d1,-d1,-d1,d1,0,-d2,0,-d1,d1,d1,d1,d1,d1,0,d2,0,-d1,d1,-d1,d1,d1,-d1,0,0,-d2,d1,d1,d1,-d1,d1,d1,0,0,d2,d1,-d1,-d1,d1,-d1,d1,0,-d2,0,-d1,d1,-d1,-d1,d1,d1,0,d2,0,d1,-d1,-d1,-d1,-d1,-d1,0,0,-d2,-d1,-d1,d1,d1,-d1,d1,0,0,d2,-d1,-d1,d1,-d1,-d1,-d1,0,-d2,0,d1,d1,d1,d1,d1,-d1,0,d2,0,d1,-d1,-d1,d1,d1,-d1,d2,0,0,-d1,-d1,d1,-d1,d1,d1,-d2,0,0,d1,d1,d1,d1,-d1,d1,d2,0,0,-d1,d1,-d1,-d1,-d1,-d1,-d2,0,0};
float color[]={c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c1,c1,c1,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,c2,c2,c2,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r1,g1,b1,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a,r2,g2,b2,a};
for(i=0;i<432;i++) glenz_vtx[i]=vertex[i];
for(i=0;i<576;i++) glenz_col[i]=color[i];
}
void triforce(float radius2,float z,float r1,float g1,float b1,float r2,float g2,float b2)
{
float radius1=radius2*0.5f;
float x1=radius1*cosf(PID* 30.0f);
float y1=radius1*sinf(PID* 30.0f);
float x2=radius1*cosf(PID*150.0f);
float y2=radius1*sinf(PID*150.0f);
float x3=radius1*cosf(PID*270.0f);
float y3=radius1*sinf(PID*270.0f);
float x4=radius2*cosf(PID* 90.0f);
float y4=radius2*sinf(PID* 90.0f);
float x5=radius2*cosf(PID*210.0f);
float y5=radius2*sinf(PID*210.0f);
float x6=radius2*cosf(PID*330.0f);
float y6=radius2*sinf(PID*330.0f);
glColor3f(r1,g1,b1);
float vertex[]={x1,y1,z,x1,y1,z,x4,y4,z,x2,y2,z,x2,y2,z,x2,y2,z,x5,y5,z,x3,y3,z,x3,y3,z,x3,y3,z,x6,y6,z,x1,y1,z,x1,y1,0,x1,y1,0,x4,y4,0,x2,y2,0,x2,y2,0,x2,y2,0,x5,y5,0,x3,y3,0,x3,y3,0,x3,y3,0,x6,y6,0,x1,y1,0,x1,y1,z,x2,y2,z,x2,y2,0,x1,y1,0,x2,y2,z,x4,y4,z,x4,y4,0,x2,y2,0,x4,y4,z,x1,y1,z,x1,y1,0,x4,y4,0,x2,y2,z,x3,y3,z,x3,y3,0,x2,y2,0,x3,y3,z,x5,y5,z,x5,y5,0,x3,y3,0,x5,y5,z,x2,y2,z,x2,y2,0,x5,y5,0,x3,y3,z,x1,y1,z,x1,y1,0,x3,y3,0,x1,y1,z,x6,y6,z,x6,y6,0,x1,y1,0,x6,y6,z,x3,y3,z,x3,y3,0,x6,y6,0};
float color[]={r1,g1,b1,r1,g1,b1,r1,g1,b1,r1,g1,b1,r1,g1,b1,r1,g1,b1,r1,g1,b1,r1,g1,b1,r1,g1,b1,r1,g1,b1,r1,g1,b1,r1,g1,b1,r1,g1,b1,r1,g1,b1,r1,g1,b1,r1,g1,b1,r1,g1,b1,r1,g1,b1,r1,g1,b1,r1,g1,b1,r1,g1,b1,r1,g1,b1,r1,g1,b1,r1,g1,b1,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2,r2,g2,b2};
for(i=0;i<180;i++)
{
triforce_vtx[i]=vertex[i];
triforce_col[i]=color[i];
}
}
int InitGL(void)
{
glClearDepth(1.0f); // set depth buffer
glDepthMask(GL_TRUE); // do not write z-buffer
glEnable(GL_CULL_FACE); // disable cull face
glCullFace(GL_BACK); // don't draw front face
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
// fog
glFogi(GL_FOG_MODE,GL_LINEAR); // fog mode
glFogfv(GL_FOG_COLOR,fog_color); // fog color
glFogf(GL_FOG_DENSITY,1.0f); // fog density
glHint(GL_FOG_HINT,GL_NICEST); // fog hint value
glFogf(GL_FOG_START,2.0f); // fog start depth
glFogf(GL_FOG_END,24.0f); // fog end depth
// load texture
load_tex(IDB_MAP,GL_REPEAT,GL_NEAREST);
//glBindTexture(GL_TEXTURE_2D,IDB_MAP);
// initialize some variable
timer=new Timer();
calc_txt();
glenz(1.0f,1.625f,0.125f,0.625f,0.75f,0.5f);
cube(cube_w,cube_size*0.75f);
chipset(cube_w*0.25f,cube_w*0.0625f,cube_w*0.5f,cube_w*0.1f,cube_w*0.0625f);
disk(2.0f);
triforce(1.0f,0.125f,0.875f,0.75f,0.25f,0.625f,0.5f,0);
for(i=0;i<star_n;i++)
{
star_angle[i]=(rand()%3600)*0.1f;
radius=((rand()%1000)*0.01f);
radius=tunnel_radius*1.125f+((radius<0.0f)?-radius:radius);
star_x[i]=radius*cosf(star_angle[i]);
star_y[i]=radius*sinf(star_angle[i]);
star_z[i]=-(rand()%(int)(tunnel_depth*tunnel_n1*1000))*0.001f;
}
y=0;
k=0;
float x1,x2,y1,y2;
for(i=0;i<tekk_bar;i++)
{
x1=-tekk_w;
x2=0;
y+=tekk_w*2.0f;
y1=y-tekk_size;
y2=y+tekk_size;
for(j=0;j<tekk_n;j++)
{
x1+=tekk_w;
x2+=tekk_w;
float angle2=1080.0f*PID/tekk_n*j+main_angle*2.0f;
tekk_vtx[k ]=x1;
tekk_vtx[k+ 1]=y2;
tekk_vtx[k+ 3]=x1;
tekk_vtx[k+ 4]=y1;
tekk_vtx[k+ 6]=x2;
tekk_vtx[k+ 7]=y1;
tekk_vtx[k+ 9]=x2;
tekk_vtx[k+10]=y2;
tekk_vtx[k+12]=x1;
tekk_vtx[k+13]=y1;
tekk_vtx[k+15]=x1;
tekk_vtx[k+16]=y2;
tekk_vtx[k+18]=x2;
tekk_vtx[k+19]=y2;
tekk_vtx[k+21]=x2;
tekk_vtx[k+22]=y1;
tekk_vtx[k+24]=x1;
tekk_vtx[k+25]=y1;
tekk_vtx[k+27]=x1;
tekk_vtx[k+28]=y1;
tekk_vtx[k+29]=0;
tekk_vtx[k+30]=x2;
tekk_vtx[k+31]=y1;
tekk_vtx[k+32]=0;
tekk_vtx[k+33]=x2;
tekk_vtx[k+34]=y1;
tekk_vtx[k+36]=x1;
tekk_vtx[k+37]=y2;
tekk_vtx[k+38]=0;
tekk_vtx[k+39]=x1;
tekk_vtx[k+40]=y2;
tekk_vtx[k+42]=x2;
tekk_vtx[k+43]=y2;
tekk_vtx[k+45]=x2;
tekk_vtx[k+46]=y2;
tekk_vtx[k+47]=0;
r=0.25f+0.25f*cosf(angle2);
g=0.25f;
b=0.25f+0.25f*sinf(angle2);
tekk_col[k ]=0.45f;
tekk_col[k+ 1]=0.5f;
tekk_col[k+ 2]=0.55f;
tekk_col[k+ 3]=0.45f;
tekk_col[k+ 4]=0.5f;
tekk_col[k+ 5]=0.55f;
tekk_col[k+ 6]=0.45f;
tekk_col[k+ 7]=0.5f;
tekk_col[k+ 8]=0.55f;
tekk_col[k+ 9]=0.45f;
tekk_col[k+10]=0.5f;
tekk_col[k+11]=0.55f;
tekk_col[k+12]=0.875f;
tekk_col[k+13]=0;
tekk_col[k+14]=0;
tekk_col[k+15]=0.875f;
tekk_col[k+16]=0;
tekk_col[k+17]=0;
tekk_col[k+18]=0.875f;
tekk_col[k+19]=0;
tekk_col[k+20]=0;
tekk_col[k+21]=0.875f;
tekk_col[k+22]=0;
tekk_col[k+23]=0;
tekk_col[k+24]=r;
tekk_col[k+25]=g;
tekk_col[k+26]=b;
tekk_col[k+27]=r;
tekk_col[k+28]=g;
tekk_col[k+29]=b;
tekk_col[k+30]=r;
tekk_col[k+31]=g;
tekk_col[k+32]=b;
tekk_col[k+33]=r;
tekk_col[k+34]=g;
tekk_col[k+35]=b;
tekk_col[k+36]=r;
tekk_col[k+37]=g;
tekk_col[k+38]=b;
tekk_col[k+39]=r;
tekk_col[k+40]=g;
tekk_col[k+41]=b;
tekk_col[k+42]=r;
tekk_col[k+43]=g;
tekk_col[k+44]=b;
tekk_col[k+45]=r;
tekk_col[k+46]=g;
tekk_col[k+47]=b;
k+=48;
}
}
return true;
}
int DrawGLScene(void) // draw scene
{
frame_counter++;
// synchro
timer->update();
timer_global_previous=timer_global;
timer_global=timer->elapsed;
if(!pause)
{
// compute rotation
main_angle_prv=main_angle;
main_angle=timer_global*100.0f*PID;
}
timer_fps=1.0f/(timer_global-timer_global_previous);
timer_fps_total+=timer_fps;
timer_fps_average=timer_fps_total/frame_counter;
if(timer_fps<timer_fps_min) timer_fps_min=timer_fps;
if(timer_fps>timer_fps_max) timer_fps_max=timer_fps;
// start decrunch
if(!mod_play&&timer_global>dos_time)
{
decrunch_flag=true;
}
// start music
if(!mod_play&&timer_global>decrunch_time)
{
dos_flag=false;
decrunch_flag=false;
mod_play=true;
#if SNG
FMUSIC_PlaySong(mod);
#endif
timer_music=timer_global;
}
if(mod_play)
{
//mod_time=(timer_global-timer_music)*1000.0f;
mod_time=FMUSIC_GetTime(mod);
mod_prv_row=mod_row;
//mod_row=(int)(mod_time/mod_tempo)%64;
mod_row=FMUSIC_GetRow(mod);
if(mod_row>mod_prv_row+1) mod_row=mod_prv_row;
if(mod_row!=mod_prv_row)
{
if(!hidden)
{
if(mod_row==0)
{
timer_max=(timer_global-timer_music)*1000.0f;
timer_music=timer_global;
#if !DEBUG
mod_ord=FMUSIC_GetOrder(mod);
/*
mod_ord++;
if((mod_ord%32==0)&&(mod_ord>0))
{
mod_ord=8;
loop_counter++;
}
*/
#endif
#if DEBUG
if(debug_test)
{
mod_ord=START;
debug_test=false;
}
else
{
mod_ord++;
}
#endif
}
if(((mod_ord>7&&mod_ord<16)||(mod_ord>17&&mod_ord<24&&mod_ord!=21))&&(mod_row%16==8||mod_row==52)) synchro();
if((mod_ord==16||mod_ord==17)&&(mod_row==52)) synchro();
if((mod_ord==21)&&(mod_row==8||mod_row==24||mod_row==56)) synchro();
if((mod_ord>27&&mod_ord<32)&&(mod_row%8==0)) sync2(1.75f);
if((loop_counter>0)&&(mod_row%16==0)) beat();
switch(mod_ord)
{
case 0:
switch(mod_row)
{
case 0:
decrunch_flag=false;
intro_flag=true;
glenz_flag=true;
flash();
intro_i=1;
synchro();
break;
case 6: intro_i=2; synchro(); break;
case 12: intro_i=3; synchro(); break;
case 32: intro_i=4; synchro(); break;
case 38: intro_i=5; synchro(); break;
case 44: intro_i=6; synchro(); break;
}
break;
case 1:
switch(mod_row)
{
case 0: intro_i=7; synchro(); break;
case 6: intro_i=8; synchro(); break;
case 12: intro_i=9; synchro(); break;
case 32: intro_i=10; synchro(); break;
case 38: intro_i=11; synchro(); break;
case 44: intro_i=12; synchro(); break;
case 59: move(); break;
}
break;
case 2:
switch(mod_row)
{
case 0: intro_i=13; synchro(); break;
case 6: intro_i=14; synchro(); break;
case 12: intro_i=15; synchro(); break;
case 32: intro_i=16; synchro(); break;
case 38: intro_i=17; synchro(); break;
case 44: intro_i=18; synchro(); break;
}
break;
case 3:
switch(mod_row)
{
case 0: intro_i=19; synchro(); break;
case 6: intro_i=20; synchro(); break;
case 12: intro_i=21; synchro(); break;
case 32: speed(); break;
}
break;
case 4:
if(mod_row==0)
{
border1_flag=true;
border2_flag=false;
razor_flag=false;
cube_flag=true;
cube_angle=main_angle;
circuit_flag=false;
intro_flag=false;
move_flag=false;
speed_flag=false;
speed_value=1.0f;
end_flag=false;
glenz_flag=false;
liner_flag=false;
flash();
fov_anim();
bgd_base_r=0.125f;
bgd_base_g=0.15f;
bgd_base_b=0.1f;
fog_color[0]=bgd_base_r;
fog_color[1]=bgd_base_g;
fog_color[2]=bgd_base_b;
glFogfv(GL_FOG_COLOR,fog_color);
}
break;
case 7:
if(mod_row==54) speed();
break;
case 8:
if(mod_row==0)
{
loop_counter++;
border1_flag=false;
border2_flag=true;
logo_flag=true;
razor_flag=true;
tekk_flag=false;
cube_flag=true;
circuit_flag=true;
glenz_flag=true;
intro_radius=3.0f;
liner_flag=true;
speed_flag=false;
txt=(loop_counter<1)?txt_info1:txt_info6;
calc_txt();
flash();
if(loop_counter>0) fov_anim();
bgd_base_r=0;
bgd_base_g=0.125f;
bgd_base_b=0.25f;
fog_color[0]=bgd_base_r;
fog_color[1]=bgd_base_g;
fog_color[2]=bgd_base_b;
glFogfv(GL_FOG_COLOR,fog_color);
}
break;
case 11:
if(mod_row==40)
{
fade();
sync2(0.5f);
}
break;
case 12:
if(mod_row==0)
{
border1_flag=true;
border2_flag=false;
logo_flag=true;
razor_flag=false;
cube_flag=false;
circuit_flag=false;
tunnel_flag=true;
tunnel_angle=main_angle;
glenz_flag=false;
liner_flag=true;
txt=txt_info2;
calc_txt();
flash();
for(i=0;i<tunnel_n1;i++)
{
angle=540.0f*PID;
x=tunnel_path*sinf(angle*0.125f)-tunnel_path*cosf(angle*0.375f);
y=tunnel_path*sinf(angle*0.25f)-tunnel_path*cosf(angle*0.25f);
tunnel_x[i]=x;
tunnel_y[i]=y;
tunnel_z[i]=-tunnel_depth*i;
}
bgd_base_r=0.0f;
bgd_base_g=0.05f;
bgd_base_b=0.1f;
fog_color[0]=bgd_base_r;
fog_color[1]=bgd_base_g;
fog_color[2]=bgd_base_b;
glFogfv(GL_FOG_COLOR,fog_color);
}
break;
case 15:
switch(mod_row)
{
case 40: fade(); break;
case 48: speed(); break;
}
break;
case 16:
if(mod_row==0)