Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/g_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1271,3 +1271,5 @@ int SpawnShowStatus(void);
int SpawnicideStatus(void);
void SpawnicideEnable(void);
void SpawnicideDisable(void);

qbool IsE1M2Practice(void);
1 change: 1 addition & 0 deletions include/progs.h
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ typedef struct gedict_s
string_t netname;
string_t target;
string_t targetname;
string_t firsttarget;
string_t message;
string_t noise;
string_t noise1;
Expand Down
7 changes: 7 additions & 0 deletions src/buttons.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ void button_fire(void)

self->state = STATE_UP;

// Allow the button in the mega room floor to be pressed multiple times
// on E1M2 during practice mode.
if (IsE1M2Practice() && streq(self->model, "*16"))
{
self->wait = 1;
}

SUB_CalcMove(self->pos2, self->speed, button_wait);
}

Expand Down
5 changes: 5 additions & 0 deletions src/maps.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,3 +692,8 @@ char* SelectMapInCycle(char *buf, int buf_size)

return buf;
}

qbool IsE1M2Practice(void)
{
return k_practice && streq(mapname, "e1m2");
}
41 changes: 40 additions & 1 deletion src/plats.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,50 @@ void train_blocked(void)
T_Damage(other, self, self, self->dmg);
}

void train_reset(void)
{
gedict_t *firsttarget;
vec3_t tmpv;

if (!self->firsttarget)
{
G_bprint(2, "train_reset: no firsttarget stored\n");
return;
}

firsttarget = find(world, FOFS(targetname), self->firsttarget);
if (!firsttarget)
{
G_bprint(2, "train_reset: couldn't find first path_corner\n");
return;
}

VectorSubtract(firsttarget->s.v.origin, self->s.v.mins, tmpv);
setorigin(self, tmpv[0], tmpv[1], tmpv[2]);

self->target = self->firsttarget;
self->think = (func_t )funcref_train_find;
}

void train_use(void)
{
qbool isE1M2Practice = IsE1M2Practice();

if (isE1M2Practice && !self->firsttarget)
{
self->firsttarget = self->target;
}

if (self->think != (func_t) funcref_train_find)
{
return; // already activated
if (isE1M2Practice)
{
train_reset();
}
else
{
return;
}
}

train_next();
Expand Down