-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTFK.pas
291 lines (257 loc) · 6.58 KB
/
TFK.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
unit TFK;
(***************************************)
(* <<<<< TIME FOR KILL >>>>> *)
(***************************************)
(* http://timeforkill.mirgames.ru *)
(***************************************)
interface
uses
Windows, Messages, SysUtils, OpenGL,
Engine_Reg,
Constants_Lib,
Graph_Lib,
Func_Lib,
Math_Lib,
Type_Lib,
Player_Lib,
Map_Lib,
MapObj_Lib,
ObjAnim_Lib,
ObjSound_Lib,
Game_Lib,
HUD_Lib,
Particle_Lib,
Menu_Lib,
Bot_Lib,
NET_Lib,
Arena_Lib;
var
//console
Console : PConsoleProp; //Ïàðàìåòðû êîíñîëè
ConsoleTex1 : TTexData;
ConsoleTex2 : TTexData;
CTC : array [1..2] of TPoint2f;
ConPi : single;
ConScale : single;
//other
stencil_counter : DWORD;
function MOD_Name: ShortString; stdcall;
procedure MOD_Init; stdcall;
procedure MOD_Free; stdcall;
procedure MOD_Draw; stdcall;
procedure MOD_DrawConsoleBG;
procedure MOD_Update; stdcall;
procedure MOD_Message(message: UINT; wParam: Longint; lParam: LongInt); stdcall;
procedure MOD_WriteCmd(FileName: ShortString); stdcall;
implementation
uses MyMenu, Binds_Lib, Timing_Lib;
//Óçíà¸ì èìÿ ìîäà
function MOD_Name: ShortString; stdcall;
begin
Result:='TIME FOR KILL v0.48';
end;
//Âðóáàåì ìîä (Çàãðóçêà âñåõ ýëåìåíòîâ)
procedure MOD_Init; stdcall;
begin
//Console
Console := Console_Prop;
Console^.Font.Filter := true;
Console^.Font.Trans := false;
Font_Create('Textures\Font\Font1.tga', @Console.Font);
ConsoleTex1.Filter:=true;
ConsoleTex1.Trans:=false;
xglTex_Load('Textures\gfx\console01.tga', @ConsoleTex1);
ConsoleTex2.Filter:=true;
ConsoleTex2.Trans:=false;
xglTex_Load('Textures\gfx\console02.jpg', @ConsoleTex2);
ConPi := 0;
//Óñòàíàâëèâàåì ïðîöåäóðó êîíôèãà
Console_SetCfgProc(@cfgProc);
con_drawbg := true;
con_alpha := 255;
inMenu := true;
NET_Init;
Menu_Init;
Game_Init;
stencil_counter := GetTickCount;
end;
procedure MOD_Free; stdcall;
begin
Arena_Free;
SaveBinds('config.cfg');
//ïðèøëîñü èçìåíèòü
FreeBotDll;
//Map
Map.Free;
//Menu
Menu_Free;
//Particles
Particle_Free;
//Textures
ObjTex_BeginLoad;
ObjTex_EndLoad;
ObjTex_MenuBeginLoad;
ObjTex_EndLoad;
snd_BeginUpdate;
snd_EndUpdate;
//Console
xglTex_Free(@Console.Font);
xglTex_Free(@ConsoleTex1);
xglTex_Free(@ConsoleTex2);
end;
procedure MOD_Draw; stdcall;
begin
if inMenu then
begin
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
Timing_Start('Menu Draw');
Menu_Draw;
Timing_End('Menu Draw');
end
else
begin
if d_clearbit then
glClear(GL_COLOR_BUFFER_BIT);
// ÷èñòèì ñòåíñèë 2 ðàçà â ñåêóíäó (íà âñÿêèé) äëÿ òåëåïîðòîâ
if GetTickCount - stencil_counter >= 500 then
begin
glClear(GL_STENCIL_BUFFER_BIT);
stencil_counter := GetTickCount;
end;
Game_Draw;
end;
if con_drawbg and (con_alpha > 0) then
begin
xglViewPort(0, 0, xglWidth, xglHeight, false);
MOD_DrawConsoleBG;
end;
if d_timing then
Timing_Draw;
end;
procedure MOD_DrawConsoleBG;
begin
with Console^ do
begin
if Height <= 0 then Exit;
if con_alpha = 255 then
xglAlphaBlend(0)
else
xglAlphaBlend(1);
glColor4ub(255, 255, 255, con_alpha);
if ConsoleTex1.ID <> 0 then
begin
xglTex_Enable(@ConsoleTex1);
glBegin(GL_QUADS);
glTexCoord2f(CTC[1].X+2, CTC[1].Y); glVertex2f(0, 0);
glTexCoord2f(CTC[1].X, CTC[1].Y); glVertex2f(xglWidth, 0);
glTexCoord2f(CTC[1].X, CTC[1].Y+1); glVertex2f(xglWidth, Height);
glTexCoord2f(CTC[1].X+2, CTC[1].Y+1); glVertex2f(0, Height);
glEnd;
end;
if ConsoleTex2.ID <> 0 then
begin
xglAlphaBlend(2);
xglTex_Enable(@ConsoleTex2);
glBegin(GL_QUADS);
glTexCoord2f(CTC[2].X+2-ConScale, CTC[2].Y+ConScale); glVertex2f(0, 0);
glTexCoord2f(CTC[2].X+ConScale, CTC[2].Y+ConScale); glVertex2f(xglWidth, 0);
glTexCoord2f(CTC[2].X+ConScale, CTC[2].Y+1-ConScale); glVertex2f(xglWidth, Height);
glTexCoord2f(CTC[2].X+2-ConScale, CTC[2].Y+1-ConScale); glVertex2f(0, Height);
glEnd;
end;
xglTex_Disable;
glDisable(GL_BLEND);
glLineWidth(3);
glDisable(GL_LINE_SMOOTH);
glColor3f(1, 1, 0);
glBegin(GL_LINES);
glVertex2f(0, Height);
glVertex2f(xglWidth, Height);
glEnd;
glLineWidth(1);
end;
end;
procedure MOD_Update; stdcall;
begin
Timing_Start('NET Update');
NET_Update;
Timing_End('NET Update');
Engine_SetUPS(cg_ups);
//Console
if con_drawbg then
begin
CTC[1].X := CTC[1].X - 0.0008;
CTC[1].Y := 0;
ConPi := ConPi + 0.005;
ConScale := abs(sin(ConPi))/10;
CTC[2].X := CTC[2].X - ConScale/40-0.001;
CTC[2].Y := CTC[2].Y + ConScale/80+0.001;
end;
//Game
if inMenu then
begin
Timing_Start('Menu Update');
Menu_Update;
Timing_End('Menu Update');
end;
if not inMenu or Net_Game then
Game_Update;
end;
procedure MOD_Message(message: UINT; wParam: Longint; lParam: LongInt); stdcall;
var
Msg: TMessage;
begin
if not Console.Show then
begin
if (message = WM_KEYDOWN) and (wParam = 27) and IsGame then
if inmenu and not ActiveWindow.Locked then
CallGameMenuOff
else
CallGameMenuOn;
if inMenu then
Menu_Message(message, wParam, lParam);
if onSay and (message <> WM_MOUSEMOVE) then
begin
Msg.Msg := message;
Msg.wParam := wParam;
Msg.lParam := lParam;
SayEdit.Active := true;
SayEdit.onMessage(Msg);
if message = WM_KEYDOWN then
case wParam of
VK_RETURN : begin
if SayEdit.Text <> '' then
Console_Cmd('say ' + SayEdit.Text);
onsay := false;
end;
end;
end;
end;
end;
procedure MOD_WriteCmd(FileName: ShortString); stdcall;
var
F : TextFile;
begin
SaveBinds(FileName);
try
AssignFile(F, Engine_ModDir + FileName);
if not FileExists(Engine_ModDir + FileName) then
Rewrite(F);
Append(F);
writeln(F, 'gametype ' + IntToStr(gametype_c));
writeln(F, 'sv_name ' + sv_name);
writeln(F, 'sv_pass ' + sv_pass);
writeln(F, 'name ' + p1name);
writeln(F, 'p2name ' + p2name);
writeln(F, 'model ' + p1model);
writeln(F, 'p2model ' + p2model);
writeln(F, 'bg ' + bg);
writeln(F, 'r_rail ' + inttostr(r_rail_color.R)+' '+ inttostr(r_rail_color.G)+' '+inttostr(r_rail_color.B)+' '+inttostr(r_rail_type));
writeln(F, 'r_rail_p2 ' + inttostr(r_p2_rail_color.R)+' '+ inttostr(r_p2_rail_color.G)+' '+inttostr(r_p2_rail_color.B)+' '+inttostr(r_p2_rail_type));
writeln(F, 'r_rail_enemy ' + inttostr(r_enemy_rail_color.R)+' '+ inttostr(r_enemy_rail_color.G)+' '+inttostr(r_enemy_rail_color.B)+' '+inttostr(r_enemy_rail_type));
CloseFile(F);
except
Log(Engine_ModDir + FileName);
end;
end;
end.