w_chainsaw: move towards the victim you're cutting with that thing. Ala scihunt

This commit is contained in:
Marco Cawthorne 2019-03-06 20:23:31 +01:00
parent 2df5e2884e
commit 5b58351619
5 changed files with 35 additions and 27 deletions

View file

@ -121,12 +121,7 @@ void Game_PutClientInServer(void)
pl.angles = spot.angles; pl.angles = spot.angles;
pl.fixangle = TRUE; pl.fixangle = TRUE;
pl.ammo_9mm = 68; SHData_GetItems();
pl.ammo_buckshot = 34;
Weapons_AddItem(pl, WEAPON_CROWBAR);
Weapons_AddItem(pl, WEAPON_GLOCK);
Weapons_AddItem(pl, WEAPON_CANNON);
Weapons_AddItem(pl, WEAPON_CHAINSAW);
} }
} }

View file

@ -37,27 +37,7 @@ void Game_Input(void)
if (cvar("sv_cheats") == 1) { if (cvar("sv_cheats") == 1) {
player pl = (player)self; player pl = (player)self;
if (self.impulse == 101) {
Weapons_AddItem(pl, WEAPON_CROWBAR);
Weapons_AddItem(pl, WEAPON_GLOCK);
Weapons_AddItem(pl, WEAPON_PYTHON);
Weapons_AddItem(pl, WEAPON_MP5);
Weapons_AddItem(pl, WEAPON_SHOTGUN);
Weapons_AddItem(pl, WEAPON_CROSSBOW);
Weapons_AddItem(pl, WEAPON_RPG);
Weapons_AddItem(pl, WEAPON_GAUSS);
Weapons_AddItem(pl, WEAPON_EGON);
Weapons_AddItem(pl, WEAPON_HORNETGUN);
Weapons_AddItem(pl, WEAPON_HANDGRENADE);
Weapons_AddItem(pl, WEAPON_SATCHEL);
Weapons_AddItem(pl, WEAPON_TRIPMINE);
Weapons_AddItem(pl, WEAPON_SNARK);
Weapons_AddItem(pl, WEAPON_CANNON);
Weapons_AddItem(pl, WEAPON_CHAINSAW);
Weapons_AddItem(pl, WEAPON_HAMMER);
Weapons_AddItem(pl, AMMO_BUCKSHOT);
}
if (self.impulse == 102) { if (self.impulse == 102) {
// Respawn all the entities // Respawn all the entities
for (entity a = world; (a = findfloat(a, gflags, GF_CANRESPAWN));) { for (entity a = world; (a = findfloat(a, gflags, GF_CANRESPAWN));) {

View file

@ -6,6 +6,8 @@
* *
****/ ****/
string g_shItemList;
void SHData_New(void) void SHData_New(void)
{ {
entity new = spawn(); entity new = spawn();
@ -51,6 +53,32 @@ void SHData_NewAngles(void)
self = oldself; self = oldself;
} }
void SHData_GetItems(void)
{
player pl = (player)self;
/* TODO: Parse the config files */
pl.ammo_9mm = 68;
pl.ammo_buckshot = 34;
Weapons_AddItem(pl, WEAPON_CROWBAR);
Weapons_AddItem(pl, WEAPON_GLOCK);
Weapons_AddItem(pl, WEAPON_PYTHON);
Weapons_AddItem(pl, WEAPON_MP5);
Weapons_AddItem(pl, WEAPON_SHOTGUN);
Weapons_AddItem(pl, WEAPON_CROSSBOW);
Weapons_AddItem(pl, WEAPON_RPG);
Weapons_AddItem(pl, WEAPON_GAUSS);
Weapons_AddItem(pl, WEAPON_EGON);
Weapons_AddItem(pl, WEAPON_HORNETGUN);
Weapons_AddItem(pl, WEAPON_HANDGRENADE);
Weapons_AddItem(pl, WEAPON_SATCHEL);
Weapons_AddItem(pl, WEAPON_TRIPMINE);
Weapons_AddItem(pl, WEAPON_SNARK);
Weapons_AddItem(pl, WEAPON_CANNON);
Weapons_AddItem(pl, WEAPON_CHAINSAW);
Weapons_AddItem(pl, WEAPON_HAMMER);
}
void SHData_Parse(string map) void SHData_Parse(string map)
{ {
int c; int c;

View file

@ -84,6 +84,11 @@ void w_chainsaw_primary(void)
Effect_Impact(IMPACT_MELEE, trace_endpos, trace_plane_normal); Effect_Impact(IMPACT_MELEE, trace_endpos, trace_plane_normal);
if (trace_ent.takedamage) { if (trace_ent.takedamage) {
if (trace_ent.iBleeds) {
/* Push the player towards the victim */
pl.velocity = normalize(trace_ent.origin - pl.origin) * 240;
}
Damage_Apply(trace_ent, self, 10, trace_endpos, FALSE ); Damage_Apply(trace_ent, self, 10, trace_endpos, FALSE );
Weapons_PlaySound(pl, CHAN_WEAPON, "sh/chainsaw_cutintoflesh.wav", 1, ATTN_NORM); Weapons_PlaySound(pl, CHAN_WEAPON, "sh/chainsaw_cutintoflesh.wav", 1, ATTN_NORM);
} else { } else {

BIN
scihunt/csprogs.dat Normal file

Binary file not shown.