mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-24 13:21:20 +00:00
Merge branch 'executordelay' into 'udmf-next'
UDMF linedef executor delay See merge request STJr/SRB2!918
This commit is contained in:
commit
11493e61d2
7 changed files with 94 additions and 11 deletions
|
@ -1737,6 +1737,31 @@ udmf
|
|||
type = 13;
|
||||
}
|
||||
}
|
||||
|
||||
465
|
||||
{
|
||||
title = "Set Linedef Executor Delay";
|
||||
prefix = "(465)";
|
||||
arg0
|
||||
{
|
||||
title = "Linedef tag";
|
||||
type = 15;
|
||||
}
|
||||
arg1
|
||||
{
|
||||
title = "Value";
|
||||
}
|
||||
arg2
|
||||
{
|
||||
title = "Set/add?";
|
||||
type = 11;
|
||||
enum
|
||||
{
|
||||
0 = "Set";
|
||||
1 = "Add";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
light
|
||||
|
|
|
@ -242,6 +242,11 @@ universalfields
|
|||
type = 2;
|
||||
default = "";
|
||||
}
|
||||
executordelay
|
||||
{
|
||||
type = 0;
|
||||
default = 0;
|
||||
}
|
||||
}
|
||||
|
||||
sidedef
|
||||
|
|
|
@ -91,6 +91,7 @@ enum line_e {
|
|||
line_frontside,
|
||||
line_backside,
|
||||
line_alpha,
|
||||
line_executordelay,
|
||||
line_slopetype,
|
||||
line_frontsector,
|
||||
line_backsector,
|
||||
|
@ -115,6 +116,7 @@ static const char *const line_opt[] = {
|
|||
"frontside",
|
||||
"backside",
|
||||
"alpha",
|
||||
"executordelay",
|
||||
"slopetype",
|
||||
"frontsector",
|
||||
"backsector",
|
||||
|
@ -792,6 +794,9 @@ static int line_get(lua_State *L)
|
|||
case line_alpha:
|
||||
lua_pushfixed(L, line->alpha);
|
||||
return 1;
|
||||
case line_executordelay:
|
||||
lua_pushinteger(L, line->executordelay);
|
||||
return 1;
|
||||
case line_slopetype:
|
||||
switch(line->slopetype)
|
||||
{
|
||||
|
|
|
@ -755,12 +755,13 @@ static void P_NetUnArchiveColormaps(void)
|
|||
#define LD_DIFF2 0x80
|
||||
|
||||
// diff2 flags
|
||||
#define LD_S2TEXOFF 0x01
|
||||
#define LD_S2TOPTEX 0x02
|
||||
#define LD_S2BOTTEX 0x04
|
||||
#define LD_S2MIDTEX 0x08
|
||||
#define LD_ARGS 0x10
|
||||
#define LD_STRINGARGS 0x20
|
||||
#define LD_S2TEXOFF 0x01
|
||||
#define LD_S2TOPTEX 0x02
|
||||
#define LD_S2BOTTEX 0x04
|
||||
#define LD_S2MIDTEX 0x08
|
||||
#define LD_ARGS 0x10
|
||||
#define LD_STRINGARGS 0x20
|
||||
#define LD_EXECUTORDELAY 0x40
|
||||
|
||||
static boolean P_AreArgsEqual(const line_t *li, const line_t *spawnli)
|
||||
{
|
||||
|
@ -1086,6 +1087,9 @@ static void ArchiveLines(void)
|
|||
if (!P_AreStringArgsEqual(li, spawnli))
|
||||
diff2 |= LD_STRINGARGS;
|
||||
|
||||
if (li->executordelay != spawnli->executordelay)
|
||||
diff2 |= LD_EXECUTORDELAY;
|
||||
|
||||
if (li->sidenum[0] != 0xffff)
|
||||
{
|
||||
si = &sides[li->sidenum[0]];
|
||||
|
@ -1174,6 +1178,8 @@ static void ArchiveLines(void)
|
|||
WRITECHAR(save_p, li->stringargs[j][k]);
|
||||
}
|
||||
}
|
||||
if (diff2 & LD_EXECUTORDELAY)
|
||||
WRITEINT32(save_p, li->executordelay);
|
||||
}
|
||||
}
|
||||
WRITEUINT16(save_p, 0xffff);
|
||||
|
@ -1256,6 +1262,9 @@ static void UnArchiveLines(void)
|
|||
li->stringargs[j][len] = '\0';
|
||||
}
|
||||
}
|
||||
if (diff2 & LD_EXECUTORDELAY)
|
||||
li->executordelay = READINT32(save_p);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1034,6 +1034,7 @@ static void P_LoadLinedefs(UINT8 *data)
|
|||
memset(ld->args, 0, NUMLINEARGS*sizeof(*ld->args));
|
||||
memset(ld->stringargs, 0x00, NUMLINESTRINGARGS*sizeof(*ld->stringargs));
|
||||
ld->alpha = FRACUNIT;
|
||||
ld->executordelay = 0;
|
||||
P_SetLinedefV1(i, SHORT(mld->v1));
|
||||
P_SetLinedefV2(i, SHORT(mld->v2));
|
||||
|
||||
|
@ -1505,6 +1506,8 @@ static void ParseTextmapLinedefParameter(UINT32 i, char *param, char *val)
|
|||
lines[i].sidenum[1] = atol(val);
|
||||
else if (fastcmp(param, "alpha"))
|
||||
lines[i].alpha = FLOAT_TO_FIXED(atof(val));
|
||||
else if (fastcmp(param, "executordelay"))
|
||||
lines[i].executordelay = atol(val);
|
||||
|
||||
// Flags
|
||||
else if (fastcmp(param, "blocking") && fastcmp("true", val))
|
||||
|
@ -1740,6 +1743,7 @@ static void P_LoadTextmap(void)
|
|||
memset(ld->args, 0, NUMLINEARGS*sizeof(*ld->args));
|
||||
memset(ld->stringargs, 0x00, NUMLINESTRINGARGS*sizeof(*ld->stringargs));
|
||||
ld->alpha = FRACUNIT;
|
||||
ld->executordelay = 0;
|
||||
ld->sidenum[0] = 0xffff;
|
||||
ld->sidenum[1] = 0xffff;
|
||||
|
||||
|
@ -3010,6 +3014,15 @@ static void P_ConvertBinaryMap(void)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//Linedef executor delay
|
||||
if (lines[i].special >= 400 && lines[i].special < 500)
|
||||
{
|
||||
//Dummy value to indicate that this executor is delayed.
|
||||
//The real value is taken from the back sector at runtime.
|
||||
if (lines[i].flags & ML_DONTPEGTOP)
|
||||
lines[i].executordelay = 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < nummapthings; i++)
|
||||
|
|
35
src/p_spec.c
35
src/p_spec.c
|
@ -1528,16 +1528,24 @@ void T_ExecutorDelay(executor_t *e)
|
|||
static void P_AddExecutorDelay(line_t *line, mobj_t *mobj, sector_t *sector)
|
||||
{
|
||||
executor_t *e;
|
||||
INT32 delay;
|
||||
|
||||
if (!line->backsector)
|
||||
I_Error("P_AddExecutorDelay: Line has no backsector!\n");
|
||||
if (udmf)
|
||||
delay = line->executordelay;
|
||||
else
|
||||
{
|
||||
if (!line->backsector)
|
||||
I_Error("P_AddExecutorDelay: Line has no backsector!\n");
|
||||
|
||||
delay = (line->backsector->ceilingheight >> FRACBITS) + (line->backsector->floorheight >> FRACBITS);
|
||||
}
|
||||
|
||||
e = Z_Calloc(sizeof (*e), PU_LEVSPEC, NULL);
|
||||
|
||||
e->thinker.function.acp1 = (actionf_p1)T_ExecutorDelay;
|
||||
e->line = line;
|
||||
e->sector = sector;
|
||||
e->timer = (line->backsector->ceilingheight>>FRACBITS)+(line->backsector->floorheight>>FRACBITS);
|
||||
e->timer = delay;
|
||||
P_SetTarget(&e->caller, mobj); // Use P_SetTarget to make sure the mobj doesn't get freed while we're delaying.
|
||||
P_AddThinker(THINK_MAIN, &e->thinker);
|
||||
}
|
||||
|
@ -1938,7 +1946,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|
|||
if (ctlsector->lines[i]->special >= 400
|
||||
&& ctlsector->lines[i]->special < 500)
|
||||
{
|
||||
if (ctlsector->lines[i]->flags & ML_DONTPEGTOP)
|
||||
if (ctlsector->lines[i]->executordelay)
|
||||
P_AddExecutorDelay(ctlsector->lines[i], actor, caller);
|
||||
else
|
||||
P_ProcessLineSpecial(ctlsector->lines[i], actor, caller);
|
||||
|
@ -2026,7 +2034,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|
|||
if (ctlsector->lines[i]->special >= 400
|
||||
&& ctlsector->lines[i]->special < 500)
|
||||
{
|
||||
if (ctlsector->lines[i]->flags & ML_DONTPEGTOP)
|
||||
if (ctlsector->lines[i]->executordelay)
|
||||
P_AddExecutorDelay(ctlsector->lines[i], actor, caller);
|
||||
else
|
||||
P_ProcessLineSpecial(ctlsector->lines[i], actor, caller);
|
||||
|
@ -4005,6 +4013,23 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
|||
}
|
||||
break;
|
||||
|
||||
case 465: // Set linedef executor delay
|
||||
{
|
||||
INT32 linenum;
|
||||
|
||||
if (!udmf)
|
||||
break;
|
||||
|
||||
for (linenum = -1; (linenum = P_FindLineFromTag(line->args[0], linenum)) >= 0 ;)
|
||||
{
|
||||
if (line->args[2])
|
||||
lines[linenum].executordelay += line->args[1];
|
||||
else
|
||||
lines[linenum].executordelay = line->args[1];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 480: // Polyobj_DoorSlide
|
||||
case 481: // Polyobj_DoorSwing
|
||||
PolyDoor(line);
|
||||
|
|
|
@ -421,6 +421,7 @@ typedef struct line_s
|
|||
// Visual appearance: sidedefs.
|
||||
UINT16 sidenum[2]; // sidenum[1] will be 0xffff if one-sided
|
||||
fixed_t alpha; // translucency
|
||||
INT32 executordelay;
|
||||
|
||||
fixed_t bbox[4]; // bounding box for the extent of the linedef
|
||||
|
||||
|
|
Loading…
Reference in a new issue