mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-17 23:21:22 +00:00
Add mobj shadowscale property
This commit is contained in:
parent
1b0a3d0fe3
commit
ba8ff3d502
4 changed files with 20 additions and 13 deletions
|
@ -1869,6 +1869,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
|
||||
S_StartSound(toucher, special->info->deathsound); // was NULL, but changed to player so you could hear others pick up rings
|
||||
P_KillMobj(special, NULL, toucher, 0);
|
||||
special->shadowscale = 0;
|
||||
}
|
||||
|
||||
/** Prints death messages relating to a dying or hit player.
|
||||
|
|
16
src/p_mobj.c
16
src/p_mobj.c
|
@ -10557,6 +10557,22 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
|||
else
|
||||
mobj->z = z;
|
||||
|
||||
// Set shadowscale here, before spawn hook so that Lua can change it
|
||||
if (
|
||||
type == MT_PLAYER ||
|
||||
type == MT_ROLLOUTROCK ||
|
||||
type == MT_EGGMOBILE4_MACE ||
|
||||
(type >= MT_SMALLMACE && type <= MT_REDSPRINGBALL) ||
|
||||
(mobj->flags & MF_ENEMY)
|
||||
)
|
||||
mobj->shadowscale = FRACUNIT;
|
||||
else if (
|
||||
type >= MT_RING && type <= MT_FLINGEMERALD && type != MT_EMERALDSPAWN
|
||||
)
|
||||
mobj->shadowscale = 2*FRACUNIT/3;
|
||||
else
|
||||
mobj->shadowscale = 0;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// DANGER! This can cause P_SpawnMobj to return NULL!
|
||||
// Avoid using P_RemoveMobj on the newly created mobj in "MobjSpawn" Lua hooks!
|
||||
|
|
|
@ -375,6 +375,7 @@ typedef struct mobj_s
|
|||
#endif
|
||||
|
||||
boolean colorized; // Whether the mobj uses the rainbow colormap
|
||||
fixed_t shadowscale; // If this object casts a shadow, and the size relative to radius
|
||||
|
||||
// WARNING: New fields must be added separately to savegame and Lua.
|
||||
} mobj_t;
|
||||
|
|
|
@ -1902,19 +1902,8 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
if (thing->subsector->sector->numlights)
|
||||
R_SplitSprite(vis);
|
||||
|
||||
///@TODO temporary: whitelist. eventually: MF/2/E flag?
|
||||
if ((
|
||||
oldthing->type == MT_PLAYER ||
|
||||
(oldthing->state - states) == S_RING ||
|
||||
oldthing->type == MT_ROLLOUTROCK ||
|
||||
oldthing->flags & MF_ENEMY ||
|
||||
oldthing->type == MT_EGGMOBILE4_MACE ||
|
||||
(oldthing->type >= MT_SMALLMACE && oldthing->type <= MT_REDSPRINGBALL) // .W.
|
||||
) && !papersprite)
|
||||
R_ProjectDropShadow(oldthing, vis,
|
||||
///@TODO make this scale configurable!
|
||||
((oldthing->state - states) == S_RING) ? 2*FRACUNIT/3 : FRACUNIT,
|
||||
basetx, tz);
|
||||
if (oldthing->shadowscale && !papersprite)
|
||||
R_ProjectDropShadow(oldthing, vis, oldthing->shadowscale, basetx, tz);
|
||||
|
||||
// Debug
|
||||
++objectsdrawn;
|
||||
|
|
Loading…
Reference in a new issue