From 4e981ae4679c11221198c6e47160e1d13dd2041f Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Mon, 8 Jun 2009 15:16:39 +0200 Subject: Reenabled rendering of hair on TMWServ (cherry picked from commit 263fc757297103935cbdaa1bb6eca14ff8e75ecd) --- src/main.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index 16cbbdfe..d23d273c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1143,6 +1143,7 @@ int main(int argc, char *argv[]) // Load XML databases ColorDB::load(); ItemDB::load(); + Being::load(); // Hairstyles MonsterDB::load(); NPCDB::load(); EmoteDB::load(); -- cgit v1.2.3-70-g09d2 From 34ca68e13b5ead819f911acdc5aaf35285dde78b Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Mon, 8 Jun 2009 08:23:48 -0600 Subject: Remove duplicate code from Being (cherry picked from commit c79406e025a17ec29afca2458f916d3f2d49447d) --- src/being.cpp | 41 ----------------------------------------- src/being.h | 4 ---- 2 files changed, 45 deletions(-) (limited to 'src') diff --git a/src/being.cpp b/src/being.cpp index 37cb6987..fa97d800 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -1025,19 +1025,6 @@ int Being::getHairStyleCount() return mNumberOfHairstyles; } -int Being::getHairColorCount() -{ - return mNumberOfHairColors; -} - -std::string Being::getHairColor(int index) -{ - if (index < 0 || index >= mNumberOfHairColors) - return "#000000"; - - return hairColors[index]; -} - void Being::load() { // Hairstyles are encoded as negative numbers. Count how far negative @@ -1048,32 +1035,4 @@ void Being::load() hairstyles++; mNumberOfHairstyles = hairstyles; - - XML::Document doc(HAIR_FILE); - xmlNodePtr root = doc.rootNode(); - - // Add an initial hair color - hairColors.resize(1, "#000000"); - - if (!root || !xmlStrEqual(root->name, BAD_CAST "colors")) - { - logger->log("Error loading being hair configuration file"); - } else { - for_each_xml_child_node(node, root) - { - if (xmlStrEqual(node->name, BAD_CAST "color")) - { - int index = atoi(XML::getProperty(node, "id", "-1").c_str()); - std::string value = XML::getProperty(node, "value", ""); - - if (index >= 0 && !value.empty()) { - if (index >= mNumberOfHairColors) { - mNumberOfHairColors = index + 1; - hairColors.resize(mNumberOfHairColors, "#000000"); - } - hairColors[index] = value; - } - } - } - } } diff --git a/src/being.h b/src/being.h index 6c849350..dd3627e2 100644 --- a/src/being.h +++ b/src/being.h @@ -498,12 +498,8 @@ class Being : public Sprite, public ConfigListener internalTriggerEffect(effectId, false, true); } - static int getHairColorCount(); - static int getHairStyleCount(); - static std::string getHairColor(int index); - virtual AnimatedSprite *getSprite(int index) const { return mSprites[index]; } -- cgit v1.2.3-70-g09d2 From 758282624f77988540062c5fb60128716aa0377b Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Mon, 8 Jun 2009 08:31:05 -0600 Subject: Remove some unused variables (cherry picked from commit c9f52e60ea7eadca0d11fc0bbf7eb8a6ad465925) --- src/being.cpp | 2 -- src/being.h | 2 -- 2 files changed, 4 deletions(-) (limited to 'src') diff --git a/src/being.cpp b/src/being.cpp index fa97d800..b5232469 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -64,9 +64,7 @@ const bool debug_movement = true; #define BEING_EFFECTS_FILE "effects.xml" #define HAIR_FILE "hair.xml" -int Being::mNumberOfHairColors = 1; int Being::mNumberOfHairstyles = 1; -std::vector Being::hairColors; static const int DEFAULT_WIDTH = 32; static const int DEFAULT_HEIGHT = 32; diff --git a/src/being.h b/src/being.h index dd3627e2..26b4f8f9 100644 --- a/src/being.h +++ b/src/being.h @@ -566,8 +566,6 @@ class Being : public Sprite, public ConfigListener /** Engine-related infos about weapon. */ const ItemInfo *mEquippedWeapon; - static std::vector hairColors; - static int mNumberOfHairColors; /** Number of hair colors in use */ static int mNumberOfHairstyles; /** Number of hair styles in use */ Path mPath; -- cgit v1.2.3-70-g09d2 From 25875637a2b0b1561e2cf69b94674ee74d8031a3 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Mon, 8 Jun 2009 20:45:20 +0200 Subject: Fixed the name of the login song The value from branding.xml isn't actually used, since it will only load a branding.xml that is located at 'data/branding.xml' relative from where you run the client. That's an issue to fix later. Mantis-issue: 714 --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index d23d273c..bc8725ab 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -940,7 +940,7 @@ int main(int argc, char *argv[]) setupButton->setPosition(top->getWidth() - setupButton->getWidth() - 3, 3); top->add(setupButton); - sound.playMusic(branding.getValue("loginMusic", "Login.ogg")); + sound.playMusic(branding.getValue("loginMusic", "Magick - Real.ogg")); // Initialize login data loginData.hostname = options.serverName; -- cgit v1.2.3-70-g09d2 From 2b2b02df79649beed9a49e37f21db996f053d4ca Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Mon, 8 Jun 2009 22:31:07 +0200 Subject: Attempt to clear some of the block/walkmask confusion --- src/map.cpp | 2 +- src/map.h | 13 +++++++++---- src/monster.h | 6 +++++- src/npc.h | 6 +++++- src/player.h | 2 +- 5 files changed, 21 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/map.cpp b/src/map.cpp index f0a5eae0..490e52c1 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -429,7 +429,7 @@ void Map::blockTile(int x, int y, BlockType type) } } -bool Map::getWalk(int x, int y, char walkmask) const +bool Map::getWalk(int x, int y, unsigned char walkmask) const { // You can't walk outside of the map if (!contains(x, y)) diff --git a/src/map.h b/src/map.h index 0432dc34..cb0271b3 100644 --- a/src/map.h +++ b/src/map.h @@ -152,6 +152,13 @@ class Map : public Properties NB_BLOCKTYPES }; + enum BlockMask + { + BLOCKMASK_WALL = 0x80, // = bin 1000 0000 + BLOCKMASK_CHARACTER = 0x01, // = bin 0000 0001 + BLOCKMASK_MONSTER = 0x02 // = bin 0000 0010 + }; + /** * Constructor, taking map and tile size as parameters. */ @@ -217,7 +224,8 @@ class Map : public Properties * Gets walkability for a tile with a blocking bitmask. When called * without walkmask, only blocks against colliding tiles. */ - bool getWalk(int x, int y, char walkmask = BLOCKMASK_WALL) const; + bool getWalk(int x, int y, + unsigned char walkmask = BLOCKMASK_WALL) const; /** * Returns the width of this map in tiles. @@ -294,9 +302,6 @@ class Map : public Properties /** * Blockmasks for different entities */ - static const unsigned char BLOCKMASK_WALL = 0x80; // = bin 1000 0000 - static const unsigned char BLOCKMASK_CHARACTER = 0x01;// = bin 0000 0001 - static const unsigned char BLOCKMASK_MONSTER = 0x02; // = bin 0000 0010 int *mOccupation[NB_BLOCKTYPES]; int mWidth, mHeight; diff --git a/src/monster.h b/src/monster.h index bf52ed6d..7b44b5a8 100644 --- a/src/monster.h +++ b/src/monster.h @@ -82,7 +82,11 @@ class Monster : public Being * Gets the way the monster is blocked by other objects */ virtual unsigned char getWalkMask() const - { return 0x83; } // blocked by walls, other monsters and players ( bin 1000 0011) + { + return Map::BLOCKMASK_WALL + | Map::BLOCKMASK_CHARACTER + | Map::BLOCKMASK_MONSTER; + } protected: /** diff --git a/src/npc.h b/src/npc.h index 57e6d5a8..fc6f3459 100644 --- a/src/npc.h +++ b/src/npc.h @@ -46,7 +46,11 @@ class NPC : public Player * Gets the way an NPC is blocked by other things on the map */ virtual unsigned char getWalkMask() const - { return 0x83; } // blocked like a monster by walls, monsters and characters ( bin 1000 0011) + { + return Map::BLOCKMASK_WALL + | Map::BLOCKMASK_CHARACTER + | Map::BLOCKMASK_MONSTER; + } static bool isTalking; diff --git a/src/player.h b/src/player.h index bb44f462..9a5c6c94 100644 --- a/src/player.h +++ b/src/player.h @@ -132,7 +132,7 @@ class Player : public Being * Gets the way the character is blocked by other objects. */ virtual unsigned char getWalkMask() const - { return 0x82; } // blocked by walls and monsters (bin 1000 0010) + { return Map::BLOCKMASK_WALL | Map::BLOCKMASK_MONSTER; } /** * Called when a option (set with config.addListener()) is changed -- cgit v1.2.3-70-g09d2 From 32457dd5b2f9431d4f5d503dc8b090a9c1b7f944 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Mon, 8 Jun 2009 23:05:15 +0200 Subject: Fixed the problem where the player would skip corners Skipping corners is only allowed around other beings (you can even walk through them), but not for collision tiles. The server doesn't allow this, so allowing it client-side leads to synchronization problems. Mantis-issue: 730 --- src/map.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/map.cpp b/src/map.cpp index 490e52c1..0b1550db 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -475,7 +475,8 @@ const std::string &Map::getName() const static int const basicCost = 100; -Path Map::findPath(int startX, int startY, int destX, int destY, unsigned char walkmask, int maxCost) +Path Map::findPath(int startX, int startY, int destX, int destY, + unsigned char walkmask, int maxCost) { // Path to be built up (empty by default) Path path; @@ -533,7 +534,8 @@ Path Map::findPath(int startX, int startY, int destX, int destY, unsigned char w // Skip if the tile is on the closed list or is not walkable // unless its the destination tile if (newTile->whichList == mOnClosedList || - ((newTile->blockmask & walkmask) && !(x == destX && y == destY))) + ((newTile->blockmask & walkmask) + && !(x == destX && y == destY))) { continue; } @@ -545,10 +547,8 @@ Path Map::findPath(int startX, int startY, int destX, int destY, unsigned char w MetaTile *t1 = getMetaTile(curr.x, curr.y + dy); MetaTile *t2 = getMetaTile(curr.x + dx, curr.y); - if (t1->blockmask & walkmask && !(t2->blockmask & walkmask)) // I hope I didn't fuck this line up - { + if ((t1->blockmask | t2->blockmask) & BLOCKMASK_WALL) continue; - } } // Calculate G cost for this route, ~sqrt(2) for moving diagonal -- cgit v1.2.3-70-g09d2 From 2a60ed3f85004c872eb9d0ae39d4aa1c47626543 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Mon, 8 Jun 2009 23:07:00 +0200 Subject: Reintroduced the 'occupied' check for eAthena movement code Makes sure the player walks around other players and beings when reasonably possible. This was meant to be based on the blockmask stuff, but I half removed that a few months ago. --- src/map.cpp | 23 +++++++++++++++++++++-- src/map.h | 7 +++++++ 2 files changed, 28 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/map.cpp b/src/map.cpp index 0b1550db..4e12ac97 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -407,7 +407,7 @@ void Map::blockTile(int x, int y, BlockType type) if (type == BLOCKTYPE_NONE || !contains(x, y)) return; - int tileNum = x + y * mWidth; + const int tileNum = x + y * mWidth; if ((++mOccupation[type][tileNum]) > 0) { @@ -439,6 +439,23 @@ bool Map::getWalk(int x, int y, unsigned char walkmask) const return !(mMetaTiles[x + y * mWidth].blockmask & walkmask); } +#ifdef EATHENA_SUPPORT +bool Map::occupied(int x, int y) const +{ + const Beings &beings = beingManager->getAll(); + for (Beings::const_iterator i = beings.begin(); i != beings.end(); i++) + { + const Being *being = *i; + + // job 45 is a portal, they don't collide + if (being->mX == x && being->mY == y && being->mJob != 45) + return true; + } + + return false; +} +#endif + bool Map::contains(int x, int y) const { return x >= 0 && y >= 0 && x < mWidth && y < mHeight; @@ -569,12 +586,14 @@ Path Map::findPath(int startX, int startY, int destX, int destY, ++Gcost; } +#ifdef EATHENA_SUPPORT // It costs extra to walk through a being (needs to be enough // to make it more attractive to walk around). - if (!getWalk(x, y, BLOCKMASK_CHARACTER | BLOCKMASK_MONSTER)) + if (occupied(x, y)) { Gcost += 3 * basicCost; } +#endif // Skip if Gcost becomes too much // Warning: probably not entirely accurate diff --git a/src/map.h b/src/map.h index cb0271b3..6baf7411 100644 --- a/src/map.h +++ b/src/map.h @@ -227,6 +227,13 @@ class Map : public Properties bool getWalk(int x, int y, unsigned char walkmask = BLOCKMASK_WALL) const; +#ifdef EATHENA_SUPPORT + /** + * Tells whether a tile is occupied by a being. + */ + bool occupied(int x, int y) const; +#endif + /** * Returns the width of this map in tiles. */ -- cgit v1.2.3-70-g09d2