Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added crhook hook style #304

Merged
merged 3 commits into from
Aug 14, 2023
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
1 change: 1 addition & 0 deletions include/g_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,7 @@ void vote_check_all(void);
#define OV_HOOKSMOOTH (VOTE_FOFS ( hooksmooth ) )
#define OV_HOOKFAST (VOTE_FOFS ( hookfast ) )
#define OV_HOOKCLASSIC (VOTE_FOFS ( hookclassic ) )
#define OV_HOOKCRHOOK (VOTE_FOFS ( hookcrhook ) )
#define OV_ANTILAG ( VOTE_FOFS ( antilag ) )
#define OV_PRIVATE ( VOTE_FOFS ( privategame ) )
//#define OV_KICKUNAUTHED ( VOTE_FOFS (kick_unauthed) )
Expand Down
1 change: 1 addition & 0 deletions include/progs.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ typedef struct vote_s
int hooksmooth;
int hookfast;
int hookclassic;
int hookcrhook;
int antilag;
int privategame;
//int kick_unauthed;
Expand Down
3 changes: 3 additions & 0 deletions src/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ void nohook();
void hooksmooth();
void hookfast();
void hookclassic();
void hookcrhook();
void noga();
void mctf();
void CTFBasedSpawn();
Expand Down Expand Up @@ -519,6 +520,7 @@ const char CD_NODESC[] = "no desc";
#define CD_HOOKSMOOTH "switch Hook style settings: Smooth Hook (CTF)"
#define CD_HOOKFAST "switch Hook style settings: Fast Hook (CTF)"
#define CD_HOOKCLASSIC "switch Hook style settings: Classic Hook (CTF)"
#define CD_HOOKCRHOOK "switch Hook style settings: crhook (CTF)"
#define CD_NORUNES "toggle runes (CTF)"
#define CD_NOGA "toggle green armor on spawn (CTF)"
#define CD_MCTF "disable hook+runes (CTF)"
Expand Down Expand Up @@ -882,6 +884,7 @@ cmd_t cmds[] =
{ "hook_smooth", hooksmooth, 0, CF_PLAYER | CF_MATCHLESS, CD_HOOKSMOOTH },
{ "hook_fast", hookfast, 0, CF_PLAYER | CF_MATCHLESS, CD_HOOKFAST },
{ "hook_classic", hookclassic, 0, CF_PLAYER | CF_MATCHLESS, CD_HOOKCLASSIC },
{ "hook_crhook", hookcrhook, 0, CF_PLAYER | CF_MATCHLESS, CD_HOOKCRHOOK },
{ "norunes", norunes, 0, CF_PLAYER | CF_MATCHLESS, CD_NORUNES },
{ "noga", noga, 0, CF_BOTH_ADMIN | CF_MATCHLESS, CD_NOGA },
{ "mctf", mctf, 0, CF_BOTH_ADMIN | CF_MATCHLESS, CD_MCTF },
Expand Down
21 changes: 19 additions & 2 deletions src/grapple.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

#define PULL_SPEED 800
#define THROW_SPEED 800
#define CR_THROW_SPEED 1050
#define NEW_THROW_SPEED 1050
#define CR_THROW_SPEED 1200
#define HOOK_FIRE_RATE 0.192

void SpawnBlood(vec3_t dest, float damage);
Expand Down Expand Up @@ -221,6 +222,11 @@ void UpdateChain()
{
CancelHook(owner);
}

if (cvar("k_ctf_hookstyle") == 4)
{
CancelHook(owner);
}
}

VectorSubtract(owner->hook->s.v.origin, owner->s.v.origin, temp);
Expand Down Expand Up @@ -429,7 +435,18 @@ void GrappleThrow()
}

float hasteMultiplier = (cvar("k_ctf_rune_power_hst") / 16) + 1;
float throwSpeed = cvar("k_ctf_hookstyle") != 3 ? CR_THROW_SPEED : THROW_SPEED;

float throwSpeed = NEW_THROW_SPEED;

if (cvar("k_ctf_hookstyle") == 3)
{
throwSpeed = THROW_SPEED;
}
else if (cvar("k_ctf_hookstyle") == 4)
{
throwSpeed = CR_THROW_SPEED;
}

g_globalvars.msg_entity = EDICT_TO_PROG(self);
WriteByte( MSG_ONE, SVC_SMALLKICK);

Expand Down
44 changes: 44 additions & 0 deletions src/vote.c
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,50 @@ void hookclassic()
}
}

void hookcrhook()
{
int votes, veto;

if (match_in_progress)
{
G_sprint(self, 2, "hook style can not be changed while match is in progress\n");

return;
}

if (!isCTF())
{
G_sprint(self, 2, "hook style can only be set in CTF mode\n");

return;
}
if (intermission_running || match_over)
{
return;
}

self->v.hookcrhook = !self->v.hookcrhook;

G_bprint(
2,
"%s %s!%s\n",
self->netname,
(self->v.hookcrhook ?
redtext("votes for crhook") :
redtext(va("withdraws %s hookstyle vote", g_his(self)))),
((votes = get_votes_req(OV_HOOKCRHOOK, true)) ? va(" (%d)", votes) : ""));

veto = is_admins_vote(OV_HOOKCRHOOK);

if (veto || !get_votes_req(OV_HOOKCRHOOK, true))
{
cvar_fset("k_ctf_hookstyle", 4);
G_bprint(2, "%s\n", redtext(va("hook style set to crhook by %s", veto ? "admin veto" : "majority vote")));
vote_clear(OV_HOOKCRHOOK);
return;
}
}

// }

// { antilag vote feature
Expand Down