Skip to content

Commit 2ede536

Browse files
authored
Merge branch 'master' into wipeout-updates
2 parents c1b9c6a + 615bfda commit 2ede536

File tree

7 files changed

+81
-1
lines changed

7 files changed

+81
-1
lines changed

include/progs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -954,6 +954,7 @@ typedef struct gedict_s
954954
float fIllegalFPSWarnings;
955955
// ILLEGALFPS]
956956

957+
qbool leavemealone;
957958
float shownick_time; // used to force centerprint is off at desired time
958959
clientType_t ct; // client type for client edicts
959960
// { timing

src/client.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3796,6 +3796,16 @@ void PlayerPreThink(void)
37963796

37973797
race_player_pre_think();
37983798

3799+
if (self->leavemealone)
3800+
{
3801+
if ((self->s.v.mins[0] == 0) || (self->s.v.mins[1] == 0))
3802+
{
3803+
// This can happen if the world 'squashes' a SOLID_NOT entity, mvdsv will turn into corpse
3804+
setsize(self, PASSVEC3(VEC_HULL_MIN), PASSVEC3(VEC_HULL_MAX));
3805+
}
3806+
setorigin(self, PASSVEC3(self->s.v.origin));
3807+
}
3808+
37993809
// brokenankle included here
38003810
if (self->s.v.button2 || self->brokenankle)
38013811
{

src/combat.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,21 @@ void T_Damage(gedict_t *targ, gedict_t *inflictor, gedict_t *attacker, float dam
463463
return;
464464
}
465465

466+
// don't bounce around players in prewar who wish to be left alone
467+
if (match_in_progress != 2 && targ->leavemealone)
468+
{
469+
if (attacker != targ && ((targ->ct == ctPlayer) && (attacker->ct == ctPlayer)))
470+
{
471+
return;
472+
}
473+
else if (dtTELE1 == targ->deathtype // always do tele damage
474+
|| dtTELE2 == targ->deathtype // always do tele damage
475+
|| dtTELE3 == targ->deathtype) // always do tele damage
476+
{
477+
// telefrags still work, to avoid getting stuck
478+
}
479+
}
480+
466481
// can't damage other players in race
467482
if (isRACE() && (attacker != targ))
468483
{

src/commands.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ void CTFBasedSpawn(void);
7272
// } CTF
7373
void FragsDown(void);
7474
void FragsUp(void);
75+
void LeaveMeAlone(void);
7576
void ListWhoNot(void);
7677
void ModStatus1(void);
7778
void ModStatus2(void);
@@ -391,6 +392,7 @@ const char CD_NODESC[] = "no desc";
391392
#define CD_CTOCT "Show octal charset table"
392393
#define CD_CTHEX "Show hexadecimal charset table"
393394
#define CD_SHOWNICK "pointed player's info"
395+
#define CD_LEAVEMEALONE "can't shoot/bounce players in prewar"
394396
#define CD_TIME5 "set timelimit to 5 mins"
395397
#define CD_TIME10 "set timelimit to 10 mins"
396398
#define CD_TIME15 "set timelimit to 15 mins"
@@ -755,6 +757,7 @@ cmd_t cmds[] =
755757
{ "sct_hex", ShowCharsetTableHexa, 0, CF_BOTH, CD_CTHEX },
756758
{ "about", ShowVersion, 0, CF_BOTH | CF_MATCHLESS, CD_ABOUT },
757759
{ "shownick", ShowNick, 0, CF_PLAYER | CF_PARAMS, CD_SHOWNICK },
760+
{ "leavemealone", LeaveMeAlone, 0, CF_PLAYER | CF_PARAMS, CD_LEAVEMEALONE },
758761
{ "time5", DEF(TimeSet), 5.0f, CF_PLAYER | CF_SPC_ADMIN, CD_TIME5 },
759762
{ "time10", DEF(TimeSet), 10.0f, CF_PLAYER | CF_SPC_ADMIN, CD_TIME10 },
760763
{ "time15", DEF(TimeSet), 15.0f, CF_PLAYER | CF_SPC_ADMIN, CD_TIME15 },
@@ -4070,6 +4073,33 @@ void ShowNick(void)
40704073
self->shownick_time = g_globalvars.time + 0.8; // clear centerprint at this time
40714074
}
40724075

4076+
void LeaveMeAlone(void)
4077+
{
4078+
if (match_in_progress)
4079+
{
4080+
return;
4081+
}
4082+
4083+
if (isRA() || isRACE())
4084+
{
4085+
return;
4086+
}
4087+
4088+
if (self->leavemealone)
4089+
{
4090+
G_bprint(2, "%s %s\n", self->netname, redtext("no longer wants to be left alone"));
4091+
self->s.v.solid = SOLID_SLIDEBOX;
4092+
}
4093+
else
4094+
{
4095+
G_bprint(2, "%s %s\n", self->netname, redtext("wants to be left alone"));
4096+
self->s.v.solid = SOLID_TRIGGER;
4097+
}
4098+
4099+
setorigin(self, PASSVEC3(self->s.v.origin));
4100+
self->leavemealone = !self->leavemealone;
4101+
}
4102+
40734103
// qqshka
40744104

40754105
// below predefined settings for usermodes

src/match.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,7 @@ static void SM_PrepareClients(void)
914914
for (p = world; (p = find_plr(p));)
915915
{
916916
players[player_count++] = p;
917+
p->leavemealone = false; // can't have this enabled during match
917918
}
918919

919920
for (i = player_count - 1; i > 0; i--)

src/triggers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ void teleport_touch(void)
715715
}
716716

717717
// only teleport living creatures
718-
if (ISDEAD(other) || (!isRACE() && (other->s.v.solid != SOLID_SLIDEBOX)))
718+
if (ISDEAD(other) || (!isRACE() && (other->s.v.solid != SOLID_SLIDEBOX) && !other->leavemealone))
719719
{
720720
return;
721721
}

src/weapons.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,12 @@ void TraceAttack(float damage, vec3_t dir, qbool send_effects)
377377
return;
378378
}
379379

380+
//can't touch/damage players who want to be left alone
381+
if (PROG_TO_EDICT(g_globalvars.trace_ent)->ct == ctPlayer && PROG_TO_EDICT(g_globalvars.trace_ent)->leavemealone)
382+
{
383+
return;
384+
}
385+
380386
if (PROG_TO_EDICT(g_globalvars.trace_ent)->s.v.takedamage)
381387
{
382388
if (PROG_TO_EDICT(g_globalvars.trace_ent)->ct == ctPlayer)
@@ -960,6 +966,11 @@ void T_MissileTouch(void)
960966
return;
961967
}
962968

969+
if (other->leavemealone)
970+
{
971+
return;
972+
}
973+
963974
if (self->voided)
964975
{
965976
return;
@@ -1323,6 +1334,12 @@ void GrenadeTouch(void)
13231334
return;
13241335
}
13251336

1337+
// can't touch players who want to be left alone
1338+
if (other->leavemealone)
1339+
{
1340+
return;
1341+
}
1342+
13261343
if (other->s.v.takedamage)
13271344
{
13281345
if (other->ct == ctPlayer)
@@ -1517,6 +1534,12 @@ void spike_touch(void)
15171534
return;
15181535
}
15191536

1537+
// can't touch players who want to be left alone
1538+
if (other->leavemealone)
1539+
{
1540+
return;
1541+
}
1542+
15201543
if (self->voided)
15211544
{
15221545
return;

0 commit comments

Comments
 (0)