diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-04-26 23:40:37 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-04-26 23:40:37 +0200 |
commit | 2d0e84449b14615bdacb6f897791628662bbfd39 (patch) | |
tree | 08019ae6c24c6da25e25da027d04ad008c25d6a2 /src/net/manaserv/beinghandler.cpp | |
parent | 42605753159d7b63276351311e0fd43874a3366b (diff) | |
parent | 0056412ed33b941d72a175dcd3f025abcd8fc02b (diff) | |
download | mana-2d0e84449b14615bdacb6f897791628662bbfd39.tar.gz mana-2d0e84449b14615bdacb6f897791628662bbfd39.tar.bz2 mana-2d0e84449b14615bdacb6f897791628662bbfd39.tar.xz mana-2d0e84449b14615bdacb6f897791628662bbfd39.zip |
Made the client use a unique kind of movement code.
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.
Diffstat (limited to 'src/net/manaserv/beinghandler.cpp')
-rw-r--r-- | src/net/manaserv/beinghandler.cpp | 38 |
1 files changed, 3 insertions, 35 deletions
diff --git a/src/net/manaserv/beinghandler.cpp b/src/net/manaserv/beinghandler.cpp index 414f914d..f8cefecf 100644 --- a/src/net/manaserv/beinghandler.cpp +++ b/src/net/manaserv/beinghandler.cpp @@ -91,37 +91,6 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) } } -Vector BeingHandler::giveSpeedInPixelsPerTicks(float speedInTilesPerSeconds) -{ - Vector speedInTicks; - Game *game = Game::instance(); - Map *map = 0; - if (game) - { - map = game->getCurrentMap(); - if (map) - { - speedInTicks.x = speedInTilesPerSeconds - * (float)map->getTileWidth() - / 1000 * (float) MILLISECONDS_IN_A_TICK; - speedInTicks.y = speedInTilesPerSeconds - * (float)map->getTileHeight() - / 1000 * (float) MILLISECONDS_IN_A_TICK; - } - } - - if (!game || !map) - { - speedInTicks.x = speedInTicks.y = 0; - logger->log("Manaserv::BeingHandler: Speed wasn't given back" - " because game/Map not initialized."); - } - // We don't use z for now. - speedInTicks.z = 0; - - return speedInTicks; -} - static void handleLooks(Being *being, Net::MessageIn &msg) { // Order of sent slots. Has to be in sync with the server code. @@ -246,11 +215,10 @@ void BeingHandler::handleBeingsMoveMessage(Net::MessageIn &msg) * The being's speed is transfered in tiles per second * 10 * to keep it transferable in a Byte. * We set it back to tiles per second and in a float. - * Then, we translate it in pixels per ticks, to correspond - * with the Being::logic() function calls - * @see MILLISECONDS_IN_A_TICK */ - being->setWalkSpeed(giveSpeedInPixelsPerTicks((float) speed / 10)); + float speedTilesSeconds = (float) speed / 10; + being->setMoveSpeed(Vector(speedTilesSeconds, speedTilesSeconds, + 0)); } // Ignore messages from the server for the local player |