DEADSOFTWARE

gl: bfg offset
[d2df-sdl.git] / src / game / g_weapons.pas
index 2b38de319c037678141d76fbbd67259ceafaa92c..96c46c8d4fc0cad7a2d0e36eeaf88b431addbaf9 100644 (file)
@@ -20,7 +20,7 @@ interface
 
 uses
   SysUtils, Classes, mempool,
-  g_animations, g_basic, g_phys, xprofiler;
+  g_basic, g_phys, xprofiler;
 
 
 type
@@ -30,7 +30,7 @@ type
     SpawnerUID: Word;
     Triggers: DWArray;
     Obj: TObj;
-    Animation: TAnimState;
+    time: LongWord;
     Timeout: DWORD;
     Stopped: Byte;
 
@@ -124,7 +124,7 @@ implementation
     Math, g_map, g_player, g_sound, g_panel,
     g_console, g_options, g_game,
     g_triggers, MAPDEF, e_log, g_monsters, g_saveload,
-    g_language, g_netmsg, g_grid,
+    g_language, g_netmsg, g_grid, g_window,
     geom, binheap, hashtable, utils, xstreams
   ;
 
@@ -589,6 +589,8 @@ begin
       SetLength(Shots, find_id + 64)
   end;
 
+  shots[find_id].time := gTime;
+
   case ShotType of
     WEAPON_ROCKETLAUNCHER:
     begin
@@ -601,7 +603,6 @@ begin
 
         Triggers := nil;
         ShotType := WEAPON_ROCKETLAUNCHER;
-        Animation.Invalidate;
       end;
     end;
 
@@ -616,7 +617,6 @@ begin
 
         Triggers := nil;
         ShotType := WEAPON_PLASMA;
-        Animation := TAnimState.Create(True, 5, 2); // !!! put values into table
       end;
     end;
 
@@ -631,7 +631,6 @@ begin
 
         Triggers := nil;
         ShotType := WEAPON_BFG;
-        Animation := TAnimState.Create(True, 6, 2); // !!! put values into table
       end;
     end;
 
@@ -646,8 +645,6 @@ begin
 
         Triggers := nil;
         ShotType := WEAPON_FLAMETHROWER;
-        Animation.Invalidate;
-        // Animation := TAnimState.Create(True, 6, 0); // drawed as gfx
       end;
     end;
 
@@ -662,7 +659,6 @@ begin
 
         Triggers := nil;
         ShotType := WEAPON_IMP_FIRE;
-        Animation := TAnimState.Create(True, 4, 2); // !!! put values into table
       end;
     end;
 
@@ -677,7 +673,6 @@ begin
 
         Triggers := nil;
         ShotType := WEAPON_CACO_FIRE;
-        Animation := TAnimState.Create(True, 4, 2); // !!! put values into table
       end;
     end;
 
@@ -692,7 +687,6 @@ begin
 
         Triggers := nil;
         ShotType := WEAPON_MANCUB_FIRE;
-        Animation := TAnimState.Create(True, 4, 2); // !!! put values into table
       end;
     end;
 
@@ -707,7 +701,6 @@ begin
 
         Triggers := nil;
         ShotType := WEAPON_BARON_FIRE;
-        Animation := TAnimState.Create(True, 4, 2); // !!! put values into table
       end;
     end;
 
@@ -722,7 +715,6 @@ begin
 
         Triggers := nil;
         ShotType := WEAPON_BSP_FIRE;
-        Animation := TAnimState.Create(True, 4, 2); // !!! put values into table
       end;
     end;
 
@@ -738,7 +730,6 @@ begin
         Triggers := nil;
         ShotType := WEAPON_SKEL_FIRE;
         target := TargetUID;
-        Animation := TAnimState.Create(True, 5, 2); // !!! put values into table
       end;
     end;
   end;
@@ -1121,6 +1112,7 @@ end;
 procedure g_Weapon_LoadData();
 begin
   e_WriteLog('Loading weapons data...', TMsgType.Notify);
+  g_Game_SetLoadingText(_lc[I_LOAD_WEAPONS_DATA], 0, False);
 
   g_Sound_CreateWADEx('SOUND_WEAPON_HITPUNCH', GameWAD+':SOUNDS\HITPUNCH');
   g_Sound_CreateWADEx('SOUND_WEAPON_MISSPUNCH', GameWAD+':SOUNDS\MISSPUNCH');
@@ -1654,8 +1646,8 @@ begin
     ShotType := WEAPON_ROCKETLAUNCHER;
     throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 12);
 
-    Animation.Invalidate;
     triggers := nil;
+    time := gTime;
   end;
 
   Shots[find_id].SpawnerUID := SpawnerUID;
@@ -1694,7 +1686,7 @@ begin
 
     triggers := nil;
     target := TargetUID;
-    Animation := TAnimState.Create(True, 5, 2); // !!! put values into table
+    time := gTime;
   end;
 
   Shots[find_id].SpawnerUID := SpawnerUID;
@@ -1735,7 +1727,7 @@ begin
     throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 16);
 
     triggers := nil;
