Merge remote branch 'minty3/testbranch'

actorid
Marc Zinnschlag 13 years ago
commit 5e9d209b21

@ -65,6 +65,8 @@ namespace MWInput
A_QuickLoad,
A_QuickMenu,
A_GameMenu,
A_ToggleWeapon,
A_ToggleSpell,
A_LAST // Marker for the last item
};
@ -86,6 +88,38 @@ namespace MWInput
/* InputImpl Methods */
void toggleSpell()
{
DrawState state = player.getDrawState();
if(state == DrawState_Weapon || state == DrawState_Nothing)
{
player.setDrawState(DrawState_Spell);
std::cout << "Player has now readied his hands for spellcasting!\n";
}
else
{
player.setDrawState(DrawState_Nothing);
std::cout << "Player does not have any kind of attack ready now.\n";
}
}
void toggleWeapon()
{
DrawState state = player.getDrawState();
if(state == DrawState_Spell || state == DrawState_Nothing)
{
player.setDrawState(DrawState_Weapon);
std::cout << "Player is now drawing his weapon.\n";
}
else
{
player.setDrawState(DrawState_Nothing);
std::cout << "Player does not have any kind of attack ready now.\n";
}
}
void screenshot()
{
mEngine.screenshot();
@ -197,7 +231,10 @@ namespace MWInput
"Auto Move");
disp->funcs.bind(A_ToggleWalk, boost::bind(&InputImpl::toggleWalking, this),
"Toggle Walk/Run");
disp->funcs.bind(A_ToggleWeapon,boost::bind(&InputImpl::toggleWeapon,this),
"Draw Weapon");
disp->funcs.bind(A_ToggleSpell,boost::bind(&InputImpl::toggleSpell,this),
"Ready hands");
// Add the exit listener
ogre.getRoot()->addFrameListener(&exit);
@ -242,6 +279,8 @@ namespace MWInput
disp->bind(A_AutoMove, KC_Z);
disp->bind(A_ToggleSneak, KC_X);
disp->bind(A_ToggleWalk, KC_C);
disp->bind(A_ToggleWeapon,KC_F);
disp->bind(A_ToggleSpell,KC_R);
// Key bindings for polled keys
// NOTE: These keys are constantly being polled. Only add keys that must be checked each frame.

@ -0,0 +1,11 @@
#ifndef GAME_MWMECHANICS_DRAWSTATE_H
#define GAME_MWMECHANICS_DRAWSTATE_H
enum DrawState
{
DrawState_Weapon = 0,
DrawState_Spell = 1,
DrawState_Nothing = 2,
};
#endif

@ -4,13 +4,13 @@
#include <map>
#include "stat.hpp"
#include "drawstate.hpp"
namespace MWMechanics
{
/// \brief Additional stats for NPCs
///
/// For non-NPC-specific stats, see the CreatureStats struct.
struct NpcStats
{
// NPCs other than the player can only have one faction. But for the sake of consistency
@ -24,9 +24,10 @@ namespace MWMechanics
bool mRun;
bool mSneak;
bool mCombat;
DrawState mDrawState;
NpcStats() : mForceRun (false), mForceSneak (false), mRun (false), mSneak (false),
mCombat (false) {}
mCombat (false) , mDrawState(DrawState_Nothing) {}
};
}

@ -26,7 +26,9 @@ namespace MWWorld
{
}
void Class::insertObject(const Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const{
void Class::insertObject(const Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const
{
}

@ -4,6 +4,7 @@
#include "../mwrender/player.hpp"
#include "../mwmechanics/movement.hpp"
#include "../mwmechanics/npcstats.hpp"
#include "world.hpp"
#include "class.hpp"
@ -48,6 +49,12 @@ namespace MWWorld
mClass = new_class;
}
void Player::setDrawState(const DrawState& value)
{
MWWorld::Ptr ptr = getPlayer();
MWWorld::Class::get(ptr).getNpcStats(ptr).mDrawState = value;
}
void Player::setAutoMove (bool enable)
{
MWWorld::Ptr ptr = getPlayer();
@ -89,4 +96,10 @@ namespace MWWorld
MWWorld::Class::get (ptr).setStance (ptr, MWWorld::Class::Run, !running);
}
DrawState Player::getDrawState()
{
MWWorld::Ptr ptr = getPlayer();
return MWWorld::Class::get(ptr).getNpcStats(ptr).mDrawState;
}
}

@ -8,6 +8,8 @@
#include "../mwworld/refdata.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwmechanics/drawstate.hpp"
namespace MWRender
{
class Player;
@ -18,7 +20,7 @@ namespace MWWorld
class World;
/// \brief NPC object representing the player and additional player data
class Player
class Player
{
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> mPlayer;
MWWorld::Ptr::CellStore *mCellStore;
@ -31,7 +33,6 @@ namespace MWWorld
ESM::Class *mClass;
bool mAutoMove;
int mForwardBackward;
public:
Player(MWRender::Player *renderer, const ESM::NPC *player, MWWorld::World& world);
@ -76,6 +77,8 @@ namespace MWWorld
void setClass (const ESM::Class& class_);
void setDrawState(const DrawState& state);
std::string getName() const
{
return mName;
@ -106,6 +109,8 @@ namespace MWWorld
return mAutoMove;
}
DrawState getDrawState();
void setAutoMove (bool enable);
void setLeftRight (int value);

Loading…
Cancel
Save