Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
authorsheepluva
Fri, 16 Sep 2016 00:22:05 +0200
changeset 11853 6a0d6b00dac8
parent 11852 38e7206a5df4
child 11854 bc5714636364
Highlander: give visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
ChangeLog.txt
hedgewars/uGearsHedgehog.pas
hedgewars/uGearsUtils.pas
share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua
--- a/ChangeLog.txt	Fri Sep 16 00:01:43 2016 +0200
+++ b/ChangeLog.txt	Fri Sep 16 00:22:05 2016 +0200
@@ -8,6 +8,7 @@
 Game engine:
  + Improved hedgehog spawns on maps that lack land mass or free space
  + Highlander mode displays game scheme specifics (mines timer, etc.) in ESC info
+ + Highlander mode gives visual and acustic feedback when weapons are collected from a kill, similar to collecting a crate
  + AI hedgehogs can now use Bee and Vampirism
  + Divided Teams mode will now work with more than 2 teams (Hint: you probably want to set world edges to "wrap" in such games)
  + Fort Mode will now work with more than 2 teams
@@ -51,6 +52,7 @@
 
 Lua-API:
  + New call: SetCinematicMode(enable) -- e.g. for cutscenes etc.
+ + New call: GetAmmoName(ammoType) -- returns the localized name for the specified ammoType
 
 0.9.21 -> 0.9.22
  + New Weapon / Map object: AirMine (floating mine that will follow nearby hedgehogs)
--- a/hedgewars/uGearsHedgehog.pas	Fri Sep 16 00:01:43 2016 +0200
+++ b/hedgewars/uGearsHedgehog.pas	Fri Sep 16 00:22:05 2016 +0200
@@ -660,7 +660,7 @@
     if cnt <> 0 then AddAmmo(HH, ammo, cnt)
     else AddAmmo(HH, ammo);
 
-    if IsHogLocal(@HH) or (GameType = gmtDemo)  then
+    if IsHogLocal(@HH) then
         begin
         if cnt <> 0 then
             s:= trammo[Ammoz[ammo].NameId] + ansistring(' (+' + IntToStr(cnt) + ')')
--- a/hedgewars/uGearsUtils.pas	Fri Sep 16 00:01:43 2016 +0200
+++ b/hedgewars/uGearsUtils.pas	Fri Sep 16 00:22:05 2016 +0200
@@ -1592,7 +1592,7 @@
 
 function IsHogLocal(HH: PHedgehog): boolean;
 begin
-    IsHogLocal:= (not (HH^.Team^.ExtDriven or (HH^.BotLevel > 0))) or (HH^.Team^.Clan^.ClanIndex = LocalClan);
+    IsHogLocal:= (not (HH^.Team^.ExtDriven or (HH^.BotLevel > 0))) or (HH^.Team^.Clan^.ClanIndex = LocalClan) or (GameType = gmtDemo);
 end;
 
 end.
--- a/share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua	Fri Sep 16 00:01:43 2016 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua	Fri Sep 16 00:22:05 2016 +0200
@@ -1,6 +1,6 @@
 --------------------------------
 -- HIGHLANDER / HOGS OF WAR
--- version 0.4b
+-- version 0.4b+
 -- by mikade
 --------------------------------
 
@@ -216,7 +216,18 @@
 -- this is called when a hog dies
 function TransferWeps(gear)
 
-	if CurrentHedgehog ~= nil then
+	if CurrentHedgehog ~= nil and CurrentHedgehog ~= gear then
+
+        local x,y,color
+        local vgear
+        local vgtX, vgtY, vgtdX, vgtdY, vgtAngle, vgtFrame, vgtFrameTicks, vgtState, vgtTimer, vgtTint
+        local dspl = IsHogLocal(CurrentHedgehog)
+        local ammolist = ''
+
+        if dspl then
+            x,y = GetGearPosition(CurrentHedgehog)
+            color = GetClanColor(GetHogClan(CurrentHedgehog))
+        end
 
         for w,c in pairs(wepArray) do
 			val = getGearValue(gear,w)
@@ -230,10 +241,29 @@
 				else
 					AddAmmo(CurrentHedgehog, w, val)
 				end
+                if dspl then
+                    if ammolist == '' then
+                        ammolist = GetAmmoName(w)
+                    else
+                        ammolist = ammolist .. ' • ' .. GetAmmoName(w)
+                    end
+                    x = x + 2
+                    y = y + 32
+                    vgear = AddVisualGear(x, y, vgtAmmo, 0, true)
+                    if vgear ~= nil then
+                        vgtX,vgtY,vgtdX,vgtdY,vgtAngle,vgtFrame,vgtFrameTicks,vgtState,vgtTimer,vgtTint = GetVisualGearValues(vgear)
+                        vgtFrame = w
+                        SetVisualGearValues(vgear,vgtX,vgtY,vgtdX,vgtdY,vgtAngle,vgtFrame,vgtFrameTicks,vgtState,vgtTimer,vgtTint)
+                    end
+                end
 
 			end
 		end
 
+        PlaySound(sndShotgunReload);
+        if dspl and ammolist ~= '' then
+            AddCaption(ammolist, color, capgrpAmmoinfo)
+        end
 	end
 
 end