DEADSOFTWARE

Add flamethrower weapon, item and ammo
authorbinarymaster <x86corez@gmail.com>
Wed, 9 Aug 2017 16:38:53 +0000 (19:38 +0300)
committerbinarymaster <x86corez@gmail.com>
Wed, 9 Aug 2017 16:38:53 +0000 (19:38 +0300)
src/game/g_game.pas
src/game/g_items.pas
src/game/g_net.pas
src/game/g_netmsg.pas
src/game/g_player.pas
src/game/g_playermodel.pas
src/game/g_weapons.pas
src/shared/MAPDEF.pas

index 1744fc524f0bb317916b0e5163c12dcc71b37292..811148cf456bfb8fb4a54703ca79ebf0ad567361 100644 (file)
@@ -4876,6 +4876,9 @@ begin
       if cmd = 'superchaingun' then begin plr.GiveItem(ITEM_WEAPON_SUPERPULEMET); g_Console_Add('player got a superchaingun'); continue; end;
       if cmd = 'superchaingunzz' then begin plr.GiveItem(ITEM_WEAPON_SUPERPULEMET); plr.GiveItem(ITEM_AMMO_BULLETS_BOX); g_Console_Add('player got a superchaingun'); continue; end;
 
+      if (cmd = 'flamer') or (cmd = 'flamethrower') or (cmd = 'ft') then begin plr.GiveItem(ITEM_WEAPON_FLAMETHROWER); g_Console_Add('player got a flame thrower'); continue; end;
+      if (cmd = 'flamerzz') or (cmd = 'flamethrowerzz') or (cmd = 'ftzz') then begin plr.GiveItem(ITEM_WEAPON_FLAMETHROWER); plr.GiveItem(ITEM_AMMO_FUELCAN); g_Console_Add('player got a flame thrower'); continue; end;
+
       if cmd = 'chainsaw' then begin plr.GiveItem(ITEM_WEAPON_SAW); g_Console_Add('player got a chainsaw'); continue; end;
 
       if cmd = 'ammo' then
@@ -4884,6 +4887,7 @@ begin
         plr.GiveItem(ITEM_AMMO_BULLETS_BOX);
         plr.GiveItem(ITEM_AMMO_CELL_BIG);
         plr.GiveItem(ITEM_AMMO_ROCKET_BOX);
+        plr.GiveItem(ITEM_AMMO_FUELCAN);
         g_Console_Add('player got some ammo');
         continue;
       end;
@@ -4900,6 +4904,8 @@ begin
       if cmd = 'rocket' then begin plr.GiveItem(ITEM_AMMO_ROCKET); g_Console_Add('player got a rocket'); continue; end;
       if cmd = 'rocketbox' then begin plr.GiveItem(ITEM_AMMO_ROCKET_BOX); g_Console_Add('player got some rockets'); continue; end;
 
+      if (cmd = 'fuel') or (cmd = 'fuelcan') then begin plr.GiveItem(ITEM_AMMO_FUELCAN); g_Console_Add('player got fuel canister'); continue; end;
+
       if cmd = 'weapons' then
       begin
         plr.GiveItem(ITEM_WEAPON_SHOTGUN1);
index f48f7932de0997ccfe5338bdfcf5f2f076189836..d94b996e05b7436b9b8d487f3e181a81d508ccba 100644 (file)
@@ -19,7 +19,7 @@ unit g_items;
 interface
 
 uses
-  g_textures, g_phys, g_saveload, BinEditor;
+  g_textures, g_phys, g_saveload, BinEditor, MAPDEF;
 
 Type
   TItem = record
@@ -50,7 +50,7 @@ procedure g_Items_LoadState(var Mem: TBinMemoryReader);
 
 var
   gItems: Array of TItem = nil;
-  gItemsTexturesID: Array [1..35] of DWORD;
+  gItemsTexturesID: Array [1..ITEM_MAX] of DWORD;
   gMaxDist: Integer = 1;
   ITEM_RESPAWNTIME: Integer = 60 * 36;
 
@@ -59,7 +59,7 @@ implementation
 uses
   g_basic, e_graphics, g_sound, g_main, g_gfx, g_map,
   Math, g_game, g_triggers, g_console, SysUtils, g_player, g_net, g_netmsg,
-  MAPDEF, e_log;
+  e_log;
 
 const
   ITEM_SIGNATURE = $4D455449; // 'ITEM'
@@ -100,7 +100,9 @@ const
      ((14), (18)), // BOTTLE
      ((16), (15)), // HELMET
      ((32), (24)), // JETPACK
-     ((25), (25))); // INVIS
+     ((25), (25)), // INVIS
+     ((53), (20)), // WEAPON_FLAMETHROWER
+     ((13), (20))); // AMMO_FUELCAN
 
 procedure InitTextures();
 begin
