-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtypestuff.pas
4665 lines (4021 loc) · 115 KB
/
typestuff.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
unit Typestuff;
interface
uses
Sysutils,
D3DX9,
windows,
Classes,
Direct3D9,
perlinnoise,
math,
Zlibex,
sha1,
winsock2,
qjson;
type
array4ofbyte=array[0..3] of byte;
THUDmessage=class(TObject)
public
value:string;
fade:word;
color:longword;
constructor create(input:string;col:longword;f:word);
end;
TStringArray=array of string;
TSingleArray=array of single;
Tnev=array[1..32] of char;
Tjelszo=array[1..32] of char;
Tintarr=array of integer;
Tfloatarr=array of single;
Tbytearr=array of byte;
Tsmallintdynarr=array of smallint;
Tarrayofpointer=array of pointer;
Psmallintarray=^Tsmallintarray;
Tsmallintarray=array[0..10000] of smallint;
Pshortintarray=^Tshortintarray;
Tshortintarray=array[0..10000] of shortint;
Tadvwove=function(xx,zz:single):single;
Tyandnorm=procedure(var xx,yy,zz:single;var norm:Td3dvector;scalfac:single);
P3DVertexarray=^T3DVertexarray;
T3DVertexarray=array[0..1000000] of TD3DXVector3;
PCustomVertex=^TCustomVertex;
TCustomVertex=record
position:TD3DVector;// The 3D position for the vertex
normal:TD3DVector;// The surface normal for the vertex
color:longword;
u,v:single;
u2,v2:single;
end;
PCustomVertexArray=^TCustomVertexArray;
TCustomVertexArray=array[0..100000] of TCustomVertex;
Plvl=^Tlvl;
Tlvl=array[0..33*33] of TCustomVertex;
PSkyVertex=^TSkyVertex;
TSkyVertex=record
position:TD3DVector;// The 3D position for the vertex
u,v:single;
end;
PskyVertexArray=^TskyVertexArray;
TskyVertexArray=array[0..100000] of TskyVertex;
POjjektumVertex=^TOjjektumVertex;
TOjjektumVertex=record
position:TD3DVector;// The 3D position for the vertex
tu,tv:single;
lu,lv:single;
end;
POjjektumVertexArray=^TOjjektumVertexArray;
TOjjektumVertexArray=array[0..100000] of TOjjektumVertex;
Tmypackedvector=record
x,y,z:word;
end;
Tmypackednorm=record
x,y:smallint;
end;
TPackedOjjektumVertex_leg=record
position:Tmypackedvector;// The 3D position for the vertex
tu,tv:word;
lu,lv:byte;
end;
TPackedOjjektumVertex=record
position:Tmypackedvector;// The 3D position for the vertex
tu,tv:word;
lu,lv:single;
end;
PPosNormUV=^TPosNormUV;
TPosNormUV=record
position:TD3DVector;// The 3D position for the vertex
normal:TD3DVector;// The surface normal for the vertex
u,v:single;
end;
PPosNormUVArray=^TPosNormUVArray;
TPosNormUVArray=array[0..100000] of TPosNormUV;
PColoredVert=^TColoredVert;
TColoredVert=record
position:TD3DVector;
col:Dword;
end;
PColoredVertarray=^TColoredVertarray;
TColoredVertarray=array[0..100000] of TColoredVert;
TNormalTangentBinormal=record
normal,tangent,binormal:TD3DXVector3;
end;
POjjektumVertex2=^TOjjektumVertex2;
TOjjektumVertex2=record
position:TD3DVector;// The 3D position for the vertex
tu,tv:single;
lu,lv:single;
normal,tangent,binormal:TD3DXVector3;
end;
POjjektumVertex2Array=^TOjjektumVertex2Array;
TOjjektumVertex2Array=array[0..100000] of TOjjektumVertex2;
TImposterVertex=record
position:TD3DVector;
color:Dword;
u1,v1:single;
u2,v2:single;
end;
PImposterVertexArray=^TImposterVertexArray;
TImposterVertexArray=array[0..100000] of TImposterVertex;
{Tpackedpos = packed record
pos:Tmypackedvector;
irany:byte;
prior:byte;
state:byte;
irany2:byte;
bg:byte;
end;
Tmukspos = record
pos:TD3DXVector3;
irany,irany2:single;
state:byte;
prior:single;
bg:byte;
end;
Tmukspls = record
seb,vseb:TD3DXVector3; //sebesség, volt sebesség
vpos,megjpos:TD3dxvector3;
mtim,vtim,atim:word; //különbözõ idõk a packetek közt
amtim,avtim,aatim,amtim2:word; // --||-- autóval
pkullov:array [1..15,1..2] of TD3DVector; //pontos lövések
kullov:array [1..15] of Tmypackedvector; //packed lövések
klsz,pklsz:byte; // számuk
lo:single;
nev:Tnev;
nev2:string;
fegyv:byte; //128 a csapat
autopos,autoopos,autoposx,autooposx:TD3DXVector3;
autoaxes,autovaxes,autovaxes2:array [0..2] of TD3DXVector3;
// atmenetL:single; //õõõh
lottram:integer; //vmikor lõtt rám pontosat
fejh:TD3DXVector3; //feje hol van (headstuff)
afejcucc:byte; // headstuff
donotsend:integer; //kezdeti neküldjdolog
overrideport:word; // port dolog
utsocht:string; // megejelnítendõ chat
chttim:integer;
visible:boolean; // Viewport culling
kills:word;
autotkuldj:byte; //0 1 2 3... trükkös.
priorneki:single; //ideiglenes szám, a felé mért prioritás (a célzás. pplpos.prior nélkül)
priormost: single; // szám, a legkisebb nyer, hozzáadódik a pplpls.priorneki és a pplpos.prior
seesme:boolean; //lat
egyebetkapott:integer; //no minden esetben amikor egyebet kap :) Fõként a seesme miatt.
end;}
Tloves=record
pos,v2:Td3DXvector3;
kilotte:integer;
fegyv:byte;
end;
{ PRIVATE TYPEOK! }
Tplayerpos=record
pos:TD3DXVector3;
irany,irany2:single;
state:byte;
seb,vseb:TD3DXVector3;//sebesség, volt sebesség
vpos,megjpos:TD3dxvector3;
end;
Tplayernet=record
ip:DWORD;
port:WORD;
overrideport:word;// nat port dolog
UID:integer;
kapottprior:single;//én milyen fontos vagyok neki
nekemprior:single;//õ milyen fontos nekem
prior:single;//a kettõ összege, ezzel egyenesen arányos a kapott sávszél
priorbucket:single;//ez töltõdik. Ha >0, lehet sendelni, akkor -=1
mtim:word;//legutóbbi packet óta eltelt századmásodpercek
vtim:word;//legutóbbi packet ideje GetTickCountban
atim:word;
amtim,avtim,aatim,vamtim:word;// --||-- autóval
lasthandshake:integer;
gothandshake:boolean;
connected:boolean;//3 way handshake kész
lovesek:array[0..15] of Tloves;//elkuldendo lovesek
loveseksz:integer;
plovesek:array[0..7] of Tloves;//elkuldendo pontos lovesek
ploveseksz:integer;
end;
Tplayerpls=record
lo:single;
muzzszog:single;
nev:string;
clan:string;
fegyv:byte;//128 a csapat
fejcucc:byte;// headstuff
fejh:TD3DXVector3;//feje hol van (headstuff)
utsocht:string;// megejelnítendõ chat
chttim:integer;
visible:boolean;// Viewport culling
kills:word;
lottram:integer;//lõtt rám. visszaszámláló
autoban:boolean;
end;
Tplayerauto=record
enabled:boolean;
pos,seb,vpos,vseb:TD3DXVector3;
axes,vaxes:array[0..2] of TD3DXVector3;
fordszam:single;
end;
Tplayer=record
pos:Tplayerpos;
net:Tplayernet;
pls:Tplayerpls;
auto:Tplayerauto;
isTyping:boolean;
end;
const uresplayer:Tplayer=();
type
TSoundData=record
filename:string;
haromd,freq,effects:boolean;
mindistance:single;
end;
TTeleport=record
vfrom,vto:TD3DXVector3;
rad:single;
vis:single;
tip:integer;
end;
TTrigger=record
name:string;
pos:TD3DXVector3;
rad:single;
touched:boolean;
ontouchscript:string;
onusescript:string;
onleavescript:string;
active:boolean;
restart:cardinal;
end;
TScript=record
name:string;
instructions:array of string;
end;
T3dLabel=record
pos:TD3DXVector3;
rad:single;
text:string;
end;
TVecVar=record
pos:TD3DXVector3;
name:string;
end;
TNumVar=record
num:single;
name:string;
end;
TStrVar=record
text:string;
name:string;
end;
TBind=record
key:char;
script:string;
end;
TTimedscript=record
time:cardinal;
script:string;
end;
TParticleSys=record
from,spd:TD3DXVector3;
tipus:integer;
scolor,ecolor,rcolor:cardinal;
szorzo,rnd,spdrnd:single;
amount,period,lifetime,rndlt:integer;
ssize,esize,vis:single;
texture:integer;
disabled:bool;
name:string;
restart:cardinal;
end;
Pbinmsg=^Tbinmsg;
Tbinmsg=packed array[0..511] of byte;
PVecArr2=^TVecarr2;
TVecarr2=array[0..100000] of TD3DXVector3;
TVecarray=array of TD3DXVector3;
TKeyArray=array[0..255] of byte;
Ttri=array[0..2] of TD3DXVector3;
Tminmaxtri=array[0..4] of TD3DXVector3;
Tminmaxtridynarr=array of Tminmaxtri;
Tsinglerect=record
x1,y1,x2,y2:single;
end;
const
ERROR_PREFIX='Error: ';
COLLISION_SOLID=$01;
COLLISION_BULLET=$02;
COLLISION_SHADOW=$04;
type
Tacctri=record
v0,v1,v2:TD3DXVector3;
a,u,v,n:TD3DXVector3;
uu,uv,vv:single;
invD:single;
vmin,vmax:TD3DXVector3;
collision:cardinal;
material:byte;
lu0,lu1,lu2:single;
lv0,lv1,lv2:single;
//lightavg:single; //trilght
//plane:TD3DXplane;
end;
TOjjektumTexture=record
tex:IDirect3DTexture9;
heightmap:IDirect3DTexture9;
occlusionmap:IDirect3DTexture9;
specularmap:IDirect3DTexture9;
name:string;
alphatest:boolean;
decal:boolean;
emitting:boolean;
collisionflags:cardinal;
material:byte;
specHardness:single;
specIntensity:single;
normalmap:boolean;
end;
Tacctriarr=array of Tacctri;
TAABB=record
min,max:TD3DXVector3;
end;
PKDnode=^TKDnode;
TKDnode=record
tricount,tristart:integer;
split:single;
// leftteg,rightteg:TAABB;
left,right:integer;
end;
TKDtree=array of TKDnode;
TKDData=array of integer;
T7pbox=array[0..7] of TD3DXVector3;
T7pboxbol=array[0..7] of boolean;
TnamedProjectile=record
kezdoseb,v1,v2,v3,cel:TD3DXVector3;
name:Dword;//ez egy hash
colltim:byte;
eletkor:integer;
kilotte:integer;
end;
TDbubble=record
pos:TD3DXVector3;
meret,erosseg:single;
meretpls,erossegpls:single;
meretplsszor:single;
tim:integer;
end;
TDripple=record
pos:TD3DXVector3;
vsz,hsz:TD3DXVector3;
meret,erosseg:single;
meretpls,erossegpls:single;
meretplsszor:single;
tim:integer;
end;
Tarrayofstring=array of string;
TFrustum=array[0..5] of TD3DXplane;
Tindexedsingle=record
ertek:single;
ind:integer;
end;
Tindexedint=record
ertek:integer;
ind:integer;
end;
Tindexedintarr=array of Tindexedint;
TStickmesh=record
Indices:array of word;
Vertices:array of TOjjektumvertex;
Normals:array of TNormalTangentBinormal;
Attrtable:array of TD3DXAttributeRange;
texturetable:array of string[50];
end;
TInAddr=winsock2.Tinaddr;
Tincim=record
sin_port:u_short;
sin_addr:TInAddr;
end;
TWeaponType=record
col:array of cardinal;
end;
const
maxOTpoints=2;
type
ToctPoint=record
pos:TD3DXVector3;
poi:pointer;
end;
POctLeaf=^TOctLeaf;
TOctleaf=record
axe:byte;
level:byte;
split:single;
AABB:TAABB;
child0,child1,parent:POctLeaf;
cumolngt:shortint;
cumok:array[0..maxOTpoints-1] of Toctpoint;
end;
TGridElem=packed record
meret,top:integer;
elemek:Pointer;//1D Array, Dwordok természetesen Castolható pointerre de úhgyis index lesz
end;
TGrid=record
meret:Integer;
bufstep:integer;
elemek:Pointer;//2D Array, PGridElemekre
end;
Tgriditems=array of dword;
Tojjrect=record
ind1,ind2:integer;
px,py:integer;
mx,my:integer;
end;
Tojjrectarr=array of Tojjrect;
const
//STICKMAN
PROG_VER=209060;
datachecksum=$03BA822D;
var
checksum:Dword=0;
nyelv:integer;
const
GRAVITACIO=0.003;
pow2:array[-10..20] of single=(1/1024,1/512,1/256,1/128,1/64,1/32,1/16,1/8,1/4,1/2,1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576);
pow2i:array[0..15] of word=(1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768);
var
cpx:Psingle;///FRÖCCCS
cpy:Psingle;///FRÖCCCS
cpz:Psingle;///FRÖCCCS
sundir:TD3DXVector3;
texturefilelist:string;
hudMessages:array[0..4] of THUDmessage;//állítható mindkét vége, az alacsony a friss
hudMessagePosY:single=0.2;
hudMessageOffsetY:single=0.05;
hudInfo:string;
hudInfoFade:word;
hudInfoColor:longword;
isEventWeapon:boolean=false;
unfocused:boolean;
multisampling:integer=0;
SCwidth:integer=800;
SCheight:integer=(800*3)div 4;
ASPECT_RATIO:double=4/3;
pixelX,pixelY,vertScale:single;
texture_res:byte;// 0 low, 1 med, 2 hi, //új: 100 superlow, 101 low, 102, med, 103 high, 104 maximum
fakedeath:single;
vallmag:single=1.2;
vallmag2:single=1.5;
singtc,cosgtc,plsgtc:single;//hullámzás
grasslevel:single;
wetsandlevel:single;
waterbaselevel:single;
vanLM:boolean;
opt_detail,opt_postproc,opt_water,opt_particle:integer;
opt_greyscale:boolean;
mt1:IDirect3DTexture9=nil;
mt2:IDirect3DTexture9=nil;
frust:TFrustum;
g_pEffect:ID3DXEffect;
matView,matProj:TD3DMatrix;
vEyePt,vLookatPt:TD3DVector;
mysebVec:td3dxvector3;
myseb:single;
fogstart,fogend,fogc:single;
lightIntensity:single;
domuzzleflash:boolean;
myfegyv:byte;
savepw:boolean;
lasthash:string='-';
gpukey:integer=0;
goodchars:shortstring='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';//62
betuszin,color_menu_normal,color_menu_select,color_menu_info:longword;
mymuzzszog:single;
// depthbias:single=-0.0001;
// depthbiasP:PCardinal=@depthbias;
pantheonPos:TD3DXVector3;
dustcol,water1col,water2col:cardinal;
mouseInvX:ShortInt;
mouseInvY:ShortInt;
vertdecl,vertdeclgagyi:IDirect3DVertexDeclaration9;
useoldterrain:boolean;
felhoszin2:single=0;
felhoszin1:single=0;
cloudblend:single;
vizkor1,vizkor2,vizkor3:single;
const
TEXTURE_LOW_LEG=0;
TEXTURE_MED_LEG=1;
TEXTURE_HIGH_LEG=2;
TEXTURE_COLOR=99;
TEXTURE_SUPERLOW=100;
TEXTURE_LOW=101;
TEXTURE_MED=102;
TEXTURE_HIGH=103;
TEXTURE_VERYHIGH=104;
TEXFLAG_COLOR=1;
TEXFLAG_FIXRES=2;
DETAIL_MIN=0;
DETAIL_POM=1;
DETAIL_LIGHT=2;
DETAIL_MAX=2;
POSTPROC_MIN=0;
POSTPROC_DISTORTION=1;//úgy használd, hogy kereshetõ legyen
POSTPROC_LASTNONSHADER=POSTPROC_DISTORTION;
POSTPROC_SNIPER=2;
POSTPROC_GLOW=3;
POSTPROC_MAX=3;
//mikor van csicsa hdr: ha van gpeffect és detail > min
WATER_MAX=3;
PARTICLE_MAX=3;
MENULAP_MAX=10;
MAT_DEFAULT=0;
MAT_METAL=1;
MAT_WOOD=2;
MAT_DIRT=3;
MAT_MAX=3;
WEATHER_MAX=22;
perlinlvl=6;
FEGYV_M4A1=0;
FEGYV_M82A1=1;
FEGYV_LAW=2;
FEGYV_MP5A3=3;
FEGYV_BM3=4;//akkor most meg lesz baszva valami
FEGYV_H31_G=100;//a szerveren a 4 a kibaszott quad
FEGYV_BM3_2=101;
FEGYV_BM3_3=102;// különbözo golyófajták // Hector ne légy balfasz.
FEGYV_MPG=128;
FEGYV_QUAD=129;
FEGYV_NOOB=130;
FEGYV_X72=131;
FEGYV_HPL=132;
FEGYV_H31_T=200;
FEGYV_NUM=10;
MSTAT_MASK=15;
MSTAT_ALL=0;
MSTAT_ELORE=1;
MSTAT_HATRA=2;
MSTAT_JOBBRA=3;
MSTAT_BALRA=4;
MSTAT_FUT=5;
// MSTAT_CHAT=6;// egyelõre nincs animáció de akár lehetne is
MSTAT_GUGGOL=16;//flag
MSTAT_CSIPO=32;//ez is flag
// Our custom FVF, which describes our custom vertex structure
D3DFVF_CUSTOMVERTEX=(D3DFVF_XYZ or D3DFVF_NORMAL or D3DFVF_DIFFUSE or D3DFVF_TEX2);
D3DFVF_OJJEKTUMVERTEX=(D3DFVF_XYZ or D3DFVF_TEX2);
D3DFVF_IMPOSTERVERTEX=(D3DFVF_XYZ or D3DFVF_DIFFUSE or D3DFVF_TEX2);
D3DFVF_SKYVERTEX=(D3DFVF_XYZ or D3DFVF_TEX1);
D3DFVF_PosNormUV=(D3DFVF_XYZ or D3DFVF_NORMAL or D3DFVF_TEX1);
D3DFVF_COLOREDVERTEX=(D3DFVF_XYZ or D3DFVF_DIFFUSE);
{ DIKChar:array [$01..$39] OF CHAR
=(' ','1','2','3','4','5','6','7','8','9','0','-','=','Û',' ',
'Q','W','E','R','T','Y','U','I','O','P','[',']',' ',' ','A','S',
'D','F','G','H','J','K','L',';',' ',' ',' ','\','Z','X','C','V',
'B','N','M',',','.','/',' ','*',' ',' ');}
identmatr:TD3DMatrix=
(_11:1;_12:0;_13:0;_14:0;
_21:0;_22:1;_23:0;_24:0;
_31:0;_32:0;_33:1;_34:0;
_41:0;_42:0;_43:0;_44:1);
{ felematr:TD3DMatrix=(_11:0.5;_12:0;_13:0;_14:0;
_21:0;_22:0.5;_23:0;_24:0;
_31:0;_32:0;_33:0.5;_34:0;
_41:0;_42:0;_43:0;_44:1); }
sqrt2=1.414213;
function CustomVertex(x,y,z,nx,ny,nz:single;acolor:longword;au,av,au2,av2:single):TCustomVertex;overload;
function CustomVertex(pos:TD3DXVector3;nx,ny,nz:single;acolor:longword;au,av,au2,av2:single):TCustomVertex;overload;
//function CustomVertex(pos:TD3DXVector3;n:TD3DXVector3;acolor:longword;au,av:single):TCustomVertex;overload;
function SkyVertex(px,py,pz,au,av:single):TSkyVertex;
function ARGB(a,r,g,b:byte):cardinal;
function PaletteToRGB(palette_index:byte;alpha:integer):cardinal;
function colorlerp(mit1,mit2:cardinal;mennyivel:single):cardinal;
function SingletoDword(mit:single):Dword;
procedure savetexfilelist;
function tavLineLine(p1,p2,p3,p4:TD3DXVector3;out pa,pb:TD3DXVector3;out Distance:single):boolean;
function tavLineLinesq(p1,p2,p3,p4:TD3DXVector3;out pa,pb:TD3DXVector3;out Distance:single):boolean;
function tavPointLinesq0(point,linestart,lineend:TD3DXVector3;out Distance:single):boolean;
function tavPointLine(point,linestart,lineend:TD3DXVector3;out Intersection:TD3DXVector3;out Distance:single):boolean;
function tavPointLinesq(point,linestart,lineend:TD3DXVector3;out Intersection:TD3DXVector3;out Distance:single):boolean;
function tavPointLinesq2d(point,linestart,lineend:TD3DXVector3;out Intersection:TD3DXVector3;out Distance:single):boolean;
function tavPointLine2(point,linestart,lineend:TD3DXVector3):single;
function tavPointPoint(Point1,point2:TD3DXvector3):single;
function tavPointPointsq(Point1,point2:TD3DXvector3):single;
function tavPointPointKock(Point1,point2:TD3DXvector3):single;
function intLineSphere(const p1,p2,sc:TD3DXVector3;const r:single;var ep:TD3DXVector3):boolean;
function IntLineTri(v0,v1,v2,p0,p1:TD3DXVector3;out pi:TD3DXVector3):boolean;
function intlinetribol(tri:Tacctri;vec,ir:TD3DXVector3):boolean;
function tavpointtri(tri:Tacctri;poi:TD3DXVector3;out pi:Td3dxvector3):single;
function tavpointtrisq(tri:Tacctri;poi:TD3DXVector3;out pi:Td3dxvector3):single;
//function tavpointtrisqszorzo(v0,v1,v2,poi:TD3DXVector3;out pi:Td3dxvector3;szorzo:single):single;
function wove(x,y:single):single;
function scalecolor(mit:cardinal;mennyivel:single):cardinal;
function LTFF(adevice:IDirect3DDevice9;nev:string;out tex:IDirect3DTexture9;flags:cardinal=0;width:PInteger=nil):boolean;
procedure randomplus(var mit:TD3DXVector3;az,scal:single);
procedure randomplus2(var mit:TD3DXVector3;az,scal:single);
function randomvec(az,scal:single):TD3DXVector3;
function randomvec2(az,scalx,scaly,scalz:single):TD3DXVector3;
function BSearch(arr:Tintarr;mit:integer):integer;overload;//BinarySearch
function Badd(var arr:Tintarr;mit:integer):boolean;overload;//BinaryAdd
function BSearch(arr:Tfloatarr;mit:single):integer;overload;//BinarySearch
function Badd(var arr:Tfloatarr;mit:single):boolean;overload;//BinaryAdd
function BSearch(arr:TKDData;mit:word):integer;overload;//BinarySearch
function Badd(var arr:TKDData;mit:word):boolean;overload;//BinaryAdd
function tegtegben(ax1,ay1,amx,amy,bx1,by1,bmx,bmy:integer):boolean;overload;
function tegtegben(a,b:Tsinglerect):boolean;overload;
function tegtegben(a,b:TAABB):boolean;overload;
function tritegben(a:Tacctri;b:TAABB):boolean;overload;
function tritegben(a:Tminmaxtri;b:TAABB):boolean;overload;
procedure packrect(rect:array of Tsinglerect;var wantrect:array of Tsinglerect;var maxx,maxy:single);
function intlinetriAcc(tri:Tacctri;p0,p1:TD3DXVector3):boolean;
function makeacc(av0,av1,av2:TD3DXVector3;amaterial:TOjjektumTexture):Tacctri;
function noNaNINF(var mi:single):boolean;overload;
function noNaNINF(var mi:TD3DVector):boolean;overload;
procedure constraintfloat(var mi:single);
procedure constraintfloat2(var mi:single);
procedure constraintvec(var mi:TD3DVector);
function trisinAABB(alaptris:Tacctriarr;alapdata:TKDData;var hova:TKDData;teg:TAABB;masoldis:boolean):integer;
procedure ConstructKDtree(var KDtree:TKDtree;var KDData:TKDData;indexes:TKDData;axis:byte;tris:Tacctriarr;teg:TAABB);
procedure traverseKDtree(const teg:TAABB;var hova:TKDData;const KDData:TKDData;const KDTree:TKDTree;const acollision:cardinal);
procedure traverseKDtreelin(const v1,v2:TD3DXVector3;var hova:TKDData;const KDData:TKDData;const KDTree:TKDTree;const trik:Tacctriarr;const acollision:cardinal);
procedure traverseKDtreelinDNT(const v1,v2:TD3DXVector3;var hova:TKDData;const KDData:TKDData;const KDTree:TKDTree;const trik:Tacctriarr;const acollision:cardinal);
procedure saveKDtree(nev:string;KDTree:TKDTree;KDData:TKDData);
procedure loadKDtree(nev:string;var KDTree:TKDTree;var KDData:TKDData);
function point(ax,ay:integer):Tpoint;
function packfloat(mit:single;range:single):word;
function packfloatheavy(mit:single;range:single):byte;
function packvec(mit:TD3DXVector3;range:single):Tmypackedvector;
function packnormal(mit:TD3DXVector3):Tmypackednorm;
function packseb(pos,opos:TD3DXVector3):Tmypackedvector;
function unpackfloat(mit:word;range:single):single;
function unpackfloatheavy(mit:byte;range:single):single;
function unpackvec(mit:Tmypackedvector;range:single):TD3DXVector3;
function unpacknormal(mit:Tmypackednorm):TD3DXVector3;
function vec3scale(v1:TD3DXVector3;s:single):TD3DXVector3;
function vec3add2(v1,v2:TD3DXVector3):TD3DXVector3;
function vec3add3(v1,v2,v3:TD3DXVector3):TD3DXVector3;
function vec3add4(v1,v2,v3,v4:TD3DXVector3):TD3DXVector3;
function kbegyenlo(mi,mivel:TD3DXVector3;epsilon:single=0.001):boolean;
procedure normalizemesh(g_pMesh:ID3DXMesh;kellnormal:Boolean=true);
function doSAT(box:T7pbox;var boxbol:T7pboxbol;tri:Tacctri;var vec:TD3DXvector3):single;
function fastinvsqrt(mit:single):single;
function fastinvsqrt2(mit:single):single;
function lerp(a,b,v:single):single;
procedure fastvec3normalize(var mit:TD3DXVector3);
function XORHash2x12byte(v1,v2:TD3DXVector3):dword;
function XORHashVector(v1:TD3DXVector3):dword;
function StringHash(mit:string):cardinal;
procedure explode(str:string;const key:char;var hova:Tarrayofstring);
function Frustum(viewMatrix:TD3DMatrix;nearplane,farplane,fovy,ratio:single):TFrustum;
function AABBvsFrustum(aabb:TAABB;f:TFrustum):boolean;
function SpherevsFrustum(pos:TD3DXVector3;r:single;f:TFrustum):boolean;
procedure addtochecksum(mit:array of DWORD;hgh:integer);
procedure addfiletochecksum(nev:string);
procedure OctTreeAdd(const tree:POctLeaf;const hol:TD3DXVector3;const mit:Pointer);
procedure OctTreeDel(const tree:POctLeaf;const hol:TD3DXVector3;const mit:Pointer);
procedure OctTreeGetRegion(const tree:PoctLeaf;const aabb:TAABB;var res:Tarrayofpointer);
procedure StickMeshConvertToX(nev:string;a_d3ddevice:IDirect3DDevice9);
function StickMeshLoad(nev:string;filevmayor:byte):TStickMesh;
procedure StickMeshSave(nev:string;mesh:TStickMesh);
procedure StickMeshComputeNTB(var mesh:Tstickmesh);
procedure StickMeshInvertNormals(var mesh:Tstickmesh);
procedure specialcopymem(dest,src:pointer;deststride,srcstride:integer;elements:integer);
function CommandLineOption(mi:string):boolean;
function SHA1GetHex(dig:TSha1Digest):string;
procedure gethostbynamewrap2(nam:string;hova:PinAddr;canwait:boolean);
function sockaddrtoincim(sockaddr:sockaddr_in):Tincim;
function incimtosockaddr(incim:Tincim):sockaddr_in;
function recvall(sck:cardinal;var buffer;length,timeout:cardinal):integer;
function connectwithtimeout(sck:cardinal;name:PSockAddr;namelen:integer;timeout:integer):integer;
function readm3urecord(nam:string):string;
function readplsrecord(nam:string):string;
function isqr(a:integer):integer;
procedure gridgetitems(grid:Tgrid;hx,hy:integer;var itms:Tgriditems);
procedure gridremoveind(grid:Tgrid;hx,hy:integer;mit:dword);
procedure gridremoveval(grid:Tgrid;hx,hy:integer;ertek:dword);
procedure gridadd(grid:Tgrid;hx,hy:integer;mit:dword);
procedure gridinit(var grid:Tgrid;ameret,abufstep:integer);
procedure rectresize(var rect:Tojjrectarr;aind1,aind2,amx,amy:integer);
procedure rectremove(var rect:Tojjrectarr;aind1,aind2:integer);
procedure rectadd(var rect:Tojjrectarr;aind1,aind2,amx,amy:integer);
procedure rectmegbasztat(var rect:Tojjrectarr;aind1,aind2,aind2uj:integer);
function ojjrect(aind1,aind2,apx,apy,amx,amy:integer):Tojjrect;
function rectget(var rect:Tojjrectarr;aind1,aind2:integer):Tojjrect;
procedure qsort_reducetokth(var mit:Tindexedintarr;k:integer);
function qsort_partition(var mit:Tindexedintarr;left,right,pivotIndex:integer):integer;
procedure loadlang(honnan:string;id:integer);
function Vec4fromCardinal(num:cardinal):TD3DXVector4;
function looptobyte(i:integer):byte;
function unloop(c:char):byte;
function encodehash(hash:string;high:integer=40):string;
function decodehash(crypt:string;high:integer=40):string;
procedure split(delimiter:char;str:string;strinList:TStringList);
function splitstring(s:string;c:char):TStringArray;
procedure teleport_to_coords(coords:TD3DVector);
function holindul(fegyv:byte):single;
function nthBit(b:byte;o:byte):boolean;
procedure mute(name:string);
procedure unmute(name:string);
function clip(low,high:single;alany:single):single;
function loop(low,high:single;alany:single):single;
function clipszogy(szogy:single):single;
function clipszogybajusz(szogy:single):single;
function flipcoin(chance:single):boolean;
function waterlevel:Single;
//function fegyindex(fegy:byte):byte;
function matname(material:byte):String;
procedure logerror(s:string);
function rotate2d(x,y,cx,cy:single;angle:single):TD3DXVector2;
procedure log(s:string);
function csicsahdr:boolean;
var
perlin:Tperlinnoise;
stuffjson:TQJSON;
animstat:single;
logfile:Textfile;//ez fontos
mutefile:Textfile;
muted:array of string;
laststate:string;
lflngt,lflngt2:integer;
campos,upvec,lvec:TD3DXVector3;
FAKE_HDR:cardinal;
shaderhdr:single=1;
hdrgoal:single=1;
hdrpref:single;//hdr strength set by user
azadvwove:Tadvwove;
isnormals:boolean;
lang:array of string;
weapons:array of TWeaponType;
implementation
var
//infcheckstuff
Infinity:single=(1.00/0);
InfinityMask:cardinal absolute infinity;
function clip(low,high:single;alany:single):single;
begin
if alany<low then
alany:=low
else if alany>high then
alany:=high;
result:=alany;
end;
function loop(low,high:single;alany:single):single;
begin
if alany<low then
alany:=high
else if alany>=high then
alany:=low;
result:=alany;
end;
procedure mute(name:string);
var
i:integer;
begin
for i:=low(muted)to high(muted) do
begin
if name=muted[i] then exit;
end;
setlength(muted,length(muted)+1);
muted[high(muted)]:=name;
end;
procedure unmute(name:string);
var
i:integer;
begin
for i:=low(muted)to high(muted) do
begin
if name=muted[i] then muted[i]:='';//mentéskor szûrni kell
end;
end;
function holindul(fegyv:byte):single;
begin
case fegyv of
FEGYV_M4A1:result:=0.5;
FEGYV_M82A1:result:=1;
FEGYV_MPG:result:=0;