mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-10 12:36:45 +03:00
Change most Getters and Setters into assignments. Change GameScriptItemInfo to use new PHD_3DPOS -> GameScript[Position/Rotation] constructor. Add value conversions/corrections to Get/SetRot.
This commit is contained in:
parent
73bf4d24a1
commit
2def69f79a
1 changed files with 30 additions and 41 deletions
|
@ -7,6 +7,7 @@
|
||||||
#include "lot.h"
|
#include "lot.h"
|
||||||
#include "GameScriptPosition.h"
|
#include "GameScriptPosition.h"
|
||||||
#include "GameScriptRotation.h"
|
#include "GameScriptRotation.h"
|
||||||
|
#include "trmath.h"
|
||||||
|
|
||||||
extern bool const WarningsAsErrors;
|
extern bool const WarningsAsErrors;
|
||||||
|
|
||||||
|
@ -29,32 +30,19 @@ void GameScriptItemInfo::Register(sol::state * state)
|
||||||
state->new_usertype<GameScriptItemInfo>("ItemInfo",
|
state->new_usertype<GameScriptItemInfo>("ItemInfo",
|
||||||
"new", sol::overload(&GameScriptItemInfo::Create, &GameScriptItemInfo::CreateEmpty),
|
"new", sol::overload(&GameScriptItemInfo::Create, &GameScriptItemInfo::CreateEmpty),
|
||||||
"Init", &GameScriptItemInfo::Init,
|
"Init", &GameScriptItemInfo::Init,
|
||||||
"GetPos", &GameScriptItemInfo::GetPos,
|
"currentAnim", sol::property(&GameScriptItemInfo::GetCurrentAnim, &GameScriptItemInfo::GetCurrentAnim),
|
||||||
"GetRot", &GameScriptItemInfo::GetRot,
|
"requiredAnim", sol::property(&GameScriptItemInfo::GetRequiredAnim, &GameScriptItemInfo::SetRequiredAnim),
|
||||||
"GetCurrentAnim", &GameScriptItemInfo::GetCurrentAnim,
|
"goalAnim", sol::property(&GameScriptItemInfo::GetGoalAnim, &GameScriptItemInfo::SetGoalAnim),
|
||||||
"GetRequiredAnim", &GameScriptItemInfo::GetRequiredAnim,
|
"HP", sol::property(&GameScriptItemInfo::GetHP, &GameScriptItemInfo::SetHP),
|
||||||
"GetGoalAnim", &GameScriptItemInfo::GetGoalAnim,
|
"OCB", sol::property(&GameScriptItemInfo::GetOCB, &GameScriptItemInfo::SetOCB),
|
||||||
"GetHP", &GameScriptItemInfo::GetHP,
|
"itemFlags", sol::property(&GameScriptItemInfo::GetItemFlags, &GameScriptItemInfo::SetItemFlags),
|
||||||
"GetOCB", &GameScriptItemInfo::GetOCB,
|
"AIBits", sol::property(&GameScriptItemInfo::GetAIBits, &GameScriptItemInfo::SetAIBits),
|
||||||
"GetItemFlags", &GameScriptItemInfo::GetItemFlags,
|
"status", sol::property(&GameScriptItemInfo::GetStatus, &GameScriptItemInfo::SetStatus),
|
||||||
"GetAIBits", &GameScriptItemInfo::GetAIBits,
|
"hitStatus", sol::property(&GameScriptItemInfo::GetHitStatus, &GameScriptItemInfo::SetHitStatus),
|
||||||
"GetStatus", &GameScriptItemInfo::GetStatus,
|
"active", sol::property(&GameScriptItemInfo::GetActive, &GameScriptItemInfo::SetActive),
|
||||||
"GetHitStatus", &GameScriptItemInfo::GetHitStatus,
|
"room", sol::property(&GameScriptItemInfo::GetRoom, &GameScriptItemInfo::SetRoom),
|
||||||
"GetActive", &GameScriptItemInfo::GetActive,
|
"pos", sol::property(&GameScriptItemInfo::GetPos, &GameScriptItemInfo::SetPos),
|
||||||
"GetRoom", &GameScriptItemInfo::GetRoom,
|
"rot", sol::property(&GameScriptItemInfo::GetRot, &GameScriptItemInfo::SetRot),
|
||||||
"SetPos", &GameScriptItemInfo::SetPos,
|
|
||||||
"SetRot", &GameScriptItemInfo::SetRot,
|
|
||||||
"SetCurrentAnim", &GameScriptItemInfo::SetCurrentAnim,
|
|
||||||
"SetRequiredAnim", &GameScriptItemInfo::SetRequiredAnim,
|
|
||||||
"SetGoalAnim", &GameScriptItemInfo::SetGoalAnim,
|
|
||||||
"SetHP", &GameScriptItemInfo::SetHP,
|
|
||||||
"SetOCB", &GameScriptItemInfo::SetOCB,
|
|
||||||
"SetItemFlags", &GameScriptItemInfo::SetItemFlags,
|
|
||||||
"SetAIBits", &GameScriptItemInfo::SetAIBits,
|
|
||||||
"SetStatus", &GameScriptItemInfo::SetStatus,
|
|
||||||
"SetHitStatus", &GameScriptItemInfo::SetHitStatus,
|
|
||||||
"SetActive", &GameScriptItemInfo::SetActive,
|
|
||||||
"SetRoom", &GameScriptItemInfo::SetRoom,
|
|
||||||
"Enable", &GameScriptItemInfo::EnableItem,
|
"Enable", &GameScriptItemInfo::EnableItem,
|
||||||
"Disable", &GameScriptItemInfo::DisableItem);
|
"Disable", &GameScriptItemInfo::DisableItem);
|
||||||
}
|
}
|
||||||
|
@ -115,29 +103,30 @@ void GameScriptItemInfo::Init()
|
||||||
|
|
||||||
GameScriptPosition GameScriptItemInfo::GetPos() const
|
GameScriptPosition GameScriptItemInfo::GetPos() const
|
||||||
{
|
{
|
||||||
return GameScriptPosition( m_item->pos.xPos,
|
return GameScriptPosition( m_item->pos );
|
||||||
m_item->pos.yPos,
|
|
||||||
m_item->pos.zPos);
|
|
||||||
}
|
|
||||||
void GameScriptItemInfo::SetPos(GameScriptPosition const& pos)
|
|
||||||
{
|
|
||||||
m_item->pos.xPos = pos.GetX();
|
|
||||||
m_item->pos.yPos = pos.GetY();
|
|
||||||
m_item->pos.zPos = pos.GetZ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameScriptItemInfo::SetPos(GameScriptPosition const& pos)
|
||||||
|
{
|
||||||
|
pos.StoreInPHDPos(m_item->pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This does not guarantee that the returned value will be identical
|
||||||
|
// to a value written in via SetRot - only that the angle measures
|
||||||
|
// will be mathematically equal
|
||||||
|
// (e.g. 90 degrees = -270 degrees = 450 degrees)
|
||||||
GameScriptRotation GameScriptItemInfo::GetRot() const
|
GameScriptRotation GameScriptItemInfo::GetRot() const
|
||||||
{
|
{
|
||||||
return GameScriptRotation( m_item->pos.xRot,
|
return GameScriptRotation( int(TO_DEGREES(m_item->pos.xRot)) % 360,
|
||||||
m_item->pos.yRot,
|
int(TO_DEGREES(m_item->pos.yRot)) % 360,
|
||||||
m_item->pos.zRot);
|
int(TO_DEGREES(m_item->pos.zRot)) % 360);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameScriptItemInfo::SetRot(GameScriptRotation const& rot)
|
void GameScriptItemInfo::SetRot(GameScriptRotation const& rot)
|
||||||
{
|
{
|
||||||
m_item->pos.xRot = rot.GetX();
|
m_item->pos.xRot = FROM_DEGREES(rot.x);
|
||||||
m_item->pos.yRot = rot.GetY();
|
m_item->pos.yRot = FROM_DEGREES(rot.y);
|
||||||
m_item->pos.zRot = rot.GetZ();
|
m_item->pos.zRot = FROM_DEGREES(rot.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
short GameScriptItemInfo::GetGoalAnim() const
|
short GameScriptItemInfo::GetGoalAnim() const
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue