summaryrefslogtreecommitdiff
path: root/src/map.cpp
AgeCommit message (Collapse)AuthorFilesLines
2012-07-31Removed 'virtual' from methods of ImageThorbjørn Lindeijer1-5/+0
Maybe it used to be necessary for these methods to be virtual, but this is no longer the case. Hence we can avoid wasting CPU ticks searching through virtual function tables, especially for frequently used methods like getWidth, getHeight and setAlpha. MapLayer::getTile was inlined.
2012-07-31Fixed drawing issues with tiles that don't match the gridThorbjørn Lindeijer1-1/+6
An optimization in the tile layer rendering code meant for drawing repeated tiles faster was not taking into account the case where the tile width does not match the width of the tile grid.
2012-03-18Removed some 'const' keywords from value returnsThorbjørn Lindeijer1-3/+3
It makes no sense to mark a return value as const when it is returned by value. This only makes sense if the return value is passed by reference, in order to prevent the receiver from modifying the value. Also made some other small adjustments. A std::string does not need to be initialized to "" explicitly and getSafeUtf8String could take its parameter by reference. Reviewed-by: Yohann Ferreira
2012-02-12Fixes to actor drawing orderThorbjørn Lindeijer1-1/+1
On the fringe layer, actors are drawn 'sorted' together with the tiles. When the sorting order was separated from the actual Y position of the actor, the tile drawing loop was not adapted to take this drawOrder into account rather than the plain Y position. Also, ActorSprite::draw was applying a half-tile offset to position the sprite at the bottom while the logical position of the actor is at the center of the tile. However, it failed to override getDrawOrder to account for this offset, causing actors to get drawn earlier than they should (and thus being overlapped by fringe layer tiles when they actually shouldn't). This fixes drawing glitches with the paths around Hurnscald and reduces the glitches when walking up/down through grass. Reviewed-by: Erik Schilling
2012-02-05Revert "Checking being positions send by the server"Thorbjørn Lindeijer1-5/+0
This reverts commit 92fd074aa85e2357bfe1ab642209dd5a0d87e4d5. Reverting because these checks should be done server-side and because having them in the client would currently require wrapping them up in checks if there is even a current map due to the reliance on tile size (we need to handle the case where the current map didn't load properly without crashing). Conflicts: src/map.cpp src/net/manaserv/beinghandler.cpp Reviewed-by: Erik Schilling
2012-02-03Clear tile flags from the gid before further processingThorbjørn Lindeijer1-1/+1
Better to show non-rotated/flipped tiles than no tile at all. This also fixes interpretation of collision tiles that happen to be flipped. Also interpret the gid as an unsigned number, since that's how they are written in the TMX file since the introduction of these flags. Reviewed-by: Yohann Ferreira
2012-01-26Updated copyrights to 2012Thorbjørn Lindeijer1-1/+1
2011-09-16Renamed Map::DebugFlags enumeratorsThorbjørn Lindeijer1-7/+7
Their name is a bit more clear with DEBUG prefix rather than MAP prefix. They're already scoped in the Map class anyway. MAP_NORMAL was changed to DEBUG_NONE to represent no debug flags. Acked-by: Bertram
2011-09-11Merge branch '0.5'Thorbjørn Lindeijer1-5/+10
Conflicts: CMakeLists.txt src/map.cpp src/winver.h
2011-09-11Fixed drawing glitch with overwide tilesThorbjørn Lindeijer1-4/+9
The layer rendering code was not prepared to handle tiles that were wider than the tile width of the map. This commit also fixes the initialization of the maximum tile height, which was based on the map height rather than the tile height. This could slightly reduce overdraw for some maps. Reviewed-by: Stefan Beller <stefanbeller@googlemail.com>
2011-09-05The draw order of particles is now Y - 16 pixels.unknown1-2/+2
This means that the order point of the sprites relative to the particles is no longer the lowest point of the image but instead a point which is approximately between the feet of the characters. The intent of the latest commits to treat sprites as perpendicular to the ground instead of perpendicular to the view line is retained by this approach. I tested this with various particle effects and it results in exactly the expected behavior. Note that this does NOT fix the current problems on TMW with the snail slime effect, because the TMW content team accidently placed this one 10px in the air. Sorry, garbage in, garbage out. getDrawPixelY was re-renamed to getPixelY to be consistent with getPixelX, while getPixelY was renamed to getDrawOrder, to make its purpose clear. Further, particles are no longer drawn when behind other objects. This is implemented by adding a drawnWhenBehind member function to Actor, which currently returns true for everything except particles and compound- sprites with more than one sub-sprites (the later case is consistent with the previous behavior of them). An exception are text particles which are excempt from this exception and whose drawing order is also biased by 16 pixels south instead of north to make them more visible. Plus some minor changes from Bertram. Reviewed-by: Bertram. Resolves: Mana-Mantis #362.
2011-06-24Fixed path finding by putting back the diagonal values in place.Yohann Ferreira1-4/+2
2011-06-22Applied fixes requested by cody.Yohann Ferreira1-3/+3
- Made the map teleport distance fixed for manaserv. - Small cleanups. The branch is considered reviewed by: Cody. Resolves Mana-Mantis: #74.
2011-06-17Removed dehardcoded values from the Map and MapLayer classes.Yohann Ferreira1-45/+53
2011-05-25Refining switches in the debug viewStefan Dombrowski1-7/+9
Reviewed-by: Bjorn
2011-05-01Fixing checking of being positions send by the serverStefan Dombrowski1-1/+1
Reviewed-by: thorbjorn
2011-05-01Checking being positions send by the serverStefan Dombrowski1-0/+5
Reviewed-by: Bertram
2011-04-26Made the client use a unique kind of movement code.Yohann Ferreira1-0/+33
This is fixng many issues and (hopefully) will make the movement rendering much smoother. Merge branch 'master' of gitorious.org:~bertram/mana/mana-movement-code-merge Conflicts: src/being.cpp src/net/manaserv/beinghandler.cpp Resolves: TMW-Mantis #946. Reviewed-by: Thorbjorn.
2011-04-16Post-review fixes.Yohann Ferreira1-3/+0
- Removed unnecessary comments - Removed a useless contains() check in getTileCenter() - Fix the above function documentation - Don't permit FloorItem to be created without a map object. Reviewed-by: Thorbjorn Lindeijer.
2011-04-09Removed a lot of useless "documentation"Thorbjørn Lindeijer1-3/+0
I have to admit I contributed a large part of these. Sorry for that. Less empty space, more attention to the code. Acked-by: Jared Adams
2011-03-29Added the Map::getTileCenter() convenience function.Yohann Ferreira1-0/+12
and made use of it through the tA code. I also remove the obsolete TODO in the flooritem class.
2011-03-17Fixed wrong comments in and optimize findTilePath() a bit.Yohann Ferreira1-13/+3
2011-03-17Now the client centers the pixel positions when using tA.Yohann Ferreira1-0/+34
I made it so that the behaviour can be changed with only a boolean setting in the playerhandler.
2011-03-10Fix the pathfinding method to acccept every walkmasks.Yohann Ferreira1-1/+1
Previously, the walkmask was hardcoded to handling walls. Trivial.
2011-03-10Wrap the open and closed list members in path finding.Yohann Ferreira1-9/+22
This prevent some weird things happening in path finding when playing for a very long time. Reviewed-by: Thorbjorn.
2011-01-10Remove the player naturally avoid other beings for Manaserv.Yohann Ferreira1-1/+5
It could lead to (even small) curious desyncs making things worse to debug. Trivial.
2010-11-01Merge branch '0.5' of gitorious.org:mana/manaYohann Ferreira1-11/+15
Conflicts: src/being.cpp src/client.cpp src/commandhandler.cpp src/gui/setup_video.cpp src/gui/socialwindow.cpp src/gui/viewport.cpp src/gui/widgets/browserbox.cpp src/gui/widgets/itemcontainer.cpp src/imageparticle.cpp src/localplayer.cpp src/localplayer.h src/map.cpp src/net/tmwa/beinghandler.cpp src/particle.cpp src/particle.h src/player.cpp src/player.h
2010-10-22Turned the OpenGL and disable transparency options as static members.Yohann Ferreira1-1/+1
- Now OpenGL and the transparency disabling are set at startup and not read again for displaying graphics, preventing graphic errors before startup. - We also agreed long time ago that SDL specific functions should have a SDL prefix. The header has been rearranged a bit to do so. - Also fixed a possible discrepancy in the hasAlphaChannel() function. Reviewed-by: CodyMartin. Resolves: Mana-Mantis: #260.
2010-10-17Added Low CPU Mode toggle in video setup. Defaults to On.madcamel@gmail.com1-10/+14
This disables the Image::setAlpha() function, which uses 60% of the client's CPU cycles. When enabled, visual quality is slightly decreased, especially with the particle system. Toggling this setting On from an Off state requires a client restart or the graphics look quite funny. Bertram's addition: - Renamed 'Low CPU' to 'Disable transparency (Low CPU)' in the gui for better understanding. - Removed the sprite display with 30% opacity when disabling transparency since it made monsters and drops be drawn above all layers at full opacity. - Made the OpenGL mode disable the 'low CPU mode'. - Fixed the GUI logic as much as possible. Please note that the GUI opacity slider stays enabled when transparency is disabled even if told to be disabled in that case. Reviewed-by: CodyMartin, 4144, MadCamel.
2010-07-28Centralized configuration default values using the VariableData system.Yohann Ferreira1-3/+3
Please note that I didn't turned all the getValue() call into new ones, simply because I have to have config object initiated which is not forcefully the case the branding file. Resolves: Manasource Mantis #170.
2010-07-22Add two debug map modes and improve slightly map drawing.Andrei Karas1-12/+75
Reviewed-by: Bertram
2010-07-19Merge branch '1.0'Yohann Ferreira1-16/+6
Conflicts: src/gui/itempopup.cpp src/item.cpp src/monster.cpp src/net/manaserv/playerhandler.cpp src/net/tmwa/partyhandler.cpp src/npc.cpp src/player.cpp src/resources/itemdb.cpp src/resources/monsterdb.cpp src/resources/monsterinfo.cpp src/resources/npcdb.cpp src/resources/spritedef.cpp
2010-07-09Fix tileset gid handling to better match TiledJared Adams1-16/+6
This change allows extending tilesets without causing issues. Reviewed-by: Freeyorp
2010-06-13Merge remote branch '1.0/1.0'Jared Adams1-5/+2
Conflicts: data/graphics/CMakeLists.txt data/graphics/Makefile.am src/client.cpp
2010-06-10Merge BeingManager and FloorItemManager as ActorSpriteManagerJared Adams1-5/+7
No need for two different classes to manage ActorSprites. Reviewed-by: Chuck Miller
2010-06-05Fix memory leak in minimapAndrei Karas1-5/+2
Reviewed-by: Thorbjørn Lindeijer
2010-05-21Fix handling sprite alphaJared Adams1-2/+1
This way, it's only set to the overlay alpha while drawing the overlay. Fixes PlayerBox rendering.
2010-04-23Add an Actor class to replace the Sprite classJared Adams1-30/+29
The Actor class manages the Map reference, position vector, and alpha float. These are the common parts from it's children.
2010-04-12Completely ignore eAthena job 45Jared Adams1-3/+1
These are warps. Reviewed-by: Bertram
2010-04-12Reviewed the LocalPlayer::nextTile() function. The ManaServ movement system ↵Bertram1-2/+2
is functional!! Introduced LocalPlayer::getNextWalkPosition(unsigned char dir) which takes care about the player next position while moving using keyboard. I removed the pixel scaler thing because it couldn't handle all the noticed cases and was rather heavy. There is still a bug in the movement system (nothing's perfect) but it's very rare and this is here in eAthena, too. So, I'll give a try at taking care of it once I'll have polished all of this a bit. Please try and give feedback!!
2010-04-12Move path finding related code to the Map class and small fixes.Bertram1-11/+125
It permits two things: 1. It simplifies and demystifies Being::SetDestination() code. 2. It will permit to show the *real* calulated path when using the drawDebugPath feature for ManaServ.
2010-03-08Fix properties bug.Andrei Karas1-2/+2
Fix Random crushes and valgrind memory errors. Reviewed-by: thorbjorn
2010-03-04Fixed crash when a map-based particle effect can't be loadedPhilipp Sehmisch1-1/+1
2010-03-04Implemented markers for warp portals defined in map files in form of ↵Philipp Sehmisch1-2/+11
particle effects. Reviewed-by: Jared Adams <jaxad0127@gmail.com>
2010-02-24Some code cleanupsThorbjørn Lindeijer1-1/+2
Reviewed-by: Jared Adams
2010-02-21Made tick counter and framerate limiter work during login sequenceThorbjørn Lindeijer1-6/+4
Much code was moved from main() to the new Client::exec(). This new event loop now integrates with the Game class, so that the tick counter and framerate limiter apply universally. The Client class is also responsible for some things that used to be global variables. Mantis-issue: ...
2010-02-22Modify copyright headersFreeyorp1-1/+2
2010-02-20License header update for The Mana ClientThorbjørn Lindeijer1-4/+3
2010-02-09Got successfully rid of tile width/height fallback values as asked by Jaxad.Bertram1-6/+0
But I added some logs when speed and other actions where refused due to game/map uninitialized. This could help.
2010-02-09Separated fallback defaults for tile width and height.Bertram1-1/+2