diff --git a/Editor/AGS.Editor/Resources/agsdefns.sh b/Editor/AGS.Editor/Resources/agsdefns.sh index a9dfd489a0..89449188be 100644 --- a/Editor/AGS.Editor/Resources/agsdefns.sh +++ b/Editor/AGS.Editor/Resources/agsdefns.sh @@ -845,6 +845,10 @@ builtin struct Room { import static bool Exists(int room); // $AUTOCOMPLETESTATICONLY$ #endif // SCRIPT_API_v360 #ifdef SCRIPT_API_v400 + /// Gets the current Room's number + import static readonly attribute int Number; // $AUTOCOMPLETESTATICONLY$ + /// Gets the current Room's name (description) + import static readonly attribute String Name; // $AUTOCOMPLETESTATICONLY$ /// Accesses the Hotspots in the current room. import static readonly attribute Hotspot *Hotspots[]; // $AUTOCOMPLETESTATICONLY$ /// Accesses the Objects in the current room. @@ -855,7 +859,7 @@ builtin struct Room { import static readonly attribute WalkableArea *WalkableAreas[]; // $AUTOCOMPLETESTATICONLY$ /// Accesses the Walk-behinds in the current room. import static readonly attribute Walkbehind *Walkbehinds[]; // $AUTOCOMPLETESTATICONLY$ - /// Gets this Room's Pathfinder object that lets find route around walkable areas. + /// Gets the current Room's Pathfinder object that lets find route around walkable areas. import static readonly attribute Pathfinder *PathFinder; // $AUTOCOMPLETESTATICONLY$ /// Gets/sets the optional y/x ratio of character's facing directions, determining directional loop selection for each Character in the current room. import static attribute float FaceDirectionRatio; diff --git a/Engine/ac/room.cpp b/Engine/ac/room.cpp index c0d52c4d45..474f5e6e67 100644 --- a/Engine/ac/room.cpp +++ b/Engine/ac/room.cpp @@ -205,6 +205,16 @@ void Room_SetFaceDirectionRatio(float ratio) croom->face_dir_ratio = ratio; } +const char *Room_GetName() +{ + return CreateNewScriptString(thisroom.GetName()); +} + +int Room_GetNumber() +{ + return displayed_room; +} + bool Room_Exists(int room) { String room_filename; @@ -1087,6 +1097,16 @@ RuntimeScriptValue Sc_Room_SetFaceDirectionRatio(const RuntimeScriptValue *param API_SCALL_VOID_PFLOAT(Room_SetFaceDirectionRatio); } +RuntimeScriptValue Sc_Room_GetName(const RuntimeScriptValue *params, int32_t param_count) +{ + API_SCALL_OBJ(const char *, myScriptStringImpl, Room_GetName); +} + +RuntimeScriptValue Sc_Room_GetNumber(const RuntimeScriptValue *params, int32_t param_count) +{ + API_SCALL_INT(Room_GetNumber); +} + // void (int xx,int yy,int mood) RuntimeScriptValue Sc_RoomProcessClick(const RuntimeScriptValue *params, int32_t param_count) { @@ -1149,6 +1169,8 @@ void RegisterRoomAPI() { "Room::get_Width", API_FN_PAIR(Room_GetWidth) }, { "Room::get_FaceDirectionRatio", API_FN_PAIR(Room_GetFaceDirectionRatio) }, { "Room::set_FaceDirectionRatio", API_FN_PAIR(Room_SetFaceDirectionRatio) }, + { "Room::get_Name", API_FN_PAIR(Room_GetName) }, + { "Room::get_Number", API_FN_PAIR(Room_GetNumber) }, { "Room::geti_Hotspots", API_FN_PAIR(Room_GetiHotspots) }, { "Room::geti_Objects", API_FN_PAIR(Room_GetiObjects) }, { "Room::geti_Regions", API_FN_PAIR(Room_GetiRegions) },