Quantcast

* Fixed the error upon login

James Whitehead Ii [02-29-08 - 13:10]
* Fixed the error upon login
* Added a middle color, which is used for proper shading between good and bad
* Fixed the coloring of the crazy arrow so it properly turns green when you're "Arrived"
Filename
Config.lua
TomTom.lua
TomTom_CrazyArrow.lua
TomTom_Waypoints.lua
diff --git a/Config.lua b/Config.lua
index b9bd80a..f03498b 100644
--- a/Config.lua
+++ b/Config.lua
@@ -212,11 +212,19 @@ options.args.crazytaxi = {
                type = "color",
                name = L["Good color"],
 			   arg = "arrow.goodcolor",
+			   hasAlpha = false,
             },
+			colormiddle = {
+				type = "color",
+				name = L["Middle color"],
+				arg = "arrow.middlecolor",
+				hasAlpha = false,
+			},
             colorend = {
                type = "color",
                name = L["Bad color"],
 			   arg = "arrow.badcolor",
+			   hasAlpha = false,
             },
          },
       },
diff --git a/TomTom.lua b/TomTom.lua
index 4245093..2eecd0b 100755
--- a/TomTom.lua
+++ b/TomTom.lua
@@ -37,8 +37,9 @@ function TomTom:Initialize()
 			},
 			arrow = {
 				enable = true,
-				goodcolor = {0, 1, 0, 1},
-				badcolor = {1, 0, 0, 1},
+				goodcolor = {0, 1, 0},
+				badcolor = {1, 0, 0},
+				middlecolor = {1, 1, 0},
 				arrival = 15,
 				lock = false,
 				showtta = true,
diff --git a/TomTom_CrazyArrow.lua b/TomTom_CrazyArrow.lua
index c067649..962eaee 100644
--- a/TomTom_CrazyArrow.lua
+++ b/TomTom_CrazyArrow.lua
@@ -111,6 +111,10 @@ local time = 0
 local distance = 0
 local delta = 0
 local function OnUpdate(self, elapsed)
+	if not active_point then
+		self:Hide()
+	end
+
 	local dist,x,y = active_point:GetDistanceToWaypoint()
 	if not dist then
 		self:Hide()
@@ -127,6 +131,7 @@ local function OnUpdate(self, elapsed)
 			arrow:SetHeight(70)
 			arrow:SetWidth(53)
 			arrow:SetTexture("Interface\\AddOns\\TomTom\\Images\\Arrow-UP")
+			arrow:SetVertexColor(unpack(TomTom.db.profile.arrow.goodcolor))
 			showDownArrow = true
 		end

@@ -159,7 +164,10 @@ local function OnUpdate(self, elapsed)

 		local perc = math.abs((math.pi - math.abs(angle)) / math.pi)

-		local r,g,b = ColorGradient(perc, 1,0,0, 1,1,0, 0,1,0)
+		local gr,gg,gb = unpack(TomTom.db.profile.arrow.goodcolor)
+		local mr,mg,mb = unpack(TomTom.db.profile.arrow.middlecolor)
+		local br,bg,bb = unpack(TomTom.db.profile.arrow.badcolor)
+		local r,g,b = ColorGradient(perc, br, bg, bb, mr, mg, mb, gr, gg, gb)
 		arrow:SetVertexColor(r,g,b)

 		cell = floor(angle / twopi * 108 + 0.5) % 108
diff --git a/TomTom_Waypoints.lua b/TomTom_Waypoints.lua
index e88c943..db37649 100644
--- a/TomTom_Waypoints.lua
+++ b/TomTom_Waypoints.lua
@@ -65,7 +65,6 @@ function WaypointClass:GetDirectionToWaypoint()
 	return Astrolabe:GetDirectionToIcon(self.minimap)
 end

-
 function TomTom:SetWaypoint(c, z, x, y, distances)
 	-- Try to acquire a waypoint from the frame pool
 	local minimap = table.remove(pool.minimap)