mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-22 01:01:45 +00:00
Turn dispoffset into a mobj field
This commit is contained in:
parent
93512ae9f9
commit
d764d68d02
8 changed files with 25 additions and 5 deletions
|
@ -84,7 +84,7 @@ typedef struct gl_vissprite_s
|
||||||
|
|
||||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||||
UINT8 *colormap;
|
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;
|
patch_t *gpatch;
|
||||||
mobj_t *mobj; // NOTE: This is a precipmobj_t if precip is true !!! Watch out.
|
mobj_t *mobj; // NOTE: This is a precipmobj_t if precip is true !!! Watch out.
|
||||||
|
|
|
@ -5052,7 +5052,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dispoffset = thing->info->dispoffset;
|
dispoffset = thing->dispoffset;
|
||||||
|
|
||||||
this_scale = FIXED_TO_FLOAT(thing->scale);
|
this_scale = FIXED_TO_FLOAT(thing->scale);
|
||||||
spritexscale = FIXED_TO_FLOAT(thing->spritexscale);
|
spritexscale = FIXED_TO_FLOAT(thing->spritexscale);
|
||||||
|
|
|
@ -96,7 +96,8 @@ enum mobj_e {
|
||||||
mobj_standingslope,
|
mobj_standingslope,
|
||||||
mobj_colorized,
|
mobj_colorized,
|
||||||
mobj_mirrored,
|
mobj_mirrored,
|
||||||
mobj_shadowscale
|
mobj_shadowscale,
|
||||||
|
mobj_dispoffset
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const mobj_opt[] = {
|
static const char *const mobj_opt[] = {
|
||||||
|
@ -173,6 +174,7 @@ static const char *const mobj_opt[] = {
|
||||||
"colorized",
|
"colorized",
|
||||||
"mirrored",
|
"mirrored",
|
||||||
"shadowscale",
|
"shadowscale",
|
||||||
|
"dispoffset",
|
||||||
NULL};
|
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])
|
#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:
|
case mobj_shadowscale:
|
||||||
lua_pushfixed(L, mo->shadowscale);
|
lua_pushfixed(L, mo->shadowscale);
|
||||||
break;
|
break;
|
||||||
|
case mobj_dispoffset:
|
||||||
|
lua_pushinteger(L, mo->dispoffset);
|
||||||
|
break;
|
||||||
default: // extra custom variables in Lua memory
|
default: // extra custom variables in Lua memory
|
||||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
||||||
I_Assert(lua_istable(L, -1));
|
I_Assert(lua_istable(L, -1));
|
||||||
|
@ -803,6 +808,9 @@ static int mobj_set(lua_State *L)
|
||||||
case mobj_shadowscale:
|
case mobj_shadowscale:
|
||||||
mo->shadowscale = luaL_checkfixed(L, 3);
|
mo->shadowscale = luaL_checkfixed(L, 3);
|
||||||
break;
|
break;
|
||||||
|
case mobj_dispoffset:
|
||||||
|
mo->dispoffset = luaL_checkinteger(L, 3);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
||||||
I_Assert(lua_istable(L, -1));
|
I_Assert(lua_istable(L, -1));
|
||||||
|
|
|
@ -10499,6 +10499,8 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
||||||
|
|
||||||
mobj->reactiontime = info->reactiontime;
|
mobj->reactiontime = info->reactiontime;
|
||||||
|
|
||||||
|
mobj->dispoffset = info->dispoffset;
|
||||||
|
|
||||||
mobj->lastlook = -1; // stuff moved in P_enemy.P_LookForPlayer
|
mobj->lastlook = -1; // stuff moved in P_enemy.P_LookForPlayer
|
||||||
|
|
||||||
// do not set the state with P_SetMobjState,
|
// do not set the state with P_SetMobjState,
|
||||||
|
|
|
@ -390,6 +390,7 @@ typedef struct mobj_s
|
||||||
boolean colorized; // Whether the mobj uses the rainbow colormap
|
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
|
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
|
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.
|
// WARNING: New fields must be added separately to savegame and Lua.
|
||||||
} mobj_t;
|
} mobj_t;
|
||||||
|
|
|
@ -1486,6 +1486,7 @@ typedef enum
|
||||||
MD2_SPRITEXOFFSET = 1<<20,
|
MD2_SPRITEXOFFSET = 1<<20,
|
||||||
MD2_SPRITEYOFFSET = 1<<21,
|
MD2_SPRITEYOFFSET = 1<<21,
|
||||||
MD2_FLOORSPRITESLOPE = 1<<22,
|
MD2_FLOORSPRITESLOPE = 1<<22,
|
||||||
|
MD2_DISPOFFSET = 1<<23
|
||||||
} mobj_diff2_t;
|
} mobj_diff2_t;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -1720,6 +1721,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
||||||
|| (slope->normal.z != FRACUNIT))
|
|| (slope->normal.z != FRACUNIT))
|
||||||
diff2 |= MD2_FLOORSPRITESLOPE;
|
diff2 |= MD2_FLOORSPRITESLOPE;
|
||||||
}
|
}
|
||||||
|
if (mobj->dispoffset != mobj->info->dispoffset)
|
||||||
|
diff2 |= MD2_DISPOFFSET;
|
||||||
|
|
||||||
if (diff2 != 0)
|
if (diff2 != 0)
|
||||||
diff |= MD_MORE;
|
diff |= MD_MORE;
|
||||||
|
@ -1895,6 +1898,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
||||||
WRITEFIXED(save_p, slope->normal.y);
|
WRITEFIXED(save_p, slope->normal.y);
|
||||||
WRITEFIXED(save_p, slope->normal.z);
|
WRITEFIXED(save_p, slope->normal.z);
|
||||||
}
|
}
|
||||||
|
if (diff2 & MD2_DISPOFFSET)
|
||||||
|
WRITEINT32(save_p, mobj->dispoffset);
|
||||||
|
|
||||||
WRITEUINT32(save_p, mobj->mobjnum);
|
WRITEUINT32(save_p, mobj->mobjnum);
|
||||||
}
|
}
|
||||||
|
@ -2942,6 +2947,10 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker)
|
||||||
slope->normal.y = READFIXED(save_p);
|
slope->normal.y = READFIXED(save_p);
|
||||||
slope->normal.z = 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)
|
if (diff & MD_REDFLAG)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1437,7 +1437,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
fixed_t paperoffset = 0, paperdistance = 0;
|
fixed_t paperoffset = 0, paperdistance = 0;
|
||||||
angle_t centerangle = 0;
|
angle_t centerangle = 0;
|
||||||
|
|
||||||
INT32 dispoffset = thing->info->dispoffset;
|
INT32 dispoffset = thing->dispoffset;
|
||||||
|
|
||||||
//SoM: 3/17/2000
|
//SoM: 3/17/2000
|
||||||
fixed_t gz = 0, gzt = 0;
|
fixed_t gz = 0, gzt = 0;
|
||||||
|
|
|
@ -209,7 +209,7 @@ typedef struct vissprite_s
|
||||||
|
|
||||||
INT16 clipbot[MAXVIDWIDTH], cliptop[MAXVIDWIDTH];
|
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;
|
} vissprite_t;
|
||||||
|
|
||||||
extern UINT32 visspritecount;
|
extern UINT32 visspritecount;
|
||||||
|
|
Loading…
Reference in a new issue