- More things from Gez's experimental build:

* info CCMD to print extended actor information (not fully implemented yet)
  * summonmbf CCMD.
  * Beta BFG code pointer (but not the related missiles yet.)
  * PowerInvisibility enhancements.
  * ScoreItem with one significant change: Added a score variable that can be
    checked through ACS and DECORATE. The engine itself will do nothing with it.
  * Nailgun option for A_Explode.
  * A_PrintBold and A_Log.
  * A_SetSpecial.


SVN r1819 (trunk)
This commit is contained in:
Christoph Oelckers 2009-09-14 19:44:14 +00:00
commit 238d4c3fac
34 changed files with 562 additions and 108 deletions

View file

@ -5,6 +5,7 @@
#include "info.h"
#include "s_sound.h"
#include "sc_man.h"
#include "cmdlib.h"
class FScanner;
@ -25,6 +26,9 @@ struct FFlagDef
FFlagDef *FindFlag (const PClass *type, const char *part1, const char *part2);
void HandleDeprecatedFlags(AActor *defaults, FActorInfo *info, bool set, int index);
const char *GetFlagName(int flagnum, int flagoffset);
#define FLAG_NAME(flagnum, flagvar) GetFlagName(flagnum, myoffsetof(AActor, flagvar))
//==========================================================================
@ -120,7 +124,7 @@ public:
~FStateExpressions();
int Add(FxExpression *x, const PClass *o, bool c);
int Reserve(int num, const PClass *cls);
void Set(int num, FxExpression *x);
void Set(int num, FxExpression *x, bool cloned = false);
void Copy(int dest, int src, int cnt);
int ResolveAll();
FxExpression *Get(int no);

View file

@ -560,12 +560,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfArmorType)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Explode)
{
ACTION_PARAM_START(5);
ACTION_PARAM_START(7);
ACTION_PARAM_INT(damage, 0);
ACTION_PARAM_INT(distance, 1);
ACTION_PARAM_BOOL(hurtSource, 2);
ACTION_PARAM_BOOL(alert, 3);
ACTION_PARAM_INT(fulldmgdistance, 4);
ACTION_PARAM_INT(nails, 5);
ACTION_PARAM_INT(naildamage, 6);
if (damage < 0) // get parameters from metadata
{
@ -578,6 +580,21 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Explode)
{
if (distance <= 0) distance = damage;
}
// NailBomb effect, from SMMU but not from its source code: instead it was implemented and
// generalized from the documentation at http://www.doomworld.com/eternity/engine/codeptrs.html
if (nails)
{
angle_t ang;
for (int i = 0; i < nails; i++)
{
ang = i*(ANGLE_MAX/nails);
// Comparing the results of a test wad with Eternity, it seems A_NailBomb does not aim
P_LineAttack (self, ang, MISSILERANGE, 0,
//P_AimLineAttack (self, ang, MISSILERANGE),
naildamage, NAME_None, NAME_BulletPuff);
}
}
P_RadiusAttack (self, self->target, damage, distance, self->DamageType, hurtSource, true, fulldmgdistance);
if (self->z <= self->floorz + (distance<<FRACBITS))
@ -1675,6 +1692,47 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Print)
}
}
//===========================================================================
//
// A_PrintBold
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PrintBold)
{
ACTION_PARAM_START(3);
ACTION_PARAM_STRING(text, 0);
ACTION_PARAM_FLOAT(time, 1);
ACTION_PARAM_NAME(fontname, 2);
float saved = con_midtime;
FFont *font = NULL;
if (fontname != NAME_None)
{
font = V_GetFont(fontname);
}
if (time > 0)
{
con_midtime = time;
}
C_MidPrintBold(font != NULL ? font : SmallFont, text);
con_midtime = saved;
}
//===========================================================================
//
// A_Log
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Log)
{
ACTION_PARAM_START(1);
ACTION_PARAM_STRING(text, 0);
Printf("%s\n", text);
}
//===========================================================================
//
@ -2769,3 +2827,28 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetArg)
self->args[pos] = value;
}
}
//===========================================================================
//
// A_SetSpecial
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpecial)
{
ACTION_PARAM_START(6);
ACTION_PARAM_INT(spec, 0);
ACTION_PARAM_INT(arg0, 1);
ACTION_PARAM_INT(arg1, 2);
ACTION_PARAM_INT(arg2, 3);
ACTION_PARAM_INT(arg3, 4);
ACTION_PARAM_INT(arg4, 5);
self->special = spec;
self->args[0] = arg0;
self->args[1] = arg1;
self->args[2] = arg2;
self->args[3] = arg3;
self->args[4] = arg4;
}

