mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-20 19:02:34 +00:00
Merge branch 'udmf-next' into udmf-multitag
# Conflicts: # src/doomdata.h # src/p_setup.c
This commit is contained in:
commit
de3ad9bc43
6 changed files with 63 additions and 12 deletions
|
@ -24,6 +24,7 @@
|
|||
#include "doomdef.h"
|
||||
|
||||
#include "taglist.h"
|
||||
#include "m_fixed.h" // See the mapthing_t scale.
|
||||
|
||||
//
|
||||
// Map level types.
|
||||
|
@ -200,12 +201,13 @@ typedef struct
|
|||
typedef struct
|
||||
{
|
||||
INT16 x, y;
|
||||
INT16 angle;
|
||||
INT16 angle, pitch, roll;
|
||||
UINT16 type;
|
||||
UINT16 options;
|
||||
INT16 z;
|
||||
UINT8 extrainfo;
|
||||
taglist_t tags;
|
||||
fixed_t scale;
|
||||
struct mobj_s *mobj;
|
||||
} mapthing_t;
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@ enum mobj_e {
|
|||
mobj_snext,
|
||||
mobj_sprev,
|
||||
mobj_angle,
|
||||
mobj_pitch,
|
||||
mobj_roll,
|
||||
mobj_rollangle,
|
||||
mobj_sprite,
|
||||
mobj_frame,
|
||||
|
@ -97,6 +99,8 @@ static const char *const mobj_opt[] = {
|
|||
"snext",
|
||||
"sprev",
|
||||
"angle",
|
||||
"pitch",
|
||||
"roll",
|
||||
"rollangle",
|
||||
"sprite",
|
||||
"frame",
|
||||
|
@ -198,6 +202,12 @@ static int mobj_get(lua_State *L)
|
|||
case mobj_angle:
|
||||
lua_pushangle(L, mo->angle);
|
||||
break;
|
||||
case mobj_pitch:
|
||||
lua_pushangle(L, mo->pitch);
|
||||
break;
|
||||
case mobj_roll:
|
||||
lua_pushangle(L, mo->roll);
|
||||
break;
|
||||
case mobj_rollangle:
|
||||
lua_pushangle(L, mo->rollangle);
|
||||
break;
|
||||
|
@ -453,6 +463,11 @@ static int mobj_set(lua_State *L)
|
|||
localangle = mo->angle;
|
||||
else if (mo->player == &players[secondarydisplayplayer])
|
||||
localangle2 = mo->angle;
|
||||
case mobj_pitch:
|
||||
mo->pitch = luaL_checkangle(L, 3);
|
||||
break;
|
||||
case mobj_roll:
|
||||
mo->roll = luaL_checkangle(L, 3);
|
||||
break;
|
||||
case mobj_rollangle:
|
||||
mo->rollangle = luaL_checkangle(L, 3);
|
||||
|
@ -771,10 +786,16 @@ static int mapthing_get(lua_State *L)
|
|||
number = mt->y;
|
||||
else if(fastcmp(field,"angle"))
|
||||
number = mt->angle;
|
||||
else if(fastcmp(field,"pitch"))
|
||||
number = mt->pitch;
|
||||
else if(fastcmp(field,"roll"))
|
||||
number = mt->roll;
|
||||
else if(fastcmp(field,"type"))
|
||||
number = mt->type;
|
||||
else if(fastcmp(field,"options"))
|
||||
number = mt->options;
|
||||
else if(fastcmp(field,"scale"))
|
||||
number = mt->scale;
|
||||
else if(fastcmp(field,"z"))
|
||||
number = mt->z;
|
||||
else if(fastcmp(field,"extrainfo"))
|
||||
|
@ -810,10 +831,16 @@ static int mapthing_set(lua_State *L)
|
|||
mt->y = (INT16)luaL_checkinteger(L, 3);
|
||||
else if(fastcmp(field,"angle"))
|
||||
mt->angle = (INT16)luaL_checkinteger(L, 3);
|
||||
else if(fastcmp(field,"pitch"))
|
||||
mt->pitch = (INT16)luaL_checkinteger(L, 3);
|
||||
else if(fastcmp(field,"roll"))
|
||||
mt->roll = (INT16)luaL_checkinteger(L, 3);
|
||||
else if(fastcmp(field,"type"))
|
||||
mt->type = (UINT16)luaL_checkinteger(L, 3);
|
||||
else if(fastcmp(field,"options"))
|
||||
mt->options = (UINT16)luaL_checkinteger(L, 3);
|
||||
else if(fastcmp(field,"scale"))
|
||||
mt->scale = luaL_checkfixed(L, 3);
|
||||
else if(fastcmp(field,"z"))
|
||||
mt->z = (INT16)luaL_checkinteger(L, 3);
|
||||
else if(fastcmp(field,"extrainfo"))
|
||||
|
|
20
src/p_mobj.c
20
src/p_mobj.c
|
@ -11618,7 +11618,7 @@ void P_MovePlayerToStarpost(INT32 playernum)
|
|||
mapthing_t *huntemeralds[MAXHUNTEMERALDS];
|
||||
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);
|
||||
|
||||
|
@ -11629,10 +11629,10 @@ static fixed_t P_GetMobjSpawnHeight(const mobjtype_t mobjtype, const fixed_t x,
|
|||
// Establish height.
|
||||
if (flip)
|
||||
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
|
||||
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)
|
||||
|
@ -11703,7 +11703,7 @@ static fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthin
|
|||
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)
|
||||
|
@ -13081,12 +13081,18 @@ static mobj_t *P_SpawnMobjFromMapThing(mapthing_t *mthing, fixed_t x, fixed_t y,
|
|||
mobj = P_SpawnMobj(x, y, z, i);
|
||||
mobj->spawnpoint = mthing;
|
||||
|
||||
P_SetScale(mobj, mthing->scale);
|
||||
mobj->destscale = mthing->scale;
|
||||
|
||||
if (!P_SetupSpawnedMapThing(mthing, mobj, &doangle))
|
||||
return mobj;
|
||||
|
||||
if (doangle)
|
||||
mobj->angle = FixedAngle(mthing->angle << FRACBITS);
|
||||
|
||||
mobj->pitch = FixedAngle(mthing->pitch << FRACBITS);
|
||||
mobj->roll = FixedAngle(mthing->roll << FRACBITS);
|
||||
|
||||
mthing->mobj = mobj;
|
||||
|
||||
// ignore MTF_ flags and return early
|
||||
|
@ -13183,7 +13189,7 @@ static void P_SpawnHoopInternal(mapthing_t *mthing, INT32 hoopsize, fixed_t size
|
|||
TVector v, *res;
|
||||
fixed_t x = mthing->x << 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->spawnpoint = mthing;
|
||||
|
@ -13328,7 +13334,7 @@ static void P_SpawnItemRow(mapthing_t *mthing, mobjtype_t* itemtypes, UINT8 numi
|
|||
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++)
|
||||
{
|
||||
|
@ -13386,7 +13392,7 @@ static void P_SpawnItemCircle(mapthing_t *mthing, mobjtype_t *itemtypes, UINT8 n
|
|||
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++)
|
||||
{
|
||||
|
|
|
@ -278,7 +278,7 @@ typedef struct mobj_s
|
|||
struct mobj_s **sprev; // killough 8/11/98: change to ptr-to-ptr
|
||||
|
||||
// More drawing info: to determine current sprite.
|
||||
angle_t angle; // orientation
|
||||
angle_t angle, pitch, roll; // orientation
|
||||
angle_t rollangle;
|
||||
spritenum_t sprite; // used to find patch_t and flip value
|
||||
UINT32 frame; // frame number, plus bits see p_pspr.h
|
||||
|
@ -398,7 +398,7 @@ typedef struct precipmobj_s
|
|||
struct precipmobj_s **sprev; // killough 8/11/98: change to ptr-to-ptr
|
||||
|
||||
// More drawing info: to determine current sprite.
|
||||
angle_t angle; // orientation
|
||||
angle_t angle, pitch, roll; // orientation
|
||||
angle_t rollangle;
|
||||
spritenum_t sprite; // used to find patch_t and flip value
|
||||
UINT32 frame; // frame number, plus bits see p_pspr.h
|
||||
|
|
|
@ -1463,7 +1463,9 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
|||
|
||||
if ((mobj->x != mobj->spawnpoint->x << FRACBITS) ||
|
||||
(mobj->y != mobj->spawnpoint->y << FRACBITS) ||
|
||||
(mobj->angle != FixedAngle(mobj->spawnpoint->angle*FRACUNIT)))
|
||||
(mobj->angle != FixedAngle(mobj->spawnpoint->angle*FRACUNIT)) ||
|
||||
(mobj->pitch != FixedAngle(mobj->spawnpoint->pitch*FRACUNIT)) ||
|
||||
(mobj->roll != FixedAngle(mobj->spawnpoint->roll*FRACUNIT)) )
|
||||
diff |= MD_POS;
|
||||
|
||||
if (mobj->info->doomednum != mobj->spawnpoint->type)
|
||||
|
@ -1645,6 +1647,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
|||
WRITEFIXED(save_p, mobj->x);
|
||||
WRITEFIXED(save_p, mobj->y);
|
||||
WRITEANGLE(save_p, mobj->angle);
|
||||
WRITEANGLE(save_p, mobj->pitch);
|
||||
WRITEANGLE(save_p, mobj->roll);
|
||||
}
|
||||
if (diff & MD_MOM)
|
||||
{
|
||||
|
@ -2661,12 +2665,16 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker)
|
|||
mobj->x = READFIXED(save_p);
|
||||
mobj->y = READFIXED(save_p);
|
||||
mobj->angle = READANGLE(save_p);
|
||||
mobj->pitch = READANGLE(save_p);
|
||||
mobj->roll = READANGLE(save_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
mobj->x = mobj->spawnpoint->x << FRACBITS;
|
||||
mobj->y = mobj->spawnpoint->y << FRACBITS;
|
||||
mobj->angle = FixedAngle(mobj->spawnpoint->angle*FRACUNIT);
|
||||
mobj->pitch = FixedAngle(mobj->spawnpoint->pitch*FRACUNIT);
|
||||
mobj->roll = FixedAngle(mobj->spawnpoint->roll*FRACUNIT);
|
||||
}
|
||||
if (diff & MD_MOM)
|
||||
{
|
||||
|
|
|
@ -1281,6 +1281,8 @@ static void P_LoadThings(UINT8 *data)
|
|||
mt->options = READUINT16(data);
|
||||
mt->extrainfo = (UINT8)(mt->type >> 12);
|
||||
Tag_FSet(&mt->tags, 0);
|
||||
mt->scale = FRACUNIT;
|
||||
mt->pitch = mt->roll = 0;
|
||||
|
||||
mt->type &= 4095;
|
||||
|
||||
|
@ -1597,9 +1599,14 @@ static void ParseTextmapThingParameter(UINT32 i, char *param, char *val)
|
|||
mapthings[i].z = atol(val);
|
||||
else if (fastcmp(param, "angle"))
|
||||
mapthings[i].angle = atol(val);
|
||||
else if (fastcmp(param, "pitch"))
|
||||
mapthings[i].pitch = atol(val);
|
||||
else if (fastcmp(param, "roll"))
|
||||
mapthings[i].roll = atol(val);
|
||||
else if (fastcmp(param, "type"))
|
||||
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
|
||||
else if (fastcmp(param, "extra") && fastcmp("true", val))
|
||||
mapthings[i].options |= MTF_EXTRA;
|
||||
|
@ -1809,6 +1816,7 @@ static void P_LoadTextmap(void)
|
|||
mt->z = 0;
|
||||
mt->extrainfo = 0;
|
||||
Tag_FSet(&mt->tags, 0);
|
||||
mt->scale = FRACUNIT;
|
||||
mt->mobj = NULL;
|
||||
|
||||
TextmapParse(mapthingsPos[i], i, ParseTextmapThingParameter);
|
||||
|
|
Loading…
Reference in a new issue