-    Animation := TAnimState.Create(True, 5, 2); // !!! put values into table
+    time := gTime;
   end;
 
   Shots[find_id].SpawnerUID := SpawnerUID;
@@ -1776,7 +1768,7 @@ begin
     throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 16);
 
     triggers := nil;
-    Animation.Invalidate;
+    time := gTime;
   end;
 
   Shots[find_id].SpawnerUID := SpawnerUID;
@@ -1817,7 +1809,7 @@ begin
     throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 16);
 
     triggers := nil;
-    Animation := TAnimState.Create(True, 4, 2); // !!! put values into table
+    time := gTime;
   end;
 
   Shots[find_id].SpawnerUID := SpawnerUID;
@@ -1858,7 +1850,7 @@ begin
     throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 16);
 
     triggers := nil;
-    Animation := TAnimState.Create(True, 4, 2); // !!! put values into table
+    time := gTime;
   end;
 
   Shots[find_id].SpawnerUID := SpawnerUID;
@@ -1899,7 +1891,7 @@ begin
     throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 16);
 
     triggers := nil;
-    Animation := TAnimState.Create(True, 4, 2); // !!! put values into table
+    time := gTime;
   end;
 
   Shots[find_id].SpawnerUID := SpawnerUID;
@@ -1940,8 +1932,7 @@ begin
     throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 16);
 
     triggers := nil;
-
-    Animation := TAnimState.Create(True, 4, 2); // !!! put values into table
+    time := gTime;
   end;
 
   Shots[find_id].SpawnerUID := SpawnerUID;
@@ -1982,8 +1973,7 @@ begin
     throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 16);
 
     triggers := nil;
-
-    Animation := TAnimState.Create(True, 4, 2); // !!! put values into table
+    time := gTime;
   end;
 
   Shots[find_id].SpawnerUID := SpawnerUID;
@@ -2024,7 +2014,7 @@ begin
     throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 16);
 
     triggers := nil;
-    Animation := TAnimState.Create(True, 6, 2); // !!! put values into table
+    time := gTime;
   end;
 
   Shots[find_id].SpawnerUID := SpawnerUID;
@@ -2183,10 +2173,6 @@ begin
           end;
       end;
 
-    // Àíèìàöèÿ ñíàðÿäà:
-      if Animation.IsValid() then
-        Animation.Update();
-
     // Äâèæåíèå:
       spl := (ShotType <> WEAPON_PLASMA) and
              (ShotType <> WEAPON_BFG) and
@@ -2208,7 +2194,7 @@ begin
       begin
         // Íà êëèåíòå ñêîðåå âñåãî è òàê óæå âûïàë.
         ShotType := 0;
-        Animation.Invalidate();
+        time := 0;
         Continue;
       end;
 
@@ -2482,7 +2468,7 @@ begin
       begin
         if gGameSettings.GameType = GT_SERVER then
           MH_SEND_DeleteShot(i, Obj.X, Obj.Y, Loud);
-        Animation.Invalidate;
+        time := 0;
       end
       else if (ShotType <> WEAPON_FLAMETHROWER) and ((oldvx <> Obj.Vel.X) or (oldvy <> Obj.Vel.Y)) then
         if gGameSettings.GameType = GT_SERVER then
@@ -2588,42 +2574,7 @@ begin
     // Êîñòûëèíà åáàíàÿ
     Shots[i].Stopped := utils.readByte(st);
 
-    // Óñòàíîâêà òåêñòóðû èëè àíèìàöèè
-    Shots[i].Animation.Invalidate;
-
-    case Shots[i].ShotType of
-      WEAPON_ROCKETLAUNCHER, WEAPON_SKEL_FIRE:
-        begin
-        end;
-      WEAPON_PLASMA:
-        begin
-          Shots[i].Animation := TAnimState.Create(True, 5, 2); // !!! put values into table
-        end;
-      WEAPON_BFG:
-        begin
-          Shots[i].Animation := TAnimState.Create(True, 6, 2); // !!! put values into table
-        end;
-      WEAPON_IMP_FIRE:
-        begin
-          Shots[i].Animation := TAnimState.Create(True, 4, 2); // !!! put values into table
-        end;
-      WEAPON_BSP_FIRE:
-        begin
-          Shots[i].Animation := TAnimState.Create(True, 4, 2); // !!! put values into table
-        end;
-      WEAPON_CACO_FIRE:
-        begin
-          Shots[i].Animation := TAnimState.Create(True, 4, 2); // !!! put values into table
-        end;
-      WEAPON_BARON_FIRE:
-        begin
-          Shots[i].Animation := TAnimState.Create(True, 4, 2); // !!! put values into table
-        end;
-      WEAPON_MANCUB_FIRE:
-        begin
-          Shots[i].Animation := TAnimState.Create(True, 4, 2); // !!! put values into table
-        end;
-    end;
+    Shots[i].time := gTime; // TODO save time?
   end;
 end;
 
@@ -2708,7 +2659,6 @@ begin
     end; // case ShotType of...
 
     ShotType := 0;
-    Animation.Invalidate;
   end;
 end;