mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 21:01:04 +00:00
Spawned things spawn relative to slope floor/ceiling heights now
This was a headache. :<
This commit is contained in:
parent
36d576adf4
commit
6fcdac494f
4 changed files with 131 additions and 38 deletions
108
src/p_mobj.c
108
src/p_mobj.c
|
@ -7306,8 +7306,16 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
||||||
// Make sure scale matches destscale immediately when spawned
|
// Make sure scale matches destscale immediately when spawned
|
||||||
P_SetScale(mobj, mobj->destscale);
|
P_SetScale(mobj, mobj->destscale);
|
||||||
|
|
||||||
mobj->floorz = mobj->subsector->sector->floorheight;
|
mobj->floorz =
|
||||||
mobj->ceilingz = mobj->subsector->sector->ceilingheight;
|
#ifdef ESLOPE
|
||||||
|
mobj->subsector->sector->f_slope ? P_GetZAt(mobj->subsector->sector->f_slope, x, y) :
|
||||||
|
#endif
|
||||||
|
mobj->subsector->sector->floorheight;
|
||||||
|
mobj->ceilingz =
|
||||||
|
#ifdef ESLOPE
|
||||||
|
mobj->subsector->sector->c_slope ? P_GetZAt(mobj->subsector->sector->c_slope, x, y) :
|
||||||
|
#endif
|
||||||
|
mobj->subsector->sector->ceilingheight;
|
||||||
|
|
||||||
// Tells MobjCheckWater that the water height was not set.
|
// Tells MobjCheckWater that the water height was not set.
|
||||||
mobj->watertop = INT32_MAX;
|
mobj->watertop = INT32_MAX;
|
||||||
|
@ -8364,7 +8372,11 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ss = R_PointInSubsector(mthing->x << FRACBITS, mthing->y << FRACBITS);
|
ss = R_PointInSubsector(mthing->x << FRACBITS, mthing->y << FRACBITS);
|
||||||
mthing->z = (INT16)((ss->sector->floorheight>>FRACBITS) + (mthing->options >> ZSHIFT));
|
mthing->z = (INT16)(((
|
||||||
|
#ifdef ESLOPE
|
||||||
|
ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, mthing->x << FRACBITS, mthing->y << FRACBITS) :
|
||||||
|
#endif
|
||||||
|
ss->sector->floorheight)>>FRACBITS) + (mthing->options >> ZSHIFT));
|
||||||
|
|
||||||
if (numhuntemeralds < MAXHUNTEMERALDS)
|
if (numhuntemeralds < MAXHUNTEMERALDS)
|
||||||
huntemeralds[numhuntemeralds++] = mthing;
|
huntemeralds[numhuntemeralds++] = mthing;
|
||||||
|
@ -8482,14 +8494,22 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||||
ss = R_PointInSubsector(x, y);
|
ss = R_PointInSubsector(x, y);
|
||||||
|
|
||||||
if (i == MT_NIGHTSBUMPER)
|
if (i == MT_NIGHTSBUMPER)
|
||||||
z = ss->sector->floorheight + ((mthing->options >> ZSHIFT) << FRACBITS);
|
z = (
|
||||||
|
#ifdef ESLOPE
|
||||||
|
ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) :
|
||||||
|
#endif
|
||||||
|
ss->sector->floorheight) + ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||||
else if (i == MT_AXIS || i == MT_AXISTRANSFER || i == MT_AXISTRANSFERLINE)
|
else if (i == MT_AXIS || i == MT_AXISTRANSFER || i == MT_AXISTRANSFERLINE)
|
||||||
z = ONFLOORZ;
|
z = ONFLOORZ;
|
||||||
else if (i == MT_SPECIALSPIKEBALL || P_WeaponOrPanel(i) || i == MT_EMERALDSPAWN || i == MT_EMMY)
|
else if (i == MT_SPECIALSPIKEBALL || P_WeaponOrPanel(i) || i == MT_EMERALDSPAWN || i == MT_EMMY)
|
||||||
{
|
{
|
||||||
if (mthing->options & MTF_OBJECTFLIP)
|
if (mthing->options & MTF_OBJECTFLIP)
|
||||||
{
|
{
|
||||||
z = ss->sector->ceilingheight;
|
z = (
|
||||||
|
#ifdef ESLOPE
|
||||||
|
ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) :
|
||||||
|
#endif
|
||||||
|
ss->sector->ceilingheight);
|
||||||
|
|
||||||
if (mthing->options & MTF_AMBUSH) // Special flag for rings
|
if (mthing->options & MTF_AMBUSH) // Special flag for rings
|
||||||
z -= 24*FRACUNIT;
|
z -= 24*FRACUNIT;
|
||||||
|
@ -8500,7 +8520,11 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
z = ss->sector->floorheight;
|
z = (
|
||||||
|
#ifdef ESLOPE
|
||||||
|
ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) :
|
||||||
|
#endif
|
||||||
|
ss->sector->floorheight);
|
||||||
|
|
||||||
if (mthing->options & MTF_AMBUSH) // Special flag for rings
|
if (mthing->options & MTF_AMBUSH) // Special flag for rings
|
||||||
z += 24*FRACUNIT;
|
z += 24*FRACUNIT;
|
||||||
|
@ -8520,9 +8544,17 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||||
|
|
||||||
// base positions
|
// base positions
|
||||||
if (flip)
|
if (flip)
|
||||||
z = ss->sector->ceilingheight - mobjinfo[i].height;
|
z = (
|
||||||
|
#ifdef ESLOPE
|
||||||
|
ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) :
|
||||||
|
#endif
|
||||||
|
ss->sector->ceilingheight) - mobjinfo[i].height;
|
||||||
else
|
else
|
||||||
z = ss->sector->floorheight;
|
z = (
|
||||||
|
#ifdef ESLOPE
|
||||||
|
ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) :
|
||||||
|
#endif
|
||||||
|
ss->sector->floorheight);
|
||||||
|
|
||||||
// offsetting
|
// offsetting
|
||||||
if (mthing->options >> ZSHIFT)
|
if (mthing->options >> ZSHIFT)
|
||||||
|
@ -9036,7 +9068,11 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
||||||
// Screw these damn hoops, I need this thinker.
|
// Screw these damn hoops, I need this thinker.
|
||||||
//hoopcenter->flags |= MF_NOTHINK;
|
//hoopcenter->flags |= MF_NOTHINK;
|
||||||
|
|
||||||
z += sec->floorheight;
|
z +=
|
||||||
|
#ifdef ESLOPE
|
||||||
|
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
|
||||||
|
#endif
|
||||||
|
sec->floorheight;
|
||||||
|
|
||||||
hoopcenter->z = z - hoopcenter->height/2;
|
hoopcenter->z = z - hoopcenter->height/2;
|
||||||
|
|
||||||
|
@ -9169,7 +9205,11 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
||||||
hoopcenter = P_SpawnMobj(x, y, z, MT_HOOPCENTER);
|
hoopcenter = P_SpawnMobj(x, y, z, MT_HOOPCENTER);
|
||||||
hoopcenter->spawnpoint = mthing;
|
hoopcenter->spawnpoint = mthing;
|
||||||
|
|
||||||
z += sec->floorheight;
|
z +=
|
||||||
|
#ifdef ESLOPE
|
||||||
|
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
|
||||||
|
#endif
|
||||||
|
sec->floorheight;
|
||||||
hoopcenter->z = z - hoopcenter->height/2;
|
hoopcenter->z = z - hoopcenter->height/2;
|
||||||
|
|
||||||
P_UnsetThingPosition(hoopcenter);
|
P_UnsetThingPosition(hoopcenter);
|
||||||
|
@ -9281,7 +9321,11 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
||||||
// Wing logo item.
|
// Wing logo item.
|
||||||
else if (mthing->type == mobjinfo[MT_NIGHTSWING].doomednum)
|
else if (mthing->type == mobjinfo[MT_NIGHTSWING].doomednum)
|
||||||
{
|
{
|
||||||
z = sec->floorheight;
|
z =
|
||||||
|
#ifdef ESLOPE
|
||||||
|
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
|
||||||
|
#endif
|
||||||
|
sec->floorheight;
|
||||||
if (mthing->options >> ZSHIFT)
|
if (mthing->options >> ZSHIFT)
|
||||||
z += ((mthing->options >> ZSHIFT) << FRACBITS);
|
z += ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||||
|
|
||||||
|
@ -9333,13 +9377,21 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
||||||
// Set proper height
|
// Set proper height
|
||||||
if (mthing->options & MTF_OBJECTFLIP)
|
if (mthing->options & MTF_OBJECTFLIP)
|
||||||
{
|
{
|
||||||
z = sec->ceilingheight - mobjinfo[ringthing].height;
|
z = (
|
||||||
|
#ifdef ESLOPE
|
||||||
|
sec->c_slope ? P_GetZAt(sec->c_slope, x, y) :
|
||||||
|
#endif
|
||||||
|
sec->ceilingheight) - mobjinfo[ringthing].height;
|
||||||
if (mthing->options >> ZSHIFT)
|
if (mthing->options >> ZSHIFT)
|
||||||
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
|
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
z = sec->floorheight;
|
z =
|
||||||
|
#ifdef ESLOPE
|
||||||
|
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
|
||||||
|
#endif
|
||||||
|
sec->floorheight;
|
||||||
if (mthing->options >> ZSHIFT)
|
if (mthing->options >> ZSHIFT)
|
||||||
z += ((mthing->options >> ZSHIFT) << FRACBITS);
|
z += ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||||
}
|
}
|
||||||
|
@ -9393,13 +9445,21 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
||||||
{
|
{
|
||||||
if (mthing->options & MTF_OBJECTFLIP)
|
if (mthing->options & MTF_OBJECTFLIP)
|
||||||
{
|
{
|
||||||
z = sec->ceilingheight - mobjinfo[ringthing].height - dist*r;
|
z = (
|
||||||
|
#ifdef ESLOPE
|
||||||
|
sec->c_slope ? P_GetZAt(sec->c_slope, x, y) :
|
||||||
|
#endif
|
||||||
|
sec->ceilingheight) - mobjinfo[ringthing].height - dist*r;
|
||||||
if (mthing->options >> ZSHIFT)
|
if (mthing->options >> ZSHIFT)
|
||||||
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
|
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
z = sec->floorheight + dist*r;
|
z = (
|
||||||
|
#ifdef ESLOPE
|
||||||
|
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
|
||||||
|
#endif
|
||||||
|
sec->floorheight) + dist*r;
|
||||||
if (mthing->options >> ZSHIFT)
|
if (mthing->options >> ZSHIFT)
|
||||||
z += ((mthing->options >> ZSHIFT) << FRACBITS);
|
z += ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||||
}
|
}
|
||||||
|
@ -9445,13 +9505,21 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
||||||
|
|
||||||
if (mthing->options & MTF_OBJECTFLIP)
|
if (mthing->options & MTF_OBJECTFLIP)
|
||||||
{
|
{
|
||||||
z = sec->ceilingheight - mobjinfo[ringthing].height - 64*FRACUNIT*r;
|
z = (
|
||||||
|
#ifdef ESLOPE
|
||||||
|
sec->c_slope ? P_GetZAt(sec->c_slope, x, y) :
|
||||||
|
#endif
|
||||||
|
sec->ceilingheight) - mobjinfo[ringthing].height - 64*FRACUNIT*r;
|
||||||
if (mthing->options >> ZSHIFT)
|
if (mthing->options >> ZSHIFT)
|
||||||
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
|
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
z = sec->floorheight + 64*FRACUNIT*r;
|
z = (
|
||||||
|
#ifdef ESLOPE
|
||||||
|
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
|
||||||
|
#endif
|
||||||
|
sec->floorheight) + 64*FRACUNIT*r;
|
||||||
if (mthing->options >> ZSHIFT)
|
if (mthing->options >> ZSHIFT)
|
||||||
z += ((mthing->options >> ZSHIFT) << FRACBITS);
|
z += ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||||
}
|
}
|
||||||
|
@ -9482,7 +9550,11 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
||||||
size = 192*FRACUNIT;
|
size = 192*FRACUNIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
z = sec->floorheight;
|
z =
|
||||||
|
#ifdef ESLOPE
|
||||||
|
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
|
||||||
|
#endif
|
||||||
|
sec->floorheight;
|
||||||
if (mthing->options >> ZSHIFT)
|
if (mthing->options >> ZSHIFT)
|
||||||
z += ((mthing->options >> ZSHIFT) << FRACBITS);
|
z += ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||||
|
|
||||||
|
|
|
@ -892,9 +892,14 @@ static void P_LoadThings(lumpnum_t lumpnum)
|
||||||
numhuntemeralds = 0;
|
numhuntemeralds = 0;
|
||||||
for (i = 0; i < nummapthings; i++, mt++)
|
for (i = 0; i < nummapthings; i++, mt++)
|
||||||
{
|
{
|
||||||
|
sector_t *mtsector = R_PointInSubsector(mt->x << FRACBITS, mt->y << FRACBITS)->sector;
|
||||||
|
|
||||||
// Z for objects
|
// Z for objects
|
||||||
mt->z = (INT16)(R_PointInSubsector(mt->x << FRACBITS, mt->y << FRACBITS)
|
mt->z = (INT16)(
|
||||||
->sector->floorheight>>FRACBITS);
|
#ifdef ESLOPE
|
||||||
|
mtsector->f_slope ? P_GetZAt(mtsector->f_slope, mt->x << FRACBITS, mt->y << FRACBITS) :
|
||||||
|
#endif
|
||||||
|
mtsector->floorheight)>>FRACBITS;
|
||||||
|
|
||||||
if (mt->type == 1700 // MT_AXIS
|
if (mt->type == 1700 // MT_AXIS
|
||||||
|| mt->type == 1701 // MT_AXISTRANSFER
|
|| mt->type == 1701 // MT_AXISTRANSFER
|
||||||
|
@ -2535,6 +2540,10 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||||
|
|
||||||
P_MapStart();
|
P_MapStart();
|
||||||
|
|
||||||
|
#ifdef ESLOPE
|
||||||
|
P_ResetDynamicSlopes();
|
||||||
|
#endif
|
||||||
|
|
||||||
P_LoadThings(lastloadedmaplumpnum + ML_THINGS);
|
P_LoadThings(lastloadedmaplumpnum + ML_THINGS);
|
||||||
|
|
||||||
P_SpawnSecretItems(loademblems);
|
P_SpawnSecretItems(loademblems);
|
||||||
|
@ -2544,7 +2553,6 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// set up world state
|
// set up world state
|
||||||
P_ResetDynamicSlopes();
|
|
||||||
P_SpawnSpecials(fromnetsave);
|
P_SpawnSpecials(fromnetsave);
|
||||||
|
|
||||||
if (loadprecip) // ugly hack for P_NetUnArchiveMisc (and P_LoadNetGame)
|
if (loadprecip) // ugly hack for P_NetUnArchiveMisc (and P_LoadNetGame)
|
||||||
|
|
|
@ -42,11 +42,6 @@
|
||||||
|
|
||||||
static pslope_t *dynslopes = NULL;
|
static pslope_t *dynslopes = NULL;
|
||||||
|
|
||||||
// Reset the dynamic slopes pointer
|
|
||||||
void P_ResetDynamicSlopes(void) {
|
|
||||||
dynslopes = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate line normal
|
// Calculate line normal
|
||||||
void P_CalculateSlopeNormal(pslope_t *slope) {
|
void P_CalculateSlopeNormal(pslope_t *slope) {
|
||||||
slope->normal.z = FINECOSINE(slope->zangle>>ANGLETOFINESHIFT);
|
slope->normal.z = FINECOSINE(slope->zangle>>ANGLETOFINESHIFT);
|
||||||
|
@ -722,6 +717,35 @@ void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Reset the dynamic slopes pointer, and read all of the fancy schmancy slopes
|
||||||
|
void P_ResetDynamicSlopes(void) {
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
dynslopes = NULL;
|
||||||
|
|
||||||
|
// We'll handle copy slopes later, after all the tag lists have been made.
|
||||||
|
// Yes, this means copied slopes won't affect things' spawning heights. Too bad for you.
|
||||||
|
for (i = 0; i < numlines; i++)
|
||||||
|
{
|
||||||
|
switch (lines[i].special)
|
||||||
|
{
|
||||||
|
case 386:
|
||||||
|
case 387:
|
||||||
|
case 388:
|
||||||
|
case 389:
|
||||||
|
case 390:
|
||||||
|
case 391:
|
||||||
|
case 392:
|
||||||
|
case 393:
|
||||||
|
P_SpawnSlope_Line(i);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
13
src/p_spec.c
13
src/p_spec.c
|
@ -6439,18 +6439,7 @@ void P_SpawnSpecials(INT32 fromnetsave)
|
||||||
sectors[s].midmap = lines[i].frontsector->midmap;
|
sectors[s].midmap = lines[i].frontsector->midmap;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ESLOPE // Slope specials. TODO move these to a different spot, maybe?
|
#ifdef ESLOPE // Slope copy specials. Handled here for sanity.
|
||||||
case 386:
|
|
||||||
case 387:
|
|
||||||
case 388:
|
|
||||||
case 389:
|
|
||||||
case 390:
|
|
||||||
case 391:
|
|
||||||
case 392:
|
|
||||||
case 393:
|
|
||||||
P_SpawnSlope_Line(i);
|
|
||||||
break;
|
|
||||||
// SoM: Copy slopes
|
|
||||||
case 394:
|
case 394:
|
||||||
case 395:
|
case 395:
|
||||||
case 396:
|
case 396:
|
||||||
|
|
Loading…
Reference in a new issue