Move event to core/
This commit is contained in:
parent
56499411b1
commit
0d33c3aa64
18 changed files with 380 additions and 380 deletions
|
@ -1,4 +1,4 @@
|
|||
#include "core/block.h"
|
||||
#include "block.h"
|
||||
|
||||
Block::Block() {
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "core/blockdata.h"
|
||||
#include "blockdata.h"
|
||||
|
||||
Blockdata::Blockdata(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
|
520
event.cpp → core/event.cpp
Executable file → Normal file
520
event.cpp → core/event.cpp
Executable file → Normal file
|
@ -1,260 +1,260 @@
|
|||
#include "event.h"
|
||||
#include "map.h"
|
||||
|
||||
QString EventType::Object = "event_object";
|
||||
QString EventType::Warp = "event_warp";
|
||||
QString EventType::CoordScript = "event_trap";
|
||||
QString EventType::CoordWeather = "event_trap_weather";
|
||||
QString EventType::Sign = "event_sign";
|
||||
QString EventType::HiddenItem = "event_hidden_item";
|
||||
QString EventType::SecretBase = "event_secret_base";
|
||||
QString EventType::HealLocation = "event_heal_location";
|
||||
|
||||
Event::Event()
|
||||
{
|
||||
this->spriteWidth = 16;
|
||||
this->spriteHeight = 16;
|
||||
}
|
||||
|
||||
Event* Event::createNewEvent(QString event_type, QString map_name)
|
||||
{
|
||||
Event *event = new Event;
|
||||
if (event_type == EventType::Object) {
|
||||
event = createNewObjectEvent();
|
||||
} else if (event_type == EventType::Warp) {
|
||||
event = createNewWarpEvent(map_name);
|
||||
} else if (event_type == EventType::HealLocation) {
|
||||
event = createNewHealLocationEvent(map_name);
|
||||
} else if (event_type == EventType::CoordScript) {
|
||||
event = createNewCoordScriptEvent();
|
||||
} else if (event_type == EventType::CoordWeather) {
|
||||
event = createNewCoordWeatherEvent();
|
||||
} else if (event_type == EventType::Sign) {
|
||||
event = createNewSignEvent();
|
||||
} else if (event_type == EventType::HiddenItem) {
|
||||
event = createNewHiddenItemEvent();
|
||||
} else if (event_type == EventType::SecretBase) {
|
||||
event = createNewSecretBaseEvent();
|
||||
}
|
||||
|
||||
event->setX(0);
|
||||
event->setY(0);
|
||||
event->put("elevation", 3);
|
||||
return event;
|
||||
}
|
||||
|
||||
Event* Event::createNewObjectEvent()
|
||||
{
|
||||
Event *event = new Event;
|
||||
event->put("event_group_type", "object_event_group");
|
||||
event->put("event_type", EventType::Object);
|
||||
event->put("sprite", "EVENT_OBJ_GFX_BOY_1");
|
||||
event->put("movement_type", "MOVEMENT_TYPE_LOOK_AROUND");
|
||||
event->put("radius_x", 0);
|
||||
event->put("radius_y", 0);
|
||||
event->put("script_label", "NULL");
|
||||
event->put("event_flag", "0");
|
||||
event->put("replacement", "0");
|
||||
event->put("is_trainer", "FALSE");
|
||||
event->put("sight_radius_tree_id", 0);
|
||||
return event;
|
||||
}
|
||||
|
||||
Event* Event::createNewWarpEvent(QString map_name)
|
||||
{
|
||||
Event *event = new Event;
|
||||
event->put("event_group_type", "warp_event_group");
|
||||
event->put("event_type", EventType::Warp);
|
||||
event->put("destination_warp", 0);
|
||||
event->put("destination_map_name", map_name);
|
||||
return event;
|
||||
}
|
||||
|
||||
Event* Event::createNewHealLocationEvent(QString map_name)
|
||||
{
|
||||
Event *event = new Event;
|
||||
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));
|
||||
return event;
|
||||
}
|
||||
|
||||
Event* Event::createNewCoordScriptEvent()
|
||||
{
|
||||
Event *event = new Event;
|
||||
event->put("event_group_type", "coord_event_group");
|
||||
event->put("event_type", EventType::CoordScript);
|
||||
event->put("script_label", "NULL");
|
||||
event->put("script_var", "VAR_TEMP_0");
|
||||
event->put("script_var_value", "0");
|
||||
return event;
|
||||
}
|
||||
|
||||
Event* Event::createNewCoordWeatherEvent()
|
||||
{
|
||||
Event *event = new Event;
|
||||
event->put("event_group_type", "coord_event_group");
|
||||
event->put("event_type", EventType::CoordWeather);
|
||||
event->put("weather", "COORD_EVENT_WEATHER_SUNNY");
|
||||
return event;
|
||||
}
|
||||
|
||||
Event* Event::createNewSignEvent()
|
||||
{
|
||||
Event *event = new Event;
|
||||
event->put("event_group_type", "bg_event_group");
|
||||
event->put("event_type", EventType::Sign);
|
||||
event->put("player_facing_direction", "BG_EVENT_PLAYER_FACING_ANY");
|
||||
event->put("script_label", "NULL");
|
||||
return event;
|
||||
}
|
||||
|
||||
Event* Event::createNewHiddenItemEvent()
|
||||
{
|
||||
Event *event = new Event;
|
||||
event->put("event_group_type", "bg_event_group");
|
||||
event->put("event_type", EventType::HiddenItem);
|
||||
event->put("item", "ITEM_POTION");
|
||||
event->put("flag", "FLAG_HIDDEN_ITEM_0");
|
||||
return event;
|
||||
}
|
||||
|
||||
Event* Event::createNewSecretBaseEvent()
|
||||
{
|
||||
Event *event = new Event;
|
||||
event->put("event_group_type", "bg_event_group");
|
||||
event->put("event_type", EventType::SecretBase);
|
||||
event->put("secret_base_id", "SECRET_BASE_RED_CAVE2_1");
|
||||
return event;
|
||||
}
|
||||
|
||||
int Event::getPixelX()
|
||||
{
|
||||
return (this->x() * 16) - qMax(0, (this->spriteWidth - 16) / 2);
|
||||
}
|
||||
|
||||
int Event::getPixelY()
|
||||
{
|
||||
return (this->y() * 16) - qMax(0, this->spriteHeight - 16);
|
||||
}
|
||||
|
||||
QString Event::buildObjectEventMacro(int item_index)
|
||||
{
|
||||
int radius_x = this->getInt("radius_x");
|
||||
int radius_y = this->getInt("radius_y");
|
||||
uint16_t x = this->getU16("x");
|
||||
uint16_t y = this->getU16("y");
|
||||
|
||||
QString text = "";
|
||||
text += QString("\tobject_event %1").arg(item_index + 1);
|
||||
text += QString(", %1").arg(this->get("sprite"));
|
||||
text += QString(", %1").arg(this->get("replacement"));
|
||||
text += QString(", %1").arg(x);
|
||||
text += QString(", %1").arg(y);
|
||||
text += QString(", %1").arg(this->get("elevation"));
|
||||
text += QString(", %1").arg(this->get("movement_type"));
|
||||
text += QString(", %1").arg(radius_x);
|
||||
text += QString(", %1").arg(radius_y);
|
||||
text += QString(", %1").arg(this->get("is_trainer"));
|
||||
text += QString(", %1").arg(this->get("sight_radius_tree_id"));
|
||||
text += QString(", %1").arg(this->get("script_label"));
|
||||
text += QString(", %1").arg(this->get("event_flag"));
|
||||
text += "\n";
|
||||
return text;
|
||||
}
|
||||
|
||||
QString Event::buildWarpEventMacro(QMap<QString, QString> *mapNamesToMapConstants)
|
||||
{
|
||||
QString text = "";
|
||||
text += QString("\twarp_def %1").arg(this->get("x"));
|
||||
text += QString(", %1").arg(this->get("y"));
|
||||
text += QString(", %1").arg(this->get("elevation"));
|
||||
text += QString(", %1").arg(this->get("destination_warp"));
|
||||
text += QString(", %1").arg(mapNamesToMapConstants->value(this->get("destination_map_name")));
|
||||
text += "\n";
|
||||
return text;
|
||||
}
|
||||
|
||||
HealLocation Event::buildHealLocation()
|
||||
{
|
||||
HealLocation hl;
|
||||
hl.name = this->get("loc_name");
|
||||
try {
|
||||
hl.index = this->get("index").toInt();
|
||||
}
|
||||
catch(...) {
|
||||
hl.index = 0;
|
||||
}
|
||||
hl.x = this->getU16("x");
|
||||
hl.y = this->getU16("y");
|
||||
return hl;
|
||||
}
|
||||
|
||||
QString Event::buildCoordScriptEventMacro()
|
||||
{
|
||||
QString text = "";
|
||||
text += QString("\tcoord_event %1").arg(this->get("x"));
|
||||
text += QString(", %1").arg(this->get("y"));
|
||||
text += QString(", %1").arg(this->get("elevation"));
|
||||
text += QString(", %1").arg(this->get("script_var"));
|
||||
text += QString(", %1").arg(this->get("script_var_value"));
|
||||
text += QString(", %1").arg(this->get("script_label"));
|
||||
text += "\n";
|
||||
return text;
|
||||
}
|
||||
|
||||
QString Event::buildCoordWeatherEventMacro()
|
||||
{
|
||||
QString text = "";
|
||||
text += QString("\tcoord_weather_event %1").arg(this->get("x"));
|
||||
text += QString(", %1").arg(this->get("y"));
|
||||
text += QString(", %1").arg(this->get("elevation"));
|
||||
text += QString(", %1").arg(this->get("weather"));
|
||||
text += "\n";
|
||||
return text;
|
||||
}
|
||||
|
||||
QString Event::buildSignEventMacro()
|
||||
{
|
||||
QString text = "";
|
||||
text += QString("\tbg_event %1").arg(this->get("x"));
|
||||
text += QString(", %1").arg(this->get("y"));
|
||||
text += QString(", %1").arg(this->get("elevation"));
|
||||
text += QString(", %1").arg(this->get("player_facing_direction"));
|
||||
text += QString(", %1").arg(this->get("script_label"));
|
||||
text += "\n";
|
||||
return text;
|
||||
}
|
||||
|
||||
QString Event::buildHiddenItemEventMacro()
|
||||
{
|
||||
QString text = "";
|
||||
text += QString("\tbg_hidden_item_event %1").arg(this->get("x"));
|
||||
text += QString(", %1").arg(this->get("y"));
|
||||
text += QString(", %1").arg(this->get("elevation"));
|
||||
text += QString(", %1").arg(this->get("item"));
|
||||
text += QString(", %1").arg(this->get("flag"));
|
||||
text += "\n";
|
||||
return text;
|
||||
}
|
||||
|
||||
QString Event::buildSecretBaseEventMacro()
|
||||
{
|
||||
QString text = "";
|
||||
text += QString("\tbg_secret_base_event %1").arg(this->get("x"));
|
||||
text += QString(", %1").arg(this->get("y"));
|
||||
text += QString(", %1").arg(this->get("elevation"));
|
||||
text += QString(", %1").arg(this->get("secret_base_id"));
|
||||
text += "\n";
|
||||
return text;
|
||||
}
|
||||
|
||||
void Event::setPixmapFromSpritesheet(QImage spritesheet, int spriteWidth, int spriteHeight)
|
||||
{
|
||||
// Set first palette color fully transparent.
|
||||
QImage img = spritesheet.copy(0, 0, spriteWidth, spriteHeight);
|
||||
img.setColor(0, qRgba(0, 0, 0, 0));
|
||||
pixmap = QPixmap::fromImage(img);
|
||||
this->spriteWidth = spriteWidth;
|
||||
this->spriteHeight = spriteHeight;
|
||||
}
|
||||
#include "event.h"
|
||||
#include "map.h"
|
||||
|
||||
QString EventType::Object = "event_object";
|
||||
QString EventType::Warp = "event_warp";
|
||||
QString EventType::CoordScript = "event_trap";
|
||||
QString EventType::CoordWeather = "event_trap_weather";
|
||||
QString EventType::Sign = "event_sign";
|
||||
QString EventType::HiddenItem = "event_hidden_item";
|
||||
QString EventType::SecretBase = "event_secret_base";
|
||||
QString EventType::HealLocation = "event_heal_location";
|
||||
|
||||
Event::Event()
|
||||
{
|
||||
this->spriteWidth = 16;
|
||||
this->spriteHeight = 16;
|
||||
}
|
||||
|
||||
Event* Event::createNewEvent(QString event_type, QString map_name)
|
||||
{
|
||||
Event *event = new Event;
|
||||
if (event_type == EventType::Object) {
|
||||
event = createNewObjectEvent();
|
||||
} else if (event_type == EventType::Warp) {
|
||||
event = createNewWarpEvent(map_name);
|
||||
} else if (event_type == EventType::HealLocation) {
|
||||
event = createNewHealLocationEvent(map_name);
|
||||
} else if (event_type == EventType::CoordScript) {
|
||||
event = createNewCoordScriptEvent();
|
||||
} else if (event_type == EventType::CoordWeather) {
|
||||
event = createNewCoordWeatherEvent();
|
||||
} else if (event_type == EventType::Sign) {
|
||||
event = createNewSignEvent();
|
||||
} else if (event_type == EventType::HiddenItem) {
|
||||
event = createNewHiddenItemEvent();
|
||||
} else if (event_type == EventType::SecretBase) {
|
||||
event = createNewSecretBaseEvent();
|
||||
}
|
||||
|
||||
event->setX(0);
|
||||
event->setY(0);
|
||||
event->put("elevation", 3);
|
||||
return event;
|
||||
}
|
||||
|
||||
Event* Event::createNewObjectEvent()
|
||||
{
|
||||
Event *event = new Event;
|
||||
event->put("event_group_type", "object_event_group");
|
||||
event->put("event_type", EventType::Object);
|
||||
event->put("sprite", "EVENT_OBJ_GFX_BOY_1");
|
||||
event->put("movement_type", "MOVEMENT_TYPE_LOOK_AROUND");
|
||||
event->put("radius_x", 0);
|
||||
event->put("radius_y", 0);
|
||||
event->put("script_label", "NULL");
|
||||
event->put("event_flag", "0");
|
||||
event->put("replacement", "0");
|
||||
event->put("is_trainer", "FALSE");
|
||||
event->put("sight_radius_tree_id", 0);
|
||||
return event;
|
||||
}
|
||||
|
||||
Event* Event::createNewWarpEvent(QString map_name)
|
||||
{
|
||||
Event *event = new Event;
|
||||
event->put("event_group_type", "warp_event_group");
|
||||
event->put("event_type", EventType::Warp);
|
||||
event->put("destination_warp", 0);
|
||||
event->put("destination_map_name", map_name);
|
||||
return event;
|
||||
}
|
||||
|
||||
Event* Event::createNewHealLocationEvent(QString map_name)
|
||||
{
|
||||
Event *event = new Event;
|
||||
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));
|
||||
return event;
|
||||
}
|
||||
|
||||
Event* Event::createNewCoordScriptEvent()
|
||||
{
|
||||
Event *event = new Event;
|
||||
event->put("event_group_type", "coord_event_group");
|
||||
event->put("event_type", EventType::CoordScript);
|
||||
event->put("script_label", "NULL");
|
||||
event->put("script_var", "VAR_TEMP_0");
|
||||
event->put("script_var_value", "0");
|
||||
return event;
|
||||
}
|
||||
|
||||
Event* Event::createNewCoordWeatherEvent()
|
||||
{
|
||||
Event *event = new Event;
|
||||
event->put("event_group_type", "coord_event_group");
|
||||
event->put("event_type", EventType::CoordWeather);
|
||||
event->put("weather", "COORD_EVENT_WEATHER_SUNNY");
|
||||
return event;
|
||||
}
|
||||
|
||||
Event* Event::createNewSignEvent()
|
||||
{
|
||||
Event *event = new Event;
|
||||
event->put("event_group_type", "bg_event_group");
|
||||
event->put("event_type", EventType::Sign);
|
||||
event->put("player_facing_direction", "BG_EVENT_PLAYER_FACING_ANY");
|
||||
event->put("script_label", "NULL");
|
||||
return event;
|
||||
}
|
||||
|
||||
Event* Event::createNewHiddenItemEvent()
|
||||
{
|
||||
Event *event = new Event;
|
||||
event->put("event_group_type", "bg_event_group");
|
||||
event->put("event_type", EventType::HiddenItem);
|
||||
event->put("item", "ITEM_POTION");
|
||||
event->put("flag", "FLAG_HIDDEN_ITEM_0");
|
||||
return event;
|
||||
}
|
||||
|
||||
Event* Event::createNewSecretBaseEvent()
|
||||
{
|
||||
Event *event = new Event;
|
||||
event->put("event_group_type", "bg_event_group");
|
||||
event->put("event_type", EventType::SecretBase);
|
||||
event->put("secret_base_id", "SECRET_BASE_RED_CAVE2_1");
|
||||
return event;
|
||||
}
|
||||
|
||||
int Event::getPixelX()
|
||||
{
|
||||
return (this->x() * 16) - qMax(0, (this->spriteWidth - 16) / 2);
|
||||
}
|
||||
|
||||
int Event::getPixelY()
|
||||
{
|
||||
return (this->y() * 16) - qMax(0, this->spriteHeight - 16);
|
||||
}
|
||||
|
||||
QString Event::buildObjectEventMacro(int item_index)
|
||||
{
|
||||
int radius_x = this->getInt("radius_x");
|
||||
int radius_y = this->getInt("radius_y");
|
||||
uint16_t x = this->getU16("x");
|
||||
uint16_t y = this->getU16("y");
|
||||
|
||||
QString text = "";
|
||||
text += QString("\tobject_event %1").arg(item_index + 1);
|
||||
text += QString(", %1").arg(this->get("sprite"));
|
||||
text += QString(", %1").arg(this->get("replacement"));
|
||||
text += QString(", %1").arg(x);
|
||||
text += QString(", %1").arg(y);
|
||||
text += QString(", %1").arg(this->get("elevation"));
|
||||
text += QString(", %1").arg(this->get("movement_type"));
|
||||
text += QString(", %1").arg(radius_x);
|
||||
text += QString(", %1").arg(radius_y);
|
||||
text += QString(", %1").arg(this->get("is_trainer"));
|
||||
text += QString(", %1").arg(this->get("sight_radius_tree_id"));
|
||||
text += QString(", %1").arg(this->get("script_label"));
|
||||
text += QString(", %1").arg(this->get("event_flag"));
|
||||
text += "\n";
|
||||
return text;
|
||||
}
|
||||
|
||||
QString Event::buildWarpEventMacro(QMap<QString, QString> *mapNamesToMapConstants)
|
||||
{
|
||||
QString text = "";
|
||||
text += QString("\twarp_def %1").arg(this->get("x"));
|
||||
text += QString(", %1").arg(this->get("y"));
|
||||
text += QString(", %1").arg(this->get("elevation"));
|
||||
text += QString(", %1").arg(this->get("destination_warp"));
|
||||
text += QString(", %1").arg(mapNamesToMapConstants->value(this->get("destination_map_name")));
|
||||
text += "\n";
|
||||
return text;
|
||||
}
|
||||
|
||||
HealLocation Event::buildHealLocation()
|
||||
{
|
||||
HealLocation hl;
|
||||
hl.name = this->get("loc_name");
|
||||
try {
|
||||
hl.index = this->get("index").toInt();
|
||||
}
|
||||
catch(...) {
|
||||
hl.index = 0;
|
||||
}
|
||||
hl.x = this->getU16("x");
|
||||
hl.y = this->getU16("y");
|
||||
return hl;
|
||||
}
|
||||
|
||||
QString Event::buildCoordScriptEventMacro()
|
||||
{
|
||||
QString text = "";
|
||||
text += QString("\tcoord_event %1").arg(this->get("x"));
|
||||
text += QString(", %1").arg(this->get("y"));
|
||||
text += QString(", %1").arg(this->get("elevation"));
|
||||
text += QString(", %1").arg(this->get("script_var"));
|
||||
text += QString(", %1").arg(this->get("script_var_value"));
|
||||
text += QString(", %1").arg(this->get("script_label"));
|
||||
text += "\n";
|
||||
return text;
|
||||
}
|
||||
|
||||
QString Event::buildCoordWeatherEventMacro()
|
||||
{
|
||||
QString text = "";
|
||||
text += QString("\tcoord_weather_event %1").arg(this->get("x"));
|
||||
text += QString(", %1").arg(this->get("y"));
|
||||
text += QString(", %1").arg(this->get("elevation"));
|
||||
text += QString(", %1").arg(this->get("weather"));
|
||||
text += "\n";
|
||||
return text;
|
||||
}
|
||||
|
||||
QString Event::buildSignEventMacro()
|
||||
{
|
||||
QString text = "";
|
||||
text += QString("\tbg_event %1").arg(this->get("x"));
|
||||
text += QString(", %1").arg(this->get("y"));
|
||||
text += QString(", %1").arg(this->get("elevation"));
|
||||
text += QString(", %1").arg(this->get("player_facing_direction"));
|
||||
text += QString(", %1").arg(this->get("script_label"));
|
||||
text += "\n";
|
||||
return text;
|
||||
}
|
||||
|
||||
QString Event::buildHiddenItemEventMacro()
|
||||
{
|
||||
QString text = "";
|
||||
text += QString("\tbg_hidden_item_event %1").arg(this->get("x"));
|
||||
text += QString(", %1").arg(this->get("y"));
|
||||
text += QString(", %1").arg(this->get("elevation"));
|
||||
text += QString(", %1").arg(this->get("item"));
|
||||
text += QString(", %1").arg(this->get("flag"));
|
||||
text += "\n";
|
||||
return text;
|
||||
}
|
||||
|
||||
QString Event::buildSecretBaseEventMacro()
|
||||
{
|
||||
QString text = "";
|
||||
text += QString("\tbg_secret_base_event %1").arg(this->get("x"));
|
||||
text += QString(", %1").arg(this->get("y"));
|
||||
text += QString(", %1").arg(this->get("elevation"));
|
||||
text += QString(", %1").arg(this->get("secret_base_id"));
|
||||
text += "\n";
|
||||
return text;
|
||||
}
|
||||
|
||||
void Event::setPixmapFromSpritesheet(QImage spritesheet, int spriteWidth, int spriteHeight)
|
||||
{
|
||||
// Set first palette color fully transparent.
|
||||
QImage img = spritesheet.copy(0, 0, spriteWidth, spriteHeight);
|
||||
img.setColor(0, qRgba(0, 0, 0, 0));
|
||||
pixmap = QPixmap::fromImage(img);
|
||||
this->spriteWidth = spriteWidth;
|
||||
this->spriteHeight = spriteHeight;
|
||||
}
|
174
event.h → core/event.h
Executable file → Normal file
174
event.h → core/event.h
Executable file → Normal file
|
@ -1,87 +1,87 @@
|
|||
#ifndef EVENT_H
|
||||
#define EVENT_H
|
||||
|
||||
#include "core/heallocation.h"
|
||||
#include <QString>
|
||||
#include <QPixmap>
|
||||
#include <QMap>
|
||||
#include <QDebug>
|
||||
|
||||
class EventType
|
||||
{
|
||||
public:
|
||||
static QString Object;
|
||||
static QString Warp;
|
||||
static QString CoordScript;
|
||||
static QString CoordWeather;
|
||||
static QString Sign;
|
||||
static QString HiddenItem;
|
||||
static QString SecretBase;
|
||||
static QString HealLocation;
|
||||
};
|
||||
|
||||
class Event
|
||||
{
|
||||
public:
|
||||
Event();
|
||||
public:
|
||||
int x() {
|
||||
return getInt("x");
|
||||
}
|
||||
int y() {
|
||||
return getInt("y");
|
||||
}
|
||||
int elevation() {
|
||||
return getInt("elevation");
|
||||
}
|
||||
void setX(int x) {
|
||||
put("x", x);
|
||||
}
|
||||
void setY(int y) {
|
||||
put("y", y);
|
||||
}
|
||||
QString get(QString key) {
|
||||
return values.value(key);
|
||||
}
|
||||
int getInt(QString key) {
|
||||
return values.value(key).toInt(nullptr, 0);
|
||||
}
|
||||
uint16_t getU16(QString key) {
|
||||
return values.value(key).toUShort(nullptr, 0);
|
||||
}
|
||||
void put(QString key, int value) {
|
||||
put(key, QString("%1").arg(value));
|
||||
}
|
||||
void put(QString key, QString value) {
|
||||
values.insert(key, value);
|
||||
}
|
||||
|
||||
static Event* createNewEvent(QString, QString);
|
||||
static Event* createNewObjectEvent();
|
||||
static Event* createNewWarpEvent(QString);
|
||||
static Event* createNewHealLocationEvent(QString);
|
||||
static Event* createNewCoordScriptEvent();
|
||||
static Event* createNewCoordWeatherEvent();
|
||||
static Event* createNewSignEvent();
|
||||
static Event* createNewHiddenItemEvent();
|
||||
static Event* createNewSecretBaseEvent();
|
||||
|
||||
QString buildObjectEventMacro(int);
|
||||
QString buildWarpEventMacro(QMap<QString, QString>*);
|
||||
HealLocation buildHealLocation();
|
||||
QString buildCoordScriptEventMacro();
|
||||
QString buildCoordWeatherEventMacro();
|
||||
QString buildSignEventMacro();
|
||||
QString buildHiddenItemEventMacro();
|
||||
QString buildSecretBaseEventMacro();
|
||||
void setPixmapFromSpritesheet(QImage, int, int);
|
||||
int getPixelX();
|
||||
int getPixelY();
|
||||
|
||||
QMap<QString, QString> values;
|
||||
QPixmap pixmap;
|
||||
int spriteWidth;
|
||||
int spriteHeight;
|
||||
};
|
||||
|
||||
#endif // EVENT_H
|
||||
#ifndef EVENT_H
|
||||
#define EVENT_H
|
||||
|
||||
#include "heallocation.h"
|
||||
#include <QString>
|
||||
#include <QPixmap>
|
||||
#include <QMap>
|
||||
#include <QDebug>
|
||||
|
||||
class EventType
|
||||
{
|
||||
public:
|
||||
static QString Object;
|
||||
static QString Warp;
|
||||
static QString CoordScript;
|
||||
static QString CoordWeather;
|
||||
static QString Sign;
|
||||
static QString HiddenItem;
|
||||
static QString SecretBase;
|
||||
static QString HealLocation;
|
||||
};
|
||||
|
||||
class Event
|
||||
{
|
||||
public:
|
||||
Event();
|
||||
public:
|
||||
int x() {
|
||||
return getInt("x");
|
||||
}
|
||||
int y() {
|
||||
return getInt("y");
|
||||
}
|
||||
int elevation() {
|
||||
return getInt("elevation");
|
||||
}
|
||||
void setX(int x) {
|
||||
put("x", x);
|
||||
}
|
||||
void setY(int y) {
|
||||
put("y", y);
|
||||
}
|
||||
QString get(QString key) {
|
||||
return values.value(key);
|
||||
}
|
||||
int getInt(QString key) {
|
||||
return values.value(key).toInt(nullptr, 0);
|
||||
}
|
||||
uint16_t getU16(QString key) {
|
||||
return values.value(key).toUShort(nullptr, 0);
|
||||
}
|
||||
void put(QString key, int value) {
|
||||
put(key, QString("%1").arg(value));
|
||||
}
|
||||
void put(QString key, QString value) {
|
||||
values.insert(key, value);
|
||||
}
|
||||
|
||||
static Event* createNewEvent(QString, QString);
|
||||
static Event* createNewObjectEvent();
|
||||
static Event* createNewWarpEvent(QString);
|
||||
static Event* createNewHealLocationEvent(QString);
|
||||
static Event* createNewCoordScriptEvent();
|
||||
static Event* createNewCoordWeatherEvent();
|
||||
static Event* createNewSignEvent();
|
||||
static Event* createNewHiddenItemEvent();
|
||||
static Event* createNewSecretBaseEvent();
|
||||
|
||||
QString buildObjectEventMacro(int);
|
||||
QString buildWarpEventMacro(QMap<QString, QString>*);
|
||||
HealLocation buildHealLocation();
|
||||
QString buildCoordScriptEventMacro();
|
||||
QString buildCoordWeatherEventMacro();
|
||||
QString buildSignEventMacro();
|
||||
QString buildHiddenItemEventMacro();
|
||||
QString buildSecretBaseEventMacro();
|
||||
void setPixmapFromSpritesheet(QImage, int, int);
|
||||
int getPixelX();
|
||||
int getPixelY();
|
||||
|
||||
QMap<QString, QString> values;
|
||||
QPixmap pixmap;
|
||||
int spriteWidth;
|
||||
int spriteHeight;
|
||||
};
|
||||
|
||||
#endif // EVENT_H
|
|
@ -1,6 +1,6 @@
|
|||
#include "core/metatile.h"
|
||||
#include "metatile.h"
|
||||
#include "tileset.h"
|
||||
#include "project.h"
|
||||
#include "core/tileset.h"
|
||||
|
||||
Metatile::Metatile()
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef PARSEUTIL_H
|
||||
#define PARSEUTIL_H
|
||||
|
||||
#include "core/heallocation.h"
|
||||
#include "heallocation.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "core/tile.h"
|
||||
#include "tile.h"
|
||||
|
||||
Tile::Tile()
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "core/tileset.h"
|
||||
#include "core/metatile.h"
|
||||
#include "tileset.h"
|
||||
#include "metatile.h"
|
||||
#include "project.h"
|
||||
|
||||
#include <QPainter>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef TILESET_H
|
||||
#define TILESET_H
|
||||
|
||||
#include "core/metatile.h"
|
||||
#include "core/tile.h"
|
||||
#include "metatile.h"
|
||||
#include "tile.h"
|
||||
#include <QImage>
|
||||
|
||||
class Tileset
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "editor.h"
|
||||
#include "event.h"
|
||||
#include "core/mapconnection.h"
|
||||
#include "mapconnection.h"
|
||||
#include <QCheckBox>
|
||||
#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
|
|
6
editor.h
6
editor.h
|
@ -9,9 +9,9 @@
|
|||
#include <QCheckBox>
|
||||
#include <QCursor>
|
||||
|
||||
#include "core/mapconnection.h"
|
||||
#include "ui/metatileselector.h"
|
||||
#include "ui/movementpermissionsselector.h"
|
||||
#include "mapconnection.h"
|
||||
#include "metatileselector.h"
|
||||
#include "movementpermissionsselector.h"
|
||||
#include "project.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "ui_mainwindow.h"
|
||||
#include "project.h"
|
||||
#include "editor.h"
|
||||
#include "ui/eventpropertiesframe.h"
|
||||
#include "eventpropertiesframe.h"
|
||||
#include "ui_objectpropertiesframe.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
|
4
map.cpp
4
map.cpp
|
@ -1,5 +1,5 @@
|
|||
#include "core/history.h"
|
||||
#include "core/historyitem.h"
|
||||
#include "history.h"
|
||||
#include "historyitem.h"
|
||||
#include "map.h"
|
||||
#include "project.h"
|
||||
|
||||
|
|
12
map.h
12
map.h
|
@ -1,12 +1,12 @@
|
|||
#ifndef MAP_H
|
||||
#define MAP_H
|
||||
|
||||
#include "core/blockdata.h"
|
||||
#include "core/history.h"
|
||||
#include "core/historyitem.h"
|
||||
#include "core/mapconnection.h"
|
||||
#include "core/maplayout.h"
|
||||
#include "core/tileset.h"
|
||||
#include "blockdata.h"
|
||||
#include "history.h"
|
||||
#include "historyitem.h"
|
||||
#include "mapconnection.h"
|
||||
#include "maplayout.h"
|
||||
#include "tileset.h"
|
||||
#include "event.h"
|
||||
|
||||
#include <QPixmap>
|
||||
|
|
|
@ -16,6 +16,7 @@ ICON = resources/icons/porymap-icon-1.ico
|
|||
|
||||
SOURCES += core/block.cpp \
|
||||
core/blockdata.cpp \
|
||||
core/event.cpp \
|
||||
core/heallocation.cpp \
|
||||
core/historyitem.cpp \
|
||||
core/maplayout.cpp \
|
||||
|
@ -31,7 +32,6 @@ SOURCES += core/block.cpp \
|
|||
ui/noscrollspinbox.cpp \
|
||||
ui/selectablepixmapitem.cpp \
|
||||
editor.cpp \
|
||||
event.cpp \
|
||||
graphicsview.cpp \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
|
@ -40,6 +40,7 @@ SOURCES += core/block.cpp \
|
|||
|
||||
HEADERS += core/block.h \
|
||||
core/blockdata.h \
|
||||
core/event.h \
|
||||
core/heallocation.h \
|
||||
core/history.h \
|
||||
core/historyitem.h \
|
||||
|
@ -57,7 +58,6 @@ HEADERS += core/block.h \
|
|||
ui/noscrollspinbox.h \
|
||||
ui/selectablepixmapitem.h \
|
||||
editor.h \
|
||||
event.h \
|
||||
graphicsview.h \
|
||||
mainwindow.h \
|
||||
map.h \
|
||||
|
|
10
project.cpp
10
project.cpp
|
@ -1,9 +1,9 @@
|
|||
#include "project.h"
|
||||
#include "core/history.h"
|
||||
#include "core/historyitem.h"
|
||||
#include "core/parseutil.h"
|
||||
#include "core/tile.h"
|
||||
#include "core/tileset.h"
|
||||
#include "history.h"
|
||||
#include "historyitem.h"
|
||||
#include "parseutil.h"
|
||||
#include "tile.h"
|
||||
#include "tileset.h"
|
||||
#include "event.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#define PROJECT_H
|
||||
|
||||
#include "map.h"
|
||||
#include "core/blockdata.h"
|
||||
#include "core/heallocation.h"
|
||||
#include "blockdata.h"
|
||||
#include "heallocation.h"
|
||||
|
||||
#include <QStringList>
|
||||
#include <QList>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define METATILESELECTOR_H
|
||||
|
||||
#include "selectablepixmapitem.h"
|
||||
#include "core/tileset.h"
|
||||
#include "tileset.h"
|
||||
|
||||
class MetatileSelector: public SelectablePixmapItem {
|
||||
Q_OBJECT
|
||||
|
|
Loading…
Reference in a new issue