mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 07:12:36 +00:00
Added net id functions for ACS
Includes net id getter and activator setter functionality. Essentially acts as a pseudo pointer system for Actors within ACS.
This commit is contained in:
parent
9ca5bef4ea
commit
f5ceaafbbc
2 changed files with 38 additions and 0 deletions
|
@ -316,6 +316,23 @@ public:
|
||||||
{
|
{
|
||||||
return tid == 0 ? defactor : GetActorIterator(tid).Next();
|
return tid == 0 ? defactor : GetActorIterator(tid).Next();
|
||||||
}
|
}
|
||||||
|
AActor* SelectActorFromTID(int tid, size_t index, AActor *defactor)
|
||||||
|
{
|
||||||
|
if (tid == 0)
|
||||||
|
return defactor;
|
||||||
|
|
||||||
|
AActor* actor = nullptr;
|
||||||
|
size_t cur = 0u;
|
||||||
|
auto it = GetActorIterator(tid);
|
||||||
|
while ((actor = it.Next()) != nullptr)
|
||||||
|
{
|
||||||
|
if (cur == index)
|
||||||
|
return actor;
|
||||||
|
++cur;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
bool SectorHasTags(sector_t *sector)
|
bool SectorHasTags(sector_t *sector)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4806,6 +4806,8 @@ enum EACSFunctions
|
||||||
ACSF_GetSectorHealth,
|
ACSF_GetSectorHealth,
|
||||||
ACSF_GetLineHealth,
|
ACSF_GetLineHealth,
|
||||||
ACSF_SetSubtitleNumber,
|
ACSF_SetSubtitleNumber,
|
||||||
|
ACSF_GetNetID,
|
||||||
|
ACSF_SetActivatorByNetID,
|
||||||
|
|
||||||
// Eternity's
|
// Eternity's
|
||||||
ACSF_GetLineX = 300,
|
ACSF_GetLineX = 300,
|
||||||
|
@ -5380,6 +5382,13 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args, int &
|
||||||
actor = Level->SingleActorFromTID(args[0], activator);
|
actor = Level->SingleActorFromTID(args[0], activator);
|
||||||
return actor != NULL? DoubleToACS(actor->Vel.Z) : 0;
|
return actor != NULL? DoubleToACS(actor->Vel.Z) : 0;
|
||||||
|
|
||||||
|
case ACSF_GetNetID:
|
||||||
|
MIN_ARG_COUNT(2);
|
||||||
|
actor = Level->SelectActorFromTID(args[0], args[1], activator);
|
||||||
|
if (argCount > 2)
|
||||||
|
actor = COPY_AAPTREX(Level, actor, args[2]);
|
||||||
|
return actor != nullptr ? actor->GetNetworkID() : NetworkEntityManager::WorldNetID;
|
||||||
|
|
||||||
case ACSF_SetPointer:
|
case ACSF_SetPointer:
|
||||||
MIN_ARG_COUNT(2);
|
MIN_ARG_COUNT(2);
|
||||||
if (activator)
|
if (activator)
|
||||||
|
@ -5431,6 +5440,18 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args, int &
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case ACSF_SetActivatorByNetID:
|
||||||
|
MIN_ARG_COUNT(1);
|
||||||
|
actor = dyn_cast<AActor>(NetworkEntityManager::GetNetworkEntity(args[0]));
|
||||||
|
if (argCount > 1)
|
||||||
|
actor = COPY_AAPTREX(Level, actor, args[1]);
|
||||||
|
if (actor != nullptr)
|
||||||
|
{
|
||||||
|
activator = actor;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
case ACSF_GetActorViewHeight:
|
case ACSF_GetActorViewHeight:
|
||||||
MIN_ARG_COUNT(1);
|
MIN_ARG_COUNT(1);
|
||||||
actor = Level->SingleActorFromTID(args[0], activator);
|
actor = Level->SingleActorFromTID(args[0], activator);
|
||||||
|
|
Loading…
Reference in a new issue