diff options
author | Ira Rice <irarice@gmail.com> | 2008-10-27 04:23:43 +0000 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2008-10-27 04:23:43 +0000 |
commit | 218ad29dc13b1b89da9804dec15f32692d8709d6 (patch) | |
tree | e1547d951089109de83833fb2a29067fc11eee8c /src/localplayer.cpp | |
parent | 8119f4ec53b64adc427f683077f65ce8aec85582 (diff) | |
download | mana-218ad29dc13b1b89da9804dec15f32692d8709d6.tar.gz mana-218ad29dc13b1b89da9804dec15f32692d8709d6.tar.bz2 mana-218ad29dc13b1b89da9804dec15f32692d8709d6.tar.xz mana-218ad29dc13b1b89da9804dec15f32692d8709d6.zip |
Made targets draw on the fringe layer, as well as added t for talking to
an NPC, n for targeting an NPC, and changed basic targeting code so that
it'll time out after being on a target for longer than a minute.
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r-- | src/localplayer.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 4cdaf03c..440ea636 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -117,6 +117,14 @@ void LocalPlayer::logic() mLastAction = -1; } + // Remove target if its been on a being for more than a minute + if (get_elapsed_time(mTargetTime) >= 60000) + { + mTargetTime = -1; + setTarget(mTarget); + mLastAction = -1; + } + for (int i = Being::TC_SMALL; i < Being::NUM_TC; i++) { player_node->mTargetCursorInRange[i]->update(10); @@ -262,8 +270,16 @@ void LocalPlayer::walk(unsigned char dir) void LocalPlayer::setTarget(Being *target) { + if (mLastAction != -1) + return; + mLastAction = tick_time; + if (target == mTarget) { + if (target != NULL) + { + target->mTargetCursor = NULL; + } return; } if (mTarget && mTarget->getType() == Being::MONSTER) @@ -562,7 +578,7 @@ void LocalPlayer::loadTargetCursor(std::string filename, int width, int height, } } -void LocalPlayer::drawTargetCursor(Graphics *graphics, int offsetX, int offsetY) +void LocalPlayer::drawTargetCursor(Graphics *graphics, int scrollX, int scrollY) { // Draw target marker if needed if (mTarget) @@ -587,9 +603,10 @@ void LocalPlayer::drawTargetCursor(Graphics *graphics, int offsetX, int offsetY) } // Draw the target cursor at the correct position - int posX = mTarget->getPixelX() + 16 - mTarget->mTargetCursor->getWidth() / 2 - offsetX; - int posY = mTarget->getPixelY() + 16 - mTarget->mTargetCursor->getHeight() / 2 - offsetY; + int posX = mTarget->getPixelX() + 16 - mTarget->mTargetCursor->getWidth() / 2 - scrollX; + int posY = mTarget->getPixelY() + 16 - mTarget->mTargetCursor->getHeight() / 2 - scrollY; graphics->drawImage(mTarget->mTargetCursor, posX, posY); } + return; } |