-
Notifications
You must be signed in to change notification settings - Fork 1
/
inc__r2render.pas
1750 lines (1474 loc) · 85 KB
/
inc__r2render.pas
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
{*******************************************************************************
NFK [R2]
Render Library
Contains:
procedure Tmainform.DXDrawInitialize(Sender: TObject);
procedure SC_LoadModels;
procedure TMainForm.LoadGrafix();
procedure DrawCBMPFont(s:string;y:integer;size:byte);
procedure DrawBMPFont(s : string; x,y : Smallint ;size : byte);
procedure AddFireWorks(X, Y : word);
procedure ParseColorTextLimited(s: string;x,y:integer;fonttype:byte; limit:word);
procedure ParseCenterColorText(s: string;y:integer;fonttype:byte);
procedure DrawQWScoreBoard;
procedure DrawScoreBoard;
procedure ReSortScoreBoard;
procedure ScreenShot();
procedure TexturedNumbersOut(number:integer; x, y, n_width, n_height: integer; color:cardinal);
*******************************************************************************}
//------------------------------------------------------------------------------
procedure Tmainform.DXDrawInitialize(Sender: TObject);
begin
if not GAME_FULLLOAD then DXTimer.MayProcess := True;
end;
//------------------------------------------------------------------------------
procedure SC_LoadModels; // SC - system core :) not starcraft
var sr: TSearchRec;
tmp,tmp2 : TStringList;
i,a : smallint;
err : boolean;
filee : string;
format : cardinal;
begin
chdir(ROOTDIR+'\models');
tmp := TStringList.create;
tmp2 := TStringList.create;
tmp.clear;
tmp2.clear;
err := false;
if FindFirst('*.*', faDirectory, sr) = 0 then begin
if (sr.attr and faDirectory) = faDirectory then
if (sr.name <> '.') and (sr.name <> '..') then tmp.add(sr.name);
while FindNext(sr) = 0 do
if (sr.attr and faDirectory) = faDirectory then
if (sr.name <> '.') and (sr.name <> '..') then tmp.add(sr.name);
end;
if tmp.count = 0 then begin
loader.cns.lines.add('FATAL ERROR: no models found.');
mainform.close;
exit;
end;
NUM_MODELS := 0;
for i := 0 to tmp.count-1 do begin
tmp2.clear;
chdir(ROOTDIR+'\models');
chdir(tmp[i]);
if FindFirst('*.nmdl', faAnyFile, sr) = 0 then begin
tmp2.add(sr.Name);
while FindNext(sr) = 0 do
tmp2.add(sr.Name);
end;
if tmp2.count = 0 then continue;
// LOAD MODEL FROM INI;
for a := 0 to tmp2.count - 1 do begin
AllModels[NUM_MODELS].cached := false;
err := false;
loader.cns.lines.add('Loading model "'+tmp[i]+'\'+tmp2[a]+'"');
AllModels[NUM_MODELS].classname := lowercase(tmp[i]);
AllModels[NUM_MODELS].skinname := lowercase(IniGetString(tmp2[a],'main','name'));
AllModels[NUM_MODELS].walkframes := strtoint(IniGetString(tmp2[a],'main','walkframes'));
AllModels[NUM_MODELS].dieframes := strtoint(IniGetString(tmp2[a],'main','dieframes'));
AllModels[NUM_MODELS].modelsizex := strtoint(IniGetString(tmp2[a],'main','modelsizex'));
AllModels[NUM_MODELS].diesizey := strtoint(IniGetString(tmp2[a],'main','diesizey'));
AllModels[NUM_MODELS].crouchsizex := strtoint(IniGetString(tmp2[a],'main','crouchsizex'));
AllModels[NUM_MODELS].crouchsizey := strtoint(IniGetString(tmp2[a],'main','crouchsizey'));
AllModels[NUM_MODELS].crouchframes := strtoint(IniGetString(tmp2[a],'main','crouchframes'));
if AllModels[NUM_MODELS].modelsizex > 96 then AllModels[NUM_MODELS].modelsizex := 96;
if AllModels[NUM_MODELS].diesizey > 96 then AllModels[NUM_MODELS].diesizey := 96;
if AllModels[NUM_MODELS].crouchsizex > 96 then AllModels[NUM_MODELS].crouchsizex := 96;
if AllModels[NUM_MODELS].crouchsizey > 96 then AllModels[NUM_MODELS].crouchsizey := 96;
if not fileexists(IniGetString(tmp2[a],'main','walkbmp')) then begin err:=true; addmessage('notfound model.walkbmp'); end;
if not fileexists(IniGetString(tmp2[a],'main','diebmp')) then begin err:=true; addmessage('notfound model.diebmp'); end;
if not fileexists(IniGetString(tmp2[a],'main','crouchbmp')) then begin err:=true; addmessage('notfound model.crouchbmp'); end;
if not fileexists(IniGetString(tmp2[a],'main','walkpowerbmp')) then begin err:=true; addmessage('notfound model.walkpowerbmp'); end;
if not fileexists(IniGetString(tmp2[a],'main','crouchpowerupbmp')) then begin err:=true; addmessage('notfound model.crouchpowerupbmp'); end;
if not fileexists('death1.wav') then begin err:=true; addmessage('notfound death1.wav'); end;
if not fileexists('death2.wav') then begin err:=true; addmessage('notfound death2.wav'); end;
if not fileexists('death3.wav') then begin err:=true; addmessage('notfound death3.wav'); end;
if not fileexists('jump1.wav') then begin err:=true; addmessage('notfound jump1.wav'); end;
if not fileexists('pain100_1.wav') then begin err:=true; addmessage('notfound pain100_1.wav'); end;
if not fileexists('pain75_1.wav') then begin err:=true; addmessage('notfound pain75_1.wav'); end;
if not fileexists('pain50_1.wav') then begin err:=true; addmessage('notfound pain50_1.wav'); end;
if not fileexists('pain25_1.wav') then begin err:=true; addmessage('notfound pain25_1.wav'); end;
// conn: taunt
if not fileexists('taunt.wav') then begin {err:=true;} addmessage('notfound taunt.wav'); end;
if err=true then begin
loader.cns.lines.add('model "'+tmp[i]+'\'+tmp2[a]+'"'+' is invalid. ignored.');
continue;
end;
if IniGetString(tmp2[a],'main','version') <> '2' then begin
loader.cns.lines.add('model "'+tmp[i]+'\'+tmp2[a]+'"'+' have old version. ignored.');
continue;
end;
try
filee := IniGetString(tmp2[a],'main','walkbmp');
format := mainform.format2; if extractfileext(lowercase(filee)) <> '.tga' then format := D3DFMT_A1R5G5B5;
mainform.IMAGES[IMAGE_LAST+1].LoadFromFile(mainform.PowerGraph.D3DDevice8,filee, AllModels[NUM_MODELS].modelsizex,48,256,256, format);
if extractfileext(lowercase(filee)) <> '.tga' then
mainform.IMAGES[IMAGE_LAST+1].Set1bitAlpha ($FFFFFF);
except addmessage('error loading walk bitmap for model'); end;
AllModels[NUM_MODELS].walk_index := IMAGE_LAST+1;
try
filee := IniGetString(tmp2[a],'main','diebmp');
format := mainform.format2; if extractfileext(lowercase(filee)) <> '.tga' then format := D3DFMT_A1R5G5B5;
mainform.IMAGES[IMAGE_LAST+2].LoadFromFile(mainform.PowerGraph.D3DDevice8,filee,52,AllModels[NUM_MODELS].diesizey,256,256, format);
if extractfileext(lowercase(filee)) <> '.tga' then
mainform.IMAGES[IMAGE_LAST+2].Set1bitAlpha ($FFFFFF);
except addmessage('error loading die bitmap for model'); end;
AllModels[NUM_MODELS].die_index := IMAGE_LAST+2;
try
filee := IniGetString(tmp2[a],'main','crouchbmp');
format := mainform.format2; if extractfileext(lowercase(filee)) <> '.tga' then format := D3DFMT_A1R5G5B5;
mainform.IMAGES[IMAGE_LAST+3].LoadFromFile(mainform.PowerGraph.D3DDevice8,filee,AllModels[NUM_MODELS].crouchsizex,AllModels[NUM_MODELS].crouchsizey,256,256, format);
if extractfileext(lowercase(filee)) <> '.tga' then
mainform.IMAGES[IMAGE_LAST+3].Set1bitAlpha ($FFFFFF);
except addmessage('error loading crouch bitmap for model'); end;
AllModels[NUM_MODELS].crouch_index := IMAGE_LAST+3;
try
filee := IniGetString(tmp2[a],'main','walkpowerbmp');
format := mainform.format2; if extractfileext(lowercase(filee)) <> '.tga' then format := D3DFMT_A1R5G5B5;
mainform.IMAGES[IMAGE_LAST+4].LoadFromFile(mainform.PowerGraph.D3DDevice8,filee,AllModels[NUM_MODELS].modelsizex,48,256,256, format);
if extractfileext(lowercase(filee)) <> '.tga' then
mainform.IMAGES[IMAGE_LAST+4].Set1bitAlpha ($000000);
except addmessage('error loading walk power bitmap for model'); end;
AllModels[NUM_MODELS].power_index := IMAGE_LAST+4;
try
filee := IniGetString(tmp2[a],'main','crouchpowerupbmp');
format := mainform.format2; if extractfileext(lowercase(filee)) <> '.tga' then format := D3DFMT_A1R5G5B5;
mainform.IMAGES[IMAGE_LAST+5].LoadFromFile(mainform.PowerGraph.D3DDevice8,filee,AllModels[NUM_MODELS].crouchsizex,AllModels[NUM_MODELS].crouchsizey,256,256, format);
if extractfileext(lowercase(filee)) <> '.tga' then
mainform.IMAGES[IMAGE_LAST+5].Set1bitAlpha ($000000);
except addmessage('error loading crouch power bitmap for model'); end;
AllModels[NUM_MODELS].cpower_index := IMAGE_LAST+5;
AllModels[NUM_MODELS].walkstartframe := strtoint(IniGetString(tmp2[a],'main','walkstartframe'));
AllModels[NUM_MODELS].crouchstartframe := strtoint(IniGetString(tmp2[a],'main','crouchstartframe'));
AllModels[NUM_MODELS].framerefreshtime := strtoint(IniGetString(tmp2[a],'main','framerefreshtime'));
AllModels[NUM_MODELS].crouchrefreshtime := strtoint(IniGetString(tmp2[a],'main','crouchrefreshtime'));
if IniGetString(tmp2[a],'main','dieframerefreshtime')='' then AllModels[NUM_MODELS].dieframerefreshtime := AllModels[NUM_MODELS].framerefreshtime else
AllModels[NUM_MODELS].dieframerefreshtime := strtoint(IniGetString(tmp2[a],'main','dieframerefreshtime'));//support old modelz
if (AllModels[NUM_MODELS].framerefreshtime < 1) or (AllModels[NUM_MODELS].framerefreshtime >= 20) then
AllModels[NUM_MODELS].framerefreshtime := 5;
inc(IMAGE_LAST,5);
inc(NUM_MODELS);
end;
end;
if not GAME_FULLLOAD then for i := 0 to NUM_MODELS-1 do if (AllModels[i].cached = true) then AllModels[i].cached := false;
// load all soundz;
SND.loadModelSounds();
loader.cns.lines.add(Inttostr(NUM_MODELS)+' models processed.');
FindClose(sr);
chdir(rootdir);
end;
//------------------------------------------------------------------------------
procedure TMainForm.LoadGrafix();
// var Res: Integer;
var ts : tstringlist;
begin
//Images[0].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'bg_menu', Format1);
Images[0].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\textures\sfx\logo512.jpg', Format2); // conn: q3 orig background
//Images[1].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'mainmenu', Format2);
//Images[42].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'mainmenu_glow', Format2);
Images[1].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\font1_prop.tga',Format2);
Images[42].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\font1_prop_glo.tga', Format2);
Images[2].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'combust', Format2);
Images[3].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, '32x32', Format2);
Images[4].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'logo', Format2); // conn: old logo
// conn: new logo
//Images[4].LoadFromFile(PowerGraph.D3DDevice8, ROOTDIR+'\custom\logo2.tga',256, 91,256,256, Format2);
Images[5].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'buttons', D3DFMT_A4R4G4B4);
Images[6].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'console', Format2);
Images[7].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\gfx\misc\console02.jpg', Format2); // conn: console overlay
if fileexists(ROOTDIR+'\custom\bg_1.jpg') then
images[11].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\custom\bg_1.jpg', Format1) else
Images[11].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'bg_1', Format1);
if fileexists(ROOTDIR+'\custom\bg_2.jpg') then
images[12].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\custom\bg_2.jpg', Format1) else
Images[12].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'bg_2', Format1);
if fileexists(ROOTDIR+'\custom\bg_3.jpg') then
images[13].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\custom\bg_3.jpg', Format1) else
Images[13].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'bg_3', Format1);
if fileexists(ROOTDIR+'\custom\bg_4.jpg') then
images[14].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\custom\bg_4.jpg', Format1) else
Images[14].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'bg_4', Format1);
if fileexists(ROOTDIR+'\custom\bg_5.jpg') then
images[15].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\custom\bg_5.jpg', Format1) else
Images[15].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'bg_5', Format1);
if fileexists(ROOTDIR+'\custom\bg_6.jpg') then
images[16].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\custom\bg_6.jpg', Format1) else
Images[16].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'bg_6', Format1);
if fileexists(ROOTDIR+'\custom\bg_7.jpg') then
images[17].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\custom\bg_7.jpg', Format1) else
Images[17].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'bg_7', Format1);
if fileexists(ROOTDIR+'\custom\bg_8.jpg') then
images[18].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\custom\bg_8.jpg', Format1) else
Images[18].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'bg_8', Format1);
// Images[19].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'lava_anim', Format2);
Images[20].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'bricks_t', Format1);
Images[21].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'bricks_t2', Format2);
Images[22].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'item', Format2);
Images[23].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'medkit', Format2);
Images[24].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'jumppad_anim', Format2);
Images[25].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'gauntlet', Format2);
Images[26].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'weapons', Format2);
Images[27].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'crosshair', Format2);
Images[28].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'smoke', Format2);
Images[29].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'shaft', Format2);
Images[30].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'portal', Format2);
Images[31].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'portal_anim', Format2);
Images[32].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'flash', Format2);
Images[33].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'explosion', D3DFMT_A4R4G4B4);
Images[34].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, '24x24', D3DFMT_A4R4G4B4);
Images[35].LoadFromVTDb(VTDb2, PowerGraph.D3DDevice8, '16x16', D3DFMT_A4R4G4B4);
// Images[35].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, '16x16', D3DFMT_A4R4G4B4);
Images[36].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, '8x8', Format2);
Images[37].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'medkits', Format2);
Images[38].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'statusbar', D3DFMT_A4R4G4B4);
Images[39].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'weapbar', Format2);
Images[40].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'powerup', Format2);
if fileexists(ROOTDIR+'\custom\stats.jpg') then
images[41].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\custom\stats.jpg', Format2) else
Images[41].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'stats', Format2);
Images[43].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'scrollbar', Format2);
// cursor
{
if fileexists(ROOTDIR+'\menu\art\3_cursor2.tga') then
images[44].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\3_cursor2.tga', Format2) else
}
Images[44].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'cursorz', Format2);
Images[45].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'loader', Format2);
Images[46].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'buttons2', Format2);
Images[47].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'flag', Format2);
// Images[48]. custom brick palette...
if SYS_USECUSTOMPALETTE then begin
DeCompressedPaletteStream.Position := 0;
images[48].LoadFromStream(PowerGraph.D3DDevice8,DeCompressedPaletteStream,32,16,256,256,D3DFMT_A1R5G5B5);
if SYS_USECUSTOMPALETTE_TRANSPARENT then images[48].Set1bitAlpha(SYS_USECUSTOMPALETTE_TRANS_COLOR);
end;
if fileexists(ROOTDIR+'\custom\console.jpg') then begin
images[49].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\custom\console.jpg', D3DFMT_R5G6B5);
SYS_CUSTOM_GRAPH_CONSOLE := TRUE;
end;
// Images[50].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'energypole', D3DFMT_R5G6B5);
Images[50].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8,'weapicon', D3DFMT_A1R5G5B5);
Images[51].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'ctf_icons', Format2);
Images[53].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'dom1_2', Format2);
Images[52].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'dom1_3', Format2);
Images[54].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'glow', Format2);
Images[55].LoadFromVTDb(VTDb, PowerGraph.D3DDevice8, 'smoke32b', Format2);
// images[56].LoadFromFile(PowerGraph.D3DDevice8,ROOTDIR+'\planet.bmp',48,48,256,256,D3DFMT_A1R5G5B5);
// images[56].Set1bitAlpha ($FFFFFF);
// images[57].LoadFromFile(PowerGraph.D3DDevice8,ROOTDIR+'\system\p1.dat',24,23,128,128,D3DFMT_A1R5G5B5);
Images[57].LoadFromVTDb(VTDb2, PowerGraph.D3DDevice8, 'gui', D3DFMT_A1R5G5B5);
// images[57].Set1bitAlpha ($FF00FF);
if fileexists(ROOTDIR+'\system\p2.dat') then begin
images[56].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\system\p2.dat', D3DFMT_R5G6B5);
SYS_BANNER := TRUE;
end;
Images[19].LoadFromVTDb(VTDb2,PowerGraph.D3DDevice8,'env_lava', D3DFMT_R5G6B5);
Images[58].LoadFromVTDb(VTDb2,PowerGraph.D3DDevice8,'env_water',D3DFMT_R5G6B5);
Images[59].LoadFromVTDb(VTDb2,PowerGraph.D3DDevice8, 'gibs', Format2);
Images[60].LoadFromVTDb(VTDb2,PowerGraph.D3DDevice8, 'labels', Format2);
// conn: [?] unpacked files
Images[61].LoadFromFile(PowerGraph.D3DDevice8, ROOTDIR+'\system\numbers.tga', 32, 32,256,256, Format2);
Images[62].LoadFromFile(PowerGraph.D3DDevice8, ROOTDIR+'\system\armors.tga', 32, 16,128,128, Format2);
Images[63].LoadFromFile(PowerGraph.D3DDevice8, ROOTDIR+'\system\icons2.tga', 32, 32,128,128, Format2);
// Images[60].Set1bitAlpha ($0);
// conn: animated machinegun
Images[64].LoadFromVTDb(VTDb2,PowerGraph.D3DDevice8, 'mgun_ex', Format2); // conn: animated machinegun
// conn: animated powerups
Images[65].LoadFromVTDb(VTDb,PowerGraph.D3DDevice8, 'fine_regen', Format2); //
Images[66].LoadFromVTDb(VTDb,PowerGraph.D3DDevice8, 'fine_quad', Format2); //
Images[67].LoadFromVTDb(VTDb,PowerGraph.D3DDevice8, 'fine_mega', Format2); //
Images[68].LoadFromVTDb(VTDb,PowerGraph.D3DDevice8, 'fine_invis', Format2); //
Images[69].LoadFromVTDb(VTDb,PowerGraph.D3DDevice8, 'fine_haste', Format2); //
Images[70].LoadFromVTDb(VTDb,PowerGraph.D3DDevice8, 'fine_fly', Format2); //
Images[71].LoadFromVTDb(VTDb,PowerGraph.D3DDevice8, 'fine_battle', Format2); //
// conn: marks on walls
Images[72].LoadFromVTDb(VTDb2,PowerGraph.D3DDevice8, 'burn_med_mrk', D3DFMT_A8R8G8B8);
Images[73].LoadFromVTDb(VTDb2,PowerGraph.D3DDevice8, 'railhit', Format2);
Images[74].LoadFromVTDb(VTDb,PowerGraph.D3DDevice8, 'bullet_mrk', D3DFMT_A8R8G8B8);
Images[75].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\bg_credits0.tga', D3DFMT_A8R8G8B8);
Images[76].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\bg_credits1.tga', D3DFMT_A8R8G8B8);
Images[77].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\bg_credits3.tga', D3DFMT_A8R8G8B8);
Images[78].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\bg_credits4.tga', D3DFMT_A8R8G8B8);
Images[79].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\bg_credits5.tga', D3DFMT_A8R8G8B8);
Images[80].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\frame2_l.tga', D3DFMT_A8R8G8B8);
Images[81].LoadFromVTDb(VTDb2, PowerGraph.D3DDevice8, 'railtrace1', Format2);
Images[82].LoadFromVTDb(VTDb2, PowerGraph.D3DDevice8, 'railtrace3', Format2);
Images[83].LoadFromVTDb(VTDb2, PowerGraph.D3DDevice8, 'railtrace4', Format2);
Images[84].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\textures\sfx\fog0.tga',D3DFMT_A8R8G8B8);
// Menu on\off image
Images[85].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\switch_on.tga',D3DFMT_A8R8G8B8);
Images[86].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\switch_off.tga',D3DFMT_A8R8G8B8);
Images[87].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\frame1_l.tga',D3DFMT_A8R8G8B8);
// back button
Images[88].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\model_0.tga',D3DFMT_A8R8G8B8);
Images[89].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\model_1.tga',D3DFMT_A8R8G8B8);
// model grid
Images[90].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\player_models_ports.tga',D3DFMT_A8R8G8B8);
// horiz arrows
Images[91].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\gs_arrows_0.tga',D3DFMT_A8R8G8B8);
Images[92].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\gs_arrows_l.tga',D3DFMT_A8R8G8B8);
Images[93].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\gs_arrows_r.tga',D3DFMT_A8R8G8B8);
// cut menu
Images[94].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\cut_frame.tga',D3DFMT_A8R8G8B8);
// grid selection
Images[95].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\opponents_select.tga',D3DFMT_A8R8G8B8);
Images[96].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\opponents_selected.tga',D3DFMT_A8R8G8B8);
// railcolor rainbow
Images[97].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\fx_base.tga',D3DFMT_A8R8G8B8);
Images[98].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\fx_white.tga',D3DFMT_A8R8G8B8);
// draggable bar
Images[99].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\slider2.tga',D3DFMT_A8R8G8B8);
Images[100].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\sliderbutt_0.tga',D3DFMT_A8R8G8B8);
Images[101].LoadFromFileAuto(PowerGraph.D3DDevice8, ROOTDIR+'\menu\art\sliderbutt_1.tga',D3DFMT_A8R8G8B8);
IMAGE_LAST := 102;
Font1.LoadFromFile(ROOTDIR+'\system\verdana10.fnt', Format2);
Font2.LoadFromFile(ROOTDIR+'\system\verdana8.fnt', Format2);
Font2b.LoadFromFile(ROOTDIR+'\system\verdana8b.fnt', Format2);
Font2s.LoadFromFile(ROOTDIR+'\system\verdana7.fnt', Format2);
Font2ss.LoadFromFile(ROOTDIR+'\system\verdana7ss.fnt', Format2);
Font3.LoadFromFile(ROOTDIR+'\system\vag14.fnt', Format2);
Font4.LoadFromFile(ROOTDIR+'\system\vag12.fnt', Format2);
if GAME_FULLLOAD then SC_LoadModels;
end;
//-----------------------------------------------------------------------------
procedure DrawCBMPFont(s:string;y:integer;size:byte);
var x : word;
begin
x := round(320-(length(s)*size)/2);
DrawBMPFont(s,x,y,size);
end;
//-----------------------------------------------------------------------------
procedure DrawBMPFont(s : string; x,y : Smallint ;size : byte);
var i,nm : word;
begin
exit;
if s = '' then exit;
for i := 1 to length(s) do begin
nm := ord(s[i])-32;
// case size of
// 14 : mainform.ImageList.Items.Find('font14').Draw(mainform.DXDraw.Surface, x+14*(i-1),y, nm);
// 12 : mainform.ImageList.Items.Find('font12').Draw(mainform.DXDraw.Surface, x+12*(i-1),y, nm);
// 10 : mainform.ImageList.Items.Find('font10').Draw(mainform.DXDraw.Surface, x+10*(i-1),y, nm);
// 8 : mainform.ImageList.Items.Find('font8').Draw(mainform.DXDraw.Surface, x+8*(i-1),y, nm);
// else addmessage('error: unknown font size: '+inttostr(size));
// end;
end;
end;
//------------------------------------------------------------------------------
procedure AddFireWorks(X, Y : word);
var i : word;
begin
for i := 0 to 1000 do
if GameObjects[i].dead = 2 then begin
GameObjects[i].x := X;
GameObjects[i].y := y;
GameObjects[i].DXID := 0;
GameObjects[i].dude := true;
GameObjects[i].frame := 0;
GameObjects[i].dead := 0;
GameObjects[i].health := 256 + random(512);
GameObjects[i].objname := 'spark';
GameObjects[i].topdraw:=2;
GameObjects[i].cx := random($FFFFFF);
GameObjects[i].spawner := players[0];
exit;
end;
end;
//------------------------------------------------------------------------------
procedure ParseColorTextLimited(s: string;x,y:integer;fonttype:byte; limit:word);
var
readcolor : boolean;
i : word;
clr,a:cardinal;
lastpos:integer;
doblink:boolean;
begin
if s='' then exit;
lastpos := x;
a := $FF;
clr:=$FFFFFF;
doblink:=false;
for i := 1 to length(s) do begin
if (readcolor) and (s[i]<>'^') then begin
readcolor := false;
if s[i]='#' then clr := $EB9D07 else
if (ord(s[i]) >= 49) and (ord(s[i]) <= 55) then begin
clr:=ACOLOR[strtoint(s[i])];
end;
if s[i] = 'b' then doblink:=true;
if s[i] = 'n' then doblink:=false;
if doblink then a:=font_alpha else a := $FF;
end else
if (readcolor=false) and (s[i]='^') then readcolor:=true else begin
if fonttype=0 then begin // font1.
mainform.font1.TextOutEx(s[i],lastpos,y,(a shl 24)+clr,effectSrcAlpha or EffectDiffuseAlpha);
lastpos := lastpos+mainform.font1.TextWidth (s[i]);
end else
if fonttype=1 then begin // font2b.
mainform.font2b.TextOutEx(s[i],lastpos,y,(a shl 24)+clr,effectSrcAlpha or EffectDiffuseAlpha);
lastpos := lastpos+mainform.font2b.TextWidth (s[i]);
end else
if fonttype=2 then begin // font2s.
mainform.font2s.TextOutEx(s[i],lastpos,y,(a shl 24)+clr,effectSrcAlpha or EffectDiffuseAlpha);
lastpos := lastpos+mainform.font2s.TextWidth (s[i]);
end else
if fonttype=3 then begin // font2ss.
mainform.font2ss.TextOutEx(s[i],lastpos,y,(a shl 24)+clr,effectSrcAlpha or EffectDiffuseAlpha);
lastpos := lastpos+mainform.font2ss.TextWidth (s[i]);
end else
if fonttype=4 then begin // font4.
mainform.font4.TextOutEx(s[i],lastpos,y,(a shl 24)+clr,effectSrcAlpha or EffectDiffuseAlpha);
lastpos := lastpos+mainform.font4.TextWidth (s[i]);
end else
if fonttype=5 then begin // font2.
mainform.font2.TextOutEx(s[i],lastpos,y,(a shl 24)+clr,effectSrcAlpha or EffectDiffuseAlpha);
lastpos := lastpos+mainform.font2.TextWidth (s[i]);
end;
if fonttype=6 then begin // font3.
mainform.font3.TextOutEx(s[i],lastpos,y,(a shl 24)+clr,effectSrcAlpha or EffectDiffuseAlpha);
lastpos := lastpos+mainform.font3.TextWidth (s[i]);
end;
if limit<(lastpos-x) then exit;
end;
end;
end;
//------------------------------------------------------------------------------
function GetColorTextCount(s:string):word;
var charcount:byte;
readcolor : boolean;
i:word;
begin
charcount:=0;
if s='' then begin result := 0; exit; end;
for i := 1 to length(s) do begin
if (readcolor) and (s[i]<>'^') then begin
readcolor := false;
end else
if (readcolor=false) and (s[i]='^') then readcolor:=true else begin
inc(charcount);
end;
end;
result := charcount;
end;
function GetColorTextWidth(s:string;fonttype:byte): word;
var
readcolor : boolean;
i : word;
lastpos:integer;
begin
if s='' then begin result := 0; exit; end;
lastpos := 0;
for i := 1 to length(s) do begin
if (readcolor) and (s[i]<>'^') then begin
readcolor := false;
end else
if (readcolor=false) and (s[i]='^') then readcolor:=true else begin
if fonttype=0 then begin // font1.
lastpos := lastpos+mainform.font1.TextWidth (s[i]);
end else
if fonttype=1 then begin // font2b.
lastpos := lastpos+mainform.font2b.TextWidth (s[i]);
end else
if fonttype=2 then begin // font2s.
lastpos := lastpos+mainform.font2s.TextWidth (s[i]);
end else
if fonttype=3 then // font2ss.
lastpos := lastpos+mainform.font2ss.TextWidth (s[i]) else
if fonttype=4 then // font4.
lastpos := lastpos+mainform.font4.TextWidth (s[i]) else
if fonttype=5 then // font2.
lastpos := lastpos+mainform.font2.TextWidth (s[i]);
if fonttype=6 then // font2.
lastpos := lastpos+mainform.font3.TextWidth (s[i]);
end;
end;
result := lastpos;
end;
procedure ParseColorText(s: string;x,y:integer;fonttype:byte);
var
readcolor : boolean;
i : word;
clr,a:cardinal;
lastpos:integer;
doblink:boolean;
ali : boolean;
begin
if s='' then exit;
lastpos := x;
a := $FF;
clr:=$FFFFFF;
doblink:=false;
//ali := mainform.PowerGraph.Antialias;
mainform.PowerGraph.Antialias := true;
for i := 1 to length(s) do begin
if (readcolor) and (s[i]<>'^') then begin
readcolor := false;
if s[i]='#' then clr := $EB9D07 else
if s[i]='%' then clr := $00CEA0 else
if s[i]='&' then clr := $0073CB else
if s[i]='!' then clr := $aaaaaa else
if s[i]='0' then clr := $000000 else
// if s[i]='@' then clr := $666666 else
// if s[i]='@' then clr := $7700CB else
if (ord(s[i]) >= 49) and (ord(s[i]) <= 55) then begin
clr:=ACOLOR[strtoint(s[i])];
end;
if s[i] = 'b' then doblink:=true;
if s[i] = 'n' then doblink:=false;
if doblink then a:=font_alpha else a := $FF;
end else
if (readcolor=false) and (s[i]='^') and (i < length(s)) then readcolor:=true else begin
if fonttype=0 then begin // font1.
mainform.font1.TextOutEx(s[i],lastpos,y,(a shl 24)+clr,effectSrcAlpha or EffectDiffuseAlpha);
lastpos := lastpos+mainform.font1.TextWidth (s[i]);
end else
if fonttype=1 then begin // font2b.
mainform.font2b.TextOutEx(s[i],lastpos,y,(a shl 24)+clr,effectSrcAlpha or EffectDiffuseAlpha);
lastpos := lastpos+mainform.font2b.TextWidth (s[i]);
end else
if fonttype=2 then begin // font2s.
mainform.font2s.TextOutEx(s[i],lastpos,y,(a shl 24)+clr,effectSrcAlpha or EffectDiffuseAlpha);
lastpos := lastpos+mainform.font2s.TextWidth (s[i]);
end else
if fonttype=3 then begin // font2ss.
mainform.font2ss.TextOutEx(s[i],lastpos,y,(a shl 24)+clr,effectSrcAlpha or EffectDiffuseAlpha);
lastpos := lastpos+mainform.font2ss.TextWidth (s[i]);
end else
if fonttype=4 then begin // font4.
mainform.font4.TextOutEx(s[i],lastpos,y,(a shl 24)+clr,effectSrcAlpha or EffectDiffuseAlpha);
lastpos := lastpos+mainform.font4.TextWidth (s[i]);
end else
if fonttype=5 then begin // font2.
mainform.font2.TextOutEx(s[i],lastpos,y,(a shl 24)+clr,effectSrcAlpha or EffectDiffuseAlpha);
lastpos := lastpos+mainform.font2.TextWidth (s[i]);
end;
if fonttype=6 then begin // font3.
mainform.font3.TextOutEx(s[i],lastpos,y,(a shl 24)+clr,effectSrcAlpha or EffectDiffuseAlpha);
lastpos := lastpos+mainform.font3.TextWidth (s[i]);
end;
end;
end;
//mainform.PowerGraph.Antialias := ali;
end;
//------------------------------------------------------------------------------
procedure ParseCenterColorText(s: string;y:integer;fonttype:byte);
begin
ParseColorText(s,320-(GetColorTextWidth(s,fonttype) div 2),y,fonttype);
end;
//------------------------------------------------------------------------------
procedure DrawQWScoreBoard;
var i,b,z, spectadd:byte;
maxnickname_length : word;
tmp : word;
time_ :cardinal;
sz : array[0..3] of word; // positions. ping, frags, name, TOP, LEFT
aph : cardinal;
begin
// Detect ScoreBoardSizes;
maxnickname_length := 50;
if scoreboard_ts.count >=1 then
for b := 0 to scoreboard_ts.count-1 do
for i:=0 to SYS_MAXPLAYERS-1 do if players[i]<> nil then
if players[i].dxid = strtoint(scoreboard_ts[b]) then begin
tmp := GetColorTextWidth (players[i].netname,1);
if tmp > maxnickname_length then
maxnickname_length := tmp;
end;
maxnickname_length := maxnickname_length + 120;
sz[0] := mainform.PowerGraph.width div 2 - (maxnickname_length) div 2;
sz[1] := mainform.PowerGraph.width div 2 - (maxnickname_length + 40) div 2;
sz[2] := mainform.PowerGraph.width div 2 + maxnickname_length;
// Rect
sz[3] := mainform.PowerGraph.Height div 3 - (scoreboard_ts.count * 16) div 2;
spectadd := SpectatorList.count * 16;
mainform.PowerGraph.Rectangle(
sz[0]-10,
sz[3] - 16,
maxnickname_length+20,
(scoreboard_ts.count * 16)+18 + spectadd,
$FF000000, $88000000,2 or $100);
mainform.PowerGraph.Line( sz[0]-9, sz[3], sz[0]+maxnickname_length+9, sz[3], $FF000000, 0);
mainform.Font2b.TextOut('PING',sz[0]+5, sz[3]-16,clwhite);
mainform.Font2b.TextOut('FRAGS',sz[0]+60, sz[3]-16,clwhite);
mainform.Font2b.TextOut('NAME',sz[0]+120, sz[3]-16,clwhite);
// Print Names
if scoreboard_ts.count >=1 then
for b := 0 to scoreboard_ts.count-1 do
for i:=0 to SYS_MAXPLAYERS-1 do if players[i]<> nil then
if players[i].dxid = strtoint(scoreboard_ts[b]) then begin
if (TeamGame) then begin
aph := $44; // transparency
if players[i].dxid = MyDXIDIS then aph := $99;
if PLAYERS[i].TEAM=0 then begin
// Team 1
//
MainForm.PowerGraph.FillRect(sz[0]-9,sz[3]+1+b*16,maxnickname_length+18,16,(aph shl 24)+$FF0000,2 or $100);
mainform.Font2b.TextOut(inttostr(players[i].ping), sz[0]+30 - mainform.Font2b.TextWidth (inttostr(players[i].ping)) , sz[3]+b*16,clwhite);
mainform.Font2b.TextOut(inttostr(players[i].frags),sz[0]+90 - mainform.Font2b.TextWidth (inttostr(players[i].frags)), sz[3]+b*16,clwhite);
ParseColorText(players[i].netname,sz[0]+120,sz[3]+b*16,1);
end else if PLAYERS[i].TEAM=1 then begin
// Team 2
//
MainForm.PowerGraph.FillRect(
sz[0]-9,sz[3]+1+b*16,
maxnickname_length+18,16,(aph shl 24)+$0000FF, 2 or $100
);
// ping
mainform.Font2b.TextOut(
inttostr(players[i].ping),
sz[0]+30 - mainform.Font2b.TextWidth (inttostr(players[i].ping)) ,
sz[3]+b*16,clwhite
);
// frags
mainform.Font2b.TextOut(
inttostr(players[i].frags),
sz[0]+90 - mainform.Font2b.TextWidth (inttostr(players[i].frags)),
sz[3]+b*16,
clwhite
);
// name
ParseColorText(
players[i].netname,
sz[0]+120 + 200,
sz[3]+b*16, 1
);
end else MainForm.PowerGraph.FillRect(sz[0]-9,sz[3]+1+b*16,maxnickname_length+18,16,(aph shl 24)+$00FFFF,2 or $100);
end else begin
// Not a Team Game
if players[i].dxid = MyDXIDIS then
MainForm.PowerGraph.FillRect(sz[0]-9,sz[3]+1+b*16,maxnickname_length+18,16,$33FFFFFF,2 or $100);
mainform.Font2b.TextOut(inttostr(players[i].ping),sz[0]+30 - mainform.Font2b.TextWidth (inttostr(players[i].ping)) , sz[3]+b*16,clwhite);
mainform.Font2b.TextOut(inttostr(players[i].frags),sz[0]+90 - mainform.Font2b.TextWidth (inttostr(players[i].frags)), sz[3]+b*16,clwhite);
ParseColorText(players[i].netname,sz[0]+120,sz[3]+b*16,1);
end;
break;
end;
if SpectatorList.count > 0 then
for i := 0 to SpectatorList.count-1 do begin
ParseColorText(TSpectator ( SpectatorList.items[i]^).netname,sz[0]+120,sz[3]+b*16+i*16,1);
mainform.Font2b.TextOut('SPECT',sz[0],sz[3]+b*16+i*16, clwhite);
end;
end;
//------------------------------------------------------------------------------
procedure DrawScoreBoard;
var i,b,z,modelID, spectadd:byte;
red_n, blu_n, ufo_n: byte;
time_ :cardinal;
begin
time_ := gettickcount;
if scoreboard_to < time_ then begin
scoreboard_to := gettickcount + 1000;
ReSortScoreBoard;
end;
if OPT_QWSCOREBOARD then begin
DrawQWScoreBoard;
exit;
end;
with mainform do begin
PowerGraph.FillRect(20,148,600,178 + spectadd,COLORARRAY[OPT_GAMEMENUCOLOR],effectMul);
if MATCH_GAMETYPE=GAMETYPE_TEAM then begin
PowerGraph.FillRect(20,120,600,28,COLORARRAY[OPT_GAMEMENUCOLOR],effectMul);
ParseCenterColorText('^1RED ^7TEAM: ^7'+inttostr(GetRedTeamScore)+' ^4BLUE ^7TEAM: ^7'+inttostr(GetBlueTeamScore),130,4);
end;
if MATCH_GAMETYPE=GAMETYPE_CTF then begin
PowerGraph.FillRect(20,100,600,48,COLORARRAY[OPT_GAMEMENUCOLOR],effectMul);
ParseCenterColorText('^1RED ^7SCORE: ^7'+inttostr(GetRedTeamScore)+' ^4BLUE ^7SCORE: ^7'+inttostr(GetBlueTeamScore),130,4);
ParseCenterColorText('^1RED ^7CAPTURES: ^7'+inttostr(MATCH_REDTEAMSCORE)+' ^4BLUE ^7CAPTURES: ^7'+inttostr(MATCH_BLUETEAMSCORE),110,4);
end;
if MATCH_GAMETYPE=GAMETYPE_DOMINATION then begin
PowerGraph.FillRect(20,100,600,48,COLORARRAY[OPT_GAMEMENUCOLOR],effectMul);
ParseCenterColorText('^1RED ^7SCORE: ^7'+inttostr(GetRedTeamScore)+' ^4BLUE ^7SCORE: ^7'+inttostr(GetBlueTeamScore),130,4);
if ismultip=1 then
ParseCenterColorText('^1RED ^7DOMSCORE: ^7'+inttostr(MATCH_REDTEAMSCORE div 3)+' ^4BLUE ^7DOMSCORE: ^7'+inttostr(MATCH_BLUETEAMSCORE div 3),110,4)
else ParseCenterColorText('^1RED ^7DOMSCORE: ^7'+inttostr(MATCH_REDTEAMSCORE)+' ^4BLUE ^7DOMSCORE: ^7'+inttostr(MATCH_BLUETEAMSCORE),110,4);
end;
spectadd := SpectatorList.count * 16;
// conn: new scoreboard
if scoreboard_ts.count >=1 then
for b := 0 to scoreboard_ts.count-1 do
for i:=0 to SYS_MAXPLAYERS-1 do if players[i]<> nil then
if players[i].dxid = strtoint(scoreboard_ts[b]) then begin
if (TeamGame) then begin
Font2s.TextOut('Score', 60,164,clRed);
Font2s.TextOut('Lag', 100,164,clRed);
Font2s.TextOut('Name', 130,164,clRed);
Font2s.TextOut('Score', 350,164,clBlue);
Font2s.TextOut('Lag', 390,164,clBlue);
Font2s.TextOut('Name', 420,164,clBlue);
if PLAYERS[i].TEAM = 0 then begin
// BLUE Team
inc(blu_n,1);
// Score
Font2b.TextOut(inttostr(players[i].Frags),355,170+blu_n*16,clwhite);
// Ping
Font2b.TextOut(inttostr(players[i].ping), 390,170+blu_n*16,clLime);
// Model
PowerGraph.RotateEffect2(
Images[players[i].walk_index],
350-20,
179+blu_n*16,
64, 256, $FFFFFFFF,
0, 0, 32, 16,
0, effectSrcAlpha or EffectDiffuseAlpha
);
// Name
ParseColorText(players[i].netname,420,170+blu_n*16,1);
end else if PLAYERS[i].TEAM =1 then begin
// RED Team
inc(red_n,1);
// Score
Font2b.TextOut(inttostr(players[i].Frags),65,170+red_n*16,clwhite);
// Ping
Font2b.TextOut(inttostr(players[i].ping), 100,170+red_n*16,clLime);
// Model
PowerGraph.RotateEffect2(
Images[players[i].walk_index],
45,
179+red_n*16,
64, 256, $FFFFFFFF,
0, 0, 32, 16,
0, effectSrcAlpha or EffectDiffuseAlpha
);
// Name
ParseColorText(players[i].netname,130,170+red_n*16,1);
end else if PLAYERS[i].TEAM =2 then begin
// Unknown Team
inc(ufo_n,1);
// Score
Font2b.TextOut(inttostr(players[i].Frags),60,170+ufo_n*16 + 100,clwhite);
// Ping
Font2b.TextOut(inttostr(players[i].ping), 100,170+ufo_n*16 + 100,clLime);
// Model
PowerGraph.RotateEffect2(
Images[players[i].walk_index],
45,
179+ufo_n*16 + 100,
64, 256, $FFFFFFFF,
0, 0, 32, 16,
0, effectSrcAlpha or EffectDiffuseAlpha
);
//PowerGraph.FillRect(72,190+b*16,4,10,clYellow,effectAdd);
ParseColorText(players[i].netname,130,170+ufo_n*16 + 100,1);
end;
end else begin
// Not a Team Play
Font2b.TextOut('Name', 80,164,clYellow);
Font2b.TextOut('Frags', 400,164,clYellow);
Font2b.TextOut('Lag', 510,164,clYellow);
// Score
Font2b.TextOut(inttostr(players[i].Frags),400,186+b*16,clwhite);
// Ping
Font2b.TextOut(inttostr(players[i].ping), 510,186+b*16,clwhite);
// Model
PowerGraph.RotateEffect2(
Images[players[i].walk_index],
45,
195+b*16,
64, 256, $FFFFFFFF,
0, 0, 32, 16,
0, effectSrcAlpha or EffectDiffuseAlpha
);
// Name
ParseColorText(players[i].netname,80,186+b*16,1);
end;
break;
end;
if SpectatorList.count > 0 then
for i := 0 to SpectatorList.count-1 do begin
inc(ufo_n,1);
ParseColorText(TSpectator ( SpectatorList.items[i]^).netname,80,180+ufo_n*16 + 100,1);
Font2b.TextOut('SPECT',416,100+b*16+i*16, clwhite);
end;
end;
end;
//------------------------------------------------------------------------------
procedure ReSortScoreBoard;
var ts : TStringList;
i, find : byte;
str : string;
begin
ts := TStringList.Create;
scoreboard_ts.clear;
for i := 0 to SYS_MAXPLAYERS-1 do
if players[i] <> nil then begin
ts.add(inttostr(players[i].frags));
players[i].loadframe := 0; // not sorted yet
end;
if ts.count=0 then exit; // :) i found this bug, when i was playing with some guy, with ping around 3000, but its does not matter :)
ts.CustomSort(CUSTOMSORT_PL);
for i := 0 to ts.count-1 do
for find := 0 to SYS_MAXPLAYERS-1 do
if players[find] <> nil then
if (inttostr(players[find].frags) = ts[i]) and (players[find].loadframe = 0) then begin
scoreboard_ts.add(inttostr(players[find].DXID));
ts[i] := '-999';
players[find].loadframe := 1;
break;
end;
ts.free;
end;
//------------------------------------------------------------------------------
procedure ScreenShot();
var counter:integer;
filename: string;
avidemoz:TBitmap;
DC:HDC;
JPG:TJpegImage;
WH,HH:word;
ext:string[4];
begin
if OPT_CL_AVIMODE=false then begin// jpeg output.
JPG := TJpegimage.create;
ext := '.jpg';
end else ext := '.bmp';
avidemoz := TBitmap.create;
if mainform.PowerGraph.FullScreen = true then begin
WH := 640;
HH := 480;
end else begin
WH:= mainform.Width;