@@ -117,6 +119,7 @@ begin
   g_Texture_Get('ITEM_WEAPON_PLASMA',    gItemsTexturesID[ITEM_WEAPON_PLASMA]);
   g_Texture_Get('ITEM_WEAPON_BFG',       gItemsTexturesID[ITEM_WEAPON_BFG]);
   g_Texture_Get('ITEM_WEAPON_SUPERPULEMET', gItemsTexturesID[ITEM_WEAPON_SUPERPULEMET]);
+  g_Texture_Get('ITEM_WEAPON_FLAMETHROWER', gItemsTexturesID[ITEM_WEAPON_FLAMETHROWER]);
   g_Texture_Get('ITEM_AMMO_BULLETS',     gItemsTexturesID[ITEM_AMMO_BULLETS]);
   g_Texture_Get('ITEM_AMMO_BULLETS_BOX', gItemsTexturesID[ITEM_AMMO_BULLETS_BOX]);
   g_Texture_Get('ITEM_AMMO_SHELLS',      gItemsTexturesID[ITEM_AMMO_SHELLS]);
@@ -125,6 +128,7 @@ begin
   g_Texture_Get('ITEM_AMMO_ROCKET_BOX',  gItemsTexturesID[ITEM_AMMO_ROCKET_BOX]);
   g_Texture_Get('ITEM_AMMO_CELL',        gItemsTexturesID[ITEM_AMMO_CELL]);
   g_Texture_Get('ITEM_AMMO_CELL_BIG',    gItemsTexturesID[ITEM_AMMO_CELL_BIG]);
+  g_Texture_Get('ITEM_AMMO_FUELCAN',     gItemsTexturesID[ITEM_AMMO_FUELCAN]);
   g_Texture_Get('ITEM_AMMO_BACKPACK',    gItemsTexturesID[ITEM_AMMO_BACKPACK]);
   g_Texture_Get('ITEM_KEY_RED',          gItemsTexturesID[ITEM_KEY_RED]);
   g_Texture_Get('ITEM_KEY_GREEN',        gItemsTexturesID[ITEM_KEY_GREEN]);
@@ -167,6 +171,7 @@ begin
   g_Texture_CreateWADEx('ITEM_WEAPON_PLASMA', GameWAD+':TEXTURES\PGUN');
   g_Texture_CreateWADEx('ITEM_WEAPON_BFG', GameWAD+':TEXTURES\BFG');
   g_Texture_CreateWADEx('ITEM_WEAPON_SUPERPULEMET', GameWAD+':TEXTURES\SPULEMET');
+  g_Texture_CreateWADEx('ITEM_WEAPON_FLAMETHROWER', GameWAD+':TEXTURES\FLAMETHROWER');
   g_Texture_CreateWADEx('ITEM_AMMO_BULLETS', GameWAD+':TEXTURES\CLIP');
   g_Texture_CreateWADEx('ITEM_AMMO_BULLETS_BOX', GameWAD+':TEXTURES\AMMO');
   g_Texture_CreateWADEx('ITEM_AMMO_SHELLS', GameWAD+':TEXTURES\SHELL1');
@@ -175,6 +180,7 @@ begin
   g_Texture_CreateWADEx('ITEM_AMMO_ROCKET_BOX', GameWAD+':TEXTURES\ROCKETS');
   g_Texture_CreateWADEx('ITEM_AMMO_CELL', GameWAD+':TEXTURES\CELL');
   g_Texture_CreateWADEx('ITEM_AMMO_CELL_BIG', GameWAD+':TEXTURES\CELL2');
+  g_Texture_CreateWADEx('ITEM_AMMO_FUELCAN', GameWAD+':TEXTURES\FUELCAN');
   g_Texture_CreateWADEx('ITEM_AMMO_BACKPACK', GameWAD+':TEXTURES\BPACK');
   g_Texture_CreateWADEx('ITEM_KEY_RED', GameWAD+':TEXTURES\KEYR');
   g_Texture_CreateWADEx('ITEM_KEY_GREEN', GameWAD+':TEXTURES\KEYG');
@@ -221,6 +227,7 @@ begin
   g_Texture_Delete('ITEM_WEAPON_PLASMA');
   g_Texture_Delete('ITEM_WEAPON_BFG');
   g_Texture_Delete('ITEM_WEAPON_SUPERPULEMET');
+  g_Texture_Delete('ITEM_WEAPON_FLAMETHROWER');
   g_Texture_Delete('ITEM_AMMO_BULLETS');
   g_Texture_Delete('ITEM_AMMO_BULLETS_BOX');
   g_Texture_Delete('ITEM_AMMO_SHELLS');
