Skip to content

Commit

Permalink
Add optional 'grapple'
Browse files Browse the repository at this point in the history
  - CTF pak0.pak required
    * CVar 'set zigrapple 1'
  - Reduce floating heads in new physics via 'fixflaws'
  • Loading branch information
DirtBagXon committed Jun 20, 2020
1 parent fdab8ea commit d1344a0
Show file tree
Hide file tree
Showing 13 changed files with 92 additions and 12 deletions.
1 change: 1 addition & 0 deletions 3zb2/zig.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ set autospawn 3
set zigmode 1
set zigspawn 1
set zigkiller 1
set zigrapple 0
set respawn_protection 1
set ctf 0
set aimfix 1
Expand Down
1 change: 1 addition & 0 deletions CONFIG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ chedit Chaining mode on/off (default off = 0, on = 1)
zigmode Capture and Hold (ZigFlag) (default off = 0, on = 1)
zigspawn ZigFlag returns home after 60s (default on = 1, off = 0)
zigkiller ZigFlag holder kill gives bonus frag (default on = 1, off = 0)
zgrapple Add CTF grapple to none CTF game s(default off = 0, on = 1)
botlist Set the botlist section name (default = "default")
ctf CTF mode on/off (default off = 0, on = 1)
aimfix Enable more accurate aiming (default on = 1, off = 0)
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ more refined, just for fun. I was trying to keep the look and feel of the origin
* Optional identified generic gameplay fixes.
* Optional respawn protection.
* Optional spawn bots at distance.
* Optional grapple.
* Optional HUD playerid.
* Optional enhanced HUD.

Expand All @@ -59,6 +60,7 @@ exec addbot.cfg
set zigmode 1
set zigspawn 1
set zigkiller 1
set zigrapple 0
set ctf 0
set aimfix 1
set combathud 1
Expand Down Expand Up @@ -224,6 +226,10 @@ Auto switch to upgraded weapon on pickup, enable `1` or disable `0` (default):

weaponswap 1

Option to add grapple to the fray - CTF `pak0.pak` required.

zigrapple 1

`Capture and Hold (ZigFlag)` mode for Deathmatch/Team games:

zigmode 1
Expand Down
18 changes: 15 additions & 3 deletions src/bot/func.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,8 @@ void PutBotInServer (edict_t *ent)
client->ctf_grapple = NULL;

item = FindItem("Grapple");
if(ctf->value) client->pers.inventory[ITEM_INDEX(item)] = 1; //ponpoko
if(ctf->value || zigrapple->value)
client->pers.inventory[ITEM_INDEX(item)] = 1; //ponpoko
//ZOID

// clear entity values
Expand Down Expand Up @@ -572,9 +573,14 @@ void PutBotInServer (edict_t *ent)
gi.multicast (ent->s.origin, MULTICAST_PVS);
}


if(zigrapple->value)
CTFPlayerResetGrapple(ent);

if(ctf->value)
{
CTFPlayerResetGrapple(ent);
if(!zigrapple->value)
CTFPlayerResetGrapple(ent);
client->zc.ctfstate = CTFS_OFFENCER;
}

Expand Down Expand Up @@ -807,8 +813,14 @@ void RemoveBot()
e->s.modelindex = 0;
e->solid = SOLID_NOT;

if(ctf->value) {
if(zigrapple->value)
CTFPlayerResetGrapple(e);

if(ctf->value) {

if(!zigrapple->value)
CTFPlayerResetGrapple(e);

CTFDeadDropFlag(e);
CTFDeadDropTech(e);
}
Expand Down
4 changes: 4 additions & 0 deletions src/bot/za.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,10 @@ void Bot_SearchItems (edict_t *ent)

j = 0;
q = false;//rocket jump needed

if(zigrapple->value)
if( ent->client->ctf_grapple != NULL) j = -1;

//search Items
if(ctf->value)
{
Expand Down
1 change: 1 addition & 0 deletions src/g_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ cvar_t *autospawn;
cvar_t *zigmode;
cvar_t *zigspawn;
cvar_t *zigkiller;
cvar_t *zigrapple;
cvar_t *spawnbotfar;
cvar_t *respawn_protection;
int flagbounce;
Expand Down
53 changes: 50 additions & 3 deletions src/g_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ void SP_func_areaportal (edict_t *ent)
Misc functions
=================
*/
void VelocityForHead (int damage, vec3_t v)
{
if(damage > 50)
damage = 50;

v[0] = damage * 10.0 * crandom();
v[1] = damage * 10.0 * crandom();
v[2] = 400.0 * crandom();

VectorScale (v, 0.7, v);
}

void VelocityForDamage (int damage, vec3_t v)
{
v[0] = 100.0 * crandom();
Expand Down Expand Up @@ -200,7 +212,17 @@ void ThrowHead (edict_t *self, char *gibname, int damage, int type)
vscale = 1.0;
}

VelocityForDamage (damage, vd);
if(fixflaws->value)
{
// Reduce floating heads in new physics
self->clipmask = MASK_SOLID;
self->groundentity = NULL;
self->gravity = 2.0;
VelocityForHead (damage, vd);
}
else
VelocityForDamage (damage, vd);

VectorMA (self->velocity, vscale, vd, self->velocity);
ClipGibVelocity (self);

Expand Down Expand Up @@ -294,7 +316,18 @@ void ThrowClientHead (edict_t *self, int damage)
self->flags |= FL_NO_KNOCKBACK;

self->movetype = MOVETYPE_BOUNCE;
VelocityForDamage (damage, vd);

if(fixflaws->value)
{
// Reduce floating heads in new physics
self->clipmask = MASK_SOLID;
self->groundentity = NULL;
self->gravity = 2.0;
VelocityForHead (damage, vd);
}
else
VelocityForDamage (damage, vd);

VectorAdd (self->velocity, vd, self->velocity);

if (self->client) // bodies in the queue don't have a client anymore
Expand Down Expand Up @@ -765,7 +798,15 @@ void func_object_use (edict_t *self, edict_t *other, edict_t *activator)
self->solid = SOLID_BSP;
self->svflags &= ~SVF_NOCLIENT;
self->use = NULL;

if(fixflaws->value)
gi.linkentity (self);

KillBox (self);

if(fixflaws->value)
gi.unlinkentity (self);

func_object_release (self);
}

Expand Down Expand Up @@ -896,8 +937,14 @@ void func_explosive_spawn (edict_t *self, edict_t *other, edict_t *activator)
self->solid = SOLID_BSP;
self->svflags &= ~SVF_NOCLIENT;
self->use = NULL;

if(fixflaws->value)
gi.linkentity (self);

KillBox (self);
gi.linkentity (self);

if(!fixflaws->value)
gi.linkentity (self);
}

