- Removed the r: ACS print cast. You can do it yourself with s: and an array.

- Changed all the bool arguments to the ACS ReplaceTextures and SectorDamage
  commands with a single flags argument. SectorDamage also gained extended
  functionality: you can now make it hurt only players, only non-players, or
  both. Previously, hurting only non-players was not possible.
- Added the HUDMSG_COLORSTRING flag for ACS hudmessages. If you OR it in with
  the message type, the color will be treated as a string naming the color
  you want to use, so now you can use custom colors with hudmessages.


SVN r318 (trunk)
This commit is contained in:
Randy Heit 2006-09-01 01:08:27 +00:00
parent a2fbb8c880
commit c87be34b08
3 changed files with 62 additions and 33 deletions

View file

@ -1,3 +1,13 @@
August 31, 2006
- Removed the r: ACS print cast. You can do it yourself with s: and an array.
- Changed all the bool arguments to the ACS ReplaceTextures and SectorDamage
commands with a single flags argument. SectorDamage also gained extended
functionality: you can now make it hurt only players, only non-players, or
both. Previously, hurting only non-players was not possible.
- Added the HUDMSG_COLORSTRING flag for ACS hudmessages. If you OR it in with
the message type, the color will be treated as a string naming the color
you want to use, so now you can use custom colors with hudmessages.
August 30, 2006 August 30, 2006
- Added the FNameNoInit class that is exactly like FName except it does not - Added the FNameNoInit class that is exactly like FName except it does not
initialize its index, so it can be used from inside Actors without initialize its index, so it can be used from inside Actors without

View file