View file

@ -391,6 +391,24 @@ FFlagDef *FindFlag (const PClass *type, const char *part1, const char *part2)
}
//==========================================================================
//
// Gets the name of an actor flag
//
//==========================================================================
const char *GetFlagName(int flagnum, int flagoffset)
{
for(int i=0; i<countof(ActorFlags); i++)
{
if (ActorFlags[i].flagbit == flagnum && ActorFlags[i].structoffset == flagoffset)
{
return ActorFlags[i].name;
}
}
return "(unknown)"; // return something printable
}
//==========================================================================
//
// Find a property by name using a binary search
@ -534,7 +552,6 @@ static int STACK_ARGS varcmp(const void * a, const void * b)
return stricmp(A->name, B->name);
}
//==========================================================================
//
// Initialization

View file

@ -75,6 +75,7 @@ DEFINE_MEMBER_VARIABLE_ALIAS(momx, velx, AActor)
DEFINE_MEMBER_VARIABLE_ALIAS(momy, vely, AActor)
DEFINE_MEMBER_VARIABLE_ALIAS(momz, velz, AActor)
DEFINE_MEMBER_VARIABLE(Damage, AActor)
DEFINE_MEMBER_VARIABLE(Score, AActor)
//==========================================================================
//
@ -2812,13 +2813,13 @@ int FStateExpressions::Reserve(int num, const PClass *cls)
//
//==========================================================================
void FStateExpressions::Set(int num, FxExpression *x)
void FStateExpressions::Set(int num, FxExpression *x, bool cloned)
{
if (num >= 0 && num < int(Size()))
{
assert(expressions[num].expr == NULL || expressions[num].cloned);
expressions[num].expr = x;
expressions[num].cloned = false;
expressions[num].cloned = cloned;
}
}

View file

@ -849,10 +849,11 @@ DEFINE_PROPERTY(bloodtype, Sss, Actor)
//==========================================================================
DEFINE_PROPERTY(bouncetype, S, Actor)
{
static const char *names[] = { "None", "Doom", "Heretic", "Hexen", "DoomCompat", "HereticCompat", "HexenCompat", NULL };
static const BYTE flags[] = { BOUNCE_None,
static const char *names[] = { "None", "Doom", "Heretic", "Hexen", "DoomCompat", "HereticCompat", "HexenCompat", "Grenade", "Classic", NULL };
static const int flags[] = { BOUNCE_None,
BOUNCE_Doom, BOUNCE_Heretic, BOUNCE_Hexen,
BOUNCE_DoomCompat, BOUNCE_HereticCompat, BOUNCE_HexenCompat };
BOUNCE_DoomCompat, BOUNCE_HereticCompat, BOUNCE_HexenCompat,
BOUNCE_Grenade, BOUNCE_Classic, };
PROP_STRING_PARM(id, 0);
int match = MatchString(id, names);
if (match < 0)
@ -1294,7 +1295,6 @@ DEFINE_CLASS_PROPERTY(pickupsound, S, Inventory)
//==========================================================================
DEFINE_CLASS_PROPERTY(pickupannouncerentry, S, Inventory)
{
PROP_STRING_PARM(str, 0);
}
//==========================================================================