- added gravity property to UDMF things. Positive values are multiplied with the class's gravity property, negative values are used as their absolute.

This commit is contained in:
Christoph Oelckers 2013-08-09 16:25:16 +02:00
parent 5d0369d4ed
commit 0a258f95ea
6 changed files with 16 additions and 0 deletions

View file

@ -204,6 +204,8 @@ Note: All <bool> fields default to false unless mentioned otherwise.
// Parameter is the conversation ID, 0 meaning none. // Parameter is the conversation ID, 0 meaning none.
countsecret = <bool>; // Picking up this actor counts as a secret. countsecret = <bool>; // Picking up this actor counts as a secret.
arg0str = <string>; // Alternate string-based version of arg0 arg0str = <string>; // Alternate string-based version of arg0
gravity = <float>; // Set per-actor gravity. Positive values are multiplied with the class's property,
// negative values are used as their absolute. Default = 1.0.
* Note about arg0str * Note about arg0str

View file

@ -342,6 +342,7 @@ struct FMapThing
int special; int special;
int args[5]; int args[5];
int Conversation; int Conversation;
fixed_t gravity;
void Serialize (FArchive &); void Serialize (FArchive &);
}; };

View file

@ -698,6 +698,7 @@ static int LoadSprites (spritetype *sprites, Xsprite *xsprites, int numsprites,
mapthings[count].SkillFilter = 0xffff; mapthings[count].SkillFilter = 0xffff;
mapthings[count].flags = MTF_SINGLE|MTF_COOPERATIVE|MTF_DEATHMATCH; mapthings[count].flags = MTF_SINGLE|MTF_COOPERATIVE|MTF_DEATHMATCH;
mapthings[count].special = 0; mapthings[count].special = 0;
mapthings[count].gravity = FRACUNIT;
if (xsprites != NULL && sprites[i].lotag == 710) if (xsprites != NULL && sprites[i].lotag == 710)
{ // Blood ambient sound { // Blood ambient sound

View file

@ -4712,6 +4712,10 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
mobj->SpawnPoint[2] = mthing->z; mobj->SpawnPoint[2] = mthing->z;
mobj->SpawnAngle = mthing->angle; mobj->SpawnAngle = mthing->angle;
mobj->SpawnFlags = mthing->flags; mobj->SpawnFlags = mthing->flags;
if (mthing->gravity < 0) mobj->gravity = -mthing->gravity;
else if (mthing->gravity > 0) mobj->gravity = FixedMul(mobj->gravity, mthing->gravity);
else mobj->flags &= ~MF_NOGRAVITY;
P_FindFloorCeiling(mobj, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT); P_FindFloorCeiling(mobj, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT);
if (!(mobj->flags2 & MF2_ARGSDEFINED)) if (!(mobj->flags2 & MF2_ARGSDEFINED))

View file

@ -1750,6 +1750,7 @@ void P_LoadThings (MapData * map)
memset (&mti[i], 0, sizeof(mti[i])); memset (&mti[i], 0, sizeof(mti[i]));
mti[i].gravity = FRACUNIT;
mti[i].Conversation = 0; mti[i].Conversation = 0;
mti[i].SkillFilter = MakeSkill(flags); mti[i].SkillFilter = MakeSkill(flags);
mti[i].ClassFilter = 0xffff; // Doom map format doesn't have class flags so spawn for all player classes mti[i].ClassFilter = 0xffff; // Doom map format doesn't have class flags so spawn for all player classes
@ -1825,6 +1826,7 @@ void P_LoadThings2 (MapData * map)
mti[i].ClassFilter = (mti[i].flags & MTF_CLASS_MASK) >> MTF_CLASS_SHIFT; mti[i].ClassFilter = (mti[i].flags & MTF_CLASS_MASK) >> MTF_CLASS_SHIFT;
mti[i].flags &= ~(MTF_SKILLMASK|MTF_CLASS_MASK); mti[i].flags &= ~(MTF_SKILLMASK|MTF_CLASS_MASK);
mti[i].Conversation = 0; mti[i].Conversation = 0;
mti[i].gravity = FRACUNIT;
} }
delete[] mtp; delete[] mtp;
} }

View file

@ -475,6 +475,7 @@ public:
FString arg0str, arg1str; FString arg0str, arg1str;
memset(th, 0, sizeof(*th)); memset(th, 0, sizeof(*th));
th->gravity = FRACUNIT;
sc.MustGetToken('{'); sc.MustGetToken('{');
while (!sc.CheckToken('}')) while (!sc.CheckToken('}'))
{ {
@ -515,6 +516,11 @@ public:
th->special = CheckInt(key); th->special = CheckInt(key);
break; break;
case NAME_Gravity:
CHECK_N(Zd | Zdt)
th->gravity = CheckFixed(key);
break;
case NAME_Arg0: case NAME_Arg0:
case NAME_Arg1: case NAME_Arg1:
case NAME_Arg2: case NAME_Arg2: