- Added Gez's CheckActorProperty submission.

SVN r1709 (trunk)
This commit is contained in:
Christoph Oelckers 2009-07-05 05:56:20 +00:00
parent 635d71e660
commit 33249ff833
3 changed files with 61 additions and 1 deletions

View file

@ -1,4 +1,7 @@
July 4, 2009 (Changes by Graf Zahl)
July 5, 2009 (Changes by Graf Zahl)
- Added Gez's CheckActorProperty submission.
July 4, 2009 (Changes by Graf Zahl)
- Added code submissions for non-piercing railguns and new skill options.
July 3, 2009

View file

@ -2409,6 +2409,7 @@ enum
APROP_SpawnHealth = 17,
APROP_Dropped = 18,
APROP_Notarget = 19,
APROP_Species = 20,
};
// These are needed for ACS's APROP_RenderStyle
@ -2557,6 +2558,10 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
case APROP_ActiveSound:
actor->ActiveSound = FBehavior::StaticLookupString(value);
break;
case APROP_Species:
actor->Species = FBehavior::StaticLookupString(value);
break;
}
}
@ -2625,6 +2630,53 @@ int DLevelScript::GetActorProperty (int tid, int property)
}
}
int DLevelScript::CheckActorProperty (int tid, int property, int value)
{
AActor *actor = SingleActorFromTID (tid, activator);
const char *string = NULL;
if (actor == NULL)
{
return 0;
}
switch (property)
{
// Default
default: return 0;
// Straightforward integer values:
case APROP_Health:
case APROP_Speed:
case APROP_Damage:
case APROP_Alpha:
case APROP_RenderStyle:
case APROP_Gravity:
case APROP_SpawnHealth:
case APROP_JumpZ:
return (GetActorProperty(tid, property) == value);
// Boolean values need to compare to a binary version of value
case APROP_Ambush:
case APROP_Dropped:
case APROP_ChaseGoal:
case APROP_Frightened:
case APROP_Friendly:
case APROP_Notarget:
return (GetActorProperty(tid, property) == (!!value));
// Strings are not covered by GetActorProperty, so make the check here
case APROP_SeeSound: string = actor->SeeSound; break;
case APROP_AttackSound: string = actor->AttackSound; break;
case APROP_PainSound: string = actor->PainSound; break;
case APROP_DeathSound: string = actor->DeathSound; break;
case APROP_ActiveSound: string = actor->ActiveSound; break;
case APROP_Species: string = actor->GetSpecies(); break;
}
if (string == NULL) string = "";
return (!stricmp(string, FBehavior::StaticLookupString(value)));
}
enum
{
// These are the original inputs sent by the player.
@ -2804,6 +2856,7 @@ enum EACSFunctions
ACSF_GetArmorType,
ACSF_SpawnSpotForced,
ACSF_SpawnSpotFacingForced,
ACSF_CheckActorProperty,
};
int DLevelScript::SideFromID(int id, int side)
@ -2968,6 +3021,9 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args)
case ACSF_SpawnSpotFacingForced:
return DoSpawnSpotFacing(args[0], args[1], args[2], true);
case ACSF_CheckActorProperty:
return (CheckActorProperty(args[0], args[1], args[2]));
default:
break;
}

View file

@ -725,6 +725,7 @@ protected:
void SetActorProperty (int tid, int property, int value);
void DoSetActorProperty (AActor *actor, int property, int value);
int GetActorProperty (int tid, int property);
int CheckActorProperty (int tid, int property, int value);
int GetPlayerInput (int playernum, int inputnum);
int LineFromID(int id);