@ -75,8 +75,23 @@ FRandom pr_acs ("ACS");
#define CLAMPCOLOR(c) (EColorRange)((unsigned)(c) >= NUM_TEXT_COLORS ? CR_UNTRANSLATED : (c)) #define CLAMPCOLOR(c) (EColorRange)((unsigned)(c) >= NUM_TEXT_COLORS ? CR_UNTRANSLATED : (c))
#define HUDMSG_LOG (0x80000000) #define HUDMSG_LOG (0x80000000)
#define HUDMSG_COLORSTRING (0x40000000)
#define LANGREGIONMASK MAKE_ID(0,0,0xff,0xff) #define LANGREGIONMASK MAKE_ID(0,0,0xff,0xff)
// Flags for ReplaceTextures
#define NOT_BOTTOM 1
#define NOT_MIDDLE 2
#define NOT_TOP 4
#define NOT_FLOOR 8
#define NOT_CEILING 16
// Flags for SectorDamage
#define DAMAGE_PLAYERS 1
#define DAMAGE_NONPLAYERS 2
#define DAMAGE_IN_AIR 4
#define DAMAGE_SUBCLASSES_PROTECT 8
struct CallReturn struct CallReturn
{ {
ScriptFunction *ReturnFunction; ScriptFunction *ReturnFunction;
@ -1845,7 +1860,7 @@ void DLevelScript::SetLineTexture (int lineid, int side, int position, int name)
} }
} }
void DLevelScript::ReplaceTextures (int fromnamei, int tonamei, BOOL not_lower, BOOL not_mid, BOOL not_upper, BOOL not_floor, BOOL not_ceil) void DLevelScript::ReplaceTextures (int fromnamei, int tonamei, int flags)
{ {
const char *fromname = FBehavior::StaticLookupString (fromnamei); const char *fromname = FBehavior::StaticLookupString (fromnamei);
const char *toname = FBehavior::StaticLookupString (tonamei); const char *toname = FBehavior::StaticLookupString (tonamei);
@ -1854,7 +1869,7 @@ void DLevelScript::ReplaceTextures (int fromnamei, int tonamei, BOOL not_lower,
if (fromname == NULL) if (fromname == NULL)
return; return;
if (!(not_lower | not_mid | not_upper)) if ((flags ^ (NOT_BOTTOM | NOT_MIDDLE | NOT_TOP)) != 0)
{ {
picnum1 = TexMan.GetTexture (fromname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable); picnum1 = TexMan.GetTexture (fromname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
picnum2 = TexMan.GetTexture (toname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable); picnum2 = TexMan.GetTexture (toname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
@ -1863,12 +1878,12 @@ void DLevelScript::ReplaceTextures (int fromnamei, int tonamei, BOOL not_lower,
{ {
side_t *wal = &sides[i]; side_t *wal = &sides[i];
if (!not_lower && wal->bottomtexture == picnum1) wal->bottomtexture = picnum2; if (!(flags & NOT_BOTTOM) && wal->bottomtexture == picnum1) wal->bottomtexture = picnum2;
if (!not_mid && wal->midtexture == picnum1) wal->midtexture = picnum2; if (!(flags & NOT_MIDDLE) && wal->midtexture == picnum1) wal->midtexture = picnum2;
if (!not_upper && wal->toptexture == picnum1) wal->toptexture = picnum2; if (!(flags & NOT_TOP) && wal->toptexture == picnum1) wal->toptexture = picnum2;
} }
} }
if (!(not_floor | not_ceil)) if ((flags ^ (NOT_FLOOR | NOT_CEILING)) != 0)
{ {
picnum1 = TexMan.GetTexture (fromname, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable); picnum1 = TexMan.GetTexture (fromname, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
picnum2 = TexMan.GetTexture (toname, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable); picnum2 = TexMan.GetTexture (toname, FTexture::TEX_Flat, FTextureManager::TEXMAN_Overridable);
@ -1877,8 +1892,8 @@ void DLevelScript::ReplaceTextures (int fromnamei, int tonamei, BOOL not_lower,
{ {
sector_t *sec = &sectors[i]; sector_t *sec = &sectors[i];
if (!not_floor && sec->floorpic == picnum1) sec->floorpic = picnum2; if (!(flags & NOT_FLOOR) && sec->floorpic == picnum1) sec->floorpic = picnum2;
if (!not_ceil && sec->ceilingpic == picnum1) sec->ceilingpic = picnum2; if (!(flags & NOT_CEILING) && sec->ceilingpic == picnum1) sec->ceilingpic = picnum2;
} }
} }
} }
@ -3701,12 +3716,6 @@ int DLevelScript::RunScript ()
} }
break; break;
case PCD_PRINTCOLOR:
work += TEXTCOLOR_ESCAPE;
work += 'A' + char(CLAMPCOLOR(STACK(1)));
sp--;
break;
// [JB] Print map character array // [JB] Print map character array
case PCD_PRINTMAPCHARARRAY: case PCD_PRINTMAPCHARARRAY:
{ {
@ -3808,13 +3817,22 @@ int DLevelScript::RunScript ()
{ {
int type = Stack[optstart-6]; int type = Stack[optstart-6];
int id = Stack[optstart-5]; int id = Stack[optstart-5];
EColorRange color = CLAMPCOLOR(Stack[optstart-4]); EColorRange color;
float x = FIXED2FLOAT(Stack[optstart-3]); float x = FIXED2FLOAT(Stack[optstart-3]);
float y = FIXED2FLOAT(Stack[optstart-2]); float y = FIXED2FLOAT(Stack[optstart-2]);
float holdTime = FIXED2FLOAT(Stack[optstart-1]); float holdTime = FIXED2FLOAT(Stack[optstart-1]);
DHUDMessage *msg; DHUDMessage *msg;
switch (type & ~HUDMSG_LOG) if (type & HUDMSG_COLORSTRING)
{
color = V_FindFontColor(FBehavior::StaticLookupString(Stack[optstart-4]));
}
else
{
color = CLAMPCOLOR(Stack[optstart-4]);
}
switch (type & 0xFFFF)
{ {
default: // normal default: // normal
msg = new DHUDMessage (work, x, y, hudwidth, hudheight, color, holdTime); msg = new DHUDMessage (work, x, y, hudwidth, hudheight, color, holdTime);
@ -4018,8 +4036,8 @@ int DLevelScript::RunScript ()
break; break;
case PCD_REPLACETEXTURES: case PCD_REPLACETEXTURES:
ReplaceTextures (STACK(7), STACK(6), STACK(5), STACK(4), STACK(3), STACK(2), STACK(1)); ReplaceTextures (STACK(3), STACK(2), STACK(1));
sp -= 7; sp -= 3;
break; break;
case PCD_SETLINEBLOCKING: case PCD_SETLINEBLOCKING:
@ -4951,15 +4969,13 @@ int DLevelScript::RunScript ()
case PCD_SECTORDAMAGE: case PCD_SECTORDAMAGE:
{ {
int tag = STACK(7); int tag = STACK(5);
int amount = STACK(6); int amount = STACK(4);
FName type = FBehavior::StaticLookupString(STACK(5)); FName type = FBehavior::StaticLookupString(STACK(3));
BOOL playersOnly = STACK(4);
BOOL inAirToo = STACK(3);
FName protection = FName (FBehavior::StaticLookupString(STACK(2)), true); FName protection = FName (FBehavior::StaticLookupString(STACK(2)), true);
const PClass *protectClass = PClass::FindClass (protection); const PClass *protectClass = PClass::FindClass (protection);
BOOL subclassesOkay = STACK(1); int flags = STACK(1);
sp -= 7; sp -= 5;
// Oh, give me custom damage types! :-) // Oh, give me custom damage types! :-)
int modtype; int modtype;
@ -4986,15 +5002,18 @@ int DLevelScript::RunScript ()
if (!(actor->flags & MF_SHOOTABLE)) if (!(actor->flags & MF_SHOOTABLE))
continue; continue;
if (playersOnly && actor->player == NULL) if (!(flags & DAMAGE_NONPLAYERS) && actor->player == NULL)
continue; continue;
if (!inAirToo && actor->z != sec->floorplane.ZatPoint (actor->x, actor->y) && !actor->waterlevel) if (!(flags & DAMAGE_PLAYERS) && actor->player != NULL)
continue;
if (!(flags & DAMAGE_IN_AIR) && actor->z != sec->floorplane.ZatPoint (actor->x, actor->y) && !actor->waterlevel)
continue; continue;
if (protectClass != NULL) if (protectClass != NULL)
{ {
if (!subclassesOkay) if (!(flags & DAMAGE_SUBCLASSES_PROTECT))
{ {
if (actor->FindInventory (protectClass)) if (actor->FindInventory (protectClass))
continue; continue;

View file

@ -535,7 +535,7 @@ public:
PCD_CHANGELEVEL, PCD_CHANGELEVEL,
PCD_SECTORDAMAGE, PCD_SECTORDAMAGE,
PCD_REPLACETEXTURES, PCD_REPLACETEXTURES,
/*330*/ PCD_PRINTCOLOR, /*330*/
PCODE_COMMAND_COUNT PCODE_COMMAND_COUNT
}; };
@ -659,7 +659,7 @@ protected:
static void ChangeFlat (int tag, int name, bool floorOrCeiling); static void ChangeFlat (int tag, int name, bool floorOrCeiling);
static int CountPlayers (); static int CountPlayers ();
static void SetLineTexture (int lineid, int side, int position, int name); static void SetLineTexture (int lineid, int side, int position, int name);
static void ReplaceTextures (int fromname, int toname, BOOL notUpper, BOOL notMid, BOOL notLower, BOOL notFloor, BOOL notCeil); static void ReplaceTextures (int fromname, int toname, int flags);
static int DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, int angle); 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 DoSpawnSpot (int type, int spot, int tid, int angle);
static int DoSpawnSpotFacing (int type, int spot, int tid); static int DoSpawnSpotFacing (int type, int spot, int tid);