summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4c6bb5a)
raw | patch | inline | side by side (parent: 4c6bb5a)
author | Joseph Stalin <granminigun@pm.me> | |
Sat, 3 Aug 2019 18:38:49 +0000 (23:38 +0500) | ||
committer | Joseph Stalin <granminigun@pm.me> | |
Sat, 3 Aug 2019 18:39:07 +0000 (23:39 +0500) |
src/game/g_game.pas | patch | blob | history | |
src/game/g_gui.pas | patch | blob | history | |
src/game/g_window.pas | patch | blob | history |
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 8f659e8d3b57e7f52721f341c9020c0f86b51fde..41099da27c9b46b9d15508da7328bf67a10d23db 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
procedure g_Game_ClearLoading();
procedure g_Game_SetDebugMode();
procedure DrawLoadingStat();
+procedure DrawMenuBackground(tex: AnsiString; ID: DWord);
{ procedure SetWinPause(Enable: Boolean); }
sfsGCDisable(); // temporary disable removing of temporary volumes
try
+ TEXTUREFILTER := GL_LINEAR;
g_Texture_CreateWADEx('MENU_BACKGROUND', GameWAD+':TEXTURES\TITLE');
g_Texture_CreateWADEx('INTER', GameWAD+':TEXTURES\INTER');
g_Texture_CreateWADEx('ENDGAME_EN', GameWAD+':TEXTURES\ENDGAME_EN');
g_Texture_CreateWADEx('ENDGAME_RU', GameWAD+':TEXTURES\ENDGAME_RU');
+ TEXTUREFILTER := GL_NEAREST;
LoadStdFont('STDTXT', 'STDFONT', gStdFont);
LoadFont('MENUTXT', 'MENUFONT', gMenuFont);
end;
end;
+procedure DrawMenuBackground(tex: AnsiString; ID: DWord);
+var
+ w, h: Word;
+
+begin
+ if g_Texture_Get(tex, ID) then
+ begin
+ e_Clear(GL_COLOR_BUFFER_BIT, 0, 0, 0);
+ e_GetTextureSize(ID, @w, @h);
+ if w = h then
+ w := round(w * 1.333 * (gScreenHeight / h))
+ else
+ w := trunc(w * (gScreenHeight / h));
+ e_DrawSize(ID, (gScreenWidth - w) div 2, 0, 0, False, False, w, gScreenHeight);
+ end
+ else e_Clear(GL_COLOR_BUFFER_BIT, 0, 0, 0);
+end;
+
procedure DrawMinimap(p: TPlayer; RenderRect: e_graphics.TRect);
var
a, aX, aY, aX2, aY2, Scale, ScaleSz: Integer;
begin
if (gState = STATE_MENU) then
begin
- if (g_ActiveWindow = nil) or (g_ActiveWindow.BackTexture = '') then
- begin
- if g_Texture_Get('MENU_BACKGROUND', ID) then e_DrawSize(ID, 0, 0, 0, False, False, gScreenWidth, gScreenHeight)
- else e_Clear(GL_COLOR_BUFFER_BIT, 0, 0, 0);
- end;
+ if (g_ActiveWindow = nil) or (g_ActiveWindow.BackTexture = '') then DrawMenuBackground('MENU_BACKGROUND', ID);
// F3 at menu will show game loading dialog
if e_KeyPressed(IK_F3) then g_Menu_Show_LoadMenu(true);
if (g_ActiveWindow <> nil) then
else
back := 'INTER';
- if g_Texture_Get(back, ID) then
- e_DrawSize(ID, 0, 0, 0, False, False, gScreenWidth, gScreenHeight)
- else
- e_Clear(GL_COLOR_BUFFER_BIT, 0, 0, 0);
+ DrawMenuBackground(back, ID);
DrawCustomStat();
begin
back := 'INTER';
- if g_Texture_Get(back, ID) then
- e_DrawSize(ID, 0, 0, 0, False, False, gScreenWidth, gScreenHeight)
- else
- e_Clear(GL_COLOR_BUFFER_BIT, 0, 0, 0);
+ DrawMenuBackground(back, ID);
DrawSingleStat();
if gState = STATE_SLIST then
begin
- if g_Texture_Get('MENU_BACKGROUND', ID) then
- begin
- e_DrawSize(ID, 0, 0, 0, False, False, gScreenWidth, gScreenHeight);
- //e_DrawFillQuad(0, 0, gScreenWidth-1, gScreenHeight-1, 48, 48, 48, 180);
- e_DarkenQuadWH(0, 0, gScreenWidth, gScreenHeight, 150);
- end;
+// if g_Texture_Get('MENU_BACKGROUND', ID) then
+// begin
+// e_DrawSize(ID, 0, 0, 0, False, False, gScreenWidth, gScreenHeight);
+// //e_DrawFillQuad(0, 0, gScreenWidth-1, gScreenHeight-1, 48, 48, 48, 180);
+// end;
+ DrawMenuBackground('MENU_BACKGROUND', ID);
+ e_DarkenQuadWH(0, 0, gScreenWidth, gScreenHeight, 150);
g_Serverlist_Draw(slCurrent, slTable);
end;
end;
diff --git a/src/game/g_gui.pas b/src/game/g_gui.pas
index 07a03c19081dcbf21589dd8569ec03946c26b5c2..ef5645962bdc2e0bcdedd2f992979fd0c816f360 100644 (file)
--- a/src/game/g_gui.pas
+++ b/src/game/g_gui.pas
if len = 0 then
Exit;
-// Îêíî ñ ãëàâíûì ìåíþ:
+// ���� � ������� ����:
g_GUI_ShowWindow(Saved_Windows[len-1]);
-// Íå ïåðåêëþ÷èëîñü (èëè íåêóäà äàëüøå):
+// �� ������������� (��� ������ ������):
if (len = 1) or (g_ActiveWindow = nil) then
Exit;
-// Èùåì êíîïêè â îñòàëüíûõ îêíàõ:
+// ���� ������ � ��������� �����:
for k := len-1 downto 1 do
begin
ok := False;
Break;
end;
- // Íå ïåðåêëþ÷èëîñü:
+ // �� �������������:
if (not ok) or
(g_ActiveWindow.Name = Saved_Windows[k]) then
Break;
var
i: Integer;
ID: DWORD;
+ tw, th: Word;
begin
- if FBackTexture <> '' then
+ if FBackTexture <> '' then // Here goes code duplication from g_game.pas:DrawMenuBackground()
if g_Texture_Get(FBackTexture, ID) then
- e_DrawSize(ID, 0, 0, 0, False, False, gScreenWidth, gScreenHeight)
+ begin
+ e_Clear(GL_COLOR_BUFFER_BIT, 0, 0, 0);
+ e_GetTextureSize(ID, @tw, @th);
+ if tw = th then
+ tw := round(tw * 1.333 * (gScreenHeight / th))
+ else
+ tw := trunc(tw * (gScreenHeight / th));
+ e_DrawSize(ID, (gScreenWidth - tw) div 2, 0, 0, False, False, tw, gScreenHeight);
+ end
else
e_Clear(GL_COLOR_BUFFER_BIT, 0.5, 0.5, 0.5);
SetActive(Self)
else
begin
- if FItems[FIndex][1] = #29 then // Ïàïêà
+ if FItems[FIndex][1] = #29 then // �����
begin
OpenDir(FPath+Copy(FItems[FIndex], 2, 255));
FIndex := 0;
if ( (Length(FItems[a]) > 0) and
(LowerCase(FItems[a][1]) = LowerCase(Chr(wParam))) ) or
( (Length(FItems[a]) > 1) and
- (FItems[a][1] = #29) and // Ïàïêà
+ (FItems[a][1] = #29) and // �����
(LowerCase(FItems[a][2]) = LowerCase(Chr(wParam))) ) then
begin
FIndex := a;
path := IncludeTrailingPathDelimiter(path);
path := ExpandFileName(path);
- // Êàòàëîãè:
+ // ��������:
if FDirs then
begin
if FindFirst(path+'*', faDirectory, SR) = 0 then
FindClose(SR);
end;
- // Ôàéëû:
+ // �����:
sm := FFileMask;
while sm <> '' do
begin
diff --git a/src/game/g_window.pas b/src/game/g_window.pas
index 82107dca143b952159ffcb3c89540a03803e5633..fb3c24075839614e3f77a1099744b0e74639dea1 100644 (file)
--- a/src/game/g_window.pas
+++ b/src/game/g_window.pas
if forceUpdate then
begin
- if g_Texture_Get('INTER', ID) then
- begin
- e_DrawSize(ID, 0, 0, 0, false, false, gScreenWidth, gScreenHeight);
- e_DarkenQuadWH(0, 0, gScreenWidth, gScreenHeight, 150);
- end
- else
- begin
- e_Clear(GL_COLOR_BUFFER_BIT, 0, 0, 0);
- end;
+ DrawMenuBackground('INTER', ID);
+ e_DarkenQuadWH(0, 0, gScreenWidth, gScreenHeight, 150);
DrawLoadingStat();
SwapBuffers();
exit;
end;
- // Âðåìÿ ïðåäûäóùåãî îáíîâëåíèÿ
+ // ����� ����������� ����������
if flag then
begin
Time_Old := Time-(Time_Delta mod 28);
{$IFDEF USE_GLES1}
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
- SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
{$ELSE}
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
Init();
Time_Old := GetTimer();
- // Êîìàíäíàÿ ñòðîêà
+ // ��������� ������
if (ParamCount > 0) then g_Game_Process_Params();
- // Çàïðîñ ÿçûêà
+ // ������ �����
if (not gGameOn) and gAskLanguage then g_Menu_AskLanguage();
e_WriteLog('Entering the main loop', TMsgType.Notify);