mirror of
https://github.com/huderlem/porymap.git
synced 2026-10-01 12:26:37 -05:00
Support reading/saving pokefirered heal locations
This commit is contained in:
@@ -87,10 +87,16 @@ Event* Event::createNewWarpEvent(QString map_name)
|
||||
Event* Event::createNewHealLocationEvent(QString map_name)
|
||||
{
|
||||
Event *event = new Event;
|
||||
QString mapConstant = QString(Map::mapConstantFromName(map_name)).remove(0,4);
|
||||
event->put("event_group_type", "heal_event_group");
|
||||
event->put("event_type", EventType::HealLocation);
|
||||
event->put("loc_name", QString(Map::mapConstantFromName(map_name)).remove(0,4));
|
||||
event->put("loc_name", mapConstant);
|
||||
event->put("id_name", map_name.replace(QRegularExpression("([a-z])([A-Z])"), "\\1_\\2").toUpper());
|
||||
event->put("elevation", 3);
|
||||
if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokefirered) {
|
||||
event->put("respawn_map", mapConstant);
|
||||
event->put("respawn_npc", 1);
|
||||
}
|
||||
return event;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,33 @@
|
||||
#include "heallocation.h"
|
||||
#include "config.h"
|
||||
|
||||
HealLocation::HealLocation(QString map, int i, uint16_t x, uint16_t y)
|
||||
HealLocation::HealLocation(QString id, QString map, int i, uint16_t x, uint16_t y)
|
||||
{
|
||||
this->name = map;
|
||||
this->idName = id;
|
||||
this->mapName = map;
|
||||
this->index = i;
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->respawnMap = "";
|
||||
this->respawnNPC = 0;
|
||||
}
|
||||
|
||||
HealLocation::HealLocation(QString id, QString map, int i, uint16_t x, uint16_t y, QString respawnMap, uint16_t respawnNPC)
|
||||
{
|
||||
this->idName = id;
|
||||
this->mapName = map;
|
||||
this->index = i;
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->respawnMap = respawnMap;
|
||||
this->respawnNPC = respawnNPC;
|
||||
}
|
||||
|
||||
HealLocation HealLocation::fromEvent(Event *event)
|
||||
{
|
||||
HealLocation hl;
|
||||
hl.name = event->get("loc_name");
|
||||
hl.idName = event->get("id_name");
|
||||
hl.mapName = event->get("loc_name");
|
||||
try {
|
||||
hl.index = event->get("index").toInt();
|
||||
}
|
||||
@@ -20,11 +36,15 @@ HealLocation HealLocation::fromEvent(Event *event)
|
||||
}
|
||||
hl.x = event->getU16("x");
|
||||
hl.y = event->getU16("y");
|
||||
if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokefirered) {
|
||||
hl.respawnNPC = event->getU16("respawn_npc");
|
||||
hl.respawnMap = event->get("respawn_map");
|
||||
}
|
||||
return hl;
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug debug, const HealLocation &hl)
|
||||
{
|
||||
debug << "HealLocation_" + hl.name << "(" << hl.x << ',' << hl.y << ")";
|
||||
debug << "HealLocation_" + hl.mapName << "(" << hl.x << ',' << hl.y << ")";
|
||||
return debug;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user