|
From: <cn...@us...> - 2024-08-18 14:58:31
|
Revision: 1510
http://sourceforge.net/p/seq/svn/1510
Author: cn187
Date: 2024-08-18 14:58:29 +0000 (Sun, 18 Aug 2024)
Log Message:
-----------
Add support for displaying waypoints on map
Modified Paths:
--------------
showeq/branches/cn187_devel/conf/zoneopcodes.xml
showeq/branches/cn187_devel/src/everquest.h
showeq/branches/cn187_devel/src/interface.cpp
showeq/branches/cn187_devel/src/map.cpp
showeq/branches/cn187_devel/src/map.h
showeq/branches/cn187_devel/src/mapcore.cpp
showeq/branches/cn187_devel/src/mapcore.h
showeq/branches/cn187_devel/src/s_everquest.h
Modified: showeq/branches/cn187_devel/conf/zoneopcodes.xml
===================================================================
--- showeq/branches/cn187_devel/conf/zoneopcodes.xml 2024-08-16 02:42:37 UTC (rev 1509)
+++ showeq/branches/cn187_devel/conf/zoneopcodes.xml 2024-08-18 14:58:29 UTC (rev 1510)
@@ -285,8 +285,16 @@
<comment>ItemCode</comment>
<payload dir="server" typename="itemPacketStruct" sizechecktype="none"/>
</opcode>
+ <opcode id="29d8" name="OP_WaypointResponse" updated="07/17/24">
+ <comment>Server sends waypoint path (for /waypoint, /find)</comment>
+ <payload dir="server" typename="waypointStruct" sizechecktype="modulus"/>
+ </opcode>
<!-- Not necessary for SEQ to run but here to name packets in logs. -->
+ <opcode id="252f" name="OP_WaypointRequest" updated="07/17/24">
+ <comment>Client requests waypoint path (/waypoint, /find)</comment>
+ <payload dir="client" typename="waypointRequestStruct" sizechecktype="match"/>
+ </opcode>
<opcode id="ffff" name="OP_LeaderExpUpdate" updated="12/11/13">
<comment>Leadership AA Exp Update</comment>
<payload dir="server" typename="leadExpUpdateStruct" sizechecktype="match"/>
Modified: showeq/branches/cn187_devel/src/everquest.h
===================================================================
--- showeq/branches/cn187_devel/src/everquest.h 2024-08-16 02:42:37 UTC (rev 1509)
+++ showeq/branches/cn187_devel/src/everquest.h 2024-08-18 14:58:29 UTC (rev 1510)
@@ -2752,6 +2752,53 @@
struct bazaarSearchResponseStruct response[0];
};
+/*
+** Waypoint Request
+** Length: 40 octets
+** OpCode: WaypointRequest
+**
+** Used for requesting path from server, for use with
+** /waypoint and /find
+*/
+struct waypointRequestStruct
+{
+/*0000*/ uint32_t unknown0000; // Might be sub-op switch. 1 for Find, 7 for waypoint
+/*0004*/ uint16_t unknown0004;
+/*0006*/ uint16_t unknown0006;
+/*0008*/ uint32_t unknown0008;
+/*0012*/ uint32_t unknown0012;
+/*0016*/ float loc_y;
+/*0020*/ float loc_x;
+/*0024*/ float loc_z;
+/*0028*/ float wp_y;
+/*0032*/ float wp_x;
+/*0036*/ float wp_z;
+/*0040*/
+};
+
+
+/*
+** Waypoint Response
+** Length: variable, modulo sizeof(waypointStruct)
+** OpCode: WaypointResponse
+**
+** Server sends as response to WaypointRequest. Used to give client
+** pathfinding coordinates for /waypoint and /find.
+**
+** If the path is not available ("Mystical forces prevent you...") the
+** the response will contain only 1 waypoint struct, with the correct
+** y/x coords, but with the z coord being a very large magnitude negative
+** value (-1e27). The client uses this to determine whether or not the path
+** request succeeded.
+*/
+struct waypointStruct
+{
+ float y;
+ float x;
+ float z;
+};
+
+
/*******************************/
/* World Server Structs */
Modified: showeq/branches/cn187_devel/src/interface.cpp
===================================================================
--- showeq/branches/cn187_devel/src/interface.cpp 2024-08-16 02:42:37 UTC (rev 1509)
+++ showeq/branches/cn187_devel/src/interface.cpp 2024-08-18 14:58:29 UTC (rev 1510)
@@ -2013,6 +2013,13 @@
connect(this, SIGNAL(saveAllPrefs(void)),
m_categoryMgr, SLOT(savePrefs(void)));
+ if (m_mapMgr)
+ {
+ m_packet->connect2("OP_WaypointResponse", SP_Zone, DIR_Server,
+ "waypointStruct", SZC_Modulus,
+ m_mapMgr, SLOT(setWaypoints(const uint8_t*, size_t, uint8_t)));
+ }
+
if (m_zoneMgr)
{
m_packet->connect2("OP_ZoneEntry", SP_Zone, DIR_Client,
Modified: showeq/branches/cn187_devel/src/map.cpp
===================================================================
--- showeq/branches/cn187_devel/src/map.cpp 2024-08-16 02:42:37 UTC (rev 1509)
+++ showeq/branches/cn187_devel/src/map.cpp 2024-08-18 14:58:29 UTC (rev 1510)
@@ -680,6 +680,9 @@
// only need to deal with position changes
if (changeType & tSpawnChangedPosition)
{
+ if (m_mapData.waypointActive())
+ m_mapData.checkWaypointComplete(MapPoint(m_player->x(), m_player->y(), m_player->z()));
+
// make sure it fits on the map display
if ( m_mapData.checkPos(item->x(), item->y()))
emit mapUpdated(); // signal if the map size has changed
@@ -816,6 +819,40 @@
emit editLayerChanged();
}
+void MapMgr::setWaypoints(const uint8_t* data, size_t len, uint8_t dir)
+{
+ const waypointStruct* waypoints = (const waypointStruct*) data;
+
+ m_mapData.clearWaypoints();
+
+ /*
+ * First waypoint is destination
+ * Second waypoint is closest point to you, generally your /loc
+ * Third waypoint through N-1 gradually move toward your destination
+ * Final waypoint is destination again
+ */
+ if (len <= sizeof(waypointStruct))
+ return;
+ // NOTE: starting at index 1, so we don't draw a straight line between
+ // the player and the destination.
+ auto wp = waypoints[1];
+ MapPoint start(wp.x, wp.y, wp.z);
+ m_mapData.startWaypointLine(start);
+ for (size_t i=1; i<(len/sizeof(waypointStruct)); ++i)
+ {
+ auto wp = waypoints[i];
+ MapPoint point(wp.x, wp.y, wp.z);
+ m_mapData.addWaypoint(point);
+ }
+ emit mapUpdated();
+}
+
+void MapMgr::clearWaypoints()
+{
+ m_mapData.clearWaypoints();
+ emit mapUpdated();
+}
+
void MapMgr::savePrefs(void)
{
#if 0 // ZBTEMP: Migrate to place where ever this is set
@@ -1059,6 +1096,9 @@
m_action_gridTicks = subMenu->addAction("Grid Ticks", this, SLOT(toggle_gridTicks()));
m_action_gridTicks->setCheckable(true);
+ m_action_waypoints = subMenu->addAction("Waypoints", this, SLOT(toggle_waypoints()));
+ m_action_waypoints->setCheckable(true);
+
m_action_locations = subMenu->addAction("Locations", this, SLOT(toggle_locations()));
m_action_locations->setCheckable(true);
@@ -1132,6 +1172,9 @@
m_action_gridLineColor = addAction("Grid Line Color...", this,
SLOT(select_gridLineColor()));
+ m_action_waypointColor = addAction("Waypoint Color...", this,
+ SLOT(select_waypointColor()));
+
m_action_backgroundColor = addAction("Background Color...", this,
SLOT(select_backgroundColor()));
@@ -1283,6 +1326,8 @@
addAction("Save Map Image...", m_map, SLOT(saveMapImage()));
+ addAction("Clear Current Waypoint", m_map, SLOT(clearWaypoints()));
+
connect(this, SIGNAL(aboutToShow()), this, SLOT(init_Menu()));
}
@@ -1316,6 +1361,7 @@
m_action_playerView->setChecked(m_map->showPlayerView());
m_action_gridLines->setChecked(m_map->showGridLines());
m_action_gridTicks->setChecked(m_map->showGridTicks());
+ m_action_waypoints->setChecked(m_map->showWaypoints());
m_action_locations->setChecked(m_map->showLocations());
m_action_spawns->setChecked(m_map->showSpawns());
m_action_spawnPoints->setChecked(m_map->showSpawnPoints());
@@ -1486,6 +1532,11 @@
m_map->setShowGridTicks(!m_map->showGridTicks());
}
+void MapMenu::toggle_waypoints()
+{
+ m_map->setShowWaypoints(!m_map->showWaypoints());
+}
+
void MapMenu::toggle_locations()
{
m_map->setShowLocations(!m_map->showLocations());
@@ -1590,6 +1641,18 @@
m_map->setGridLineColor(newColor);
}
+void MapMenu::select_waypointColor()
+{
+ QString name = QString("ShowEQ - ") + m_map->preferenceName()
+ + " Waypoint Color";
+ QColor newColor = QColorDialog::getColor(m_map->waypointColor(),
+ m_map, name);
+
+ if (newColor.isValid())
+ m_map->setWaypointColor(newColor);
+}
+
+
void MapMenu::select_backgroundColor()
{
QString name = QString("ShowEQ - ") + m_map->preferenceName()
@@ -1817,6 +1880,9 @@
tmpPrefString = "ShowGridTicks";
m_param.setShowGridTicks(pSEQPrefs->getPrefBool(tmpPrefString, prefString, true));
+ tmpPrefString = "ShowWaypoints";
+ m_param.setShowWaypoints(pSEQPrefs->getPrefBool(tmpPrefString, prefString, true));
+
tmpPrefString = "ShowBackgroundImage";
m_param.setShowBackgroundImage(pSEQPrefs->getPrefBool(tmpPrefString, prefString, true));
@@ -1832,6 +1898,9 @@
tmpPrefString = "GridLineColor";
m_param.setGridLineColor(pSEQPrefs->getPrefColor(tmpPrefString, prefString, QColor("#194819")));
+ tmpPrefString = "WaypointColor";
+ m_param.setWaypointColor(pSEQPrefs->getPrefColor(tmpPrefString, prefString, QColor("#ff007f")));
+
tmpPrefString = "BackgroundColor";
m_param.setBackgroundColor(pSEQPrefs->getPrefColor(tmpPrefString, prefString, QColor("black")));
@@ -2079,11 +2148,24 @@
m_mapPanX = me->x();
m_mapPanY = me->y();
#endif
- }
- else
+ }
+ else
{
+ uint32_t dist = 15;
+
+ if (m_mapMgr->mapData().waypointActive())
+ {
+ QPoint clickpoint(m_param.invertXOffset(me->x()), m_param.invertYOffset(me->y()));
+ const MapPoint* closest_wp = m_mapMgr->mapData().closestWaypointToPoint2D(clickpoint, dist);
+ if (closest_wp)
+ {
+ m_mapMgr->clearWaypoints();
+ return;
+ }
+ }
+
+
const Item* closestSpawn;
- uint32_t dist = 15;
// find the nearest spawn within a reasonable range
closestSpawn = closestSpawnToPoint(me->pos(), dist);
@@ -2934,6 +3016,17 @@
refreshMap ();
}
+void Map::setWaypointColor(const QColor& color)
+{
+ m_param.setWaypointColor(color);
+
+ // set color preference
+ pSEQPrefs->setPrefColor("WaypointColor", preferenceName(), m_param.waypointColor());
+
+ if(!m_cacheChanges)
+ refreshMap ();
+}
+
void Map::setBackgroundColor(const QColor& color)
{
m_param.setBackgroundColor(color);
@@ -3041,6 +3134,22 @@
refreshMap ();
}
+void Map::clearWaypoints()
+{
+ m_mapMgr->clearWaypoints();
+}
+
+void Map::setShowWaypoints(bool val)
+{
+ m_param.setShowWaypoints(val);
+
+ QString tmpPrefString = "ShowWaypoints";
+ pSEQPrefs->setPrefBool(tmpPrefString, preferenceName(), m_param.showWaypoints());
+
+ if(!m_cacheChanges)
+ refreshMap ();
+}
+
void Map::setCacheAlwaysRepaint(bool val)
{
m_mapCache.setAlwaysRepaint(val);
@@ -3119,10 +3228,12 @@
out << "ShowMapLines: " << m_param.showLines() << ENDL;
out << "ShowGridLines: " << m_param.showGridLines() << ENDL;
out << "ShowGridTicks: " << m_param.showGridTicks() << ENDL;
+ out << "ShowWaypointss: " << m_param.showWaypoints() << ENDL;
out << "ShowBackgroundImage: " << m_param.showBackgroundImage() << ENDL;
out << "GridResolution: " << m_param.gridResolution() << ENDL;
out << "GridTickColor: " << m_param.gridTickColor().name() << ENDL;
out << "GridLineColor: " << m_param.gridLineColor().name() << ENDL;
+ out << "WaypointColor: " << m_param.waypointColor().name() << ENDL;
out << "BackgroundColor: " << m_param.backgroundColor().name() << ENDL;
out << "HeadRoom: " << m_param.headRoom() << ENDL;
out << "FloorRoom: " << m_param.floorRoom() << ENDL;
@@ -4671,7 +4782,7 @@
// only need to deal with position changes
if (changeType & tSpawnChangedPosition)
{
- if (m_followMode == tFollowSpawn)
+ if (m_followMode == tFollowSpawn)
{
// follow mode is follow spawn, check if this is the selected spawn
// and if so, reAdjust around it's position.
Modified: showeq/branches/cn187_devel/src/map.h
===================================================================
--- showeq/branches/cn187_devel/src/map.h 2024-08-16 02:42:37 UTC (rev 1509)
+++ showeq/branches/cn187_devel/src/map.h 2024-08-18 14:58:29 UTC (rev 1510)
@@ -202,9 +202,12 @@
void showLineDlg(QWidget* parent);
void scaleDownZ(int16_t);
void scaleUpZ(int16_t);
-
void setEditLayer(int layerNum);
+ // Waypoint handling
+ void setWaypoints(const uint8_t* data, size_t len, uint8_t dir);
+ void clearWaypoints();
+
// Preference handling
void savePrefs(void);
@@ -229,6 +232,7 @@
QString m_curLineColor;
QString m_curLineName;
QString m_curLocationColor;
+ QString m_waypointColor;
};
//----------------------------------------------------------------------
@@ -261,6 +265,7 @@
void toggle_playerView();
void toggle_gridLines();
void toggle_gridTicks();
+ void toggle_waypoints();
void toggle_locations();
void toggle_spawns();
void toggle_spawnPnts();
@@ -282,6 +287,7 @@
void toggle_instanceLocationMarker();
void select_gridTickColor();
void select_gridLineColor();
+ void select_waypointColor();
void select_backgroundColor();
void select_font();
void select_fovColor();
@@ -321,6 +327,7 @@
QAction* m_action_playerView;
QAction* m_action_gridLines;
QAction* m_action_gridTicks;
+ QAction* m_action_waypoints;
QAction* m_action_locations;
QAction* m_action_spawns;
QAction* m_action_spawnPoints;
@@ -342,6 +349,7 @@
#endif
QAction* m_action_gridTickColor;
QAction* m_action_gridLineColor;
+ QAction* m_action_waypointColor;
QAction* m_action_backgroundColor;
QAction* m_action_font;
QAction* m_action_drawSizeMenu;
@@ -442,6 +450,7 @@
int gridResolution() const { return m_param.gridResolution(); }
const QColor& gridTickColor() const { return m_param.gridTickColor(); }
const QColor& gridLineColor() const { return m_param.gridLineColor(); }
+ const QColor& waypointColor() const { return m_param.waypointColor(); }
const QColor& backgroundColor() const { return m_param.backgroundColor(); }
const QFont& font() const { return m_param.font(); }
int headRoom() const { return m_param.headRoom(); }
@@ -452,6 +461,7 @@
bool showLines() const { return m_param.showLines(); }
bool showGridLines() const { return m_param.showGridLines(); }
bool showGridTicks() const { return m_param.showGridTicks(); }
+ bool showWaypoints() const { return m_param.showWaypoints(); }
bool cacheAlwaysRepaint() const { return m_mapCache.alwaysRepaint(); }
bool isLayerVisible(uint8_t layerNum) const { return m_param.isLayerVisible(layerNum); }
@@ -461,6 +471,7 @@
void saveMapImage(void);
void selectSpawn(const Item* item);
+ void clearWaypoints();
// SpawnShell handling
void delItem(const Item* item);
@@ -542,6 +553,7 @@
void setGridResolution(int val);
void setGridTickColor(const QColor& color);
void setGridLineColor(const QColor& color);
+ void setWaypointColor(const QColor& color);
void setBackgroundColor(const QColor& color);
void setFont(const QFont& font);
void setHeadRoom(int val);
@@ -552,6 +564,7 @@
void setShowLines(bool val);
void setShowGridLines(bool val);
void setShowGridTicks(bool val);
+ void setShowWaypoints(bool val);
void setCacheAlwaysRepaint(bool val);
void setShowZoneSafePoint(bool val);
void setShowInstanceLocationMarker(bool val);
Modified: showeq/branches/cn187_devel/src/mapcore.cpp
===================================================================
--- showeq/branches/cn187_devel/src/mapcore.cpp 2024-08-16 02:42:37 UTC (rev 1509)
+++ showeq/branches/cn187_devel/src/mapcore.cpp 2024-08-18 14:58:29 UTC (rev 1510)
@@ -92,6 +92,7 @@
m_showLines = true;
m_showGridLines = true;
m_showGridTicks = true;
+ m_showWaypoints = true;
reset();
}
@@ -452,7 +453,9 @@
//----------------------------------------------------------------------
// MapData
-MapData::MapData()
+MapData::MapData():
+ m_waypointLayer(nullptr),
+ m_waypointActive(false)
{
// clear the structure
clear();
@@ -482,6 +485,9 @@
qDeleteAll(m_mapLayers);
m_mapLayers.clear();
+ delete m_waypointLayer;
+ m_waypointLayer = NULL;
+ m_curWaypoints = NULL;
qDeleteAll(m_aggros);
m_aggros.clear();
@@ -503,6 +509,14 @@
return NULL;
}
+MapLayer* MapData::waypointLayer()
+{
+ if (!m_waypointLayer)
+ m_waypointLayer = new MapLayer();
+
+ return m_waypointLayer;
+}
+
void MapData::loadMap(const QString& fileName, bool import)
{
int16_t mx, my, mz;
@@ -1639,6 +1653,102 @@
m_editLineM->setColor(color);
}
+void MapData::startWaypointLine(const MapPoint& point)
+{
+ if (!m_waypointLayer)
+ m_waypointLayer = new MapLayer();
+
+ // create the new line, with just the first point. Color is a placeholder
+ // for api compatibility. MapParameters.m_waypointColor will be used instead
+ m_curWaypoints = new MapLineM("waypoints", "#ff007f", point);
+
+ // calculate the XY bounds of the line
+ m_curWaypoints->calcBounds();
+
+ // add line to the line list
+ m_waypointLayer->mLines().append(m_curWaypoints);
+
+ m_waypointActive = true;
+}
+
+
+void MapData::addWaypoint(const MapPoint& point)
+{
+ // make sure there is a line to add to
+ if (m_curWaypoints == NULL)
+ return;
+
+ uint32_t pos = m_curWaypoints->size();
+
+ // increase the size of the line by one point
+ m_curWaypoints->resize(pos + 1);
+
+ // set the point data
+ m_curWaypoints->setPoint(pos, point);
+
+ // calculate the XY bounds of the line
+ m_curWaypoints->calcBounds();
+}
+
+void MapData::clearWaypoints()
+{
+ if (!m_curWaypoints || !m_waypointLayer)
+ return;
+
+ m_waypointActive = false;
+ m_curWaypoints->clear();
+ delete m_waypointLayer->mLines().takeAt(m_waypointLayer->mLines().indexOf(m_curWaypoints));
+ m_curWaypoints = NULL;
+ delete m_waypointLayer;
+ m_waypointLayer = NULL;
+}
+
+void MapData::checkWaypointComplete(const MapPoint& playerPos)
+{
+ if (! m_curWaypoints || !m_waypointActive || !m_waypointLayer) return;
+
+ if (playerPos.calcDistInt(*(m_curWaypoints->end()-1)) < WAYPOINT_DONE_RADIUS)
+ clearWaypoints();
+}
+
+const MapPoint* MapData::closestWaypointToPoint3D(const MapPoint& point, const uint32_t& dist) const
+{
+ if (!m_curWaypoints) return NULL;
+
+ MapPoint* closest_wp = NULL;
+ int closest_dist = dist;
+ for (auto wp_itr = m_curWaypoints->begin(); wp_itr != m_curWaypoints->end(); ++wp_itr)
+ {
+ int wp_dist = point.calcDistInt(*wp_itr);
+ if (wp_dist < closest_dist)
+ {
+ closest_dist = wp_dist;
+ closest_wp = wp_itr;
+ }
+ }
+ return closest_wp;
+}
+
+const MapPoint* MapData::closestWaypointToPoint2D(const MapPoint& point, const uint32_t& dist) const
+{
+ if (!m_curWaypoints) return NULL;
+
+ MapPoint* closest_wp = NULL;
+ int closest_dist = dist;
+ for (auto wp_itr = m_curWaypoints->begin(); wp_itr != m_curWaypoints->end(); ++wp_itr)
+ {
+ int wp_dist = point.calcDist2DInt(*wp_itr);
+ if (wp_dist < closest_dist)
+ {
+ closest_dist = wp_dist;
+ closest_wp = wp_itr;
+ }
+ }
+ return closest_wp;
+}
+
+
+
void MapData::scaleDownZ(int16_t factor)
{
@@ -1938,9 +2048,95 @@
curY_1 = curY_2;
}
}
+
}
+
}
+void MapData::paintWaypoints(MapParameters& param, QPainter& p) const
+{
+ const QRect& screenBounds = param.screenBounds();
+
+ bool lastInBounds;
+ bool curInBounds;
+ int16_t curX_1, curY_1;
+ int16_t curX_2, curY_2;
+ uint numPoints;
+ MapPoint* mData;
+
+ MapLineM* currentLineM = NULL;
+
+ if (m_waypointLayer && param.showWaypoints() && m_waypointActive)
+ {
+ const MapPoint* closest_wp = closestWaypointToPoint3D(param.player(), INT_MAX);
+
+ // then paint the M lines that are between the closest wp and the destination
+ QList<MapLineM*>::const_iterator mmit = m_waypointLayer->mLines().begin();
+ for (; mmit != m_waypointLayer->mLines().end(); ++mmit)
+ {
+ currentLineM = *mmit;
+ // if line is outside the currently visible region, skip it.
+ if (!currentLineM->boundingRect().intersects(screenBounds))
+ continue;
+
+ // get the number of points in the line
+ numPoints = currentLineM->size();
+
+ // get the underlying array
+ mData = currentLineM->data();
+
+ // set pen color
+ #ifdef DEBUGMAP
+ seqDebug("lineColor = '%s'", (char *) param.waypointColor());
+ #endif
+ p.setPen(param.waypointColor());
+
+ // paint a line from the player to the closest waypoint
+ p.drawLine(param.calcXOffsetI(param.player().x()),
+ param.calcYOffsetI(param.player().y()),
+ param.calcXOffsetI(closest_wp->x()),
+ param.calcYOffsetI(closest_wp->y()));
+
+ int closest_idx = m_curWaypoints->indexOf(*closest_wp);
+
+ curX_1 = mData[closest_idx].x();
+ curY_1 = mData[closest_idx].y();
+
+ // see if the starting position is in bounds
+ lastInBounds = inRect(screenBounds, curX_1, curY_1);
+
+ // iterate over all the points in the line starting with the next closest
+ for (uint32_t i = closest_idx + 1; i < numPoints; i++)
+ {
+ curX_2 = mData[i].x();
+ curY_2 = mData[i].y();
+
+ // determine if the current position is in bounds
+ curInBounds = inRect(screenBounds, curX_2, curY_2);
+
+ // draw the line segment if either end is in bounds
+ if (lastInBounds || curInBounds)
+ {
+ p.drawEllipse(param.calcXOffsetI(curX_1) - 1,
+ param.calcYOffsetI(curY_1) - 1,
+ 2,2);
+ p.drawLine(param.calcXOffsetI(curX_1),
+ param.calcYOffsetI(curY_1),
+ param.calcXOffsetI(curX_2),
+ param.calcYOffsetI(curY_2));
+
+ }
+ // current becomes the last
+ lastInBounds = curInBounds;
+ curX_1 = curX_2;
+ curY_1 = curY_2;
+ }
+ }
+ } //end if show waypoints
+}
+
+
+
void MapData::paintDepthFilteredLines(MapParameters& param, QPainter& p) const
{
//----------------------------------------------------------------------
@@ -2422,7 +2618,8 @@
(m_lastParam.showLocations() != param.showLocations()) ||
(m_lastParam.showLines() != param.showLines()) ||
(m_lastParam.showGridLines() != param.showGridLines()) ||
- (m_lastParam.showGridTicks() != param.showGridTicks()) ||
+ (m_lastParam.showGridTicks() != param.showGridTicks()) ||
+ (m_lastParam.showWaypoints() != param.showWaypoints()) ||
(m_lastParam.showBackgroundImage() != param.showBackgroundImage()) ||
(m_lastParam.gridLineColor() != param.gridLineColor()) ||
(m_lastParam.gridTickColor() != param.gridTickColor()) ||
@@ -2506,6 +2703,9 @@
}
}
+ if (param.showWaypoints() && m_mapData.waypointActive())
+ m_mapData.paintWaypoints(param, tmp);
+
//----------------------------------------------------------------------
/* Paint the locations */
if (param.showLocations())
Modified: showeq/branches/cn187_devel/src/mapcore.h
===================================================================
--- showeq/branches/cn187_devel/src/mapcore.h 2024-08-16 02:42:37 UTC (rev 1509)
+++ showeq/branches/cn187_devel/src/mapcore.h 2024-08-18 14:58:29 UTC (rev 1510)
@@ -79,6 +79,7 @@
//----------------------------------------------------------------------
// constants
+#define WAYPOINT_DONE_RADIUS 10
//----------------------------------------------------------------------
// MapParameters
@@ -122,6 +123,7 @@
int gridResolution() const { return m_gridResolution; }
const QColor& gridLineColor() const { return m_gridLineColor; }
const QColor& gridTickColor() const { return m_gridTickColor; }
+ const QColor& waypointColor() const { return m_waypointColor; }
const QColor& backgroundColor() const { return m_backgroundColor; }
const QFont& font() const { return m_font; }
int16_t headRoom() const { return m_headRoom; }
@@ -134,6 +136,7 @@
bool showLines() const { return m_showLines; }
bool showGridLines() const { return m_showGridLines; }
bool showGridTicks() const { return m_showGridTicks; }
+ bool showWaypoints() const { return m_showWaypoints; }
// utility methods
int calcXOffset (int mapCoordinate) const;
@@ -170,8 +173,10 @@
void setShowLines(bool val) { m_showLines = val; }
void setShowGridLines(bool val) { m_showGridLines = val; }
void setShowGridTicks(bool val) { m_showGridTicks = val; }
+ void setShowWaypoints(bool val) { m_showWaypoints = val; }
void setGridLineColor(const QColor& color) { m_gridLineColor = color; }
void setGridTickColor(const QColor& color) { m_gridTickColor = color; }
+ void setWaypointColor(const QColor& color) { m_waypointColor = color; }
void setHeadRoom(int16_t headRoom);
void setFloorRoom(int16_t floorRoom);
void setLayerVisibility(uint8_t layerNum, bool isVisible);
@@ -201,6 +206,7 @@
int m_gridResolution;
QColor m_gridLineColor;
QColor m_gridTickColor;
+ QColor m_waypointColor;
QColor m_backgroundColor;
QFont m_font;
int16_t m_headRoom;
@@ -215,6 +221,7 @@
bool m_showLines;
bool m_showGridLines;
bool m_showGridTicks;
+ bool m_showWaypoints;
uint32_t m_layerVisibility;
};
@@ -567,6 +574,7 @@
int16_t maxX() const { return m_maxX; }
int16_t maxY() const { return m_maxY; }
MapLayer* mapLayer(uint8_t layerNum);
+ MapLayer* waypointLayer();
uint8_t numLayers() const { return m_mapLayers.count(); }
QList<MapAggro*>& aggros() { return m_aggros; }
const QPixmap& image() const { return m_image; }
@@ -595,6 +603,16 @@
void setEditLayer(uint8_t layerNum) { m_editLayer = layerNum; }
uint8_t editLayer() const { return m_editLayer; }
+ // waypoints
+ void startWaypointLine(const MapPoint& point);
+ void addWaypoint(const MapPoint& point);
+ void clearWaypoints(void);
+ void checkWaypointComplete(const MapPoint& playerPos);
+ bool waypointActive() const { return m_waypointActive; }
+ const MapPoint* closestWaypointToPoint3D(const MapPoint& point, const uint32_t& dist) const;
+ const MapPoint* closestWaypointToPoint2D(const MapPoint& point, const uint32_t& dist) const;
+ void paintWaypoints(MapParameters& param, QPainter& p) const;
+
// map painting
void paintGrid(MapParameters& param, QPainter& p) const;
void paintLines(MapParameters& param, QPainter& p) const;
@@ -623,6 +641,9 @@
bool m_xset;
bool m_yset;
+ MapLayer* m_waypointLayer;
+ MapLineM* m_curWaypoints;
+ bool m_waypointActive;
};
inline
Modified: showeq/branches/cn187_devel/src/s_everquest.h
===================================================================
--- showeq/branches/cn187_devel/src/s_everquest.h 2024-08-16 02:42:37 UTC (rev 1509)
+++ showeq/branches/cn187_devel/src/s_everquest.h 2024-08-18 14:58:29 UTC (rev 1510)
@@ -124,6 +124,8 @@
AddStruct(bazaarTraderRequest);
AddStruct(bazaarSearchQueryStruct);
AddStruct(bazaarSearchResponseStruct);
+AddStruct(waypointRequestStruct);
+AddStruct(waypointStruct);
AddStruct(guildListStruct);
AddStruct(worldGuildListStruct);
AddStruct(worldMOTDStruct);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|