In-map emblem coordinates are now set via emblem mapthings (thing type 322) instead of X/Y/Z fields in SOC

This commit is contained in:
MascaraSnake 2019-02-03 14:32:07 +01:00
parent 8c345b87ca
commit bc30bd06df
5 changed files with 70 additions and 82 deletions

View File

@ -2491,12 +2491,8 @@ static void reademblemdata(MYFILE *f, INT32 num)
else
emblemlocations[num-1].type = (UINT8)value;
}
else if (fastcmp(word, "X"))
emblemlocations[num-1].x = (INT16)value;
else if (fastcmp(word, "Y"))
emblemlocations[num-1].y = (INT16)value;
else if (fastcmp(word, "Z"))
emblemlocations[num-1].z = (INT16)value;
else if (fastcmp(word, "TAG"))
emblemlocations[num-1].tag = (INT16)value;
else if (fastcmp(word, "MAPNUM"))
{
// Support using the actual map name,

View File

@ -6033,7 +6033,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
},
{ // MT_EMBLEM
-1, // doomednum
322, // doomednum
S_EMBLEM1, // spawnstate
1000, // spawnhealth
S_NULL, // seestate
@ -6270,7 +6270,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
},
{ // MT_EMERALDSPAWN
323, // doomednum
321, // doomednum
S_INVISIBLE, // spawnstate
1000, // spawnhealth
S_NULL, // seestate

View File

@ -87,9 +87,7 @@ typedef struct
typedef struct
{
UINT8 type; ///< Emblem type
INT16 x; ///< X coordinate.
INT16 y; ///< Y coordinate.
INT16 z; ///< Z coordinate.
INT16 tag; ///< Tag of emblem mapthing
INT16 level; ///< Level on which this emblem can be found.
UINT8 sprite; ///< emblem sprite to use, 0 - 25
UINT8 color; ///< skincolor to use

View File

@ -35,6 +35,7 @@
#include "p_slopes.h"
#endif
#include "f_finale.h"
#include "m_cond.h"
static CV_PossibleValue_t CV_BobSpeed[] = {{0, "MIN"}, {4*FRACUNIT, "MAX"}, {0, NULL}};
consvar_t cv_movebob = {"movebob", "1.0", CV_FLOAT|CV_SAVE, CV_BobSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
@ -10174,6 +10175,9 @@ You should think about modifying the deathmatch starts to take full advantage of
if (i == MT_TOKEN && ((gametype != GT_COOP && gametype != GT_COMPETITION) || ultimatemode || tokenbits == 30 || tokenlist & (1 << tokenbits++)))
return; // you already got this token, or there are too many, or the gametype's not right
if (i == MT_EMBLEM && (netgame || multiplayer || (modifiedgame && !savemoddata))) // No cheating!!
return;
// Objectplace landing point
noreturns:
@ -10190,7 +10194,7 @@ You should think about modifying the deathmatch starts to take full advantage of
ss->sector->floorheight) + ((mthing->options >> ZSHIFT) << FRACBITS);
else if (i == MT_AXIS || i == MT_AXISTRANSFER || i == MT_AXISTRANSFERLINE)
z = ONFLOORZ;
else if (i == MT_SPIKEBALL || P_WeaponOrPanel(i) || i == MT_EMERALDSPAWN || i == MT_TOKEN)
else if (i == MT_SPIKEBALL || P_WeaponOrPanel(i) || i == MT_EMERALDSPAWN || i == MT_TOKEN || i == MT_EMBLEM)
{
if (mthing->options & MTF_OBJECTFLIP)
{
@ -10292,6 +10296,60 @@ You should think about modifying the deathmatch starts to take full advantage of
#endif
switch(mobj->type)
{
case MT_EMBLEM:
{
INT32 i;
emblem_t *emblem = M_GetLevelEmblems(gamemap);
while (emblem)
{
if ((emblem->type == ET_GLOBAL || emblem->type == ET_SKIN) && emblem->tag == mthing->angle)
break;
emblem = M_GetLevelEmblems(-1);
}
if (!emblem)
{
CONS_Debug(DBG_GAMELOGIC, "No map emblem for map %d with tag %d found!\n", gamemap, mthing->angle);
break;
}
i = emblem - emblemlocations;
I_Assert(emblemlocations[i].sprite >= 'A' && emblemlocations[i].sprite <= 'Z');
P_SetMobjState(mobj, mobj->info->spawnstate + (emblemlocations[i].sprite - 'A'));
mobj->health = i + 1;
mobj->color = (UINT8)M_GetEmblemColor(&emblemlocations[i]);
if (emblemlocations[i].collected
|| (emblemlocations[i].type == ET_SKIN && emblemlocations[i].var != players[0].skin))
{
P_UnsetThingPosition(mobj);
mobj->flags |= MF_NOCLIP;
mobj->flags &= ~MF_SPECIAL;
mobj->flags |= MF_NOBLOCKMAP;
mobj->frame |= (tr_trans50 << FF_TRANSSHIFT);
P_SetThingPosition(mobj);
}
else
{
mobj->frame &= ~FF_TRANSMASK;
if (emblemlocations[i].type == ET_GLOBAL)
{
mobj->reactiontime = emblemlocations[i].var;
if (emblemlocations[i].var & GE_NIGHTSITEM)
{
mobj->flags |= MF_NIGHTSITEM;
mobj->flags &= ~MF_SPECIAL;
mobj->flags2 |= MF2_DONTDRAW;
}
}
}
break;
}
case MT_SKYBOX:
if (mthing->options & MTF_OBJECTSPECIAL)
skyboxcenterpnts[mthing->extrainfo] = mobj;

View File

@ -961,10 +961,6 @@ void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum)
}
#endif
//
// P_LoadThings
//
static void P_PrepareRawThings(UINT8 *data, size_t i)
{
mapthing_t *mt;
@ -1007,7 +1003,7 @@ static void P_PrepareThings(lumpnum_t lumpnum)
Z_Free(data);
}
static void P_LoadThings(void)
static void P_LoadThings(boolean loademblems)
{
size_t i;
mapthing_t *mt;
@ -1032,6 +1028,9 @@ static void P_LoadThings(void)
|| mt->type == 1702) // MT_AXISTRANSFERLINE
continue; // These were already spawned
if (!loademblems && mt->type == mobjinfo[MT_EMBLEM].doomednum)
continue;
mt->mobj = NULL;
P_SpawnMapThing(mt);
}
@ -1106,65 +1105,6 @@ static void P_LoadThings(void)
}
}
static inline void P_SpawnEmblems(void)
{
INT32 i, color;
mobj_t *emblemmobj;
for (i = 0; i < numemblems; i++)
{
if (emblemlocations[i].level != gamemap || emblemlocations[i].type > ET_SKIN)
continue;
emblemmobj = P_SpawnMobj(emblemlocations[i].x<<FRACBITS, emblemlocations[i].y<<FRACBITS,
emblemlocations[i].z<<FRACBITS, MT_EMBLEM);
I_Assert(emblemlocations[i].sprite >= 'A' && emblemlocations[i].sprite <= 'Z');
P_SetMobjStateNF(emblemmobj, emblemmobj->info->spawnstate + (emblemlocations[i].sprite - 'A'));
emblemmobj->health = i+1;
color = M_GetEmblemColor(&emblemlocations[i]);
emblemmobj->color = (UINT8)color;
if (emblemlocations[i].collected
|| (emblemlocations[i].type == ET_SKIN && emblemlocations[i].var != players[0].skin))
{
P_UnsetThingPosition(emblemmobj);
emblemmobj->flags |= MF_NOCLIP;
emblemmobj->flags &= ~MF_SPECIAL;
emblemmobj->flags |= MF_NOBLOCKMAP;
emblemmobj->frame |= (tr_trans50<<FF_TRANSSHIFT);
P_SetThingPosition(emblemmobj);
}
else
{
emblemmobj->frame &= ~FF_TRANSMASK;
if (emblemlocations[i].type == ET_GLOBAL)
{
emblemmobj->reactiontime = emblemlocations[i].var;
if (emblemlocations[i].var & GE_NIGHTSITEM)
{
emblemmobj->flags |= MF_NIGHTSITEM;
emblemmobj->flags &= ~MF_SPECIAL;
emblemmobj->flags2 |= MF2_DONTDRAW;
}
}
}
}
}
static void P_SpawnSecretItems(boolean loademblems)
{
// Now let's spawn those funky emblem things! Tails 12-08-2002
if (netgame || multiplayer || (modifiedgame && !savemoddata)) // No cheating!!
return;
if (loademblems)
P_SpawnEmblems();
}
// Experimental groovy write function!
void P_WriteThings(lumpnum_t lumpnum)
{
@ -2364,13 +2304,11 @@ void P_LoadThingsOnly(void)
}
else // phew it's just a WAD
P_PrepareThings(lastloadedmaplumpnum + ML_THINGS);
P_LoadThings();
P_LoadThings(true);
// restore skybox viewpoint/centerpoint if necessary, set them to defaults if we can't do that
skyboxmo[0] = skyboxviewpnts[(viewid >= 0) ? viewid : 0];
skyboxmo[1] = skyboxcenterpnts[(centerid >= 0) ? centerid : 0];
P_SpawnSecretItems(true);
}
/** Compute MD5 message digest for bytes read from memory source
@ -2959,12 +2897,10 @@ boolean P_SetupLevel(boolean skipprecip)
P_ResetDynamicSlopes();
#endif
P_LoadThings();
P_LoadThings(loademblems);
skyboxmo[0] = skyboxviewpnts[0];
skyboxmo[1] = skyboxcenterpnts[0];
P_SpawnSecretItems(loademblems);
for (numcoopstarts = 0; numcoopstarts < MAXPLAYERS; numcoopstarts++)
if (!playerstarts[numcoopstarts])
break;