mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-05 15:43:08 +00:00
p_saveg.c: initialize "special" fields of mobj, if spawned from mapthing, in default state
This commit is contained in:
parent
ca1bbfd53f
commit
39486a56d6
3 changed files with 26 additions and 15 deletions
36
src/p_mobj.c
36
src/p_mobj.c
|
|
@ -14538,24 +14538,10 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
|
|||
return true;
|
||||
}
|
||||
|
||||
static mobj_t *P_SpawnMobjFromMapThing(mapthing_t *mthing, fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
||||
void P_CopyMapThingSpecialFieldsToMobj(const mapthing_t *mthing, mobj_t *mobj)
|
||||
{
|
||||
mobj_t *mobj = NULL;
|
||||
size_t arg = SIZE_MAX;
|
||||
|
||||
mobj = P_SpawnMobj(x, y, z, type);
|
||||
mobj->spawnpoint = mthing;
|
||||
|
||||
mobj->angle = FixedAngle(mthing->angle << FRACBITS);
|
||||
mobj->pitch = FixedAngle(mthing->pitch << FRACBITS);
|
||||
mobj->roll = FixedAngle(mthing->roll << FRACBITS);
|
||||
|
||||
P_SetScale(mobj, FixedMul(mobj->scale, mthing->scale));
|
||||
mobj->destscale = FixedMul(mobj->destscale, mthing->scale);
|
||||
|
||||
mobj->spritexscale = mthing->spritexscale;
|
||||
mobj->spriteyscale = mthing->spriteyscale;
|
||||
|
||||
P_SetThingTID(mobj, mthing->tid);
|
||||
|
||||
mobj->special = mthing->special;
|
||||
|
|
@ -14609,6 +14595,26 @@ static mobj_t *P_SpawnMobjFromMapThing(mapthing_t *mthing, fixed_t x, fixed_t y,
|
|||
mobj->script_stringargs[arg] = Z_Realloc(mobj->script_stringargs[arg], len + 1, PU_LEVEL, NULL);
|
||||
M_Memcpy(mobj->script_stringargs[arg], mthing->script_stringargs[arg], len + 1);
|
||||
}
|
||||
}
|
||||
|
||||
static mobj_t *P_SpawnMobjFromMapThing(mapthing_t *mthing, fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
||||
{
|
||||
mobj_t *mobj = NULL;
|
||||
|
||||
mobj = P_SpawnMobj(x, y, z, type);
|
||||
mobj->spawnpoint = mthing;
|
||||
|
||||
mobj->angle = FixedAngle(mthing->angle << FRACBITS);
|
||||
mobj->pitch = FixedAngle(mthing->pitch << FRACBITS);
|
||||
mobj->roll = FixedAngle(mthing->roll << FRACBITS);
|
||||
|
||||
P_SetScale(mobj, FixedMul(mobj->scale, mthing->scale));
|
||||
mobj->destscale = FixedMul(mobj->destscale, mthing->scale);
|
||||
|
||||
mobj->spritexscale = mthing->spritexscale;
|
||||
mobj->spriteyscale = mthing->spriteyscale;
|
||||
|
||||
P_CopyMapThingSpecialFieldsToMobj(mthing, mobj);
|
||||
|
||||
if (!P_SetupSpawnedMapThing(mthing, mobj))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -557,6 +557,7 @@ fixed_t P_GetMobjSpawnHeight(const mobjtype_t mobjtype, const fixed_t x, const f
|
|||
fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mthing, const fixed_t x, const fixed_t y);
|
||||
|
||||
mobj_t *P_SpawnMapThing(mapthing_t *mthing);
|
||||
void P_CopyMapThingSpecialFieldsToMobj(const mapthing_t *mthing, mobj_t *mobj);
|
||||
void P_SpawnHoop(mapthing_t *mthing);
|
||||
void P_SpawnItemPattern(mapthing_t *mthing);
|
||||
void P_SpawnItemLine(mapthing_t *mt1, mapthing_t *mt2);
|
||||
|
|
|
|||
|
|
@ -4538,6 +4538,10 @@ static thinker_t* LoadMobjThinker(savebuffer_t *save, actionf_p1 thinker)
|
|||
mobj->script_stringargs[j][len] = '\0';
|
||||
}
|
||||
}
|
||||
else if (mobj->spawnpoint)
|
||||
{
|
||||
P_CopyMapThingSpecialFieldsToMobj(mobj->spawnpoint, mobj);
|
||||
}
|
||||
if (diff2 & MD2_FLOORSPRITESLOPE)
|
||||
{
|
||||
pslope_t *slope = (pslope_t *)P_CreateFloorSpriteSlope(mobj);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue