f31257236b45de2c43d6510b403ffc4d12e69a27
1 (* Copyright (C) Doom 2D: Forever Developers
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 *)
15 {$INCLUDE ../shared/a_modes.inc}
18 interface
20 uses
21 utils;
27 var
33 implementation
35 uses
37 {$IFDEF ENABLE_HOLMES}
39 {$ENDIF}
47 var
54 {$IFDEF USE_SDLMIXER}
56 {$ENDIF}
59 begin
60 // remember old mobj positions, prepare for update
62 // server: receive client commands for new frame
63 // client: receive game state changes from server
66 // think
68 // server: send any accumulated outgoing data to clients
74 begin
80 {$IFDEF USE_SDLMIXER}
83 {$ENDIF}
85 begin
86 Randomize;
88 {$IFDEF HEADLESS}
89 {$IFDEF USE_SDLMIXER}
91 {$ELSE}
93 {$ENDIF}
94 {$ELSE}
96 {$ENDIF}
98 g_Touch_Init;
100 (*
101 if (e_JoysticksAvailable > 0) then
102 e_WriteLog('Input: Joysticks available.', TMsgType.Notify)
103 else
104 e_WriteLog('Input: No Joysticks.', TMsgType.Notify);
105 *)
108 begin
110 {$IFDEF USE_SDLMIXER}
116 begin
119 begin
123 end
124 else
129 {$ENDIF}
131 {$IFDEF USE_SDLMIXER}
133 begin
134 (* HACK: Set CWD to load GUS patches relatively to cfg file. *)
135 (* CWD not restored after sound init because timidity *)
136 (* store relative pathes internally and load patches *)
137 (* later. I hope game never relies on CWD. *)
141 e_logwritefln('WARNING: USED TIMIDITY CONFIG HACK, CWD SWITCHED "%s" -> "%s"', [oldcwd, newcwd]);
143 {$ENDIF}
149 // FillChar(charbuff, sizeof(charbuff), ' ');
153 begin
161 begin
168 begin
173 begin
175 Exit;
177 {$IFNDEF HEADLESS}
179 {$ENDIF}
183 // TODO: At the moment, I left here only host network processing, because the client code must
184 // handle network events on its own. Otherwise separate network cases that use different calls to
185 // enet_host_service() WILL lose their packets (for example, resource downloading). So they have
186 // to handle everything by themselves. But in general, this MUST be removed completely, since
187 // updating the window should never affect the network. Use single enet_host_service(), period.
194 var
196 begin
205 begin
216 begin
226 begin
232 begin
234 exit;
237 // Âðåìÿ ïðåäûäóùåãî îáíîâëåíèÿ
241 // don't wait if VSync is on, GL already probably waits enough
246 begin
249 else
251 Draw;
252 sys_Repaint;
253 Frame := Time
254 end
255 else
262 var
266 {$IFDEF ENABLE_HOLMES}
269 {$ENDIF}
270 begin
274 begin
294 {.$IF DEFINED(D2F_DEBUG)}
296 {.$ENDIF}
298 {$IFDEF ENABLE_HOLMES}
302 begin
304 begin
311 begin
313 begin
316 {$IFNDEF HEADLESS}
318 begin
325 {$ELSE}
326 // fuck off, fpc!
329 {$ENDIF}
333 {$ENDIF}
336 begin
338 begin
345 begin
353 begin
355 begin
362 r_Window_Initialize;
364 Init;
369 // Êîìàíäíàÿ ñòðîêà
372 {$IFNDEF HEADLESS}
373 // Çàïðîñ ÿçûêà
375 {$ENDIF}
379 // main loop
391 initialization
392 {$IFDEF USE_SDLMIXER}
393 conRegVar('sdl_native_music', @UseNativeMusic, 'use native midi music output when possible', 'use native midi');
394 {$IFDEF DARWIN}
396 {$ELSE}
398 {$ENDIF}
399 {$ENDIF}