summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 17ca389)
raw | patch | inline | side by side (parent: 17ca389)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Thu, 27 Jan 2022 15:53:47 +0000 (18:53 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Thu, 27 Jan 2022 15:53:47 +0000 (18:53 +0300) |
14 files changed:
diff --git a/src/game/Doom2DF.lpr b/src/game/Doom2DF.lpr
index c56af24696221e14e974b32deaae5d8a55b6b439..eee1e55928609c5cd913d18545d8b086d2dcf0a2 100644 (file)
--- a/src/game/Doom2DF.lpr
+++ b/src/game/Doom2DF.lpr
r_textures in 'opengl/r_textures.pas',
r_weapons in 'opengl/r_weapons.pas',
r_window in 'opengl/r_window.pas',
- g_gui in 'g_gui.pas',
- g_menu in 'g_menu.pas',
+ {$IFDEF ENABLE_MENU}
+ g_gui in 'g_gui.pas',
+ g_menu in 'g_menu.pas',
+ {$ENDIF}
{$ENDIF}
{$IFDEF USE_FMOD}
{$ENDIF}
{$IFNDEF ANDROID}
(* This will fix menu reset on keyboard showing *)
- g_Menu_Reset;
+ {$IFDEF ENABLE_MENU}
+ g_Menu_Reset;
+ {$ENDIF}
{$ENDIF}
//g_Game_ClearLoading;
{$IFDEF ENABLE_HOLMES}
r_Render_Load;
{$ENDIF}
g_Game_Init;
- {$IFNDEF HEADLESS}
+ {$IFDEF ENABLE_MENU}
g_Menu_Init;
g_GUI_Init;
{$ENDIF}
g_Game_Process_Params;
// TODO reload GAME textures
g_Console_Init; // welcome message
- {$IFNDEF HEADLESS}
+ {$IFDEF ENABLE_MENU}
if (not gGameOn) and gAskLanguage then
g_Menu_AskLanguage;
{$ENDIF}
Time_Old := GetTickCount64();
while not ProcessMessage() do begin end;
g_Console_WriteGameConfig;
- {$IFNDEF HEADLESS}
+ {$IFDEF ENABLE_MENU}
g_GUI_Destroy;
g_Menu_Free;
+ {$ENDIF}
+ {$IFNDEF HEADLESS}
r_Render_Free;
{$ENDIF}
{$IFDEF ENABLE_HOLMES}
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index 91131d1d91e75bba067c9927f5d86ea118de5ef7..20f7c8395ead0237e99d0a4f044176573021a570 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
implementation
uses
+ {$IFDEF ENABLE_MENU}
+ g_gui, g_menu,
+ {$ENDIF}
{$IFNDEF HEADLESS}
- g_gui, g_menu, g_touch,
+ g_touch,
{$ENDIF}
g_textures, e_input, g_game, g_gfx, g_player, g_items,
SysUtils, g_basic, g_options, Math, e_res,
rep: Boolean;
down, up: SSArray;
end;
+
menu_toggled: BOOLEAN; (* hack for menu controls *)
procedure g_Console_Switch;
else if gChatShow then
g_Console_Chat_Switch
else
+ begin
KeyPress(VK_ESCAPE);
+ end;
menu_toggled := True
end;
'toggleconsole':
var grab, active: Boolean;
begin
Result := False;
- {$IFDEF HEADLESS}
+ {$IFDEF DISABLE_MENU}
grab := False;
active := False;
{$ELSE}
procedure g_Console_ProcessBindRepeat (key: Integer);
var i: Integer; active: Boolean;
begin
- {$IFDEF HEADLESS}
+ {$IFDEF DISABLE_MENU}
active := False;
{$ELSE}
active := g_ActiveWindow <> nil;
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 23bf9bdc49cfa87e47d2093907cd62ab78a84abe..a6713a763768102cce8b46ae50ce4e5eb355fc2c 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
interface
uses
+ {$IFDEF ENABLE_MENU}
+ g_gui,
+ {$ENDIF}
{$IFNDEF HEADLESS}
- g_gui, g_touch,
+ g_touch,
{$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);
-{$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 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}
+ procedure KeyPress (K: Word);
{ procedure SetWinPause(Enable: Boolean); }
{$IFDEF ENABLE_HOLMES}
g_holmes,
{$ENDIF}
+ {$IFDEF ENABLE_MENU}
+ g_menu,
+ {$ENDIF}
{$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,
end;
+{$IFDEF ENABLE_MENU}
procedure KeyPress (K: Word);
-{$IFNDEF HEADLESS}
-var
- Msg: g_gui.TMessage;
-{$ENDIF}
+ var Msg: g_gui.TMessage;
begin
-{$IFNDEF HEADLESS}
case K of
VK_ESCAPE: // <Esc>:
begin
end;
end;
end;
-{$ENDIF}
end;
+{$ELSE}
+ procedure KeyPress (K: Word);
+ begin
+ gJustChatted := False;
+ if gConsoleShow or gChatShow then
+ begin
+ g_Console_Control(K);
+ end
+ end;
+{$ENDIF}
{$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
- 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;
{$ENDIF}
EndingGameCounter := 0;
-{$IFNDEF HEADLESS}
+{$IFDEF ENABLE_MENU}
g_ActiveWindow := nil;
{$ENDIF}
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
- if slCurrent = nil then
- slWaitStr := _lc[I_NET_SLIST_NOSERVERS];
+ g_GUI_ShowWindow('MainMenu');
+ gState := STATE_MENU;
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;
end
end;
-{$IFNDEF HEADLESS}
+{$IFDEF ENABLE_MENU}
// HACK: add dynlight here
if gwin_k8_enable_light_experiments then
begin
procedure g_Game_Update();
var
- {$IFNDEF HEADLESS}
+ {$IFDEF ENABLE_MENU}
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)
-{$IFNDEF HEADLESS}
+{$IFDEF ENABLE_MENU}
and (g_ActiveWindow = nil)
{$ENDIF}
)
begin
// Выход в главное меню:
g_Game_Free;
-{$IFNDEF HEADLESS}
+{$IFDEF ENABLE_MENU}
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)
-{$IFNDEF HEADLESS}
+{$IFDEF ENABLE_MENU}
and (g_ActiveWindow = nil)
{$ENDIF}
)
// Обрабатываем клавиши игроков:
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 (gPlayer1 = nil) and (gPlayer2 = nil)
and (not gConsoleShow) and (not gChatShow)
-{$IFNDEF HEADLESS}
+{$IFDEF ENABLE_MENU}
and (g_ActiveWindow = nil)
{$ENDIF}
then
end; // if gameOn ...
// Активно окно интерфейса - передаем клавиши ему:
-{$IFNDEF HEADLESS}
+{$IFDEF ENABLE_MENU}
if g_ActiveWindow <> nil then
begin
w := e_GetFirstKeyPressed();
begin
KeyPress(IK_F10);
end;
-{$ENDIF} // NOT HEADLESS
+{$ENDIF}
Time := GetTickCount64() {div 1000};
g_Player_ResetAll(Force or gLastMap, gGameSettings.GameType = GT_SINGLE);
gState := STATE_NONE;
- {$IFNDEF HEADLESS}
+ {$IFDEF ENABLE_MENU}
g_ActiveWindow := nil;
{$ENDIF}
gGameOn := True;
chstr := '';
if cmd = 'pause' then
begin
- {$IFNDEF HEADLESS}
+ {$IFDEF ENABLE_MENU}
if (g_ActiveWindow = nil) then
g_Game_Pause(not gPauseMain);
{$ELSE}
end;
{$ENDIF}
-{$IFNDEF HEADLESS}
+{$IFDEF ENABLE_MENU}
procedure g_Game_InGameMenu(Show: Boolean);
begin
if (g_ActiveWindow = nil) and Show then
PBarWasHere := false;
end;
- {$IFNDEF HEADLESS}
+ {$IFDEF ENABLE_MENU}
g_ActiveWindow := nil;
{$ENDIF}
diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas
index cb5ea3cabb527cf74084aaf9511b0ec07bc9e79f..fe851b8250fc878ba0935ea3b65697e7dc0f21bd 100644 (file)
--- a/src/game/g_menu.pas
+++ b/src/game/g_menu.pas
procedure g_Menu_Init();
procedure g_Menu_Free();
procedure g_Menu_Reset();
-procedure LoadStdFont(cfgres, texture: string; var FontID: DWORD);
-procedure LoadFont(txtres, fntres: string; var FontID: DWORD);
procedure g_Menu_AskLanguage();
procedure g_Menu_Show_SaveMenu();
procedure g_Menu_Show_QuitGameMenu();
var
- gMenuFont: DWORD;
- gMenuSmallFont: DWORD;
PromptIP: string;
PromptPort: Word;
TempScale: Integer = -1;
MAPDEF, Math, g_saveload,
g_language, e_res,
g_net, g_netmsg, g_netmaster, g_items, e_input, g_touch,
- utils, wadreader, g_system, r_render;
+ utils, wadreader, g_system, r_render, r_game;
type TYNCallback = procedure (yes:Boolean);
ProcChangeColor(nil);
end;
-procedure LoadStdFont(cfgres, texture: string; var FontID: DWORD);
-var
- cwdt, chgt: Byte;
- spc: ShortInt;
- ID: DWORD;
- wad: TWADFile;
- cfgdata: Pointer;
- cfglen: Integer;
- config: TConfig;
-begin
- cfglen := 0;
-
- wad := TWADFile.Create;
- if wad.ReadFile(GameWAD) then
- wad.GetResource('FONTS/'+cfgres, cfgdata, cfglen);
- wad.Free();
-
- if cfglen <> 0 then
- begin
- g_Texture_CreateWADEx('FONT_STD', GameWAD+':FONTS\'+texture);
-
- config := TConfig.CreateMem(cfgdata, cfglen);
- cwdt := Min(Max(config.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
- chgt := Min(Max(config.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
- spc := Min(Max(config.ReadInt('FontMap', 'Kerning', 0), -128), 127);
-
- if g_Texture_Get('FONT_STD', ID) then
- e_TextureFontBuild(ID, FontID, cwdt, chgt, spc);
-
- config.Free();
- end;
-
- if cfglen <> 0 then FreeMem(cfgdata);
-end;
-
-procedure LoadFont(txtres, fntres: string; var FontID: DWORD);
-var
- cwdt, chgt: Byte;
- spc: ShortInt;
- CharID: DWORD;
- wad: TWADFile;
- cfgdata, fntdata: Pointer;
- cfglen, fntlen: Integer;
- config: TConfig;
- chrwidth: Integer;
- a: Byte;
-begin
- cfglen := 0;
- fntlen := 0;
-
- wad := TWADFile.Create;
- if wad.ReadFile(GameWAD) then
- begin
- wad.GetResource('FONTS/'+txtres, cfgdata, cfglen);
- wad.GetResource('FONTS/'+fntres, fntdata, fntlen);
- end;
- wad.Free();
-
- if cfglen <> 0 then
- begin
- config := TConfig.CreateMem(cfgdata, cfglen);
- cwdt := Min(Max(config.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
- chgt := Min(Max(config.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
-
- spc := Min(Max(config.ReadInt('FontMap', 'Kerning', 0), -128), 127);
- FontID := e_CharFont_Create(spc);
-
- for a := 0 to 255 do
- begin
- chrwidth := config.ReadInt(IntToStr(a), 'Width', 0);
- if chrwidth = 0 then Continue;
-
- if e_CreateTextureMemEx(fntdata, fntlen, CharID, cwdt*(a mod 16), chgt*(a div 16),
- cwdt, chgt) then
- e_CharFont_AddChar(FontID, CharID, Chr(a), chrwidth);
- end;
-
- config.Free();
- end;
-
- if cfglen <> 0 then FreeMem(cfgdata);
- if fntlen <> 0 then FreeMem(fntdata);
-end;
-
procedure MenuLoadData();
begin
e_WriteLog('Loading menu data...', TMsgType.Notify);
index 777453a119a19d7e2b168bcc4598e8cfeb7e2993..df1b4acfff22c5e1aaf7f64599bdb9f007e0ce59 100644 (file)
--- a/src/game/g_monsters.pas
+++ b/src/game/g_monsters.pas
implementation
uses
- {$IFNDEF HEADLESS}
+ {$IFDEF ENABLE_MENU}
g_menu,
{$ENDIF}
e_log, g_sound, g_gfx, g_player, g_game,
index 7ae9c4c10e311d06f95a32fb1e68da8bab7d238a..12d926f937c309fc94ff6c7b186cbe4be50491e9 100644 (file)
--- a/src/game/g_netmaster.pas
+++ b/src/game/g_netmaster.pas
implementation
uses
+ {$IFDEF ENABLE_MENU}
+ g_gui, g_menu,
+ {$ENDIF}
{$IFNDEF HEADLESS}
- g_gui, g_menu, r_render, g_system,
+ r_render, g_system,
{$ENDIF}
e_input, e_log, g_net, g_console,
g_map, g_game, g_sound, g_options, g_language, g_basic,
SL := nil;
ST := nil;
gState := STATE_MENU;
-{$IFNDEF HEADLESS}
+{$IFDEF ENABLE_MENU}
g_GUI_ShowWindow('MainMenu');
g_GUI_ShowWindow('NetGameMenu');
g_GUI_ShowWindow('NetClientMenu');
Srv := GetServerFromTable(slSelection, SL, ST);
if Srv.Password then
begin
-{$IFNDEF HEADLESS}
+{$IFDEF ENABLE_MENU}
PromptIP := Srv.IP;
PromptPort := Srv.Port;
{$ENDIF}
gState := STATE_MENU;
-{$IFNDEF HEADLESS}
+{$IFDEF ENABLE_MENU}
g_GUI_ShowWindow('ClientPasswordMenu');
{$ENDIF}
SL := nil;
diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas
index 816673a180455a7289cd40b3332b97b40a39cad7..f3b095591d8b08a94c4296b2360403a1ed88506c 100644 (file)
--- a/src/game/g_netmsg.pas
+++ b/src/game/g_netmsg.pas
implementation
uses
- {$IFNDEF HEADLESS}
+ {$IFDEF ENABLE_MENU}
g_gui,
{$ENDIF}
Math, ENet, e_input, e_log, g_base, g_basic,
kByte := 0;
Predict := NetPredictSelf; // and (not NetGotKeys);
-{$IFDEF HEADLESS}
+{$IFDEF DISABLE_MENU}
if (not gConsoleShow) and (not gChatShow) then
{$ELSE}
if (not gConsoleShow) and (not gChatShow) and (g_ActiveWindow = nil) then
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 7d25ca5f126a47e57b4d9a147c4469636d61fa65..ea7cb7d1a11d50e8b4e0d9ad9e57663fb3cfd424 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
{$IFDEF ENABLE_HOLMES}
g_holmes,
{$ENDIF}
+ {$IFDEF ENABLE_MENU}
+ g_menu,
+ {$ENDIF}
{$IFNDEF HEADLESS}
- r_render, g_menu,
+ r_render,
{$ENDIF}
e_log, g_map, g_items, g_console, g_gfx, Math,
g_options, g_triggers, g_game, g_grid, e_res,
index f7ab15fdceedae8301bae1e96433705602953ccc..b8e8e52b613d8b8a0e9b354bd647ce258d71f9fd 100644 (file)
implementation
uses
+ {$IFDEF ENABLE_MENU}
+ g_menu,
+ {$ENDIF}
SysUtils, Classes, Math,
e_log, r_graphics, g_options, r_textures, r_game,
conbuf,
- g_base, g_console, g_game, g_menu
+ g_base, g_console, g_game
;
(* ====== Console ====== *)
index 6e587868d4114524cb45887784d91528fdc99a9c..75c3e2ee5e505cc63edb64cbb0622740f13fcf1d 100644 (file)
var
gStdFont: DWORD;
+ gMenuFont: DWORD;
+ gMenuSmallFont: DWORD;
implementation
uses
{$INCLUDE ../nogl/noGLuses.inc}
-{$IFDEF ENABLE_HOLMES}
- g_holmes,
-{$ENDIF}
+ {$IFDEF ENABLE_HOLMES}
+ g_holmes,
+ {$ENDIF}
+ {$IFDEF ENABLE_MENU}
+ g_gui, g_menu,
+ {$ENDIF}
SysUtils, Classes, Math,
g_base, g_basic, r_graphics,
g_system, g_touch,
- MAPDEF, xprofiler, utils, wadreader,
+ MAPDEF, xprofiler, utils, wadreader, CONFIG,
e_input, e_sound,
- g_language, g_console, g_menu, g_triggers, g_player, g_options, g_monsters, g_map, g_panel,
- g_items, g_weapons, g_gfx, g_phys, g_net, g_gui, g_netmaster,
+ g_language, g_console, g_triggers, g_player, g_options, g_monsters, g_map, g_panel,
+ g_items, g_weapons, g_gfx, g_phys, g_net, g_netmaster,
g_game, r_console, r_gfx, r_items, r_map, r_monsters, r_weapons, r_netmaster, r_player, r_textures,
r_playermodel
;
BackID: DWORD = DWORD(-1);
gBackSize: TDFPoint;
+procedure LoadStdFont(cfgres, texture: string; var FontID: DWORD);
+var
+ cwdt, chgt: Byte;
+ spc: ShortInt;
+ ID: DWORD;
+ wad: TWADFile;
+ cfgdata: Pointer;
+ cfglen: Integer;
+ config: TConfig;
+begin
+ cfglen := 0;
+
+ wad := TWADFile.Create;
+ if wad.ReadFile(GameWAD) then
+ wad.GetResource('FONTS/'+cfgres, cfgdata, cfglen);
+ wad.Free();
+
+ if cfglen <> 0 then
+ begin
+ g_Texture_CreateWADEx('FONT_STD', GameWAD+':FONTS\'+texture);
+
+ config := TConfig.CreateMem(cfgdata, cfglen);
+ cwdt := Min(Max(config.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
+ chgt := Min(Max(config.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
+ spc := Min(Max(config.ReadInt('FontMap', 'Kerning', 0), -128), 127);
+
+ if g_Texture_Get('FONT_STD', ID) then
+ e_TextureFontBuild(ID, FontID, cwdt, chgt, spc);
+
+ config.Free();
+ end;
+
+ if cfglen <> 0 then FreeMem(cfgdata);
+end;
+
+procedure LoadFont(txtres, fntres: string; var FontID: DWORD);
+var
+ cwdt, chgt: Byte;
+ spc: ShortInt;
+ CharID: DWORD;
+ wad: TWADFile;
+ cfgdata, fntdata: Pointer;
+ cfglen, fntlen: Integer;
+ config: TConfig;
+ chrwidth: Integer;
+ a: Byte;
+begin
+ cfglen := 0;
+ fntlen := 0;
+
+ wad := TWADFile.Create;
+ if wad.ReadFile(GameWAD) then
+ begin
+ wad.GetResource('FONTS/'+txtres, cfgdata, cfglen);
+ wad.GetResource('FONTS/'+fntres, fntdata, fntlen);
+ end;
+ wad.Free();
+
+ if cfglen <> 0 then
+ begin
+ config := TConfig.CreateMem(cfgdata, cfglen);
+ cwdt := Min(Max(config.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
+ chgt := Min(Max(config.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
+
+ spc := Min(Max(config.ReadInt('FontMap', 'Kerning', 0), -128), 127);
+ FontID := e_CharFont_Create(spc);
+
+ for a := 0 to 255 do
+ begin
+ chrwidth := config.ReadInt(IntToStr(a), 'Width', 0);
+ if chrwidth = 0 then Continue;
+
+ if e_CreateTextureMemEx(fntdata, fntlen, CharID, cwdt*(a mod 16), chgt*(a div 16),
+ cwdt, chgt) then
+ e_CharFont_AddChar(FontID, CharID, Chr(a), chrwidth);
+ end;
+
+ config.Free();
+ end;
+
+ if cfglen <> 0 then FreeMem(cfgdata);
+ if fntlen <> 0 then FreeMem(fntdata);
+end;
+
procedure r_Game_Load;
var
wl, hl: Integer;
end;
end;
+{$IFDEF ENABLE_MENU}
if gPauseMain and gGameOn and (g_ActiveWindow = nil) then
+{$ELSE}
+ if gPauseMain and gGameOn then
+{$ENDIF}
begin
//e_DrawFillQuad(0, 0, gScreenWidth-1, gScreenHeight-1, 48, 48, 48, 180);
e_DarkenQuadWH(0, 0, gScreenWidth, gScreenHeight, 150);
if not gGameOn then
begin
- if (gState = STATE_MENU) then
- begin
- if (g_ActiveWindow = nil) or (g_ActiveWindow.BackTexture = '') then r_Game_DrawMenuBackground('MENU_BACKGROUND');
- // F3 at menu will show game loading dialog
- if e_KeyPressed(IK_F3) then g_Menu_Show_LoadMenu(true);
- if (g_ActiveWindow <> nil) then
+ {$IFDEF ENABLE_MENU}
+ if (gState = STATE_MENU) then
begin
- //e_DrawFillQuad(0, 0, gScreenWidth-1, gScreenHeight-1, 48, 48, 48, 180);
- e_DarkenQuadWH(0, 0, gScreenWidth, gScreenHeight, 150);
- end
- else
- begin
- // F3 at titlepic will show game loading dialog
- if e_KeyPressed(IK_F3) then
+ if (g_ActiveWindow = nil) or (g_ActiveWindow.BackTexture = '') then r_Game_DrawMenuBackground('MENU_BACKGROUND');
+ // F3 at menu will show game loading dialog
+ if e_KeyPressed(IK_F3) then g_Menu_Show_LoadMenu(true);
+ if (g_ActiveWindow <> nil) then
begin
- g_Menu_Show_LoadMenu(true);
- if (g_ActiveWindow <> nil) then e_DarkenQuadWH(0, 0, gScreenWidth, gScreenHeight, 150);
+ //e_DrawFillQuad(0, 0, gScreenWidth-1, gScreenHeight-1, 48, 48, 48, 180);
+ e_DarkenQuadWH(0, 0, gScreenWidth, gScreenHeight, 150);
+ end
+ else
+ begin
+ // F3 at titlepic will show game loading dialog
+ if e_KeyPressed(IK_F3) then
+ begin
+ g_Menu_Show_LoadMenu(true);
+ if (g_ActiveWindow <> nil) then e_DarkenQuadWH(0, 0, gScreenWidth, gScreenHeight, 150);
+ end;
end;
end;
- end;
+ {$ELSE}
+ r_Game_DrawMenuBackground('MENU_BACKGROUND');
+ {$ENDIF}
if gState = STATE_FOLD then
begin
DrawCustomStat();
- if g_ActiveWindow <> nil then
- begin
- //e_DrawFillQuad(0, 0, gScreenWidth-1, gScreenHeight-1, 48, 48, 48, 180);
- e_DarkenQuadWH(0, 0, gScreenWidth, gScreenHeight, 150);
- end;
+ {$IFDEF ENABLE_MENU}
+ if g_ActiveWindow <> nil then
+ begin
+ //e_DrawFillQuad(0, 0, gScreenWidth-1, gScreenHeight-1, 48, 48, 48, 180);
+ e_DarkenQuadWH(0, 0, gScreenWidth, gScreenHeight, 150);
+ end;
+ {$ENDIF}
end;
if gState = STATE_INTERSINGLE then
DrawSingleStat();
- if g_ActiveWindow <> nil then
- begin
- //e_DrawFillQuad(0, 0, gScreenWidth-1, gScreenHeight-1, 48, 48, 48, 180);
- e_DarkenQuadWH(0, 0, gScreenWidth, gScreenHeight, 150);
- end;
+ {$IFDEF ENABLE_MENU}
+ if g_ActiveWindow <> nil then
+ begin
+ //e_DrawFillQuad(0, 0, gScreenWidth-1, gScreenHeight-1, 48, 48, 48, 180);
+ e_DarkenQuadWH(0, 0, gScreenWidth, gScreenHeight, 150);
+ end;
+ {$ENDIF}
end;
end;
if g_Texture_Get('TEXTURE_endpic', ID) then r_Game_DrawMenuBackground('TEXTURE_endpic')
else r_Game_DrawMenuBackground(_lc[I_TEXTURE_ENDPIC]);
- if g_ActiveWindow <> nil then
- begin
- //e_DrawFillQuad(0, 0, gScreenWidth-1, gScreenHeight-1, 48, 48, 48, 180);
- e_DarkenQuadWH(0, 0, gScreenWidth, gScreenHeight, 150);
- end;
+ {$IFDEF ENABLE_MENU}
+ if g_ActiveWindow <> nil then
+ begin
+ //e_DrawFillQuad(0, 0, gScreenWidth-1, gScreenHeight-1, 48, 48, 48, 180);
+ e_DarkenQuadWH(0, 0, gScreenWidth, gScreenHeight, 150);
+ end;
+ {$ENDIF}
end;
if gState = STATE_SLIST then
end;
end;
+{$IFDEF ENABLE_MENU}
if g_ActiveWindow <> nil then
begin
if gGameOn then
end;
g_ActiveWindow.Draw();
end;
+{$ENDIF}
{$IFNDEF HEADLESS}
r_Console_Draw();
index 679e85a7dc0a06837776c1992a70d043f5ca84bb..a2545c452f88ae84beb159b98feb0863242530d4 100644 (file)
implementation
uses
+ {$IFDEF ENABLE_MENU}
+ g_menu,
+ {$ENDIF}
SysUtils, Classes, Math,
r_graphics, r_game,
- g_basic, g_language, g_game, g_menu
+ g_basic, g_language, g_game
;
procedure r_Serverlist_Draw (var SL: TNetServerList; var ST: TNetServerTable);
index 2a962f7aab91f3b8bf17504a81bf2febcca783aa..225f8526e4616deed8bed125f857cc57dc8a95a0 100644 (file)
implementation
uses
+ {$IFDEF ENABLE_HOLMES}
+ g_holmes,
+ {$ENDIF}
+ {$IFDEF ENABLE_MENU}
+ g_menu,
+ {$ENDIF}
SysUtils, Classes, Math,
MAPDEF, utils,
- g_basic, g_game, g_phys, g_map, g_menu, g_language, g_weapons, g_items, g_net, g_options,
-{$IFDEF ENABLE_HOLMES}
- g_holmes,
-{$ENDIF}
+ g_basic, g_game, g_phys, g_map, g_language, g_weapons, g_items, g_net, g_options,
r_playermodel, r_graphics, r_animations, r_textures, r_items, r_game, r_map
;
index da6edc87bf1e9e90d28678c566859e454999ff73..645176010962aafa8b105f8389d3116f3cf3660b 100644 (file)
implementation
uses
+ {$IFDEF ENABLE_MENU}
+ g_gui,
+ {$ENDIF}
SysUtils,
- e_log, r_graphics, r_game, e_input, g_options, g_game, g_gui, g_weapons, g_console;
+ e_log, r_graphics, r_game, e_input, g_options, g_game, g_weapons, g_console
+ ;
var
angleFire: Boolean;
g_Console_ProcessBind(i, False);
(* up/down + fire hack *)
+{$IFDEF ENABLE_MENU}
if g_touch_fire and (gGameSettings.GameType <> GT_NONE) and (g_ActiveWindow = nil) and angleFire then
+{$ELSE}
+ if g_touch_fire and (gGameSettings.GameType <> GT_NONE) and angleFire then
+{$ENDIF}
begin
if (i = VK_UP) or (i = VK_DOWN) then
begin
g_Console_ProcessBind(i, True);
(* up/down + fire hack *)
+{$IFDEF ENABLE_MENU}
if g_touch_fire and (gGameSettings.GameType <> GT_NONE) and (g_ActiveWindow = nil) then
+{$ELSE}
+ if g_touch_fire and (gGameSettings.GameType <> GT_NONE) then
+{$ENDIF}
begin
if i = VK_UP then
begin
diff --git a/src/shared/a_modes.inc b/src/shared/a_modes.inc
index 9b5d9390f1fadf14f156622520bde230fc91a334..3e089bd122cb6c79b650e8fe63abe4cda0acfbb2 100644 (file)
--- a/src/shared/a_modes.inc
+++ b/src/shared/a_modes.inc
{$WARNING Holmes in headless mode has no sense. Disabled.}
{$UNDEF ENABLE_HOLMES}
{$ENDIF}
+ {$IFDEF ENABLE_MENU}
+ {$WARNING Menu in headless mode has no sense. Disabled.}
+ {$UNDEF ENABLE_MENU}
+ {$DEFINE DISABLE_MENU}
+ {$ENDIF}
+{$ENDIF}
+
+{$IF DEFINED(ENABLE_MENU) AND DEFINED(DISABLE_MENU)}
+ {$ERROR Select ENABLE_MENU or DISABLE_MENU}
+{$ELSEIF NOT DEFINED(ENABLE_MENU) AND NOT DEFINED(DISABLE_MENU)}
+ // defaut ENABLE/DISABLE menu
+ {$IFDEF HEADLESS}
+ {$DEFINE DISABLE_MENU}
+ {$ELSE}
+ {$DEFINE ENABLE_MENU}
+ {$ENDIF}
{$ENDIF}
{$IF DEFINED(USE_SYSSTUB)}