Adapt linedef type 434 to UDMF

This commit is contained in:
MascaraSnake 2021-09-21 08:34:55 +02:00
parent 17bd20a15e
commit ea1d442f31
3 changed files with 42 additions and 8 deletions

View file

@ -2955,6 +2955,22 @@ udmf
}
}
434
{
title = "Award Power-Up";
prefix = "(434)";
stringarg0
{
title = "Power";
type = 2;
}
stringarg1
{
title = "Duration/Amount";
type = 2;
}
}
437
{
title = "Disable Player Control";

View file

@ -1292,7 +1292,6 @@ static void P_LoadSidedefs(UINT8 *data)
case 334: // Trigger linedef executor: Object dye - Continuous
case 335: // Trigger linedef executor: Object dye - Each time
case 336: // Trigger linedef executor: Object dye - Once
case 434: // Custom Power
case 461: // Spawns an object on the map based on texture offsets
{
char process[8*3+1];
@ -1314,6 +1313,7 @@ static void P_LoadSidedefs(UINT8 *data)
case 332: // Trigger linedef executor: Skin - Each time
case 333: // Trigger linedef executor: Skin - Once
case 425: // Calls P_SetMobjState on calling mobj
case 434: // Custom Power
case 442: // Calls P_SetMobjState on mobjs of a given type in the tagged sectors
case 443: // Calls a named Lua function
case 459: // Control text prompt (named tag)
@ -3823,6 +3823,28 @@ static void P_ConvertBinaryMap(void)
case 433: //Enable/disable gravity flip
lines[i].args[0] = !!(lines[i].flags & ML_NOCLIMB);
break;
case 434: //Award power-up
if (sides[lines[i].sidenum[0]].text)
{
lines[i].stringargs[0] = Z_Malloc(strlen(sides[lines[i].sidenum[0]].text) + 1, PU_LEVEL, NULL);
M_Memcpy(lines[i].stringargs[0], sides[lines[i].sidenum[0]].text, strlen(sides[lines[i].sidenum[0]].text) + 1);
}
if (lines[i].sidenum[1] != 0xffff && lines[i].flags & ML_BLOCKMONSTERS) // read power from back sidedef
{
lines[i].stringargs[1] = Z_Malloc(strlen(sides[lines[i].sidenum[1]].text) + 1, PU_LEVEL, NULL);
M_Memcpy(lines[i].stringargs[1], sides[lines[i].sidenum[1]].text, strlen(sides[lines[i].sidenum[1]].text) + 1);
}
else if (lines[i].flags & ML_NOCLIMB) // 'Infinite'
{
lines[i].stringargs[1] = Z_Malloc(3, PU_LEVEL, NULL);
M_Memcpy(lines[i].stringargs[1], "-1", 3);
}
else
{
lines[i].stringargs[1] = Z_Malloc(7, PU_LEVEL, NULL);
snprintf(lines[i].stringargs[1], 7, "%d", sides[lines[i].sidenum[0]].textureoffset >> FRACBITS);
}
break;
case 435: //Change plane scroller direction
lines[i].args[0] = tag;
lines[i].args[1] = R_PointToDist2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y) >> FRACBITS;

View file

@ -2669,14 +2669,10 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
{
mobj_t *dummy = P_SpawnMobj(mo->x, mo->y, mo->z, MT_NULL);
var1 = sides[line->sidenum[0]].toptexture; //(line->dx>>FRACBITS)-1;
if (line->sidenum[1] != 0xffff && line->flags & ML_BLOCKMONSTERS) // read power from back sidedef
var2 = sides[line->sidenum[1]].toptexture;
else if (line->flags & ML_NOCLIMB) // 'Infinite'
var1 = line->stringargs[0] ? get_number(line->stringargs[0]) : 0;
var2 = line->stringargs[1] ? get_number(line->stringargs[1]) : 0;
if (var2 == -1) // 'Infinite'
var2 = UINT16_MAX;
else
var2 = sides[line->sidenum[0]].textureoffset>>FRACBITS;
P_SetTarget(&dummy->target, mo);
A_CustomPower(dummy);