From 593003b0f7a1159f5ca5c82029275979b533927e Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 3 Apr 2020 20:53:00 -0700 Subject: [PATCH] Line special 80, raise tagged things by type to this FOF Thing type is the front texture x offset. Tag here refers to the thing's angle. For example, you have two sectors tagged to one FOF. Put a ring in each sector, give it angle 0. Then give a line in the FOF control sector special 80 front texture x offset 300. Those rings will spawn on the FOF instead of on the sector floor. Also works for object flip and slopes. --- src/p_spec.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/src/p_spec.c b/src/p_spec.c index 425d1c779..0e182fa18 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -5350,6 +5350,72 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f return ffloor; } +static fixed_t +Floor_height (sector_t *s, fixed_t x, fixed_t y) +{ +#ifdef ESLOPE + return s->f_slope ? P_GetZAt(s->f_slope, x, y) : s->floorheight; +#else + (void)x; + (void)y; + return s->floorheight; +#endif +} + +static fixed_t +Ceiling_height (sector_t *s, fixed_t x, fixed_t y) +{ +#ifdef ESLOPE + return s->c_slope ? P_GetZAt(s->c_slope, x, y) : s->ceilingheight; +#else + (void)x; + (void)y; + return s->ceilingheight; +#endif +} + +static void +P_RaiseTaggedThingsToFakeFloor ( + UINT16 type, + INT16 tag, + sector_t *control +){ + sector_t *target; + + mobj_t *mo; + mapthing_t *mthing; + + fixed_t offset; + + size_t i; + + for (i = 0; i < control->numattached; ++i) + { + target = §ors[control->attached[i]]; + + for (mo = target->thinglist; mo; mo = mo->snext) + { + mthing = mo->spawnpoint; + + if ( + mthing->type == type && + mthing->angle == tag + ){ + if (( mo->flags2 & MF2_OBJECTFLIP )) + { + offset = ( mo->ceilingz - mo->info->height ) - mo->z; + mo->z = ( Floor_height(control, mo->x, mo->y) - mo->info->height ) - offset; + } + else + { + offset = mo->z - mo->floorz; + mo->z = Ceiling_height(control, mo->x, mo->y) + offset; + } + } + } + } +} + // // SPECIAL SPAWNING // @@ -6813,6 +6879,22 @@ void P_SpawnSpecials(INT32 fromnetsave) } } + /* some things have to be done after FOF spawn */ + + for (i = 0; i < numlines; ++i) + { + switch (lines[i].special) + { + case 80: // Raise tagged things by type to this FOF + P_RaiseTaggedThingsToFakeFloor( + ( sides[lines[i].sidenum[0]].textureoffset >> FRACBITS ), + lines[i].tag, + lines[i].frontsector + ); + break; + } + } + // Allocate each list for (i = 0; i < numsectors; i++) if(secthinkers[i].thinkers)