-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ALTV-426 Add interior API * ALTV-426 update func_table * ALTV-426 add latest apis * ALTV-426 fix typo * ALTV-426 update sdk * ALTV-426 - rename class to AABB * ALTV-426 - move AABB class to own file * update sdk * update runtime
- Loading branch information
Showing
10 changed files
with
424 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#pragma once | ||
#include "cpp-sdk/deps/alt-math/alt-math.h" | ||
|
||
typedef struct { | ||
alt::Position min; | ||
alt::Position max; | ||
} aabb_t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include "interior.h" | ||
|
||
#include "utils/macros.h" | ||
|
||
CAPI_START() | ||
|
||
#ifdef ALT_CLIENT_API | ||
uint16_t Interior_GetRoomCount(uint32_t interiorId) | ||
{ | ||
auto interior = alt::ICore::Instance().GetInterior(interiorId); | ||
return interior->GetRoomCount(); | ||
} | ||
|
||
uint16_t Interior_GetPortalCount(uint32_t interiorId) | ||
{ | ||
auto interior = alt::ICore::Instance().GetInterior(interiorId); | ||
return interior->GetPortalCount(); | ||
} | ||
|
||
alt::Position Interior_GetPosition(uint32_t interiorId) | ||
{ | ||
auto interior = alt::ICore::Instance().GetInterior(interiorId); | ||
return interior->GetPosition(); | ||
} | ||
|
||
alt::Rotation Interior_GetRotation(uint32_t interiorId) | ||
{ | ||
auto interior = alt::ICore::Instance().GetInterior(interiorId); | ||
return interior->GetRotation(); | ||
} | ||
|
||
void Interior_GetEntitiesExtents(uint32_t interiorId, aabb_t& extents) | ||
{ | ||
auto interior = alt::ICore::Instance().GetInterior(interiorId); | ||
auto ext = interior->GetEntitiesExtents(); | ||
extents.min = ext.min; | ||
extents.max = ext.max; | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
|
||
#ifdef __clang__ | ||
#pragma clang diagnostic push | ||
#pragma clang diagnostic ignored "-Wempty-body" | ||
#pragma clang diagnostic ignored "-Wswitch" | ||
#endif | ||
|
||
#include "cpp-sdk/SDK.h" | ||
#include "data/aabb.h" | ||
#include "data/types.h" | ||
#include "data/invoker.h" | ||
#include "utils/export.h" | ||
|
||
#ifdef ALT_SERVER_API | ||
#include <CSharpResourceImpl.h> | ||
#elif ALT_CLIENT_API | ||
#include "../client/src/runtime/CSharpResourceImpl.h" | ||
#endif | ||
|
||
#ifdef __clang__ | ||
#pragma clang diagnostic pop | ||
#endif | ||
|
||
EXPORT_CLIENT uint16_t Interior_GetRoomCount(uint32_t interiorId); | ||
EXPORT_CLIENT uint16_t Interior_GetPortalCount(uint32_t interiorId); | ||
EXPORT_CLIENT alt::Position Interior_GetPosition(uint32_t interiorId); | ||
EXPORT_CLIENT alt::Rotation Interior_GetRotation(uint32_t interiorId); | ||
EXPORT_CLIENT void Interior_GetEntitiesExtents(uint32_t interiorId, aabb_t& extents); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
#include "interior_portal.h" | ||
|
||
#include "cpp-sdk/script-objects/IInteriorPortal.h" | ||
#include "utils/macros.h" | ||
|
||
CAPI_START() | ||
|
||
#ifdef ALT_CLIENT_API | ||
uint32_t InteriorPortal_GetIndex(uint32_t interiorId, uint32_t portalIndex) | ||
{ | ||
auto portal = GetInteriorPortal(interiorId, portalIndex); | ||
return portal->GetIndex(); | ||
} | ||
|
||
uint16_t InteriorPortal_GetCornerCount(uint32_t interiorId, uint32_t portalIndex) | ||
{ | ||
auto portal = GetInteriorPortal(interiorId, portalIndex); | ||
return portal->GetCornerCount(); | ||
} | ||
|
||
alt::Position InteriorPortal_GetCornerPosition(uint32_t interiorId, uint32_t portalIndex, uint32_t cornerIndex) | ||
{ | ||
auto portal = GetInteriorPortal(interiorId, portalIndex); | ||
return portal->GetCornerPosition(cornerIndex); | ||
} | ||
|
||
uint32_t InteriorPortal_GetRoomFrom(uint32_t interiorId, uint32_t portalIndex) | ||
{ | ||
auto portal = GetInteriorPortal(interiorId, portalIndex); | ||
return portal->GetRoomFrom(); | ||
} | ||
|
||
uint32_t InteriorPortal_GetRoomTo(uint32_t interiorId, uint32_t portalIndex) | ||
{ | ||
auto portal = GetInteriorPortal(interiorId, portalIndex); | ||
return portal->GetRoomTo(); | ||
} | ||
|
||
int32_t InteriorPortal_GetFlag(uint32_t interiorId, uint32_t portalIndex) | ||
{ | ||
auto portal = GetInteriorPortal(interiorId, portalIndex); | ||
return portal->GetFlag(); | ||
} | ||
|
||
uint16_t InteriorPortal_GetEntityCount(uint32_t interiorId, uint32_t portalIndex) | ||
{ | ||
auto portal = GetInteriorPortal(interiorId, portalIndex); | ||
return portal->GetEntityCount(); | ||
} | ||
|
||
uint32_t InteriorPortal_GetEntityArcheType(uint32_t interiorId, uint32_t portalIndex, uint32_t entityIndex) | ||
{ | ||
auto portal = GetInteriorPortal(interiorId, portalIndex); | ||
return portal->GetEntityArcheType(entityIndex); | ||
} | ||
|
||
int32_t InteriorPortal_GetEntityFlag(uint32_t interiorId, uint32_t portalIndex, uint32_t entityIndex) | ||
{ | ||
auto portal = GetInteriorPortal(interiorId, portalIndex); | ||
return portal->GetEntityFlag(entityIndex); | ||
} | ||
|
||
alt::Position InteriorPortal_GetEntityPosition(uint32_t interiorId, uint32_t portalIndex, uint32_t entityIndex) | ||
{ | ||
auto portal = GetInteriorPortal(interiorId, portalIndex); | ||
return portal->GetEntityPosition(entityIndex); | ||
} | ||
|
||
alt::Rotation InteriorPortal_GetEntityRotation(uint32_t interiorId, uint32_t portalIndex, uint32_t entityIndex) | ||
{ | ||
auto portal = GetInteriorPortal(interiorId, portalIndex); | ||
return portal->GetEntityRotation(entityIndex); | ||
} | ||
|
||
void InteriorPortal_SetCornerPosition(uint32_t interiorId, uint32_t portalIndex, uint32_t cornerIndex, | ||
position_t position) | ||
{ | ||
auto portal = GetInteriorPortal(interiorId, portalIndex); | ||
portal->SetCornerPosition(cornerIndex, alt::Position(position.x, position.y, position.z)); | ||
} | ||
|
||
void InteriorPortal_SetRoomFrom(uint32_t interiorId, uint32_t portalIndex, uint32_t roomFrom) | ||
{ | ||
auto portal = GetInteriorPortal(interiorId, portalIndex); | ||
portal->SetRoomFrom(roomFrom); | ||
} | ||
|
||
void InteriorPortal_SetRoomTo(uint32_t interiorId, uint32_t portalIndex, uint32_t roomTo) | ||
{ | ||
auto portal = GetInteriorPortal(interiorId, portalIndex); | ||
portal->SetRoomTo(roomTo); | ||
} | ||
|
||
void InteriorPortal_SetFlag(uint32_t interiorId, uint32_t portalIndex, int32_t flag) | ||
{ | ||
auto portal = GetInteriorPortal(interiorId, portalIndex); | ||
portal->SetFlag(flag); | ||
} | ||
|
||
void InteriorPortal_SetEntityFlag(uint32_t interiorId, uint32_t portalIndex, uint32_t entityIndex, int32_t flag) | ||
{ | ||
auto portal = GetInteriorPortal(interiorId, portalIndex); | ||
portal->SetEntityFlag(entityIndex, flag); | ||
} | ||
|
||
std::shared_ptr<alt::IInteriorPortal> GetInteriorPortal(uint32_t interiorId, uint32_t portalIndex) | ||
{ | ||
auto interior = alt::ICore::Instance().GetInterior(interiorId); | ||
return interior->GetPortalByIndex(portalIndex); | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#pragma once | ||
|
||
#ifdef __clang__ | ||
#pragma clang diagnostic push | ||
#pragma clang diagnostic ignored "-Wempty-body" | ||
#pragma clang diagnostic ignored "-Wswitch" | ||
#endif | ||
|
||
#include "cpp-sdk/SDK.h" | ||
#include "data/aabb.h" | ||
#include "data/types.h" | ||
#include "data/invoker.h" | ||
#include "utils/export.h" | ||
|
||
#ifdef ALT_SERVER_API | ||
#include <CSharpResourceImpl.h> | ||
#elif ALT_CLIENT_API | ||
#include "../client/src/runtime/CSharpResourceImpl.h" | ||
#endif | ||
|
||
#ifdef __clang__ | ||
#pragma clang diagnostic pop | ||
#endif | ||
|
||
EXPORT_CLIENT uint32_t InteriorPortal_GetIndex(uint32_t interiorId, uint32_t portalIndex); | ||
EXPORT_CLIENT uint16_t InteriorPortal_GetCornerCount(uint32_t interiorId, uint32_t portalIndex); | ||
EXPORT_CLIENT alt::Position InteriorPortal_GetCornerPosition(uint32_t interiorId, uint32_t portalIndex, uint32_t cornerIndex); | ||
EXPORT_CLIENT uint32_t InteriorPortal_GetRoomFrom(uint32_t interiorId, uint32_t portalIndex); | ||
EXPORT_CLIENT uint32_t InteriorPortal_GetRoomTo(uint32_t interiorId, uint32_t portalIndex); | ||
EXPORT_CLIENT int32_t InteriorPortal_GetFlag(uint32_t interiorId, uint32_t portalIndex); | ||
|
||
EXPORT_CLIENT uint16_t InteriorPortal_GetEntityCount(uint32_t interiorId, uint32_t portalIndex); | ||
EXPORT_CLIENT uint32_t InteriorPortal_GetEntityArcheType(uint32_t interiorId, uint32_t portalIndex, uint32_t entityIndex); | ||
EXPORT_CLIENT int32_t InteriorPortal_GetEntityFlag(uint32_t interiorId, uint32_t portalIndex, uint32_t entityIndex); | ||
EXPORT_CLIENT alt::Position InteriorPortal_GetEntityPosition(uint32_t interiorId, uint32_t portalIndex, uint32_t entityIndex); | ||
EXPORT_CLIENT alt::Rotation InteriorPortal_GetEntityRotation(uint32_t interiorId, uint32_t portalIndex, uint32_t entityIndex); | ||
|
||
|
||
EXPORT_CLIENT void InteriorPortal_SetCornerPosition(uint32_t interiorId, uint32_t portalIndex, uint32_t cornerIndex, position_t position); | ||
EXPORT_CLIENT void InteriorPortal_SetRoomFrom(uint32_t interiorId, uint32_t portalIndex, uint32_t roomFrom); | ||
EXPORT_CLIENT void InteriorPortal_SetRoomTo(uint32_t interiorId, uint32_t portalIndex, uint32_t roomTo); | ||
EXPORT_CLIENT void InteriorPortal_SetFlag(uint32_t interiorId, uint32_t portalIndex, int32_t flag); | ||
EXPORT_CLIENT void InteriorPortal_SetEntityFlag(uint32_t interiorId, uint32_t portalIndex, uint32_t entityIndex, int32_t flag); | ||
|
||
#ifdef ALT_CLIENT_API | ||
std::shared_ptr<alt::IInteriorPortal> GetInteriorPortal(uint32_t interiorId, uint32_t portalIndex); | ||
#endif |
Oops, something went wrong.