Search FOF target sectors for slope anchors

Requires spawning fake floors before slopes, and therefore before things,
basically before everything. Hopefully nothing breaks!
This commit is contained in:
James R 2020-09-24 01:56:03 -07:00
parent b35e2ac9b3
commit 388d56a5f8
4 changed files with 70 additions and 26 deletions

View file

@ -3206,19 +3206,22 @@ boolean P_SetupLevel(boolean skipprecip)
// anything that P_ResetDynamicSlopes/P_LoadThings needs to know
P_InitSpecials();
// set up world state
// jart: needs to be done here so anchored slopes know the attached list
P_SpawnSpecials(fromnetsave);
P_ResetDynamicSlopes();
P_LoadThings();
P_RaiseThings();
P_SpawnSecretItems(loademblems);
for (numcoopstarts = 0; numcoopstarts < MAXPLAYERS; numcoopstarts++)
if (!playerstarts[numcoopstarts])
break;
// set up world state
P_SpawnSpecials(fromnetsave);
K_AdjustWaypointsParameters();
if (loadprecip) // ugly hack for P_NetUnArchiveMisc (and P_LoadNetGame)

View file

@ -5358,6 +5358,26 @@ P_RaiseTaggedThingsToFakeFloor (
}
}
void
P_RaiseThings (void)
{
size_t i;
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;
}
}
}
//
// SPECIAL SPAWNING
//
@ -6822,22 +6842,6 @@ 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)

View file

@ -38,6 +38,7 @@ void P_SetupLevelFlatAnims(void);
// at map load
void P_InitSpecials(void);
void P_SpawnSpecials(INT32 fromnetsave);
void P_RaiseThings(void);
// every tic
void P_UpdateSpecials(void);

View file

@ -266,6 +266,8 @@ find_closest_anchors
int last = 0;
size_t i;
if (list->count < 3)
{
I_Error("At least three slope anchors are required to make a slope.");
@ -273,7 +275,18 @@ find_closest_anchors
anchors = Z_Malloc(3 * sizeof *anchors, PU_LEVEL, NULL);
get_sector_anchors(anchors, distances, list, sector);
if (sector->numattached > 0)
{
for (i = 0; i < sector->numattached; ++i)
{
get_sector_anchors
(anchors, distances, list, &sectors[sector->attached[i]]);
}
}
else
{
get_sector_anchors(anchors, distances, list, sector);
}
if (distances[2] < INT32_MAX)
{
@ -287,13 +300,36 @@ find_closest_anchors
else
last = 0;
I_Error(
"(Sector #%s)"
" Slope requires anchors near 3 of its vertices (%d found)",
if (sector->numattached > 0)
{
CONS_Printf("\nSearched for anchors in sectors...\n\n");
sizeu1 (sector - sectors),
last
);
for (i = 0; i < sector->numattached; ++i)
{
CONS_Printf("#%s\n", sizeu1 (sector->attached[i]));
}
I_Error(
"(Control Sector #%s)"
" Slope requires anchors near 3 of its target sectors' vertices"
" (%d found)"
"\n\nCheck the log to see which sectors were searched.",
sizeu1 (sector - sectors),
last
);
}
else
{
I_Error(
"(Sector #%s)"
" Slope requires anchors near 3 of its vertices (%d found)",
sizeu1 (sector - sectors),
last
);
}
}
static pslope_t *