From: Ketmar Dark Date: Thu, 31 Aug 2017 00:30:39 +0000 (+0300) Subject: added some alternative texture names ==> simple zipping "game.wad" from resource... X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=ff152ddb08bd84058c4162fcee523a2864a26368;p=d2df-sdl.git added some alternative texture names ==> simple zipping "game.wad" from resource repository works --- diff --git a/src/game/g_game.pas b/src/game/g_game.pas index 66a589b..a22912b 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -2009,12 +2009,12 @@ begin g_Texture_CreateWADEx('TEXTURE_PLAYER_HUDJET', GameWAD+':TEXTURES\JETBAR'); g_Texture_CreateWADEx('TEXTURE_PLAYER_HUDBG', GameWAD+':TEXTURES\HUDBG'); g_Texture_CreateWADEx('TEXTURE_PLAYER_ARMORHUD', GameWAD+':TEXTURES\ARMORHUD'); - g_Texture_CreateWADEx('TEXTURE_PLAYER_REDFLAG', GameWAD+':TEXTURES\FLAGHUD_RB'); - g_Texture_CreateWADEx('TEXTURE_PLAYER_REDFLAG_S', GameWAD+':TEXTURES\FLAGHUD_RS'); - g_Texture_CreateWADEx('TEXTURE_PLAYER_REDFLAG_D', GameWAD+':TEXTURES\FLAGHUD_RD'); - g_Texture_CreateWADEx('TEXTURE_PLAYER_BLUEFLAG', GameWAD+':TEXTURES\FLAGHUD_BB'); - g_Texture_CreateWADEx('TEXTURE_PLAYER_BLUEFLAG_S', GameWAD+':TEXTURES\FLAGHUD_BS'); - g_Texture_CreateWADEx('TEXTURE_PLAYER_BLUEFLAG_D', GameWAD+':TEXTURES\FLAGHUD_BD'); + g_Texture_CreateWADEx('TEXTURE_PLAYER_REDFLAG', GameWAD+':TEXTURES\FLAGHUD_RB', GameWAD+':TEXTURES\FLAGHUD_R_BASE'); + g_Texture_CreateWADEx('TEXTURE_PLAYER_REDFLAG_S', GameWAD+':TEXTURES\FLAGHUD_RS', GameWAD+':TEXTURES\FLAGHUD_R_STOLEN'); + g_Texture_CreateWADEx('TEXTURE_PLAYER_REDFLAG_D', GameWAD+':TEXTURES\FLAGHUD_RD', GameWAD+':TEXTURES\FLAGHUD_R_DROP'); + g_Texture_CreateWADEx('TEXTURE_PLAYER_BLUEFLAG', GameWAD+':TEXTURES\FLAGHUD_BB', GameWAD+':TEXTURES\FLAGHUD_B_BASE'); + g_Texture_CreateWADEx('TEXTURE_PLAYER_BLUEFLAG_S', GameWAD+':TEXTURES\FLAGHUD_BS', GameWAD+':TEXTURES\FLAGHUD_B_STOLEN'); + g_Texture_CreateWADEx('TEXTURE_PLAYER_BLUEFLAG_D', GameWAD+':TEXTURES\FLAGHUD_BD', GameWAD+':TEXTURES\FLAGHUD_B_DROP'); g_Texture_CreateWADEx('TEXTURE_PLAYER_TALKBUBBLE', GameWAD+':TEXTURES\TALKBUBBLE'); g_Texture_CreateWADEx('TEXTURE_PLAYER_INVULPENTA', GameWAD+':TEXTURES\PENTA'); g_Frames_CreateWAD(nil, 'FRAMES_TELEPORT', GameWAD+':TEXTURES\TELEPORT', 64, 64, 10, False); diff --git a/src/game/g_textures.pas b/src/game/g_textures.pas index 0209800..af3b29f 100644 --- a/src/game/g_textures.pas +++ b/src/game/g_textures.pas @@ -84,7 +84,7 @@ Type function g_Texture_CreateWAD(var ID: DWORD; Resource: String): Boolean; function g_Texture_CreateFile(var ID: DWORD; FileName: String): Boolean; -function g_Texture_CreateWADEx(TextureName: ShortString; Resource: String): Boolean; +function g_Texture_CreateWADEx(TextureName: ShortString; Resource: String; altrsrc: AnsiString=''): Boolean; function g_Texture_CreateFileEx(TextureName: ShortString; FileName: String): Boolean; function g_Texture_Get(TextureName: ShortString; var ID: DWORD): Boolean; procedure g_Texture_Delete(TextureName: ShortString); @@ -200,7 +200,7 @@ begin end; end; -function g_Texture_CreateWADEx(TextureName: ShortString; Resource: String): Boolean; +function texture_CreateWADExInternal (TextureName: ShortString; Resource: String; showmsg: Boolean): Boolean; var WAD: TWADFile; FileName: String; @@ -217,25 +217,39 @@ begin if WAD.GetResource(g_ExtractFilePathName(Resource), TextureData, ResourceLength) then begin - Result := e_CreateTextureMem(TextureData, ResourceLength, TexturesArray[find_id].ID); - if Result then + result := e_CreateTextureMem(TextureData, ResourceLength, TexturesArray[find_id].ID); + if result then begin - e_GetTextureSize(TexturesArray[find_id].ID, @TexturesArray[find_id].Width, - @TexturesArray[find_id].Height); + e_GetTextureSize(TexturesArray[find_id].ID, @TexturesArray[find_id].Width, @TexturesArray[find_id].Height); TexturesArray[find_id].Name := LowerCase(TextureName); end else + begin FreeMem(TextureData); + end; end else begin - e_WriteLog(Format('Error loading texture %s', [Resource]), MSG_WARNING); + if showmsg then + begin + e_WriteLog(Format('Error loading texture %s', [Resource]), MSG_WARNING); + end; //e_WriteLog(Format('WAD Reader error: %s', [WAD.GetLastErrorStr]), MSG_WARNING); - Result := False; + result := false; end; WAD.Free(); end; +function g_Texture_CreateWADEx(TextureName: ShortString; Resource: String; altrsrc: AnsiString=''): Boolean; +begin + if (Length(altrsrc) > 0) then + begin + result := texture_CreateWADExInternal(TextureName, altrsrc, false); + if result then exit; + end; + result := texture_CreateWADExInternal(TextureName, Resource, true); +end; + function g_Texture_CreateFileEx(TextureName: ShortString; FileName: String): Boolean; var find_id: DWORD;