Compare commits

...

2 commits

133 changed files with 790 additions and 533 deletions

View file

@ -1,4 +1,4 @@
# FreeGunman
# Banzure Prime (FreeGunman)
Clean-room reimplementation of Gunman Chronicles in QuakeC.
![Preview 1](img/preview1.jpg)

View file

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

View file

@ -18,6 +18,12 @@ int
ClientGame_EntityUpdate(float id, float new)
{
switch (id) {
case ENT_WEAPON:
NSENTITY_READENTITY(GCWeapon, new)
break;
case ENT_PLAYER:
NSENTITY_READENTITY(HLPlayer, new)
break;
default:
return (0);
}

View file

@ -112,9 +112,9 @@ HUD_DrawHealth(void)
{
vector pos;
vector hcol;
player pl;
HLPlayer pl;
pl = (player)pSeat->m_ePlayer;
pl = (HLPlayer)pSeat->m_ePlayer;
/* Shift digits by 128 units for the larger HUD */
if (g_hudres[0] <= 640) {
@ -184,7 +184,7 @@ HUD_DrawHealth(void)
void
HUD_DrawAmmo1(void)
{
player pl = (player)pSeat->m_ePlayer;
HLPlayer pl = (HLPlayer)pSeat->m_ePlayer;
vector pos;
static int old_ammo1;
static float m_flAmmo1Alpha;
@ -213,7 +213,7 @@ HUD_DrawAmmo1(void)
void
HUD_DrawAmmo2(void)
{
player pl = (player)pSeat->m_ePlayer;
HLPlayer pl = (HLPlayer)pSeat->m_ePlayer;
vector pos;
static int old_ammo2;
@ -239,7 +239,7 @@ HUD_DrawAmmo2(void)
void
HUD_DrawAmmo3(void)
{
player pl = (player)pSeat->m_ePlayer;
HLPlayer pl = (HLPlayer)pSeat->m_ePlayer;
vector pos;
static int old_ammo3;
@ -279,16 +279,20 @@ HUD_WeaponPickupNotify(int w)
void
HUD_Draw(void)
{
player pl = (player)pSeat->m_ePlayer;
HLPlayer pl = (HLPlayer)pSeat->m_ePlayer;
g_hud_color = autocvar_con_color * (1 / 255);
/* little point in not drawing these, even if you don't have a suit */
if (pl.m_activeWeapon) {
pl.m_activeWeapon.UpdateGUI();
}
Textmenu_Draw();
Obituary_Draw();
Damage_Draw();
HUD_DamageNotify_Draw();
HUD_DrawHealth();
Weapons_DrawCrosshair(pl);
HUD_DrawWeaponSelect();
pSeatLocal->weaponSelectionHUD.Draw();
}
void

View file

@ -0,0 +1,138 @@
/*
* Copyright (c) 2022-2024 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.
*/
#ifndef GEARBOX
#define AMMO_COUNT 12
#else
#define AMMO_COUNT 17
#endif
string g_ammo_spr;
typedef struct
{
float alpha;
int count;
} ammonote_t;
ammonote_t g_ammonotify[AMMO_COUNT];
vector g_ammotype[AMMO_COUNT] = {
[0/256, 72/128], // pistol
[24/256, 72/128], // revolver
[48/256, 72/128], // grenade
[72/256, 72/128], // shell
[96/256, 72/128], // arrow
[120/256, 72/128], // rocket
[0/256, 96/128], // uranium
[24/256, 96/128], // hornet
[48/256, 96/128], // grenade
[72/256, 96/128], // satchel
[96/256, 96/128], // snark
[120/256, 96/128], // tripmine
#ifdef GEARBOX
[24/256, 72/128], // 556 (same as 357)
[24/256, 72/128], // 762 (same as 357)
[200/256, 48/128], // spore
[224/256, 48/128], // shock
[144/256, 72/128], // penguin
#endif
};
void
HUD_AmmoNotify_Init(void)
{
g_ammo_spr = spriteframe("sprites/640hud7.spr", 0, 0.0f);
}
void
HUD_AmmoNotify_Draw(__inout vector pos)
{
pos[0] = g_hudmins[0] + g_hudres[0] - 40;
for (int i = 0; i < AMMO_COUNT; i++) {
vector srcpos;
float a;
/* make sure we skip any faded entries, and also null them */
if (g_ammonotify[i].alpha <= 0.0f) {
g_ammonotify[i].count = 0;
continue;
}
/* let's get the src img pos for our type */
srcpos = g_ammotype[i];
a = bound(0, g_ammonotify[i].alpha, 1.0);
/* we'll use the alpha to control the offset so it gently glides down when fading out */
pos -= [0, 32 * a]; /* go up a notch */
drawsubpic(pos,
[24,24],
g_ammo_spr,
srcpos,
[24/256, 24/128],
g_hud_color,
a,
DRAWFLAG_ADDITIVE
);
drawfont = Font_GetID(FONT_20);
string txt = sprintf("%i", g_ammonotify[i].count);
float offs = stringwidth(txt, FALSE, [20,20]);
drawstring(pos + [-offs - 8,4], sprintf("%i", g_ammonotify[i].count), [20,20], g_hud_color, a, DRAWFLAG_ADDITIVE);
g_ammonotify[i].alpha -= (clframetime * 0.5);
}
}
void
HUD_AmmoNotify_Insert(int type, int count)
{
if (count <= 0)
return;
if (type == 7 && count < 8) // hornet hack!
return;
g_ammonotify[type].count += count;
g_ammonotify[type].alpha = 2.5f;
}
/* called whenever we should check for pickup updates */
void
HUD_AmmoNotify_Check(NSClientPlayer pl)
{
HUD_AmmoNotify_Insert(0, pl.m_iAmmoTypes[1] - pl.m_iAmmoTypes_net[1]);
HUD_AmmoNotify_Insert(1, pl.m_iAmmoTypes[2] - pl.m_iAmmoTypes_net[2]);
HUD_AmmoNotify_Insert(2, pl.m_iAmmoTypes[12] - pl.m_iAmmoTypes_net[12]);
HUD_AmmoNotify_Insert(3, pl.m_iAmmoTypes[3] - pl.m_iAmmoTypes_net[3]);
HUD_AmmoNotify_Insert(4, pl.m_iAmmoTypes[4] - pl.m_iAmmoTypes_net[4]);
HUD_AmmoNotify_Insert(5, pl.m_iAmmoTypes[5] - pl.m_iAmmoTypes_net[5]);
HUD_AmmoNotify_Insert(6, pl.m_iAmmoTypes[6] - pl.m_iAmmoTypes_net[6]);
HUD_AmmoNotify_Insert(7, pl.m_iAmmoTypes[11] - pl.m_iAmmoTypes_net[11]);
HUD_AmmoNotify_Insert(8, pl.m_iAmmoTypes[7] - pl.m_iAmmoTypes_net[7]);
HUD_AmmoNotify_Insert(9, pl.m_iAmmoTypes[8] - pl.m_iAmmoTypes_net[8]);
HUD_AmmoNotify_Insert(10, pl.m_iAmmoTypes[10] - pl.m_iAmmoTypes_net[10]);
HUD_AmmoNotify_Insert(11, pl.m_iAmmoTypes[9] - pl.m_iAmmoTypes_net[9]);
#ifdef GEARBOX
HUD_AmmoNotify_Insert(12, pl.m_iAmmoTypes[13] - pl.m_iAmmoTypes_net[13]);
HUD_AmmoNotify_Insert(13, pl.m_iAmmoTypes[14] - pl.m_iAmmoTypes_net[14]);
HUD_AmmoNotify_Insert(14, pl.m_iAmmoTypes[15] - pl.m_iAmmoTypes_net[15]);
HUD_AmmoNotify_Insert(15, pl.m_iAmmoTypes[16] - pl.m_iAmmoTypes_net[16]);
HUD_AmmoNotify_Insert(16, pl.m_iAmmoTypes[17] - pl.m_iAmmoTypes_net[17]);
#endif
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
* Copyright (c) 2016-2024 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
@ -14,7 +14,8 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
void View_ForceChange(player pl, int targetWeapon);
void View_ForceChange(NSClientPlayer pl, int targetWeapon);
vector g_vecHUDNums[6] =
{
@ -26,125 +27,68 @@ vector g_vecHUDNums[6] =
[208 / 256, 92 / 128]
};
void
HUD_SelectWeapon(NSWeapon nextWeapon)
{
if (!nextWeapon) {
pSeat->m_iHUDWeaponSelected = 0i;
return;
}
pSeat->m_iHUDWeaponSelected = nextWeapon.GetSharedID();
}
/* Select the next item in the list. */
void
HUD_DrawWeaponSelect_Forward(void)
{
player pl = (player)pSeat->m_ePlayer;
if (!pl.activeweapon) {
return;
}
if (Weapons_InputForward(pl) == FALSE) {
return;
}
if (pSeat->m_flHUDWeaponSelectTime < time) {
pSeat->m_iHUDWeaponSelected = pl.activeweapon;
pl.StartSoundDef("Player.WeaponSelectionOpen", CHAN_ITEM, false);
} else {
pl.StartSoundDef("Player.WeaponSelectionMoveSlot", CHAN_ITEM, false);
pSeat->m_iHUDWeaponSelected--;
if (pSeat->m_iHUDWeaponSelected <= 0) {
pSeat->m_iHUDWeaponSelected = g_weapons.length - 1;
}
}
pSeat->m_flHUDWeaponSelectTime = time + 3;
if not (pl.g_items & g_weapons[pSeat->m_iHUDWeaponSelected].id) {
HUD_DrawWeaponSelect_Forward();
}
}
void
HUD_DrawWeaponSelect_Back(void)
{
player pl = (player)pSeat->m_ePlayer;
if (!pl.activeweapon) {
return;
}
if (Weapons_InputBack(pl) == FALSE) {
return;
}
if (pSeat->m_flHUDWeaponSelectTime < time) {
pSeat->m_iHUDWeaponSelected = pl.activeweapon;
pl.StartSoundDef("Player.WeaponSelectionOpen", CHAN_ITEM, false);
} else {
pl.StartSoundDef("Player.WeaponSelectionMoveSlot", CHAN_ITEM, false);
pSeat->m_iHUDWeaponSelected++;
if (pSeat->m_iHUDWeaponSelected >= g_weapons.length) {
pSeat->m_iHUDWeaponSelected = 1;
}
}
pSeat->m_flHUDWeaponSelectTime = time + 3;
if not (pl.g_items & g_weapons[pSeat->m_iHUDWeaponSelected].id) {
HUD_DrawWeaponSelect_Back();
}
}
void
HUD_DrawWeaponSelect_Trigger(void)
{
player pl = (player)pSeat->m_ePlayer;
if (pl.activeweapon != pSeat->m_iHUDWeaponSelected)
View_ForceChange(pl, pSeat->m_iHUDWeaponSelected);
pl.StartSoundDef("Player.WeaponSelected", CHAN_ITEM, false);
pSeat->m_iHUDWeaponSelected = pSeat->m_flHUDWeaponSelectTime = 0;
}
void
HUD_DrawWeaponSelect_Last(void)
{
player pl = (player)pSeat->m_ePlayer;
if (pl.g_items & g_weapons[pSeat->m_iOldWeapon].id) {
pl.activeweapon = pSeat->m_iOldWeapon;
sendevent("PlayerSwitchWeapon", "i", pSeat->m_iOldWeapon);
}
}
void
HUD_DrawWeaponSelect_Num(vector vecPos, float fValue)
{
drawsubpic(vecPos, [20,20], g_hud7_spr, g_vecHUDNums[fValue], [20/256, 20/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
drawsubpic(vecPos, [20,20], g_hud7_spr, g_vecHUDNums[fValue], [20/256, 20/128], g_hud_color, 1, DRAWFLAG_ADDITIVE);
}
int
HUD_InSlotPos(int slot, int pos)
{
player pl = (player)pSeat->m_ePlayer;
for (int i = 1; i < g_weapons.length; i++) {
if (g_weapons[i].slot == slot && g_weapons[i].slot_pos == pos) {
if (pl.g_items & g_weapons[i].id) {
return i;
} else {
return (-1);
}
}
}
return (-1);
}
void
HUD_SlotSelect(int slot)
{
player pl = (player)pSeat->m_ePlayer;
#if 0
NSClientPlayer pl = (NSClientPlayer)pSeat->m_ePlayer;
int curslot = g_weapons[pSeat->m_iHUDWeaponSelected].slot;
int i;
#endif
if (g_textmenu != "") {
Textmenu_Input(slot);
return;
}
#if 0
/* hack to see if we have ANY weapons at all. */
if (!pl.activeweapon) {
return;
@ -185,12 +129,14 @@ HUD_SlotSelect(int slot)
pSeat->m_flHUDWeaponSelectTime = time + 3;
}
}
#endif
}
void
HUD_DrawWeaponSelect(void)
{
player pl = (player)pSeat->m_ePlayer;
#if 0
NSClientPlayer pl = (NSClientPlayer)pSeat->m_ePlayer;
if (!pl.activeweapon) {
return;
}
@ -238,4 +184,5 @@ HUD_DrawWeaponSelect(void)
vecPos[0] += 25;
}
}
#endif
}

View file

@ -25,6 +25,12 @@ void
ClientGame_Init(float apilevel, string enginename, float engineversion)
{
Obituary_Init();
registercommand("lastinv");
registercommand("invnext");
registercommand("invprev");
pSeatLocal->weaponSelectionHUD = spawn(HLWeaponSelect);
}
void
@ -48,4 +54,6 @@ ClientGame_RendererRestart(string rstr)
MUZZLE_SMALL = (int)getmodelindex("sprites/muzzleflash2.spr");
MUZZLE_WEIRD = (int)getmodelindex("sprites/muzzleflash3.spr");
g_cross_spr = spriteframe("sprites/crosshairs.spr", 0, 0.0f);
HLSprite_Init();
}

View file

@ -30,6 +30,9 @@ entities.qc
../../../valve/src/client/viewmodel.qc
../../../valve/src/client/obituary.qc
../../../valve/src/client/hud_dmgnotify.qc
../../../valve/src/client/hud_ammonotify.qc
../../../valve/src/client/hud_itemnotify.qc
../../../valve/src/client/HLWeaponSelect.qc
hud.qc
hud_weaponselect.qc
../../../valve/src/client/hud_sprite.qc

View file

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

View file

@ -27,6 +27,6 @@ button_aiwallplug::Respawn(void)
SetMovetype(MOVETYPE_NONE);
SetModel("models/aiwallplug.mdl");
SetSize([-32,-32,0], [32,32,48]);
SetOrigin(GetSpawnOrigin());
SetAngles(GetSpawnAngles());
SetOrigin(GetSpawnVector("origin"));
SetAngles(GetSpawnVector("angles"));
}

View file

@ -93,8 +93,8 @@ RWDecore::Respawn(void)
else
SetSolid(SOLID_NOT);
SetOrigin(GetSpawnOrigin());
SetModel(GetSpawnModel());
SetOrigin(GetSpawnVector("origin"));
SetModel(GetSpawnString("model"));
SetSize(m_vecSpawnMins, m_vecSpawnMaxs);
SetFrame(m_iSpawnFrame);
@ -111,6 +111,10 @@ RWDecore::StartTouch(entity touchingEntity)
if (touchingEntity.takedamage == DAMAGE_NO)
return;
Damage_Apply(touchingEntity, this, m_iDamage, WEAPON_NONE, 0);
NSDict damageDecl = spawn(NSDict);
damageDecl.AddKey("damage", itos(m_iDamage));
entityDamage(touchingEntity, this, touchingEntity, damageDecl.GetDeclBody(), "", GetOrigin(), g_vec_null, touchingEntity.origin);
remove(damageDecl);
m_flDamageTest = time + m_flDamageTime;
}

View file

@ -169,8 +169,8 @@ entity_digitgod::ResetCounter(void)
void
entity_digitgod::Respawn(void)
{
vector digitDir = GetSpawnAngles();
vector digitPos = GetSpawnOrigin();
vector digitDir = GetSpawnVector("angles");
vector digitPos = GetSpawnVector("origin");
for (int i = 0i; i < 3; i++) {
m_eDigits[i].SetModel("models/digits.mdl");

View file

@ -121,7 +121,7 @@ void
entity_spritegod::Respawn(void)
{
SetSize([0,0,0], [0,0,0]);
SetOrigin(GetSpawnOrigin());
SetOrigin(GetSpawnVector("origin"));
SetThink(EmitSprite);
if (m_bState == true)

View file

@ -23,7 +23,7 @@ HLGameRules::IsMultiplayer(void)
void
HLGameRules::LevelDecodeParms(NSClientPlayer pp)
{
player pl = (player)pp;
HLPlayer pl = (HLPlayer)pp;
g_landmarkpos[0] = parm1;
g_landmarkpos[1] = parm2;
g_landmarkpos[2] = parm3;
@ -37,68 +37,12 @@ HLGameRules::LevelDecodeParms(NSClientPlayer pp)
pl.activeweapon = parm11;
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;*/
pl.ammo_battery = parm12; /* beamgun */
pl.ammo_chem = parm13; /* chemicalgun */
pl.ammo_rocket = parm14; /* dml / grenades */
pl.ammo_gauss = parm15; /* gauspistol */
pl.ammo_minigun = parm16; /* minigun */
pl.ammo_buckshot = parm17; /* shotgun */
pl.fist_mode = parm18; /* knife/fists */
pl.gauss_mode = parm19;
pl.shotgun_shells = parm20;
pl.shotgun_spread = parm21;
pl.dml_launch = parm22; /* when fired, when targeted */
pl.dml_flightpath = parm23; /* guided, homing, spiral */
pl.dml_detonate = parm24; /* on impact, in proximity, timed, when tripped */
pl.dml_payload = parm25; /* explosive, cluster */
pl.chem_acid = parm26;
pl.chem_neutral = parm27;
pl.chem_base = parm28;
pl.chem_pressure = parm29;
pl.beam_range = parm30; /* TOUCH TAZER, SHORT TAZER, MEDIUM BEAM, LONG BEAM */
pl.beam_poweracc = parm31; /* LOW HIGHEST, MEDIUM HIGH, HIGH MEDIUM, HIGHEST LOW */
pl.beam_lightning = parm32; /* BEAM, CHAIN, BALL */
pl.gren_detonate = parm33; /* when tripped (tripmine = parm24;, timed, on impact */
pl.gren_payload = parm34; /* cluster, explosive */
pl.menu_active = parm35;
pl.dml_state = parm36;
if (pl.flags & FL_CROUCHING) {
setsize(pl, VEC_CHULL_MIN, VEC_CHULL_MAX);
} else {
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
}
}
void
HLGameRules::LevelChangeParms(NSClientPlayer pp)
{
player pl = (player)pp;
HLPlayer pl = (HLPlayer)pp;
parm1 = g_landmarkpos[0];
parm2 = g_landmarkpos[1];
parm3 = g_landmarkpos[2];
@ -111,36 +55,6 @@ HLGameRules::LevelChangeParms(NSClientPlayer pp)
parm64 = pl.flags;
parm10 = pl.g_items;
parm11 = pl.activeweapon;
parm12 = pl.ammo_battery; /* beamgun */
parm13 = pl.ammo_chem; /* chemicalgun */
parm14 = pl.ammo_rocket; /* dml / grenades */
parm15 = pl.ammo_gauss; /* gauspistol */
parm16 = pl.ammo_minigun; /* minigun */
parm17 = pl.ammo_buckshot; /* shotgun */
parm18 = pl.fist_mode; /* knife/fists */
parm19 = pl.gauss_mode;
parm20 = pl.shotgun_shells;
parm21 = pl.shotgun_spread;
parm22 = pl.dml_launch; /* when fired, when targeted */
parm23 = pl.dml_flightpath; /* guided, homing, spiral */
parm24 = pl.dml_detonate; /* on impact, in proximity, timed, when tripped */
parm25 = pl.dml_payload; /* explosive, cluster */
parm26 = pl.chem_acid;
parm27 = pl.chem_neutral;
parm28 = pl.chem_base;
parm29 = pl.chem_pressure;
parm30 = pl.beam_range; /* TOUCH TAZER, SHORT TAZER, MEDIUM BEAM, LONG BEAM */
parm31 = pl.beam_poweracc; /* LOW HIGHEST, MEDIUM HIGH, HIGH MEDIUM, HIGHEST LOW */
parm32 = pl.beam_lightning; /* BEAM, CHAIN, BALL */
parm33 = pl.gren_detonate; /* when tripped (tripmine;, timed, on impact */
parm34 = pl.gren_payload; /* cluster, explosive */
parm35 = pl.menu_active;
parm36 = pl.dml_state;
}
void
@ -182,13 +96,6 @@ HLGameRules::PlayerDisconnect(NSClientPlayer pl)
pl.SendFlags = PLAYER_MODELINDEX;
}
void
HLGameRules::PlayerKill(NSClientPlayer pp)
{
player pl = (player)pp;
Damage_Apply(pl, pl, pl.health, WEAPON_NONE, DMG_SKIP_ARMOR);
}
void
TriggerFlashlight(NSClient target)
{

View file

@ -80,7 +80,7 @@ HLMultiplayerRules::PlayerDeath(NSClientPlayer pl)
/* death-counter */
pl.deaths++;
forceinfokey(pl, "*deaths", ftos(pl.deaths));
pl.SetInfoKey("*deaths", ftos(pl.deaths));
/* update score-counter */
if (pl.flags & FL_CLIENT || pl.flags & FL_MONSTER)
@ -93,9 +93,9 @@ HLMultiplayerRules::PlayerDeath(NSClientPlayer pl)
#ifdef VALVE
/* explode all satchels */
s_satchel_detonate((entity)pl);
//s_satchel_detonate((entity)pl);
/* drop their posessions into a weaponbox item */
weaponbox_spawn((player)pl);
//weaponbox_spawn(pl);
#endif
/* either gib, or make a corpse */
@ -104,53 +104,103 @@ HLMultiplayerRules::PlayerDeath(NSClientPlayer pl)
float gibStrength = g_dmg_iDamage * 2.0f;
BreakModel_Entity(pl, gibDir, gibStrength);
} else {
FX_Corpse_Spawn((player)pl, ANIM_DIESIMPLE);
#if 0
float deathAnimation = ANIM_DIESIMPLE;
switch (g_dmg_iHitBody) {
case BODY_HEAD:
deathAnimation = ANIM_DIEHEADSHOT;
break;
case BODY_CHEST:
deathAnimation = ANIM_DIESPIN;
break;
case BODY_STOMACH:
deathAnimation = ANIM_DIEGUTSHOT;
break;
default:
bool isFacing = pl.IsFacingPosition(g_dmg_vecLocation);
/* we still want a change to play ANIM_DIESIMPLE */
if (random() < 0.5)
if (isFacing == false) {
deathAnimation = ANIM_DIEFORWARD;
} else {
deathAnimation = random() < 0.5 ? ANIM_DIEBACKWARDS1 : ANIM_DIEBACKWARDS1;
}
break;
}
NSEntity newCorpse = (NSEntity)FX_Corpse_Spawn(pl, deathAnimation);
/* if we were crouching, adjust the bbox (thx 2 lack of crouch death animation) */
if (pl.IsCrouching()) {
newCorpse.SetSize(VEC_HULL_MIN, [16, 16, -16]);
}
#endif
}
/* now let's make the real client invisible */
pl.SetModelindex(0);
pl.SetMovetype(MOVETYPE_NONE);
pl.SetSolid(SOLID_NOT);
pl.takedamage = DAMAGE_NO;
pl.SetTakedamage(DAMAGE_NO);
pl.gflags &= ~GF_FLASHLIGHT;
pl.gflags &= ~GF_EGONBEAM;
pl.armor = pl.activeweapon = pl.g_items = 0;
pl.health = 0;
pl.StartSoundDef("Player.Death", CHAN_AUTO, true);
/* force respawn */
pl.think = PutClientInServer;
pl.nextthink = time + 4.0f;
if (cvar("mp_forcerespawn") == 1) {
pl.ScheduleThink(PutClientInServer, 4.0f);
}
/* have we gone over the fraglimit? */
CheckRules();
}
void
HLMultiplayerRules::PlayerSpawn(NSClientPlayer pp)
HLMultiplayerRules::PlayerSpawn(NSClientPlayer pl)
{
player pl = (player)pp;
string playerModel;
/* this is where the mods want to deviate */
entity spot;
pl.classname = "player";
pl.health = pl.max_health = 100;
pl.takedamage = DAMAGE_YES;
pl.solid = SOLID_SLIDEBOX;
pl.movetype = MOVETYPE_WALK;
pl.flags = FL_CLIENT;
pl.SetMaxHealth(100);
pl.SetHealth(100);
pl.SetTakedamage(DAMAGE_YES);
pl.SetSolid(SOLID_SLIDEBOX);
pl.SetMovetype(MOVETYPE_WALK);
pl.AddFlags(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;
/* player model selection */
if (IsTeamplay() == true) {
int teamCount = tokenizebyseparator(m_strTeamList, ";");
int playerTeam = (int)pl.GetTeam();
/* not part of a team? pick one of the ones we have */
/* TODO: this should sort us into the lowest team */
if (playerTeam == 0) {
playerTeam = 1i + (int)floor(random(0, (float)teamCount)); /* teams start at 1 after all */
pl.SetTeam(playerTeam);
}
/* assign our player model */
playerModel = sprintf("models/player/%s/%s.mdl", argv(playerTeam - 1i), argv(playerTeam - 1i));
} else {
/* interpret the 'model' InfoKey */
playerModel = pl.GetInfoKey("model");
if (playerModel) {
playerModel = sprintf("models/player/%s/%s.mdl", playerModel, playerModel);
}
}
setmodel(pl, pl.model);
/* fallback is always models/player.mdl for Half-Life */
if not (whichpack(playerModel)) {
playerModel = "models/player.mdl";
}
pl.SetModel(playerModel);
pl.SetSize(VEC_HULL_MIN, VEC_HULL_MAX);
pl.ClearVelocity();
pl.gravity = __NULL__;
@ -160,20 +210,20 @@ HLMultiplayerRules::PlayerSpawn(NSClientPlayer pp)
pl.SetInfoKey("*dead", "0");
pl.SetInfoKey("*deaths", ftos(pl.deaths));
pl.SetPropData("actor_human");
pl.SetCanBleed(true);
pl.EnableBleeding();
LevelNewParms();
LevelDecodeParms(pl);
pl.g_items = ITEM_FISTS | ITEM_GAUSSPISTOL | ITEM_SUIT;
pl.activeweapon = WEAPON_GAUSSPISTOL;
pl.ammo_gauss = 35;
#if defined (VALVE) || defined (GEARBOX)
pl.GiveItem("item_suit");
pl.GiveItem("weapon_fists");
pl.GiveItem("weapon_gausspistol");
//pl.ammo_9mm = 44;
#endif
spot = Spawn_SelectRandom("info_player_deathmatch");
setorigin(pl, spot.origin);
pl.angles = spot.angles;
Weapons_RefreshAmmo(pl);
pl.Transport(spot.origin, spot.angles);
Client_FixAngle(pl, pl.angles);
}

View file

@ -89,7 +89,7 @@ HLSingleplayerRules::PlayerSpawn(NSClientPlayer pl)
pl.SetInfoKey("*dead", "0");
pl.SetInfoKey("*deaths", ftos(pl.deaths));
pl.SetPropData("actor_human");
pl.SetCanBleed(true);
pl.EnableBleeding();
/* this is where the mods want to deviate */
entity spot;
@ -105,32 +105,31 @@ HLSingleplayerRules::PlayerSpawn(NSClientPlayer pl)
pl.angles = spot.angles;
}
Weapons_RefreshAmmo(pl);
Client_FixAngle(pl, pl.angles);
}
bool
HLSingleplayerRules::ImpulseCommand(NSClient bp, float num)
HLSingleplayerRules::ImpulseCommand(NSClient pl, float num)
{
switch (num) {
case 101:
player pl = (player)bp;
pl.health = 100;
pl.armor = 100;
Weapons_AddItem(pl, WEAPON_FISTS, -1);
Weapons_AddItem(pl, WEAPON_GAUSSPISTOL, -1);
Weapons_AddItem(pl, WEAPON_BEAMGUN, -1);
Weapons_AddItem(pl, WEAPON_CHEMICALGUN, -1);
Weapons_AddItem(pl, WEAPON_DML, -1);
Weapons_AddItem(pl, WEAPON_MINIGUN, -1);
Weapons_AddItem(pl, WEAPON_AICORE, -1);
Weapons_AddItem(pl, WEAPON_SHOTGUN, -1);
Weapons_AddItem(pl, WEAPON_GRENADE, -1);
pl.SetHealth(100);
pl.SetMaxHealth(100);
pl.SetArmor(100);
pl.GiveItem("item_suit");
pl.GiveItem("weapon_fists");
pl.GiveItem("weapon_gausspistol");
pl.GiveItem("weapon_shotgun");
pl.GiveItem("weapon_minigun");
pl.GiveItem("weapon_beamgun");
pl.GiveItem("weapon_dml");
pl.GiveItem("weapon_SPchemicalgun");
pl.GiveItem("weapon_aicore");
break;
default:
return super::ImpulseCommand(bp, num);
return super::ImpulseCommand(pl, num);
}
return true;

View file

@ -70,7 +70,7 @@ public:
virtual void SpawnKey(string, string);
virtual void Spawned(void);
virtual void Respawn(void);
virtual void Pain(void);
virtual void Pain(entity, entity, int, vector, int);
nonvirtual void Fail(void);
@ -78,6 +78,7 @@ private:
string m_strFailName;
holoDamageMonster_t m_dType;
holoDamageType_t m_dDamageType;
string m_strHoloModel;
};
void
@ -95,17 +96,16 @@ hologram_damage::Spawned(void)
switch (m_dType) {
case 1:
model = "models/tube.mdl";
m_strHoloModel = "models/tube.mdl";
break;
case 2:
model = "models/raptor.mdl";
m_strHoloModel = "models/raptor.mdl";
break;
default:
model = "models/beak.mdl";
m_strHoloModel = "models/beak.mdl";
}
precache_model(model);
m_oldModel = model;
precache_model(m_strHoloModel);
}
void
@ -131,8 +131,8 @@ hologram_damage::Respawn(void)
{
super::Respawn();
SetModel(GetSpawnModel());
SetOrigin(GetSpawnOrigin());
SetModel(m_strHoloModel);
SetOrigin(GetSpawnVector("origin"));
SetSolid(SOLID_CORPSE);
SetMovetype(MOVETYPE_NONE);
SetRenderMode(RM_ADDITIVE);
@ -153,9 +153,10 @@ hologram_damage::Fail(void)
}
void
hologram_damage::Pain(void)
hologram_damage::Pain(entity inflictor, entity attacker, int damage, vector dir, int location)
{
entity_digitgod digitGod = (entity_digitgod)find(world, ::targetname, target);
string weaponName = "";
if (!target || !digitGod) {
EntError("entity_digitgod %S not found!", target);
@ -168,13 +169,13 @@ hologram_damage::Pain(void)
case HOLOFILTER_GAUSSCHARGED:
case HOLOFILTER_GAUSSRAPID:
case HOLOFILTER_GAUSSSNIPER:
if (g_dmg_iWeapon != WEAPON_GAUSSPISTOL) {
if (weaponName != "weapon_gausspistol") {
Fail();
return;
}
break;
case HOLOFILTER_BULLET:
if (!(g_dmg_iWeapon == WEAPON_SHOTGUN || g_dmg_iWeapon == WEAPON_MINIGUN)) {
if (!(weaponName == "weapon_shotgun" || weaponName == "weapon_minigun")) {
Fail();
return;
}
@ -183,7 +184,7 @@ hologram_damage::Pain(void)
case HOLOFILTER_CHEMGUNBASE:
case HOLOFILTER_CHEMGUNEXPLOSIVE:
case HOLOFILTER_CHEMGUNSMOKE:
if (g_dmg_iWeapon != WEAPON_GAUSSPISTOL) {
if (weaponName != "weapon_gausspistol") {
Fail();
return;
}
@ -192,7 +193,7 @@ hologram_damage::Pain(void)
return;
}
EntLog("Hologram informing %S about %i damage taken", target, g_dmg_iRealDamage);
digitGod.AddToCounter(g_dmg_iRealDamage);
EntLog("Hologram informing %S about %i damage taken", target, damage);
digitGod.AddToCounter(damage);
SetHealth(1000);
}

View file

@ -44,41 +44,42 @@ player_giveitems:NSPointTrigger
void
player_giveitems::Trigger(entity eAct, triggermode_t iState)
{
player pl = (player)eAct;
HLPlayer pl = (HLPlayer)eAct;
if (!(eAct.flags & FL_CLIENT))
return;
if (HasSpawnFlags(GIFL_FISTS))
Weapons_AddItem(pl, WEAPON_FISTS, -1);
pl.GiveItem("weapon_fists");
if (HasSpawnFlags(GIFL_PISTOL))
Weapons_AddItem(pl, WEAPON_GAUSSPISTOL, -1);
pl.GiveItem("weapon_gausspistol");
if (HasSpawnFlags(GIFL_SNIPER))
Weapons_AddItem(pl, WEAPON_GAUSSPISTOL, -1);
//if (HasSpawnFlags(GIFL_SNIPER))
// Weapons_AddItem(pl, WEAPON_GAUSSPISTOL, -1);
if (HasSpawnFlags(GIFL_SHOTGUN))
Weapons_AddItem(pl, WEAPON_SHOTGUN, -1);
pl.GiveItem("weapon_shotgun");
if (HasSpawnFlags(GIFL_MECHAGUN))
Weapons_AddItem(pl, WEAPON_MINIGUN, -1);
pl.GiveItem("weapon_minigun");
if (HasSpawnFlags(GIFL_COOLERS))
Weapons_AddItem(pl, WEAPON_GAUSSPISTOL, -1);
//if (HasSpawnFlags(GIFL_COOLERS))
// Weapons_AddItem(pl, WEAPON_GAUSSPISTOL, -1);
if (HasSpawnFlags(GIFL_BEAMGUN))
Weapons_AddItem(pl, WEAPON_BEAMGUN, -1);
pl.GiveItem("weapon_beamgun");
if (HasSpawnFlags(GIFL_DML))
Weapons_AddItem(pl, WEAPON_DML, -1);
pl.GiveItem("weapon_dml");
if (HasSpawnFlags(GIFL_CHEMGUN))
Weapons_AddItem(pl, WEAPON_CHEMICALGUN, -1);
pl.GiveItem("weapon_SPchemicalgun");
if (HasSpawnFlags(GIFL_AICORE))
Weapons_AddItem(pl, WEAPON_AICORE, -1);
pl.GiveItem("weapon_aicore");
/*
if (HasSpawnFlags(GIFL_ARMOR))
Weapons_AddItem(pl, WEAPON_GAUSSPISTOL, -1);
@ -93,6 +94,7 @@ player_giveitems::Trigger(entity eAct, triggermode_t iState)
if (HasSpawnFlags(GIFL_HEALTHKIT4))
Weapons_AddItem(pl, WEAPON_GAUSSPISTOL, -1);
*/
}
void

View file

@ -32,8 +32,6 @@ button_aiwallplug.qc
../../../valve/src/server/player.qc
../../../valve/src/server/items.qc
../../../src/botlib/include.src
gamerules.qc
@ -42,9 +40,7 @@ gamerules_multiplayer.qc
../../../valve/src/server/server.qc
../../../valve/src/server/damage.qc
../../../valve/src/server/flashlight.qc
../../../valve/src/server/modelevent.qc
../../../valve/src/server/spawn.qc

View file

@ -67,7 +67,7 @@ sphere_explosion::Trigger(entity eAct, triggermode_t iState)
void
sphere_explosion::Respawn(void)
{
SetOrigin(GetSpawnOrigin());
SetOrigin(GetSpawnVector("origin"));
SetSize([0,0,0], [0,0,0]);
}

10
src/shared/GCWeapon.qc Normal file
View file

@ -0,0 +1,10 @@
/*! \brief Gunman Chronicles weapon base class. */
/*!QUAKED HLWeapon (0 0.8 0.8) (-16 -16 0) (16 16 72)
# OVERVIEW
Gunman Chronicles specific weapon based on HLWeapon.
*/
class
GCWeapon:HLWeapon
{
};

View file

@ -1,27 +1,15 @@
#includelist
../../../valve/src/shared/flags.h
../../../valve/src/shared/events.h
player.qc
../../../valve/src/shared/weapon_common.h
../../../valve/src/shared/player.qc
../../../valve/src/shared/animations.h
../../../valve/src/shared/animations.qc
../../../valve/src/shared/pmove.qc
../../../valve/src/shared/fx_blood.qc
fx_gaussbeam.qc
../../../valve/src/shared/fx_gaussbeam.qc
../../../valve/src/shared/fx_corpse.qc
items.h
weapons.h
w_fists.qc
w_gausspistol.qc
w_grenade.qc
w_shotgun.qc
w_beamgun.qc
w_chemicalgun.qc
w_dml.qc
w_minigun.qc
w_aicore.qc
weapons.qc
../../../valve/src/shared/weapon_common.qc
../../../valve/src/shared/HLWeapon.qc
GCWeapon.qc
#endlist

View file

@ -29,7 +29,7 @@ enumflags
PLAYER_UNUSED7
};
class player:NSClientPlayer
class GCPlayer:HLPlayer
{
PREDICTED_INT(anim_top)
PREDICTED_FLOAT(anim_top_time)

1
zpak001.pk3dir/PAK_NAME Normal file
View file

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

View file

@ -0,0 +1,38 @@
#include "ammo/beamgunclip.def"
#include "ammo/buckshot.def"
#include "ammo/dmlclip.def"
#include "ammo/dmlsingle.def"
#include "ammo/gaussclip.def"
#include "ammo/minigunclip.def"
#include "ammo/chemical.def"
// these have to be defined by the game.
entityDef ammo_types {
"ammo_none" "0"
"ammo_battery" "1"
"ammo_chem" "2"
"ammo_rocket" "3"
"ammo_gauss" "4"
"ammo_minigun" "5"
"ammo_buckshot" "6"
}
entityDef ammo_names {
"ammo_none" "None"
"ammo_battery" "Battery"
"ammo_chem" "Chem"
"ammo_rocket" "Rockets"
"ammo_gauss" "Gauss"
"ammo_minigun" "Minigun"
"ammo_buckshot" "Buckshot"
}
entityDef ammo_max {
"ammo_none" "0"
"ammo_battery" "-1"
"ammo_chem" "50"
"ammo_rocket" "100"
"ammo_gauss" "150"
"ammo_minigun" "100"
"ammo_buckshot" "90"
}

View file

@ -8,7 +8,7 @@ entityDef ammo_beamgunclip
"spawnclass" "NSItem"
"model" "models/beamgunammo.mdl"
"inv_item" "$WEAPON_AICORE"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
"inv_ammo_battery" "5"
}

View file

@ -8,7 +8,7 @@ entityDef ammo_buckshot
"spawnclass" "NSItem"
"model" "models/shotgunammo.mdl"
"inv_item" "$WEAPON_AICORE"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
"inv_ammo_buckshot" "5"
}

View file

@ -8,7 +8,7 @@ entityDef ammo_chemical
"spawnclass" "NSItem"
"model" "models/chem_ammo.mdl"
"inv_item" "$WEAPON_AICORE"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
"inv_ammo_chem" "5"
}

View file

@ -8,7 +8,7 @@ entityDef ammo_dmlclip
"spawnclass" "NSItem"
"model" "models/dmlammo.mdl"
"inv_item" "$WEAPON_AICORE"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
"inv_ammo_rocket" "5"
}

View file

@ -8,7 +8,7 @@ entityDef ammo_dmlsingle
"spawnclass" "NSItem"
"model" "models/dmlrocket.mdl"
"inv_item" "$WEAPON_AICORE"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
"inv_ammo_rocket" "1"
}

