summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c49ad9c)
raw | patch | inline | side by side (parent: c49ad9c)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Mon, 17 Jan 2022 16:11:35 +0000 (19:11 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Mon, 17 Jan 2022 16:11:35 +0000 (19:11 +0300) |
diff --git a/src/game/Doom2DF.lpr b/src/game/Doom2DF.lpr
index 400e77701cc60a5b8e8980913526939a8bfc8644..1be6b0c4e9a3744003c22d5c9605084e349e28e2 100644 (file)
--- a/src/game/Doom2DF.lpr
+++ b/src/game/Doom2DF.lpr
fuiScrWdt := w;
fuiScrHgt := h;
{$ENDIF}
- g_Game_SetupScreenSize;
{$IFNDEF ANDROID}
(* This will fix menu reset on keyboard showing *)
g_Menu_Reset;
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 2ce5d95e7107a6b547b0e99670db518ec0335e59..17c9fdafbd775d156abebd401148926d16b8f4a3 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
procedure g_Game_Update();
procedure g_Game_PreUpdate();
procedure g_Game_Quit();
-procedure g_Game_SetupScreenSize();
function g_Game_ModeToText(Mode: Byte): string;
function g_Game_TextToMode(Mode: string): Byte;
procedure g_Game_ExecuteEvent(Name: String);
e_WriteLog(Format(_lc[I_SIMPLE_ERROR], [Text]), TMsgType.Warning);
end;
-procedure g_Game_SetupScreenSize();
-const
- RES_FACTOR = 4.0 / 3.0;
-var
- s: Single;
- rf: Single;
- bw, bh: Word;
-begin
-// Размер экранов игроков:
- gPlayerScreenSize.X := gScreenWidth-196;
- if (gPlayer1 <> nil) and (gPlayer2 <> nil) then
- gPlayerScreenSize.Y := gScreenHeight div 2
- else
- gPlayerScreenSize.Y := gScreenHeight;
-
-// Размер заднего плана:
- if BackID <> DWORD(-1) then
- begin
- s := SKY_STRETCH;
- if (gScreenWidth*s > gMapInfo.Width) or
- (gScreenHeight*s > gMapInfo.Height) then
- begin
- gBackSize.X := gScreenWidth;
- gBackSize.Y := gScreenHeight;
- end
- else
- begin
- e_GetTextureSize(BackID, @bw, @bh);
- rf := Single(bw) / Single(bh);
- if (rf > RES_FACTOR) then bw := Round(Single(bh) * RES_FACTOR)
- else if (rf < RES_FACTOR) then bh := Round(Single(bw) / RES_FACTOR);
- s := Max(gScreenWidth / bw, gScreenHeight / bh);
- if (s < 1.0) then s := 1.0;
- gBackSize.X := Round(bw*s);
- gBackSize.Y := Round(bh*s);
- end;
- end;
-end;
-
procedure g_Game_AddPlayer(Team: Byte = TEAM_NONE);
begin
if ((not gGameOn) and (gState <> STATE_INTERCUSTOM))
g_Game_ExecuteEvent('ongamestart');
-// Установка размеров окон игроков:
- g_Game_SetupScreenSize();
-
// Создание первого игрока:
gPlayer1 := g_Player_Get(g_Player_Create(gPlayer1Settings.Model,
gPlayer1Settings.Color,
g_Game_ExecuteEvent('ongamestart');
-// Установка размеров окон игроков:
- g_Game_SetupScreenSize();
-
// Режим наблюдателя:
if nPlayers = 0 then
begin
g_Game_ExecuteEvent('ongamestart');
-// Установка размеров окна игрока
- g_Game_SetupScreenSize();
-
// Режим наблюдателя:
if nPlayers = 0 then
begin
g_Game_ExecuteEvent('ongamestart');
-// Установка размеров окон игроков:
- g_Game_SetupScreenSize();
-
NetState := NET_STATE_AUTH;
g_Game_SetLoadingText(_lc[I_LOAD_CONNECT], 0, False);
diff --git a/src/game/g_map.pas b/src/game/g_map.pas
index 2ca5bb67c604fc8f1f03c53aa87575eb260524e2..c5afc785818d45c559299ec19bfcbe6fd0e0d0e0 100644 (file)
--- a/src/game/g_map.pas
+++ b/src/game/g_map.pas
Author: String;
MusicName: String;
SkyName: String;
+ SkyFullName: String; // used by render
Height: Word;
Width: Word;
end;
gFlags: array [FLAG_RED..FLAG_BLUE] of TFlag;
//gDOMFlags: array of TFlag;
gMapInfo: TMapInfo;
- gBackSize: TDFPoint;
gDoorMap: array of array of DWORD;
gLiftMap: array of array of DWORD;
gWADHash: TMD5Digest;
- BackID: DWORD = DWORD(-1);
gExternalResources: array of TDiskFileInfo = nil;
gMovingWallIds: array of Integer = nil;
//mapReader := nil;
// Çàãðóçêà íåáà
+ gMapInfo.SkyFullName := '';
if (gMapInfo.SkyName <> '') then
begin
e_WriteLog(' Loading sky: ' + gMapInfo.SkyName, TMsgType.Notify);
g_Game_SetLoadingText(_lc[I_LOAD_SKY], 0, False);
- s := e_GetResourcePath(WadDirs, gMapInfo.SkyName, g_ExtractWadName(Res));
- if g_Texture_CreateWAD(BackID, s, gTextureFilter) then
- g_Game_SetupScreenSize
- else
- g_FatalError(Format(_lc[I_GAME_ERROR_SKY], [s]))
+ gMapInfo.SkyFullName := e_GetResourcePath(WadDirs, gMapInfo.SkyName, g_ExtractWadName(Res));
end;
// Çàãðóçêà ìóçûêè
FreePanelArray(gBlockMon);
gMovingWallIds := nil;
- if BackID <> DWORD(-1) then
- begin
- gBackSize.X := 0;
- gBackSize.Y := 0;
- e_DeleteTexture(BackID);
- BackID := DWORD(-1);
- end;
-
g_Game_StopAllSounds(False);
gMusic.FreeSound();
g_Sound_Delete(gMapInfo.MusicName);
index 32f6821770c20af0affaf213d2b5ee23853e6cc2..d603440d839241a9c3513f59140ae34d0ca755ba 100644 (file)
--- a/src/game/g_saveload.pas
+++ b/src/game/g_saveload.pas
end;
g_Game_ExecuteEvent('ongamestart');
- // Óñòàíîâêà ðàçìåðîâ îêîí èãðîêîâ
- g_Game_SetupScreenSize();
-
// Çàãðóçêà è çàïóñê êàðòû
//FIXME: save/load `asMegawad`
if not g_Game_StartMap(false{asMegawad}, WAD_Path+':\'+Map_Name, True, curmapfile) then
index af6fa38e78d27de654cd04e39e75aa7c394eec5a..a31c4afccf67c14505a4f7ed56a09e9be0ef3380 100644 (file)
procedure r_Game_DrawLoadingStat;
procedure r_Game_DrawMenuBackground (tex: AnsiString);
+ procedure r_Game_SetupScreenSize;
+
var
gStdFont: DWORD;
FPSTime: LongWord;
hasPBarGfx: Boolean;
+ BackID: DWORD = DWORD(-1);
+ gBackSize: TDFPoint;
+
procedure r_Game_Load;
var
wl, hl: Integer;
g_Texture_Delete('TEXTURE_PLAYER_INVULPENTA');
end;
+procedure r_Game_SetupScreenSize;
+const
+ RES_FACTOR = 4.0 / 3.0;
+var
+ s: Single;
+ rf: Single;
+ bw, bh: Word;
+begin
+// Размер экранов игроков:
+ gPlayerScreenSize.X := gScreenWidth-196;
+ if (gPlayer1 <> nil) and (gPlayer2 <> nil) then
+ gPlayerScreenSize.Y := gScreenHeight div 2
+ else
+ gPlayerScreenSize.Y := gScreenHeight;
+
+// Размер заднего плана:
+ if BackID <> DWORD(-1) then
+ begin
+ s := SKY_STRETCH;
+ if (gScreenWidth*s > gMapInfo.Width) or
+ (gScreenHeight*s > gMapInfo.Height) then
+ begin
+ gBackSize.X := gScreenWidth;
+ gBackSize.Y := gScreenHeight;
+ end
+ else
+ begin
+ e_GetTextureSize(BackID, @bw, @bh);
+ rf := Single(bw) / Single(bh);
+ if (rf > RES_FACTOR) then bw := Round(Single(bh) * RES_FACTOR)
+ else if (rf < RES_FACTOR) then bh := Round(Single(bw) / RES_FACTOR);
+ s := Max(gScreenWidth / bw, gScreenHeight / bh);
+ if (s < 1.0) then s := 1.0;
+ gBackSize.X := Round(bw*s);
+ gBackSize.Y := Round(bh*s);
+ end;
+ end;
+end;
+
procedure r_Game_LoadTextures;
begin
g_Texture_CreateWADEx('TEXTURE_endpic', EndPicPath, gTextureFilter);
+ if gMapInfo.SkyFullName <> '' then
+ g_Texture_CreateWAD(BackID, gMapInfo.SkyFullName, gTextureFilter);
+ r_Game_SetupScreenSize;
end;
procedure r_Game_FreeTextures;
begin
- g_Texture_Delete('TEXTURE_endpic')
+ g_Texture_Delete('TEXTURE_endpic');
+ if BackID <> DWORD(-1) then
+ begin
+ gBackSize.X := 0;
+ gBackSize.Y := 0;
+ e_DeleteTexture(BackID);
+ BackID := DWORD(-1);
+ end
end;
+procedure r_Map_DrawBack(dx, dy: Integer);
+begin
+ if gDrawBackGround and (BackID <> DWORD(-1)) then
+ e_DrawSize(BackID, dx, dy, 0, False, False, gBackSize.X, gBackSize.Y)
+ else
+ e_Clear(GL_COLOR_BUFFER_BIT, 0, 0, 0);
+end;
+
function GetActivePlayer_ByID(ID: Integer): TPlayer;
var
a: Integer;
index 9efb062512f975054c65b7f011fd189132e7a4a2..b3efdc30be82fd2df53e77538f05631c83c185fb 100644 (file)
procedure r_Map_Update;
- procedure r_Map_DrawBack (dx, dy: Integer);
procedure r_Map_DrawPanels (PanelType: Word; hasAmbient: Boolean; constref ambColor: TDFColor); // unaccelerated
procedure r_Map_CollectDrawPanels (x0, y0, wdt, hgt: Integer);
procedure r_Map_DrawPanelShadowVolumes (lightX: Integer; lightY: Integer; radius: Integer);
uses
{$INCLUDE ../nogl/noGLuses.inc}
- SysUtils, Classes, Math, e_log, wadreader, CONFIG, utils,
+ SysUtils, Classes, Math, e_log, wadreader, CONFIG, utils, g_language,
r_graphics, r_animations, r_textures, g_textures,
g_base, g_basic, g_game, g_options,
g_map
it.release();
end;
-procedure r_Map_DrawBack(dx, dy: Integer);
-begin
- if gDrawBackGround and (BackID <> DWORD(-1)) then
- e_DrawSize(BackID, dx, dy, 0, False, False, gBackSize.X, gBackSize.Y)
- else
- e_Clear(GL_COLOR_BUFFER_BIT, 0, 0, 0);
-end;
-
procedure r_Map_DrawFlags;
var i, dx: Integer; Mirror: TMirrorType; f: PFlag;
begin
index d4af4b55fdd5b89432ed810c7759a72c8edaa182..1e5dec0edc646393aa95cab7fba5ff2611dfee24 100644 (file)
{$IFDEF ENABLE_HOLMES}
g_holmes,
{$ENDIF}
- r_playermodel, r_graphics, r_animations, r_textures, r_items, r_game
+ r_playermodel, r_graphics, r_animations, r_textures, r_items, r_game, r_map
;
var
index 2eec521475ec4c7806fa08c8d63a59538c1da293..90bda3b04a230a27abceb3ad4e651b518a5fad7e 100644 (file)
gScreenWidth := w;
gScreenHeight := h;
e_ResizeWindow(w, h);
- e_InitGL
+ e_InitGL;
+ r_Game_SetupScreenSize;
end;
procedure r_Render_Apply;