Fixes against Nuclide 'Develop'

This commit is contained in:
Marco Cawthorne 2024-07-10 22:39:27 -07:00
parent 3f9a4799d8
commit 9ebc54a6f1
Signed by: eukara
GPG key ID: CE2032F0A2882A22
25 changed files with 220 additions and 1705 deletions

View file

@ -1,4 +1,4 @@
CC=fteqcc QCC=fteqcc
all: all:
$(CC) progs.src $(QCC) progs.src

View file

@ -16,6 +16,7 @@
#include "../../../valve/src/client/obituary.h" #include "../../../valve/src/client/obituary.h"
#include "../../../valve/src/client/particles.h" #include "../../../valve/src/client/particles.h"
#include "../../../valve/src/client/hud_sprite.h"
var int autocvar_cl_autoweaponswitch = TRUE; var int autocvar_cl_autoweaponswitch = TRUE;

View file

@ -14,25 +14,22 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
weapon_t w_null = {}; int
weapon_t g_weapons[] = { ClientGame_EntityUpdate(float id, float new)
w_null, {
w_crowbar, switch (id) {
w_hammer, case ENT_TRIPMINE:
w_chainsaw, NSENTITY_READENTITY(HLTripmine, new)
w_needle, break;
w_glock, case ENT_WEAPON:
w_python, NSENTITY_READENTITY(HLWeapon, new)
w_mp5, break;
w_shotgun, case ENT_PLAYER:
w_crossbow, NSENTITY_READENTITY(SHPlayer, new)
w_cannon, break;
w_rpg, default:
w_gauss, return (0);
w_egon, }
w_hornetgun,
w_handgrenade, return (1);
w_satchel, }
w_tripmine,
w_snark
};

View file

@ -148,7 +148,7 @@ void
HUD_DrawHealth(void) HUD_DrawHealth(void)
{ {
vector pos; vector pos;
player pl = (player)pSeat->m_ePlayer; NSClientPlayer pl = (NSClientPlayer)pSeat->m_ePlayer;
if (pl.health != pSeatLocal->m_iHealthOld) { if (pl.health != pSeatLocal->m_iHealthOld) {
pSeatLocal->m_flHealthAlpha = 1.0; pSeatLocal->m_flHealthAlpha = 1.0;
@ -195,7 +195,7 @@ void
HUD_DrawArmor(void) HUD_DrawArmor(void)
{ {
vector pos; vector pos;
player pl = (player)pSeat->m_ePlayer; SHPlayer pl = (SHPlayer)pSeat->m_ePlayer;
pos = g_hudmins + [198, g_hudres[1] - 42]; pos = g_hudmins + [198, g_hudres[1] - 42];
@ -242,7 +242,7 @@ HUD_DrawArmor(void)
void void
HUD_DrawAmmo1(void) HUD_DrawAmmo1(void)
{ {
player pl = (player)pSeat->m_ePlayer; SHPlayer pl = (SHPlayer)pSeat->m_ePlayer;
vector pos; vector pos;
if (pl.a_ammo1 != pSeatLocal->m_iAmmo1Old) { if (pl.a_ammo1 != pSeatLocal->m_iAmmo1Old) {
@ -265,7 +265,7 @@ HUD_DrawAmmo1(void)
void void
HUD_DrawAmmo2(void) HUD_DrawAmmo2(void)
{ {
player pl = (player)pSeat->m_ePlayer; SHPlayer pl = (SHPlayer)pSeat->m_ePlayer;
vector pos; vector pos;
if (pl.a_ammo2 != pSeatLocal->m_iAmmo2Old) { if (pl.a_ammo2 != pSeatLocal->m_iAmmo2Old) {
@ -287,7 +287,7 @@ HUD_DrawAmmo2(void)
void void
HUD_DrawAmmo3(void) HUD_DrawAmmo3(void)
{ {
player pl = (player)pSeat->m_ePlayer; SHPlayer pl = (SHPlayer)pSeat->m_ePlayer;
vector pos; vector pos;
if (pl.a_ammo3 != pSeatLocal->m_iAmmo3Old) { if (pl.a_ammo3 != pSeatLocal->m_iAmmo3Old) {
@ -323,7 +323,7 @@ void
HUD_DrawFlashlight(void) HUD_DrawFlashlight(void)
{ {
vector pos; vector pos;
player pl = (player)pSeat->m_ePlayer; SHPlayer pl = (SHPlayer)pSeat->m_ePlayer;
pos = g_hudmins + [g_hudres[0] - 48, 16]; pos = g_hudmins + [g_hudres[0] - 48, 16];
/* both on, draw both sprites at full intensity */ /* both on, draw both sprites at full intensity */
@ -399,7 +399,7 @@ HUD_DrawLogo(void)
void void
HUD_DrawNotify(void) HUD_DrawNotify(void)
{ {
player pl = (player)self; SHPlayer pl = (SHPlayer)self;
vector pos; vector pos;
float a; float a;
@ -414,7 +414,7 @@ HUD_DrawNotify(void)
a = bound(0.0, pSeatLocal->m_flPickupAlpha, 1.0); a = bound(0.0, pSeatLocal->m_flPickupAlpha, 1.0);
pos[1] += 48 * (1.0 - a); pos[1] += 48 * (1.0 - a);
Weapons_HUDPic(pl, pSeatLocal->m_iPickupWeapon, 1, pos, a); //Weapons_HUDPic(pl, pSeatLocal->m_iPickupWeapon, 1, pos, a);
HUD_ItemNotify_Draw(pos); HUD_ItemNotify_Draw(pos);
HUD_AmmoNotify_Draw(pos); HUD_AmmoNotify_Draw(pos);
pSeatLocal->m_flPickupAlpha -= (clframetime * 0.5); pSeatLocal->m_flPickupAlpha -= (clframetime * 0.5);
@ -423,6 +423,7 @@ HUD_DrawNotify(void)
void void
HUD_WeaponPickupNotify(int w) HUD_WeaponPickupNotify(int w)
{ {
#if 0
#if defined (VALVE) || defined (GEARBOX) #if defined (VALVE) || defined (GEARBOX)
switch (w) { switch (w) {
case WEAPON_SNARK: case WEAPON_SNARK:
@ -436,7 +437,7 @@ HUD_WeaponPickupNotify(int w)
default: default:
} }
#endif #endif
#endif
pSeatLocal->m_iPickupWeapon = w; pSeatLocal->m_iPickupWeapon = w;
pSeatLocal->m_flPickupAlpha = 2.5f; pSeatLocal->m_flPickupAlpha = 2.5f;
} }
@ -468,7 +469,7 @@ HUD_DrawDamageIndicator(void)
void void
HUD_DrawInsanityIcon(void) HUD_DrawInsanityIcon(void)
{ {
player pl = (player)pSeat->m_ePlayer; SHPlayer pl = (SHPlayer)pSeat->m_ePlayer;
vector pos; vector pos;
float insanityalpha; float insanityalpha;
pos = g_hudmins + [13, g_hudres[1] - 92]; pos = g_hudmins + [13, g_hudres[1] - 92];
@ -523,7 +524,7 @@ HUD_DrawInsanityIcon(void)
void void
HUD_DrawInsanityTime(void) HUD_DrawInsanityTime(void)
{ {
player pl = (player)pSeat->m_ePlayer; SHPlayer pl = (SHPlayer)pSeat->m_ePlayer;
vector pos; vector pos;
float insanecount = floor(pl.sh_insaneactive); float insanecount = floor(pl.sh_insaneactive);
@ -544,31 +545,43 @@ HUD_DrawInsanityTime(void)
} }
} }
void
HUD_TimeRemaining(void)
{
vector iconPos = g_hudmins + [16, g_hudres[1] - 64];
/* display time if timelimit is being hit */
if (serverkeyfloat("timelimit")) {
string tempstr = strcat("Time Remaining: ", Util_GetTime());
Font_DrawText_RGB(iconPos, tempstr, g_hud_color, FONT_20);
}
}
/* main entry */ /* main entry */
void void
HUD_Draw(void) HUD_Draw(void)
{ {
player pl = (player)pSeat->m_ePlayer; SHPlayer pl = (SHPlayer)pSeat->m_ePlayer;
#ifndef TFC #ifndef TFC
g_hud_color = autocvar_con_color * (1 / 255); g_hud_color = autocvar_con_color * (1 / 255);
#endif #endif
/* little point in not drawing these, even if you don't have a suit */ /* little point in not drawing these, even if you don't have a suit */
Weapons_DrawCrosshair(pl); if (pl.m_activeWeapon)
pl.m_activeWeapon.UpdateGUI();
HUD_DrawDamageIndicator(); HUD_DrawDamageIndicator();
HUD_DrawWeaponSelect(); HUD_DrawWeaponSelect();
Obituary_Draw(); Obituary_Draw();
Textmenu_Draw(); Textmenu_Draw();
if (!(pl.g_items & ITEM_SUIT)) { HUD_TimeRemaining();
if (pl.HasItem("item_suit") == false) {
return; return;
} }
HUD_DrawInsanityIcon();
HUD_DrawInsanityTime();
HUD_DamageNotify_Draw(); HUD_DamageNotify_Draw();
HUD_DrawHealth(); HUD_DrawHealth();
HUD_DrawArmor(); HUD_DrawArmor();

View file

@ -25,10 +25,9 @@ void
ClientGame_Init(float apilevel, string enginename, float engineversion) ClientGame_Init(float apilevel, string enginename, float engineversion)
{ {
Obituary_Init(); Obituary_Init();
registercommand("+sciscore"); registercommand("+sciscore");
registercommand("-sciscore"); registercommand("-sciscore");
registercommand("changeteam"); registercommand("chooseteam");
} }
void VGUI_ShowMOTD(void); void VGUI_ShowMOTD(void);
@ -47,10 +46,15 @@ ClientGame_RendererRestart(string rstr)
precache_model("models/shotgunshell.mdl"); precache_model("models/shotgunshell.mdl");
/* there's also muzzleflash.spr, but that's just MUZZLE_SMALL again */ /* there's also muzzleflash.spr, but that's just MUZZLE_SMALL again */
precache_model("sprites/muzzleflash1.spr");
precache_model("sprites/muzzleflash2.spr");
precache_model("sprites/muzzleflash3.spr");
MUZZLE_RIFLE = (int)getmodelindex("sprites/muzzleflash1.spr"); MUZZLE_RIFLE = (int)getmodelindex("sprites/muzzleflash1.spr");
MUZZLE_SMALL = (int)getmodelindex("sprites/muzzleflash2.spr"); MUZZLE_SMALL = (int)getmodelindex("sprites/muzzleflash2.spr");
MUZZLE_WEIRD = (int)getmodelindex("sprites/muzzleflash3.spr"); MUZZLE_WEIRD = (int)getmodelindex("sprites/muzzleflash3.spr");
HLSprite_Init();
Damage_Precache(); Damage_Precache();
Obituary_Precache(); Obituary_Precache();

View file

@ -5,6 +5,7 @@
#define CSQC #define CSQC
#define CLIENT #define CLIENT
#define VALVE #define VALVE
#define SCIHUNT
#define CLASSIC_VGUI #define CLASSIC_VGUI
#includelist #includelist
@ -23,7 +24,7 @@ defs.h
draw.qc draw.qc
init.qc init.qc
../../../valve/src/client/flashlight.qc ../../../valve/src/client/flashlight.qc
../../../valve/src/client/entities.qc entities.qc
cmds.qc cmds.qc
../../../valve/src/client/game_event.qc ../../../valve/src/client/game_event.qc
../../../valve/src/client/camera.qc ../../../valve/src/client/camera.qc
@ -31,9 +32,9 @@ cmds.qc
../../../valve/src/client/obituary.qc ../../../valve/src/client/obituary.qc
../../../valve/src/client/hud_ammonotify.qc ../../../valve/src/client/hud_ammonotify.qc
../../../valve/src/client/hud_dmgnotify.qc ../../../valve/src/client/hud_dmgnotify.qc
../../../valve/src/client/hud_sprite.qc
../../../valve/src/client/hud_itemnotify.qc ../../../valve/src/client/hud_itemnotify.qc
hud.qc hud.qc
../../../valve/src/client/hud_sprite.qc
../../../valve/src/client/hud_weaponselect.qc ../../../valve/src/client/hud_weaponselect.qc
../../../valve/src/client/scoreboard.qc ../../../valve/src/client/scoreboard.qc

View file

@ -1,4 +1,4 @@
CC=fteqcc QCC=fteqcc
all: all:
$(CC) progs.src $(QCC) progs.src

View file

@ -44,7 +44,7 @@ HLGameRules::IsMultiplayer(void)
void void
HLGameRules::LevelDecodeParms(NSClientPlayer pp) HLGameRules::LevelDecodeParms(NSClientPlayer pp)
{ {
player pl = (player)pp; SHPlayer pl = (SHPlayer)pp;
g_landmarkpos[0] = parm1; g_landmarkpos[0] = parm1;
g_landmarkpos[1] = parm2; g_landmarkpos[1] = parm2;
g_landmarkpos[2] = parm3; g_landmarkpos[2] = parm3;
@ -58,38 +58,12 @@ HLGameRules::LevelDecodeParms(NSClientPlayer pp)
pl.activeweapon = parm11; pl.activeweapon = parm11;
pl.flags = parm64; pl.flags = parm64;
pl.ammo_9mm = parm12;
pl.ammo_357 = parm13;
pl.ammo_buckshot = parm14;
pl.ammo_m203_grenade = parm15;
pl.ammo_bolt = parm16;
pl.ammo_rocket = parm17;
pl.ammo_uranium = parm18;
pl.ammo_handgrenade = parm19;
pl.ammo_satchel = parm20;
pl.ammo_tripmine = parm21;
pl.ammo_snark = parm22;
pl.ammo_hornet = parm23;
pl.glock_mag = parm24;
pl.mp5_mag = parm25;
pl.python_mag = parm26;
pl.shotgun_mag = parm27;
pl.crossbow_mag = parm28;
pl.rpg_mag = parm29;
pl.satchel_chg = parm30;
if (pl.flags & FL_CROUCHING) {
setsize(pl, VEC_CHULL_MIN, VEC_CHULL_MAX);
} else {
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
}
} }
void void
HLGameRules::LevelChangeParms(NSClientPlayer pp) HLGameRules::LevelChangeParms(NSClientPlayer pp)
{ {
player pl = (player)pp; SHPlayer pl = (SHPlayer)pp;
parm1 = g_landmarkpos[0]; parm1 = g_landmarkpos[0];
parm2 = g_landmarkpos[1]; parm2 = g_landmarkpos[1];
parm3 = g_landmarkpos[2]; parm3 = g_landmarkpos[2];
@ -100,27 +74,7 @@ HLGameRules::LevelChangeParms(NSClientPlayer pp)
parm8 = pl.velocity[1]; parm8 = pl.velocity[1];
parm9 = pl.velocity[2]; parm9 = pl.velocity[2];
parm64 = pl.flags; parm64 = pl.flags;
parm10 = pl.g_items;
parm11 = pl.activeweapon;
parm12 = pl.ammo_9mm;
parm13 = pl.ammo_357;
parm14 = pl.ammo_buckshot;
parm15 = pl.ammo_m203_grenade;
parm16 = pl.ammo_bolt;
parm17 = pl.ammo_rocket;
parm18 = pl.ammo_uranium;
parm19 = pl.ammo_handgrenade;
parm20 = pl.ammo_satchel;
parm21 = pl.ammo_tripmine;
parm22 = pl.ammo_snark;
parm23 = pl.ammo_hornet;
parm24 = pl.glock_mag;
parm25 = pl.mp5_mag;
parm26 = pl.python_mag;
parm27 = pl.shotgun_mag;
parm28 = pl.crossbow_mag;
parm29 = pl.rpg_mag;
parm30 = pl.satchel_chg;
} }
void void
@ -139,7 +93,7 @@ HLGameRules::LevelNewParms(void)
void void
HLGameRules::PlayerPostFrame(NSClientPlayer pp) HLGameRules::PlayerPostFrame(NSClientPlayer pp)
{ {
player pl = (player)pp; SHPlayer pl = (SHPlayer)pp;
pl.sh_insaneactive = bound(0.0f, pl.sh_insaneactive - frametime, pl.sh_insaneactive); pl.sh_insaneactive = bound(0.0f, pl.sh_insaneactive - frametime, pl.sh_insaneactive);
@ -174,7 +128,8 @@ HLGameRules::CountScientists(void)
void void
HLGameRules::ScientistKill(NSClientPlayer pp, entity sci) HLGameRules::ScientistKill(NSClientPlayer pp, entity sci)
{ {
player pl = (player)pp; SHPlayer pl = (SHPlayer)pp;
/* obituary networking */ /* obituary networking */
if (cvar("sh_announcescideath") == 1) { if (cvar("sh_announcescideath") == 1) {
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
@ -190,9 +145,11 @@ HLGameRules::ScientistKill(NSClientPlayer pp, entity sci)
/* give players a frag per scientist they kill */ /* give players a frag per scientist they kill */
pl.frags++; pl.frags++;
#if 0
/* only reward melee frags for insanity, otherwise it's a bit OP */ /* only reward melee frags for insanity, otherwise it's a bit OP */
if (g_weapons[g_dmg_iWeapon].slot != 0) if (g_weapons[g_dmg_iWeapon].slot != 0)
return; return;
#endif
if (cvar("sh_insanity") == 0) if (cvar("sh_insanity") == 0)
return; return;
@ -237,7 +194,7 @@ HLGameRules::FrameStart(void)
m_flRestockTimer = time + 120.0f; m_flRestockTimer = time + 120.0f;
for (e = world; (e = find(e, ::classname, "player"));) { for (e = world; (e = find(e, ::classname, "player"));) {
player pl = (player)e; SHPlayer pl = (SHPlayer)e;
/* Don't give spectators weapons */ /* Don't give spectators weapons */
if (pl.IsFakeSpectator() == false && pl.IsRealSpectator() == false) if (pl.IsFakeSpectator() == false && pl.IsRealSpectator() == false)
@ -278,7 +235,7 @@ HLGameRules::CheckRules(void)
void void
HLGameRules::PlayerDeath(NSClientPlayer pl) HLGameRules::PlayerDeath(NSClientPlayer pl)
{ {
player sh_pl = (player)pl; SHPlayer sh_pl = (SHPlayer)pl;
/* obituary networking */ /* obituary networking */
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
@ -307,9 +264,9 @@ HLGameRules::PlayerDeath(NSClientPlayer pl)
#ifdef VALVE #ifdef VALVE
/* explode all satchels */ /* explode all satchels */
s_satchel_detonate((entity)pl); //s_satchel_detonate((entity)pl);
/* drop their posessions into a weaponbox item */ /* drop their posessions into a weaponbox item */
weaponbox_spawn((player)pl); //weaponbox_spawn((SHPlayer)pl);
#endif #endif
/* either gib, or make a corpse */ /* either gib, or make a corpse */
@ -318,11 +275,11 @@ HLGameRules::PlayerDeath(NSClientPlayer pl)
float gibStrength = g_dmg_iDamage * 2.0f; float gibStrength = g_dmg_iDamage * 2.0f;
BreakModel_Entity(pl, gibDir, gibStrength); BreakModel_Entity(pl, gibDir, gibStrength);
} else { } else {
FX_Corpse_Spawn((player)pl, ANIM_DIESIMPLE); FX_Corpse_Spawn((SHPlayer)pl, ANIM_DIESIMPLE);
} }
/* now let's make the real client invisible */ /* now let's make the real client invisible */
pl.Death(); //pl.Death();
pl.SetTakedamage(DAMAGE_NO); pl.SetTakedamage(DAMAGE_NO);
pl.gflags &= ~GF_FLASHLIGHT; pl.gflags &= ~GF_FLASHLIGHT;
pl.gflags &= ~GF_EGONBEAM; pl.gflags &= ~GF_EGONBEAM;
@ -356,7 +313,7 @@ HLGameRules::PlayerRequestRespawn(NSClientPlayer bp)
void void
HLGameRules::PlayerSpawn(NSClientPlayer pp) HLGameRules::PlayerSpawn(NSClientPlayer pp)
{ {
player pl = (player)pp; SHPlayer pl = (SHPlayer)pp;
/* this is where the mods want to deviate */ /* this is where the mods want to deviate */
entity spot; entity spot;
@ -395,7 +352,7 @@ HLGameRules::PlayerSpawn(NSClientPlayer pp)
pl.SetInfoKey("*dead", "0"); pl.SetInfoKey("*dead", "0");
pl.SetInfoKey("*deaths", ftos(pl.deaths)); pl.SetInfoKey("*deaths", ftos(pl.deaths));
pl.SetPropData("actor_human"); pl.SetPropData("actor_human");
pl.SetCanBleed(true); pl.EnableBleeding();
/* if we have team flags set, then join a team spawn /* if we have team flags set, then join a team spawn
* search for the entity though in case we're on a non scihunt map */ * search for the entity though in case we're on a non scihunt map */
@ -440,24 +397,12 @@ HLGameRules::PlayerSpawn(NSClientPlayer pp)
} }
} }
pl.SetOrigin(spot.origin);
pl.SetAngles(spot.angles);
setorigin(pl, spot.origin);
pl.angles = spot.angles;
if (pl.IsScientist() == true) {
pl.g_items = ITEM_NEEDLE | ITEM_SUIT;
pl.activeweapon = WEAPON_NEEDLE;
} else {
pl.g_items = ITEM_CROWBAR | ITEM_GLOCK | ITEM_SUIT;
pl.activeweapon = WEAPON_GLOCK;
pl.glock_mag = 18;
pl.ammo_9mm = 44;
}
Weapons_RefreshAmmo(pl);
SHData_GetItems(pl);
Client_FixAngle(pl, pl.angles); Client_FixAngle(pl, pl.angles);
pl.GiveItem("item_suit");
SHData_GetItems(pl);
} }
void void
@ -500,7 +445,7 @@ HLGameRules::HLGameRules(void)
if (cvar("sh_levelexec") != 0) { if (cvar("sh_levelexec") != 0) {
/* just re-read this to prevent race conditions */ /* just re-read this to prevent race conditions */
readcmd(sprintf("exec maps/%s.cfg\n", mapname)); //readcmd(sprintf("exec maps/%s.cfg\n", mapname));
} }
/* always broadcast how many max scientists the server has set /* always broadcast how many max scientists the server has set
@ -541,9 +486,8 @@ SHTeamRules::IsTeamplay(void)
void void
SHTeamRules::PlayerSpawn(NSClientPlayer pp) SHTeamRules::PlayerSpawn(NSClientPlayer pp)
{ {
player pl = (player)pp; SHPlayer pl = (SHPlayer)pp;
print(sprintf("team: %d\n", pl.team));
if (pl.team > 0) { if (pl.team > 0) {
super::PlayerSpawn(pl); super::PlayerSpawn(pl);
return; return;
@ -558,11 +502,12 @@ SHTeamRules::ScientistKill(NSClientPlayer cl, entity sci)
{ {
super::ScientistKill(cl, sci); super::ScientistKill(cl, sci);
if (cl.team == 2) if (cl.team == 2) {
AddTeam2Kill(); AddTeam2Kill();
else if (cl.team == 1) } else if (cl.team == 1) {
AddTeam1Kill(); AddTeam1Kill();
} }
}
void void
SHTeamRules::AddTeam1Kill(void) SHTeamRules::AddTeam1Kill(void)
@ -585,8 +530,9 @@ SHTeamRules::RegisterSciDeath(void)
super::RegisterSciDeath(); super::RegisterSciDeath();
/* if no scientists are left then stop */ /* if no scientists are left then stop */
if (m_iScientistsAlive > 0) if (m_iScientistsAlive > 0) {
return; return;
}
/* award the kill to the appropiate team */ /* award the kill to the appropiate team */
if (m_iKillsTeam1 > m_iKillsTeam2) { if (m_iKillsTeam1 > m_iKillsTeam2) {
@ -644,8 +590,9 @@ SHInvasionRules::RegisterSciDeath(void)
super::RegisterSciDeath(); super::RegisterSciDeath();
/* if no scientists are left then we win */ /* if no scientists are left then we win */
if (m_iScientistsAlive > 0) if (m_iScientistsAlive > 0) {
return; return;
}
env_message_broadcast("You have survived!\nCan you do it again?"); env_message_broadcast("You have survived!\nCan you do it again?");
@ -656,10 +603,8 @@ SHInvasionRules::RegisterSciDeath(void)
void void
SHInvasionRules::PlayerDeath(NSClientPlayer pl) SHInvasionRules::PlayerDeath(NSClientPlayer pl)
{ {
pl = (player)pl; pl = (SHPlayer)pl;
super::PlayerDeath(pl); super::PlayerDeath(pl);
pl.MakeTempSpectator(); pl.MakeTempSpectator();
} }
@ -705,7 +650,7 @@ void
CSEv_JoinAuto(void) CSEv_JoinAuto(void)
{ {
SHTeamRules rules = (SHTeamRules)g_grMode; SHTeamRules rules = (SHTeamRules)g_grMode;
player pl = (player)self; SHPlayer pl = (SHPlayer)self;
int red = 0; int red = 0;
int blue = 0; int blue = 0;
@ -716,22 +661,27 @@ CSEv_JoinAuto(void)
/* count for auto-balance */ /* count for auto-balance */
for (entity e = world; (e = find( e, ::classname, "player"));) { for (entity e = world; (e = find( e, ::classname, "player"));) {
if (e == pl) if (e == pl) {
continue; continue;
if (e.team == 1) }
if (e.team == 1) {
red++; red++;
if (e.team == 2) }
if (e.team == 2) {
blue++; blue++;
} }
}
/* assign to whatever team has fewer players */ /* assign to whatever team has fewer players */
if (red > blue) if (red > blue) {
pl.team = 2; pl.team = 2;
else } else {
pl.team = 1; pl.team = 1;
}
forceinfokey(pl, "*team", sprintf("%d", pl.team)); forceinfokey(pl, "*team", sprintf("%d", pl.team));
rules.PlayerSpawn(pl); rules.PlayerSpawn(pl);
} }
@ -739,7 +689,7 @@ void
CSEv_JoinTeam_f(float teamNumber) CSEv_JoinTeam_f(float teamNumber)
{ {
SHTeamRules rules = (SHTeamRules)g_grMode; SHTeamRules rules = (SHTeamRules)g_grMode;
player pl = (player)self; SHPlayer pl = (SHPlayer)self;
/* matches Game_InitRules() */ /* matches Game_InitRules() */
if (cvar("sv_playerslots") == 1 || cvar("coop") == 1) { if (cvar("sv_playerslots") == 1 || cvar("coop") == 1) {
@ -757,11 +707,8 @@ void
CSEv_JoinSpectator(void) CSEv_JoinSpectator(void)
{ {
SHTeamRules rules = (SHTeamRules)g_grMode; SHTeamRules rules = (SHTeamRules)g_grMode;
player pl = (player)self; SHPlayer pl = (SHPlayer)self;
pl.team = 0; pl.team = 0;
forceinfokey(pl, "*team", sprintf("%d", pl.team)); forceinfokey(pl, "*team", sprintf("%d", pl.team));
rules.PlayerSpawn(pl); rules.PlayerSpawn(pl);
} }

View file

@ -8,7 +8,7 @@ SHGameFear::SHGameFear(void)
void void
SHGameFear::ScientistKill(NSClientPlayer pp, entity sci) SHGameFear::ScientistKill(NSClientPlayer pp, entity sci)
{ {
player pl = (player)pp; SHPlayer pl = (SHPlayer)pp;
if (pl.IsScientist() == true) { if (pl.IsScientist() == true) {
pl.frags++; pl.frags++;

View file

@ -71,25 +71,25 @@ enum
class SHScientist:NSTalkMonster class SHScientist:NSTalkMonster
{ {
void(void) SHScientist; void SHScientist(void);
/* override */ /* override */
virtual void(void) SeeThink; virtual void SeeThink(void);
virtual float(void) GetWalkSpeed; virtual float GetWalkSpeed(void);
virtual float(void) GetChaseSpeed; virtual float GetChaseSpeed(void);
virtual float(void) GetRunSpeed; virtual float GetRunSpeed(void);
virtual void(void) PanicFrame; virtual void PanicFrame(void);
virtual void(void) Respawn; virtual void Respawn(void);
virtual void(void) Pain; virtual void Pain(entity, entity, int, vector, int);
virtual void(void) Death; virtual void Death(entity, entity, int, vector, int);
virtual void(void) PlayerUse; virtual void PlayerUse(void);
virtual void(void) TalkPanic; virtual void TalkPanic(void);
virtual int(void) AttackMelee; virtual int AttackMelee(void);
virtual void(void) AttackNeedle; virtual void AttackNeedle(void);
virtual void(void) FallNoise; virtual void FallNoise(void);
}; };
@ -200,8 +200,9 @@ SHScientist_NeedleAttack(entity target)
} }
} }
if (isHealed != true) if (isHealed != true) {
Damage_Apply(target, target.poisonSource, 10, 0, DMG_POISON); // Damage_Apply(target, target.poisonSource, 10, 0, DMG_POISON);
}
/* since corpses have "health" do an extra check */ /* since corpses have "health" do an extra check */
if (target.health <= 0) if (target.health <= 0)
@ -336,7 +337,7 @@ SHScientist::PlayerUse(void)
} }
void void
SHScientist::Pain(void) SHScientist::Pain(entity inflictor, entity attacker, int damage, vector dir, int location)
{ {
/* make everyone on edge */ /* make everyone on edge */
WarnAllies(); WarnAllies();
@ -354,7 +355,7 @@ SHScientist::Pain(void)
} }
void void
SHScientist::Death(void) SHScientist::Death(entity inflictor, entity attacker, int damage, vector dir, int location)
{ {
bool deathcheck = false; bool deathcheck = false;
HLGameRules rules = (HLGameRules)g_grMode; HLGameRules rules = (HLGameRules)g_grMode;
@ -365,15 +366,15 @@ SHScientist::Death(void)
if (IsAlive() == true) { if (IsAlive() == true) {
SetFrame(SCIA_DIE_SIMPLE + floor(random(0, 6))); SetFrame(SCIA_DIE_SIMPLE + floor(random(0, 6)));
rules.ScientistKill((player)g_dmg_eAttacker, (entity)this); rules.ScientistKill((SHPlayer)attacker, (entity)this);
Plugin_PlayerObituary(g_dmg_eAttacker, this, g_dmg_iWeapon, g_dmg_iHitBody, g_dmg_iDamage); Plugin_PlayerObituary(attacker, this, g_dmg_iWeapon, g_dmg_iHitBody, g_dmg_iDamage);
Sound_Speak(this, "SHScientist.die"); Sound_Speak(this, "SHScientist.die");
deathcheck = true; deathcheck = true;
} }
/* now mark our state as 'dead' */ /* now mark our state as 'dead' */
super::Death(); super::Death(inflictor, attacker, damage, dir, location);
/* now we'll tell our kill function about it, since we're now legally dead */ /* now we'll tell our kill function about it, since we're now legally dead */
if (deathcheck == true) { if (deathcheck == true) {

View file

@ -12,33 +12,13 @@
../../../src/shared/defs.h ../../../src/shared/defs.h
../../../src/server/defs.h ../../../src/server/defs.h
../../../src/botlib/botinfo.h ../../../src/botlib/botinfo.h
../../../src/gs-entbase/server.src ../../../src/gs-entbase/server.src
../../../src/gs-entbase/shared.src ../../../src/gs-entbase/shared.src
defs.h defs.h
../shared/include.src ../shared/include.src
monster_scientist.qc monster_scientist.qc
../../../valve/src/server/player.qc ../../../valve/src/server/player.qc
../../../valve/src/server/items.qc
../../../valve/src/server/item_longjump.qc
../../../valve/src/server/item_suit.qc
../../../valve/src/server/item_healthkit.qc
../../../valve/src/server/item_battery.qc
../../../valve/src/server/item_weaponbox.qc
../../../valve/src/server/world_items.qc
../../../valve/src/server/xen_spore_small.qc
../../../valve/src/server/xen_spore_medium.qc
../../../valve/src/server/xen_spore_large.qc
../../../valve/src/server/xen_hair.qc
../../../valve/src/server/xen_plantlight.qc
../../../valve/src/server/ammo.qc
../../../src/botlib/include.src ../../../src/botlib/include.src
shdata_parse.qc shdata_parse.qc
gamerules.qc gamerules.qc
gamerules_fear.qc gamerules_fear.qc
@ -47,14 +27,9 @@ gamerules_invasion.qc
gamerules_madness.qc gamerules_madness.qc
gamerules_slaughter.qc gamerules_slaughter.qc
gamerules_stealth.qc gamerules_stealth.qc
server.qc server.qc
../../../valve/src/server/damage.qc
../../../valve/src/server/flashlight.qc ../../../valve/src/server/flashlight.qc
../../../valve/src/server/modelevent.qc
../../../valve/src/server/spawn.qc ../../../valve/src/server/spawn.qc
../../../src/server/include.src ../../../src/server/include.src
../../../src/shared/include.src ../../../src/shared/include.src
#endlist #endlist

View file

@ -52,7 +52,6 @@ Game_Worldspawn(void)
Sound_Precache("Player.FlashLightOn"); Sound_Precache("Player.FlashLightOn");
Player_Precache(); Player_Precache();
Weapons_Init();
SHData_Parse(mapname); SHData_Parse(mapname);
FX_Corpse_Init(); FX_Corpse_Init();
} }

View file

@ -29,7 +29,8 @@ SHData_SpawnScientist(void)
} }
slimit++; slimit++;
} }
//spawnfunc_monster_scientist();
EntityDef_SpawnClassname("monster_scientist");
} }
void void
@ -41,7 +42,7 @@ SHData_New(void)
new.origin[2] = stof(argv(3)); new.origin[2] = stof(argv(3));
if (autocvar_sh_sciyaw) { if (autocvar_sh_sciyaw) {
new.angles[1] = Math_FixDelta(random(0,360)); new.angles[1] = fixAngleDelta(random(0,360));
} }
setorigin(new, new.origin); setorigin(new, new.origin);
@ -85,38 +86,38 @@ SHData_NewAngles(void)
} }
void void
SHData_GetItems(player pl) SHData_GetItems(SHPlayer pl)
{ {
if (pl.IsScientist() == true) { if (pl.IsScientist() == true) {
Weapons_AddItem(pl, WEAPON_NEEDLE, -1); pl.GiveItem("weapon_needle");
return; return;
} }
/* TODO: Parse the config files */ /* TODO: Parse the config files */
pl.ammo_9mm = 68; pl.GiveAmmo(ammoNumForName("ammo_9mm"), 68);
pl.ammo_buckshot = 34; pl.GiveAmmo(ammoNumForName("ammo_buckshot"), 34);
pl.ammo_bolt = 50; pl.GiveAmmo(ammoNumForName("ammo_bolt"), 50);
pl.ammo_357 = 36; pl.GiveAmmo(ammoNumForName("ammo_357"), 36);
pl.ammo_m203_grenade = 3; pl.GiveAmmo(ammoNumForName("ammo_m203_grenade"), 3);
pl.ammo_rocket = 5; pl.GiveAmmo(ammoNumForName("ammo_rocket"), 5);
pl.ammo_snark = 10; pl.GiveAmmo(ammoNumForName("ammo_snark"), 10);
Weapons_AddItem(pl, WEAPON_CROWBAR, -1); pl.GiveItem("weapon_crowbar");
Weapons_AddItem(pl, WEAPON_GLOCK, -1); pl.GiveItem("weapon_9mmhandgun");
Weapons_AddItem(pl, WEAPON_PYTHON, -1); pl.GiveItem("weapon_357");
Weapons_AddItem(pl, WEAPON_MP5, -1); pl.GiveItem("weapon_9mmAR");
Weapons_AddItem(pl, WEAPON_SHOTGUN, -1); pl.GiveItem("weapon_shotgun");
Weapons_AddItem(pl, WEAPON_CROSSBOW, -1); pl.GiveItem("weapon_crossbow");
Weapons_AddItem(pl, WEAPON_RPG, -1); pl.GiveItem("weapon_rpg");
Weapons_AddItem(pl, WEAPON_GAUSS, -1); pl.GiveItem("weapon_gauss");
Weapons_AddItem(pl, WEAPON_EGON, -1); pl.GiveItem("weapon_egon");
Weapons_AddItem(pl, WEAPON_HORNETGUN, -1); pl.GiveItem("weapon_hornetgun");
Weapons_AddItem(pl, WEAPON_HANDGRENADE, -1); pl.GiveItem("weapon_handgrenade");
Weapons_AddItem(pl, WEAPON_SATCHEL, -1); pl.GiveItem("weapon_satchel");
Weapons_AddItem(pl, WEAPON_TRIPMINE, -1); pl.GiveItem("weapon_tripmine");
Weapons_AddItem(pl, WEAPON_SNARK, -1); pl.GiveItem("weapon_snark");
Weapons_AddItem(pl, WEAPON_CANNON, -1); pl.GiveItem("weapon_handcannon");
Weapons_AddItem(pl, WEAPON_CHAINSAW, -1); pl.GiveItem("weapon_chainsaw");
Weapons_AddItem(pl, WEAPON_HAMMER, -1); pl.GiveItem("weapon_hammer");
} }
void void

View file

@ -2,36 +2,17 @@
../../../valve/src/shared/entities.h ../../../valve/src/shared/entities.h
../../../valve/src/shared/events.h ../../../valve/src/shared/events.h
../../../valve/src/shared/flags.h ../../../valve/src/shared/flags.h
../../../valve/src/shared/player.qc
player.qc player.qc
../../../valve/src/shared/pmove.qc
pmove.qc pmove.qc
../../../valve/src/shared/weapon_common.h
../../../valve/src/shared/animations.h ../../../valve/src/shared/animations.h
../../../valve/src/shared/animations.qc ../../../valve/src/shared/animations.qc
../../../valve/src/shared/fx_blood.qc ../../../valve/src/shared/fx_blood.qc
../../../valve/src/shared/fx_gaussbeam.qc ../../../valve/src/shared/fx_gaussbeam.qc
../../../valve/src/shared/fx_corpse.qc ../../../valve/src/shared/fx_corpse.qc
../../../valve/src/shared/HLGaussBeam.qc
items.h ../../../valve/src/shared/HLWeapon.qc
weapons.h
../../../valve/src/shared/w_crossbow.qc
../../../valve/src/shared/w_crowbar.qc
../../../valve/src/shared/w_egon.qc
../../../valve/src/shared/w_gauss.qc
../../../valve/src/shared/w_glock.qc
../../../valve/src/shared/w_handgrenade.qc
../../../valve/src/shared/w_hornetgun.qc
../../../valve/src/shared/w_mp5.qc
../../../valve/src/shared/w_python.qc
../../../valve/src/shared/w_rpg.qc
../../../valve/src/shared/w_satchel.qc
../../../valve/src/shared/w_shotgun.qc
../../../valve/src/shared/w_snark.qc
../../../valve/src/shared/w_tripmine.qc ../../../valve/src/shared/w_tripmine.qc
w_cannon.qc
w_chainsaw.qc
w_hammer.qc
w_needle.qc
weapons.qc
../../../valve/src/shared/weapon_common.qc
#endlist #endlist

View file

@ -14,64 +14,18 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "../../../valve/src/shared/skeleton.h"
#include "scianims.h" #include "scianims.h"
/* all custom SendFlags bits we can possibly send */ /* all custom SendFlags bits we can possibly send */
enumflags enumflags
{ {
PLAYER_TOPFRAME = PLAYER_CUSTOMFIELDSTART, PLAYER_TOPFRAME = PLAYER_CUSTOMFIELDSTART,
PLAYER_BOTTOMFRAME, PLAYER_BOTTOMFRAME
PLAYER_AMMO1,
PLAYER_AMMO2,
PLAYER_AMMO3,
PLAYER_UNUSED5,
PLAYER_UNUSED6,
PLAYER_UNUSED7
}; };
class player:NSClientPlayer class SHPlayer:HLPlayer
{ {
void(void) player; void(void) SHPlayer;
/* animation */
PREDICTED_INT(anim_top)
PREDICTED_FLOAT(anim_top_time)
PREDICTED_FLOAT(anim_top_delay)
PREDICTED_INT(anim_bottom)
PREDICTED_FLOAT(anim_bottom_time)
/* ammo 1 */
PREDICTED_INT(glock_mag)
PREDICTED_INT(mp5_mag)
PREDICTED_INT(python_mag)
PREDICTED_INT(shotgun_mag)
PREDICTED_INT(crossbow_mag)
PREDICTED_INT(rpg_mag)
PREDICTED_INT(satchel_chg)
PREDICTED_INT(cannon_mag)
/* ammo 2 */
PREDICTED_INT(ammo_9mm)
PREDICTED_INT(ammo_357)
PREDICTED_INT(ammo_buckshot)
PREDICTED_INT(ammo_bolt)
PREDICTED_INT(ammo_rocket)
PREDICTED_INT(ammo_uranium)
PREDICTED_INT(ammo_handgrenade)
PREDICTED_INT(ammo_satchel)
PREDICTED_INT(ammo_tripmine)
PREDICTED_INT(ammo_snark)
PREDICTED_INT(ammo_hornet)
/* ammo 3 */
PREDICTED_INT(ammo_m203_grenade)
PREDICTED_INT(ammo_gauss_volume)
PREDICTED_INT(ammo_rpg_state)
PREDICTED_INT(mode_tempstate)
PREDICTED_INT(ammo_chainsaw_state)
PREDICTED_INT(ammo_hammer_state)
/* insanity */ /* insanity */
PREDICTED_FLOAT(sh_insanetime) PREDICTED_FLOAT(sh_insanetime)
@ -96,7 +50,6 @@ class player:NSClientPlayer
virtual void ReceiveEntity(float,float); virtual void ReceiveEntity(float,float);
virtual void PredictPreFrame(void); virtual void PredictPreFrame(void);
virtual void PredictPostFrame(void); virtual void PredictPostFrame(void);
virtual void UpdateAliveCam(void);
#else #else
virtual void EvaluateEntity(void); virtual void EvaluateEntity(void);
virtual float SendEntity(entity, float); virtual float SendEntity(entity, float);
@ -107,11 +60,18 @@ class player:NSClientPlayer
#endif #endif
}; };
void
SHPlayer::SHPlayer(void)
{
sh_insanetime = 0;
sh_insaneactive = 0;
}
void void
SHSciAnim_PlayerUpdate(NSClientPlayer playerTarget) SHSciAnim_PlayerUpdate(NSClientPlayer playerTarget)
{ {
bool useTopAnim; bool useTopAnim;
player pl = (player)playerTarget; SHPlayer pl = (SHPlayer)playerTarget;
if (pl.anim_top_delay <= 0.0f) { if (pl.anim_top_delay <= 0.0f) {
useTopAnim = false; useTopAnim = false;
@ -137,7 +97,7 @@ SHSciAnim_PlayerUpdate(NSClientPlayer playerTarget)
} }
bool bool
player::IsScientist(void) SHPlayer::IsScientist(void)
{ {
#ifdef CLIENT #ifdef CLIENT
float myTeam = getplayerkeyfloat(this.entnum-1, "*team"); float myTeam = getplayerkeyfloat(this.entnum-1, "*team");
@ -173,7 +133,7 @@ player::IsScientist(void)
void void
player::Physics_Crouch(void) SHPlayer::Physics_Crouch(void)
{ {
if (IsScientist() == true) { if (IsScientist() == true) {
view_ofs = PHY_VIEWPOS + [0,0, 36]; view_ofs = PHY_VIEWPOS + [0,0, 36];
@ -184,7 +144,7 @@ player::Physics_Crouch(void)
} }
void void
player::Physics_SetViewParms(void) SHPlayer::Physics_SetViewParms(void)
{ {
vector bboxOffset = g_vec_null; vector bboxOffset = g_vec_null;
@ -192,7 +152,7 @@ player::Physics_SetViewParms(void)
bboxOffset = [0, 0, 36]; bboxOffset = [0, 0, 36];
} }
if (GetFlags() & FL_CROUCHING) { if (IsCrouching()) {
mins = PHY_HULL_CROUCHED_MIN; mins = PHY_HULL_CROUCHED_MIN;
maxs = PHY_HULL_CROUCHED_MAX; maxs = PHY_HULL_CROUCHED_MAX;
view_ofs = PHY_VIEWPOS_CROUCHED; view_ofs = PHY_VIEWPOS_CROUCHED;
@ -204,11 +164,8 @@ player::Physics_SetViewParms(void)
SetSize(mins + bboxOffset, maxs + bboxOffset); SetSize(mins + bboxOffset, maxs + bboxOffset);
} }
void Animation_PlayerUpdate(player);
void Animation_TimerUpdate(player, float);
void void
player::UpdatePlayerAnimation(float timelength) SHPlayer::UpdatePlayerAnimation(float timelength)
{ {
if (IsScientist() == true) { if (IsScientist() == true) {
SHSciAnim_PlayerUpdate(this); SHSciAnim_PlayerUpdate(this);
@ -222,136 +179,24 @@ player::UpdatePlayerAnimation(float timelength)
} }
#ifdef CLIENT #ifdef CLIENT
void Camera_RunPosBob(vector angles, __inout vector camera_pos);
void Camera_StrafeRoll(__inout vector camera_angle);
void Shake_Update(NSClientPlayer);
void void
player::UpdateAliveCam(void) SHPlayer::UpdatePlayerAttachments(bool visible)
{
vector cam_pos = GetEyePos();
Camera_RunPosBob(view_angles, cam_pos);
g_view.SetCameraOrigin(cam_pos);
Camera_StrafeRoll(view_angles);
g_view.SetCameraAngle(view_angles);
if (vehicle) {
NSVehicle veh = (NSVehicle)vehicle;
if (veh.UpdateView)
veh.UpdateView();
} else if (health) {
if (autocvar_pm_thirdPerson == TRUE) {
makevectors(view_angles);
vector vStart = [pSeat->m_vecPredictedOrigin[0], pSeat->m_vecPredictedOrigin[1], pSeat->m_vecPredictedOrigin[2] + 16] + (v_right * 4);
vector vEnd = vStart + (v_forward * -48) + [0,0,16] + (v_right * 4);
traceline(vStart, vEnd, FALSE, this);
g_view.SetCameraOrigin(trace_endpos + (v_forward * 5));
}
}
Shake_Update(this);
g_view.AddPunchAngle(punchangle);
}
.string oldmodel;
string Weapons_GetPlayermodel(player, int);
void
player::UpdatePlayerAttachments(bool visible)
{ {
if (IsScientist()) { if (IsScientist()) {
p_model.modelindex = 0; p_model.modelindex = 0;
return; return;
} }
/* draw the flashlight */ super::UpdatePlayerAttachments(visible);
if (gflags & GF_FLASHLIGHT) {
vector src;
vector ang;
if (entnum != player_localentnum) {
src = origin + view_ofs;
ang = v_angle;
} else {
src = pSeat->m_vecPredictedOrigin + [0,0,-8];
ang = view_angles;
} }
makevectors(ang);
traceline(src, src + (v_forward * 8096), MOVE_NORMAL, this);
if (serverkeyfloat("*bspversion") == BSPVER_HL) {
dynamiclight_add(trace_endpos + (v_forward * -2), 128, [1,1,1]);
} else {
float p = dynamiclight_add(src, 512, [1,1,1], 0, "textures/flashlight");
dynamiclight_set(p, LFIELD_ANGLES, ang);
dynamiclight_set(p, LFIELD_FLAGS, 3);
}
}
/* FIXME: this needs to be incorporated and simplified, now that we can handle it all in-class */
if (!visible)
return;
/* what's the current weapon model supposed to be anyway? */
p_model.oldmodel = Weapons_GetPlayermodel(this, activeweapon);
/* we changed weapons, update skeletonindex */
if (p_model.model != p_model.oldmodel) {
/* free memory */
if (p_model.skeletonindex)
skel_delete(p_model.skeletonindex);
/* set the new model and mark us updated */
setmodel(p_model, p_model.oldmodel);
p_model.model = p_model.oldmodel;
/* set the new skeletonindex */
p_model.skeletonindex = skel_create(p_model.modelindex);
/* hack this thing in here FIXME: this should be done when popping in/out of a pvs */
if (autocvar(cl_himodels, 1, "Use high-quality thisayer models over lower-definition ones"))
setcustomskin(this, "", "geomset 0 2\n");
else
setcustomskin(this, "", "geomset 0 1\n");
}
/* follow thisayer at all times */
setorigin(p_model, origin);
p_model.angles = angles;
skel_build(p_model.skeletonindex, p_model, p_model.modelindex,0, 0, -1);
/* we have to loop through all valid bones of the weapon model and match them
* to the thisayer one */
for (float i = 0; i < g_pbones.length; i++) {
vector bpos;
float pbone = gettagindex(this, g_pbones[i]);
float wbone = gettagindex(p_model, g_pbones[i]);
/* if the bone doesn't ignore in either skeletal mesh, ignore */
if (wbone <= 0 || pbone <= 0)
continue;
bpos = gettaginfo(this, pbone);
/* the most expensive bit */
skel_set_bone_world(p_model, wbone, bpos, v_forward, v_right, v_up);
}
}
void Weapons_AmmoUpdate(entity);
void HUD_AmmoNotify_Check(player pl);
void HUD_ItemNotify_Check(player pl);
/* /*
================= =================
player::ReceiveEntity player::ReceiveEntity
================= =================
*/ */
void void
player::ReceiveEntity(float new, float flChanged) SHPlayer::ReceiveEntity(float new, float flChanged)
{ {
/* the generic client attributes */ /* the generic client attributes */
NSClientPlayer::ReceiveEntity(new, flChanged); NSClientPlayer::ReceiveEntity(new, flChanged);
@ -363,35 +208,8 @@ player::ReceiveEntity(float new, float flChanged)
READENTITY_BYTE(anim_bottom, PLAYER_BOTTOMFRAME) READENTITY_BYTE(anim_bottom, PLAYER_BOTTOMFRAME)
READENTITY_FLOAT(anim_bottom_time, PLAYER_BOTTOMFRAME) READENTITY_FLOAT(anim_bottom_time, PLAYER_BOTTOMFRAME)
READENTITY_BYTE(glock_mag, PLAYER_AMMO1) READENTITY_FLOAT(sh_insanetime, PLAYER_BOTTOMFRAME)
READENTITY_BYTE(mp5_mag, PLAYER_AMMO1) READENTITY_FLOAT(sh_insaneactive, PLAYER_BOTTOMFRAME)
READENTITY_BYTE(python_mag, PLAYER_AMMO1)
READENTITY_BYTE(shotgun_mag, PLAYER_AMMO1)
READENTITY_BYTE(crossbow_mag, PLAYER_AMMO1)
READENTITY_BYTE(rpg_mag, PLAYER_AMMO1)
READENTITY_BYTE(satchel_chg, PLAYER_AMMO1)
READENTITY_BYTE(cannon_mag, PLAYER_AMMO1)
READENTITY_BYTE(ammo_9mm, PLAYER_AMMO2)
READENTITY_BYTE(ammo_357, PLAYER_AMMO2)
READENTITY_BYTE(ammo_buckshot, PLAYER_AMMO2)
READENTITY_BYTE(ammo_bolt, PLAYER_AMMO2)
READENTITY_BYTE(ammo_rocket, PLAYER_AMMO2)
READENTITY_BYTE(ammo_uranium, PLAYER_AMMO2)
READENTITY_BYTE(ammo_handgrenade, PLAYER_AMMO2)
READENTITY_BYTE(ammo_satchel, PLAYER_AMMO2)
READENTITY_BYTE(ammo_tripmine, PLAYER_AMMO2)
READENTITY_BYTE(ammo_snark, PLAYER_AMMO2)
READENTITY_BYTE(ammo_hornet, PLAYER_AMMO2)
READENTITY_BYTE(ammo_m203_grenade, PLAYER_AMMO3)
READENTITY_BYTE(ammo_gauss_volume, PLAYER_AMMO3)
READENTITY_BYTE(ammo_rpg_state, PLAYER_AMMO3)
READENTITY_BYTE(mode_tempstate, PLAYER_AMMO3)
READENTITY_BYTE(ammo_chainsaw_state, PLAYER_AMMO3)
READENTITY_BYTE(ammo_hammer_state, PLAYER_AMMO3)
READENTITY_FLOAT(sh_insanetime, PLAYER_AMMO3)
READENTITY_FLOAT(sh_insaneactive, PLAYER_AMMO3)
setorigin(this, origin); setorigin(this, origin);
@ -404,8 +222,7 @@ player::ReceiveEntity(float new, float flChanged)
if (flChanged == UPDATE_ALL) if (flChanged == UPDATE_ALL)
PredictPreFrame(); PredictPreFrame();
if (flChanged & PLAYER_AMMO1 || flChanged & PLAYER_AMMO2 || flChanged & PLAYER_AMMO3) { if (flChanged & PLAYER_AMMOTYPES) {
Weapons_AmmoUpdate(this);
HUD_AmmoNotify_Check(this); HUD_AmmoNotify_Check(this);
} }
@ -422,44 +239,13 @@ so we can roll them back later.
================= =================
*/ */
void void
player::PredictPreFrame(void) SHPlayer::PredictPreFrame(void)
{ {
/* the generic client attributes */ /* the generic client attributes */
NSClientPlayer::PredictPreFrame(); super::PredictPreFrame();
SAVE_STATE(anim_top) SAVE_STATE(sh_insanetime)
SAVE_STATE(anim_top_delay) SAVE_STATE(sh_insaneactive)
SAVE_STATE(anim_top_time)
SAVE_STATE(anim_bottom)
SAVE_STATE(anim_bottom_time)
SAVE_STATE(glock_mag)
SAVE_STATE(mp5_mag)
SAVE_STATE(python_mag)
SAVE_STATE(shotgun_mag)
SAVE_STATE(crossbow_mag)
SAVE_STATE(rpg_mag)
SAVE_STATE(satchel_chg)
SAVE_STATE(cannon_mag)
SAVE_STATE(ammo_9mm)
SAVE_STATE(ammo_357)
SAVE_STATE(ammo_buckshot)
SAVE_STATE(ammo_bolt)
SAVE_STATE(ammo_rocket)
SAVE_STATE(ammo_uranium)
SAVE_STATE(ammo_handgrenade)
SAVE_STATE(ammo_satchel)
SAVE_STATE(ammo_tripmine)
SAVE_STATE(ammo_snark)
SAVE_STATE(ammo_hornet)
SAVE_STATE(ammo_m203_grenade)
SAVE_STATE(ammo_gauss_volume)
SAVE_STATE(ammo_rpg_state)
SAVE_STATE(mode_tempstate)
SAVE_STATE(ammo_chainsaw_state)
SAVE_STATE(ammo_hammer_state)
} }
/* /*
@ -470,192 +256,30 @@ Where we roll back our values to the ones last sent/verified by the server.
================= =================
*/ */
void void
player::PredictPostFrame(void) SHPlayer::PredictPostFrame(void)
{ {
/* the generic client attributes */ /* the generic client attributes */
NSClientPlayer::PredictPostFrame(); super::PredictPostFrame();
ROLL_BACK(anim_top) ROLL_BACK(sh_insanetime)
ROLL_BACK(anim_top_delay) ROLL_BACK(sh_insaneactive)
ROLL_BACK(anim_top_time)
ROLL_BACK(anim_bottom)
ROLL_BACK(anim_bottom_time)
ROLL_BACK(glock_mag)
ROLL_BACK(mp5_mag)
ROLL_BACK(python_mag)
ROLL_BACK(shotgun_mag)
ROLL_BACK(crossbow_mag)
ROLL_BACK(rpg_mag)
ROLL_BACK(satchel_chg)
ROLL_BACK(cannon_mag)
ROLL_BACK(ammo_9mm)
ROLL_BACK(ammo_357)
ROLL_BACK(ammo_buckshot)
ROLL_BACK(ammo_m203_grenade)
ROLL_BACK(ammo_bolt)
ROLL_BACK(ammo_rocket)
ROLL_BACK(ammo_uranium)
ROLL_BACK(ammo_handgrenade)
ROLL_BACK(ammo_satchel)
ROLL_BACK(ammo_tripmine)
ROLL_BACK(ammo_snark)
ROLL_BACK(ammo_hornet)
ROLL_BACK(ammo_m203_grenade)
ROLL_BACK(ammo_gauss_volume)
ROLL_BACK(ammo_rpg_state)
ROLL_BACK(mode_tempstate)
ROLL_BACK(ammo_chainsaw_state)
ROLL_BACK(ammo_hammer_state)
} }
#else #else
void void
player::Save(float handle) SHPlayer::Save(float handle)
{ {
super::Save(handle); super::Save(handle);
SaveInt(handle, "anim_top", anim_top);
SaveFloat(handle, "anim_top_time", anim_top_time);
SaveFloat(handle, "anim_top_delay", anim_top_delay);
SaveInt(handle, "anim_bottom", anim_bottom);
SaveFloat(handle, "anim_bottom_time", anim_bottom_time);
/* ammo 1 */
SaveInt(handle, "glock_mag", glock_mag);
SaveInt(handle, "mp5_mag", mp5_mag);
SaveInt(handle, "python_mag", python_mag);
SaveInt(handle, "shotgun_mag", shotgun_mag);
SaveInt(handle, "crossbow_mag", crossbow_mag);
SaveInt(handle, "rpg_mag", rpg_mag);
SaveInt(handle, "satchel_chg", satchel_chg);
SaveInt(handle, "cannon_mag", satchel_chg);
/* ammo 2 */
SaveInt(handle, "ammo_9mm", ammo_9mm);
SaveInt(handle, "ammo_357", ammo_357);
SaveInt(handle, "ammo_buckshot", ammo_buckshot);
SaveInt(handle, "ammo_bolt", ammo_bolt);
SaveInt(handle, "ammo_rocket", ammo_rocket);
SaveInt(handle, "ammo_uranium", ammo_uranium);
SaveInt(handle, "ammo_handgrenade", ammo_handgrenade);
SaveInt(handle, "ammo_satchel", ammo_satchel);
SaveInt(handle, "ammo_tripmine", ammo_tripmine);
SaveInt(handle, "ammo_snark", ammo_snark);
SaveInt(handle, "ammo_hornet", ammo_hornet);
/* ammo 3 */
SaveInt(handle, "ammo_m203_grenade", ammo_m203_grenade);
SaveInt(handle, "ammo_gauss_volume", ammo_gauss_volume);
SaveInt(handle, "ammo_rpg_state", ammo_rpg_state);
SaveInt(handle, "mode_tempstate", mode_tempstate);
SaveInt(handle, "ammo_chainsaw_state", ammo_chainsaw_state);
SaveInt(handle, "ammo_hammer_state", ammo_hammer_state);
/* insanity */ /* insanity */
SaveFloat(handle, "sh_insanetime", sh_insanetime); SaveFloat(handle, "sh_insanetime", sh_insanetime);
SaveFloat(handle, "sh_insaneactive", sh_insaneactive); SaveFloat(handle, "sh_insaneactive", sh_insaneactive);
} }
void void
player::Restore(string strKey, string strValue) SHPlayer::Restore(string strKey, string strValue)
{ {
switch (strKey) { switch (strKey) {
case "anim_top":
anim_top = ReadInt(strValue);
break;
case "anim_top_time":
anim_top_time = ReadFloat(strValue);
break;
case "anim_top_delay":
anim_top_delay = ReadFloat(strValue);
break;
case "anim_bottom":
anim_bottom = ReadInt(strValue);
break;
case "anim_bottom_time":
anim_bottom_time = ReadFloat(strValue);
break;
/* AMMO 1 */
case "glock_mag":
glock_mag = ReadInt(strValue);
break;
case "mp5_mag":
mp5_mag = ReadInt(strValue);
break;
case "python_mag":
python_mag = ReadInt(strValue);
break;
case "shotgun_mag":
shotgun_mag = ReadInt(strValue);
break;
case "crossbow_mag":
crossbow_mag = ReadInt(strValue);
break;
case "rpg_mag":
rpg_mag = ReadInt(strValue);
break;
case "satchel_chg":
satchel_chg = ReadInt(strValue);
break;
case "cannon_mag":
satchel_chg = ReadInt(strValue);
break;
/* AMMO 2 */
case "ammo_9mm":
ammo_9mm = ReadInt(strValue);
break;
case "ammo_357":
ammo_357 = ReadInt(strValue);
break;
case "ammo_buckshot":
ammo_buckshot = ReadInt(strValue);
break;
case "ammo_bolt":
ammo_bolt = ReadInt(strValue);
break;
case "ammo_rocket":
ammo_rocket = ReadInt(strValue);
break;
case "ammo_uranium":
ammo_uranium = ReadInt(strValue);
break;
case "ammo_handgrenade":
ammo_handgrenade = ReadInt(strValue);
break;
case "ammo_satchel":
ammo_satchel = ReadInt(strValue);
break;
case "ammo_tripmine":
ammo_tripmine = ReadInt(strValue);
break;
case "ammo_snark":
ammo_snark = ReadInt(strValue);
break;
case "ammo_hornet":
ammo_hornet = ReadInt(strValue);
break;
/* AMMO 3 */
case "ammo_m203_grenade":
ammo_m203_grenade = ReadInt(strValue);
break;
case "ammo_gauss_volume":
ammo_gauss_volume = ReadInt(strValue);
break;
case "ammo_rpg_state":
ammo_rpg_state = ReadInt(strValue);
break;
case "mode_tempstate":
mode_tempstate = ReadInt(strValue);
break;
case "ammo_chainsaw_state":
ammo_chainsaw_state = ReadInt(strValue);
break;
case "ammo_hammer_state":
ammo_hammer_state = ReadInt(strValue);
break;
case "sh_insanetime": case "sh_insanetime":
sh_insanetime = ReadFloat(strValue); sh_insanetime = ReadFloat(strValue);
break; break;
@ -668,46 +292,13 @@ player::Restore(string strKey, string strValue)
} }
void void
player::EvaluateEntity(void) SHPlayer::EvaluateEntity(void)
{ {
/* the generic client attributes */ /* the generic client attributes */
NSClientPlayer::EvaluateEntity(); super::EvaluateEntity();
EVALUATE_FIELD(anim_top, PLAYER_TOPFRAME) EVALUATE_FIELD(sh_insanetime, PLAYER_BOTTOMFRAME)
EVALUATE_FIELD(anim_top_time, PLAYER_TOPFRAME) EVALUATE_FIELD(sh_insaneactive, PLAYER_BOTTOMFRAME)
EVALUATE_FIELD(anim_top_delay, PLAYER_TOPFRAME)
EVALUATE_FIELD(anim_bottom, PLAYER_BOTTOMFRAME)
EVALUATE_FIELD(anim_bottom_time, PLAYER_BOTTOMFRAME)
EVALUATE_FIELD(glock_mag, PLAYER_AMMO1)
EVALUATE_FIELD(mp5_mag, PLAYER_AMMO1)
EVALUATE_FIELD(python_mag, PLAYER_AMMO1)
EVALUATE_FIELD(shotgun_mag, PLAYER_AMMO1)
EVALUATE_FIELD(crossbow_mag, PLAYER_AMMO1)
EVALUATE_FIELD(rpg_mag, PLAYER_AMMO1)
EVALUATE_FIELD(satchel_chg, PLAYER_AMMO1)
EVALUATE_FIELD(cannon_mag, PLAYER_AMMO1)
EVALUATE_FIELD(ammo_9mm, PLAYER_AMMO2)
EVALUATE_FIELD(ammo_357, PLAYER_AMMO2)
EVALUATE_FIELD(ammo_buckshot, PLAYER_AMMO2)
EVALUATE_FIELD(ammo_bolt, PLAYER_AMMO2)
EVALUATE_FIELD(ammo_rocket, PLAYER_AMMO2)
EVALUATE_FIELD(ammo_uranium, PLAYER_AMMO2)
EVALUATE_FIELD(ammo_handgrenade, PLAYER_AMMO2)
EVALUATE_FIELD(ammo_satchel, PLAYER_AMMO2)
EVALUATE_FIELD(ammo_tripmine, PLAYER_AMMO2)
EVALUATE_FIELD(ammo_snark, PLAYER_AMMO2)
EVALUATE_FIELD(ammo_hornet, PLAYER_AMMO2)
EVALUATE_FIELD(ammo_m203_grenade, PLAYER_AMMO3)
EVALUATE_FIELD(ammo_gauss_volume, PLAYER_AMMO3)
EVALUATE_FIELD(ammo_rpg_state, PLAYER_AMMO3)
EVALUATE_FIELD(mode_tempstate, PLAYER_AMMO3)
EVALUATE_FIELD(ammo_chainsaw_state, PLAYER_AMMO3)
EVALUATE_FIELD(ammo_hammer_state, PLAYER_AMMO3)
EVALUATE_FIELD(sh_insanetime, PLAYER_AMMO3)
EVALUATE_FIELD(sh_insaneactive, PLAYER_AMMO3)
} }
/* /*
@ -716,7 +307,7 @@ player::SendEntity
================= =================
*/ */
float float
player::SendEntity(entity ePEnt, float flChanged) SHPlayer::SendEntity(entity ePEnt, float flChanged)
{ {
/* don't broadcast invisible players */ /* don't broadcast invisible players */
if (IsFakeSpectator() && ePEnt != this) if (IsFakeSpectator() && ePEnt != this)
@ -726,9 +317,6 @@ player::SendEntity(entity ePEnt, float flChanged)
flChanged = OptimiseChangedFlags(ePEnt, flChanged); flChanged = OptimiseChangedFlags(ePEnt, flChanged);
WriteByte(MSG_ENTITY, ENT_PLAYER);
WriteFloat(MSG_ENTITY, flChanged);
/* the generic client attributes */ /* the generic client attributes */
NSClientPlayer::SendEntity(ePEnt, flChanged); NSClientPlayer::SendEntity(ePEnt, flChanged);
@ -738,73 +326,9 @@ player::SendEntity(entity ePEnt, float flChanged)
SENDENTITY_BYTE(anim_bottom, PLAYER_BOTTOMFRAME) SENDENTITY_BYTE(anim_bottom, PLAYER_BOTTOMFRAME)
SENDENTITY_FLOAT(anim_bottom_time, PLAYER_BOTTOMFRAME) SENDENTITY_FLOAT(anim_bottom_time, PLAYER_BOTTOMFRAME)
SENDENTITY_BYTE(glock_mag, PLAYER_AMMO1) SENDENTITY_FLOAT(sh_insanetime, PLAYER_BOTTOMFRAME)
SENDENTITY_BYTE(mp5_mag, PLAYER_AMMO1) SENDENTITY_FLOAT(sh_insaneactive, PLAYER_BOTTOMFRAME)
SENDENTITY_BYTE(python_mag, PLAYER_AMMO1)
SENDENTITY_BYTE(shotgun_mag, PLAYER_AMMO1)
SENDENTITY_BYTE(crossbow_mag, PLAYER_AMMO1)
SENDENTITY_BYTE(rpg_mag, PLAYER_AMMO1)
SENDENTITY_BYTE(satchel_chg, PLAYER_AMMO1)
SENDENTITY_BYTE(cannon_mag, PLAYER_AMMO1)
SENDENTITY_BYTE(ammo_9mm, PLAYER_AMMO2)
SENDENTITY_BYTE(ammo_357, PLAYER_AMMO2)
SENDENTITY_BYTE(ammo_buckshot, PLAYER_AMMO2)
SENDENTITY_BYTE(ammo_bolt, PLAYER_AMMO2)
SENDENTITY_BYTE(ammo_rocket, PLAYER_AMMO2)
SENDENTITY_BYTE(ammo_uranium, PLAYER_AMMO2)
SENDENTITY_BYTE(ammo_handgrenade, PLAYER_AMMO2)
SENDENTITY_BYTE(ammo_satchel, PLAYER_AMMO2)
SENDENTITY_BYTE(ammo_tripmine, PLAYER_AMMO2)
SENDENTITY_BYTE(ammo_snark, PLAYER_AMMO2)
SENDENTITY_BYTE(ammo_hornet, PLAYER_AMMO2)
SENDENTITY_BYTE(ammo_m203_grenade, PLAYER_AMMO3)
SENDENTITY_BYTE(ammo_gauss_volume, PLAYER_AMMO3)
SENDENTITY_BYTE(ammo_rpg_state, PLAYER_AMMO3)
SENDENTITY_BYTE(mode_tempstate, PLAYER_AMMO3)
SENDENTITY_BYTE(ammo_chainsaw_state, PLAYER_AMMO3)
SENDENTITY_BYTE(ammo_hammer_state, PLAYER_AMMO3)
SENDENTITY_FLOAT(sh_insanetime, PLAYER_AMMO3)
SENDENTITY_FLOAT(sh_insaneactive, PLAYER_AMMO3)
return (1); return (1);
} }
#endif #endif
void
player::player(void)
{
anim_top = 0;
anim_top_time = 0;
anim_top_delay = 0;
anim_bottom = 0;
anim_bottom_time = 0;
glock_mag = 0;
mp5_mag = 0;
python_mag = 0;
shotgun_mag = 0;
crossbow_mag = 0;
rpg_mag = 0;
satchel_chg = 0;
cannon_mag = 0;
ammo_9mm = 0;
ammo_357 = 0;
ammo_buckshot = 0;
ammo_bolt = 0;
ammo_rocket = 0;
ammo_uranium = 0;
ammo_handgrenade = 0;
ammo_satchel = 0;
ammo_tripmine = 0;
ammo_snark = 0;
ammo_hornet = 0;
ammo_m203_grenade = 0;
ammo_gauss_volume = 0;
ammo_rpg_state = 0;
mode_tempstate = 0;
ammo_chainsaw_state = 0;
ammo_hammer_state = 0;
sh_insanetime = 0;
sh_insaneactive = 0;
}

View file

@ -34,7 +34,7 @@
/* insanity changes player move and attack speed /* insanity changes player move and attack speed
* so lets override some base player functions */ * so lets override some base player functions */
void void
player::Physics_InputPreMove(void) SHPlayer::Physics_InputPreMove(void)
{ {
float insanecooldown; float insanecooldown;
@ -51,7 +51,7 @@ player::Physics_InputPreMove(void)
* easier to do this to every weapon, plus it's more fun * easier to do this to every weapon, plus it's more fun
* FIXME reloading is borked when active */ * FIXME reloading is borked when active */
void void
player::Physics_InputPostMove(void) SHPlayer::Physics_InputPostMove(void)
{ {
super::Physics_InputPostMove(); super::Physics_InputPostMove();
if (gflags & GF_MADNESS) { if (gflags & GF_MADNESS) {
@ -60,7 +60,7 @@ player::Physics_InputPostMove(void)
} }
float float
player::Physics_MaxSpeed(void) SHPlayer::Physics_MaxSpeed(void)
{ {
if (gflags & GF_MADNESS) { if (gflags & GF_MADNESS) {
return 1000.0f; return 1000.0f;
@ -70,7 +70,7 @@ player::Physics_MaxSpeed(void)
} }
void void
player::Physics_Jump(void) SHPlayer::Physics_Jump(void)
{ {
if (waterlevel >= 2) { if (waterlevel >= 2) {
if (watertype == CONTENT_WATER) { if (watertype == CONTENT_WATER) {
@ -82,7 +82,7 @@ player::Physics_Jump(void)
} }
} else { } else {
/* Half-Life: Longjump module */ /* Half-Life: Longjump module */
if (flags & FL_CROUCHING && g_items & 0x00008000i) { if (IsCrouching() && g_items & 0x00008000i) {
makevectors([0, v_angle[1], 0]); makevectors([0, v_angle[1], 0]);
velocity = v_forward * 512; velocity = v_forward * 512;
velocity[2] += 100; velocity[2] += 100;

View file

@ -1,296 +0,0 @@
/*
* Copyright (c) 2016-2021 Marco Cawthorne <marco@icculus.org>
*
* 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.
*/
#ifdef CLIENT
var string g_cannon_spr;
#endif
typedef enum
{
CANNON_FIREBOTH,
CANNON_FIRELEFT,
CANNON_FIRERIGHT,
CANNON_RELOAD,
CANNON_DEPLOY,
CANNON_PUTAWAY,
CANNON_IDLE1,
CANNON_IDLE2
} cannonAnims_t;
void
w_cannon_precache(void)
{
#ifdef SERVER
Sound_Precache("weapon_cannon.shoot");
#else
precache_model("models/v_cannon.mdl");
precache_model("models/p_cannon.mdl");
g_cannon_spr = spriteframe("sprites/w_cannon.spr", 0, 0.0f);
#endif
}
void
w_cannon_updateammo(player pl)
{
Weapons_UpdateAmmo(pl, pl.cannon_mag, pl.ammo_buckshot, -1);
}
string
w_cannon_pmodel(player pl)
{
return "models/p_cannon.mdl";
}
string
w_cannon_deathmsg(void)
{
return "%s killed %s with handcannon.";
}
void
w_cannon_reload(player pl)
{
if (pl.w_attack_next > 0) {
return;
}
if (pl.cannon_mag >= 2) {
return;
}
if (!pl.ammo_buckshot) {
return;
}
Weapons_ViewAnimation(pl, CANNON_RELOAD);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::cannon_mag, player::ammo_buckshot, 2);
#endif
pl.w_attack_next = 3.0f;
pl.w_idle_next = 3.0f;
}
int
w_cannon_pickup(player pl, int new, int startammo)
{
#ifdef SERVER
if (new) {
pl.cannon_mag = 2;
} else {
if (pl.ammo_buckshot < 125) {
pl.ammo_buckshot = bound(0, pl.ammo_buckshot + 2, 125);
} else {
return (0);
}
}
#endif
return (1);
}
void
w_cannon_draw(player pl)
{
Weapons_SetModel("models/v_cannon.mdl");
Weapons_ViewAnimation(pl, CANNON_DEPLOY);
}
void
w_cannon_holster(player pl)
{
Weapons_ViewAnimation(pl, CANNON_PUTAWAY);
}
void
w_cannon_primary(player pl)
{
if (pl.w_attack_next > 0.0) {
return;
}
if (pl.cannon_mag != 2 && cvar("sh_hchorror") != 1) {
w_cannon_reload(pl);
return;
}
#ifdef CLIENT
View_SetMuzzleflash(MUZZLE_SMALL);
#else
int dmg;
dmg = Skill_GetValue("plr_cannon", 5);
TraceAttack_FireBullets(20, pl.origin + pl.view_ofs, dmg, [0.08716,0.04362], WEAPON_CANNON);
if (cvar("sh_hchorror") != 1)
pl.cannon_mag -= 2;
Sound_Play(pl, CHAN_WEAPON, "weapon_cannon.shoot");
Weapons_UpdateAmmo(pl, pl.cannon_mag, pl.ammo_buckshot, __NULL__);
#endif
Weapons_ViewPunchAngle(pl, [-5,0,0]);
Weapons_ViewAnimation(pl, CANNON_FIREBOTH);
if (cvar("sh_hchorror") != 1) {
pl.w_attack_next = 1.5f;
pl.w_idle_next = 2.5f;
} else {
pl.w_attack_next = 0.5f;
pl.w_idle_next = 0.5f;
}
if (self.flags & FL_CROUCHING)
Animation_PlayerTop(pl, ANIM_CR_SHOOTSHOTGUN, 0.41f);
else
Animation_PlayerTop(pl, ANIM_SHOOTSHOTGUN, 0.5f);
}
void
w_cannon_secondary(player pl)
{
if (pl.w_attack_next > 0.0) {
return;
}
if (!pl.cannon_mag && cvar("sh_hchorror") != 1) {
w_cannon_reload(pl);
return;
}
Weapons_ViewPunchAngle(pl, [-5,0,0]);
#ifdef SERVER
int dmg;
dmg = Skill_GetValue("plr_cannon", 5);
TraceAttack_FireBullets(10, pl.origin + pl.view_ofs, dmg, [0.08716,0.04362], WEAPON_CANNON);
if (cvar("sh_hchorror") != 1)
pl.cannon_mag--;
Sound_Play(pl, CHAN_WEAPON, "weapon_cannon.shoot");
#endif
if (pl.cannon_mag == 2) {
Weapons_ViewAnimation(pl, CANNON_FIRELEFT);
} else {
Weapons_ViewAnimation(pl, CANNON_FIRERIGHT);
}
if (cvar("sh_hchorror") != 1) {
pl.w_attack_next = 1.5f;
pl.w_idle_next = 2.5f;
} else {
pl.w_attack_next = 0.5f;
pl.w_idle_next = 0.5f;
}
if (self.flags & FL_CROUCHING)
Animation_PlayerTop(pl, ANIM_CR_SHOOTSHOTGUN, 0.41f);
else
Animation_PlayerTop(pl, ANIM_SHOOTSHOTGUN, 0.5f);
}
void
w_cannon_release(player pl)
{
/* auto-reload if need be */
if (pl.w_attack_next <= 0.0)
if (pl.cannon_mag == 0 && pl.ammo_buckshot > 0) {
Weapons_Reload(pl);
return;
}
if (pl.w_idle_next > 0.0) {
return;
}
int r = floor(random(0,2));
switch (r) {
case 0:
Weapons_ViewAnimation(pl, CANNON_IDLE1);
break;
case 1:
Weapons_ViewAnimation(pl, CANNON_IDLE2);
break;
}
pl.w_idle_next = 8.0f;
}
void
w_cannon_crosshair(player pl)
{
#ifdef CLIENT
static vector cross_pos;
cross_pos = g_hudmins + (g_hudres / 2) + [-12,-12];
drawsubpic(cross_pos, [24,24], g_cross_spr, [48/128,24/128], [0.1875, 0.1875], [1,1,1], 1, DRAWFLAG_NORMAL);
HUD_DrawAmmo1();
HUD_DrawAmmo2();
vector aicon_pos = g_hudmins + [g_hudres[0] - 48, g_hudres[1] - 42];
drawsubpic(aicon_pos, [24,24], g_hud7_spr, [72/256,72/128], [24/256, 24/128], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
#endif
}
float
w_cannon_aimanim(player pl)
{
return pl.flags & FL_CROUCHING ? ANIM_CR_AIMSHOTGUN : ANIM_AIMSHOTGUN;
}
void
w_cannon_hudpic(player pl, int s, vector pos, float a)
{
#ifdef CLIENT
vector hud_col;
if (pl.cannon_mag == 0 && pl.ammo_buckshot == 0)
hud_col = [1,0,0];
else
hud_col = g_hud_color;
if (s) {
drawsubpic(pos, [170,45], g_cannon_spr, [0,48/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
} else {
drawsubpic(pos, [170,45], g_cannon_spr, [0,0], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
}
HUD_DrawAmmoBar(pos, pl.ammo_buckshot, MAX_A_BUCKSHOT, a);
#endif
}
weapon_t
w_cannon =
{
.name = "handcannon",
.id = ITEM_CANNON,
.slot = 2,
.slot_pos = 3,
.draw = w_cannon_draw,
.holster = w_cannon_holster,
.primary = w_cannon_primary,
.secondary = w_cannon_secondary,
.reload = w_cannon_reload,
.release = w_cannon_release,
.postdraw = w_cannon_crosshair,
.precache = w_cannon_precache,
.pickup = w_cannon_pickup,
.updateammo = w_cannon_updateammo,
.wmodel = __NULL__,
.pmodel = w_cannon_pmodel,
.deathmsg = w_cannon_deathmsg,
.aimanim = w_cannon_aimanim,
.hudpic = w_cannon_hudpic
};

View file

@ -1,202 +0,0 @@
/*
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* 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.
*/
#ifdef CLIENT
var string g_chainsaw_spr;
#endif
enum
{
CHAINSAW_STARTFIRE,
CHAINSAW_CONTINUEFIRE,
CHAINSAW_STOPFIRE,
CHAINSAW_DEPLOY,
CHAINSAW_HOLSTER,
CHAINSAW_IDLE1,
CHAINSAW_IDLE2,
};
enum
{
CHAINSAWSTATE_IDLE,
CHAINSAWSTATE_ATTACKING,
};
void w_chainsaw_precache(void)
{
#ifdef SERVER
Sound_Precache("weapon_chainsaw.attack");
Sound_Precache("weapon_chainsaw.hit");
Sound_Precache("weapon_chainsaw.hitflesh");
Sound_Precache("weapon_chainsaw.idle");
Sound_Precache("weapon_chainsaw.startup");
#else
precache_model("models/v_chainsaw.mdl");
precache_model("models/p_saw.mdl");
g_chainsaw_spr = spriteframe("sprites/chainsaw.spr", 0, 0.0f);
#endif
}
void w_chainsaw_updateammo(player pl)
{
Weapons_UpdateAmmo(pl, -1, -1, -1);
}
string w_chainsaw_pmodel(player pl)
{
return "models/p_saw.mdl";
}
string w_chainsaw_deathmsg(void)
{
return "%s killed %s with chainsaw.";
}
void w_chainsaw_draw(player pl)
{
Weapons_SetModel("models/v_chainsaw.mdl");
Weapons_ViewAnimation(pl, CHAINSAW_DEPLOY);
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_chainsaw.startup");
#endif
}
void w_chainsaw_holster(player pl)
{
Weapons_ViewAnimation(pl, CHAINSAW_HOLSTER);
}
void w_chainsaw_primary(player pl)
{
/* only do it in the attack state */
if (pl.ammo_chainsaw_state == CHAINSAWSTATE_ATTACKING)
if (pl.w_attack_next)
return;
pl.ammo_chainsaw_state = CHAINSAWSTATE_ATTACKING;
Weapons_ViewAnimation(pl, CHAINSAW_CONTINUEFIRE);
#ifdef SERVER
Weapons_MakeVectors(pl);
vector src = pl.origin + pl.view_ofs;
traceline(src, src + (v_forward * 32), FALSE, pl);
if (trace_fraction >= 1.0) {
Sound_Play(pl, CHAN_WEAPON, "weapon_chainsaw.attack");
pl.w_attack_next = 0.2f;
} else {
int dmg;
SurfData_Impact(trace_ent, trace_endpos, trace_plane_normal);
if (trace_ent.takedamage) {
if (trace_ent.iBleeds) {
FX_Blood(trace_endpos, [1,0,0]);
/* Push the player towards the victim */
pl.velocity = normalize(trace_ent.origin - pl.origin) * 240;
}
dmg = Skill_GetValue("plr_chainsaw", 10);
Damage_Apply(trace_ent, self, dmg, WEAPON_CHAINSAW, DMG_BLUNT);
Sound_Play(pl, CHAN_WEAPON, "weapon_chainsaw.hitflesh");
} else {
/* well, this is in the advanced options */
if (cvar("sh_chainspark") != 1)
pointparticles(particleeffectnum("fx_spark.main"), trace_endpos, [0,0,0], 1);
Sound_Play(pl, CHAN_WEAPON, "weapon_chainsaw.hit");
}
pl.w_attack_next = 0.1f;
}
#endif
pl.w_idle_next = 0.0f;
}
void w_chainsaw_release(player pl)
{
if (pl.w_idle_next)
return;
if (pl.ammo_chainsaw_state == CHAINSAWSTATE_ATTACKING) {
pl.ammo_chainsaw_state = CHAINSAWSTATE_IDLE;
Weapons_ViewAnimation(pl, CHAINSAW_STOPFIRE);
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_chainsaw.idle");
#endif
return;
}
if (pl.ammo_chainsaw_state == CHAINSAWSTATE_IDLE) {
if (pl.w_idle_next <= 0.0f) {
/* Loop idle sound */
#ifdef SERVER
Sound_Play(pl, CHAN_WEAPON, "weapon_chainsaw.idle");
#endif
pl.w_idle_next = 1.45f;
}
if (pl.w_attack_next <= 0.0f) {
if (random() < 0.5) {
Weapons_ViewAnimation(pl, CHAINSAW_IDLE1);
} else {
Weapons_ViewAnimation(pl, CHAINSAW_IDLE2);
}
pl.w_attack_next = 5.3333f;
}
}
}
float w_chainsaw_aimanim(player pl)
{
return pl.flags & FL_CROUCHING ? ANIM_CR_AIMEGON : ANIM_AIMEGON;
}
void w_chainsaw_hudpic(player pl, int s, vector pos, float a)
{
#ifdef CLIENT
if (s) {
drawsubpic(pos, [170,45], g_chainsaw_spr,
[0,48/256], [170/256,45/256],
g_hud_color, a, DRAWFLAG_ADDITIVE);
} else {
drawsubpic(pos, [170,45], g_chainsaw_spr,
[0,0], [170/256,45/256],
g_hud_color, a, DRAWFLAG_ADDITIVE);
}
#endif
}
weapon_t w_chainsaw =
{
.name = "chainsaw",
.id = ITEM_CHAINSAW,
.slot = 0,
.slot_pos = 2,
.draw = w_chainsaw_draw,
.holster = w_chainsaw_holster,
.primary = w_chainsaw_primary,
.secondary = w_chainsaw_release,
.reload = w_chainsaw_release,
.release = w_chainsaw_release,
.postdraw = __NULL__,
.precache = w_chainsaw_precache,
.pickup = __NULL__,
.updateammo = w_chainsaw_updateammo,
.wmodel = __NULL__,
.pmodel = w_chainsaw_pmodel,
.deathmsg = w_chainsaw_deathmsg,
.aimanim = w_chainsaw_aimanim,
.hudpic = w_chainsaw_hudpic
};

View file

@ -1,247 +0,0 @@
/*
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* 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.
*/
#ifdef CLIENT
var string g_hammer_spr;
#endif
enum
{
HAMMER_IDLE1,
HAMMER_DRAW,
HAMMER_HOLSTER,
HAMMER_ATTACK1,
HAMMER_ATTACK2,
HAMMER_IDLE2,
HAMMER_IDLE3,
HAMMER_HOLSTER2,
HAMMER_HOLSTER3
};
void w_hammer_precache(void)
{
#ifdef SERVER
Sound_Precache("weapon_hammer.hit");
Sound_Precache("weapon_hammer.hitflesh");
Sound_Precache("weapon_hammer.miss");
#else
precache_model("models/p_hammer.mdl");
precache_model("models/v_hammer.mdl");
g_hammer_spr = spriteframe("sprites/hammer.spr", 0, 0.0f);
#endif
}
void w_hammer_updateammo(player pl)
{
Weapons_UpdateAmmo(pl, -1, -1, -1);
}
string w_hammer_pmodel(player pl)
{
return "models/p_hammer.mdl";
}
string w_hammer_deathmsg(void)
{
return "%s killed %s with hammer.";
}
void w_hammer_draw(player pl)
{
Weapons_SetModel("models/v_hammer.mdl");
Weapons_ViewAnimation(pl, HAMMER_DRAW);
}
void w_hammer_holster(player pl)
{
Weapons_ViewAnimation(pl, HAMMER_HOLSTER);
}
void w_hammer_primary(player pl)
{
if (!pl.w_attack_next) {
/* Hack */
if (pl.ammo_hammer_state != 1) {
Weapons_ViewAnimation(pl, HAMMER_HOLSTER2);
pl.ammo_hammer_state = 1;
pl.w_attack_next = 0.5f;
}
}
pl.w_idle_next = 2.5f;
}
void w_hammer_secondary(player pl)
{
if (!pl.w_attack_next) {
/* Hack */
if (pl.ammo_hammer_state != 2) {
Weapons_ViewAnimation(pl, HAMMER_HOLSTER3);
pl.ammo_hammer_state = 2;
pl.w_attack_next = 0.5f;
}
}
pl.w_idle_next = 2.5f;
}
void w_hammer_reload(player pl)
{
}
void w_hammer_release(player pl)
{
if (pl.w_attack_next) {
return;
}
#ifdef SERVER
int hdmg;
int hitsound = 0;
vector src = pl.origin + pl.view_ofs;
makevectors(pl.v_angle);
traceline(src, src + v_forward * 64, FALSE, self);
#endif
if (pl.ammo_hammer_state == 1) {
#ifdef SERVER
if (trace_ent.takedamage) {
if (trace_ent.iBleeds) {
FX_Blood(trace_endpos, [1,0,0]);
}
hitsound = floor(random(1, 2));
/* players only take half damage */
hdmg = Skill_GetValue("plr_hammer", 50);
Damage_Apply(trace_ent, self, hdmg, WEAPON_HAMMER, DMG_BLUNT);
makevectors(pl.v_angle);
if (trace_ent.classname == "monster_scientist") {
trace_ent.movetype = MOVETYPE_TOSS;
trace_ent.velocity = v_forward * 768 + v_up * 256;
} else if (trace_ent.classname == "player") {
trace_ent.velocity = v_forward * 768 + v_up * 256;
}
} else {
if (trace_fraction < 1.0) {
hitsound = 2;
}
}
#endif
Weapons_ViewAnimation(pl, HAMMER_ATTACK1);
pl.w_attack_next = 1.0f;
if (self.flags & FL_CROUCHING)
Animation_PlayerTop(pl, ANIM_CR_SHOOTCROWBAR, 0.41f);
else
Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f);
} else if (pl.ammo_hammer_state == 2) {
#ifdef SERVER
if (trace_ent.takedamage) {
if (trace_ent.iBleeds) {
FX_Blood(trace_endpos, [1,0,0]);
}
hitsound = floor(random(1, 2));
hdmg = Skill_GetValue("plr_hammeralt", 200);
Damage_Apply(trace_ent, self, hdmg, WEAPON_HAMMER, DMG_BLUNT);
} else {
if (trace_fraction < 1.0) {
hitsound = 2;
}
}
#endif
Weapons_ViewAnimation(pl, HAMMER_ATTACK2);
pl.w_attack_next = 0.75f;
if (self.flags & FL_CROUCHING)
Animation_PlayerTop(pl, ANIM_CR_SHOOTCROWBAR, 0.41f);
else
Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f);
}
#ifdef SERVER
if (pl.ammo_hammer_state > 0) {
string snd = "weapon_hammer.miss";
switch (hitsound) {
case 1:
snd = "weapon_hammer.hitflesh";
break;
case 2:
snd = "weapon_hammer.hit";
break;
}
Sound_Play(pl, CHAN_WEAPON, snd);
}
#endif
/* Reset the hack */
pl.ammo_hammer_state = 0;
/* Pure cosmetics start here */
if (pl.w_idle_next) {
return;
}
int r = floor(random(0,3));
switch (r) {
case 0:
Weapons_ViewAnimation(pl, HAMMER_IDLE1);
break;
case 1:
Weapons_ViewAnimation(pl, HAMMER_IDLE2);
break;
case 2:
Weapons_ViewAnimation(pl, HAMMER_IDLE3);
break;
}
pl.w_idle_next = 10.0f;
}
float w_hammer_aimanim(player pl)
{
return pl.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR;
}
void w_hammer_hudpic(player pl, int s, vector pos, float a)
{
#ifdef CLIENT
if (s) {
drawsubpic(pos, [170,45], g_hammer_spr, [0,48/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
} else {
drawsubpic(pos, [170,45], g_hammer_spr, [0,0], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
}
#endif
}
weapon_t w_hammer =
{
.name = "hammer",
.id = ITEM_HAMMER,
.slot = 0,
.slot_pos = 1,
.draw = w_hammer_draw,
.holster = w_hammer_holster,
.primary = w_hammer_primary,
.secondary = w_hammer_secondary,
.reload = w_hammer_reload,
.release = w_hammer_release,
.postdraw = __NULL__,
.precache = w_hammer_precache,
.pickup = __NULL__,
.updateammo = w_hammer_updateammo,
.wmodel = __NULL__,
.pmodel = w_hammer_pmodel,
.deathmsg = w_hammer_deathmsg,
.aimanim = w_hammer_aimanim,
.hudpic = w_hammer_hudpic
};

View file

@ -1,123 +0,0 @@
/*
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* 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 w_needle_precache(void)
{
}
void w_needle_updateammo(player pl)
{
Weapons_UpdateAmmo(pl, -1, -1, -1);
}
string w_needle_pmodel(player pl)
{
return __NULL__;
}
string w_needle_deathmsg(void)
{
return "%s poisoned %s.";
}
void w_needle_draw(player pl)
{
}
void w_needle_holster(player pl)
{
}
void w_needle_primary(player pl)
{
if (pl.w_attack_next > 0.0) {
return;
}
vector startTrace = pl.GetEyePos();
vector endTrace;
makevectors(pl.v_angle);
endTrace = startTrace + (v_forward * 96);
traceline(startTrace, endTrace, MOVE_NORMAL, pl);
pl.w_attack_next = 1.0f;
Animation_PlayerTop(pl, SCIANIM_PUSH_BUTTON, 1.0f);
#ifdef SERVER
if (trace_fraction >= 1.0) {
return;
}
if (trace_ent.takedamage == DAMAGE_NO) {
return;
}
if not (trace_ent.flags & FL_CLIENT || trace_ent.flags & FL_MONSTER) {
return;
}
Damage_Apply(trace_ent, pl, 7, WEAPON_NEEDLE, DMG_POISON);
#endif
}
void w_needle_secondary(player pl)
{
/* TODO: switch between first/third person */
}
float w_needle_aimanim(player pl)
{
return 0; /* not used */
}
void w_needle_hudpic(player pl, int s, vector pos, float a)
{
#ifdef CLIENT
if (s) {
drawsubpic(pos, [170,45], g_hammer_spr, [0,48/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
} else {
drawsubpic(pos, [170,45], g_hammer_spr, [0,0], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
}
#endif
}
bool
w_needle_isempty(player pl)
{
return false;
}
weapon_t w_needle =
{
.name = "needle",
.id = ITEM_NEEDLE,
.slot = 0,
.slot_pos = 2,
.draw = w_needle_draw,
.holster = w_needle_holster,
.primary = w_needle_primary,
.secondary = w_needle_secondary,
.reload = __NULL__,
.release = __NULL__,
.postdraw = __NULL__,
.precache = w_needle_precache,
.pickup = __NULL__,
.updateammo = w_needle_updateammo,
.wmodel = __NULL__,
.pmodel = w_needle_pmodel,
.deathmsg = w_needle_deathmsg,
.aimanim = w_needle_aimanim,
.isempty = w_needle_isempty,
.hudpic = w_needle_hudpic
};

View file

@ -1,52 +0,0 @@
/*
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
*
* 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_CROWBAR,
WEAPON_HAMMER,
WEAPON_CHAINSAW,
WEAPON_NEEDLE,
WEAPON_GLOCK,
WEAPON_PYTHON,
WEAPON_MP5,
WEAPON_SHOTGUN,
WEAPON_CROSSBOW,
WEAPON_CANNON,
WEAPON_RPG,
WEAPON_GAUSS,
WEAPON_EGON,
WEAPON_HORNETGUN,
WEAPON_HANDGRENADE,
WEAPON_SATCHEL,
WEAPON_TRIPMINE,
WEAPON_SNARK
};
#define MAX_A_9MM 250
#define MAX_A_357 36
#define MAX_A_BUCKSHOT 125
#define MAX_A_M203_GRENADE 10
#define MAX_A_BOLT 50
#define MAX_A_ROCKET 5
#define MAX_A_URANIUM 100
#define MAX_A_HANDGRENADE 10
#define MAX_A_SATCHEL 5
#define MAX_A_TRIPMINE 10
#define MAX_A_SNARK 10
#define MAX_A_HORNET 8

1
zpak001.pk3dir/PAK_NAME Normal file
View file

@ -0,0 +1 @@
package_scihunt.pk3

View file

@ -12,6 +12,6 @@ set sk_plr_chainsaw1 "10"
set sk_plr_chainsaw2 "10" set sk_plr_chainsaw2 "10"
set sk_plr_chainsaw3 "10" set sk_plr_chainsaw3 "10"
set sk_plr_cannon1 "5" set sk_plr_handcannon1 "5"
set sk_plr_cannon2 "5" set sk_plr_handcannon2 "5"
set sk_plr_cannon3 "5" set sk_plr_handcannon3 "5"

View file

@ -1,4 +1,4 @@
entityDef player entityDef player
{ {
"spawnclass" "HLPlayer" "spawnclass" "SHPlayer"
} }

View file

@ -17,6 +17,9 @@ entityDef weapon_handcannon
"def_altFireInfo" "fireInfo_altCannon" "def_altFireInfo" "fireInfo_altCannon"
"inv_name" "Hand Cannon" "inv_name" "Hand Cannon"
"clipSize" "2" "clipSize" "2"
"ammoType" "ammo_buckshot"
"ammoRequired" "1"
"model_flash" "sprites/muzzleflash2.spr"
"actHolster" "5" "actHolster" "5"
"actReload" "3" "actReload" "3"
@ -50,38 +53,25 @@ entityDef projectile_handcannon
entityDef fireInfo_handcannon entityDef fireInfo_handcannon
{ {
"def_projectile" "projectile_handcannon" "def_onFire" "projectile_handcannon"
"ammoType" "ammo_buckshot"
"ammoRequired" "2"
"ammoPerShot" "2" "ammoPerShot" "2"
"fireRate" "1.5" "fireRate" "1.5"
"actFire" "0" "actFire" "0"
"model_flash" "sprites/muzzleflash2.spr"
} }
entityDef fireInfo_altCannon entityDef fireInfo_altCannon
{ {
"def_projectile" "projectile_handcannon_single" "def_onFire" "projectile_handcannon_single"
"ammoType" "ammo_buckshot"
"ammoRequired" "1"
"ammoPerShot" "1" "ammoPerShot" "1"
"fireRate" "1.5" "fireRate" "1.5"
"actFire" "1,2" "actFire" "1,2"
"model_flash" "sprites/muzzleflash2.spr"
} }
// TODO respect sh_hchorror = 1 // TODO respect sh_hchorror = 1
entityDef fireInfo_handcannonHorror entityDef fireInfo_handcannonHorror
{ {
"def_projectile" "projectile_handcannon" "def_onFire" "projectile_handcannon"
"ammoType" "ammo_buckshot"
"ammoRequired" "0"
"ammoPerShot" "0"
"fireRate" "0.5" "fireRate" "0.5"
"actFire" "0" "actFire" "0"
"model_flash" "sprites/muzzleflash2.spr" "ammoRequired" "0"
} }