mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-21 18:32:08 +00:00
Adapt linedef executor delay to UDMF
This commit is contained in:
parent
7fec1211fd
commit
f26648e6f2
5 changed files with 47 additions and 11 deletions
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1033,6 +1033,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));
|
||||
|
||||
|
@ -1504,6 +1505,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))
|
||||
|
@ -1739,6 +1742,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;
|
||||
|
||||
|
@ -2952,6 +2956,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++)
|
||||
|
|
18
src/p_spec.c
18
src/p_spec.c
|
@ -1592,16 +1592,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);
|
||||
}
|
||||
|
@ -2002,7 +2010,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);
|
||||
|
@ -2090,7 +2098,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);
|
||||
|
|
|
@ -425,6 +425,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