DEADSOFTWARE

added license info
[d2df-sdl.git] / src / game / g_menu.pas
index 46d6dad134bf6b4010b3e9974797dca04253adf0..16c2d0123a59fa48fcf595691908552b4a368d10 100644 (file)
@@ -1,3 +1,19 @@
+(* Copyright (C)  DooM 2D:Forever Developers
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *)
+{$MODE DELPHI}
 unit g_menu;
 
 interface
@@ -29,7 +45,7 @@ uses
   g_gui, g_textures, e_graphics, g_main, g_window, g_game, g_map,
   g_basic, g_console, g_sound, g_gfx, g_player, g_options,
   e_log, SysUtils, CONFIG, g_playermodel, DateUtils,
-  MAPSTRUCT, WADEDITOR, Math, WADSTRUCT, g_saveload,
+  MAPSTRUCT, wadreader, Math, g_saveload,
   e_textures, GL, GLExt, g_language,
   g_net, g_netmsg, g_netmaster, g_items, e_input;
 
@@ -725,7 +741,7 @@ begin
 
     if a.pic <> '' then
     begin
-      g_ProcessResourceStr(a.pic, @fn, nil, nil);
+      fn := g_ExtractWadName(a.pic);
       if fn = '' then
         TGUIImage(win.GetControl('mpWADImage')).SetImage(wad+a.pic)
       else
@@ -774,16 +790,16 @@ var
   cwdt, chgt: Byte;
   spc: ShortInt;
   ID: DWORD;
-  wad: TWADEditor_1;
+  wad: TWADFile;
   cfgdata: Pointer;
   cfglen: Integer;
   config: TConfig;
 begin
   cfglen := 0;
 
-  wad := TWADEditor_1.Create;
+  wad := TWADFile.Create;
   if wad.ReadFile(GameWAD) then
-    wad.GetResource('FONTS', cfgres, cfgdata, cfglen);
+    wad.GetResource('FONTS/'+cfgres, cfgdata, cfglen);
   wad.Free();
 
   if cfglen <> 0 then
@@ -809,7 +825,7 @@ var
   cwdt, chgt: Byte;
   spc: ShortInt;
   CharID: DWORD;
-  wad: TWADEditor_1;
+  wad: TWADFile;
   cfgdata, fntdata: Pointer;
   cfglen, fntlen: Integer;
   config: TConfig;
@@ -819,11 +835,11 @@ begin
   cfglen := 0;
   fntlen := 0;
 
-  wad := TWADEditor_1.Create;
+  wad := TWADFile.Create;
   if wad.ReadFile(GameWAD) then
   begin
-    wad.GetResource('FONTS', txtres, cfgdata, cfglen);
-    wad.GetResource('FONTS', fntres, fntdata, fntlen);
+    wad.GetResource('FONTS/'+txtres, cfgdata, cfglen);
+    wad.GetResource('FONTS/'+fntres, fntdata, fntlen);
   end;
   wad.Free();
 
@@ -841,7 +857,7 @@ begin
       chrwidth := config.ReadInt(IntToStr(a), 'Width', 0);
       if chrwidth = 0 then Continue;
 
-      if e_CreateTextureMemEx(fntdata, CharID, cwdt*(a mod 16), chgt*(a div 16),
+      if e_CreateTextureMemEx(fntdata, fntlen, CharID, cwdt*(a mod 16), chgt*(a div 16),
                               cwdt, chgt) then
         e_CharFont_AddChar(FontID, CharID, Chr(a), chrwidth);
     end;