void SP_func_explosive (edict_t *self)
Expand Down
1 change: 1 addition & 0 deletions src/g_save.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ void InitGame (void)
spawnbotfar = gi.cvar("spawnbotfar", "0", CVAR_ARCHIVE);
zigspawn = gi.cvar("zigspawn", "1", CVAR_ARCHIVE);
zigkiller = gi.cvar("zigkiller", "1", CVAR_SERVERINFO | CVAR_ARCHIVE);
zigrapple = gi.cvar("zigrapple", "0", CVAR_SERVERINFO | CVAR_ARCHIVE);
basepath = gi.cvar("basepath", ".", CVAR_NOSET);
respawn_protection = gi.cvar("respawn_protection", "0", CVAR_ARCHIVE);

Expand Down
1 change: 1 addition & 0 deletions src/header/local.h
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ extern cvar_t *autospawn;
extern cvar_t *zigmode;
extern cvar_t *zigspawn;
extern cvar_t *zigkiller;
extern cvar_t *zigrapple;
extern cvar_t *respawn_protection;
extern cvar_t *spawnbotfar;
extern cvar_t *killerflag;
Expand Down
10 changes: 8 additions & 2 deletions src/player/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,10 +615,15 @@ void player_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damag
//ZOID

TossClientWeapon (self);

if(zigrapple->value)
CTFPlayerResetGrapple(self);
//ZOID
if(ctf->value)
{
CTFPlayerResetGrapple(self);
if(!zigrapple->value)
CTFPlayerResetGrapple(self);

CTFDeadDropFlag(self);
CTFDeadDropTech(self);
}
Expand Down Expand Up @@ -726,7 +731,8 @@ void InitClientPersistant (gclient_t *client)

//ZOID
item = FindItem("Grapple");
if(ctf->value) client->pers.inventory[ITEM_INDEX(item)] = 1; //ponpoko
if(ctf->value || zigrapple->value)
client->pers.inventory[ITEM_INDEX(item)] = 1; //ponpoko
//ZOID

client->pers.health = 100;
Expand Down
Binary file modified windows/gamex86.dll
Binary file not shown.
Binary file modified windows/gamex86_64.dll
Binary file not shown.
8 changes: 4 additions & 4 deletions windows/path.diff
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ index ac62468..d9bcf86 100644

# ----------
diff --git a/src/bot/func.c b/src/bot/func.c
index c3cacca..98b7273 100644
index 22b8d6c..0beb853 100644
--- a/src/bot/func.c
+++ b/src/bot/func.c
@@ -86,8 +86,7 @@ void Load_BotInfo()
Expand Down Expand Up @@ -44,10 +44,10 @@ index 7da1da0..b7583d9 100644
fpout = fopen(name,"rb");
if(fpout == NULL)
diff --git a/src/g_main.c b/src/g_main.c
index 60648ab..23e22c4 100644
index e5b32f7..d1bea09 100644
--- a/src/g_main.c
+++ b/src/g_main.c
@@ -224,8 +224,8 @@ void Get_NextMap()
@@ -225,8 +225,8 @@ void Get_NextMap()

if(!maplist->string) return;

Expand Down Expand Up @@ -78,7 +78,7 @@ index c694cd5..7955ffc 100644
fpout = fopen(name,"wb");
if(fpout == NULL) gi.cprintf(NULL,PRINT_HIGH,"Can't open %s\n",name);
diff --git a/src/header/local.h b/src/header/local.h
index 876e3f6..de3e09a 100644
index 0c711f7..8a70923 100644
--- a/src/header/local.h
+++ b/src/header/local.h
@@ -566,10 +566,10 @@ extern int meansOfDeath;
Expand Down

0 comments on commit d1344a0

Please sign in to comment.