- added script variable access for native code so that many more classes can be fully exported. Tested with the puzzle items.

This commit is contained in:
Christoph Oelckers 2017-01-15 18:16:36 +01:00
commit 156f9c488e
12 changed files with 23 additions and 120 deletions

View file

@ -747,6 +747,8 @@ void cht_Give (player_t *player, const char *name, int amount)
if (giveall || stricmp (name, "artifacts") == 0)
{
auto pitype = PClass::FindActor(NAME_PuzzleItem);
for (unsigned int i = 0; i < PClassActor::AllActorClasses.Size(); ++i)
{
type = PClassActor::AllActorClasses[i];
@ -754,7 +756,7 @@ void cht_Give (player_t *player, const char *name, int amount)
{
AInventory *def = (AInventory*)GetDefaultByType (type);
if (def->Icon.isValid() && def->MaxAmount > 1 &&
!type->IsDescendantOf (RUNTIME_CLASS(APuzzleItem)) &&
!type->IsDescendantOf (pitype) &&
!type->IsDescendantOf (RUNTIME_CLASS(APowerup)) &&
!type->IsDescendantOf (RUNTIME_CLASS(AArmor)))
{
@ -772,10 +774,11 @@ void cht_Give (player_t *player, const char *name, int amount)
if (giveall || stricmp (name, "puzzlepieces") == 0)
{
auto pitype = PClass::FindActor(NAME_PuzzleItem);
for (unsigned int i = 0; i < PClassActor::AllActorClasses.Size(); ++i)
{
type = PClassActor::AllActorClasses[i];
if (type->IsDescendantOf (RUNTIME_CLASS(APuzzleItem)))
if (type->IsDescendantOf (pitype))
{
AInventory *def = (AInventory*)GetDefaultByType (type);
if (def->Icon.isValid())
@ -954,13 +957,14 @@ void cht_Take (player_t *player, const char *name, int amount)
if (takeall || stricmp (name, "artifacts") == 0)
{
auto pitype = PClass::FindActor(NAME_PuzzleItem);
for (unsigned int i = 0; i < PClassActor::AllActorClasses.Size(); ++i)
{
type = PClassActor::AllActorClasses[i];
if (type->IsDescendantOf (RUNTIME_CLASS (AInventory)))
{
if (!type->IsDescendantOf (RUNTIME_CLASS (APuzzleItem)) &&
if (!type->IsDescendantOf (pitype) &&
!type->IsDescendantOf (RUNTIME_CLASS (APowerup)) &&
!type->IsDescendantOf (RUNTIME_CLASS (AArmor)) &&
!type->IsDescendantOf (RUNTIME_CLASS (AWeapon)) &&
@ -980,11 +984,12 @@ void cht_Take (player_t *player, const char *name, int amount)
if (takeall || stricmp (name, "puzzlepieces") == 0)
{
auto pitype = PClass::FindActor(NAME_PuzzleItem);
for (unsigned int i = 0; i < PClassActor::AllActorClasses.Size(); ++i)
{
type = PClassActor::AllActorClasses[i];
if (type->IsDescendantOf (RUNTIME_CLASS (APuzzleItem)))
if (type->IsDescendantOf (pitype))
{
AActor *puzzlepiece = player->mo->FindInventory(static_cast<PClassActor *>(type));