summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 79f21863..c7c1d213 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -21,6 +21,7 @@
#include "game.h"
+#include "actorsprite.h"
#include "beingmanager.h"
#include "channelmanager.h"
#include "client.h"
@@ -36,7 +37,6 @@
#include "localplayer.h"
#include "log.h"
#include "map.h"
-#include "npc.h"
#include "particle.h"
#include "playerrelations.h"
#include "sound.h"
@@ -206,7 +206,7 @@ static void destroyGuiWindows()
Game *Game::mInstance = 0;
Game::Game():
- mLastTarget(Being::UNKNOWN),
+ mLastTarget(ActorSprite::UNKNOWN),
mCurrentMap(0), mMapName("")
{
assert(!mInstance);
@@ -334,7 +334,9 @@ void Game::logic()
handleInput();
// Handle all necessary game logic
+ ActorSprite::actorLogic();
beingManager->logic();
+ floorItemManager->logic();
particleEngine->update();
if (mCurrentMap)
mCurrentMap->update();
@@ -753,7 +755,7 @@ void Game::handleInput()
return;
// Moving player around
- if (player_node->isAlive() && !NPC::isTalking() &&
+ if (player_node->isAlive() && !Being::isTalking() &&
!chatWindow->isInputFocused() && !quitDialog)
{
// Get the state of the keyboard keys
@@ -832,7 +834,7 @@ void Game::handleInput()
{
// Only auto target Monsters
target = beingManager->findNearestLivingBeing(player_node,
- 20, Being::MONSTER);
+ 20, ActorSprite::MONSTER);
}
player_node->attack(target, newTarget);
}
@@ -844,14 +846,14 @@ void Game::handleInput()
(joystick && joystick->buttonPressed(3))) &&
!keyboard.isKeyActive(keyboard.KEY_TARGET))
{
- Being::Type currentTarget = Being::UNKNOWN;
+ ActorSprite::Type currentTarget = ActorSprite::UNKNOWN;
if (keyboard.isKeyActive(keyboard.KEY_TARGET_CLOSEST) ||
(joystick && joystick->buttonPressed(3)))
- currentTarget = Being::MONSTER;
+ currentTarget = ActorSprite::MONSTER;
else if (keyboard.isKeyActive(keyboard.KEY_TARGET_PLAYER))
- currentTarget = Being::PLAYER;
+ currentTarget = ActorSprite::PLAYER;
else if (keyboard.isKeyActive(keyboard.KEY_TARGET_NPC))
- currentTarget = Being::NPC;
+ currentTarget = ActorSprite::NPC;
Being *target = beingManager->findNearestLivingBeing(player_node,
20, currentTarget);
@@ -865,7 +867,7 @@ void Game::handleInput()
}
else
{
- mLastTarget = Being::UNKNOWN; // Reset last target
+ mLastTarget = ActorSprite::UNKNOWN; // Reset last target
}
// Talk to the nearest NPC if 't' pressed
@@ -876,8 +878,8 @@ void Game::handleInput()
if (target)
{
- if (target->getType() == Being::NPC)
- static_cast<NPC*>(target)->talk();
+ if (target->canTalk())
+ target->talkTo();
}
}