From 7c43158af1abf38fa896a442cb3c6d8a5bc630e7 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Sun, 14 Oct 2012 20:00:30 +0200 Subject: [PATCH] moved map data to maps.l2s --- src/loader/Caster.cpp | 6 + src/loader/Caster.h | 3 + src/loader/Interpreter.cpp | 21 ++- src/loader/Interpreter.h | 2 +- src/loader/Parser.cpp | 5 +- src/main.cpp | 326 ++----------------------------------- src/map/Area.cpp | 24 +++ src/map/Area.h | 3 + src/map/Entity.cpp | 5 + src/map/Entity.h | 3 + src/map/Map.cpp | 30 ++++ src/map/Map.h | 10 +- src/map/MapState.cpp | 1 + src/map/Tile.cpp | 27 +++ src/map/Tile.h | 5 +- src/map/Trigger.cpp | 26 +++ src/map/Trigger.h | 9 +- test-data/constants.l2h | 19 +++ test-data/constants.l2s | 19 +++ test-data/maps.l2s | 291 +++++++++++++++++++++++++++++++++ 20 files changed, 499 insertions(+), 336 deletions(-) create mode 100644 test-data/maps.l2s diff --git a/src/loader/Caster.cpp b/src/loader/Caster.cpp index 6d6d718..152c8b2 100644 --- a/src/loader/Caster.cpp +++ b/src/loader/Caster.cpp @@ -14,6 +14,7 @@ using battle::PartyLayout; using common::Hero; using common::Item; using common::Spell; +using map::Map; using std::string; @@ -24,6 +25,7 @@ Caster::Caster(Interpreter &intp) , battleResourcesId(TypeDescription::GetTypeId("BattleResources")) , heroId(TypeDescription::GetTypeId("Hero")) , itemId(TypeDescription::GetTypeId("Item")) +, mapId(TypeDescription::GetTypeId("Map")) , monsterId(TypeDescription::GetTypeId("Monster")) , partyLayoutId(TypeDescription::GetTypeId("PartyLayout")) , spellId(TypeDescription::GetTypeId("Spell")) { @@ -43,6 +45,10 @@ Item *Caster::GetItem(const string &ident) { return reinterpret_cast(intp.GetObject(itemId, ident)); } +Map *Caster::GetMap(const string &ident) { + return reinterpret_cast(intp.GetObject(mapId, ident)); +} + Monster *Caster::GetMonster(const string &ident) { return reinterpret_cast(intp.GetObject(monsterId, ident)); } diff --git a/src/loader/Caster.h b/src/loader/Caster.h index a3042ac..80e765e 100644 --- a/src/loader/Caster.h +++ b/src/loader/Caster.h @@ -11,6 +11,7 @@ #include "Interpreter.h" #include "../battle/fwd.h" #include "../common/fwd.h" +#include "../map/fwd.h" #include @@ -29,6 +30,7 @@ public: battle::Resources *GetBattleResources(const std::string &identifier); common::Hero *GetHero(const std::string &identifier); common::Item *GetItem(const std::string &identifier); + map::Map *GetMap(const std::string &identifier); battle::Monster *GetMonster(const std::string &identifier); battle::PartyLayout *GetPartyLayout(const std::string &identifier); common::Spell *GetSpell(const std::string &identifier); @@ -39,6 +41,7 @@ private: int battleResourcesId; int heroId; int itemId; + int mapId; int monsterId; int partyLayoutId; int spellId; diff --git a/src/loader/Interpreter.cpp b/src/loader/Interpreter.cpp index c2ce0d4..0fd2d88 100644 --- a/src/loader/Interpreter.cpp +++ b/src/loader/Interpreter.cpp @@ -62,8 +62,16 @@ Interpreter::~Interpreter() { } -const Interpreter::ParsedDefinition &Interpreter::GetDefinition(const string &identifier) const { - return parsedDefinitions.at(identifier); +const Interpreter::ParsedDefinition &Interpreter::GetDefinition(const string &identifier) { + std::map::const_iterator i(parsedDefinitions.find(identifier)); + if (i != parsedDefinitions.end()) { + return i->second; + } else if (source.IsDefined(identifier)) { + ReadDefinition(source.GetDefinition(identifier)); + return parsedDefinitions.at(identifier); + } else { + throw Error("access to undefined object " + identifier); + } } @@ -114,13 +122,13 @@ void Interpreter::ReadLiteral(const Definition &dfn) { || dfn.GetLiteral()->GetType() == Literal::STRING) ? dfn.GetLiteral()->GetString().size() : td.Size()); char *object(alloc.Alloc(size)); + values[typeId].push_back(object); + parsedDefinitions.insert(make_pair(dfn.Identifier(), ParsedDefinition(&dfn, typeId, id))); if (dfn.GetLiteral()->GetType() == Literal::OBJECT) { ReadObject(typeId, id, object, *dfn.GetLiteral()->GetProperties()); } else { ReadLiteral(typeId, id, object, *dfn.GetLiteral()); } - values[typeId].push_back(object); - parsedDefinitions.insert(make_pair(dfn.Identifier(), ParsedDefinition(&dfn, typeId, id))); } void Interpreter::ReadLiteral(int typeId, int id, char *object, const Literal &literal) { @@ -221,8 +229,9 @@ void *Interpreter::GetObject(int typeId, const Value &v) { case Literal::SCRIPT: { typeId = TypeDescription::GetTypeId("Script"); + char *script(ReadScript(v.GetLiteral().GetScript())); id = values[typeId].size(); - values[typeId].push_back(ReadScript(v.GetLiteral().GetScript())); + values[typeId].push_back(script); } break; case Literal::STRING: @@ -271,8 +280,8 @@ void Interpreter::ReadObject(const Definition &dfn) { char *object(alloc.Alloc(td.Size())); td.Construct(object); values[typeId].push_back(object); - ReadObject(typeId, id, object, *dfn.GetProperties()); parsedDefinitions.insert(make_pair(dfn.Identifier(), ParsedDefinition(&dfn, typeId, id))); + ReadObject(typeId, id, object, *dfn.GetProperties()); } diff --git a/src/loader/Interpreter.h b/src/loader/Interpreter.h index 5fbded6..9795a60 100644 --- a/src/loader/Interpreter.h +++ b/src/loader/Interpreter.h @@ -67,7 +67,7 @@ public: }; const std::set &ExportedIdentifiers() const { return source.Exports(); } - const ParsedDefinition &GetDefinition(const std::string &identifier) const; + const ParsedDefinition &GetDefinition(const std::string &identifier); const std::map &Images() const { return imageCache; } const std::vector &PostponedDefinitions() const { return postponedDefinitions; } const std::map > &Values() const { return values; } diff --git a/src/loader/Parser.cpp b/src/loader/Parser.cpp index 8ba3704..9ddae34 100644 --- a/src/loader/Parser.cpp +++ b/src/loader/Parser.cpp @@ -355,6 +355,7 @@ Literal *Parser::ParseScript() { Token t(GetToken()); AssertTokenType(t.type, Token::SCRIPT_BEGIN, msg); + t = GetToken(); vector script; try { while (t.type != Token::SCRIPT_END) { @@ -365,7 +366,7 @@ Literal *Parser::ParseScript() { switch (t.type) { case Token::COMMAND: { Token t2(GetToken()); - AssertTokenType(t.type, Token::IDENTIFIER, msg); + AssertTokenType(t2.type, Token::IDENTIFIER, msg); script.push_back(new ScriptToken(t2.str, ScriptToken::COMMAND)); break; } @@ -375,7 +376,7 @@ Literal *Parser::ParseScript() { } case Token::REGISTER: { Token t2(GetToken()); - AssertTokenType(t.type, Token::IDENTIFIER, msg); + AssertTokenType(t2.type, Token::IDENTIFIER, msg); script.push_back(new ScriptToken(t2.str, ScriptToken::REGISTER)); break; } diff --git a/src/main.cpp b/src/main.cpp index a8a7225..40b38f1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -103,7 +103,6 @@ int main(int argc, char **argv) { const int width = 800; const int height = 480; - const int tileSize = 32; const float walkSpeed = 128.0f; bool battle(false); @@ -114,6 +113,7 @@ int main(int argc, char **argv) { InitSDL sdl; InitImage image(IMG_INIT_PNG); + Area::CreateTypeDescription(); battle::Resources::CreateTypeDescription(); ComplexAnimation::CreateTypeDescription(); Font::CreateTypeDescription(); @@ -123,6 +123,7 @@ int main(int argc, char **argv) { Ikari::CreateTypeDescription(); Interpreter::CreateTypeDescriptions(); Item::CreateTypeDescription(); + Map::CreateTypeDescription(); graphics::MenuProperties::CreateTypeDescription(); Monster::CreateTypeDescription(); PartyLayout::CreateTypeDescription(); @@ -131,6 +132,8 @@ int main(int argc, char **argv) { Sprite::CreateTypeDescription(); Stats::CreateTypeDescription(); common::TargetingMode::CreateTypeDescription(); + Tile::CreateTypeDescription(); + Trigger::CreateTypeDescription(); Entity::CreateTypeDescription(); Arguments args; @@ -186,6 +189,12 @@ int main(int argc, char **argv) { Caster caster(intp); + { + Map *map1(caster.GetMap("map1")); + Map *map2(caster.GetMap("map2")); + std::cout << map1 << ' ' << map2 << std::endl; + } + GameState gameState; gameState.heroes[0] = *caster.GetHero("maxim"); @@ -263,301 +272,6 @@ int main(int argc, char **argv) { gameState.heroes[3].SetRing(caster.GetItem("rocketRingItem")); gameState.heroes[3].SetJewel(caster.GetItem("krakenRockItem")); - Tile tiles1[64]; - - tiles1[ 0].SetOffset(Vector(2, 1)); - tiles1[ 1].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_NORTH | Tile::BLOCK_WEST); - tiles1[ 2].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH); - tiles1[ 3].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH | Tile::BLOCK_EAST); - tiles1[ 4].SetOffset(Vector(0, 1)); - tiles1[ 5].SetOffset(Vector(2, 0)); - tiles1[ 6].SetOffset(Vector(2, 0)); - tiles1[ 7].SetOffset(Vector(2, 0)); - - tiles1[ 8].SetOffset(Vector(2, 1)); - tiles1[ 9].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_WEST); - tiles1[10].SetOffset(Vector(3, 0)); - tiles1[11].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_EAST); - tiles1[12].SetOffset(Vector(0, 2)); - tiles1[13].SetOffset(Vector(1, 2)); - tiles1[14].SetOffset(Vector(1, 2)); - tiles1[15].SetOffset(Vector(1, 2)); - - tiles1[16].SetOffset(Vector(2, 1)); - tiles1[17].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_WEST); - tiles1[18].SetOffset(Vector(3, 0)); - tiles1[19].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_EAST); - tiles1[20].SetOffset(Vector(0, 3)); - tiles1[21].SetOffset(Vector(1, 3)); - tiles1[22].SetOffset(Vector(1, 3)); - tiles1[23].SetOffset(Vector(2, 3)); - - tiles1[24].SetOffset(Vector(2, 1)); - tiles1[25].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_WEST); - tiles1[26].SetOffset(Vector(3, 0)); - tiles1[27].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_EAST); - tiles1[28].SetOffset(Vector(0, 4)); - tiles1[29].SetOffset(Vector(1, 4)); - tiles1[30].SetOffset(Vector(1, 4)); - tiles1[31].SetOffset(Vector(2, 4)); - - tiles1[32].SetOffset(Vector(2, 1)); - tiles1[33].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_WEST); - tiles1[34].SetOffset(Vector(3, 0)); - tiles1[35].SetOffset(Vector(3, 0)); - tiles1[36].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH); - tiles1[37].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH); - tiles1[38].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH); - tiles1[39].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH); - - tiles1[40].SetOffset(Vector(2, 1)); - tiles1[41].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_WEST); - tiles1[42].SetOffset(Vector(3, 0)); - tiles1[43].SetOffset(Vector(3, 0)); - tiles1[44].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_SOUTH); - tiles1[45].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_SOUTH); - tiles1[46].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_SOUTH); - tiles1[47].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_SOUTH); - - tiles1[48].SetOffset(Vector(2, 1)); - tiles1[49].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_WEST); - tiles1[50].SetOffset(Vector(3, 0)); - tiles1[51].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_EAST); - tiles1[52].SetOffset(Vector(0, 0)); - tiles1[53].SetOffset(Vector(1, 0)); - tiles1[54].SetOffset(Vector(1, 0)); - tiles1[55].SetOffset(Vector(1, 0)); - - tiles1[56].SetOffset(Vector(2, 1)); - tiles1[57].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_SOUTH | Tile::BLOCK_WEST); - tiles1[58].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_SOUTH); - tiles1[59].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_SOUTH | Tile::BLOCK_EAST); - tiles1[60].SetOffset(Vector(0, 1)); - tiles1[61].SetOffset(Vector(1, 1)); - tiles1[62].SetOffset(Vector(1, 1)); - tiles1[63].SetOffset(Vector(1, 1)); - - Tile tiles2[64]; - - tiles2[ 0].SetOffset(Vector(2, 0)); - tiles2[ 1].SetOffset(Vector(2, 0)); - tiles2[ 2].SetOffset(Vector(2, 0)); - tiles2[ 3].SetOffset(Vector(2, 0)); - tiles2[ 4].SetOffset(Vector(2, 0)); - tiles2[ 5].SetOffset(Vector(2, 0)); - tiles2[ 6].SetOffset(Vector(2, 0)); - tiles2[ 7].SetOffset(Vector(2, 0)); - - tiles2[ 8].SetOffset(Vector(1, 2)); - tiles2[ 9].SetOffset(Vector(1, 2)); - tiles2[10].SetOffset(Vector(5, 3)); - tiles2[11].SetOffset(Vector(2, 0)); - tiles2[12].SetOffset(Vector(2, 0)); - tiles2[13].SetOffset(Vector(2, 0)); - tiles2[14].SetOffset(Vector(2, 0)); - tiles2[15].SetOffset(Vector(2, 0)); - - tiles2[16].SetOffset(Vector(3, 3)); - tiles2[17].SetOffset(Vector(0, 3)); - tiles2[18].SetOffset(Vector(0, 1)); - tiles2[19].SetOffset(Vector(2, 0)); - tiles2[20].SetOffset(Vector(2, 0)); - tiles2[21].SetOffset(Vector(2, 0)); - tiles2[22].SetOffset(Vector(2, 0)); - tiles2[23].SetOffset(Vector(2, 0)); - - tiles2[24].SetOffset(Vector(3, 4)).SetFlags(Tile::BLOCK_NORTH | Tile::BLOCK_EAST | Tile::BLOCK_WEST); - tiles2[25].SetOffset(Vector(0, 4)); - tiles2[26].SetOffset(Vector(0, 1)); - tiles2[27].SetOffset(Vector(2, 0)); - tiles2[28].SetOffset(Vector(2, 0)); - tiles2[29].SetOffset(Vector(2, 0)); - tiles2[30].SetOffset(Vector(2, 0)); - tiles2[31].SetOffset(Vector(2, 0)); - - tiles2[32].SetOffset(Vector(5, 0)); - tiles2[33].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH | Tile::BLOCK_EAST); - tiles2[34].SetOffset(Vector(0, 1)); - tiles2[35].SetOffset(Vector(2, 0)); - tiles2[36].SetOffset(Vector(2, 0)); - tiles2[37].SetOffset(Vector(2, 0)); - tiles2[38].SetOffset(Vector(2, 0)); - tiles2[39].SetOffset(Vector(2, 0)); - - tiles2[40].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_SOUTH); - tiles2[41].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_SOUTH | Tile::BLOCK_EAST); - tiles2[42].SetOffset(Vector(0, 1)); - tiles2[43].SetOffset(Vector(2, 0)); - tiles2[44].SetOffset(Vector(2, 0)); - tiles2[45].SetOffset(Vector(2, 0)); - tiles2[46].SetOffset(Vector(2, 0)); - tiles2[47].SetOffset(Vector(2, 0)); - - tiles2[48].SetOffset(Vector(1, 0)); - tiles2[49].SetOffset(Vector(1, 0)); - tiles2[50].SetOffset(Vector(5, 4)); - tiles2[51].SetOffset(Vector(2, 0)); - tiles2[52].SetOffset(Vector(2, 0)); - tiles2[53].SetOffset(Vector(2, 0)); - tiles2[54].SetOffset(Vector(2, 0)); - tiles2[55].SetOffset(Vector(2, 0)); - - tiles2[56].SetOffset(Vector(2, 0)); - tiles2[57].SetOffset(Vector(2, 0)); - tiles2[58].SetOffset(Vector(2, 0)); - tiles2[59].SetOffset(Vector(2, 0)); - tiles2[60].SetOffset(Vector(2, 0)); - tiles2[61].SetOffset(Vector(2, 0)); - tiles2[62].SetOffset(Vector(2, 0)); - tiles2[63].SetOffset(Vector(2, 0)); - - Area areas1[2]; - areas1[0].SetTiles(tiles1, 64); - areas1[0].SetWidth(8); - areas1[1].SetTiles(tiles2, 64); - areas1[1].SetWidth(8); - - Trigger triggers1[1]; - triggers1[0].SetTilePosition(Vector(8, 3)); - triggers1[0].SetType(Trigger::TYPE_NORTH); - - SDL_Surface *tilesetImg(IMG_Load("test-data/tileset.png")); - Sprite tileset(tilesetImg, tileSize, tileSize); - - Map map1; - map1.SetAreas(areas1, 2); - map1.SetTileset(&tileset); - map1.SetTriggers(triggers1, 1); - map1.SetWidth(2); - map1.SetBattleBackground(bg); - - Tile tiles3[64]; - - tiles3[ 0].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH | Tile::BLOCK_WEST); - tiles3[ 1].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH); - tiles3[ 2].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH); - tiles3[ 3].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH); - tiles3[ 4].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH); - tiles3[ 5].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH); - tiles3[ 6].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH); - tiles3[ 7].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH | Tile::BLOCK_EAST); - - tiles3[ 8].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_WEST); - tiles3[ 9].SetOffset(Vector(3, 0)); - tiles3[10].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_SOUTH); - tiles3[11].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_SOUTH); - tiles3[12].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_SOUTH); - tiles3[13].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_SOUTH); - tiles3[14].SetOffset(Vector(4, 0)); - tiles3[15].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_EAST | Tile::BLOCK_SOUTH); - - tiles3[16].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_WEST); - tiles3[17].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_EAST); - tiles3[18].SetOffset(Vector(0, 0)); - tiles3[19].SetOffset(Vector(1, 0)); - tiles3[20].SetOffset(Vector(1, 0)); - tiles3[21].SetOffset(Vector(3, 2)); - tiles3[22].SetOffset(Vector(4, 2)).SetFlags(Tile::BLOCK_EAST | Tile::BLOCK_SOUTH | Tile::BLOCK_WEST); - tiles3[23].SetOffset(Vector(5, 2)); - - tiles3[24].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_WEST); - tiles3[25].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_EAST); - tiles3[26].SetOffset(Vector(0, 1)); - tiles3[27].SetOffset(Vector(2, 0)); - tiles3[28].SetOffset(Vector(2, 0)); - tiles3[29].SetOffset(Vector(1, 2)); - tiles3[30].SetOffset(Vector(1, 2)); - tiles3[31].SetOffset(Vector(1, 2)); - - tiles3[32].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_WEST); - tiles3[33].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_EAST); - tiles3[34].SetOffset(Vector(0, 1)); - tiles3[35].SetOffset(Vector(2, 0)); - tiles3[36].SetOffset(Vector(2, 0)); - tiles3[37].SetOffset(Vector(2, 3)); - tiles3[38].SetOffset(Vector(3, 3)); - tiles3[39].SetOffset(Vector(0, 3)); - - tiles3[40].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_WEST); - tiles3[41].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_EAST); - tiles3[42].SetOffset(Vector(0, 1)); - tiles3[43].SetOffset(Vector(2, 0)); - tiles3[44].SetOffset(Vector(2, 0)); - tiles3[45].SetOffset(Vector(2, 4)); - tiles3[46].SetOffset(Vector(3, 4)); - tiles3[47].SetOffset(Vector(0, 4)); - - tiles3[48].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_WEST); - tiles3[49].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_EAST); - tiles3[50].SetOffset(Vector(0, 1)); - tiles3[51].SetOffset(Vector(2, 0)); - tiles3[52].SetOffset(Vector(2, 0)); - tiles3[53].SetOffset(Vector(4, 1)); - tiles3[54].SetOffset(Vector(5, 1)); - tiles3[55].SetOffset(Vector(3, 1)); - - tiles3[56].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_SOUTH | Tile::BLOCK_WEST); - tiles3[57].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_EAST | Tile::BLOCK_SOUTH); - tiles3[58].SetOffset(Vector(0, 1)); - tiles3[59].SetOffset(Vector(2, 0)); - tiles3[60].SetOffset(Vector(2, 0)); - tiles3[61].SetOffset(Vector(2, 0)); - tiles3[62].SetOffset(Vector(2, 0)); - tiles3[63].SetOffset(Vector(2, 0)); - - Area areas2[1]; - areas2[0].SetTiles(tiles3, 64); - areas2[0].SetWidth(8); - - Trigger triggers2[1]; - triggers2[0].SetTilePosition(Vector(6, 2)); - triggers2[0].SetType(Trigger::TYPE_SOUTH); - - Map map2; - map2.SetAreas(areas2, 1); - map2.SetTileset(&tileset); - map2.SetTriggers(triggers2, 1); - map2.SetWidth(1); - map2.SetBattleBackground(bg); - - unsigned char transition1text[4 + sizeof(int) + sizeof(Map *) + sizeof(Vector)]; - int i(0); - transition1text[i++] = Script::CODE_MOVE_I0; - *reinterpret_cast(transition1text + i) = 1; - i += sizeof(int); - transition1text[i++] = Script::CODE_MOVE_A0; - *reinterpret_cast(transition1text + i) = &map2; - i += sizeof(Map *); - transition1text[i++] = Script::CODE_MOVE_V0; - *reinterpret_cast *>(transition1text + i) = Vector(6, 2); - i += sizeof(Vector); - transition1text[i++] = Script::CODE_SYSCALL; - - Script transition1; - transition1.text = transition1text; - transition1.textlen = sizeof(transition1text); - - triggers1[0].SetScript(&transition1); - - unsigned char transition2text[4 + sizeof(int) + sizeof(Map *) + sizeof(Vector)]; - i = 0; - transition2text[i++] = Script::CODE_MOVE_I0; - *reinterpret_cast(transition2text + i) = 1; - i += sizeof(int); - transition2text[i++] = Script::CODE_MOVE_A0; - *reinterpret_cast(transition2text + i) = &map1; - i += sizeof(Map *); - transition2text[i++] = Script::CODE_MOVE_V0; - *reinterpret_cast *>(transition2text + i) = Vector(8, 3); - i += sizeof(Vector); - transition2text[i++] = Script::CODE_SYSCALL; - - Script transition2; - transition2.text = transition2text; - transition2.textlen = sizeof(transition2text); - - triggers2[0].SetScript(&transition2); - gameState.heroes[0].MapEntity().Position() = Vector(64, 128); gameState.heroes[1].MapEntity().Position() = Vector(64, 128); @@ -572,23 +286,6 @@ int main(int argc, char **argv) { gameState.heroes[3].MapEntity().SetFlags(Entity::FLAG_NONBLOCKING); gameState.heroes[2].MapEntity().AddFollower(&gameState.heroes[3].MapEntity()); - Entity mapPopulation[2]; - map1.SetEntities(mapPopulation, 2); - - SDL_Surface *mapMonsterImg(IMG_Load("test-data/monster-map.png")); - Sprite mapMonsterSprite(mapMonsterImg, 32, 32); - SimpleAnimation mapMonsterAnimation(&mapMonsterSprite, 500, 2, 0, 0, true); - mapPopulation[0].SetAnimation(&mapMonsterAnimation); - mapPopulation[0].Position() = Vector(64, 32); - mapPopulation[0].SetOrientation(Entity::ORIENTATION_SOUTH); - mapPopulation[0].SetPartyLayout(&monstersLayout); - mapPopulation[0].SetMonsters(&monster, 1); - - Sprite blockSprite(tilesetImg, tileSize, tileSize, 3 * tileSize, 1 * tileSize); - mapPopulation[1].SetSprite(&blockSprite); - mapPopulation[1].Position() = Vector(64, 160); - mapPopulation[1].SetFlags(Entity::FLAG_PUSHABLE | Entity::FLAG_FIXED_ORIENTATION); - InitScreen screen(width, height); app::State *state(0); @@ -605,11 +302,10 @@ int main(int argc, char **argv) { battleState->AddHero(gameState.heroes[3]); state = battleState; } else { - MapState *mapState(new MapState(&gameConfig, &map1)); + MapState *mapState(new MapState(&gameConfig, caster.GetMap("map1"))); mapState->ControlEntity(&gameState.heroes[0].MapEntity()); mapState->SetWalkingSpeed(walkSpeed); - mapPopulation[0].StartAnimation(*mapState); state = mapState; } diff --git a/src/map/Area.cpp b/src/map/Area.cpp index 985dea2..1b9488a 100644 --- a/src/map/Area.cpp +++ b/src/map/Area.cpp @@ -9,11 +9,14 @@ #include "Tile.h" #include "../graphics/Sprite.h" +#include "../loader/TypeDescription.h" #include "../sdl/utility.h" #include using geometry::Vector; +using loader::FieldDescription; +using loader::TypeDescription; namespace map { @@ -86,4 +89,25 @@ void Area::RenderDebug(SDL_Surface *dest, const graphics::Sprite *tileset, const } } + +void Area::CreateTypeDescription() { + Area a; + + int imageId(TypeDescription::GetTypeId("Image")); + int numberId(TypeDescription::GetTypeId("Number")); + int tileId(TypeDescription::GetTypeId("Tile")); + + TypeDescription &td(TypeDescription::CreateOrGet("Area")); + td.SetConstructor(&Construct); + td.SetSize(sizeof(Area)); + + td.AddField("battlebg", FieldDescription(((char *)&a.battlebg) - ((char *)&a), imageId).SetReferenced()); + td.AddField("tiles", FieldDescription(((char *)&a.tiles) - ((char *)&a), tileId).SetReferenced().SetAggregate()); + td.AddField("width", FieldDescription(((char *)&a.width) - ((char *)&a), numberId)); +} + +void Area::Construct(void *data) { + new (data) Area; +} + } diff --git a/src/map/Area.h b/src/map/Area.h index a044c8b..3c370ab 100644 --- a/src/map/Area.h +++ b/src/map/Area.h @@ -34,6 +34,9 @@ public: void Render(SDL_Surface *dest, const graphics::Sprite *tileset, const geometry::Vector &offset) const; void RenderDebug(SDL_Surface *dest, const graphics::Sprite *tileset, const geometry::Vector &offset) const; + static void CreateTypeDescription(); + static void Construct(void *); + // temporary setters public: void SetTiles(Tile *t, int num) { tiles = t; numTiles = num; } diff --git a/src/map/Entity.cpp b/src/map/Entity.cpp index e922e54..9929534 100644 --- a/src/map/Entity.cpp +++ b/src/map/Entity.cpp @@ -143,7 +143,9 @@ void Entity::CreateTypeDescription() { int animationId(TypeDescription::GetTypeId("Animation")); int monsterId(TypeDescription::GetTypeId("Monster")); + int numberId(TypeDescription::GetTypeId("Number")); int partyLayoutId(TypeDescription::GetTypeId("PartyLayout")); + int spriteId(TypeDescription::GetTypeId("Sprite")); int vectorId(TypeDescription::GetTypeId("Vector")); TypeDescription &td(TypeDescription::CreateOrGet("Entity")); @@ -152,9 +154,12 @@ void Entity::CreateTypeDescription() { td.SetSize(sizeof(Entity)); td.AddField("animation", FieldDescription(((char *)&e.animation) - ((char *)&e), animationId).SetReferenced()); + td.AddField("sprite", FieldDescription(((char *)&e.sprite) - ((char *)&e), spriteId).SetReferenced()); td.AddField("partyLayout", FieldDescription(((char *)&e.partyLayout) - ((char *)&e), partyLayoutId).SetReferenced()); td.AddField("monsters", FieldDescription(((char *)&e.monsters) - ((char *)&e), monsterId).SetReferenced().SetAggregate()); td.AddField("spriteOffset", FieldDescription(((char *)&e.spriteOffset) - ((char *)&e), vectorId)); + td.AddField("position", FieldDescription(((char *)&e.tilePosition) - ((char *)&e), vectorId)); + td.AddField("flags", FieldDescription(((char *)&e.flags) - ((char *)&e), numberId)); } void Entity::Construct(void *data) { diff --git a/src/map/Entity.h b/src/map/Entity.h index fc1dc81..cc30c95 100644 --- a/src/map/Entity.h +++ b/src/map/Entity.h @@ -48,6 +48,8 @@ public: geometry::Vector &SpriteOffset() { return spriteOffset; } const geometry::Vector &SpriteOffset() const { return spriteOffset; } + void ResetPosition(const geometry::Vector &tileSize) { position = tilePosition * tileSize; } + void SetAnimation(const graphics::Animation *a); void StartAnimation(app::Application &ctrl); void StartAnimation(app::State &ctrl); @@ -104,6 +106,7 @@ private: int numMonsters; graphics::AnimationRunner runner; geometry::Vector spriteOffset; + geometry::Vector tilePosition; geometry::Vector position; geometry::Vector velocity; Orientation orientation; diff --git a/src/map/Map.cpp b/src/map/Map.cpp index 1c55eaf..3f05962 100644 --- a/src/map/Map.cpp +++ b/src/map/Map.cpp @@ -11,11 +11,14 @@ #include "Tile.h" #include "Trigger.h" #include "../graphics/Sprite.h" +#include "../loader/TypeDescription.h" #include "../sdl/utility.h" #include using geometry::Vector; +using loader::FieldDescription; +using loader::TypeDescription; namespace map { @@ -149,4 +152,31 @@ void Map::RenderDebug(SDL_Surface *dest, const Vector &inOffset) const { } } + +void Map::CreateTypeDescription() { + Map m; + + int areaId(TypeDescription::GetTypeId("Area")); + int entityId(TypeDescription::GetTypeId("Entity")); + int imageId(TypeDescription::GetTypeId("Image")); + int numberId(TypeDescription::GetTypeId("Number")); + int spriteId(TypeDescription::GetTypeId("Sprite")); + int triggerId(TypeDescription::GetTypeId("Trigger")); + + TypeDescription &td(TypeDescription::CreateOrGet("Map")); + td.SetConstructor(&Construct); + td.SetSize(sizeof(Map)); + + td.AddField("tileset", FieldDescription(((char *)&m.tileset) - ((char *)&m), spriteId).SetReferenced()); + td.AddField("battlebg", FieldDescription(((char *)&m.battlebg) - ((char *)&m), imageId).SetReferenced()); + td.AddField("areas", FieldDescription(((char *)&m.areas) - ((char *)&m), areaId).SetReferenced().SetAggregate()); + td.AddField("triggers", FieldDescription(((char *)&m.triggers) - ((char *)&m), triggerId).SetReferenced().SetAggregate()); + td.AddField("entities", FieldDescription(((char *)&m.entities) - ((char *)&m), entityId).SetReferenced().SetAggregate()); + td.AddField("width", FieldDescription(((char *)&m.width) - ((char *)&m), numberId)); +} + +void Map::Construct(void *data) { + new (data) Map; +} + } diff --git a/src/map/Map.h b/src/map/Map.h index 40cce1c..a985d84 100644 --- a/src/map/Map.h +++ b/src/map/Map.h @@ -39,14 +39,8 @@ public: void Render(SDL_Surface *dest, const geometry::Vector &offset) const; void RenderDebug(SDL_Surface *dest, const geometry::Vector &offset) const; -// temporary setters -public: - void SetTileset(const graphics::Sprite *t) { tileset = t; } - void SetBattleBackground(SDL_Surface *bg) { battlebg = bg; } - void SetAreas(Area *a, int num) { areas = a; numAreas = num; } - void SetTriggers(Trigger *t, int num) { triggers = t; numTriggers = num; } - void SetEntities(Entity *e, int num) { entities = e; numEntities = num; } - void SetWidth(int w) { width = w; } + static void CreateTypeDescription(); + static void Construct(void *); private: const graphics::Sprite *tileset; diff --git a/src/map/MapState.cpp b/src/map/MapState.cpp index 6b02531..37ccc72 100644 --- a/src/map/MapState.cpp +++ b/src/map/MapState.cpp @@ -412,6 +412,7 @@ void MapState::LoadMap(Map *m) { map = m; for (Entity *e(m->EntitiesBegin()), *end(m->EntitiesEnd()); e != end; ++e) { entities.push_back(e); + e->ResetPosition(map->Tileset()->Size()); } for (Entity *e(controlled); e; e = e->Follower()) { entities.push_back(e); diff --git a/src/map/Tile.cpp b/src/map/Tile.cpp index 303c9e5..650bbdb 100644 --- a/src/map/Tile.cpp +++ b/src/map/Tile.cpp @@ -7,6 +7,11 @@ #include "Tile.h" +#include "../loader/TypeDescription.h" + +using loader::FieldDescription; +using loader::TypeDescription; + namespace map { Tile::Tile() @@ -15,4 +20,26 @@ Tile::Tile() } + +void Tile::CreateTypeDescription() { + Tile t; + + int imageId(TypeDescription::GetTypeId("Image")); + int numberId(TypeDescription::GetTypeId("Number")); + int vectorId(TypeDescription::GetTypeId("Vector")); + + TypeDescription &td(TypeDescription::CreateOrGet("Tile")); + td.SetConstructor(&Construct); + td.SetSize(sizeof(Tile)); + + td.AddField("battlebg", FieldDescription(((char *)&t.battlebg) - ((char *)&t), imageId).SetReferenced()); + td.AddField("t", FieldDescription(((char *)&t.offset) - ((char *)&t), vectorId)); + td.AddField("flags", FieldDescription(((char *)&t.flags) - ((char *)&t), numberId)); + +} + +void Tile::Construct(void *data) { + new (data) Tile; +} + } diff --git a/src/map/Tile.h b/src/map/Tile.h index 06b3b11..6706b01 100644 --- a/src/map/Tile.h +++ b/src/map/Tile.h @@ -37,6 +37,9 @@ public: bool BlocksSouth() const { return flags & BLOCK_SOUTH; } bool BlocksWest() const { return flags & BLOCK_WEST; } + static void CreateTypeDescription(); + static void Construct(void *); + // temporary setters public: Tile &SetOffset(const geometry::Vector &o) { offset = o; return *this; } @@ -45,7 +48,7 @@ public: private: SDL_Surface *battlebg; geometry::Vector offset; - Uint32 flags; + int flags; }; diff --git a/src/map/Trigger.cpp b/src/map/Trigger.cpp index f454613..ff4863d 100644 --- a/src/map/Trigger.cpp +++ b/src/map/Trigger.cpp @@ -7,6 +7,11 @@ #include "Trigger.h" +#include "../loader/TypeDescription.h" + +using loader::FieldDescription; +using loader::TypeDescription; + namespace map { Trigger::Trigger() @@ -15,4 +20,25 @@ Trigger::Trigger() } + +void Trigger::CreateTypeDescription() { + Trigger t; + + int numberId(TypeDescription::GetTypeId("Number")); + int scriptId(TypeDescription::GetTypeId("Script")); + int vectorId(TypeDescription::GetTypeId("Vector")); + + TypeDescription &td(TypeDescription::CreateOrGet("Trigger")); + td.SetConstructor(&Construct); + td.SetSize(sizeof(Trigger)); + + td.AddField("script", FieldDescription(((char *)&t.script) - ((char *)&t), scriptId).SetReferenced()); + td.AddField("position", FieldDescription(((char *)&t.tilePosition) - ((char *)&t), vectorId)); + td.AddField("type", FieldDescription(((char *)&t.type) - ((char *)&t), numberId)); +} + +void Trigger::Construct(void *data) { + new (data) Trigger; +} + } diff --git a/src/map/Trigger.h b/src/map/Trigger.h index 13b85ac..eb17460 100644 --- a/src/map/Trigger.h +++ b/src/map/Trigger.h @@ -26,16 +26,19 @@ public: TYPE_EAST = Entity::ORIENTATION_EAST, TYPE_SOUTH = Entity::ORIENTATION_SOUTH, TYPE_WEST = Entity::ORIENTATION_WEST, - TYPE_CONTACT, + TYPE_CONTACT = 4, }; public: const geometry::Vector &TilePosition() const { return tilePosition; } - Type GetType() const { return type; } + Type GetType() const { return Type(type); } bool HasScript() const { return script; } common::Script &GetScript() { return *script; } const common::Script &GetScript() const { return *script; } + static void CreateTypeDescription(); + static void Construct(void *); + // temporary setters public: void SetTilePosition(const geometry::Vector &p) { tilePosition = p; } @@ -45,7 +48,7 @@ public: private: common::Script *script; geometry::Vector tilePosition; - Type type; + int type; }; diff --git a/test-data/constants.l2h b/test-data/constants.l2h index 851f7ff..5ace629 100644 --- a/test-data/constants.l2h +++ b/test-data/constants.l2h @@ -9,3 +9,22 @@ Number multiple // Ikari Boolean magical Boolean physical + +// Trigger type +Number triggerNorth +Number triggerEast +Number triggerSouth +Number triggerWest +Number triggerContact + +// Tile flags +Number blockN +Number blockE +Number blockNE +Number blockS +Number blockES +Number blockW +Number blockNW +Number blockNEW +Number blockSW +Number blockESW diff --git a/test-data/constants.l2s b/test-data/constants.l2s index 8c624ec..fa01f2b 100644 --- a/test-data/constants.l2s +++ b/test-data/constants.l2s @@ -9,3 +9,22 @@ export Number single 2 // Ikari export Boolean magical false export Boolean physical true + +// Trigger type +export Number triggerNorth 0 +export Number triggerEast 1 +export Number triggerSouth 2 +export Number triggerWest 3 +export Number triggerContact 4 + +// Tile flags +export Number blockN 1 +export Number blockE 2 +export Number blockNE 3 +export Number blockS 4 +export Number blockES 6 +export Number blockW 8 +export Number blockNW 9 +export Number blockNEW 11 +export Number blockSW 12 +export Number blockESW 14 diff --git a/test-data/maps.l2s b/test-data/maps.l2s new file mode 100644 index 0000000..e91ace9 --- /dev/null +++ b/test-data/maps.l2s @@ -0,0 +1,291 @@ +include "constants.l2h" + +export Map map1 { + tileset: Sprite { + image: :"tileset.png", + size: <32, 32> + }, + battlebg: :"battle-bg.png", + width: 2, + areas: [ Area + { + width: 8, + tiles: [ Tile + { t: <2, 1> }, + { t: <4, 0>, flags: blockNW }, + { t: <3, 0>, flags: blockN }, + { t: <3, 0>, flags: blockNE }, + { t: <0, 1> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + + { t: <2, 1> }, + { t: <4, 0>, flags: blockW }, + { t: <3, 0> }, + { t: <3, 0>, flags: blockE }, + { t: <0, 2> }, + { t: <1, 2> }, + { t: <1, 2> }, + { t: <1, 2> }, + + { t: <2, 1> }, + { t: <4, 0>, flags: blockW }, + { t: <3, 0> }, + { t: <3, 0>, flags: blockE }, + { t: <0, 3> }, + { t: <1, 3> }, + { t: <1, 3> }, + { t: <2, 3> }, + + { t: <2, 1> }, + { t: <4, 0>, flags: blockW }, + { t: <3, 0> }, + { t: <3, 0>, flags: blockE }, + { t: <0, 4> }, + { t: <1, 4> }, + { t: <1, 4> }, + { t: <2, 4> }, + + { t: <2, 1> }, + { t: <4, 0>, flags: blockW }, + { t: <3, 0> }, + { t: <3, 0> }, + { t: <3, 0>, flags: blockN }, + { t: <3, 0>, flags: blockN }, + { t: <3, 0>, flags: blockN }, + { t: <3, 0>, flags: blockN }, + + { t: <2, 1> }, + { t: <4, 0>, flags: blockW }, + { t: <3, 0> }, + { t: <3, 0> }, + { t: <3, 0>, flags: blockS }, + { t: <4, 0>, flags: blockS }, + { t: <4, 0>, flags: blockS }, + { t: <4, 0>, flags: blockS }, + + { t: <2, 1> }, + { t: <4, 0>, flags: blockW }, + { t: <3, 0> }, + { t: <3, 0>, flags: blockE }, + { t: <0, 0> }, + { t: <1, 0> }, + { t: <1, 0> }, + { t: <1, 0> }, + + { t: <2, 1> }, + { t: <4, 0>, flags: blockSW }, + { t: <3, 0>, flags: blockS }, + { t: <3, 0>, flags: blockES }, + { t: <0, 1> }, + { t: <1, 1> }, + { t: <1, 1> }, + { t: <1, 1> } + ] + }, + { + width: 8, + tiles: [ Tile + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + + { t: <1, 2> }, + { t: <1, 2> }, + { t: <5, 3> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + + { t: <3, 3> }, + { t: <0, 3> }, + { t: <0, 1> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + + { t: <3, 4>, flags: blockNEW }, + { t: <0, 4> }, + { t: <0, 1> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + + { t: <5, 0> }, + { t: <3, 0>, flags: blockNE }, + { t: <0, 1> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + + { t: <4, 0>, flags: blockS }, + { t: <4, 0>, flags: blockES }, + { t: <0, 1> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + + { t: <1, 0> }, + { t: <1, 0> }, + { t: <5, 4> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> } + ] + } + ], + triggers: [ Trigger + { + position: <8, 3>, + type: triggerNorth, + script: << + $move %i0 1 + $move %a0 map2 + $move %v0 <6, 2> + $sysc + >> + } + ], + entities: [ Entity + { + animation: SimpleAnimation { + sprite: Sprite { + image: :"monster-map.png", + size: <32, 32> + }, + framecount: 2, + frametime: 500, + repeat: true + }, + position: <2, 1>, + partyLayout: monstersLayout + // TODO: monsters + }, + { + sprite: Sprite { + image: :"tileset.png", + size: <32, 32>, + offset: <96, 32> + }, + position: <2, 5>, + flags: 6 // TODO: hard support for flags + } + ] +} + +export Map map2 { + tileset: Sprite { + image: :"tileset.png", + size: <32, 32> + }, + battlebg: :"battle-bg.png", + width: 2, + areas: [ Area + { + width: 8, + tiles: [ Tile + { t: <3, 0>, flags: blockNW }, + { t: <3, 0>, flags: blockN }, + { t: <3, 0>, flags: blockN }, + { t: <3, 0>, flags: blockN }, + { t: <3, 0>, flags: blockN }, + { t: <3, 0>, flags: blockN }, + { t: <3, 0>, flags: blockN }, + { t: <3, 0>, flags: blockNE }, + + { t: <3, 0>, flags: blockW }, + { t: <3, 0> }, + { t: <3, 0>, flags: blockS }, + { t: <4, 0>, flags: blockS }, + { t: <4, 0>, flags: blockS }, + { t: <4, 0>, flags: blockS }, + { t: <4, 0> }, + { t: <4, 0>, flags: blockES }, + + { t: <3, 0>, flags: blockW }, + { t: <3, 0>, flags: blockE }, + { t: <0, 0> }, + { t: <1, 0> }, + { t: <1, 0> }, + { t: <3, 2> }, + { t: <4, 2>, flags: blockESW }, + { t: <5, 2> }, + + { t: <3, 0>, flags: blockW }, + { t: <3, 0>, flags: blockE }, + { t: <0, 1> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <1, 2> }, + { t: <1, 2> }, + { t: <1, 2> }, + + { t: <3, 0>, flags: blockW }, + { t: <3, 0>, flags: blockE }, + { t: <0, 1> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 4> }, + { t: <3, 4> }, + { t: <0, 4> }, + + { t: <3, 0>, flags: blockW }, + { t: <3, 0>, flags: blockE }, + { t: <0, 1> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <4, 1> }, + { t: <5, 1> }, + { t: <3, 1> }, + + { t: <3, 0>, flags: blockW }, + { t: <3, 0>, flags: blockE }, + { t: <0, 1> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> }, + { t: <2, 0> } + ] + } + ], + triggers: [ Trigger + { + position: <6, 2>, + type: triggerSouth, + script: << + $move %i0 1 + $move %a0 map1 + $move %v0 <8, 3> + $sysc + >> + } + ] +} -- 2.39.2