diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 918a94714df9f810469a5204a8e83d817fac5074..27377d3e9ba44b57b660d9c0aa24ba5321c20452 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
SysUtils, Classes,
MAPDEF,
g_basic, g_player, e_graphics, g_res_downloader,
- g_sound, g_gui, utils, md5, mempool, xprofiler;
+ g_sound, g_gui, utils, md5, mempool, xprofiler,
+ g_touch;
type
TGameSettings = record
procedure DebugCommands(P: SSArray);
procedure g_Game_Process_Params;
procedure g_Game_SetLoadingText(Text: String; Max: Integer; reWrite: Boolean);
-procedure g_Game_StepLoading();
+procedure g_Game_StepLoading(Value: Integer = -1);
procedure g_Game_ClearLoading();
procedure g_Game_SetDebugMode();
procedure DrawLoadingStat();
gChatSounds: Array of TChatSound;
g_dbg_ignore_bounds: Boolean = false;
+ r_smallmap_h: Integer = 0; // 0: left; 1: center; 2: right
+ r_smallmap_v: Integer = 2; // 0: top; 1: center; 2: bottom
// move button values:
// bits 0-1: l/r state:
implementation
uses
+{$INCLUDE ../nogl/noGLuses.inc}
+{$IFDEF ENABLE_HOLMES}
+ g_holmes,
+{$ENDIF}
e_texture, g_textures, g_main, g_window, g_menu,
e_input, e_log, g_console, g_items, g_map, g_panel,
g_playermodel, g_gfx, g_options, g_weapons, Math,
g_triggers, g_monsters, e_sound, CONFIG,
g_language, g_net,
- ENet, e_msg, g_netmsg, g_netmaster, GL, GLExt,
- sfs, wadreader, g_holmes;
+ ENet, e_msg, g_netmsg, g_netmaster,
+ sfs, wadreader;
var
EndingGameCounter: Byte = 0;
MessageText: String;
MessageTime: Word;
+ MessageLineLength: Integer = 80;
MapList: SSArray = nil;
MapIndex: Integer = -1;
MegaWAD: record
end
else
slWaitStr := _lc[I_NET_SLIST_ERROR];
+ g_Serverlist_GenerateTable(slCurrent, slTable);
end;
g_Game_ExecuteEvent('ongameend');
gMusic.SetByName('MUSIC_INTERMUS');
gMusic.Play();
gState := STATE_INTERSINGLE;
+ e_UnpressAllKeys();
g_Game_ExecuteEvent('oninter');
end
if (not g_Game_IsClient) and
(
(
- (e_KeyPressed(IK_RETURN) or e_KeyPressed(IK_KPRETURN) or e_KeyPressed(IK_SPACE))
+ (
+ e_KeyPressed(IK_RETURN) or e_KeyPressed(IK_KPRETURN) or e_KeyPressed(IK_SPACE) or
+ e_KeyPressed(VK_FIRE) or e_KeyPressed(VK_OPEN)
+ )
and (not gJustChatted) and (not gConsoleShow) and (not gChatShow)
and (g_ActiveWindow = nil)
)
gMusic.Play();
gState := STATE_INTERCUSTOM;
+ e_UnpressAllKeys();
end
else // Çàêîí÷èëàñü ïîñëåäíÿÿ êàðòà â Îäèíî÷íîé èãðå
begin
gMusic.SetByName('MUSIC_INTERMUS');
gMusic.Play();
gState := STATE_INTERSINGLE;
+ e_UnpressAllKeys();
end;
g_Game_ExecuteEvent('oninter');
end
end;
STATE_SLIST:
- g_Serverlist_Control(slCurrent);
+ g_Serverlist_Control(slCurrent, slTable);
end;
if g_Game_IsNet then
begin
if g_ActiveWindow = nil then
begin
- if e_KeyPressed(gGameControls.GameControls.Chat) then
+ if e_KeyPressed(gGameControls.GameControls.Chat) or e_KeyPressed(VK_CHAT) then
g_Console_Chat_Switch(False)
- else if (e_KeyPressed(gGameControls.GameControls.TeamChat)) and
+ else if (e_KeyPressed(gGameControls.GameControls.TeamChat) or e_KeyPressed(VK_TEAM)) and
(gGameSettings.GameMode in [GM_TDM, GM_CTF]) then
g_Console_Chat_Switch(True);
end;
end else
if not gChatEnter then
if (not e_KeyPressed(gGameControls.GameControls.Chat))
- and (not e_KeyPressed(gGameControls.GameControls.TeamChat)) then
+ and (not e_KeyPressed(gGameControls.GameControls.TeamChat))
+ and (not e_KeyPressed(VK_CHAT))
+ and (not e_KeyPressed(VK_TEAM)) then
gChatEnter := True;
// Ñòàòèñòèêà ïî Tab:
if gGameOn then
IsDrawStat := (not gConsoleShow) and (not gChatShow) and
(gGameSettings.GameType <> GT_SINGLE) and
- e_KeyPressed(gGameControls.GameControls.Stat);
+ (e_KeyPressed(gGameControls.GameControls.Stat) or e_KeyPressed(VK_STATUS));
// Èãðà èäåò:
if gGameOn and not gPause and (gState <> STATE_FOLD) then
end;
// Äåëàåì ñêðèíøîò (íå ÷àùå 200 ìèëëèñåêóíä):
- if e_KeyPressed(gGameControls.GameControls.TakeScreenshot) then
+ if e_KeyPressed(gGameControls.GameControls.TakeScreenshot) or e_KeyPressed(VK_PRINTSCR) then
if (GetTimer()-LastScreenShot) > 200000 div 1000 then
begin
g_TakeScreenShot();
g_ProcessMessages();
- if e_KeyPressed(IK_TAB) then
+ if e_KeyPressed(IK_TAB) or e_KeyPressed(VK_STATUS) then
begin
if not gStatsPressed then
begin
* glBlendFunc(GL_DST_ALPHA, GL_ONE);
* draw all geometry up to and including walls (with alpha-testing, probably) -- this does lighting
*)
-
wassc := (glIsEnabled(GL_SCISSOR_TEST) <> 0);
if wassc then glGetIntegerv(GL_SCISSOR_BOX, @scxywh[0]) else glGetIntegerv(GL_VIEWPORT, @scxywh[0]);
tagmask: Integer;
pan: TPanel;
begin
- profileFrameDraw.sectionBegin(profname);
+ if (profileFrameDraw <> nil) then profileFrameDraw.sectionBegin(profname);
if gdbg_map_use_accel_render then
begin
tagmask := panelTypeToTag(panType);
begin
if doDraw then g_Map_DrawPanels(panType, hasAmbient, ambColor);
end;
- profileFrameDraw.sectionEnd();
+ if (profileFrameDraw <> nil) then profileFrameDraw.sectionEnd();
end;
procedure drawOther (profname: AnsiString; cb: TDrawCB);
begin
- profileFrameDraw.sectionBegin(profname);
+ if (profileFrameDraw <> nil) then profileFrameDraw.sectionBegin(profname);
if assigned(cb) then cb();
- profileFrameDraw.sectionEnd();
+ if (profileFrameDraw <> nil) then profileFrameDraw.sectionEnd();
end;
begin
- profileFrameDraw.sectionBegin('total');
+ if (profileFrameDraw <> nil) then profileFrameDraw.sectionBegin('total');
// our accelerated renderer will collect all panels to gDrawPanelList
// we can use panel tag to render level parts (see GridTagXXX in g_map.pas)
- profileFrameDraw.sectionBegin('collect');
+ if (profileFrameDraw <> nil) then profileFrameDraw.sectionBegin('collect');
if gdbg_map_use_accel_render then
begin
g_Map_CollectDrawPanels(sX, sY, sWidth, sHeight);
end;
- profileFrameDraw.sectionEnd();
+ if (profileFrameDraw <> nil) then profileFrameDraw.sectionEnd();
- profileFrameDraw.sectionBegin('skyback');
+ if (profileFrameDraw <> nil) then profileFrameDraw.sectionBegin('skyback');
g_Map_DrawBack(backXOfs, backYOfs);
- profileFrameDraw.sectionEnd();
+ if (profileFrameDraw <> nil) then profileFrameDraw.sectionEnd();
if setTransMatrix then
begin
g_Player_DrawHealth();
end;
- profileFrameDraw.mainEnd(); // map rendering
+ if (profileFrameDraw <> nil) then profileFrameDraw.mainEnd(); // map rendering
end;
end;
if (profileFrameDraw = nil) then profileFrameDraw := TProfiler.Create('RENDER', g_profile_history_size);
- profileFrameDraw.mainBegin(g_profile_frame_draw);
+ if (profileFrameDraw <> nil) then profileFrameDraw.mainBegin(g_profile_frame_draw);
gPlayerDrawn := p;
//conwritefln('OLD: (%s,%s)-(%s,%s)', [sX, sY, sWidth, sHeight]);
fixViewportForScale();
//conwritefln(' (%s,%s)-(%s,%s)', [sX, sY, sWidth, sHeight]);
+
if (g_dbg_scale <> 1.0) and (not g_dbg_ignore_bounds) then
begin
if (sX+sWidth > gMapInfo.Width) then sX := gMapInfo.Width-sWidth;
if (gBackSize.X <= gPlayerScreenSize.X) or (gMapInfo.Width <= sWidth) then c := 0 else c := trunc((gBackSize.X-gPlayerScreenSize.X)*sX/(gMapInfo.Width-sWidth));
if (gBackSize.Y <= gPlayerScreenSize.Y) or (gMapInfo.Height <= sHeight) then d := 0 else d := trunc((gBackSize.Y-gPlayerScreenSize.Y)*sY/(gMapInfo.Height-sHeight));
end;
+
+ //r_smallmap_h: 0: left; 1: center; 2: right
+ //r_smallmap_v: 0: top; 1: center; 2: bottom
+ // horiz small map?
+ if (gMapInfo.Width = sWidth) then
+ begin
+ sX := 0;
+ end
+ else if (gMapInfo.Width < sWidth) then
+ begin
+ case r_smallmap_h of
+ 1: sX := -((sWidth-gMapInfo.Width) div 2); // center
+ 2: sX := -(sWidth-gMapInfo.Width); // right
+ else sX := 0; // left
+ end;
+ end;
+ // vert small map?
+ if (gMapInfo.Height = sHeight) then
+ begin
+ sY := 0;
+ end
+ else if (gMapInfo.Height < sHeight) then
+ begin
+ case r_smallmap_v of
+ 1: sY := -((sHeight-gMapInfo.Height) div 2); // center
+ 2: sY := -(sHeight-gMapInfo.Height); // bottom
+ else sY := 0; // top
+ end;
+ end;
+
p.viewPortX := sX;
p.viewPortY := sY;
p.viewPortW := sWidth;
p.viewPortH := sHeight;
+{$IFDEF ENABLE_HOLMES}
if (p = gPlayer1) then
begin
g_Holmes_plrViewPos(sX, sY);
g_Holmes_plrViewSize(sWidth, sHeight);
end;
+{$ENDIF}
renderMapInternal(-c, -d, true);
px: Integer = -1;
py: Integer = -1;
begin
- if g_profile_frame_draw then px := px-drawProfiles(px, py, profileFrameDraw);
- if g_profile_collision then begin px := px-drawProfiles(px, py, profMapCollision); py -= calcProfilesHeight(profMonsLOS); end;
- if g_profile_los then begin px := px-drawProfiles(px, py, profMonsLOS); py -= calcProfilesHeight(profMonsLOS); end;
+ if g_profile_frame_draw and (profileFrameDraw <> nil) then px := px-drawProfiles(px, py, profileFrameDraw);
+ if g_profile_collision and (profMapCollision <> nil) then begin px := px-drawProfiles(px, py, profMapCollision); py -= calcProfilesHeight(profMonsLOS); end;
+ if g_profile_los and (profMonsLOS <> nil) then begin px := px-drawProfiles(px, py, profMonsLOS); py -= calcProfilesHeight(profMonsLOS); end;
end;
procedure g_Game_Draw();
e_DrawLine(2, 0, gScreenHeight div 2, gScreenWidth, gScreenHeight div 2, 0, 0, 0);
end;
+{$IFDEF ENABLE_HOLMES}
// draw inspector
if (g_holmes_enabled) then g_Holmes_Draw();
+{$ENDIF}
if MessageText <> '' then
begin
//e_DrawFillQuad(0, 0, gScreenWidth-1, gScreenHeight-1, 48, 48, 48, 180);
e_DarkenQuadWH(0, 0, gScreenWidth, gScreenHeight, 150);
end;
- g_Serverlist_Draw(slCurrent);
+ g_Serverlist_Draw(slCurrent, slTable);
end;
end;
if gGameOn then drawProfilers();
+{$IFDEF ENABLE_HOLMES}
g_Holmes_DrawUI();
+{$ENDIF}
+
+ g_Touch_Draw;
end;
procedure g_Game_Quit();
ProcessLoading(true);
- if e_KeyPressed(IK_ESCAPE) or e_KeyPressed(IK_SPACE) then
+ if e_KeyPressed(IK_ESCAPE) or e_KeyPressed(IK_SPACE) or e_KeyPressed(VK_ESCAPE) then
begin
State := 0;
break;
gWADHash := MD5File(MapsDir + NewWAD);
g_Game_LoadWAD(NewWAD);
end else
- // hash recieved in MC_RECV_GameEvent -> NET_EV_MAPSTART
+ // hash received in MC_RECV_GameEvent -> NET_EV_MAPSTART
g_Game_ClientWAD(NewWAD, gWADHash);
end else
ResName := Map;
procedure g_Game_Message(Msg: string; Time: Word);
begin
- MessageText := b_Text_Format(Msg);
+ MessageLineLength := (gScreenWidth - 204) div e_CharFont_GetMaxWidth(gMenuFont);
+ MessageText := b_Text_Wrap(b_Text_Format(Msg), MessageLineLength);
MessageTime := Time;
end;
ProcessLoading(true);
end;
-procedure g_Game_StepLoading();
+procedure g_Game_StepLoading(Value: Integer = -1);
begin
with LoadingStat do
begin
- Inc(CurValue);
- Inc(ShowCount);
- if (ShowCount > LOADING_SHOW_STEP) then
+ if Value = -1 then
+ begin
+ Inc(CurValue);
+ Inc(ShowCount);
+ end
+ else
+ CurValue := Value;
+ if (ShowCount > LOADING_SHOW_STEP) or (Value > -1) then
begin
ShowCount := 0;
ProcessLoading();
conRegVar('los_enabled', @gmon_dbg_los_enabled, 'enable/disable monster LOS calculations', 'monster LOS', true);
conRegVar('mon_think', @gmon_debug_think, 'enable/disable monster thinking', 'monster thinking', true);
+{$IFDEF ENABLE_HOLMES}
conRegVar('dbg_holmes', @g_holmes_enabled, 'enable/disable Holmes', 'Holmes', true);
+{$ENDIF}
conRegVar('dbg_ignore_level_bounds', @g_dbg_ignore_bounds, 'ignore level bounds', '', false);
conRegVar('light_enabled', @gwin_k8_enable_light_experiments, 'enable/disable dynamic lighting', 'lighting');
conRegVar('light_player_halo', @g_playerLight, 'enable/disable player halo', 'player light halo');
+
+ conRegVar('r_smallmap_align_h', @r_smallmap_h, 'halign: 0: left; 1: center; 2: right', 'horizontal aligning of small maps');
+ conRegVar('r_smallmap_align_v', @r_smallmap_v, 'valign: 0: top; 1: center; 2: bottom', 'vertial aligning of small maps');
end.