@@ -229,6 +236,7 @@ begin
   g_Texture_Delete('ITEM_AMMO_ROCKET_BOX');
   g_Texture_Delete('ITEM_AMMO_CELL');
   g_Texture_Delete('ITEM_AMMO_CELL_BIG');
+  g_Texture_Delete('ITEM_AMMO_FUELCAN');
   g_Texture_Delete('ITEM_AMMO_BACKPACK');
   g_Texture_Delete('ITEM_KEY_RED');
   g_Texture_Delete('ITEM_KEY_GREEN');
@@ -446,7 +454,8 @@ begin
                     else
                       if ItemType in [ITEM_WEAPON_SAW, ITEM_WEAPON_PISTOL, ITEM_WEAPON_SHOTGUN1, ITEM_WEAPON_SHOTGUN2,
                                       ITEM_WEAPON_CHAINGUN, ITEM_WEAPON_ROCKETLAUNCHER, ITEM_WEAPON_PLASMA,
-                                      ITEM_WEAPON_BFG, ITEM_WEAPON_SUPERPULEMET, ITEM_AMMO_BACKPACK] then
+                                      ITEM_WEAPON_BFG, ITEM_WEAPON_SUPERPULEMET, ITEM_WEAPON_FLAMETHROWER,
+                                      ITEM_AMMO_BACKPACK] then
                         g_Sound_PlayExAt('SOUND_ITEM_GETWEAPON',
                           gPlayers[j].Obj.X, gPlayers[j].Obj.Y)
                       else
@@ -462,7 +471,7 @@ begin
                     else
                       if ItemType in [ITEM_WEAPON_SAW, ITEM_WEAPON_PISTOL, ITEM_WEAPON_SHOTGUN1, ITEM_WEAPON_SHOTGUN2,
                                       ITEM_WEAPON_CHAINGUN, ITEM_WEAPON_ROCKETLAUNCHER, ITEM_WEAPON_PLASMA,
-                                      ITEM_WEAPON_BFG, ITEM_WEAPON_SUPERPULEMET] then
+                                      ITEM_WEAPON_BFG, ITEM_WEAPON_SUPERPULEMET, ITEM_WEAPON_FLAMETHROWER] then
                         g_Sound_PlayExAt('SOUND_ITEM_GETWEAPON',
                           gPlayers[j].Obj.X, gPlayers[j].Obj.Y)
                       else
index e935fc98eb68556f60e92a4be559b0419abb86ce..0ea107b875028752a826f3043227275af8a834c5 100644 (file)
@@ -22,7 +22,7 @@ uses
   e_log, e_fixedbuffer, ENet, Classes;
 
 const
-  NET_PROTOCOL_VER = 169;
+  NET_PROTOCOL_VER = 170;
 
   NET_MAXCLIENTS = 24;
   NET_CHANS = 11;
index 9a226cf78438fa955578bb58e1cf8415a1375827..f8ec00a801c09757c9ed897566a53ff116beba7e 100644 (file)
@@ -2385,7 +2385,8 @@ begin
         else
           if gItems[ID].ItemType in [ITEM_WEAPON_SAW, ITEM_WEAPON_PISTOL, ITEM_WEAPON_SHOTGUN1, ITEM_WEAPON_SHOTGUN2,
                                      ITEM_WEAPON_CHAINGUN, ITEM_WEAPON_ROCKETLAUNCHER, ITEM_WEAPON_PLASMA,
-                                     ITEM_WEAPON_BFG, ITEM_WEAPON_SUPERPULEMET, ITEM_AMMO_BACKPACK] then
+                                     ITEM_WEAPON_BFG, ITEM_WEAPON_SUPERPULEMET, ITEM_WEAPON_FLAMETHROWER,
+                                     ITEM_AMMO_BACKPACK] then
             g_Sound_PlayExAt('SOUND_ITEM_GETWEAPON',
               gItems[ID].Obj.X, gItems[ID].Obj.Y)
             else
@@ -2401,7 +2402,7 @@ begin
       else
         if gItems[ID].ItemType in [ITEM_WEAPON_SAW, ITEM_WEAPON_PISTOL, ITEM_WEAPON_SHOTGUN1, ITEM_WEAPON_SHOTGUN2,
                                    ITEM_WEAPON_CHAINGUN, ITEM_WEAPON_ROCKETLAUNCHER, ITEM_WEAPON_PLASMA,
-                                   ITEM_WEAPON_BFG, ITEM_WEAPON_SUPERPULEMET] then
+                                   ITEM_WEAPON_BFG, ITEM_WEAPON_SUPERPULEMET, ITEM_WEAPON_FLAMETHROWER] then
           g_Sound_PlayExAt('SOUND_ITEM_GETWEAPON',
             gItems[ID].Obj.X, gItems[ID].Obj.Y)
         else
