mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-11 13:06:49 +03:00
Add GetRoom script function for all related object types
This commit is contained in:
parent
e6f51fab3c
commit
b68b08ade1
8 changed files with 44 additions and 7 deletions
|
@ -92,6 +92,7 @@ static constexpr char ScriptReserved_SwapMesh[] = "SwapMesh";
|
||||||
static constexpr char ScriptReserved_UnswapMesh[] = "UnswapMesh";
|
static constexpr char ScriptReserved_UnswapMesh[] = "UnswapMesh";
|
||||||
static constexpr char ScriptReserved_GetHitStatus[] = "GetHitStatus";
|
static constexpr char ScriptReserved_GetHitStatus[] = "GetHitStatus";
|
||||||
static constexpr char ScriptReserved_GetActive[] = "GetActive";
|
static constexpr char ScriptReserved_GetActive[] = "GetActive";
|
||||||
|
static constexpr char ScriptReserved_GetRoom[] = "GetRoom";
|
||||||
static constexpr char ScriptReserved_GetRoomNumber[] = "GetRoomNumber";
|
static constexpr char ScriptReserved_GetRoomNumber[] = "GetRoomNumber";
|
||||||
static constexpr char ScriptReserved_SetRoomNumber[] = "SetRoomNumber";
|
static constexpr char ScriptReserved_SetRoomNumber[] = "SetRoomNumber";
|
||||||
static constexpr char ScriptReserved_GetStrength[] = "GetStrength";
|
static constexpr char ScriptReserved_GetStrength[] = "GetStrength";
|
||||||
|
|
|
@ -58,6 +58,11 @@ void AIObject::Register(sol::table & parent)
|
||||||
// @tparam string name The object's new name
|
// @tparam string name The object's new name
|
||||||
ScriptReserved_SetName, &AIObject::SetName,
|
ScriptReserved_SetName, &AIObject::SetName,
|
||||||
|
|
||||||
|
/// Get the current room of the object
|
||||||
|
// @function AIObject:GetRoom
|
||||||
|
// @treturn Room current room of the object
|
||||||
|
ScriptReserved_GetRoom, &AIObject::GetRoom,
|
||||||
|
|
||||||
/// Get the current room number of the object
|
/// Get the current room number of the object
|
||||||
// @function AIObject:GetRoomNumber
|
// @function AIObject:GetRoomNumber
|
||||||
// @treturn int number representing the current room of the object
|
// @treturn int number representing the current room of the object
|
||||||
|
@ -146,7 +151,12 @@ void AIObject::SetName(std::string const & id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
short AIObject::GetRoomNumber() const
|
std::unique_ptr<Room> AIObject::GetRoom() const
|
||||||
|
{
|
||||||
|
return std::make_unique<Room>(g_Level.Rooms[m_aiObject.roomNumber]);
|
||||||
|
}
|
||||||
|
|
||||||
|
int AIObject::GetRoomNumber() const
|
||||||
{
|
{
|
||||||
return m_aiObject.roomNumber;
|
return m_aiObject.roomNumber;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Objects/NamedBase.h"
|
#include "Objects/NamedBase.h"
|
||||||
|
#include "Objects/Room/RoomObject.h"
|
||||||
#include "Specific/level.h"
|
#include "Specific/level.h"
|
||||||
|
|
||||||
namespace sol {
|
namespace sol {
|
||||||
|
@ -24,7 +25,8 @@ public:
|
||||||
Vec3 GetPos() const;
|
Vec3 GetPos() const;
|
||||||
void SetPos(Vec3 const& pos);
|
void SetPos(Vec3 const& pos);
|
||||||
|
|
||||||
short GetRoomNumber() const;
|
std::unique_ptr<Room> GetRoom() const;
|
||||||
|
int GetRoomNumber() const;
|
||||||
void SetRoomNumber(short Room);
|
void SetRoomNumber(short Room);
|
||||||
|
|
||||||
std::string GetName() const;
|
std::string GetName() const;
|
||||||
|
|
|
@ -48,6 +48,11 @@ void CameraObject::Register(sol::table & parent)
|
||||||
// @tparam string name The camera's new name
|
// @tparam string name The camera's new name
|
||||||
ScriptReserved_SetName, &CameraObject::SetName,
|
ScriptReserved_SetName, &CameraObject::SetName,
|
||||||
|
|
||||||
|
/// Get the current room of the camera
|
||||||
|
// @function CameraObject:GetRoom
|
||||||
|
// @treturn Room current room of the camera
|
||||||
|
ScriptReserved_GetRoom, &CameraObject::GetRoom,
|
||||||
|
|
||||||
/// Get the current room number of the camera
|
/// Get the current room number of the camera
|
||||||
// @function Camera:GetRoomNumber
|
// @function Camera:GetRoomNumber
|
||||||
// @treturn int number representing the current room of the camera
|
// @treturn int number representing the current room of the camera
|
||||||
|
@ -96,7 +101,12 @@ void CameraObject::SetName(std::string const & id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
short CameraObject::GetRoomNumber() const
|
std::unique_ptr<Room> CameraObject::GetRoom() const
|
||||||
|
{
|
||||||
|
return std::make_unique<Room>(g_Level.Rooms[m_camera.RoomNumber]);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CameraObject::GetRoomNumber() const
|
||||||
{
|
{
|
||||||
return m_camera.RoomNumber;
|
return m_camera.RoomNumber;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Objects/NamedBase.h"
|
#include "Objects/NamedBase.h"
|
||||||
|
#include "Objects/Room/RoomObject.h"
|
||||||
|
|
||||||
struct LevelCameraInfo;
|
struct LevelCameraInfo;
|
||||||
|
|
||||||
|
@ -24,7 +25,8 @@ public:
|
||||||
Vec3 GetPos() const;
|
Vec3 GetPos() const;
|
||||||
void SetPos(Vec3 const& pos);
|
void SetPos(Vec3 const& pos);
|
||||||
|
|
||||||
short GetRoomNumber() const;
|
std::unique_ptr<Room> GetRoom() const;
|
||||||
|
int GetRoomNumber() const;
|
||||||
void SetRoomNumber(short room);
|
void SetRoomNumber(short room);
|
||||||
|
|
||||||
std::string GetName() const;
|
std::string GetName() const;
|
||||||
|
|
|
@ -410,6 +410,8 @@ ScriptReserved_GetSlotHP, & Moveable::GetSlotHP,
|
||||||
// @treturn bool true if the moveable is active
|
// @treturn bool true if the moveable is active
|
||||||
ScriptReserved_GetActive, &Moveable::GetActive,
|
ScriptReserved_GetActive, &Moveable::GetActive,
|
||||||
|
|
||||||
|
ScriptReserved_GetRoom, &Moveable::GetRoom,
|
||||||
|
|
||||||
ScriptReserved_GetRoomNumber, &Moveable::GetRoomNumber,
|
ScriptReserved_GetRoomNumber, &Moveable::GetRoomNumber,
|
||||||
|
|
||||||
ScriptReserved_SetRoomNumber, &Moveable::SetRoomNumber,
|
ScriptReserved_SetRoomNumber, &Moveable::SetRoomNumber,
|
||||||
|
@ -849,10 +851,18 @@ bool Moveable::GetHitStatus() const
|
||||||
return m_item->HitStatus;
|
return m_item->HitStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the current room of the object
|
||||||
|
// @function Moveable:GetRoom
|
||||||
|
// @treturn Room current room of the object
|
||||||
|
std::unique_ptr<Room> Moveable::GetRoom() const
|
||||||
|
{
|
||||||
|
return std::make_unique<Room>(g_Level.Rooms[m_item->RoomNumber]);
|
||||||
|
}
|
||||||
|
|
||||||
/// Get the current room number of the object
|
/// Get the current room number of the object
|
||||||
// @function Moveable:GetRoomNumber
|
// @function Moveable:GetRoomNumber
|
||||||
// @treturn int number representing the current room of the object
|
// @treturn int number representing the current room of the object
|
||||||
short Moveable::GetRoomNumber() const
|
int Moveable::GetRoomNumber() const
|
||||||
{
|
{
|
||||||
return m_item->RoomNumber;
|
return m_item->RoomNumber;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ScriptUtil.h"
|
#include "ScriptUtil.h"
|
||||||
|
#include "Objects/Room/RoomObject.h"
|
||||||
#include "Objects/NamedBase.h"
|
#include "Objects/NamedBase.h"
|
||||||
|
|
||||||
class LevelFunc;
|
class LevelFunc;
|
||||||
|
@ -101,7 +102,8 @@ public:
|
||||||
[[nodiscard]] bool GetActive() const;
|
[[nodiscard]] bool GetActive() const;
|
||||||
void SetActive(bool active);
|
void SetActive(bool active);
|
||||||
|
|
||||||
[[nodiscard]] short GetRoomNumber() const;
|
std::unique_ptr<Room> GetRoom() const;
|
||||||
|
[[nodiscard]] int GetRoomNumber() const;
|
||||||
void SetRoomNumber(short room);
|
void SetRoomNumber(short room);
|
||||||
|
|
||||||
void AttachObjCamera(short camMeshId, Moveable& mov, short targetMeshId);
|
void AttachObjCamera(short camMeshId, Moveable& mov, short targetMeshId);
|
||||||
|
|
|
@ -15,7 +15,7 @@ class Room : public NamedBase<Room, ROOM_INFO&>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using IdentifierType = std::reference_wrapper<ROOM_INFO>;
|
using IdentifierType = std::reference_wrapper<ROOM_INFO>;
|
||||||
Room(ROOM_INFO& volume);
|
Room(ROOM_INFO& room);
|
||||||
~Room() = default;
|
~Room() = default;
|
||||||
|
|
||||||
Room& operator =(const Room& other) = delete;
|
Room& operator =(const Room& other) = delete;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue