mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-03 20:19:40 +00:00
Fix SetPos and SetAngle functions
Fix types for SetPos and SetAngle
This commit is contained in:
parent
645a21af21
commit
6f07d590d4
5 changed files with 28 additions and 5 deletions
|
@ -48,7 +48,7 @@ double ScriptFunctions::GetPosZ(unsigned short pid) noexcept
|
||||||
return player->Position()->pos[2];
|
return player->Position()->pos[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptFunctions::SetPos(unsigned short pid, float x, float y, float z) noexcept
|
void ScriptFunctions::SetPos(unsigned short pid, double x, double y, double z) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player,);
|
GET_PLAYER(pid, player,);
|
||||||
|
@ -140,7 +140,7 @@ double ScriptFunctions::GetAngleZ(unsigned short pid) noexcept
|
||||||
return player->Position()->rot[2];
|
return player->Position()->rot[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptFunctions::SetAngle(unsigned short pid, float x, float y, float z) noexcept
|
void ScriptFunctions::SetAngle(unsigned short pid, double x, double y, double z) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player,);
|
GET_PLAYER(pid, player,);
|
||||||
|
|
|
@ -36,14 +36,14 @@ public:
|
||||||
static double GetPosX(unsigned short pid) noexcept;
|
static double GetPosX(unsigned short pid) noexcept;
|
||||||
static double GetPosY(unsigned short pid) noexcept;
|
static double GetPosY(unsigned short pid) noexcept;
|
||||||
static double GetPosZ(unsigned short pid) noexcept;
|
static double GetPosZ(unsigned short pid) noexcept;
|
||||||
static void SetPos(unsigned short pid, float x, float y, float z) noexcept;
|
static void SetPos(unsigned short pid, double x, double y, double z) noexcept;
|
||||||
|
|
||||||
|
|
||||||
static void GetAngle(unsigned short pid, float *x, float *y, float *z) noexcept;
|
static void GetAngle(unsigned short pid, float *x, float *y, float *z) noexcept;
|
||||||
static double GetAngleX(unsigned short pid) noexcept;
|
static double GetAngleX(unsigned short pid) noexcept;
|
||||||
static double GetAngleY(unsigned short pid) noexcept;
|
static double GetAngleY(unsigned short pid) noexcept;
|
||||||
static double GetAngleZ(unsigned short pid) noexcept;
|
static double GetAngleZ(unsigned short pid) noexcept;
|
||||||
static void SetAngle(unsigned short pid, float x, float y, float z) noexcept;
|
static void SetAngle(unsigned short pid, double x, double y, double z) noexcept;
|
||||||
|
|
||||||
static void SetCell(unsigned short pid, const char *name) noexcept;
|
static void SetCell(unsigned short pid, const char *name) noexcept;
|
||||||
static const char *GetCell(unsigned short pid) noexcept;
|
static const char *GetCell(unsigned short pid) noexcept;
|
||||||
|
|
|
@ -117,6 +117,18 @@ void LocalPlayer::updatePosition(bool forceUpdate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LocalPlayer::setPosition()
|
||||||
|
{
|
||||||
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
|
MWWorld::Ptr player = world->getPlayerPtr();
|
||||||
|
|
||||||
|
world->getPlayer().setTeleported(true);
|
||||||
|
world->moveObject(player, Position()->pos[0], Position()->pos[1], Position()->pos[2]);
|
||||||
|
world->rotateObject(player, Position()->rot[0], Position()->rot[1], Position()->rot[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void LocalPlayer::updateInventory(bool forceUpdate)
|
void LocalPlayer::updateInventory(bool forceUpdate)
|
||||||
{
|
{
|
||||||
MWWorld::Ptr player = GetPlayerPtr();
|
MWWorld::Ptr player = GetPlayerPtr();
|
||||||
|
|
|
@ -29,6 +29,8 @@ namespace mwmp
|
||||||
void updateCell(bool forceUpdate = false);
|
void updateCell(bool forceUpdate = false);
|
||||||
void updateDrawStateAndFlags(bool forceUpdate = false);
|
void updateDrawStateAndFlags(bool forceUpdate = false);
|
||||||
|
|
||||||
|
void setPosition();
|
||||||
|
|
||||||
void CharGen(int stageFirst, int stageEnd);
|
void CharGen(int stageFirst, int stageEnd);
|
||||||
|
|
||||||
bool CharGenThread(); // return true if CGStage::current == CGStage::end
|
bool CharGenThread(); // return true if CGStage::current == CGStage::end
|
||||||
|
|
|
@ -204,7 +204,16 @@ void Networking::ReciveMessage(RakNet::Packet *packet)
|
||||||
case ID_GAME_UPDATE_POS:
|
case ID_GAME_UPDATE_POS:
|
||||||
{
|
{
|
||||||
if(id == myid)
|
if(id == myid)
|
||||||
|
{
|
||||||
|
if (packet->length != myPacket->headerSize())
|
||||||
|
{
|
||||||
|
cout << "ID_GAME_UPDATE_POS changed by server" << endl;
|
||||||
|
myPacket->Packet(&bsIn, getLocalPlayer(), false);
|
||||||
|
getLocalPlayer()->setPosition();
|
||||||
|
}
|
||||||
|
else
|
||||||
getLocalPlayer()->updatePosition(true);
|
getLocalPlayer()->updatePosition(true);
|
||||||
|
}
|
||||||
else if(pl != 0)
|
else if(pl != 0)
|
||||||
myPacket->Packet(&bsIn, pl, false);
|
myPacket->Packet(&bsIn, pl, false);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue