From fcc9643190d099cacdf4f6935b779381f5bd2113 Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Thu, 12 Sep 2019 09:11:30 +0200 Subject: [PATCH] More tweaks for both Half-Life and Opposing Force weapons and behaviour. Also added Gunman stubs. --- src/client/gearbox/progs.src | 1 + src/client/rewolf/entities.c | 26 +++ src/client/rewolf/progs.src | 29 +-- src/server/rewolf/client.c | 316 +++++++++++++++++++++++++++ src/server/rewolf/input.c | 58 +++++ src/server/rewolf/progs.src | 41 +--- src/shared/gearbox/w_m249.c | 3 +- src/shared/gearbox/w_pipewrench.c | 6 +- src/shared/gearbox/w_shockrifle.c | 6 +- src/shared/gearbox/w_sporelauncher.c | 1 + src/shared/rewolf/items.h | 51 +++++ src/shared/rewolf/w_aicore.c | 2 + src/shared/rewolf/w_beamgun.c | 2 + src/shared/rewolf/w_chemicalgun.c | 2 + src/shared/rewolf/w_dml.c | 2 + src/shared/rewolf/w_fists.c | 2 + src/shared/rewolf/w_gausspistol.c | 2 + src/shared/rewolf/w_minigun.c | 2 + src/shared/rewolf/weapons.c | 27 +++ src/shared/rewolf/weapons.h | 47 ++++ src/shared/valve/w_gauss.c | 71 +++--- src/shared/valve/w_mp5.c | 3 + 22 files changed, 612 insertions(+), 88 deletions(-) create mode 100644 src/client/rewolf/entities.c create mode 100644 src/server/rewolf/client.c create mode 100644 src/server/rewolf/input.c create mode 100644 src/shared/rewolf/items.h create mode 100644 src/shared/rewolf/w_aicore.c create mode 100644 src/shared/rewolf/w_beamgun.c create mode 100644 src/shared/rewolf/w_chemicalgun.c create mode 100644 src/shared/rewolf/w_dml.c create mode 100644 src/shared/rewolf/w_fists.c create mode 100644 src/shared/rewolf/w_gausspistol.c create mode 100644 src/shared/rewolf/w_minigun.c create mode 100644 src/shared/rewolf/weapons.c create mode 100644 src/shared/rewolf/weapons.h diff --git a/src/client/gearbox/progs.src b/src/client/gearbox/progs.src index f3eeb9b9..19f957bd 100644 --- a/src/client/gearbox/progs.src +++ b/src/client/gearbox/progs.src @@ -3,6 +3,7 @@ #define CSQC #define VALVE +#define GEARBOX #includelist ../../shared/fteextensions.qc diff --git a/src/client/rewolf/entities.c b/src/client/rewolf/entities.c new file mode 100644 index 00000000..8cb88cd7 --- /dev/null +++ b/src/client/rewolf/entities.c @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016-2019 Marco Hladik + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +int +Game_Entity_Update(float id, float new) +{ + switch (id) { + default: + return FALSE; + } + + return TRUE; +} diff --git a/src/client/rewolf/progs.src b/src/client/rewolf/progs.src index 6f760d1a..2354552d 100755 --- a/src/client/rewolf/progs.src +++ b/src/client/rewolf/progs.src @@ -40,28 +40,21 @@ decore.cpp ../../shared/spraylogo.cpp ../npc.c -../../shared/valve/items.h +../../shared/rewolf/items.h ../../shared/valve/weapon_common.h -../../shared/valve/weapons.h -../../shared/valve/w_crossbow.c -../../shared/valve/w_crowbar.c -../../shared/valve/w_egon.c -../../shared/valve/w_gauss.c -../../shared/valve/w_glock.c -../../shared/valve/w_handgrenade.c -../../shared/valve/w_hornetgun.c -../../shared/valve/w_mp5.c -../../shared/valve/w_python.c -../../shared/valve/w_rpg.c -../../shared/valve/w_satchel.c -../../shared/valve/w_shotgun.c -../../shared/valve/w_snark.c -../../shared/valve/w_tripmine.c -../../shared/valve/weapons.c +../../shared/rewolf/weapons.h +../../shared/rewolf/w_fists.c +../../shared/rewolf/w_gausspistol.c +../../shared/rewolf/w_beamgun.c +../../shared/rewolf/w_chemicalgun.c +../../shared/rewolf/w_dml.c +../../shared/rewolf/w_minigun.c +../../shared/rewolf/w_aicore.c +../../shared/rewolf/weapons.c ../../shared/valve/weapon_common.c ../valve/player.c -../valve/entities.c +entities.c ../entities.c ../valve/cmds.c diff --git a/src/server/rewolf/client.c b/src/server/rewolf/client.c new file mode 100644 index 00000000..983e36f4 --- /dev/null +++ b/src/server/rewolf/client.c @@ -0,0 +1,316 @@ +/* + * Copyright (c) 2016-2019 Marco Hladik + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +var int autocvar_sv_networkeverything = FALSE; + +void +Game_ClientConnect(void) +{ + entity a; + bprint(PRINT_HIGH, sprintf("%s connected\n", self.netname)); + + int playercount = 0; + for (a = world; (a = find(a, classname, "player"));) { + playercount++; + } + + /* we're the first. respawn all entities? */ + if (playercount == 0) { + for (a = world; (a = findfloat(a, gflags, GF_CANRESPAWN));) { + CBaseEntity caw = (CBaseEntity)a; + caw.Respawn(); + } + } +} + +void +Game_ClientDisconnect(void) +{ + bprint(PRINT_HIGH, sprintf("%s disconnected\n", self.netname)); + + /* Make this unusable */ + self.solid = SOLID_NOT; + self.movetype = MOVETYPE_NONE; + self.modelindex = 0; + self.health = 0; + self.takedamage = 0; + self.SendFlags = PLAYER_MODELINDEX; +} + +void +Game_ClientKill(void) +{ + Damage_Apply(self, self, self.health, self.origin, TRUE); +} + +void +Game_PlayerPreThink(void) +{ + +} + +void +Game_PlayerPostThink(void) +{ + player pl = (player)self; + Animation_PlayerUpdate(); + + pl.SendFlags |= PLAYER_KEEPALIVE; + + if (pl.old_modelindex != pl.modelindex) { + pl.SendFlags |= PLAYER_MODELINDEX; + } + if (pl.old_origin[0] != pl.origin[0]) { + pl.SendFlags |= PLAYER_ORIGIN; + } + if (pl.old_origin[1] != pl.origin[1]) { + pl.SendFlags |= PLAYER_ORIGIN; + } + if (pl.old_origin[2] != pl.origin[2]) { + pl.SendFlags |= PLAYER_ORIGIN_Z; + } + if (pl.old_angles[0] != pl.angles[0]) { + pl.SendFlags |= PLAYER_ANGLES_X; + } + if (pl.old_angles[1] != pl.angles[1]) { + pl.SendFlags |= PLAYER_ANGLES_Y; + } + if (pl.old_angles[2] != pl.angles[2]) { + pl.SendFlags |= PLAYER_ANGLES_Z; + } + if (pl.old_velocity[0] != pl.velocity[0]) { + pl.SendFlags |= PLAYER_VELOCITY; + } + if (pl.old_velocity[1] != pl.velocity[1]) { + pl.SendFlags |= PLAYER_VELOCITY; + } + if (pl.old_velocity[2] != pl.velocity[2]) { + pl.SendFlags |= PLAYER_VELOCITY_Z; + } + if (pl.old_flags != pl.flags) { + pl.SendFlags |= PLAYER_FLAGS; + } + if (pl.old_activeweapon != pl.activeweapon) { + pl.SendFlags |= PLAYER_WEAPON; + } + if (pl.old_items != pl.g_items) { + pl.SendFlags |= PLAYER_ITEMS; + } + if (pl.old_health != pl.health) { + pl.SendFlags |= PLAYER_HEALTH; + } + if (pl.old_armor != pl.armor) { + pl.SendFlags |= PLAYER_ARMOR; + } + if (pl.old_movetype != pl.movetype) { + pl.SendFlags |= PLAYER_MOVETYPE; + } + if (pl.old_viewofs != pl.view_ofs[2]) { + pl.SendFlags |= PLAYER_VIEWOFS; + } + if (pl.old_baseframe != pl.baseframe) { + pl.SendFlags |= PLAYER_BASEFRAME; + } + if (pl.old_frame != pl.frame) { + pl.SendFlags |= PLAYER_FRAME; + } + if (pl.old_a_ammo1 != pl.a_ammo1) { + pl.SendFlags |= PLAYER_AMMO1; + } + if (pl.old_a_ammo2 != pl.a_ammo2) { + pl.SendFlags |= PLAYER_AMMO2; + } + if (pl.old_a_ammo3 != pl.a_ammo3) { + pl.SendFlags |= PLAYER_AMMO3; + } + + pl.old_modelindex = pl.modelindex; + pl.old_origin = pl.origin; + pl.old_angles = pl.angles; + pl.old_velocity = pl.velocity; + pl.old_flags = pl.flags; + pl.old_activeweapon = pl.activeweapon; + pl.old_items = pl.g_items; + pl.old_health = pl.health; + pl.old_armor = pl.armor; + pl.old_movetype = pl.movetype; + pl.old_viewofs = pl.view_ofs[2]; + pl.old_baseframe = pl.baseframe; + pl.old_frame = pl.frame; + pl.old_a_ammo1 = pl.a_ammo1; + pl.old_a_ammo2 = pl.a_ammo2; + pl.old_a_ammo3 = pl.a_ammo3; +} +void +Game_RunClientCommand(void) +{ + Footsteps_Update(); + QPhysics_Run(self); +} + +void +Game_DecodeChangeParms(void) +{ + player pl = (player)self; + g_landmarkpos[0] = parm1; + g_landmarkpos[1] = parm2; + g_landmarkpos[2] = parm3; + pl.angles[0] = parm4; + pl.angles[1] = parm5; + pl.angles[2] = parm6; + pl.velocity[0] = parm7; + pl.velocity[1] = parm8; + pl.velocity[2] = parm9; + pl.g_items = parm10; + pl.activeweapon = parm11; +} + +void +Game_SetChangeParms(void) +{ + player pl = (player)self; + parm1 = g_landmarkpos[0]; + parm2 = g_landmarkpos[1]; + parm3 = g_landmarkpos[2]; + parm4 = pl.angles[0]; + parm5 = pl.angles[1]; + parm6 = pl.angles[2]; + parm7 = pl.velocity[0]; + parm8 = pl.velocity[1]; + parm9 = pl.velocity[2]; + parm10 = pl.g_items; + parm11 = pl.activeweapon; +} + +void +Game_PutClientInServer(void) +{ + if (self.classname != "player") { + spawnfunc_player(); + } + player pl = (player)self; + + entity spot; + pl.classname = "player"; + pl.health = self.max_health = 100; + + pl.takedamage = DAMAGE_YES; + pl.solid = SOLID_SLIDEBOX; + pl.movetype = MOVETYPE_WALK; + pl.flags = FL_CLIENT; + pl.viewzoom = 1.0; + pl.model = "models/player.mdl"; + + string mymodel = infokey(pl, "model"); + + if (mymodel) { + mymodel = sprintf("models/player/%s/%s.mdl", mymodel, mymodel); + if (whichpack(mymodel)) { + pl.model = mymodel; + } + } + setmodel(pl, pl.model); + + setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX); + pl.view_ofs = VEC_PLAYER_VIEWPOS; + pl.velocity = [0,0,0]; + pl.gravity = __NULL__; + pl.frame = 1; + pl.SendEntity = Player_SendEntity; + pl.SendFlags = UPDATE_ALL; + + pl.customphysics = Empty; + pl.vPain = Player_Pain; + pl.vDeath = Player_Death; + pl.iBleeds = TRUE; + forceinfokey(pl, "*spec", "0"); + forceinfokey(self, "*deaths", ftos(self.deaths)); + + if (cvar("sv_playerslots") == 1) { + Game_DecodeChangeParms(); + + if (startspot != "") { + setorigin(pl, Landmark_GetSpot()); + } else { + spot = find(world, classname, "info_player_start"); + setorigin(pl, spot.origin); + pl.angles = spot.angles; + pl.fixangle = TRUE; + } + } else { + spot = Spawn_SelectRandom("info_player_deathmatch"); + setorigin(pl, spot.origin); + pl.angles = spot.angles; + pl.fixangle = TRUE; + pl.g_items |= ITEM_SUIT; + } +} + +void +SV_SendChat(entity sender, string msg, entity eEnt, float fType) +{ + WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); + WriteByte(MSG_MULTICAST, fType == 0 ? EV_CHAT:EV_CHAT_TEAM); + WriteByte(MSG_MULTICAST, num_for_edict(sender) - 1); + WriteByte(MSG_MULTICAST, sender.team); + WriteString(MSG_MULTICAST, msg); + if (eEnt) { + msg_entity = eEnt; + multicast([0,0,0], MULTICAST_ONE); + } else { + multicast([0,0,0], MULTICAST_ALL); + } + + localcmd(sprintf("echo [SERVER] %s: %s\n", sender.netname, msg)); +} + +void +Game_ParseClientCommand(string cmd) +{ + tokenize(cmd); + + if (argv(1) == "timeleft") { + string msg; + string timestring; + float timeleft; + timeleft = cvar("mp_timelimit") - (time / 60); + timestring = Vox_TimeToString(timeleft); + msg = sprintf("we have %s minutes remaining", timestring); + Vox_Singlecast(self, msg); + return; + } + + if (argv(0) == "say") { + SV_SendChat(self, argv(1), world, 0); + return; + } else if (argv(0) == "say_team") { + entity a; + for (a = world; (a = find(a, classname, "player"));) { + if (a.team == self.team) { + SV_SendChat(self, argv(1), a, 1); + } + } + return; + } + + clientcommand(self, cmd); +} + +void +Game_SetNewParms(void) +{ + +} diff --git a/src/server/rewolf/input.c b/src/server/rewolf/input.c new file mode 100644 index 00000000..48d9c881 --- /dev/null +++ b/src/server/rewolf/input.c @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2016-2019 Marco Hladik + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +void +Game_Input(void) +{ + if (input_buttons & INPUT_BUTTON0) { + Weapons_Primary(); + } else if (input_buttons & INPUT_BUTTON4) { + Weapons_Reload(); + } else if (input_buttons & INPUT_BUTTON3) { + Weapons_Secondary(); + } else { + Weapons_Release(); + } + + if (input_buttons & INPUT_BUTTON5) { + Player_UseDown(); + } else { + Player_UseUp(); + } + + if (self.impulse == 100) { + Flashlight_Toggle(); + } + + if (cvar("sv_cheats") == 1) { + player pl = (player)self; + if (self.impulse == 101) { + pl.health = 100; + pl.armor = 100; + } + + if (self.impulse == 102) { + // Respawn all the entities + for (entity a = world; (a = findfloat(a, gflags, GF_CANRESPAWN));) { + CBaseEntity caw = (CBaseEntity)a; + caw.Respawn(); + } + bprint(PRINT_HIGH, "Respawning all map entities...\n"); + } + } + + self.impulse = 0; +} diff --git a/src/server/rewolf/progs.src b/src/server/rewolf/progs.src index ef296d30..0dc836e0 100755 --- a/src/server/rewolf/progs.src +++ b/src/server/rewolf/progs.src @@ -14,10 +14,8 @@ ../../shared/entities.h ../../shared/valve/animations.h ../defs.h - ../plugins.c ../logging.c - ../../gs-entbase/server.src ../valve/monster_rat.cpp ../valve/monster_scientist_dead.cpp @@ -27,32 +25,23 @@ monster_human_chopper.cpp monster_human_demoman.cpp monster_human_gunman.cpp monster_human_unarmed.cpp - ../../shared/decals.c ../../shared/effects.c ../../shared/spraylogo.cpp - ../../shared/valve/player.cpp ../valve/player.c ../../shared/pmove.c ../valve/spectator.c -../../shared/valve/items.h +../../shared/rewolf/items.h ../../shared/valve/weapon_common.h -../../shared/valve/weapons.h -../../shared/valve/w_crossbow.c -../../shared/valve/w_crowbar.c -../../shared/valve/w_egon.c -../../shared/valve/w_gauss.c -../../shared/valve/w_glock.c -../../shared/valve/w_handgrenade.c -../../shared/valve/w_hornetgun.c -../../shared/valve/w_mp5.c -../../shared/valve/w_python.c -../../shared/valve/w_rpg.c -../../shared/valve/w_satchel.c -../../shared/valve/w_shotgun.c -../../shared/valve/w_snark.c -../../shared/valve/w_tripmine.c +../../shared/rewolf/weapons.h +../../shared/rewolf/w_fists.c +../../shared/rewolf/w_gausspistol.c +../../shared/rewolf/w_beamgun.c +../../shared/rewolf/w_chemicalgun.c +../../shared/rewolf/w_dml.c +../../shared/rewolf/w_minigun.c +../../shared/rewolf/w_aicore.c ../valve/items.cpp ../valve/item_longjump.cpp ../valve/item_suit.cpp @@ -61,26 +50,20 @@ monster_human_unarmed.cpp ../valve/item_weaponbox.cpp ../valve/world_items.cpp ../valve/ammo.cpp -../../shared/valve/weapons.c +../../shared/rewolf/weapons.c ../../shared/valve/weapon_common.c - ../spawn.c ../vox.c - ../../shared/valve/animations.c -../valve/client.c +client.c ../client.c - ../valve/server.c ../server.c - ../valve/damage.c ../traceattack.c - ../footsteps.c ../flashlight.c -../valve/input.c - +input.c ../valve/spawn.c ../entry.c #endlist diff --git a/src/shared/gearbox/w_m249.c b/src/shared/gearbox/w_m249.c index ffbe5114..a6678202 100644 --- a/src/shared/gearbox/w_m249.c +++ b/src/shared/gearbox/w_m249.c @@ -134,7 +134,7 @@ w_m249_primary(void) Weapons_UpdateAmmo(pl, pl.m249_mag, pl.ammo_556, __NULL__); #endif - pl.w_attack_next = 0.1f; + pl.w_attack_next = 0.075f; pl.w_idle_next = 10.0f; } @@ -178,6 +178,7 @@ void w_m249_release(void) { player pl = (player)self; + if (pl.w_idle_next > 0.0) { return; } diff --git a/src/shared/gearbox/w_pipewrench.c b/src/shared/gearbox/w_pipewrench.c index ca11fc5f..ba70a14b 100644 --- a/src/shared/gearbox/w_pipewrench.c +++ b/src/shared/gearbox/w_pipewrench.c @@ -108,9 +108,9 @@ w_pipewrench_primary(void) traceline(src, src + (v_forward * 32), FALSE, pl); if (trace_fraction >= 1.0) { - pl.w_attack_next = 0.9f; - } else { pl.w_attack_next = 0.7f; + } else { + pl.w_attack_next = 0.53f; } pl.w_idle_next = 2.5f; @@ -181,7 +181,7 @@ w_pipewrench_secondary(void) if (pl.a_ammo1 != 1) { Weapons_ViewAnimation(PIPE_ATTACKBIGWIND); pl.a_ammo1 = 1; - pl.w_attack_next = 0.86f; + pl.w_attack_next = 0.75f; } } pl.w_idle_next = 2.5f; diff --git a/src/shared/gearbox/w_shockrifle.c b/src/shared/gearbox/w_shockrifle.c index 44475c48..9cf628d3 100644 --- a/src/shared/gearbox/w_shockrifle.c +++ b/src/shared/gearbox/w_shockrifle.c @@ -127,13 +127,13 @@ w_shockrifle_release(void) #ifdef CSQC if (pl.a_ammo2 < 10) { pl.a_ammo2 = bound(0, pl.a_ammo2 + 1, 10); - pl.w_idle_next = 0.5f; + pl.w_idle_next = 0.35f; } #else if (pl.ammo_shock < 10) { pl.ammo_shock = bound(0, pl.ammo_shock + 1, 10); Weapons_UpdateAmmo(pl, -1, pl.ammo_shock, -1); - pl.w_idle_next = 0.5f; + pl.w_idle_next = 0.35f; } #endif @@ -183,7 +183,7 @@ w_shockrifle_primary(void) Weapons_ViewAnimation(SHOCKRIFLE_SHOOT); pl.w_attack_next = 0.1f; - pl.w_idle_next = 0.75f; + pl.w_idle_next = 0.5f; } void diff --git a/src/shared/gearbox/w_sporelauncher.c b/src/shared/gearbox/w_sporelauncher.c index 66a3054e..80f62fae 100644 --- a/src/shared/gearbox/w_sporelauncher.c +++ b/src/shared/gearbox/w_sporelauncher.c @@ -170,6 +170,7 @@ void w_sporelauncher_reload(void) { player pl = (player)self; + #ifdef CSQC if (pl.a_ammo1 >= 5) { return; diff --git a/src/shared/rewolf/items.h b/src/shared/rewolf/items.h new file mode 100644 index 00000000..b8221ccd --- /dev/null +++ b/src/shared/rewolf/items.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2016-2019 Marco Hladik + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#define ITEM_FISTS 0x00000001i +#define ITEM_GAUSSPISTOL 0x00000002i +#define ITEM_BEAMGUN 0x00000004i +#define ITEM_CHEMICALGUN 0x00000008i +#define ITEM_DML 0x00000010i +#define ITEM_MINIGUN 0x00000020i +#define ITEM_AICORE 0x00000040i +#define ITEM_UNUSED8 0x00000080i + +#define ITEM_UNUSED9 0x00000100i +#define ITEM_UNUSED10 0x00000200i +#define ITEM_UNUSED11 0x00000400i +#define ITEM_UNUSED12 0x00000800i +#define ITEM_UNUSED13 0x00001000i +#define ITEM_UNUSED14 0x00002000i +#define ITEM_SUIT 0x00004000i +#define ITEM_LONGJUMP 0x00008000i + +#define ITEM_UNUSED17 0x00010000i +#define ITEM_UNUSED18 0x00020000i +#define ITEM_UNUSED19 0x00040000i +#define ITEM_UNUSED20 0x00080000i +#define ITEM_UNUSED21 0x00100000i +#define ITEM_UNUSED22 0x00200000i +#define ITEM_UNUSED23 0x00400000i +#define ITEM_UNUSED24 0x00800000i + +#define ITEM_UNUSED25 0x01000000i +#define ITEM_UNUSED26 0x02000000i +#define ITEM_UNUSED27 0x04000000i +#define ITEM_UNUSED28 0x08000000i +#define ITEM_UNUSED29 0x10000000i +#define ITEM_UNUSED30 0x20000000i +#define ITEM_UNUSED31 0x40000000i +#define ITEM_UNUSED32 0x80000000i diff --git a/src/shared/rewolf/w_aicore.c b/src/shared/rewolf/w_aicore.c new file mode 100644 index 00000000..9b0cd0ca --- /dev/null +++ b/src/shared/rewolf/w_aicore.c @@ -0,0 +1,2 @@ + +weapon_t w_aicore = {}; diff --git a/src/shared/rewolf/w_beamgun.c b/src/shared/rewolf/w_beamgun.c new file mode 100644 index 00000000..2cb9182e --- /dev/null +++ b/src/shared/rewolf/w_beamgun.c @@ -0,0 +1,2 @@ + +weapon_t w_beamgun = {}; diff --git a/src/shared/rewolf/w_chemicalgun.c b/src/shared/rewolf/w_chemicalgun.c new file mode 100644 index 00000000..b7e8caa7 --- /dev/null +++ b/src/shared/rewolf/w_chemicalgun.c @@ -0,0 +1,2 @@ + +weapon_t w_chemicalgun = {}; diff --git a/src/shared/rewolf/w_dml.c b/src/shared/rewolf/w_dml.c new file mode 100644 index 00000000..da771706 --- /dev/null +++ b/src/shared/rewolf/w_dml.c @@ -0,0 +1,2 @@ + +weapon_t w_dml = {}; diff --git a/src/shared/rewolf/w_fists.c b/src/shared/rewolf/w_fists.c new file mode 100644 index 00000000..a0d8fd83 --- /dev/null +++ b/src/shared/rewolf/w_fists.c @@ -0,0 +1,2 @@ + +weapon_t w_fists = {}; diff --git a/src/shared/rewolf/w_gausspistol.c b/src/shared/rewolf/w_gausspistol.c new file mode 100644 index 00000000..75ea67c0 --- /dev/null +++ b/src/shared/rewolf/w_gausspistol.c @@ -0,0 +1,2 @@ + +weapon_t w_gausspistol = {}; diff --git a/src/shared/rewolf/w_minigun.c b/src/shared/rewolf/w_minigun.c new file mode 100644 index 00000000..d2e075bc --- /dev/null +++ b/src/shared/rewolf/w_minigun.c @@ -0,0 +1,2 @@ + +weapon_t w_minigun = {}; diff --git a/src/shared/rewolf/weapons.c b/src/shared/rewolf/weapons.c new file mode 100644 index 00000000..7fa19f6f --- /dev/null +++ b/src/shared/rewolf/weapons.c @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016-2019 Marco Hladik + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +weapon_t w_null = {}; +weapon_t g_weapons[] = { + w_null, + w_fists, + w_gausspistol, + w_beamgun, + w_chemicalgun, + w_dml, + w_minigun, + w_aicore +}; diff --git a/src/shared/rewolf/weapons.h b/src/shared/rewolf/weapons.h new file mode 100644 index 00000000..dad24192 --- /dev/null +++ b/src/shared/rewolf/weapons.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2016-2019 Marco Hladik + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* Weapon Indices for the weapon table */ +enum +{ + WEAPON_NONE, + WEAPON_FISTS, + WEAPON_GAUSSPISTOL, + WEAPON_BEAMGUN, + WEAPON_CHEMICALGUN, + WEAPON_DML, + WEAPON_MINIGUN, + WEAPON_AICORE +}; + +/* What the weapons do support and stuff */ +enum +{ + AMMO_9MM, + AMMO_357, + AMMO_BUCKSHOT, + AMMO_M203_GRENADE, + AMMO_BOLT, + AMMO_ROCKET, + AMMO_URANIUM, + AMMO_HANDGRENADE, + AMMO_SATCHEL, + AMMO_TRIPMINE, + AMMO_SNARK, + AMMO_556, + AMMO_762, + AMMO_SPORE +}; diff --git a/src/shared/valve/w_gauss.c b/src/shared/valve/w_gauss.c index f705d92a..efeb55ac 100644 --- a/src/shared/valve/w_gauss.c +++ b/src/shared/valve/w_gauss.c @@ -302,46 +302,49 @@ void w_gauss_secondary(void) void w_gauss_release(void) { - player pl = (player)self; - if (pl.w_idle_next > 0.0) { - return; - } - - /* Reset the pitch sound shift */ - pl.a_ammo1 = 0; + player pl = (player)self; + if (pl.w_idle_next > 0.0) { + return; + } - if (pl.a_ammo3 == 1) { - pl.w_attack_next = 0.0f; - pl.w_idle_next = 4.0f; - w_gauss_primary(); - pl.a_ammo3 = 0; - return; - } else if (pl.a_ammo3 == 2) { - w_gauss_fire(0); - Weapons_ViewAnimation(GAUSS_FIRE1); + /* Reset the pitch sound shift */ + pl.a_ammo1 = 0; + if (pl.a_ammo3 == 1) { + pl.w_attack_next = 0.0f; + pl.w_idle_next = 4.0f; + w_gauss_primary(); + pl.a_ammo3 = 0; + return; + } else if (pl.a_ammo3 == 2) { + w_gauss_fire(0); + Weapons_ViewAnimation(GAUSS_FIRE1); #ifdef CSQC soundupdate(pl, CHAN_WEAPON, "", -1, ATTN_NORM, 0, 0, 0); #endif - pl.w_attack_next = 1.5f; - pl.w_idle_next = 4.0f; - pl.a_ammo3 = 0; - return; - } + pl.w_attack_next = 1.5f; + pl.w_idle_next = 4.0f; + pl.a_ammo3 = 0; + return; + } - int r = floor(random(0,3)); - switch (r) { - case 0: - Weapons_ViewAnimation(GAUSS_IDLE1); - break; - case 1: - Weapons_ViewAnimation(GAUSS_IDLE2); - break; - case 2: - Weapons_ViewAnimation(GAUSS_FIDGET); - break; - } - pl.w_idle_next = 3.0f; + int r = (float)input_sequence % 3; + switch (r) { + case 1: + Weapons_ViewAnimation(GAUSS_IDLE2); + pl.w_idle_next = 4.0f; + break; +#ifndef GEARBOX + case 2: + Weapons_ViewAnimation(GAUSS_FIDGET); + pl.w_idle_next = 3.0f; + break; +#endif + default: + Weapons_ViewAnimation(GAUSS_IDLE1); + pl.w_idle_next = 4.0f; + break; + } } void w_gauss_reload(void) diff --git a/src/shared/valve/w_mp5.c b/src/shared/valve/w_mp5.c index 3668178f..e167930f 100644 --- a/src/shared/valve/w_mp5.c +++ b/src/shared/valve/w_mp5.c @@ -21,6 +21,9 @@ enum { MP5_GRENADE, MP5_RELOAD, MP5_DRAW, +#ifdef GEARBOX + MP5_DEPLOY, /* not sure what this is about */ +#endif MP5_FIRE1, MP5_FIRE2, MP5_FIRE3