hedgewars/hw.dpr
author unc0rr
Mon, 22 Aug 2005 21:38:06 +0000
changeset 3 ffe4ad26a64c
parent 2 4eeab397c3c6
child 4 bcbd7adb4e4b
permissions -rw-r--r--
- On every frame there was made one superfluous game tick resulting in variable game speed - Removed comment written in russian
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
     1
(*
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
     2
 * Hedgewars, a worms-like game
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
     3
 * Copyright (c) 2004, 2005 Andrey Korotaev <unC0Rr@gmail.com>
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
     4
 *
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
     5
 * Distributed under the terms of the BSD-modified licence:
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
     6
 *
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
     7
 * Permission is hereby granted, free of charge, to any person obtaining a copy
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
     8
 * of this software and associated documentation files (the "Software"), to deal
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
     9
 * with the Software without restriction, including without limitation the
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    10
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    11
 * sell copies of the Software, and to permit persons to whom the Software is
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    12
 * furnished to do so, subject to the following conditions:
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    13
 *
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    14
 * 1. Redistributions of source code must retain the above copyright notice,
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    15
 *    this list of conditions and the following disclaimer.
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    16
 * 2. Redistributions in binary form must reproduce the above copyright notice,
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    17
 *    this list of conditions and the following disclaimer in the documentation
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    18
 *    and/or other materials provided with the distribution.
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    19
 * 3. The name of the author may not be used to endorse or promote products
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    20
 *    derived from this software without specific prior written permission.
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    21
 *
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    22
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    23
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    24
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    25
 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    26
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    27
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    28
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    29
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    30
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    31
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    32
 *)
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    33
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    34
program hedgewars;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    35
{$APPTYPE CONSOLE}
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    36
uses
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    37
  SDLh,
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    38
  uConsts in 'uConsts.pas',
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    39
  uGame in 'uGame.pas',
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    40
  uMisc in 'uMisc.pas',
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    41
  uStore in 'uStore.pas',
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    42
  uWorld in 'uWorld.pas',
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    43
  uIO in 'uIO.pas',
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    44
  uGears in 'uGears.pas',
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    45
  uConsole in 'uConsole.pas',
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    46
  uKeys in 'uKeys.pas',
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    47
  uTeams in 'uTeams.pas',
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    48
  uSound in 'uSound.pas',
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    49
  uRandom in 'uRandom.pas',
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    50
  uAI in 'uAI.pas',
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    51
  uAIActions in 'uAIActions.pas',
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    52
  uAIMisc in 'uAIMisc.pas',
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    53
  uAIAmmoTests in 'uAIAmmoTests.pas',
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    54
  uCollisions in 'uCollisions.pas',
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    55
  uLand in 'uLand.pas';
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    56
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    57
{$INCLUDE options.inc}
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    58
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    59
// also: GSHandlers.inc
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    60
//       CCHandlers.inc
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    61
//       HHHandlers.inc
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    62
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    63
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    64
procedure OnDestroy; forward;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    65
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    66
////////////////////////////////
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    67
procedure DoTimer(Lag: integer);  // - обработка таймера
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    68
const cCons: boolean = false;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    69
var s: string;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    70
begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    71
case GameState of
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    72
   gsLandGen: begin
2
4eeab397c3c6 - Support for forts game mode option. Works for demos, frontend doesn't support it.
unc0rr
parents: 1
diff changeset
    73
              if (GameFlags and gfForts) = 0 then GenLandSurface
4eeab397c3c6 - Support for forts game mode option. Works for demos, frontend doesn't support it.
unc0rr
parents: 1
diff changeset
    74
                                             else MakeFortsMap;
1
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    75
              GameState:= gsStart;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    76
              end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    77
     gsStart: begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    78
              AssignHHCoords;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    79
              AdjustColor(cColorNearBlack);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    80
              AdjustColor(cWhiteColor);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    81
              StoreLoad;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    82
              AdjustColor(cConsoleSplitterColor);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    83
              ResetKbd;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    84
              SoundLoad;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    85
              PlayMusic;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    86
              GameState:= gsGame
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    87
              end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    88
     gsGame : begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    89
              ProcessKbd;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    90
              DoGameTick(Lag);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    91
              DrawWorld(Lag, SDLPrimSurface);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    92
              end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    93
   gsConsole: begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    94
              DoGameTick(Lag);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    95
              DrawWorld(Lag, SDLPrimSurface);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    96
              DrawConsole(SDLPrimSurface);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    97
              end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    98
     gsExit : begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    99
              OnDestroy;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   100
              end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   101
     end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   102
SDL_Flip(SDLPrimSurface);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   103
if flagMakeCapture then
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   104
   begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   105
   flagMakeCapture:= false;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   106
   s:= 'hw_' + ParamStr(5) + '_' + inttostr(GameTicks) + '.bmp';
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   107
   WriteLnToConsole('Saving ' + s);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   108
   SDL_SaveBMP_RW(SDLPrimSurface, SDL_RWFromFile(PChar(s), 'wb'), 1)
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   109
   end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   110
