diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 23bf9bdc49cfa87e47d2093907cd62ab78a84abe..41238952d636e6c903dd2f9de1b9fbb4261d78ac 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
interface
uses
interface
uses
- {$IFNDEF HEADLESS}
- g_gui, g_touch,
+ {$IFDEF ENABLE_MENU}
+ g_gui,
{$ENDIF}
SysUtils, Classes, MAPDEF,
g_base, g_basic, g_player, g_res_downloader,
{$ENDIF}
SysUtils, Classes, MAPDEF,
g_base, g_basic, g_player, g_res_downloader,
procedure g_Game_NextLevel();
procedure g_Game_Pause(Enable: Boolean);
procedure g_Game_HolmesPause(Enable: Boolean);
procedure g_Game_NextLevel();
procedure g_Game_Pause(Enable: Boolean);
procedure g_Game_HolmesPause(Enable: Boolean);
-{$IFNDEF HEADLESS}
- procedure g_Game_InGameMenu(Show: Boolean);
-{$ENDIF}
function g_Game_IsWatchedPlayer(UID: Word): Boolean;
function g_Game_IsWatchedTeam(Team: Byte): Boolean;
procedure g_Game_Message(Msg: String; Time: Word);
function g_Game_IsWatchedPlayer(UID: Word): Boolean;
function g_Game_IsWatchedTeam(Team: Byte): Boolean;
procedure g_Game_Message(Msg: String; Time: Word);
function GetActivePlayerID_Next(Skip: Integer = -1): Integer;
procedure SortGameStat(var stat: TPlayerStatArray);
function GetActivePlayerID_Next(Skip: Integer = -1): Integer;
procedure SortGameStat(var stat: TPlayerStatArray);
-procedure KeyPress (K: Word);
+{$IFDEF ENABLE_MENU}
+ procedure g_Game_InGameMenu(Show: Boolean);
+{$ENDIF}
{$IFNDEF HEADLESS}
procedure CharPress (C: AnsiChar);
{$ENDIF}
{$IFNDEF HEADLESS}
procedure CharPress (C: AnsiChar);
{$ENDIF}
+ procedure KeyPress (K: Word);
{ procedure SetWinPause(Enable: Boolean); }
{ procedure SetWinPause(Enable: Boolean); }
{$IFDEF ENABLE_HOLMES}
g_holmes,
{$ENDIF}
{$IFDEF ENABLE_HOLMES}
g_holmes,
{$ENDIF}
+ {$IFDEF ENABLE_MENU}
+ g_menu,
+ {$ENDIF}
{$IFNDEF HEADLESS}
{$IFNDEF HEADLESS}
- r_render, g_menu, g_system,
+ r_render, g_system,
{$ENDIF}
e_res, g_window,
e_input, e_log, g_console, g_items, g_map, g_panel,
{$ENDIF}
e_res, g_window,
e_input, e_log, g_console, g_items, g_map, g_panel,
end;
end;
+{$IFDEF ENABLE_MENU}
procedure KeyPress (K: Word);
procedure KeyPress (K: Word);
-{$IFNDEF HEADLESS}
-var
- Msg: g_gui.TMessage;
-{$ENDIF}
+ var Msg: g_gui.TMessage;
begin
begin
-{$IFNDEF HEADLESS}
case K of
VK_ESCAPE: // <Esc>:
begin
case K of
VK_ESCAPE: // <Esc>:
begin
end;
end;
end;
end;
end;
end;
-{$ENDIF}
end;
end;
+{$ELSE}
+ procedure KeyPress (K: Word);
+ begin
+ gJustChatted := False;
+ if gConsoleShow or gChatShow then
+ begin
+ g_Console_Control(K);
+ end
+ end;
+{$ENDIF}
{$IFNDEF HEADLESS}
{$IFNDEF HEADLESS}
-procedure CharPress (C: AnsiChar);
-var
- Msg: g_gui.TMessage;
- a: Integer;
-begin
- if gConsoleShow or gChatShow then
- begin
- g_Console_Char(C)
- end
- else if (g_ActiveWindow <> nil) then
- begin
- Msg.Msg := WM_CHAR;
- Msg.WParam := Ord(C);
- g_ActiveWindow.OnMessage(Msg);
- end
- else
+ procedure CharPress (C: AnsiChar);
+ {$IFDEF ENABLE_MENU}
+ var Msg: g_gui.TMessage;
+ {$ENDIF}
+ var a: Integer;
begin
begin
- for a := 0 to 14 do charbuff[a] := charbuff[a+1];
- charbuff[15] := upcase1251(C);
- Cheat();
+ if gConsoleShow or gChatShow then
+ begin
+ g_Console_Char(C);
+ end
+ {$IFDEF ENABLE_MENU}
+ else if g_ActiveWindow <> nil then
+ begin
+ Msg.Msg := WM_CHAR;
+ Msg.WParam := Ord(C);
+ g_ActiveWindow.OnMessage(Msg);
+ end
+ {$ENDIF}
+ else
+ begin
+ for a := 0 to 14 do
+ begin
+ charbuff[a] := charbuff[a + 1];
+ end;
+ charbuff[15] := upcase1251(C);
+ Cheat;
+ end;
end;
end;
-end;
{$ENDIF}
{$ENDIF}
EndingGameCounter := 0;
EndingGameCounter := 0;
-{$IFNDEF HEADLESS}
+{$IFDEF ENABLE_MENU}
g_ActiveWindow := nil;
{$ENDIF}
g_ActiveWindow := nil;
{$ENDIF}
end
else
begin // Выход в главное меню
end
else
begin // Выход в главное меню
-{$IFDEF HEADLESS}
- gState := STATE_MENU; // ???
-{$ELSE}
- gMusic.SetByName('MUSIC_MENU');
- gMusic.Play();
- if gState <> STATE_SLIST then
- begin
- g_GUI_ShowWindow('MainMenu');
- gState := STATE_MENU;
- end else
- begin
- // Обновляем список серверов
- slReturnPressed := True;
- if g_Net_Slist_Fetch(slCurrent) then
+ {$IFDEF DISABLE_MENU}
+ gState := STATE_MENU; // ???
+ {$ELSE}
+ gMusic.SetByName('MUSIC_MENU');
+ gMusic.Play();
+ if gState <> STATE_SLIST then
begin
begin
- if slCurrent = nil then
- slWaitStr := _lc[I_NET_SLIST_NOSERVERS];
+ g_GUI_ShowWindow('MainMenu');
+ gState := STATE_MENU;
end
else
end
else
- slWaitStr := _lc[I_NET_SLIST_ERROR];
- g_Serverlist_GenerateTable(slCurrent, slTable);
- end;
-{$ENDIF}
+ begin
+ // Обновляем список серверов
+ slReturnPressed := True;
+ if g_Net_Slist_Fetch(slCurrent) then
+ begin
+ if slCurrent = nil then
+ slWaitStr := _lc[I_NET_SLIST_NOSERVERS];
+ end
+ else
+ slWaitStr := _lc[I_NET_SLIST_ERROR];
+ g_Serverlist_GenerateTable(slCurrent, slTable);
+ end;
+ {$ENDIF}
g_Game_ExecuteEvent('ongameend');
end;
end;
g_Game_ExecuteEvent('ongameend');
end;
end;
end
end;
end
end;
-{$IFNDEF HEADLESS}
+{$IFDEF ENABLE_MENU}
// HACK: add dynlight here
if gwin_k8_enable_light_experiments then
begin
// HACK: add dynlight here
if gwin_k8_enable_light_experiments then
begin
procedure g_Game_Update();
var
procedure g_Game_Update();
var
- {$IFNDEF HEADLESS}
+ {$IFDEF ENABLE_MENU}
Msg: g_gui.TMessage;
w: Word;
{$ENDIF}
Msg: g_gui.TMessage;
w: Word;
{$ENDIF}
e_KeyPressed(JOY2_ATTACK) or e_KeyPressed(JOY3_ATTACK)
)
and (not gJustChatted) and (not gConsoleShow) and (not gChatShow)
e_KeyPressed(JOY2_ATTACK) or e_KeyPressed(JOY3_ATTACK)
)
and (not gJustChatted) and (not gConsoleShow) and (not gChatShow)
-{$IFNDEF HEADLESS}
+{$IFDEF ENABLE_MENU}
and (g_ActiveWindow = nil)
{$ENDIF}
)
and (g_ActiveWindow = nil)
{$ENDIF}
)
begin
// Выход в главное меню:
g_Game_Free;
begin
// Выход в главное меню:
g_Game_Free;
-{$IFNDEF HEADLESS}
+{$IFDEF ENABLE_MENU}
g_GUI_ShowWindow('MainMenu');
gMusic.SetByName('MUSIC_MENU');
gMusic.Play();
g_GUI_ShowWindow('MainMenu');
gMusic.SetByName('MUSIC_MENU');
gMusic.Play();
e_KeyPressed(JOY2_ATTACK) or e_KeyPressed(JOY3_ATTACK)
)
and (not gJustChatted) and (not gConsoleShow) and (not gChatShow)
e_KeyPressed(JOY2_ATTACK) or e_KeyPressed(JOY3_ATTACK)
)
and (not gJustChatted) and (not gConsoleShow) and (not gChatShow)
-{$IFNDEF HEADLESS}
+{$IFDEF ENABLE_MENU}
and (g_ActiveWindow = nil)
{$ENDIF}
)
and (g_ActiveWindow = nil)
{$ENDIF}
)
// Обрабатываем клавиши игроков:
if gPlayer1 <> nil then gPlayer1.ReleaseKeys();
if gPlayer2 <> nil then gPlayer2.ReleaseKeys();
// Обрабатываем клавиши игроков:
if gPlayer1 <> nil then gPlayer1.ReleaseKeys();
if gPlayer2 <> nil then gPlayer2.ReleaseKeys();
-{$IFDEF HEADLESS}
+{$IFDEF DISABLE_MENU}
if (not gConsoleShow) and (not gChatShow) then
{$ELSE}
if (not gConsoleShow) and (not gChatShow) and (g_ActiveWindow = nil) then
if (not gConsoleShow) and (not gChatShow) then
{$ELSE}
if (not gConsoleShow) and (not gChatShow) and (g_ActiveWindow = nil) then
// Наблюдатель
if (gPlayer1 = nil) and (gPlayer2 = nil)
and (not gConsoleShow) and (not gChatShow)
// Наблюдатель
if (gPlayer1 = nil) and (gPlayer2 = nil)
and (not gConsoleShow) and (not gChatShow)
-{$IFNDEF HEADLESS}
+{$IFDEF ENABLE_MENU}
and (g_ActiveWindow = nil)
{$ENDIF}
then
and (g_ActiveWindow = nil)
{$ENDIF}
then
end; // if gameOn ...
// Активно окно интерфейса - передаем клавиши ему:
end; // if gameOn ...
// Активно окно интерфейса - передаем клавиши ему:
-{$IFNDEF HEADLESS}
+{$IFDEF ENABLE_MENU}
if g_ActiveWindow <> nil then
begin
w := e_GetFirstKeyPressed();
if g_ActiveWindow <> nil then
begin
w := e_GetFirstKeyPressed();
begin
KeyPress(IK_F10);
end;
begin
KeyPress(IK_F10);
end;
-{$ENDIF} // NOT HEADLESS
+{$ENDIF}
Time := GetTickCount64() {div 1000};
Time := GetTickCount64() {div 1000};
g_Player_ResetAll(Force or gLastMap, gGameSettings.GameType = GT_SINGLE);
gState := STATE_NONE;
g_Player_ResetAll(Force or gLastMap, gGameSettings.GameType = GT_SINGLE);
gState := STATE_NONE;
- {$IFNDEF HEADLESS}
+ {$IFDEF ENABLE_MENU}
g_ActiveWindow := nil;
{$ENDIF}
gGameOn := True;
g_ActiveWindow := nil;
{$ENDIF}
gGameOn := True;
chstr := '';
if cmd = 'pause' then
begin
chstr := '';
if cmd = 'pause' then
begin
- {$IFNDEF HEADLESS}
+ {$IFDEF ENABLE_MENU}
if (g_ActiveWindow = nil) then
g_Game_Pause(not gPauseMain);
{$ELSE}
if (g_ActiveWindow = nil) then
g_Game_Pause(not gPauseMain);
{$ELSE}
end;
{$ENDIF}
end;
{$ENDIF}
-{$IFNDEF HEADLESS}
+{$IFDEF ENABLE_MENU}
procedure g_Game_InGameMenu(Show: Boolean);
begin
if (g_ActiveWindow = nil) and Show then
procedure g_Game_InGameMenu(Show: Boolean);
begin
if (g_ActiveWindow = nil) and Show then
PBarWasHere := false;
end;
PBarWasHere := false;
end;
- {$IFNDEF HEADLESS}
+ {$IFDEF ENABLE_MENU}
g_ActiveWindow := nil;
{$ENDIF}
g_ActiveWindow := nil;
{$ENDIF}