diff --git a/QuestHelper/arrow.lua b/QuestHelper/arrow.lua index 586c833..aa6559c 100644 --- a/QuestHelper/arrow.lua +++ b/QuestHelper/arrow.lua @@ -160,17 +160,17 @@ function QH_Arrow_SetTextScale(scale) wayframe.tta:SetFont(default_font_name, default_font_size * scale, default_font_flags) end -local function wpupdate(c, z, x, y, desc) - if c then - QuestHelper: Assert(z) +local function wpupdate(m, f, x, y, desc) + if m then + QuestHelper: Assert(f) QuestHelper: Assert(x) QuestHelper: Assert(y) else - QuestHelper: Assert(not z) + QuestHelper: Assert(not f) QuestHelper: Assert(not x) QuestHelper: Assert(not y) end - active_point.c, active_point.z, active_point.x, active_point.y = c, z, x, y + active_point.m, active_point.f, active_point.x, active_point.y = m, f, x, y wayframe.title:SetText(desc) wayframe:Show() OnUpdate() @@ -199,7 +199,6 @@ OnUpdate = function() local dist, dx, dy = QuestHelper.Astrolabe:ComputeDistance(QuestHelper.collect_rm, QuestHelper.collect_rf, QuestHelper.collect_rx, QuestHelper.collect_ry, active_point.m, active_point.f, active_point.x, active_point.y) --print(QuestHelper.collect_rc, QuestHelper.collect_rz, QuestHelper.collect_rx, QuestHelper.collect_ry, active_point.c, active_point.z, active_point.x, active_point.y) - local text = "" if dist then @@ -233,7 +232,7 @@ OnUpdate = function() local xend = ((column + 1) * 53) / 512 local yend = ((row + 1) * 70) / 512 arrow:SetTexCoord(xstart,xend,ystart,yend) - else + elseif dist then if showDownArrow then showDownArrow = false QH_Arrow_SetScale() @@ -247,7 +246,7 @@ OnUpdate = function() angle = angle - player local perc = math.abs((math.pi - math.abs(angle)) / math.pi) - if perc > 1 then perc = 2 - perc end -- siiigh + if perc > 1 then perc = 2 - perc end -- siiigh local gr,gg,gb = 0, 1, 0 local mr,mg,mb = 1, 1, 0 diff --git a/QuestHelper/core.lua b/QuestHelper/core.lua index 2bbc4a6..1df4da7 100644 --- a/QuestHelper/core.lua +++ b/QuestHelper/core.lua @@ -5,7 +5,8 @@ QuestHelper_File["core.lua"] = "4.0.1.$svnversion$" QuestHelper_Loadtime["core.lua"] = GetTime() -QuestHelper.Astrolabe = QH_Astrolabe_Ready and DongleStub("Astrolabe-1.0") +--QuestHelper.Astrolabe = QH_Astrolabe_Ready and DongleStub("Astrolabe-1.0") +QuestHelper.Astrolabe = DongleStub("Astrolabe-1.0") local walker = QuestHelper:CreateWorldMapWalker() QuestHelper.minimap_marker = QuestHelper:CreateMipmapDodad() diff --git a/QuestHelper/dodads.lua b/QuestHelper/dodads.lua index 41e4b05..ca71ee4 100644 --- a/QuestHelper/dodads.lua +++ b/QuestHelper/dodads.lua @@ -24,6 +24,8 @@ local function convertLocationToScreen(p, m, f) local pm, _, px, py = convertLocation(p) local ox, oy = QuestHelper.Astrolabe:TranslateWorldMapPosition(pm, 0, px, py, m, f) --QuestHelper:TextOut(string.format("%f/%f/%f to %f/%f/%f to %f/%f %f/%f", p.c, p.x, p.y, pc, px, py, c, z, ox, oy)) + assert(ox) + assert(oy) return ox, oy end @@ -938,7 +940,7 @@ function QuestHelper:CreateWorldMapMinidad(objective, nxt) end local callbacks = {} -local last_c, last_z, last_x, last_y, last_desc +local last_m, last_f, last_x, last_y, last_desc function QuestHelper:AddWaypointCallback(func, ...) local cb = self:CreateTable() @@ -947,13 +949,13 @@ function QuestHelper:AddWaypointCallback(func, ...) cb.len = len cb.func = func for i = 1,len do cb[i] = select(i, ...) end - cb[len+1] = last_c - cb[len+2] = last_z + cb[len+1] = last_m + cb[len+2] = last_f cb[len+3] = last_x cb[len+4] = last_y cb[len+5] = last_desc - if last_c then + if last_m then func(unpack(cb, 1, len+5)) end @@ -965,20 +967,22 @@ function QuestHelper:RemoveWaypointCallback(cb) self:ReleaseTable(cb) end -function QuestHelper:InvokeWaypointCallbacks(c, z, x, y, desc) - QuestHelper: Assert(not c or type(c) == "number") - QuestHelper: Assert(not z or type(z) == "number") +function QuestHelper:InvokeWaypointCallbacks(m, f, x, y, desc) + QuestHelper: Assert(not m or type(m) == "number") + QuestHelper: Assert(not f or type(f) == "number") QuestHelper: Assert(not x or type(x) == "number") QuestHelper: Assert(not y or type(y) == "number") - if c == last_c and z == last_z and desc == last_desc and not x and not y then x, y = last_x, last_y end -- sometimes we may not have up-to-date location, but could still in theory be pointing at the same spot - if not c or (x and y) then - if c ~= last_c or z ~= last_z or x ~= last_x or y ~= last_y or desc ~= last_desc then - last_c, last_z, last_x, last_y, last_desc = c, z, x, y, desc + --assert(m or last_m, tostring(m) .. " " .. tostring(last_m)) -- ok, both are nil, which is why line arrow:202 fails. + if m == last_m and f == last_f and desc == last_desc and not x and not y then x, y = last_x, last_y end -- sometimes we may not have up-to-date location, but could still in theory be pointing at the same spot + + if not m or (x and y) then + if m ~= last_m or f ~= last_f or x ~= last_x or y ~= last_y or desc ~= last_desc then + last_m, last_f, last_x, last_y, last_desc = m, f, x, y, desc for cb in pairs(callbacks) do local len = cb.len - cb[len+1] = c - cb[len+2] = z + cb[len+1] = m + cb[len+2] = f cb[len+3] = x cb[len+4] = y cb[len+5] = desc @@ -1050,11 +1054,11 @@ function QuestHelper:CreateMipmapDodad() icon.bg:SetAllPoints() function icon:OnUpdate(elapsed) - local c, z, x, y, textdesc + local m, f, x, y, textdesc if self.obj then - c, z = QuestHelper.collect_rc, QuestHelper.collect_rz - if c and z then - x, y = convertLocationToScreen(self.obj.loc, c, z) + m, f = QuestHelper.collect_rm, QuestHelper.collect_rf + if m and f then + x, y = convertLocationToScreen(self.obj.loc, m, f) end if self.obj.map_desc_chain then @@ -1069,14 +1073,14 @@ function QuestHelper:CreateMipmapDodad() end end - QuestHelper: Assert(not c or type(c) == "number") - QuestHelper: Assert(not z or type(z) == "number") + QuestHelper: Assert(not m or type(m) == "number") + QuestHelper: Assert(not f or type(f) == "number") -- Deal with waypoint callbacks if QuestHelper_Pref.hide or UnitIsDeadOrGhost("player") and not QuestHelper.InBrokenInstance then QuestHelper:InvokeWaypointCallbacks() else - QuestHelper:InvokeWaypointCallbacks(c, z, x, y, textdesc) + QuestHelper:InvokeWaypointCallbacks(m, f, x, y, textdesc) end if self.obj and not QuestHelper.InBrokenInstance then diff --git a/QuestHelper/main.lua b/QuestHelper/main.lua index d9d496f..aa0c58e 100644 --- a/QuestHelper/main.lua +++ b/QuestHelper/main.lua @@ -287,9 +287,16 @@ local function FinalProblemChecks(uninstallederr, file_problem_version) return end - if not DongleStub or not QH_Astrolabe_Ready then + if not DongleStub then + QH_fixedmessage("NOT_UNZIPPED_CORRECTLY") + QuestHelber_ErrorCatcher_ExplicitError(false, "no DongleStub") + QuestHelper = nil + return + end + + if not QuestHelper.Astrolabe then QH_fixedmessage(QHText("NOT_UNZIPPED_CORRECTLY")) - QuestHelper_ErrorCatcher_ExplicitError(false, "not-unzipped-properly") + QuestHelper_ErrorCatcher_ExplicitError(false, "no QH_Astrolabe_Ready") QuestHelper = nil -- Just in case anybody else is checking for us, we're not home return end