diff options
author | Bertram <bertram@cegetel.net> | 2009-10-29 11:20:29 +0100 |
---|---|---|
committer | Bertram <bertram@cegetel.net> | 2009-10-29 11:20:29 +0100 |
commit | 6d2a6ee01523bbec105cd2e6ce9a24ab7c1094f2 (patch) | |
tree | 99bd2c18c08a034a5fcffe49dfa3d2ade43095b0 /src/gui/viewport.cpp | |
parent | 45223500f7a5f661adea71e57010b018bac2cf32 (diff) | |
download | mana-6d2a6ee01523bbec105cd2e6ce9a24ab7c1094f2.tar.gz mana-6d2a6ee01523bbec105cd2e6ce9a24ab7c1094f2.tar.bz2 mana-6d2a6ee01523bbec105cd2e6ce9a24ab7c1094f2.tar.xz mana-6d2a6ee01523bbec105cd2e6ce9a24ab7c1094f2.zip |
Second round of fine tuning for keyboard movement.
I just discovered that the X,Y offsets aren't handled
the same way between eAthena and Manaserv to draw the player's character.
So, this patch hopefully fix the walk on water bug.
There are some glitches left:
- Like walking diagonally to a blocked corner.
- Or Some times the character miss a blocked tile and correct its route.
- The character's name is drawn in the wrong place for Manaserv client.
- The playerBox draws the player at the wrong location; He's not centered at login
and isn't diplayed at all in equipment window...
But anyway, it's better than before.
I'll go on for some polishing before continuing. Some cleanups
are becoming vital for code's understanding.
Diffstat (limited to 'src/gui/viewport.cpp')
-rw-r--r-- | src/gui/viewport.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 21a6ec80..6e9720e9 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -231,8 +231,8 @@ void Viewport::logic() if (!mMap || !player_node) return; -#ifdef EATHENA_SUPPORT Uint8 button = SDL_GetMouseState(&mMouseX, &mMouseY); +#ifdef EATHENA_SUPPORT if (mPlayerFollowMouse && button & SDL_BUTTON(1) && mWalkTime != player_node->mWalkTime) @@ -241,6 +241,17 @@ void Viewport::logic() mMouseY / 32 + mTileViewY); mWalkTime = player_node->mWalkTime; } +#else // MANASERV_SUPPORT + Uint8 *keys = SDL_GetKeyState(NULL); + if (mPlayerFollowMouse && button & SDL_BUTTON(1) && + !(keys[SDLK_LSHIFT] || keys[SDLK_RSHIFT]) && + get_elapsed_time(mLocalWalkTime) >= walkingMouseDelay) + { + mLocalWalkTime = tick_time; + player_node->setDestination(mMouseX + (int) mPixelViewX, + mMouseY + (int) mPixelViewY); + player_node->pathSetByMouse(); + } #endif } |