View file

@ -8,7 +8,7 @@ entityDef ammo_gaussclip
"spawnclass" "NSItem"
"model" "models/guassammo.mdl"
"inv_item" "$WEAPON_AICORE"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
"inv_ammo_gauss" "5"
}

View file

@ -8,9 +8,9 @@ entityDef ammo_minigunClip
"spawnclass" "NSItem"
"model" "models/mechammo.mdl"
"inv_item" "$WEAPON_AICORE"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
"inv_ammo_minigun" "5"
}
entityDef ammo_mechgunClip

View file

@ -0,0 +1,31 @@
#include "decore/aicore.def"
#include "decore/bodygib.def"
#include "decore/butterflyflock.def"
#include "decore/foot.def"
#include "decore/cam.def"
#include "decore/camflare.def"
#include "decore/corpse.def"
#include "decore/eagle.def"
#include "decore/goldskull.def"
#include "decore/gutspile.def"
#include "decore/hatgib.def"
#include "decore/ice.def"
#include "decore/icebeak.def"
#include "decore/labstuff.def"
#include "decore/mushroom.def"
#include "decore/mushroom2.def"
#include "decore/nest.def"
#include "decore/pipes.def"
#include "decore/prickle.def"
#include "decore/pteradon.def"
#include "decore/sack.def"
#include "decore/scripted_boulder.def"
#include "decore/sittingtubemortar.def"
#include "decore/spacedebris.def"
#include "decore/swampplants.def"
#include "decore/torch.def"
#include "decore/torchflame.def"
#include "decore/baboon.def"
#include "decore/asteroid.def"
#include "decore/cactus.def"
#include "decore/explodable.def"

