Merge branch 'mobj-dispoffset' into 'next'

Turn dispoffset into a mobj field

See merge request STJr/SRB2!1708
This commit is contained in:
sphere 2023-05-25 20:59:43 +00:00
commit ce504d4e8e
8 changed files with 25 additions and 5 deletions

View file

@ -88,7 +88,7 @@ typedef struct gl_vissprite_s
//Hurdler: 25/04/2000: now support colormap in hardware mode
UINT8 *colormap;
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
INT32 dispoffset; // copy of mobj->dispoffset, affects ordering but not drawing
patch_t *gpatch;
mobj_t *mobj; // NOTE: This is a precipmobj_t if precip is true !!! Watch out.

View file

@ -5031,7 +5031,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
return;
}
dispoffset = thing->info->dispoffset;
dispoffset = thing->dispoffset;
if (R_UsingFrameInterpolation() && !paused)

View file

@ -96,7 +96,8 @@ enum mobj_e {
mobj_standingslope,
mobj_colorized,
mobj_mirrored,
mobj_shadowscale
mobj_shadowscale,
mobj_dispoffset
};
static const char *const mobj_opt[] = {
@ -173,6 +174,7 @@ static const char *const mobj_opt[] = {
"colorized",
"mirrored",
"shadowscale",
"dispoffset",
NULL};
#define UNIMPLEMENTED luaL_error(L, LUA_QL("mobj_t") " field " LUA_QS " is not implemented for Lua and cannot be accessed.", mobj_opt[field])
@ -439,6 +441,9 @@ static int mobj_get(lua_State *L)
case mobj_shadowscale:
lua_pushfixed(L, mo->shadowscale);
break;
case mobj_dispoffset:
lua_pushinteger(L, mo->dispoffset);
break;
default: // extra custom variables in Lua memory
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
I_Assert(lua_istable(L, -1));
@ -804,6 +809,9 @@ static int mobj_set(lua_State *L)
case mobj_shadowscale:
mo->shadowscale = luaL_checkfixed(L, 3);
break;
case mobj_dispoffset:
mo->dispoffset = luaL_checkinteger(L, 3);
break;
default:
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
I_Assert(lua_istable(L, -1));

View file

@ -10622,6 +10622,8 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
mobj->reactiontime = info->reactiontime;
mobj->dispoffset = info->dispoffset;
mobj->lastlook = -1; // stuff moved in P_enemy.P_LookForPlayer
// do not set the state with P_SetMobjState,

View file

@ -399,6 +399,7 @@ typedef struct mobj_s
boolean colorized; // Whether the mobj uses the rainbow colormap
boolean mirrored; // The object's rotations will be mirrored left to right, e.g., see frame AL from the right and AR from the left
fixed_t shadowscale; // If this object casts a shadow, and the size relative to radius
INT32 dispoffset; // copy of info->dispoffset, so mobjs can be sorted independently of their type
// WARNING: New fields must be added separately to savegame and Lua.
} mobj_t;

View file

@ -1571,6 +1571,7 @@ typedef enum
MD2_SPRITEXOFFSET = 1<<20,
MD2_SPRITEYOFFSET = 1<<21,
MD2_FLOORSPRITESLOPE = 1<<22,
MD2_DISPOFFSET = 1<<23
} mobj_diff2_t;
typedef enum
@ -1805,6 +1806,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|| (slope->normal.z != FRACUNIT))
diff2 |= MD2_FLOORSPRITESLOPE;
}
if (mobj->dispoffset != mobj->info->dispoffset)
diff2 |= MD2_DISPOFFSET;
if (diff2 != 0)
diff |= MD_MORE;
@ -1980,6 +1983,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
WRITEFIXED(save_p, slope->normal.y);
WRITEFIXED(save_p, slope->normal.z);
}
if (diff2 & MD2_DISPOFFSET)
WRITEINT32(save_p, mobj->dispoffset);
WRITEUINT32(save_p, mobj->mobjnum);
}
@ -3034,6 +3039,10 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker)
slope->normal.y = READFIXED(save_p);
slope->normal.z = READFIXED(save_p);
}
if (diff2 & MD2_DISPOFFSET)
mobj->dispoffset = READINT32(save_p);
else
mobj->dispoffset = mobj->info->dispoffset;
if (diff & MD_REDFLAG)
{

View file

@ -1477,7 +1477,7 @@ static void R_ProjectSprite(mobj_t *thing)
fixed_t paperoffset = 0, paperdistance = 0;
angle_t centerangle = 0;
INT32 dispoffset = thing->info->dispoffset;
INT32 dispoffset = thing->dispoffset;
//SoM: 3/17/2000
fixed_t gz = 0, gzt = 0;

View file

@ -212,7 +212,7 @@ typedef struct vissprite_s
INT16 clipbot[MAXVIDWIDTH], cliptop[MAXVIDWIDTH];
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
INT32 dispoffset; // copy of mobj->dispoffset, affects ordering but not drawing
} vissprite_t;
extern UINT32 visspritecount;