Racer: Draw waypoint outline around cursor while in placement phase
authorWuzzy <Wuzzy2@mail.ru>
Thu, 08 Mar 2018 21:28:02 +0100
changeset 13134 9a328734e469
parent 13133 2f7c8e2ebe8e
child 13135 13b6f1621ef2
Racer: Draw waypoint outline around cursor while in placement phase
ChangeLog.txt
share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua
share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
--- a/ChangeLog.txt	Thu Mar 08 21:05:10 2018 +0100
+++ b/ChangeLog.txt	Thu Mar 08 21:28:02 2018 +0100
@@ -39,9 +39,10 @@
  + Construction Mode: Allow to change "Switch Hedgehog" in weapon scheme
  + Construction Mode: Hide selected sub-modes from crate/object placer from enemies over the net
  + Continental supplies: Custom weapon icons for the special weapons
- + Racer, Tech Racer: Beforee starting a round, make first waypoint flash and center camera to it
+ + Racer, Tech Racer: Before starting a round, make first waypoint flash and center camera to it
+ + Racer, Tech Racer: Various other waypoint appearance improvements
  + Racer: Use dark waypoints in bright themes like Bath
- + Racer, Tech Racer: Various other waypoint appearance improvements
+ + Racer, HedgeEditor: Show waypoint outline around cursor when placing waypoints
  + Battalion: Minor message and visual improvements
  + Battalion: Mutate hog hats by default, but not the names
  + Battalion: Script parameter “mutatenames=true” to also change the hog names (default: false)
--- a/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Thu Mar 08 21:05:10 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/HedgeEditor.lua	Thu Mar 08 21:28:02 2018 +0100
@@ -2981,8 +2981,8 @@
 			-- Waypoint outline
 			if (cat[cIndex] == loc("Waypoint Editing Mode")) and (pMode[pIndex] == loc("Place Waypoint")) then
 				if not waypointPreviewSprite then
-					waypointPreviewSprite = AddVisualGear(CursorX, CursorY, vgtCircle, 1, true)
-					SetVisualGearValues(waypointPreviewSprite, CursorX, CursorY, 244, 224, 0, 0, 0, wpRadius/5, 5, 0xFF0000FF)
+					waypointPreviewSprite = AddVisualGear(CursorX, CursorY, vgtCircle, 0, true)
+					SetVisualGearValues(waypointPreviewSprite, CursorX, CursorY, 244, 224, 0, 0, 0, div(wpRadius, 5), 5, 0xFF0000FF)
 				end
 			elseif waypointPreviewSprite then
 				DeleteVisualGear(waypointPreviewSprite)
--- a/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Thu Mar 08 21:05:10 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Thu Mar 08 21:28:02 2018 +0100
@@ -116,6 +116,9 @@
 
 local TeamRope = false
 
+local waypointCursor = false
+local waypointPreview = nil
+
 --------------------------
 -- hog and team tracking variales
 --------------------------
@@ -760,6 +763,7 @@
         wpCirc[wpCount] = nil
         SetVisualGearValues(wpCirc[wpCount-1], nil, nil, nil, nil, nil, nil, nil, nil, nil, waypointColour)
         AddCaption(string.format(loc("Waypoint removed. Available points: %d"), wpLimit-wpCount))
+        PlaySound(sndBump)
     else
         PlaySound(sndDenied)
         AddCaption(loc("No waypoint to be removed!"))
@@ -916,9 +920,15 @@
                                 -- still in placement mode
                         end
 
-                end
-        end
-
+        	end
+		if not racerActive and not gameBegun and GetCurAmmoType() == amAirAttack then
+			waypointCursor = true
+		else
+			waypointCursor = false
+		end
+	else
+		waypointCursor = false
+	end
 
         -- has the player started his tumbling spree?
         if (CurrentHedgehog ~= nil) then
@@ -957,6 +967,20 @@
 
 end
 
+function onGameTick()
+	if waypointCursor then
+		if not waypointPreview then
+			waypointPreview = AddVisualGear(CursorX, CursorY, vgtCircle, 0, true)
+		end
+		SetVisualGearValues(waypointPreview, CursorX, CursorY, 200, 200, 0, 0, 0, div(wpRad, 5), 5, waypointColourAtPlacement)
+	else
+		if waypointPreview then
+			DeleteVisualGear(waypointPreview)
+			waypointPreview = nil
+		end
+	end
+end
+
 function onGearResurrect(gear)
 
         AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)