Fixed Change Sky linedef type crashing the game.

It was changed during v2 indev to operate off textures supplied rather than offsets. Unfortunately, she didn't bank on the 2.2 merge making it so that only linedefs of specific types would generate the necessary `->text` string from their texture fields. This branch corrects that issue, along with a bonus null-avoidance in P_SetupLevelSky just in case someone messes up the source linedef.
This commit is contained in:
toaster 2021-02-16 17:08:49 +00:00
parent 3ac803be76
commit ac0e291db6

View file

@ -1261,6 +1261,24 @@ static void P_LoadSidedefs(UINT8 *data)
break;
}
case 423: // Change Sky
{
char process[8*3+1];
memset(process,0,8*3+1);
sd->toptexture = sd->midtexture = sd->bottomtexture = 0;
if (msd->toptexture[0] != '-' && msd->toptexture[1] != '\0')
M_Memcpy(process,msd->toptexture,8);
if (msd->midtexture[0] != '-' || msd->midtexture[1] != '\0')
M_Memcpy(process+strlen(process), msd->midtexture, 8);
if (msd->bottomtexture[0] != '-' || msd->bottomtexture[1] != '\0')
M_Memcpy(process+strlen(process), msd->bottomtexture, 8);
if (!strlen(process))
break;
sd->text = Z_Malloc(strlen(process)+1, PU_LEVEL, NULL);
M_Memcpy(sd->text, process, strlen(process)+1);
break;
}
case 9: // Mace parameters
case 14: // Bustable block parameters
case 15: // Fan particle spawner parameters
@ -3305,6 +3323,9 @@ static boolean P_LoadMapFromFile(void)
void P_SetupLevelSky(const char *skytexname, boolean global)
{
char tex[9];
if (!skytexname || !skytexname[0])
return;
strncpy(tex, skytexname, 9);
tex[8] = 0;