index 5f4692fc081d81b7aff0581eba151c96e73328bf..d03247cdc5e4e3f2505078aa28ccd5f165f70f55 100644 (file)
@@ -50,11 +50,12 @@ const
   A_SHELLS          = 1;
   A_ROCKETS         = 2;
   A_CELLS           = 3;
-  A_HIGH            = 3;
+  A_FUEL            = 4;
+  A_HIGH            = 4;
 
   AmmoLimits: Array [0..1] of Array [A_BULLETS..A_HIGH] of Word =
-  ((200,  50,  50, 300),
-   (400, 100, 100, 600));
+  ((200,  50,  50, 300, 100),
+   (400, 100, 100, 600, 200));
 
   K_SIMPLEKILL      = 0;
   K_HARDKILL        = 1;
@@ -547,27 +548,30 @@ const
                                                    (R:0; G:0; B:255));
   DIFFICULT_EASY: TDifficult = (DiagFire: 32; InvisFire: 32; DiagPrecision: 32;
                                 FlyPrecision: 32; Cover: 32; CloseJump: 32;
-                                WeaponPrior:(0,0,0,0,0,0,0,0,0,0); CloseWeaponPrior:(0,0,0,0,0,0,0,0,0,0));
+                                WeaponPrior:(0,0,0,0,0,0,0,0,0,0,0); CloseWeaponPrior:(0,0,0,0,0,0,0,0,0,0,0));
   DIFFICULT_MEDIUM: TDifficult = (DiagFire: 127; InvisFire: 127; DiagPrecision: 127;
                                   FlyPrecision: 127; Cover: 127; CloseJump: 127;
-                                WeaponPrior:(0,0,0,0,0,0,0,0,0,0); CloseWeaponPrior:(0,0,0,0,0,0,0,0,0,0));
+                                WeaponPrior:(0,0,0,0,0,0,0,0,0,0,0); CloseWeaponPrior:(0,0,0,0,0,0,0,0,0,0,0));
   DIFFICULT_HARD: TDifficult = (DiagFire: 255; InvisFire: 255; DiagPrecision: 255;
                                 FlyPrecision: 255; Cover: 255; CloseJump: 255;
-                                WeaponPrior:(0,0,0,0,0,0,0,0,0,0); CloseWeaponPrior:(0,0,0,0,0,0,0,0,0,0));
+                                WeaponPrior:(0,0,0,0,0,0,0,0,0,0,0); CloseWeaponPrior:(0,0,0,0,0,0,0,0,0,0,0));
   WEAPON_PRIOR1: Array [WP_FIRST..WP_LAST] of Byte =
