mirror of
https://github.com/ZDoom/gzdoom-last-svn.git
synced 2025-05-29 16:31:16 +00:00
* Updated to ZDoom 4140:
- Fixed: If you hit a wall at the right moment you would some times come out of a teleporter with sliding velocity. - Fixed incorrect -= operators in vectors.h. - Add support for user variables on things in UDMF maps. If you include an actor's user variable in its UDMF thing definition, that user variable will be set to the desired value for that actor when the map is loaded. git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@1528 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
parent
a6b89e2b6a
commit
b9951b548d
6 changed files with 88 additions and 11 deletions
|
@ -2516,10 +2516,17 @@ void FSlide::SlideMove (AActor *mo, fixed_t tryx, fixed_t tryy, int numsteps)
|
|||
{
|
||||
newx = FixedMul (tryx, bestslidefrac);
|
||||
newy = FixedMul (tryy, bestslidefrac);
|
||||
|
||||
|
||||
// [BL] We need to abandon this function if we end up going through a teleporter
|
||||
const fixed_t startvelx = mo->velx;
|
||||
const fixed_t startvely = mo->vely;
|
||||
|
||||
// killough 3/15/98: Allow objects to drop off ledges
|
||||
if (!P_TryMove (mo, mo->x+newx, mo->y+newy, true))
|
||||
goto stairstep;
|
||||
|
||||
if (mo->velx != startvelx || mo->vely != startvely)
|
||||
return;
|
||||
}
|
||||
|
||||
// Now continue along the wall.
|
||||
|
|
|
@ -142,6 +142,8 @@ int numgamesubsectors;
|
|||
bool hasglnodes;
|
||||
|
||||
TArray<FMapThing> MapThingsConverted;
|
||||
TMap<unsigned,unsigned> MapThingsUserDataIndex; // from mapthing idx -> user data idx
|
||||
TArray<FMapThingUserData> MapThingsUserData;
|
||||
|
||||
int sidecount;
|
||||
sidei_t *sidetemp;
|
||||
|
@ -1637,7 +1639,7 @@ void P_LoadNodes (MapData * map)
|
|||
//===========================================================================
|
||||
CVAR(Bool, dumpspawnedthings, false, 0)
|
||||
|
||||
void SpawnMapThing(int index, FMapThing *mt, int position)
|
||||
AActor *SpawnMapThing(int index, FMapThing *mt, int position)
|
||||
{
|
||||
AActor *spawned = P_SpawnMapThing(mt, position);
|
||||
if (dumpspawnedthings)
|
||||
|
@ -1647,6 +1649,42 @@ void SpawnMapThing(int index, FMapThing *mt, int position)
|
|||
spawned? spawned->GetClass()->TypeName.GetChars() : "(none)");
|
||||
}
|
||||
T_AddSpawnedThing(spawned);
|
||||
return spawned;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// SetMapThingUserData
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
static void SetMapThingUserData(AActor *actor, unsigned udi)
|
||||
{
|
||||
if (actor == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
while (MapThingsUserData[udi].Property != NAME_None)
|
||||
{
|
||||
FName varname = MapThingsUserData[udi].Property;
|
||||
int value = MapThingsUserData[udi].Value;
|
||||
PSymbol *sym = actor->GetClass()->Symbols.FindSymbol(varname, true);
|
||||
PSymbolVariable *var;
|
||||
|
||||
udi++;
|
||||
|
||||
if (sym == NULL || sym->SymbolType != SYM_Variable ||
|
||||
!(var = static_cast<PSymbolVariable *>(sym))->bUserVar ||
|
||||
var->ValueType.Type != VAL_Int)
|
||||
{
|
||||
DPrintf("%s is not a user variable in class %s\n", varname.GetChars(),
|
||||
actor->GetClass()->TypeName.GetChars());
|
||||
}
|
||||
else
|
||||
{ // Set the value of the specified user variable.
|
||||
*(int *)(reinterpret_cast<BYTE *>(actor) + var->offset) = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -1685,7 +1723,7 @@ void P_LoadThings (MapData * map)
|
|||
for (int i=0 ; i < numthings; i++, mt++)
|
||||
{
|
||||
// [RH] At this point, monsters unique to Doom II were weeded out
|
||||
// if the IWAD wasn't for Doom II. R_SpawnMapThing() can now
|
||||
// if the IWAD wasn't for Doom II. P_SpawnMapThing() can now
|
||||
// handle these and more cases better, so we just pass it
|
||||
// everything and let it decide what to do with them.
|
||||
|
||||
|
@ -1780,7 +1818,12 @@ void P_SpawnThings (int position)
|
|||
|
||||
for (int i=0; i < numthings; i++)
|
||||
{
|
||||
SpawnMapThing (i, &MapThingsConverted[i], position);
|
||||
AActor *actor = SpawnMapThing (i, &MapThingsConverted[i], position);
|
||||
unsigned *udi = MapThingsUserDataIndex.CheckKey((unsigned)i);
|
||||
if (udi != NULL)
|
||||
{
|
||||
SetMapThingUserData(actor, *udi);
|
||||
}
|
||||
}
|
||||
for(int i=0; i<MAXPLAYERS; i++)
|
||||
{
|
||||
|
@ -3501,6 +3544,8 @@ void P_SetupLevel (char *lumpname, int position)
|
|||
wminfo.partime = 180;
|
||||
|
||||
MapThingsConverted.Clear();
|
||||
MapThingsUserDataIndex.Clear();
|
||||
MapThingsUserData.Clear();
|
||||
linemap.Clear();
|
||||
FCanvasTextureInfo::EmptyList ();
|
||||
R_FreePastViewers ();
|
||||
|
@ -4071,6 +4116,8 @@ void P_SetupLevel (char *lumpname, int position)
|
|||
}
|
||||
}
|
||||
MapThingsConverted.Clear();
|
||||
MapThingsUserDataIndex.Clear();
|
||||
MapThingsUserData.Clear();
|
||||
|
||||
if (glsegextras != NULL)
|
||||
{
|
||||
|
|
|
@ -159,4 +159,14 @@ struct FMissingCount
|
|||
};
|
||||
typedef TMap<FString,FMissingCount> FMissingTextureTracker;
|
||||
|
||||
// Record of user data for UDMF maps
|
||||
struct FMapThingUserData
|
||||
{
|
||||
FName Property;
|
||||
int Value;
|
||||
};
|
||||
extern TMap<unsigned,unsigned> MapThingsUserDataIndex; // from mapthing idx -> user data idx
|
||||
extern TArray<FMapThingUserData> MapThingsUserData;
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -627,9 +627,12 @@ public:
|
|||
break;
|
||||
|
||||
default:
|
||||
if (!strnicmp("user_", key.GetChars(), 5))
|
||||
{
|
||||
// Custom user key - handle later
|
||||
if (0 == strnicmp("user_", key.GetChars(), 5))
|
||||
{ // Custom user key - Sets an actor's user variable directly
|
||||
FMapThingUserData ud;
|
||||
ud.Property = key;
|
||||
ud.Value = CheckInt(key);
|
||||
MapThingsUserData.Push(ud);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1603,8 +1606,18 @@ public:
|
|||
if (sc.Compare("thing"))
|
||||
{
|
||||
FMapThing th;
|
||||
unsigned userdatastart = MapThingsUserData.Size();
|
||||
ParseThing(&th);
|
||||
MapThingsConverted.Push(th);
|
||||
if (userdatastart < MapThingsUserData.Size())
|
||||
{ // User data added
|
||||
MapThingsUserDataIndex[MapThingsConverted.Size()-1] = userdatastart;
|
||||
// Mark end of the user data for this map thing
|
||||
FMapThingUserData ud;
|
||||
ud.Property = NAME_None;
|
||||
ud.Value = 0;
|
||||
MapThingsUserData.Push(ud);
|
||||
}
|
||||
}
|
||||
else if (sc.Compare("linedef"))
|
||||
{
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
// This file was automatically generated by the
|
||||
// updaterevision tool. Do not edit by hand.
|
||||
|
||||
#define ZD_SVN_REVISION_STRING "4136"
|
||||
#define ZD_SVN_REVISION_NUMBER 4136
|
||||
#define ZD_SVN_REVISION_STRING "4140"
|
||||
#define ZD_SVN_REVISION_NUMBER 4140
|
||||
|
|
|
@ -439,7 +439,7 @@ struct TVector3
|
|||
// Vector subtraction
|
||||
TVector3 &operator-= (const TVector3 &other)
|
||||
{
|
||||
X -= other.X, Y -= other.Y, Z - other.Z;
|
||||
X -= other.X, Y -= other.Y, Z -= other.Z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -1166,7 +1166,7 @@ struct TRotator
|
|||
// Vector subtraction
|
||||
TRotator &operator-= (const TRotator &other)
|
||||
{
|
||||
Pitch -= other.Pitch, Yaw -= other.Yaw, Roll - other.Roll;
|
||||
Pitch -= other.Pitch, Yaw -= other.Yaw, Roll -= other.Roll;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue