mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-26 22:31:10 +00:00
Adapt setup of line-based slopes to UDMF
This commit is contained in:
parent
41a74bede1
commit
98c4221a24
2 changed files with 53 additions and 22 deletions
|
@ -2646,6 +2646,46 @@ static void P_LinkMapData(void)
|
|||
}
|
||||
}
|
||||
|
||||
//For maps in binary format, converts setup of specials to UDMF format.
|
||||
static void P_ConvertBinaryMap(void)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < numlines; i++)
|
||||
{
|
||||
switch (lines[i].special)
|
||||
{
|
||||
case 700: //Slope front sector floor
|
||||
case 701: //Slope front sector ceiling
|
||||
case 702: //Slope front sector floor and ceiling
|
||||
case 703: //Slope front sector floor and back sector ceiling
|
||||
case 710: //Slope back sector floor
|
||||
case 711: //Slope back sector ceiling
|
||||
case 712: //Slope back sector floor and ceiling
|
||||
case 713: //Slope back sector floor and front sector ceiling
|
||||
{
|
||||
boolean frontfloor = (lines[i].special == 700 || lines[i].special == 702 || lines[i].special == 703);
|
||||
boolean backfloor = (lines[i].special == 710 || lines[i].special == 712 || lines[i].special == 713);
|
||||
boolean frontceil = (lines[i].special == 701 || lines[i].special == 702 || lines[i].special == 713);
|
||||
boolean backceil = (lines[i].special == 711 || lines[i].special == 712 || lines[i].special == 703);
|
||||
|
||||
lines[i].args[0] = backfloor ? 2 : (frontfloor ? 1 : 0);
|
||||
lines[i].args[1] = backceil ? 2 : (frontceil ? 1 : 0);
|
||||
|
||||
if (lines[i].flags & ML_NETONLY)
|
||||
lines[i].args[2] |= SL_NOPHYSICS;
|
||||
if (lines[i].flags & ML_NONET)
|
||||
lines[i].args[2] |= SL_DYNAMIC;
|
||||
|
||||
lines[i].special = 700;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Compute MD5 message digest for bytes read from memory source
|
||||
*
|
||||
* The resulting message digest number will be written into the 16 bytes
|
||||
|
@ -2709,6 +2749,7 @@ static void P_MakeMapMD5(virtres_t *virt, void *dest)
|
|||
static boolean P_LoadMapFromFile(void)
|
||||
{
|
||||
virtres_t *virt = vres_GetMap(lastloadedmaplumpnum);
|
||||
virtlump_t *textmap = vres_Find(virt, "TEXTMAP");
|
||||
|
||||
if (!P_LoadMapData(virt))
|
||||
return false;
|
||||
|
@ -2717,6 +2758,9 @@ static boolean P_LoadMapFromFile(void)
|
|||
|
||||
P_LinkMapData();
|
||||
|
||||
if (!textmap)
|
||||
P_ConvertBinaryMap();
|
||||
|
||||
// Copy relevant map data for NetArchive purposes.
|
||||
spawnsectors = Z_Calloc(numsectors * sizeof(*sectors), PU_LEVEL, NULL);
|
||||
spawnlines = Z_Calloc(numlines * sizeof(*lines), PU_LEVEL, NULL);
|
||||
|
|
|
@ -247,32 +247,26 @@ static void line_SpawnViaLine(const int linenum, const boolean spawnthinker)
|
|||
// because checking to see if a slope had changed will waste more memory than
|
||||
// if the slope was just updated when called
|
||||
line_t *line = lines + linenum;
|
||||
INT16 special = line->special;
|
||||
pslope_t *fslope = NULL, *cslope = NULL;
|
||||
vector3_t origin, point;
|
||||
vector2_t direction;
|
||||
fixed_t nx, ny, dz, extent;
|
||||
|
||||
boolean frontfloor = (special == 700 || special == 702 || special == 703);
|
||||
boolean backfloor = (special == 710 || special == 712 || special == 713);
|
||||
boolean frontceil = (special == 701 || special == 702 || special == 713);
|
||||
boolean backceil = (special == 711 || special == 712 || special == 703);
|
||||
|
||||
UINT8 flags = 0; // Slope flags
|
||||
if (line->flags & ML_NETONLY)
|
||||
flags |= SL_NOPHYSICS;
|
||||
if (line->flags & ML_NONET)
|
||||
flags |= SL_DYNAMIC;
|
||||
boolean frontfloor = line->args[0] == 1;
|
||||
boolean backfloor = line->args[0] == 2;
|
||||
boolean frontceil = line->args[1] == 1;
|
||||
boolean backceil = line->args[1] == 2;
|
||||
UINT8 flags = line->args[2]; // Slope flags
|
||||
|
||||
if(!frontfloor && !backfloor && !frontceil && !backceil)
|
||||
{
|
||||
CONS_Printf("P_SpawnSlope_Line called with non-slope line special.\n");
|
||||
CONS_Printf("line_SpawnViaLine: Slope special with nothing to do.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!line->frontsector || !line->backsector)
|
||||
{
|
||||
CONS_Debug(DBG_SETUP, "P_SpawnSlope_Line used on a line without two sides. (line number %i)\n", linenum);
|
||||
CONS_Debug(DBG_SETUP, "line_SpawnViaLine: Slope special used on a line without two sides. (line number %i)\n", linenum);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -299,7 +293,7 @@ static void line_SpawnViaLine(const int linenum, const boolean spawnthinker)
|
|||
|
||||
if(extent < 0)
|
||||
{
|
||||
CONS_Printf("P_SpawnSlope_Line failed to get frontsector extent on line number %i\n", linenum);
|
||||
CONS_Printf("line_SpawnViaLine failed to get frontsector extent on line number %i\n", linenum);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -365,7 +359,7 @@ static void line_SpawnViaLine(const int linenum, const boolean spawnthinker)
|
|||
|
||||
if(extent < 0)
|
||||
{
|
||||
CONS_Printf("P_SpawnSlope_Line failed to get backsector extent on line number %i\n", linenum);
|
||||
CONS_Printf("line_SpawnViaLine failed to get backsector extent on line number %i\n", linenum);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -563,13 +557,6 @@ void P_ResetDynamicSlopes(const boolean fromsave) {
|
|||
switch (lines[i].special)
|
||||
{
|
||||
case 700:
|
||||
case 701:
|
||||
case 702:
|
||||
case 703:
|
||||
case 710:
|
||||
case 711:
|
||||
case 712:
|
||||
case 713:
|
||||
line_SpawnViaLine(i, !fromsave);
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in a new issue