summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 76bea6c)
raw | patch | inline | side by side (parent: 76bea6c)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Thu, 27 Jan 2022 15:53:47 +0000 (18:53 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 9 Jun 2023 07:57:12 +0000 (10:57 +0300) |
14 files changed:
diff --git a/src/game/Doom2DF.lpr b/src/game/Doom2DF.lpr
index 166c2ed26d9fbf4e9effd687a3005289cdff14a3..1db010902c294eb9f71d319085a669ce632d0c03 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 514c69e0ee27a53cd303a83c2e534e9ba4c2ae9f..13bf81f55870bc559f01d47e663b715cb83874ec 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 *)
ConsoleStdIn: Boolean;
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 6ecd2c5db2b4359925ee1c180ca7fc2974a65582..2debca1f909544d3fe6dc55b70cee0347675ebc5 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 a580596b118b6db3b5721c19a53c94bb59b37c82..80f27318b471b0e32b9e70c3f05267cf835b25c4 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 a035cd020ea55fdacd2decb2ff1057e7d0522315..97152525e5c4d7e688a5d433851128124f57bde4 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 91db892681e4a33cb4edcb747625f3a843564e85..5dbe785c3865c3691e785aa0de01412fdefd582c 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 bc7f7c98c52bf1f62494a22b1951117d472a537e..759f4b6bd963964b6c9d76524fd178902881091b 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 9ae2b6e1df81c4c75031e2596f1dd0a0b02c8636..db455725d2ca1b4f83c662584a279953acad455f 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 246449864c7b6db3137230cd65265f2346dfcacc..ed21eaabcee583c62290f99a732b6f161d681635 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 da9f8da41dc7cffeb415b1545e25a184ac7bee8e..62f81929bb612497f77a7f3795afa4e794abc927 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 a7f5ab13079ee747afa91bf8e9f7732b5a003cbe..43b773baf80e7de79fe0f506e7a8dd2a4bef36fc 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)}