end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   111
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   112
////////////////////
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   113
procedure OnDestroy;   // - очищаем память
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   114
begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   115
{$IFDEF DEBUGFILE}AddFileLog('Freeing resources...');{$ENDIF}
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   116
if isSoundEnabled then ReleaseSound;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   117
StoreRelease;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   118
CloseIPC;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   119
TTF_Quit;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   120
SDL_Quit;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   121
halt
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   122
end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   123
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   124
///////////////////
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   125
procedure MainLoop;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   126
var PrevTime,
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   127
    CurrTime: Cardinal;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   128
    event: TSDL_Event;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   129
begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   130
PrevTime:= SDL_GetTicks;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   131
repeat
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   132
while SDL_PollEvent(@event) <> 0 do
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   133
      case event.type_ of
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   134
           SDL_KEYDOWN: case GameState of
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   135
                             gsGame: if event.key.keysym.sym = 96 then
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   136
                                        begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   137
                                        cConsoleYAdd:= cConsoleHeight;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   138
                                        GameState:= gsConsole
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   139
                                        end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   140
                          gsConsole: KeyPressConsole(event.key.keysym.sym);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   141
                             end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   142
           SDL_QUITEV: isTerminated:= true
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   143
           end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   144
CurrTime:= SDL_GetTicks;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   145
if PrevTime + cTimerInterval <= CurrTime then
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   146
   begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   147
   DoTimer(CurrTime - PrevTime);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   148
   PrevTime:= CurrTime
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   149
   end else {sleep(1)};
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   150
IPCCheckSock
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   151
until isTerminated
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   152
end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   153
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   154
////////////////////
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   155
procedure GetParams;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   156
var c: integer;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   157
{$IFDEF DEBUGFILE}
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   158
    i: integer;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   159
begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   160
for i:= 0 to ParamCount do
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   161
    AddFileLog(inttostr(i) + ': ' + ParamStr(i));
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   162
{$ELSE}
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   163
begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   164
{$ENDIF}
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   165
if ParamCount=6 then
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   166
   begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   167
   //TODO: сделать передачу через IPC
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   168
   val(ParamStr(1), cScreenWidth, c);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   169
   val(ParamStr(2), cScreenHeight, c);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   170
   Pathz[ptThemeCurrent]:= Pathz[ptThemes] + ParamStr(3)+'/';
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   171
   val(ParamStr(4), ipcPort, c);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   172
   SetRandomParams(ParamStr(5), rndfillstr);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   173
   cFullScreen:= ParamStr(6)[1] = '1'
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   174
   end else OutError(errmsgShouldntRun, true);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   175
end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   176
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   177
procedure ShowMainWindow;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   178
var flags: Longword;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   179
begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   180
flags:= SDL_HWSURFACE or SDL_DOUBLEBUF or SDL_HWACCEL;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   181
if cFullScreen then flags:= flags or SDL_FULLSCREEN
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   182
               else SDL_WM_SetCaption('Hedgewars', nil);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   183
SDLPrimSurface:= SDL_SetVideoMode(cScreenWidth, cScreenHeight, cBits, flags);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   184
TryDo(SDLPrimSurface <> nil, errmsgCreateSurface, true);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   185
PixelFormat:= SDLPrimSurface.format;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   186
SDL_ShowCursor(0);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   187
end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   188
////////////////////////////////////////////////////////////////////////////////
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   189
/////////////////////////////// m a i n ////////////////////////////////////////
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   190
////////////////////////////////////////////////////////////////////////////////
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   191
{$INCLUDE revision.inc}
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   192
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   193
begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   194
WriteLnToConsole('HedgeWars 0.1, svn '+cRevision);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   195
WriteLnToConsole('  -= by unC0Rr =-  ');
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   196
GetParams;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   197
Randomize;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   198
InitGears;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   199
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   200
WriteToConsole('Init SDL... ');
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   201
SDLTry(SDL_Init(SDL_INIT_VIDEO) >= 0, true);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   202
WriteLnToConsole(msgOK);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   203
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   204
WriteToConsole('Init SDL_ttf... ');
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   205
SDLTry(TTF_Init >= 0, true);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   206
WriteLnToConsole(msgOK);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   207
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   208
ShowMainWindow;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   209
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   210
InitKbdKeyTable;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   211
InitIPC;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   212
WriteLnToConsole(msgGettingConfig);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   213
SendIPCAndWaitReply('C');        // запрос конфига игры
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   214
InitTeams;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   215
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   216
if isSoundEnabled then InitSound;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   217
InitWorld;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   218
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   219
StoreInit;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   220
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   221
isDeveloperMode:= false;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   222
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   223
MainLoop
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   224
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   225
end.