- Changed A_ChangeFlag so that it doesn't need to alter the flag

string. With strings being passed as names this is unsafe.
- Removed unused parameter types from the function parameter parser for
  DECORATE.
- Changed: All actor name parameters in DECORATE are now passed as 
  FNames, not as strings. 
- Fixed: The MAPINFO parser stored the RedirectType as a type pointer.
  But at this point DECORATE hasn't been read yet so this was limited to
  the internal classes.
- Fixed: TXT_NEED_IDCARD wasn't terminated with a ';'.
- Fixed: Strife's DeadRebel was missing its DoomEdNum.
- With names as type identifiers it is no longer necessary to remap
  the monster types to internal constants in A_BossDeath.
- Fixed: A_BossDeath got the string from a name - just to get a name from
  the string. Using the name directly is sufficient.


SVN r103 (trunk)
This commit is contained in:
Christoph Oelckers 2006-05-10 15:07:14 +00:00
parent 032526340a
commit 159c548c5a
14 changed files with 115 additions and 120 deletions

View file

@ -1,3 +1,20 @@
May 10, 2006 (Changes by Graf Zahl)
- Changed A_ChangeFlag so that it doesn't need to alter the flag
string. With strings being passed as names this is unsafe.
- Removed unused parameter types from the function parameter parser for
DECORATE.
- Changed: All actor name parameters in DECORATE are now passed as
FNames, not as strings.
- Fixed: The MAPINFO parser stored the RedirectType as a type pointer.
But at this point DECORATE hasn't been read yet so this was limited to
the internal classes.
- Fixed: TXT_NEED_IDCARD wasn't terminated with a ';'.
- Fixed: Strife's DeadRebel was missing its DoomEdNum.
- With names as type identifiers it is no longer necessary to remap
the monster types to internal constants in A_BossDeath.
- Fixed: A_BossDeath got the string from a name - just to get a name from
the string. Using the name directly is sufficient.
May 9, 2006
- Redid ClearLcoks() fix that I accidentally removed.
- Added a new setting for am_rotate: 2 will enable rotation only for the

View file

@ -8,6 +8,7 @@
%ifndef M_TARGET_LINUX
%define ylookup _ylookup
%define vince _vince
%define vplce _vplce
%define palookupoffse _palookupoffse
%define bufplce _bufplce
%define dc_iscale _dc_iscale
@ -26,7 +27,6 @@
%define mvlineasm1 _mvlineasm1
%define mvlineasm4 _mvlineasm4
%endif
%define vplce _vplce
EXTERN ylookup ; near
@ -453,10 +453,10 @@ fixchain2mb: add edi, 320
ALIGN 16
endmvlineasm4:
mov [_vplce], ecx
mov [_vplce+4], edx
mov [_vplce+8], esi
mov [_vplce+12], ebp
mov [vplce], ecx
mov [vplce+4], edx
mov [vplce+8], esi
mov [vplce+12], ebp
pop ecx
pop ebp
pop edi

View file

