mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
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.
This commit is contained in:
parent
f190e3bd9e
commit
593003b0f7
1 changed files with 82 additions and 0 deletions
82
src/p_spec.c
82
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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue