mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Add mapthing scale support; fields scale, scalex and scaley set the only mapthing scale field alike.
This commit is contained in:
parent
197d4e405d
commit
7cf08e1a08
3 changed files with 15 additions and 8 deletions
|
@ -203,6 +203,7 @@ typedef struct
|
||||||
UINT16 options;
|
UINT16 options;
|
||||||
INT16 z;
|
INT16 z;
|
||||||
UINT8 extrainfo;
|
UINT8 extrainfo;
|
||||||
|
INT32 scale;
|
||||||
INT16 tag;
|
INT16 tag;
|
||||||
struct mobj_s *mobj;
|
struct mobj_s *mobj;
|
||||||
} mapthing_t;
|
} mapthing_t;
|
||||||
|
|
17
src/p_mobj.c
17
src/p_mobj.c
|
@ -11616,7 +11616,7 @@ void P_MovePlayerToStarpost(INT32 playernum)
|
||||||
mapthing_t *huntemeralds[MAXHUNTEMERALDS];
|
mapthing_t *huntemeralds[MAXHUNTEMERALDS];
|
||||||
INT32 numhuntemeralds;
|
INT32 numhuntemeralds;
|
||||||
|
|
||||||
static fixed_t P_GetMobjSpawnHeight(const mobjtype_t mobjtype, const fixed_t x, const fixed_t y, const fixed_t offset, const boolean flip)
|
static fixed_t P_GetMobjSpawnHeight(const mobjtype_t mobjtype, const fixed_t x, const fixed_t y, const fixed_t offset, const boolean flip, const fixed_t scale)
|
||||||
{
|
{
|
||||||
const subsector_t *ss = R_PointInSubsector(x, y);
|
const subsector_t *ss = R_PointInSubsector(x, y);
|
||||||
|
|
||||||
|
@ -11627,10 +11627,10 @@ static fixed_t P_GetMobjSpawnHeight(const mobjtype_t mobjtype, const fixed_t x,
|
||||||
// Establish height.
|
// Establish height.
|
||||||
if (flip)
|
if (flip)
|
||||||
return (ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) : ss->sector->ceilingheight)
|
return (ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) : ss->sector->ceilingheight)
|
||||||
- offset - mobjinfo[mobjtype].height;
|
- FixedMul(scale, offset + mobjinfo[mobjtype].height);
|
||||||
else
|
else
|
||||||
return (ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) : ss->sector->floorheight)
|
return (ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) : ss->sector->floorheight)
|
||||||
+ offset;
|
+ FixedMul(scale, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
static fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mthing, const fixed_t x, const fixed_t y)
|
static fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mthing, const fixed_t x, const fixed_t y)
|
||||||
|
@ -11701,7 +11701,7 @@ static fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthin
|
||||||
return ONFLOORZ;
|
return ONFLOORZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return P_GetMobjSpawnHeight(mobjtype, x, y, offset, flip);
|
return P_GetMobjSpawnHeight(mobjtype, x, y, offset, flip, mthing->scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean P_SpawnNonMobjMapThing(mapthing_t *mthing)
|
static boolean P_SpawnNonMobjMapThing(mapthing_t *mthing)
|
||||||
|
@ -13083,6 +13083,9 @@ static mobj_t *P_SpawnMobjFromMapThing(mapthing_t *mthing, fixed_t x, fixed_t y,
|
||||||
if (doangle)
|
if (doangle)
|
||||||
mobj->angle = FixedAngle(mthing->angle << FRACBITS);
|
mobj->angle = FixedAngle(mthing->angle << FRACBITS);
|
||||||
|
|
||||||
|
P_SetScale(mobj, mthing->scale);
|
||||||
|
mobj->destscale = mthing->scale;
|
||||||
|
|
||||||
mthing->mobj = mobj;
|
mthing->mobj = mobj;
|
||||||
|
|
||||||
// ignore MTF_ flags and return early
|
// ignore MTF_ flags and return early
|
||||||
|
@ -13179,7 +13182,7 @@ static void P_SpawnHoopInternal(mapthing_t *mthing, INT32 hoopsize, fixed_t size
|
||||||
TVector v, *res;
|
TVector v, *res;
|
||||||
fixed_t x = mthing->x << FRACBITS;
|
fixed_t x = mthing->x << FRACBITS;
|
||||||
fixed_t y = mthing->y << FRACBITS;
|
fixed_t y = mthing->y << FRACBITS;
|
||||||
fixed_t z = P_GetMobjSpawnHeight(MT_HOOP, x, y, mthing->z << FRACBITS, false);
|
fixed_t z = P_GetMobjSpawnHeight(MT_HOOP, x, y, mthing->z << FRACBITS, false, mthing->scale);
|
||||||
|
|
||||||
hoopcenter = P_SpawnMobj(x, y, z, MT_HOOPCENTER);
|
hoopcenter = P_SpawnMobj(x, y, z, MT_HOOPCENTER);
|
||||||
hoopcenter->spawnpoint = mthing;
|
hoopcenter->spawnpoint = mthing;
|
||||||
|
@ -13324,7 +13327,7 @@ static void P_SpawnItemRow(mapthing_t *mthing, mobjtype_t* itemtypes, UINT8 numi
|
||||||
itemtypes[r] = P_GetMobjtypeSubstitute(&dummything, itemtypes[r]);
|
itemtypes[r] = P_GetMobjtypeSubstitute(&dummything, itemtypes[r]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
z = P_GetMobjSpawnHeight(itemtypes[0], x, y, z, mthing->options & MTF_OBJECTFLIP);
|
z = P_GetMobjSpawnHeight(itemtypes[0], x, y, z, mthing->options & MTF_OBJECTFLIP, mthing->scale);
|
||||||
|
|
||||||
for (r = 0; r < numitems; r++)
|
for (r = 0; r < numitems; r++)
|
||||||
{
|
{
|
||||||
|
@ -13382,7 +13385,7 @@ static void P_SpawnItemCircle(mapthing_t *mthing, mobjtype_t *itemtypes, UINT8 n
|
||||||
itemtypes[i] = P_GetMobjtypeSubstitute(&dummything, itemtypes[i]);
|
itemtypes[i] = P_GetMobjtypeSubstitute(&dummything, itemtypes[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
z = P_GetMobjSpawnHeight(itemtypes[0], x, y, z, false);
|
z = P_GetMobjSpawnHeight(itemtypes[0], x, y, z, false, mthing->scale);
|
||||||
|
|
||||||
for (i = 0; i < numitems; i++)
|
for (i = 0; i < numitems; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1281,6 +1281,7 @@ static void P_LoadThings(UINT8 *data)
|
||||||
mt->type = READUINT16(data);
|
mt->type = READUINT16(data);
|
||||||
mt->options = READUINT16(data);
|
mt->options = READUINT16(data);
|
||||||
mt->extrainfo = (UINT8)(mt->type >> 12);
|
mt->extrainfo = (UINT8)(mt->type >> 12);
|
||||||
|
mt->scale = FRACUNIT;
|
||||||
mt->tag = 0;
|
mt->tag = 0;
|
||||||
|
|
||||||
mt->type &= 4095;
|
mt->type &= 4095;
|
||||||
|
@ -1570,7 +1571,8 @@ static void ParseTextmapThingParameter(UINT32 i, char *param, char *val)
|
||||||
mapthings[i].angle = atol(val);
|
mapthings[i].angle = atol(val);
|
||||||
else if (fastcmp(param, "type"))
|
else if (fastcmp(param, "type"))
|
||||||
mapthings[i].type = atol(val);
|
mapthings[i].type = atol(val);
|
||||||
|
else if (fastcmp(param, "scale") || fastcmp(param, "scalex") || fastcmp(param, "scaley"))
|
||||||
|
mapthings[i].scale = FLOAT_TO_FIXED(atof(val));
|
||||||
// Flags
|
// Flags
|
||||||
else if (fastcmp(param, "extra") && fastcmp("true", val))
|
else if (fastcmp(param, "extra") && fastcmp("true", val))
|
||||||
mapthings[i].options |= MTF_EXTRA;
|
mapthings[i].options |= MTF_EXTRA;
|
||||||
|
@ -1777,6 +1779,7 @@ static void P_LoadTextmap(void)
|
||||||
mt->options = 0;
|
mt->options = 0;
|
||||||
mt->z = 0;
|
mt->z = 0;
|
||||||
mt->extrainfo = 0;
|
mt->extrainfo = 0;
|
||||||
|
mt->scale = FRACUNIT;
|
||||||
mt->tag = 0;
|
mt->tag = 0;
|
||||||
mt->mobj = NULL;
|
mt->mobj = NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue