summaryrefslogtreecommitdiff
path: root/src/gui/viewport.cpp
diff options
context:
space:
mode:
authorChuck Miller <shadowmil@gmail.com>2009-05-01 21:28:29 -0400
committerChuck Miller <shadowmil@gmail.com>2009-05-01 21:28:29 -0400
commit51d6f634eecae2a9e68078a7272353b8b61fd4e1 (patch)
treecbb34cc845dcc5dfcf36eda2761eb2f8f5b8db6d /src/gui/viewport.cpp
parent81e0bb1a26530c5b5dc012ef125ce806b431a030 (diff)
downloadmana-client-51d6f634eecae2a9e68078a7272353b8b61fd4e1.tar.gz
mana-client-51d6f634eecae2a9e68078a7272353b8b61fd4e1.tar.bz2
mana-client-51d6f634eecae2a9e68078a7272353b8b61fd4e1.tar.xz
mana-client-51d6f634eecae2a9e68078a7272353b8b61fd4e1.zip
Changed the way beings are handled when clicked on with a TMWServ build
(mainly talking to NPCs, and attacking Monsters / Players. Though combat is still broken.)
Diffstat (limited to 'src/gui/viewport.cpp')
-rw-r--r--src/gui/viewport.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 9ce537fc..041794c2 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -335,21 +335,22 @@ void Viewport::mousePressed(gcn::MouseEvent &event)
if (event.getButton() == gcn::MouseEvent::LEFT)
{
FloorItem *item;
-#ifdef EATHENA_SUPPORT
Being *being;
// Interact with some being
-// if ((being = beingManager->findBeing(tilex, tiley)))
if ((being = beingManager->findBeingByPixel(pixelx, pixely)))
{
switch (being->getType())
{
+ // Talk to NPCs
case Being::NPC:
dynamic_cast<NPC*>(being)->talk();
break;
+ // Attack or walk to monsters or players
case Being::MONSTER:
case Being::PLAYER:
+ // Ignore it if its dead
if (being->mAction == Being::DEAD)
break;
@@ -357,23 +358,30 @@ void Viewport::mousePressed(gcn::MouseEvent &event)
keyboard.isKeyActive(keyboard.KEY_ATTACK))
{
player_node->setGotoTarget(being);
+//TODO: This can be changed when TMWServ moves to target based combat
+#ifdef TMWSERV_SUPPORT
+ player_node->attack();
+#else
player_node->attack(being,
!keyboard.isKeyActive(keyboard.KEY_TARGET));
+#endif
+
}
else
{
+#ifdef TMWSERV_SUPPORT
+ player_node->setDestination(event.getX() + (int) mPixelViewX,
+ event.getY() + (int) mPixelViewY);
+#else
player_node->setDestination(tilex, tiley);
+#endif
}
break;
-
default:
break;
}
- }
- // Pick up some item
- else
-#endif
- if ((item = floorItemManager->findByCoordinates(tilex, tiley)))
+ // Picks up a item if we clicked on one
+ } else if ((item = floorItemManager->findByCoordinates(tilex, tiley)))
{
player_node->pickUp(item);
}