View file

@ -0,0 +1 @@
#include "hologram/beak.def"

View file

@ -0,0 +1,3 @@
#include "items/armor.def"
#include "items/gascan.def"
#include "items/healthkit.def"

View file

@ -8,7 +8,7 @@ entityDef item_armor
"spawnclass" "NSItem"
"model" "models/w_armor.mdl"
"inv_item" "$WEAPON_AICORE"
"inv_armor" "100"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
}

View file

@ -8,7 +8,7 @@ entityDef item_gascan
"spawnclass" "NSItem"
"model" "models/gastank.mdl"
"inv_item" "$WEAPON_AICORE"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
"inv_carry" "1"
}

View file

@ -8,7 +8,7 @@ entityDef item_healthkit
"spawnclass" "NSItem"
"model" "models/w_medkit.mdl"
"inv_item" "$WEAPON_AICORE"
"snd_acquire" "weapon.pickup"
"snd_respawn" "item.respawn"
"inv_health" "15"
}

View file

@ -0,0 +1,40 @@
#include "monsters/beak.def"
#include "monsters/cricket.def"
#include "monsters/critter.def"
#include "monsters/darttrap.def"
#include "monsters/dragonfly.def"
#include "monsters/endboss.def"
#include "monsters/gator.def"
#include "monsters/gunner_friendly.def"
#include "monsters/hatchetfish.def"
#include "monsters/hiveback.def"
#include "monsters/human_bandit.def"
#include "monsters/human_chopper.def"
#include "monsters/human_demoman.def"
#include "monsters/human_gunman.def"
#include "monsters/human_unarmed.def"
#include "monsters/largescorpion.def"
#include "monsters/manta.def"
#include "monsters/microraptor.def"
#include "monsters/ourano.def"
#include "monsters/penta.def"
#include "monsters/raptor.def"
#include "monsters/rustbattery.def"
#include "monsters/rustbit.def"
#include "monsters/rustbit_friendly.def"
#include "monsters/rustbot.def"
#include "monsters/rustbot_friendly.def"
#include "monsters/rustflier.def"
#include "monsters/rustgunr.def"
#include "monsters/scientist.def"
#include "monsters/scorpion.def"
#include "monsters/sentry.def"
#include "monsters/sentry_mini.def"
#include "monsters/sitting_scientist.def"
#include "monsters/tank.def"
#include "monsters/targetrocket.def"
#include "monsters/trainingbot.def"
#include "monsters/tube.def"
#include "monsters/tube_embryo.def"
#include "monsters/xenome.def"
#include "monsters/xenome_embryo.def"

Some files were not shown because too many files have changed in this diff Show more