@ -1356,7 +1356,7 @@ void A_BFGSpray (AActor *mo)
int index = CheckIndex (3, NULL);
if (index >= 0)
{
spraytype = PClass::FindClass ((const char *)StateParameters[index]);
spraytype = PClass::FindClass ((ENamedName)StateParameters[index]);
numrays = EvalExpressionI (StateParameters[index+1], mo);
if (numrays <= 0)
numrays = 40;

View file

@ -173,7 +173,7 @@ void A_FatAttack1 (AActor *self)
const PClass *spawntype = NULL;
int index = CheckIndex (1, NULL);
if (index >= 0) spawntype = PClass::FindClass ((const char *)StateParameters[index]);
if (index >= 0) spawntype = PClass::FindClass ((ENamedName)StateParameters[index]);
if (spawntype == NULL) spawntype = RUNTIME_CLASS(AFatShot);
A_FaceTarget (self);
@ -201,7 +201,7 @@ void A_FatAttack2 (AActor *self)
const PClass *spawntype = NULL;
int index = CheckIndex (1, NULL);
if (index >= 0) spawntype = PClass::FindClass ((const char *)StateParameters[index]);
if (index >= 0) spawntype = PClass::FindClass ((ENamedName)StateParameters[index]);
if (spawntype == NULL) spawntype = RUNTIME_CLASS(AFatShot);
A_FaceTarget (self);
@ -229,7 +229,7 @@ void A_FatAttack3 (AActor *self)
const PClass *spawntype = NULL;
int index = CheckIndex (1, NULL);
if (index >= 0) spawntype = PClass::FindClass ((const char *)StateParameters[index]);
if (index >= 0) spawntype = PClass::FindClass ((ENamedName)StateParameters[index]);
if (spawntype == NULL) spawntype = RUNTIME_CLASS(AFatShot);
A_FaceTarget (self);
@ -266,7 +266,7 @@ void A_Mushroom (AActor *actor)
int index = CheckIndex (1, NULL);
if (index >= 0)
{
spawntype = PClass::FindClass((const char *)StateParameters[index]);
spawntype = PClass::FindClass((ENamedName)StateParameters[index]);
n = EvalExpressionI (StateParameters[index+1], actor);
if (n == 0)
n = actor->damage;

View file

@ -115,7 +115,7 @@ void A_PainShootSkull (AActor *self, angle_t angle)
int index=CheckIndex(1, NULL);
if (index>=0)
{
spawntype = PClass::FindClass((const char *)StateParameters[index]);
spawntype = PClass::FindClass((ENamedName)StateParameters[index]);
}
if (spawntype == NULL) spawntype = RUNTIME_CLASS(ALostSoul);

View file

@ -772,12 +772,14 @@ static void ParseMapInfoLower (MapInfoHandler *handlers,
case MITYPE_REDIRECT:
SC_MustGetString ();
levelinfo->RedirectType = PClass::FindClass (sc_String);
levelinfo->RedirectType = sc_String;
/*
if (levelinfo->RedirectType == NULL ||
!(levelinfo->RedirectType->IsDescendantOf (RUNTIME_CLASS(AInventory))))
{
SC_ScriptError ("%s is not an inventory item", sc_String);
}
*/
// Intentional fall-through
case MITYPE_MAPNAME: {
@ -2168,18 +2170,22 @@ level_info_t *FindLevelByNum (int num)
level_info_t *CheckLevelRedirect (level_info_t *info)
{
if (info->RedirectType != NULL)
if (info->RedirectType != NAME_None)
{
for (int i = 0; i < MAXPLAYERS; ++i)
const PClass *type = PClass::FindClass(info->RedirectType);
if (type != NULL)
{
if (playeringame[i] && players[i].mo->FindInventory (info->RedirectType))
for (int i = 0; i < MAXPLAYERS; ++i)
{
level_info_t *newinfo = FindLevelInfo (info->RedirectMap);
if (newinfo != NULL)
if (playeringame[i] && players[i].mo->FindInventory (type))
{
info = newinfo;
level_info_t *newinfo = FindLevelInfo (info->RedirectMap);
if (newinfo != NULL)
{
info = newinfo;
}
break;
}
break;
}
}
}

View file

@ -148,7 +148,7 @@ struct level_info_s
// Redirection: If any player is carrying the specified item, then
// you go to the RedirectMap instead of this one.
const PClass *RedirectType;
FName RedirectType;
char RedirectMap[9];
char enterpic[9];

View file

@ -86,7 +86,7 @@ const BYTE SF_BIGTIC = 0x80;
// The first 2 parameters for each function call represent
// the old misc1/misc2 values, even for non-weapons
extern TArray<intptr_t> StateParameters;
extern TArray<int> StateParameters;
struct FState
{

View file

@ -79,7 +79,27 @@ xx(Mauler)
xx(Chicken)
xx(Pig)
// Damage types
xx(Fire)
//xx(Ice) already defined above
xx(Disintegrate)
#if 0
xx(Water)
xx(Slime)
xx(Crush)
xx(Telefrag)
xx(Falling)
xx(Suicide)
xx(Exit)
xx(Railgun)
xx(Poison)
xx(Electric)
xx(BFGSplash)
xx(DrainLife) // A weapon like the Sigil that drains your life away.
xx(Massacre) // For death by a cheater!
//(Melee) already defined above, so don't define it again
// Standard animator names.
xx(Spawn)
@ -106,25 +126,6 @@ xx(AltHoldAttack)
// a damage type if you wanted to force an extreme death.
xx(Extreme)
// Damage types
xx(Fire)
//xx(Ice) already defined above
xx(Disintegrate)
xx(Water)
xx(Slime)
xx(Crush)
xx(Telefrag)
xx(Falling)
xx(Suicide)
xx(Exit)
xx(Railgun)
xx(Poison)
xx(Electric)
xx(BFGSplash)
xx(DrainLife) // A weapon like the Sigil that drains your life away.
xx(Massacre) // For death by a cheater!
//(Melee) already defined above, so don't define it again
// Compatible death names for the decorate parser.
xx(XDeath)
xx(BDeath)

View file

@ -2349,25 +2349,14 @@ bool CheckBossDeath (AActor *actor)
//
void A_BossDeath (AActor *actor)
{
enum
{
MT_FATSO,
MT_BABY,
MT_BRUISER,
MT_CYBORG,
MT_SPIDER,
MT_HEAD,
MT_MINOTAUR,
MT_SORCERER2
} type;
FName type = actor->GetClass()->TypeName;
// Do generic special death actions first
bool checked = false;
FSpecialAction *sa = level.info->specialactions;
while (sa)
{
if (FName(actor->GetClass()->TypeName.GetChars()) == sa->Type)
if (type == sa->Type)
{
if (!checked && !CheckBossDeath(actor))
{
@ -2393,28 +2382,14 @@ void A_BossDeath (AActor *actor)
LEVEL_SORCERER2SPECIAL)) == 0)
return;
const PClass *actorType = actor->GetClass();
switch (actorType->TypeName)
{
case NAME_Fatso: type = MT_FATSO; break;
case NAME_Arachnotron: type = MT_BABY; break;
case NAME_BaronOfHell: type = MT_BRUISER; break;
case NAME_Cyberdemon: type = MT_CYBORG; break;
case NAME_SpiderMastermind: type = MT_SPIDER; break;
case NAME_Ironlich: type = MT_HEAD; break;
case NAME_Minotaur: type = MT_MINOTAUR; break;
case NAME_Sorcerer2: type = MT_SORCERER2; break;
default: return;
}
if (
((level.flags & LEVEL_MAP07SPECIAL) && (type == MT_FATSO || type == MT_BABY)) ||
((level.flags & LEVEL_BRUISERSPECIAL) && (type == MT_BRUISER)) ||
((level.flags & LEVEL_CYBORGSPECIAL) && (type == MT_CYBORG)) ||
((level.flags & LEVEL_SPIDERSPECIAL) && (type == MT_SPIDER)) ||
((level.flags & LEVEL_HEADSPECIAL) && (type == MT_HEAD)) ||
((level.flags & LEVEL_MINOTAURSPECIAL) && (type == MT_MINOTAUR)) ||
((level.flags & LEVEL_SORCERER2SPECIAL) && (type == MT_SORCERER2))
((level.flags & LEVEL_MAP07SPECIAL) && (type == NAME_Fatso || type == NAME_Arachnotron)) ||
((level.flags & LEVEL_BRUISERSPECIAL) && (type == NAME_BaronOfHell)) ||
((level.flags & LEVEL_CYBORGSPECIAL) && (type == NAME_Cyberdemon)) ||
((level.flags & LEVEL_SPIDERSPECIAL) && (type == NAME_SpiderMastermind)) ||
((level.flags & LEVEL_HEADSPECIAL) && (type == NAME_Ironlich)) ||
((level.flags & LEVEL_MINOTAURSPECIAL) && (type == NAME_Minotaur)) ||
((level.flags & LEVEL_SORCERER2SPECIAL) && (type == NAME_Sorcerer2))
)
;
else
@ -2432,13 +2407,13 @@ void A_BossDeath (AActor *actor)
}
if (level.flags & LEVEL_MAP07SPECIAL)
{
if (type == MT_FATSO)
if (type == NAME_Fatso)
{
EV_DoFloor (DFloor::floorLowerToLowest, NULL, 666, FRACUNIT, 0, 0, 0);
return;
}
if (type == MT_BABY)
if (type == NAME_Arachnotron)
{
EV_DoFloor (DFloor::floorRaiseByTexture, NULL, 667, FRACUNIT, 0, 0, 0);
return;

View file

@ -77,7 +77,7 @@ extern TArray<FActorInfo *> Decorations;
// allow decal specifications in DECORATE. Decals are loaded after DECORATE so the names must be stored here.
TArray<char*> DecalNames;
// all state parameters
TArray<intptr_t> StateParameters;
TArray<int> StateParameters;
//==========================================================================
//
@ -362,17 +362,16 @@ int EvalExpressionI (int id, AActor *self);
void A_ChangeFlag(AActor * self)
{
int index=CheckIndex(2);
char * flagname = (char *)StateParameters[index]; // the string is changed but that doesn't really matter
const char * flagname = FName((ENamedName)StateParameters[index]).GetChars();
int expression = EvalExpressionI (StateParameters[index+1], self);
char *dot = strchr (flagname, '.');
const char *dot = strchr (flagname, '.');
flagdef *fd;
if (dot != NULL)
{
*dot = '\0';
fd = FindFlag (self->GetClass(), flagname, dot+1);
*dot = '.';
FString part1(flagname, dot-flagname);
fd = FindFlag (self->GetClass(), part1, dot+1);
}
else
{
@ -665,7 +664,7 @@ AFuncDesc AFTable[]=
FUNC(A_ExtChase, "XXyx")
FUNC(A_Jiggle, "XX")
FUNC(A_DropInventory, "M")
FUNC(A_SetBlend, "DXXd")
FUNC(A_SetBlend, "CXXc")
FUNC(A_ChangeFlag, "TX")
FUNC(A_JumpIf, "XL")
FUNC(A_KillMaster, NULL)
@ -1629,7 +1628,7 @@ do_stop:
const char * params = afd->parameters;
int numparams = (int)strlen(params);
int paramindex = PrepareStateParameters(&state, numparams);
intptr_t v;
int v;
if (!islower(*params))
{
@ -1643,10 +1642,11 @@ do_stop:
{
switch(*params)
{
/*
case 'A':
case 'a': // Angle
SC_MustGetFloat();
v=angle_t(sc_Float*ANGLE_1);
v=(int)angle_t(sc_Float*ANGLE_1);
break;
case 'B':
@ -1672,6 +1672,13 @@ do_stop:
v=fixed_t(sc_Float*FRACUNIT);
break;
case '!': // not boolean (to simulate parameters which default to 1)
SC_MustGetNumber();
v=!sc_Number;
break;
*/
case 'S':
case 's': // Sound name
SC_MustGetString();
@ -1683,7 +1690,7 @@ do_stop:
case 'T':
case 't': // String
SC_MustGetString();
v = (intptr_t)(sc_String[0] ? copystring(sc_String) : NULL);
v = (int)(sc_String[0] ? FName(sc_String) : NAME_None);
break;
case 'L':
@ -1708,11 +1715,6 @@ do_stop:
break;
case '!': // not boolean (to simulate parameters which default to 1)
SC_MustGetNumber();
v=!sc_Number;
break;
case 'C':
case 'c':
SC_MustGetString ();
@ -1728,13 +1730,6 @@ do_stop:
}
break;
case 'D':
case 'd':
SC_MustGetString ();
v = V_GetColor (NULL, sc_String);
((PalEntry *)&v)->a = 255;
break;
case 'X':
case 'x':
v = ParseExpression (false);

View file

@ -413,7 +413,7 @@ void DoJumpIfInventory(AActor * self, AActor * owner)
int index=CheckIndex(3, &CallingState);
if (index<0 || owner == NULL) return;
const char * ItemType=(const char *)StateParameters[index];
ENamedName ItemType=(ENamedName)StateParameters[index];
int ItemAmount = EvalExpressionI (StateParameters[index+1], self);
int JumpOffset = StateParameters[index+2];
const PClass * Type=PClass::FindClass(ItemType);
@ -514,7 +514,7 @@ void A_CustomMissile(AActor * self)
int index=CheckIndex(6);
if (index<0) return;
const char * MissileName=(const char*)StateParameters[index];
ENamedName MissileName=(ENamedName)StateParameters[index];
fixed_t SpawnHeight=fixed_t(EvalExpressionF (StateParameters[index+1], self) * FRACUNIT);
int Spawnofs_XY=EvalExpressionI (StateParameters[index+2], self);
angle_t Angle=angle_t(EvalExpressionF (StateParameters[index+3], self) * ANGLE_1);
@ -629,7 +629,7 @@ void A_CustomBulletAttack (AActor *self)
angle_t Spread_Z=angle_t(EvalExpressionF (StateParameters[index+1], self) * ANGLE_1);
int NumBullets=EvalExpressionI (StateParameters[index+2], self);
int DamagePerBullet=EvalExpressionI (StateParameters[index+3], self);
const char * PuffType=(const char *)StateParameters[index+4];
ENamedName PuffType=(ENamedName)StateParameters[index+4];
fixed_t Range = fixed_t(EvalExpressionF (StateParameters[index+5], self) * FRACUNIT);
if(Range==0) Range=MISSILERANGE;
@ -675,15 +675,14 @@ void A_CustomMeleeAttack (AActor *self)
int Modulus = EvalExpressionI (StateParameters[index+1], self);
int Adder = EvalExpressionI (StateParameters[index+2], self);
int MeleeSound=StateParameters[index+3];
const char * DamageType = (const char*)StateParameters[index+4];
ENamedName DamageType = (ENamedName)StateParameters[index+4];
bool bleed = EvalExpressionN (StateParameters[index+5], self);
int mod;
// This needs to be redesigned once the customizable damage type system is working
if (DamageType == NULL) mod=MOD_HIT;
else if (!stricmp(DamageType, "Fire")) mod=MOD_FIRE;
else if (!stricmp(DamageType, "Ice")) mod=MOD_ICE;
else if (!stricmp(DamageType, "Disintegrate")) mod=MOD_DISINTEGRATE;
if (DamageType==NAME_Fire) mod=MOD_FIRE;
else if (DamageType==NAME_Ice) mod=MOD_ICE;
else if (DamageType==NAME_Disintegrate) mod=MOD_DISINTEGRATE;
else mod=MOD_HIT;
if (!self->target)
@ -729,7 +728,7 @@ void A_FireBullets (AActor *self)
angle_t Spread_Z=angle_t(EvalExpressionF (StateParameters[index+1], self) * ANGLE_1);
int NumberOfBullets=EvalExpressionI (StateParameters[index+2], self);
int DamagePerBullet=EvalExpressionI (StateParameters[index+3], self);
const char * PuffTypeName=(const char *)StateParameters[index+4];
ENamedName PuffTypeName=(ENamedName)StateParameters[index+4];
bool UseAmmo=EvalExpressionN (StateParameters[index+5], self);
fixed_t Range=fixed_t(EvalExpressionF (StateParameters[index+6], self) * FRACUNIT);
@ -789,7 +788,7 @@ void A_FireCustomMissile (AActor * self)
int index=CheckIndex(5);
if (index<0 || !self->player) return;
const char * MissileName=(const char *)StateParameters[index];
ENamedName MissileName=(ENamedName)StateParameters[index];
angle_t Angle=angle_t(EvalExpressionF (StateParameters[index+1], self) * ANGLE_1);
bool UseAmmo=EvalExpressionN (StateParameters[index+2], self);
int SpawnOfs_XY=EvalExpressionI (StateParameters[index+3], self);
@ -844,7 +843,7 @@ void A_CustomPunch (AActor *self)
int Damage=EvalExpressionI (StateParameters[index], self);
bool norandom=!!EvalExpressionI (StateParameters[index+1], self);
bool UseAmmo=EvalExpressionN (StateParameters[index+2], self);
const char * PuffTypeName=(const char *)StateParameters[index+3];
ENamedName PuffTypeName=(ENamedName)StateParameters[index+3];
fixed_t Range=fixed_t(EvalExpressionF (StateParameters[index+4], self) * FRACUNIT);
const PClass * PuffType;
@ -984,7 +983,7 @@ static void DoGiveInventory(AActor * self, AActor * receiver)
int index=CheckIndex(2);
if (index<0 || receiver == NULL) return;
const char * item =(const char*)StateParameters[index];
ENamedName item =(ENamedName)StateParameters[index];
int amount=EvalExpressionI (StateParameters[index+1], self);
if (amount==0) amount=1;
@ -1037,7 +1036,7 @@ void DoTakeInventory(AActor * self, AActor * receiver)
int index=CheckIndex(2);
if (index<0 || receiver == NULL) return;
const char * item =(const char*)StateParameters[index];
ENamedName item =(ENamedName)StateParameters[index];
int amount=EvalExpressionI (StateParameters[index+1], self);
const PClass * mi=PClass::FindClass(item);
@ -1083,7 +1082,7 @@ void A_SpawnItem(AActor * self)
int index=CheckIndex(4, &CallingState);
if (index<0) return;
const PClass * missile= PClass::FindClass((const char *)StateParameters[index]);
const PClass * missile= PClass::FindClass((ENamedName)StateParameters[index]);
fixed_t distance = EvalExpressionF (StateParameters[index+1], self);
fixed_t zheight = fixed_t(EvalExpressionF (StateParameters[index+2], self) * FRACUNIT);
bool useammo = EvalExpressionN (StateParameters[index+3], self);
@ -1180,7 +1179,7 @@ void A_ThrowGrenade(AActor * self)
int index=CheckIndex(5, &CallingState);
if (index<0) return;
const PClass * missile= PClass::FindClass((const char *)StateParameters[index]);
const PClass * missile= PClass::FindClass((ENamedName)StateParameters[index]);
fixed_t zheight = fixed_t(EvalExpressionF (StateParameters[index+1], self) * FRACUNIT);
fixed_t xymom = fixed_t(EvalExpressionF (StateParameters[index+2], self) * FRACUNIT);
fixed_t zmom = fixed_t(EvalExpressionF (StateParameters[index+3], self) * FRACUNIT);
@ -1251,7 +1250,7 @@ void A_SelectWeapon(AActor * actor)
int index=CheckIndex(1, NULL);
if (index<0 || actor->player == NULL) return;
const PClass * weapon= PClass::FindClass((const char *)StateParameters[index]);
const PClass * weapon= PClass::FindClass((ENamedName)StateParameters[index]);
AWeapon * weaponitem = static_cast<AWeapon*>(actor->FindInventory(weapon));
if (weaponitem != NULL && weaponitem->IsKindOf(RUNTIME_CLASS(AWeapon)))
@ -1278,7 +1277,7 @@ void A_Print(AActor * actor)
if (actor->CheckLocalView (consoleplayer) ||
(actor->target!=NULL && actor->target->CheckLocalView (consoleplayer)))
{
C_MidPrint((const char *)StateParameters[index]);
C_MidPrint(FName((ENamedName)StateParameters[index]).GetChars());
}
}
@ -1362,7 +1361,7 @@ void A_SpawnDebris(AActor * self)
int index=CheckIndex(1, NULL);
if (index<0) return;
debris = PClass::FindClass((const char *)StateParameters[index]);
debris = PClass::FindClass((ENamedName)StateParameters[index]);
if (debris == NULL) return;
for (i = 0; i < GetDefaultByType(debris)->health; i++)
@ -1454,7 +1453,7 @@ void A_DropInventory(AActor * self)
{
int index=CheckIndex(1, &CallingState);
if (index<0) return;
const PClass * ti = PClass::FindClass((const char*)StateParameters[index]);
const PClass * ti = PClass::FindClass((ENamedName)StateParameters[index]);
if (ti)
{
AInventory * inv = self->FindInventory(ti);
@ -1480,6 +1479,8 @@ void A_SetBlend(AActor * self)
int tics = EvalExpressionI (StateParameters[index+2], self);
PalEntry color2 = StateParameters[index+3];
if (color==-1) color=0;
if (color2==-1) color2=0;
if (!color2.a)
color2 = color;

View file

@ -671,7 +671,7 @@ ACTOR DeadReaver 20
// Dead Rebel ---------------------------------------------------------------
ACTOR DeadRebel
ACTOR DeadRebel 19
{
Game Strife
ConversationID 235, -1, -1

View file

@ -975,7 +975,7 @@ TXT_BLOODSCOURGE_PIECE = "SEGMENT OF BLOODSCOURGE";
TXT_NEEDKEY = "You don't have the key";
TXT_NEED_PASSCARD = "You need a passcard";
TXT_NEED_PASSCARD_DOOR = "You need a pass card key to open this door";
TXT_NEED_IDCARD = "You need an ID card"
TXT_NEED_IDCARD = "You need an ID card";
TXT_NEED_PRISONKEY = "You don't have the key to the prison";
TXT_NEED_HANDPRINT = "Hand print not on file";
TXT_NEED_GOLDKEY = "You need the Gold Key";