-                                (WEAPON_SUPERPULEMET, WEAPON_SHOTGUN2, WEAPON_SHOTGUN1,
+                                (WEAPON_FLAMETHROWER, WEAPON_SUPERPULEMET,
+                                 WEAPON_SHOTGUN2, WEAPON_SHOTGUN1,
                                  WEAPON_CHAINGUN, WEAPON_PLASMA, WEAPON_ROCKETLAUNCHER,
                                  WEAPON_BFG, WEAPON_PISTOL, WEAPON_SAW, WEAPON_KASTET);
   WEAPON_PRIOR2: Array [WP_FIRST..WP_LAST] of Byte =
-                                (WEAPON_SUPERPULEMET, WEAPON_BFG, WEAPON_ROCKETLAUNCHER,
+                                (WEAPON_FLAMETHROWER, WEAPON_SUPERPULEMET,
+                                 WEAPON_BFG, WEAPON_ROCKETLAUNCHER,
                                  WEAPON_SHOTGUN2, WEAPON_PLASMA, WEAPON_SHOTGUN1,
                                  WEAPON_CHAINGUN, WEAPON_PISTOL, WEAPON_SAW, WEAPON_KASTET);
   //WEAPON_PRIOR3: Array [WP_FIRST..WP_LAST] of Byte =
-  //                              (WEAPON_SUPERPULEMET, WEAPON_BFG, WEAPON_PLASMA,
-  //                               WEAPON_SHOTGUN2, WEAPON_CHAINGUN, WEAPON_SHOTGUN1,
-  //                               WEAPON_SAW, WEAPON_ROCKETLAUNCHER, WEAPON_PISTOL, WEAPON_KASTET);
+  //                              (WEAPON_FLAMETHROWER, WEAPON_SUPERPULEMET,
+  //                               WEAPON_BFG, WEAPON_PLASMA, WEAPON_SHOTGUN2,
+  //                               WEAPON_CHAINGUN, WEAPON_SHOTGUN1, WEAPON_SAW,
+  //                               WEAPON_ROCKETLAUNCHER, WEAPON_PISTOL, WEAPON_KASTET);
   WEAPON_RELOAD: Array [WP_FIRST..WP_LAST] of Byte =
-                                (5, 2, 6, 18, 36, 2, 12, 2, 14, 2);
+                                (5, 2, 6, 18, 36, 2, 12, 2, 14, 2, 0);
 
   PLAYER_SIGNATURE = $52594C50; // 'PLYR'
   CORPSE_SIGNATURE = $50524F43; // 'CORP'
@@ -2492,6 +2496,7 @@ begin
     WEAPON_ROCKETLAUNCHER: ID := gItemsTexturesID[ITEM_WEAPON_ROCKETLAUNCHER];
     WEAPON_PLASMA: ID := gItemsTexturesID[ITEM_WEAPON_PLASMA];
     WEAPON_BFG: ID := gItemsTexturesID[ITEM_WEAPON_BFG];
+    WEAPON_FLAMETHROWER: ID := gItemsTexturesID[ITEM_WEAPON_FLAMETHROWER];
   end;
 
   e_CharFont_GetSize(gMenuFont, s, tw, th);
@@ -2799,6 +2804,16 @@ begin
         g_Player_CreateShell(GameX+PLAYER_RECT_CX, GameY+PLAYER_RECT_CX,
                              GameVelX, GameVelY-2, SHELL_SHELL);
       end;
+
+    WEAPON_FLAMETHROWER:
+      if FAmmo[A_FUEL] > 0 then
+      begin
+        FReloading[FCurrWeap] := WEAPON_RELOAD[FCurrWeap];
+        Dec(FAmmo[A_FUEL]);
+        FFireAngle := FAngle;
+        f := True;
+        DidFire := True;
+      end;
   end;
 
   if g_Game_IsNet then
@@ -2829,6 +2844,7 @@ begin
     WEAPON_SHOTGUN1, WEAPON_SHOTGUN2, WEAPON_SUPERPULEMET: Result := FAmmo[A_SHELLS];
     WEAPON_ROCKETLAUNCHER: Result := FAmmo[A_ROCKETS];
     WEAPON_PLASMA, WEAPON_BFG: Result := FAmmo[A_CELLS];
+    WEAPON_FLAMETHROWER: Result := FAmmo[A_FUEL];
     else Result := 0;
   end;
 end;
@@ -3100,6 +3116,7 @@ begin
           WEAPON_PLASMA: i := ITEM_WEAPON_PLASMA;
           WEAPON_BFG: i := ITEM_WEAPON_BFG;
           WEAPON_SUPERPULEMET: i := ITEM_WEAPON_SUPERPULEMET;
+          WEAPON_FLAMETHROWER: i := ITEM_WEAPON_FLAMETHROWER;
           else i := 0;
         end;
 
@@ -3307,6 +3324,7 @@ begin
     WEAPON_PISTOL, WEAPON_CHAINGUN, WEAPON_SUPERPULEMET: result := (FAmmo[A_BULLETS] > 0);
     WEAPON_ROCKETLAUNCHER: result := (FAmmo[A_ROCKETS] > 0);
     WEAPON_PLASMA, WEAPON_BFG: result := (FAmmo[A_CELLS] > 0);
+    WEAPON_FLAMETHROWER: result := (FAmmo[A_FUEL] > 0);
     else result := (weapon < length(FWeapon));
   end;
 end;
@@ -3611,6 +3629,18 @@ begin
         if a and g_Game_IsNet then MH_SEND_Sound(GameX, GameY, 'SOUND_ITEM_GETWEAPON');
       end;
 
+    ITEM_WEAPON_FLAMETHROWER:
+      if (FAmmo[A_FUEL] < FMaxAmmo[A_FUEL]) or not FWeapon[WEAPON_FLAMETHROWER] then
+      begin
+        if a and FWeapon[WEAPON_FLAMETHROWER] then Exit;
+
+        IncMax(FAmmo[A_FUEL], 100, FMaxAmmo[A_FUEL]);
+        FWeapon[WEAPON_FLAMETHROWER] := True;
+        Result := True;
+        if gFlash = 2 then Inc(FPickup, 5);
+        if a and g_Game_IsNet then MH_SEND_Sound(GameX, GameY, 'SOUND_ITEM_GETWEAPON');
+      end;
+
     ITEM_AMMO_BULLETS:
       if FAmmo[A_BULLETS] < FMaxAmmo[A_BULLETS] then
       begin
@@ -3683,17 +3713,28 @@ begin
         if gFlash = 2 then Inc(FPickup, 5);
       end;
 
+    ITEM_AMMO_FUELCAN:
+      if FAmmo[A_FUEL] < FMaxAmmo[A_FUEL] then
+      begin
+        IncMax(FAmmo[A_FUEL], 100, FMaxAmmo[A_FUEL]);
+        Result := True;
+        remove := True;
+        if gFlash = 2 then Inc(FPickup, 5);
+      end;
+
     ITEM_AMMO_BACKPACK:
       if not(R_ITEM_BACKPACK in FRulez) or
             (FAmmo[A_BULLETS] < FMaxAmmo[A_BULLETS]) or
             (FAmmo[A_SHELLS] < FMaxAmmo[A_SHELLS]) or
             (FAmmo[A_ROCKETS] < FMaxAmmo[A_ROCKETS]) or
-            (FAmmo[A_CELLS] < FMaxAmmo[A_CELLS]) then
+            (FAmmo[A_CELLS] < FMaxAmmo[A_CELLS]) or
+            (FMaxAmmo[A_FUEL] < AmmoLimits[1, A_FUEL]) then
       begin
         FMaxAmmo[A_BULLETS] := AmmoLimits[1, A_BULLETS];
         FMaxAmmo[A_SHELLS] := AmmoLimits[1, A_SHELLS];
         FMaxAmmo[A_ROCKETS] := AmmoLimits[1, A_ROCKETS];
         FMaxAmmo[A_CELLS] := AmmoLimits[1, A_CELLS];
+        FMaxAmmo[A_FUEL] := AmmoLimits[1, A_FUEL];
 
         if FAmmo[A_BULLETS] < FMaxAmmo[A_BULLETS] then
           IncMax(FAmmo[A_BULLETS], 10, FMaxAmmo[A_BULLETS]);
@@ -4134,6 +4175,7 @@ begin
     FMaxAmmo[A_SHELLS] := AmmoLimits[0, A_SHELLS];
     FMaxAmmo[A_ROCKETS] := AmmoLimits[0, A_SHELLS];
     FMaxAmmo[A_CELLS] := AmmoLimits[0, A_CELLS];
+    FMaxAmmo[A_FUEL] := AmmoLimits[0, A_FUEL];
 
     if gGameSettings.GameMode in [GM_DM, GM_TDM, GM_CTF] then
       FRulez := [R_KEY_RED, R_KEY_GREEN, R_KEY_BLUE]
@@ -5042,6 +5084,12 @@ begin
       g_Player_CreateShell(GameX+PLAYER_RECT_CX, GameY+PLAYER_RECT_CX,
                              GameVelX, GameVelY-2, SHELL_SHELL);
     end;
+
+    WEAPON_FLAMETHROWER:
+    begin
+      FFireAngle := FAngle;
+      f := True;
+    end;
   end;
 
   if not f then Exit;
@@ -5726,6 +5774,7 @@ begin
     ITEM_WEAPON_PLASMA: FWeapon[WEAPON_PLASMA] := True;
     ITEM_WEAPON_BFG: FWeapon[WEAPON_BFG] := True;
     ITEM_WEAPON_SUPERPULEMET: FWeapon[WEAPON_SUPERPULEMET] := True;
+    ITEM_WEAPON_FLAMETHROWER: FWeapon[WEAPON_FLAMETHROWER] := True;
 
     ITEM_AMMO_BULLETS: if FAmmo[A_BULLETS] < FMaxAmmo[A_BULLETS] then IncMax(FAmmo[A_BULLETS], 10, FMaxAmmo[A_BULLETS]);
     ITEM_AMMO_BULLETS_BOX: if FAmmo[A_BULLETS] < FMaxAmmo[A_BULLETS] then IncMax(FAmmo[A_BULLETS], 50, FMaxAmmo[A_BULLETS]);
@@ -5735,17 +5784,20 @@ begin
     ITEM_AMMO_ROCKET_BOX: if FAmmo[A_ROCKETS] < FMaxAmmo[A_ROCKETS] then IncMax(FAmmo[A_ROCKETS], 5, FMaxAmmo[A_ROCKETS]);
     ITEM_AMMO_CELL: if FAmmo[A_CELLS] < FMaxAmmo[A_CELLS] then IncMax(FAmmo[A_CELLS], 40, FMaxAmmo[A_CELLS]);
     ITEM_AMMO_CELL_BIG: if FAmmo[A_CELLS] < FMaxAmmo[A_CELLS] then IncMax(FAmmo[A_CELLS], 100, FMaxAmmo[A_CELLS]);
+    ITEM_AMMO_FUELCAN: if FAmmo[A_FUEL] < FMaxAmmo[A_FUEL] then IncMax(FAmmo[A_FUEL], 100, FMaxAmmo[A_FUEL]);
 
     ITEM_AMMO_BACKPACK:
       if (FAmmo[A_BULLETS] < FMaxAmmo[A_BULLETS]) or
          (FAmmo[A_SHELLS] < FMaxAmmo[A_SHELLS]) or
          (FAmmo[A_ROCKETS] < FMaxAmmo[A_ROCKETS]) or
-         (FAmmo[A_CELLS] < FMaxAmmo[A_CELLS]) then
+         (FAmmo[A_CELLS] < FMaxAmmo[A_CELLS]) or
+         (FMaxAmmo[A_FUEL] < AmmoLimits[1, A_FUEL]) then
       begin
         FMaxAmmo[A_BULLETS] := AmmoLimits[1, A_BULLETS];
         FMaxAmmo[A_SHELLS] := AmmoLimits[1, A_SHELLS];
         FMaxAmmo[A_ROCKETS] := AmmoLimits[1, A_ROCKETS];
         FMaxAmmo[A_CELLS] := AmmoLimits[1, A_CELLS];
+        FMaxAmmo[A_FUEL] := AmmoLimits[1, A_FUEL];
 
         if FAmmo[A_BULLETS] < FMaxAmmo[A_BULLETS] then IncMax(FAmmo[A_BULLETS], 10, FMaxAmmo[A_BULLETS]);
         if FAmmo[A_SHELLS] < FMaxAmmo[A_SHELLS] then IncMax(FAmmo[A_SHELLS], 4, FMaxAmmo[A_SHELLS]);
@@ -6110,7 +6162,7 @@ begin
 
       case FCurrWeap of
         WEAPON_PLASMA, WEAPON_SUPERPULEMET, WEAPON_CHAINGUN: PressKey(KEY_FIRE, 20);
-        WEAPON_SAW, WEAPON_KASTET, WEAPON_MEGAKASTET: PressKey(KEY_FIRE, 40);
+        WEAPON_SAW, WEAPON_KASTET, WEAPON_FLAMETHROWER: PressKey(KEY_FIRE, 40);
         else PressKey(KEY_FIRE);
       end;
     end;
@@ -7082,6 +7134,7 @@ var
       WEAPON_PLASMA: Result := FAmmo[A_CELLS] >= 10;
       WEAPON_BFG: Result := FAmmo[A_CELLS] >= 40;
       WEAPON_SUPERPULEMET: Result := FAmmo[A_SHELLS] >= 1;
+      WEAPON_FLAMETHROWER: Result := FAmmo[A_FUEL] >= 1;
       else Result := True;
     end;
   end;
index 8e895a9245645c84a11c56fc9319779c199c389c..f3e1f8d79e5c7652ba9a002d1216f422016c8198 100644 (file)
@@ -145,13 +145,14 @@ const
   FLAG_DEFANGLE = -20;
   WEAPONBASE: Array [WP_FIRST + 1..WP_LAST] of TPoint =
               ((X:8; Y:4), (X:8; Y:8), (X:16; Y:16), (X:16; Y:24),
-               (X:16; Y:16), (X:24; Y:24), (X:16; Y:16), (X:24; Y:24), (X:16; Y:16));
+               (X:16; Y:16), (X:24; Y:24), (X:16; Y:16), (X:24; Y:24),
+               (X:16; Y:16), (X:8; Y:8));
 
   AnimNames: Array [A_STAND..A_PAIN] of String =
              ('StandAnim','WalkAnim','Die1Anim','Die2Anim','AttackAnim',
               'SeeUpAnim','SeeDownAnim','AttackUpAnim','AttackDownAnim','PainAnim');
   WeapNames: Array [WP_FIRST + 1..WP_LAST] of String =
-             ('csaw', 'hgun', 'sg', 'ssg', 'mgun', 'rkt', 'plz', 'bfg', 'spl');
+             ('csaw', 'hgun', 'sg', 'ssg', 'mgun', 'rkt', 'plz', 'bfg', 'spl', 'flm');
 
 var
   WeaponID: Array [WP_FIRST + 1..WP_LAST] of
@@ -253,7 +254,7 @@ var
   WAD: TWADFile;
   s: string;
   prefix: string;
-  ok: Boolean;
+  ok, chk: Boolean;
 begin
   e_WriteLog(Format('Loading player model: %s', [ExtractFileName(FileName)]), MSG_NOTIFY);
 
@@ -395,10 +396,60 @@ begin
       for bb := A_STAND to A_PAIN do
         if not (bb in [A_DIE1, A_DIE2, A_PAIN]) then
         begin
-          ok := ok and GetWeapPoints(config.ReadStr(AnimNames[bb], WeapNames[aa]+'_points', ''), aa, bb, D_RIGHT,
-                                     config.ReadInt(AnimNames[bb], 'frames', 0),
-                                     config.ReadBool(AnimNames[bb], 'backanim', False),
-                                     WeaponPoints);
+          chk := GetWeapPoints(config.ReadStr(AnimNames[bb], WeapNames[aa]+'_points', ''), aa, bb, D_RIGHT,
+                               config.ReadInt(AnimNames[bb], 'frames', 0),
+                               config.ReadBool(AnimNames[bb], 'backanim', False),
+                               WeaponPoints);
+          if ok and (not chk) and (aa = WEAPON_FLAMETHROWER) then
+          begin
+            // workaround for flamethrower
+            chk := GetWeapPoints(config.ReadStr(AnimNames[bb], WeapNames[WEAPON_PLASMA]+'_points', ''), aa, bb, D_RIGHT,
+                                 config.ReadInt(AnimNames[bb], 'frames', 0),
+                                 config.ReadBool(AnimNames[bb], 'backanim', False),
+                                 WeaponPoints);
+            if chk then
+            for f := 0 to High(WeaponPoints[aa, bb, D_RIGHT]) do
+            begin
+              case bb of
+                A_STAND, A_PAIN:
+                begin
+                  Dec(WeaponPoints[aa, bb, D_RIGHT, f].X, 6);
+                  Dec(WeaponPoints[aa, bb, D_RIGHT, f].Y, 8);
+                end;
+                A_WALK:
+                begin
+                  Dec(WeaponPoints[aa, bb, D_RIGHT, f].X, 9);
+                  Dec(WeaponPoints[aa, bb, D_RIGHT, f].Y, 9);
+                end;
+                A_ATTACK:
+                begin
+                  Dec(WeaponPoints[aa, bb, D_RIGHT, f].X, 5);
+                  Dec(WeaponPoints[aa, bb, D_RIGHT, f].Y, 8);
+                end;
+                A_SEEUP:
+                begin
+                  Dec(WeaponPoints[aa, bb, D_RIGHT, f].X, 5);
+                  Dec(WeaponPoints[aa, bb, D_RIGHT, f].Y, 16);
+                end;
+                A_SEEDOWN:
+                begin
+                  Dec(WeaponPoints[aa, bb, D_RIGHT, f].X, 6);
+                  Dec(WeaponPoints[aa, bb, D_RIGHT, f].Y, 5);
+                end;
+                A_ATTACKUP:
+                begin
+                  Dec(WeaponPoints[aa, bb, D_RIGHT, f].X, 5);
+                  Dec(WeaponPoints[aa, bb, D_RIGHT, f].Y, 16);
+                end;
+                A_ATTACKDOWN:
+                begin
+                  Dec(WeaponPoints[aa, bb, D_RIGHT, f].X, 6);
+                  Dec(WeaponPoints[aa, bb, D_RIGHT, f].Y, 4);
+                end;
+              end;
+            end;
+          end;
+          ok := ok and chk;
 
           if not GetWeapPoints(config.ReadStr(AnimNames[bb], WeapNames[aa]+'2_points', ''), aa, bb, D_LEFT,
                                config.ReadInt(AnimNames[bb], 'frames', 0),
index c6f09a9d08dab480254b6657a86ed821a88e414d..38d33e3b5c713244a7c978857c816d1d39d2f35a 100644 (file)
@@ -97,7 +97,7 @@ const
   WEAPON_PLASMA         = 7;
   WEAPON_BFG            = 8;
   WEAPON_SUPERPULEMET   = 9;
-  WEAPON_MEGAKASTET     = 10;
+  WEAPON_FLAMETHROWER   = 10;
   WEAPON_ZOMBY_PISTOL   = 20;
   WEAPON_IMP_FIRE       = 21;
   WEAPON_BSP_FIRE       = 22;
@@ -107,7 +107,7 @@ const
   WEAPON_SKEL_FIRE      = 26;
 
   WP_FIRST          = WEAPON_KASTET;
-  WP_LAST           = WEAPON_SUPERPULEMET;
+  WP_LAST           = WEAPON_FLAMETHROWER;
 
 implementation
 
index 15203525aaa81bfdbda94270df10e0e77541961a..ef4eaf63675fdd137368ba9a01b2a85da2738146 100644 (file)
@@ -92,8 +92,10 @@ const
   ITEM_HELMET                = 34;
   ITEM_JETPACK               = 35;
   ITEM_INVIS                 = 36;
+  ITEM_WEAPON_FLAMETHROWER   = 37;
+  ITEM_AMMO_FUELCAN          = 38;
 
-  ITEM_MAX                   = 36; // store the last item's id in here
+  ITEM_MAX                   = 38; // store the last item's id in here
                                    // use this in for loops
 
   ITEM_OPTION_ONLYDM = 1;