forked from teamnwah/openmw-tes3coop
[Client] Add and use DedicatedPlayer::update()
This commit is contained in:
parent
e11a24f446
commit
44476248b7
2 changed files with 43 additions and 36 deletions
|
@ -56,43 +56,10 @@ void PlayerList::update(float dt)
|
|||
{
|
||||
for (std::map <RakNet::RakNetGUID, DedicatedPlayer *>::iterator it = players.begin(); it != players.end(); it++)
|
||||
{
|
||||
DedicatedPlayer *pl = it->second;
|
||||
if (pl == 0) continue;
|
||||
DedicatedPlayer *player = it->second;
|
||||
if (player == 0) continue;
|
||||
|
||||
MWMechanics::NpcStats *ptrNpcStats = &pl->ptr.getClass().getNpcStats(pl->getPtr());
|
||||
|
||||
MWMechanics::DynamicStat<float> value;
|
||||
|
||||
if (pl->creatureStats.mDead)
|
||||
{
|
||||
value.readState(pl->creatureStats.mDynamic[0]);
|
||||
ptrNpcStats->setHealth(value);
|
||||
continue;
|
||||
}
|
||||
|
||||
value.readState(pl->creatureStats.mDynamic[0]);
|
||||
ptrNpcStats->setHealth(value);
|
||||
value.readState(pl->creatureStats.mDynamic[1]);
|
||||
ptrNpcStats->setMagicka(value);
|
||||
value.readState(pl->creatureStats.mDynamic[2]);
|
||||
ptrNpcStats->setFatigue(value);
|
||||
|
||||
if (ptrNpcStats->isDead())
|
||||
ptrNpcStats->resurrect();
|
||||
|
||||
ptrNpcStats->setAttacked(false);
|
||||
|
||||
ptrNpcStats->getAiSequence().stopCombat();
|
||||
|
||||
ptrNpcStats->setAlarmed(false);
|
||||
ptrNpcStats->setAiSetting(MWMechanics::CreatureStats::AI_Alarm, 0);
|
||||
ptrNpcStats->setAiSetting(MWMechanics::CreatureStats::AI_Fight, 0);
|
||||
ptrNpcStats->setAiSetting(MWMechanics::CreatureStats::AI_Flee, 0);
|
||||
ptrNpcStats->setAiSetting(MWMechanics::CreatureStats::AI_Hello, 0);
|
||||
|
||||
ptrNpcStats->setBaseDisposition(255);
|
||||
pl->move(dt);
|
||||
pl->updateAnimFlags();
|
||||
player->update(dt);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,6 +208,44 @@ bool PlayerList::isDedicatedPlayer(const MWWorld::Ptr &ptr)
|
|||
return (getPlayer(ptr) != 0);
|
||||
}
|
||||
|
||||
void DedicatedPlayer::update(float dt)
|
||||
{
|
||||
MWMechanics::NpcStats *ptrNpcStats = &ptr.getClass().getNpcStats(ptr);
|
||||
|
||||
MWMechanics::DynamicStat<float> value;
|
||||
|
||||
if (creatureStats.mDead)
|
||||
{
|
||||
value.readState(creatureStats.mDynamic[0]);
|
||||
ptrNpcStats->setHealth(value);
|
||||
return;
|
||||
}
|
||||
|
||||
value.readState(creatureStats.mDynamic[0]);
|
||||
ptrNpcStats->setHealth(value);
|
||||
value.readState(creatureStats.mDynamic[1]);
|
||||
ptrNpcStats->setMagicka(value);
|
||||
value.readState(creatureStats.mDynamic[2]);
|
||||
ptrNpcStats->setFatigue(value);
|
||||
|
||||
if (ptrNpcStats->isDead())
|
||||
ptrNpcStats->resurrect();
|
||||
|
||||
ptrNpcStats->setAttacked(false);
|
||||
|
||||
ptrNpcStats->getAiSequence().stopCombat();
|
||||
|
||||
ptrNpcStats->setAlarmed(false);
|
||||
ptrNpcStats->setAiSetting(MWMechanics::CreatureStats::AI_Alarm, 0);
|
||||
ptrNpcStats->setAiSetting(MWMechanics::CreatureStats::AI_Fight, 0);
|
||||
ptrNpcStats->setAiSetting(MWMechanics::CreatureStats::AI_Flee, 0);
|
||||
ptrNpcStats->setAiSetting(MWMechanics::CreatureStats::AI_Hello, 0);
|
||||
|
||||
ptrNpcStats->setBaseDisposition(255);
|
||||
move(dt);
|
||||
updateAnimFlags();
|
||||
}
|
||||
|
||||
void DedicatedPlayer::move(float dt)
|
||||
{
|
||||
if (state != 2) return;
|
||||
|
|
|
@ -53,6 +53,8 @@ namespace mwmp
|
|||
|
||||
public:
|
||||
|
||||
void update(float dt);
|
||||
|
||||
void move(float dt);
|
||||
void updateAnimFlags();
|
||||
void updateEquipment();
|
||||
|
|
Loading…
Reference in a new issue