mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-07-07 00:51:36 +00:00
Merge remote branch 'minty3/testbranch'
This commit is contained in:
commit
5e9d209b21
6 changed files with 77 additions and 6 deletions
|
@ -65,6 +65,8 @@ namespace MWInput
|
||||||
A_QuickLoad,
|
A_QuickLoad,
|
||||||
A_QuickMenu,
|
A_QuickMenu,
|
||||||
A_GameMenu,
|
A_GameMenu,
|
||||||
|
A_ToggleWeapon,
|
||||||
|
A_ToggleSpell,
|
||||||
|
|
||||||
A_LAST // Marker for the last item
|
A_LAST // Marker for the last item
|
||||||
};
|
};
|
||||||
|
@ -86,6 +88,38 @@ namespace MWInput
|
||||||
|
|
||||||
/* InputImpl Methods */
|
/* 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()
|
void screenshot()
|
||||||
{
|
{
|
||||||
mEngine.screenshot();
|
mEngine.screenshot();
|
||||||
|
@ -197,7 +231,10 @@ namespace MWInput
|
||||||
"Auto Move");
|
"Auto Move");
|
||||||
disp->funcs.bind(A_ToggleWalk, boost::bind(&InputImpl::toggleWalking, this),
|
disp->funcs.bind(A_ToggleWalk, boost::bind(&InputImpl::toggleWalking, this),
|
||||||
"Toggle Walk/Run");
|
"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
|
// Add the exit listener
|
||||||
ogre.getRoot()->addFrameListener(&exit);
|
ogre.getRoot()->addFrameListener(&exit);
|
||||||
|
|
||||||
|
@ -242,6 +279,8 @@ namespace MWInput
|
||||||
disp->bind(A_AutoMove, KC_Z);
|
disp->bind(A_AutoMove, KC_Z);
|
||||||
disp->bind(A_ToggleSneak, KC_X);
|
disp->bind(A_ToggleSneak, KC_X);
|
||||||
disp->bind(A_ToggleWalk, KC_C);
|
disp->bind(A_ToggleWalk, KC_C);
|
||||||
|
disp->bind(A_ToggleWeapon,KC_F);
|
||||||
|
disp->bind(A_ToggleSpell,KC_R);
|
||||||
|
|
||||||
// Key bindings for polled keys
|
// Key bindings for polled keys
|
||||||
// NOTE: These keys are constantly being polled. Only add keys that must be checked each frame.
|
// NOTE: These keys are constantly being polled. Only add keys that must be checked each frame.
|
||||||
|
|
11
apps/openmw/mwmechanics/drawstate.hpp
Normal file
11
apps/openmw/mwmechanics/drawstate.hpp
Normal file
|
@ -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 <map>
|
||||||
|
|
||||||
#include "stat.hpp"
|
#include "stat.hpp"
|
||||||
|
#include "drawstate.hpp"
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
/// \brief Additional stats for NPCs
|
/// \brief Additional stats for NPCs
|
||||||
///
|
///
|
||||||
/// For non-NPC-specific stats, see the CreatureStats struct.
|
/// For non-NPC-specific stats, see the CreatureStats struct.
|
||||||
|
|
||||||
struct NpcStats
|
struct NpcStats
|
||||||
{
|
{
|
||||||
// NPCs other than the player can only have one faction. But for the sake of consistency
|
// 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 mRun;
|
||||||
bool mSneak;
|
bool mSneak;
|
||||||
bool mCombat;
|
bool mCombat;
|
||||||
|
DrawState mDrawState;
|
||||||
|
|
||||||
NpcStats() : mForceRun (false), mForceSneak (false), mRun (false), mSneak (false),
|
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 "../mwrender/player.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/movement.hpp"
|
#include "../mwmechanics/movement.hpp"
|
||||||
|
#include "../mwmechanics/npcstats.hpp"
|
||||||
|
|
||||||
#include "world.hpp"
|
#include "world.hpp"
|
||||||
#include "class.hpp"
|
#include "class.hpp"
|
||||||
|
@ -48,6 +49,12 @@ namespace MWWorld
|
||||||
mClass = new_class;
|
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)
|
void Player::setAutoMove (bool enable)
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = getPlayer();
|
MWWorld::Ptr ptr = getPlayer();
|
||||||
|
@ -89,4 +96,10 @@ namespace MWWorld
|
||||||
|
|
||||||
MWWorld::Class::get (ptr).setStance (ptr, MWWorld::Class::Run, !running);
|
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/refdata.hpp"
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
|
||||||
|
#include "../mwmechanics/drawstate.hpp"
|
||||||
|
|
||||||
namespace MWRender
|
namespace MWRender
|
||||||
{
|
{
|
||||||
class Player;
|
class Player;
|
||||||
|
@ -18,7 +20,7 @@ namespace MWWorld
|
||||||
class World;
|
class World;
|
||||||
|
|
||||||
/// \brief NPC object representing the player and additional player data
|
/// \brief NPC object representing the player and additional player data
|
||||||
class Player
|
class Player
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> mPlayer;
|
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> mPlayer;
|
||||||
MWWorld::Ptr::CellStore *mCellStore;
|
MWWorld::Ptr::CellStore *mCellStore;
|
||||||
|
@ -31,7 +33,6 @@ namespace MWWorld
|
||||||
ESM::Class *mClass;
|
ESM::Class *mClass;
|
||||||
bool mAutoMove;
|
bool mAutoMove;
|
||||||
int mForwardBackward;
|
int mForwardBackward;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Player(MWRender::Player *renderer, const ESM::NPC *player, MWWorld::World& world);
|
Player(MWRender::Player *renderer, const ESM::NPC *player, MWWorld::World& world);
|
||||||
|
@ -76,6 +77,8 @@ namespace MWWorld
|
||||||
|
|
||||||
void setClass (const ESM::Class& class_);
|
void setClass (const ESM::Class& class_);
|
||||||
|
|
||||||
|
void setDrawState(const DrawState& state);
|
||||||
|
|
||||||
std::string getName() const
|
std::string getName() const
|
||||||
{
|
{
|
||||||
return mName;
|
return mName;
|
||||||
|
@ -106,6 +109,8 @@ namespace MWWorld
|
||||||
return mAutoMove;
|
return mAutoMove;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DrawState getDrawState();
|
||||||
|
|
||||||
void setAutoMove (bool enable);
|
void setAutoMove (bool enable);
|
||||||
|
|
||||||
void setLeftRight (int value);
|
void setLeftRight (int value);
|
||||||
|
|
Loading…
Reference in a new issue