DEADSOFTWARE

added some alternative texture names ==> simple zipping "game.wad" from resource...
authorKetmar Dark <ketmar@ketmar.no-ip.org>
Thu, 31 Aug 2017 00:30:39 +0000 (03:30 +0300)
committerKetmar Dark <ketmar@ketmar.no-ip.org>
Thu, 31 Aug 2017 00:31:17 +0000 (03:31 +0300)
src/game/g_game.pas
src/game/g_textures.pas

index 66a589b316a7f447f4eda273418a3a4c08b1cdec..a22912b8a896018200aa87ede17ac202d8644b3d 100644 (file)
@@ -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);
index 02098004a6432c4d64385e6d6f208c1380e2a569..af3b29ff8e464f1fe8467a2b804ea384bd8d0ba5 100644 (file)
@@ -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;