mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
- Added binary (b) and hexadecimal (x) cast types for ACS's various print
statements. - Added ClassifyActor(tid) ACS builtin function. This takes a TID and returns a set of bits describing the actor. If TID is 0, it returns information about the activator. If there is more than one actor with the given TID, only the first one is considered. Currently defined bits are: ACTOR_NONE No actors with this TID exist (only when TID is not 0). ACTOR_WORLD Activator is the world (only when TID is 0). ACTOR_PLAYER Actor is a player (includes bots and voodoo dolls). ACTOR_BOT Actor is a bot. ACTOR_VOODOODOLL Actor is a voodoo doll. ACTOR_MONSTER Actor is a monster. ACTOR_ALIVE Actor is alive (players/monsters only). ACTOR_DEAD Actor is dead (players/monsters only). ACTOR_MISSILE Actor is a missile. ACTOR_GENERIC Actor exists, but no further information is available. SVN r1310 (trunk)
This commit is contained in:
parent
b90a04f3be
commit
238de9cda1
3 changed files with 121 additions and 5 deletions
|
@ -1,4 +1,20 @@
|
|||
December 6, 2008
|
||||
- Added binary (b) and hexadecimal (x) cast types for ACS's various print
|
||||
statements.
|
||||
- Added ClassifyActor(tid) ACS builtin function. This takes a TID and returns
|
||||
a set of bits describing the actor. If TID is 0, it returns information
|
||||
about the activator. If there is more than one actor with the given TID,
|
||||
only the first one is considered. Currently defined bits are:
|
||||
ACTOR_NONE No actors with this TID exist (only when TID is not 0).
|
||||
ACTOR_WORLD Activator is the world (only when TID is 0).
|
||||
ACTOR_PLAYER Actor is a player (includes bots and voodoo dolls).
|
||||
ACTOR_BOT Actor is a bot.
|
||||
ACTOR_VOODOODOLL Actor is a voodoo doll.
|
||||
ACTOR_MONSTER Actor is a monster.
|
||||
ACTOR_ALIVE Actor is alive (players/monsters only).
|
||||
ACTOR_DEAD Actor is dead (players/monsters only).
|
||||
ACTOR_MISSILE Actor is a missile.
|
||||
ACTOR_GENERIC Actor exists, but no further information is available.
|
||||
- Moved ExpandEnvVars() from d_main.cpp to cmdlib.cpp.
|
||||
- AutoExec paths now support the same variable expansion as the search paths.
|
||||
Additionally, on Windows, the default autoexec path is now relative to
|
||||
|
|
102
src/p_acs.cpp
102
src/p_acs.cpp
|
@ -3,7 +3,7 @@
|
|||
** General BEHAVIOR management and ACS execution environment
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 1998-2007 Randy Heit
|
||||
** Copyright 1998-2008 Randy Heit
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
|
@ -31,7 +31,8 @@
|
|||
**---------------------------------------------------------------------------
|
||||
**
|
||||
** This code at one time made lots of little-endian assumptions.
|
||||
** I think it should be better now, but I have no real way to test it.
|
||||
** I think it should be fine on big-endian machines now, but I have no
|
||||
** real way to test it.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -2450,6 +2451,87 @@ int DLevelScript::GetPlayerInput(int playernum, int inputnum)
|
|||
}
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
ACTOR_NONE = 0x00000000,
|
||||
ACTOR_WORLD = 0x00000001,
|
||||
ACTOR_PLAYER = 0x00000002,
|
||||
ACTOR_BOT = 0x00000004,
|
||||
ACTOR_VOODOODOLL = 0x00000008,
|
||||
ACTOR_MONSTER = 0x00000010,
|
||||
ACTOR_ALIVE = 0x00000020,
|
||||
ACTOR_DEAD = 0x00000040,
|
||||
ACTOR_MISSILE = 0x00000080,
|
||||
ACTOR_GENERIC = 0x00000100
|
||||
};
|
||||
|
||||
int DLevelScript::DoClassifyActor(int tid)
|
||||
{
|
||||
AActor *actor;
|
||||
int classify;
|
||||
|
||||
if (tid == 0)
|
||||
{
|
||||
actor = activator;
|
||||
if (actor == NULL)
|
||||
{
|
||||
return ACTOR_WORLD;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FActorIterator it(tid);
|
||||
actor = it.Next();
|
||||
}
|
||||
if (actor == NULL)
|
||||
{
|
||||
return ACTOR_NONE;
|
||||
}
|
||||
|
||||
classify = 0;
|
||||
if (actor->player != NULL)
|
||||
{
|
||||
classify |= ACTOR_PLAYER;
|
||||
if (actor->player->playerstate == PST_DEAD)
|
||||
{
|
||||
classify |= ACTOR_DEAD;
|
||||
}
|
||||
else
|
||||
{
|
||||
classify |= ACTOR_ALIVE;
|
||||
}
|
||||
if (actor->player->mo != actor)
|
||||
{
|
||||
classify |= ACTOR_VOODOODOLL;
|
||||
}
|
||||
if (actor->player->isbot)
|
||||
{
|
||||
classify |= ACTOR_BOT;
|
||||
}
|
||||
}
|
||||
else if (actor->flags3 & MF3_ISMONSTER)
|
||||
{
|
||||
classify |= ACTOR_MONSTER;
|
||||
if (actor->health <= 0)
|
||||
{
|
||||
classify |= ACTOR_DEAD;
|
||||
}
|
||||
else
|
||||
{
|
||||
classify |= ACTOR_ALIVE;
|
||||
}
|
||||
}
|
||||
else if (actor->flags & MF_MISSILE)
|
||||
{
|
||||
classify |= ACTOR_MISSILE;
|
||||
}
|
||||
else
|
||||
{
|
||||
classify |= ACTOR_GENERIC;
|
||||
}
|
||||
return classify;
|
||||
}
|
||||
|
||||
#define NEXTWORD (LittleLong(*pc++))
|
||||
#define NEXTBYTE (fmt==ACS_LittleEnhanced?getbyte(pc):NEXTWORD)
|
||||
#define STACK(a) (Stack[sp - (a)])
|
||||
|
@ -3864,6 +3946,16 @@ int DLevelScript::RunScript ()
|
|||
--sp;
|
||||
break;
|
||||
|
||||
case PCD_PRINTBINARY:
|
||||
work.AppendFormat ("%B", STACK(1));
|
||||
--sp;
|
||||
break;
|
||||
|
||||
case PCD_PRINTHEX:
|
||||
work.AppendFormat ("%X", STACK(1));
|
||||
--sp;
|
||||
break;
|
||||
|
||||
case PCD_PRINTCHARACTER:
|
||||
work += (char)STACK(1);
|
||||
--sp;
|
||||
|
@ -5405,7 +5497,7 @@ int DLevelScript::RunScript ()
|
|||
{
|
||||
STACK(1) = actor->Sector->lightlevel;
|
||||
}
|
||||
else STACK(1)=0;
|
||||
else STACK(1) = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -5429,6 +5521,10 @@ int DLevelScript::RunScript ()
|
|||
}
|
||||
break;
|
||||
|
||||
case PCD_CLASSIFYACTOR:
|
||||
STACK(1) = DoClassifyActor(STACK(1));
|
||||
break;
|
||||
|
||||
case PCD_MORPHACTOR:
|
||||
{
|
||||
int tag = STACK(7);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
** ACS script stuff
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 1998-2007 Randy Heit
|
||||
** Copyright 1998-2008 Randy Heit
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
|
@ -554,8 +554,11 @@ public:
|
|||
PCD_MORPHACTOR, // [MH]
|
||||
PCD_UNMORPHACTOR, // [MH]
|
||||
PCD_GETPLAYERINPUT,
|
||||
PCD_CLASSIFYACTOR,
|
||||
PCD_PRINTBINARY,
|
||||
/*350*/ PCD_PRINTHEX,
|
||||
|
||||
/*348*/ PCODE_COMMAND_COUNT
|
||||
/*351*/ PCODE_COMMAND_COUNT
|
||||
};
|
||||
|
||||
// Some constants used by ACS scripts
|
||||
|
@ -682,6 +685,7 @@ protected:
|
|||
static int DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, int angle);
|
||||
static int DoSpawnSpot (int type, int spot, int tid, int angle);
|
||||
static int DoSpawnSpotFacing (int type, int spot, int tid);
|
||||
int DoClassifyActor (int tid);
|
||||
|
||||
void DoFadeTo (int r, int g, int b, int a, fixed_t time);
|
||||
void DoFadeRange (int r1, int g1, int b1, int a1,
|
||||
|
|
Loading…
Reference in a new issue