summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 66a94fe)
raw | patch | inline | side by side (parent: 66a94fe)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Mon, 11 Sep 2017 13:45:30 +0000 (16:45 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Mon, 11 Sep 2017 13:45:59 +0000 (16:45 +0300) |
index ded85939193aaba22a8f569de903b4ed3dd94504..467994f5fdd0869eb031d10b31afbb2efd8bda8e 100644 (file)
e_Colors: TRGB;
e_NoGraphics: Boolean = False;
e_FastScreenshots: Boolean = true; // it's REALLY SLOW with `false`
+ g_dbg_scale: Single = 1.0;
implementation
e_SetViewPort(0, 0, Width, Height);
end;
-procedure drawTxQuad (x0, y0, w, h: Integer; u, v: single; Mirror: TMirrorType);
+procedure drawTxQuad (x0, y0, w, h, tw, th: Integer; u, v: single; Mirror: TMirrorType);
var
x1, y1, tmp: Integer;
begin
y1 := y0+h;
if Mirror = M_HORIZONTAL then begin tmp := x1; x1 := x0; x0 := tmp; end
else if Mirror = M_VERTICAL then begin tmp := y1; y1 := y0; y0 := tmp; end;
+ //HACK: make texture one pixel shorter, so it won't wrap
+ if (g_dbg_scale <> 1.0) then
+ begin
+ u := u*tw/(tw+1);
+ v := v*th/(th+1);
+ end;
glTexCoord2f(0, v); glVertex2i(x0, y0);
glTexCoord2f(0, 0); glVertex2i(x0, y1);
glTexCoord2f(u, 0); glVertex2i(x1, y1);
glBindTexture(GL_TEXTURE_2D, e_Textures[ID].tx.id);
glBegin(GL_QUADS);
- drawTxQuad(X, Y, e_Textures[id].tx.width, e_Textures[id].tx.height, e_Textures[ID].tx.u, e_Textures[ID].tx.v, Mirror);
+ drawTxQuad(X, Y, e_Textures[id].tx.width, e_Textures[id].tx.height, e_Textures[id].tx.width, e_Textures[id].tx.height, e_Textures[ID].tx.u, e_Textures[ID].tx.v, Mirror);
//u := e_Textures[ID].tx.u;
//v := e_Textures[ID].tx.v;
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, e_Textures[ID].tx.id);
glBegin(GL_QUADS);
- drawTxQuad(X, Y, Width, Height, e_Textures[ID].tx.u, e_Textures[ID].tx.v, Mirror);
+ drawTxQuad(X, Y, Width, Height, e_Textures[id].tx.width, e_Textures[id].tx.height, e_Textures[ID].tx.u, e_Textures[ID].tx.v, Mirror);
glEnd();
glDisable(GL_BLEND);
glBindTexture(GL_TEXTURE_2D, e_Textures[id].tx.id);
glBegin(GL_QUADS); //0-1 1-1
//00 10
- drawTxQuad(X, Y, e_Textures[id].tx.width, e_Textures[id].tx.height, e_Textures[ID].tx.u, e_Textures[ID].tx.v, Mirror);
+ drawTxQuad(X, Y, e_Textures[id].tx.width, e_Textures[id].tx.height, e_Textures[id].tx.width, e_Textures[id].tx.height, e_Textures[ID].tx.u, e_Textures[ID].tx.v, Mirror);
glEnd();
if Angle <> 0 then
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 1d95bda6e40339c5e2a11b94d0dcddd04e1ae93c..2b1423315601c7632dfae4f114974c70fd1719f3 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
g_rlayer_water: Boolean = true;
g_rlayer_fore: Boolean = true;
- g_dbg_scale: Single = 1.0;
-
procedure g_ResetDynlights ();
procedure g_AddDynLight (x, y, radius: Integer; r, g, b, a: Single);
implementation
uses
- g_textures, g_main, g_window, g_menu,
+ 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,
if setTransMatrix then
begin
+ //if (g_dbg_scale <> 1.0) then glTranslatef(0.0, -0.375/2, 0);
glScalef(g_dbg_scale, g_dbg_scale, 1.0);
glTranslatef(-sX, -sY, 0);
end;
diff --git a/src/game/g_holmes.pas b/src/game/g_holmes.pas
index b6724a994d7c2fca015d85a67fbf8bbdb73584e1..96e86c97a5f93a15cc525122a79fcc2a3ed111a7 100644 (file)
--- a/src/game/g_holmes.pas
+++ b/src/game/g_holmes.pas
implementation
uses
- {rttiobj,} typinfo,
+ {rttiobj,} typinfo, e_texture,
SysUtils, Classes, GL, SDL2,
MAPDEF, g_main, g_options,
utils, hashtable, xparser;
diff --git a/src/game/g_map.pas b/src/game/g_map.pas
index bac475b18901716c0c48b4007f0cc24167a60bef..9c696cb656b766b347129617d92d92e523ad32a4 100644 (file)
--- a/src/game/g_map.pas
+++ b/src/game/g_map.pas
implementation
uses
- e_input, g_main, e_log, SysUtils, g_items, g_gfx, g_console,
+ e_input, g_main, e_log, e_texture, SysUtils, g_items, g_gfx, g_console,
GL, GLExt, g_weapons, g_game, g_sound, e_sound, CONFIG,
g_options, g_triggers, g_player,
Math, g_monsters, g_saveload, g_language, g_netmsg,
TextureData: Pointer;
WADName: String;
a, ResLength: Integer;
+ oldFilter: Integer;
begin
RecName := toLowerCase1251(RecName);
if (TextNameHash = nil) then TextNameHash := hashNewStrInt();
end;
}
- if WAD.GetResource(g_ExtractFilePathName(RecName), TextureData, ResLength, log) then
- begin
- SetLength(Textures, Length(Textures)+1);
- if not e_CreateTextureMem(TextureData, ResLength, Textures[High(Textures)].TextureID) then
+ oldFilter := TEXTUREFILTER;
+ TEXTUREFILTER := GL_NEAREST;
+ try
+ if WAD.GetResource(g_ExtractFilePathName(RecName), TextureData, ResLength, log) then
begin
- SetLength(Textures, Length(Textures)-1);
- Exit;
- end;
- e_GetTextureSize(Textures[High(Textures)].TextureID, @Textures[High(Textures)].Width, @Textures[High(Textures)].Height);
- FreeMem(TextureData);
- Textures[High(Textures)].TextureName := RecName;
- Textures[High(Textures)].Anim := False;
+ SetLength(Textures, Length(Textures)+1);
+ if not e_CreateTextureMem(TextureData, ResLength, Textures[High(Textures)].TextureID) then
+ begin
+ SetLength(Textures, Length(Textures)-1);
+ Exit;
+ end;
+ e_GetTextureSize(Textures[High(Textures)].TextureID, @Textures[High(Textures)].Width, @Textures[High(Textures)].Height);
+ FreeMem(TextureData);
+ Textures[High(Textures)].TextureName := RecName;
+ Textures[High(Textures)].Anim := False;
- result := High(Textures);
- TextNameHash.put(RecName, result);
- end
- else // Íåò òàêîãî ðåóñðñà â WAD'å
- begin
- //e_WriteLog(Format('SHIT! Error loading texture %s : %s', [RecName, g_ExtractFilePathName(RecName)]), MSG_WARNING);
- if (BadTextNameHash = nil) then BadTextNameHash := hashNewStrInt();
- if log and (not BadTextNameHash.get(RecName, a)) then
+ result := High(Textures);
+ TextNameHash.put(RecName, result);
+ end
+ else // Íåò òàêîãî ðåóñðñà â WAD'å
begin
- e_WriteLog(Format('Error loading texture %s', [RecName]), MSG_WARNING);
- //e_WriteLog(Format('WAD Reader error: %s', [WAD.GetLastErrorStr]), MSG_WARNING);
+ //e_WriteLog(Format('SHIT! Error loading texture %s : %s', [RecName, g_ExtractFilePathName(RecName)]), MSG_WARNING);
+ if (BadTextNameHash = nil) then BadTextNameHash := hashNewStrInt();
+ if log and (not BadTextNameHash.get(RecName, a)) then
+ begin
+ e_WriteLog(Format('Error loading texture %s', [RecName]), MSG_WARNING);
+ //e_WriteLog(Format('WAD Reader error: %s', [WAD.GetLastErrorStr]), MSG_WARNING);
+ end;
+ BadTextNameHash.put(RecName, -1);
end;
- BadTextNameHash.put(RecName, -1);
+ finally
+ TEXTUREFILTER := oldFilter;
end;
WAD.Free();
mapReader := nil;
// Çàãðóçêà íåáà
- if gMapInfo.SkyName <> '' then
+ if (gMapInfo.SkyName <> '') then
begin
e_WriteLog(' Loading sky: ' + gMapInfo.SkyName, MSG_NOTIFY);
g_Game_SetLoadingText(_lc[I_LOAD_SKY], 0, False);
FileName := g_ExtractWadName(gMapInfo.SkyName);
- if FileName <> '' then
- FileName := GameDir+'/wads/'+FileName
- else
- begin
- FileName := g_ExtractWadName(Res);
- end;
+ if (FileName <> '') then FileName := GameDir+'/wads/'+FileName else FileName := g_ExtractWadName(Res);
s := FileName+':'+g_ExtractFilePathName(gMapInfo.SkyName);
if g_Texture_CreateWAD(BackID, s) then
- begin
- g_Game_SetupScreenSize();
- end
+ begin
+ g_Game_SetupScreenSize();
+ end
else
+ begin
g_FatalError(Format(_lc[I_GAME_ERROR_SKY], [s]));
+ end;
end;
// Çàãðóçêà ìóçûêè
index 834220a1b40d316a4634bfc93f432739c077f860..9647d18eca57012ecd6a4773bd78db2054143f72 100644 (file)
--- a/src/game/g_monsters.pas
+++ b/src/game/g_monsters.pas
implementation
uses
- e_log, g_main, g_sound, g_gfx, g_player, g_game,
+ e_log, e_texture, g_main, g_sound, g_gfx, g_player, g_game,
g_weapons, g_triggers, MAPDEF, g_items, g_options,
g_console, g_map, Math, SysUtils, g_menu, wadreader,
g_language, g_netmsg, idpool;
diff --git a/src/game/g_panel.pas b/src/game/g_panel.pas
index 07fe2d6103e5dd4f2fc57ec38e1b67330060203b..16f43c2cbb2eedd0c7016b1fb1d9f4d6bfae35ce 100644 (file)
--- a/src/game/g_panel.pas
+++ b/src/game/g_panel.pas
implementation
uses
- SysUtils, g_basic, g_map, g_game, g_gfx, e_graphics, g_weapons, g_triggers,
+ SysUtils, e_texture, g_basic, g_map, g_game, g_gfx, e_graphics, g_weapons, g_triggers,
g_console, g_language, g_monsters, g_player, g_grid, e_log, GL, utils;
const
diff --git a/src/game/g_window.pas b/src/game/g_window.pas
index 5f04992969bd4ace2b25683a447b5613f5caa877..46ec6df528d540fa7b985c8ce5b58f78104284aa 100644 (file)
--- a/src/game/g_window.pas
+++ b/src/game/g_window.pas
uses
{$IFDEF WINDOWS}Windows,{$ENDIF}
SysUtils, Classes, MAPDEF,
- SDL2, GL, GLExt, e_graphics, e_log, g_main,
+ SDL2, GL, GLExt, e_graphics, e_log, e_texture, g_main,
g_console, e_input, g_options, g_game,
g_basic, g_textures, e_sound, g_sound, g_menu, ENet, g_net,
g_map, g_gfx, g_monsters, g_holmes, xprofiler, utils;