Rebase against latest Develop, move more components from the old platform/ dir oriented towards FHL
This commit is contained in:
parent
2b300e45b0
commit
5a1728cf84
114 changed files with 1252 additions and 5221 deletions
2
engine.h
2
engine.h
|
@ -59,6 +59,7 @@
|
|||
/* uncompressed textures */
|
||||
#define IMAGEFMT_BMP /* sprays */
|
||||
#define IMAGEFMT_TGA
|
||||
#define IMAGEFMT_JPG
|
||||
|
||||
/* compressed textures */
|
||||
#define IMAGEFMT_KTX
|
||||
|
@ -193,7 +194,6 @@
|
|||
#undef IMAGEFMT_XCF
|
||||
#undef IMAGEFMT_LMP
|
||||
#undef IMAGEFMT_PNG
|
||||
#undef IMAGEFMT_JPG
|
||||
#undef IMAGEFMT_GIF
|
||||
#undef IMAGEFMT_EXR
|
||||
#undef IPLOG
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
void HUD_DrawWeaponSelect_Back(void);
|
||||
void HUD_DrawWeaponSelect_Forward(void);
|
||||
void HUD_DrawWeaponSelect_Last(void);
|
||||
|
||||
int
|
||||
ClientGame_ConsoleCommand(void)
|
||||
{
|
||||
|
@ -21,8 +25,44 @@ ClientGame_ConsoleCommand(void)
|
|||
case "chooseteam":
|
||||
sendevent("HLDM_Chooseteam", "s", argv(1));
|
||||
break;
|
||||
case "hudSort":
|
||||
HLWeapon_SortWeaponChain((NSClientPlayer)pSeat->m_ePlayer);
|
||||
case "invnext":
|
||||
HUD_DrawWeaponSelect_Back();
|
||||
break;
|
||||
case "invprev":
|
||||
HUD_DrawWeaponSelect_Forward();
|
||||
break;
|
||||
case "lastinv":
|
||||
HUD_DrawWeaponSelect_Last();
|
||||
break;
|
||||
case "slot1":
|
||||
HUD_SlotSelect(0);
|
||||
break;
|
||||
case "slot2":
|
||||
HUD_SlotSelect(1);
|
||||
break;
|
||||
case "slot3":
|
||||
HUD_SlotSelect(2);
|
||||
break;
|
||||
case "slot4":
|
||||
HUD_SlotSelect(3);
|
||||
break;
|
||||
case "slot5":
|
||||
HUD_SlotSelect(4);
|
||||
break;
|
||||
case "slot6":
|
||||
HUD_SlotSelect(5);
|
||||
break;
|
||||
case "slot7":
|
||||
HUD_SlotSelect(6);
|
||||
break;
|
||||
case "slot8":
|
||||
HUD_SlotSelect(7);
|
||||
break;
|
||||
case "slot9":
|
||||
HUD_SlotSelect(8);
|
||||
break;
|
||||
case "slot10":
|
||||
HUD_SlotSelect(9);
|
||||
break;
|
||||
default:
|
||||
return (0);
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (c) 2019-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.
|
||||
*/
|
||||
|
||||
var string g_damage_spr_t;
|
||||
var string g_damage_spr_b;
|
||||
var string g_damage_spr_l;
|
||||
|
@ -31,7 +47,7 @@ Damage_Draw(void)
|
|||
|
||||
HUD_DamageNotify_Check();
|
||||
|
||||
center = video_mins + (video_res / 2);
|
||||
center = video_mins + (g_vidsize / 2);
|
||||
|
||||
/* the pos relative to the player + view_dir determines which
|
||||
* and how bright each indicator is drawn. so first get the relative
|
||||
|
@ -65,7 +81,7 @@ Damage_Draw(void)
|
|||
if (autocvar_cg_damageFill > 0.0) {
|
||||
vector finalColor = [1,1,1];
|
||||
finalColor[1] = finalColor[2] = 1.0 - (pSeat->m_flDamageAlpha * autocvar_cg_damageFill);
|
||||
drawpic(video_mins, "fade_modulate", video_res, finalColor, 1.0, DRAWFLAG_NORMAL);
|
||||
drawpic(video_mins, "fade_modulate", g_vidsize, finalColor, 1.0, DRAWFLAG_NORMAL);
|
||||
}
|
||||
|
||||
pSeat->m_flDamageAlpha -= clframetime;
|
||||
|
|
|
@ -68,4 +68,3 @@ void HUD_DrawAmmo3(void);
|
|||
void HUD_DrawAmmoBar(vector pos, float val, float max, float a);
|
||||
void HUD_WeaponPickupNotify(int);
|
||||
|
||||
NSWeapon HLWeapon_SortWeaponChain(NSClientPlayer targetPlayer);
|
||||
|
|
|
@ -25,10 +25,12 @@ ClientGame_EntityUpdate(float id, float new)
|
|||
NSENTITY_READENTITY(HLWeapon, new)
|
||||
break;
|
||||
case ENT_PLAYER:
|
||||
#ifndef GEARBOX
|
||||
NSENTITY_READENTITY(HLPlayer, new)
|
||||
#else
|
||||
#ifdef GEARBOX
|
||||
NSENTITY_READENTITY(OP4Player, new)
|
||||
#elif SCIHUNT
|
||||
NSENTITY_READENTITY(SHPlayer, new)
|
||||
#else
|
||||
NSENTITY_READENTITY(HLPlayer, new)
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
/*
|
||||
* 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
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define DMG_COUNT 8
|
||||
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
/*
|
||||
* Copyright (c) 2023-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.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
string m_strImage;
|
||||
|
|
|
@ -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,80 +14,8 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
.NSWeapon m_nextWeapon;
|
||||
.NSWeapon m_prevWeapon;
|
||||
|
||||
void View_ForceChange(NSClientPlayer pl, int targetWeapon);
|
||||
|
||||
NSWeapon
|
||||
HLWeapon_SortWeaponChain(NSClientPlayer targetPlayer)
|
||||
{
|
||||
NSWeapon itemChain = targetPlayer.m_itemList;
|
||||
int heighestSlot = -1i;
|
||||
int heighestPos = -1i;
|
||||
NSWeapon firstWeapon, lastWeapon;
|
||||
|
||||
firstWeapon = lastWeapon = __NULL__;
|
||||
|
||||
if (!targetPlayer.m_itemList) {
|
||||
return __NULL__;
|
||||
}
|
||||
|
||||
/* first we determine the range of our hud buckets. */
|
||||
while (itemChain) {
|
||||
if (itemChain.IsWeapon() == true) {
|
||||
int hudSlot = itemChain.GetDefInt("hudSlot");
|
||||
int hudPos = itemChain.GetDefInt("hudSlotPos");
|
||||
|
||||
if (hudSlot > heighestSlot) {
|
||||
heighestSlot = hudSlot;
|
||||
}
|
||||
if (hudPos > heighestPos) {
|
||||
heighestPos = hudPos;
|
||||
}
|
||||
}
|
||||
|
||||
itemChain = itemChain.chain;
|
||||
}
|
||||
|
||||
for (int hS = 0i; hS <= heighestSlot; hS++) {
|
||||
for (int hP = 0i; hP <= heighestPos; hP++) {
|
||||
itemChain = targetPlayer.m_itemList;
|
||||
|
||||
while (itemChain) {
|
||||
if (itemChain.IsWeapon() == true) {
|
||||
int hudSlot = itemChain.GetDefInt("hudSlot");
|
||||
int hudPos = itemChain.GetDefInt("hudSlotPos");
|
||||
|
||||
if (hudSlot == hS && hudPos == hP) {
|
||||
/* first weapon in the chain? */
|
||||
if (!lastWeapon) {
|
||||
firstWeapon = itemChain;
|
||||
lastWeapon = firstWeapon;
|
||||
} else {
|
||||
/* assign this weapon to the last weapon of our chain. */
|
||||
lastWeapon.m_nextWeapon = itemChain;
|
||||
itemChain.m_prevWeapon = lastWeapon;
|
||||
lastWeapon = itemChain;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
itemChain = itemChain.chain;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* test */
|
||||
NSWeapon weaponTest = firstWeapon;
|
||||
while (weaponTest) {
|
||||
weaponTest = weaponTest.m_nextWeapon;
|
||||
}
|
||||
|
||||
firstWeapon.m_prevWeapon = lastWeapon;
|
||||
|
||||
return (firstWeapon);
|
||||
}
|
||||
|
||||
vector g_vecHUDNums[6] =
|
||||
{
|
||||
|
@ -99,15 +27,6 @@ vector g_vecHUDNums[6] =
|
|||
[208 / 256, 92 / 128]
|
||||
};
|
||||
|
||||
bool
|
||||
HUD_DrawWeaponSelect_CanSwitch(NSClientPlayer pl)
|
||||
{
|
||||
if (!pl.m_activeWeapon)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
HUD_SelectWeapon(NSWeapon nextWeapon)
|
||||
{
|
||||
|
@ -123,39 +42,11 @@ HUD_SelectWeapon(NSWeapon nextWeapon)
|
|||
void
|
||||
HUD_DrawWeaponSelect_Forward(void)
|
||||
{
|
||||
NSClientPlayer pl = (NSClientPlayer)pSeat->m_ePlayer;
|
||||
NSWeapon firstWeapon;
|
||||
|
||||
if (HUD_DrawWeaponSelect_CanSwitch(pl) = false) {
|
||||
return;
|
||||
}
|
||||
|
||||
firstWeapon = HLWeapon_SortWeaponChain(pl);
|
||||
|
||||
if (pl.m_activeWeapon.m_nextWeapon) {
|
||||
HUD_SelectWeapon(pl.m_activeWeapon.m_nextWeapon);
|
||||
} else {
|
||||
HUD_SelectWeapon(firstWeapon);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
HUD_DrawWeaponSelect_Back(void)
|
||||
{
|
||||
NSClientPlayer pl = (NSClientPlayer)pSeat->m_ePlayer;
|
||||
NSWeapon firstWeapon;
|
||||
|
||||
if (HUD_DrawWeaponSelect_CanSwitch(pl) = false) {
|
||||
return;
|
||||
}
|
||||
|
||||
firstWeapon = HLWeapon_SortWeaponChain(pl);
|
||||
|
||||
if (pl.m_activeWeapon.m_prevWeapon) {
|
||||
HUD_SelectWeapon(pl.m_activeWeapon.m_prevWeapon);
|
||||
} else {
|
||||
HUD_SelectWeapon(firstWeapon);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -26,7 +26,10 @@ ClientGame_Init(float apilevel, string enginename, float engineversion)
|
|||
{
|
||||
Obituary_Init();
|
||||
registercommand("chooseteam");
|
||||
registercommand("hudSort");
|
||||
|
||||
registercommand("lastinv");
|
||||
registercommand("invnext");
|
||||
registercommand("invprev");
|
||||
}
|
||||
|
||||
void VGUI_ShowMOTD();
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#pragma target fte_5768
|
||||
//#pragma flag enable assumeint
|
||||
#pragma progs_dat "../../zpak001.pk3dir/csprogs.dat"
|
||||
|
||||
#define CSQC
|
||||
|
@ -10,35 +9,30 @@
|
|||
#includelist
|
||||
../../../src/shared/fteextensions.qc
|
||||
../../../src/shared/defs.h
|
||||
defs.h
|
||||
../../../valve/src/client/defs.h
|
||||
../../../src/client/defs.h
|
||||
|
||||
../../../src/vgui/include.src
|
||||
|
||||
../../../src/gs-entbase/client.src
|
||||
../../../src/gs-entbase/shared.src
|
||||
../shared/include.src
|
||||
|
||||
draw.qc
|
||||
|
||||
damage.qc
|
||||
init.qc
|
||||
../../../valve/src/client/draw.qc
|
||||
../../../valve/src/client/damage.qc
|
||||
../../../valve/src/client/init.qc
|
||||
../../../valve/src/client/flashlight.qc
|
||||
entities.qc
|
||||
cmds.qc
|
||||
game_event.qc
|
||||
../../../valve/src/client/entities.qc
|
||||
../../../valve/src/client/cmds.qc
|
||||
../../../valve/src/client/game_event.qc
|
||||
../../../valve/src/client/camera.qc
|
||||
../../../valve/src/client/viewmodel.qc
|
||||
obituary.qc
|
||||
hud_sprite.qc
|
||||
hud_itemnotify.qc
|
||||
hud_dmgnotify.qc
|
||||
hud_ammonotify.qc
|
||||
hud.qc
|
||||
hud_weaponselect.qc
|
||||
scoreboard.qc
|
||||
|
||||
../../../valve/src/client/obituary.qc
|
||||
../../../valve/src/client/hud_sprite.qc
|
||||
../../../valve/src/client/hud_itemnotify.qc
|
||||
../../../valve/src/client/hud_dmgnotify.qc
|
||||
../../../valve/src/client/hud_ammonotify.qc
|
||||
../../../valve/src/client/hud.qc
|
||||
../../../valve/src/client/hud_weaponselect.qc
|
||||
../../../valve/src/client/scoreboard.qc
|
||||
../../../src/client/include.src
|
||||
vgui_motd.qc
|
||||
../../../valve/src/client/vgui_motd.qc
|
||||
../../../src/shared/include.src
|
||||
#endlist
|
||||
|
|
|
@ -207,9 +207,9 @@ Scores_Draw(void)
|
|||
}
|
||||
|
||||
c += (serverkeyfloat("teams") * 10);
|
||||
pos = video_mins + [(video_res[0] / 2) - 145, (video_res[1] / 2) - c];
|
||||
pos = video_mins + [(g_vidsize[0] / 2) - 145, (g_vidsize[1] / 2) - c];
|
||||
} else {
|
||||
pos = video_mins + [(video_res[0] / 2) - 145, 30];
|
||||
pos = video_mins + [(g_vidsize[0] / 2) - 145, 30];
|
||||
}
|
||||
|
||||
if (Util_IsTeamplay()) {
|
||||
|
|
|
@ -61,5 +61,5 @@ VGUI_ShowMOTD(void)
|
|||
}
|
||||
|
||||
winMotd.Show();
|
||||
winMotd.SetPos((video_res / 2) - (winMotd.GetSize() / 2));
|
||||
winMotd.SetPos((g_vidsize / 2) - (winMotd.GetSize() / 2));
|
||||
}
|
||||
|
|
64
src/server/HLScientist.qc
Normal file
64
src/server/HLScientist.qc
Normal file
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
class
|
||||
HLScientist:NSTalkMonster
|
||||
{
|
||||
void HLScientist(void);
|
||||
|
||||
virtual void Respawn(void);
|
||||
};
|
||||
|
||||
void
|
||||
HLScientist::HLScientist(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
HLScientist::Respawn(void)
|
||||
{
|
||||
int bodyValue = GetSpawnInt("body");
|
||||
super::Respawn();
|
||||
|
||||
if (bodyValue == -1i) {
|
||||
SetBody((int)floor(random(1,5)));
|
||||
SetSkin(0);
|
||||
|
||||
switch (bodyValue) {
|
||||
case 1i:
|
||||
m_flPitch = 105;
|
||||
netname = "Walter";
|
||||
SetBodyInGroup(1, 1);
|
||||
break;
|
||||
case 2i:
|
||||
m_flPitch = 100;
|
||||
netname = "Einstein";
|
||||
SetBodyInGroup(1, 2);
|
||||
break;
|
||||
case 3i:
|
||||
m_flPitch = 95;
|
||||
netname = "Luther";
|
||||
SetBodyInGroup(1, 3);
|
||||
SetSkin(1);
|
||||
break;
|
||||
default:
|
||||
m_flPitch = 100;
|
||||
netname = "Slick";
|
||||
SetBodyInGroup(1, 4);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,428 +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.
|
||||
*/
|
||||
|
||||
class item_ammo:NSRenderableEntity
|
||||
{
|
||||
void(void) item_ammo;
|
||||
|
||||
virtual void(void) Spawned;
|
||||
virtual void(void) Respawn;
|
||||
virtual void(entity) Touch;
|
||||
};
|
||||
|
||||
void
|
||||
item_ammo::Touch(entity eToucher)
|
||||
{
|
||||
if not (eToucher.flags & FL_CLIENT) {
|
||||
return;
|
||||
}
|
||||
|
||||
player pl = (player)eToucher;
|
||||
Sound_Play(eToucher, CHAN_ITEM, "ammo.pickup");
|
||||
Weapons_RefreshAmmo(pl);
|
||||
Logging_Pickup(eToucher, this, __NULL__);
|
||||
|
||||
if (real_owner || cvar("sv_playerslots") == 1) {
|
||||
Destroy();
|
||||
} else {
|
||||
Disappear();
|
||||
ScheduleThink(Respawn, 30.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
item_ammo::Respawn(void)
|
||||
{
|
||||
static void AdjustSpawnPos(void) {
|
||||
RestoreAngles();
|
||||
SetOrigin(GetSpawnOrigin());
|
||||
DropToFloor();
|
||||
SetMovetype(MOVETYPE_TOSS);
|
||||
}
|
||||
|
||||
SetSolid(SOLID_TRIGGER);
|
||||
SetMovetype(MOVETYPE_TOSS);
|
||||
SetOrigin(GetSpawnOrigin());
|
||||
SetModel(GetSpawnModel());
|
||||
SetSize([-16,-16,0],[16,16,16]);
|
||||
|
||||
ReleaseThink();
|
||||
|
||||
if (real_owner && time > 30.0f)
|
||||
Sound_Play(this, CHAN_ITEM, "ammo.respawn");
|
||||
|
||||
ScheduleThink(AdjustSpawnPos, 0.0f);
|
||||
}
|
||||
|
||||
void
|
||||
item_ammo::Spawned(void)
|
||||
{
|
||||
super::Spawned();
|
||||
|
||||
Sound_Precache("ammo.pickup");
|
||||
Sound_Precache("ammo.respawn");
|
||||
precache_model(model);
|
||||
}
|
||||
|
||||
void
|
||||
item_ammo::item_ammo(void)
|
||||
{
|
||||
m_oldModel = model;
|
||||
}
|
||||
|
||||
/*QUAKED ammo_357 (0 0 0.8) (-16 -16 0) (16 16 32)
|
||||
|
||||
HALF-LIFE (1998) ENTITY
|
||||
|
||||
Ammo for the .357 Magnum Revolver.
|
||||
A single ammo_357 will provide 6 bullets.
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_357ammobox.mdl"
|
||||
*/
|
||||
|
||||
class ammo_357:item_ammo
|
||||
{
|
||||
void(void) ammo_357;
|
||||
virtual void(entity) Touch;
|
||||
};
|
||||
|
||||
void
|
||||
ammo_357::ammo_357(void)
|
||||
{
|
||||
model = "models/w_357ammobox.mdl";
|
||||
}
|
||||
|
||||
void
|
||||
ammo_357::Touch(entity eToucher)
|
||||
{
|
||||
if not (eToucher.flags & FL_CLIENT) {
|
||||
return;
|
||||
}
|
||||
if (eToucher.classname == "player") {
|
||||
player pl = (player)eToucher;
|
||||
if (pl.ammo_357 < MAX_A_357) {
|
||||
pl.ammo_357 = bound(0, pl.ammo_357 + 6, MAX_A_357);
|
||||
item_ammo::Touch(eToucher);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*QUAKED ammo_9mmAR (0 0 0.8) (-16 -16 0) (16 16 32)
|
||||
|
||||
HALF-LIFE (1998) ENTITY
|
||||
|
||||
Ammo for the 9mm Handgun and the 9mm AR.
|
||||
A single ammo_9mmAR will provide 50 bullets.
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_9mmarclip.mdl"
|
||||
*/
|
||||
|
||||
class ammo_9mmAR:item_ammo
|
||||
{
|
||||
void(void) ammo_9mmAR;
|
||||
virtual void(entity) Touch;
|
||||
};
|
||||
|
||||
void
|
||||
ammo_9mmAR::ammo_9mmAR(void)
|
||||
{
|
||||
model = "models/w_9mmarclip.mdl";
|
||||
}
|
||||
|
||||
void
|
||||
ammo_9mmAR::Touch(entity eToucher)
|
||||
{
|
||||
if not (eToucher.flags & FL_CLIENT) {
|
||||
return;
|
||||
}
|
||||
if (eToucher.classname == "player") {
|
||||
player pl = (player)eToucher;
|
||||
if (pl.ammo_9mm < MAX_A_9MM) {
|
||||
pl.ammo_9mm = bound(0, pl.ammo_9mm + 50, MAX_A_9MM);
|
||||
item_ammo::Touch(eToucher);
|
||||
}
|
||||
}
|
||||
}
|
||||
CLASSEXPORT(ammo_mp5clip, ammo_9mmAR)
|
||||
CLASSEXPORT(ammo_9mmARclip, ammo_9mmAR)
|
||||
|
||||
/*QUAKED ammo_9mmbox (0 0 0.8) (-16 -16 0) (16 16 32)
|
||||
|
||||
HALF-LIFE (1998) ENTITY
|
||||
|
||||
Ammo for the 9mm Handgun and the 9mm AR.
|
||||
A single ammo_9mmbox will provide 200 bullets.
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_chainammo.mdl"
|
||||
*/
|
||||
|
||||
class ammo_9mmbox:item_ammo
|
||||
{
|
||||
void(void) ammo_9mmbox;
|
||||
virtual void(entity) Touch;
|
||||
};
|
||||
|
||||
void
|
||||
ammo_9mmbox::ammo_9mmbox(void)
|
||||
{
|
||||
model = "models/w_chainammo.mdl";
|
||||
}
|
||||
|
||||
void
|
||||
ammo_9mmbox::Touch(entity eToucher)
|
||||
{
|
||||
if not (eToucher.flags & FL_CLIENT) {
|
||||
return;
|
||||
}
|
||||
if (eToucher.classname == "player") {
|
||||
player pl = (player)eToucher;
|
||||
if (pl.ammo_9mm < MAX_A_9MM) {
|
||||
pl.ammo_9mm = bound(0, pl.ammo_9mm + 200, MAX_A_9MM);
|
||||
item_ammo::Touch(eToucher);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*QUAKED ammo_9mmclip (0 0 0.8) (-16 -16 0) (16 16 32)
|
||||
|
||||
HALF-LIFE (1998) ENTITY
|
||||
|
||||
Ammo for the 9mm Handgun and the 9mm AR.
|
||||
A single ammo_9mmclip will provide 17 bullets.
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_9mmclip.mdl"
|
||||
*/
|
||||
|
||||
class ammo_9mmclip:item_ammo
|
||||
{
|
||||
void(void) ammo_9mmclip;
|
||||
virtual void(entity) Touch;
|
||||
};
|
||||
|
||||
void
|
||||
ammo_9mmclip::ammo_9mmclip(void)
|
||||
{
|
||||
model = "models/w_9mmclip.mdl";
|
||||
}
|
||||
|
||||
void
|
||||
ammo_9mmclip::Touch(entity eToucher)
|
||||
{
|
||||
if not (eToucher.flags & FL_CLIENT) {
|
||||
return;
|
||||
}
|
||||
if (eToucher.classname == "player") {
|
||||
player pl = (player)eToucher;
|
||||
if (pl.ammo_9mm < MAX_A_9MM) {
|
||||
pl.ammo_9mm = bound(0, pl.ammo_9mm + 17, MAX_A_9MM);
|
||||
item_ammo::Touch(eToucher);
|
||||
}
|
||||
}
|
||||
}
|
||||
CLASSEXPORT(ammo_glockclip, ammo_9mmclip)
|
||||
|
||||
/*QUAKED ammo_ARgrenades (0 0 0.8) (-16 -16 0) (16 16 32)
|
||||
|
||||
HALF-LIFE (1998) ENTITY
|
||||
|
||||
Ammo for the 9mm AR's secondary fire.
|
||||
A single ammo_ARgrenades will provide 2 AR grenades.
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_argrenade.mdl"
|
||||
*/
|
||||
|
||||
class ammo_ARgrenades:item_ammo
|
||||
{
|
||||
void(void) ammo_ARgrenades;
|
||||
virtual void(entity) Touch;
|
||||
};
|
||||
|
||||
void
|
||||
ammo_ARgrenades::ammo_ARgrenades(void)
|
||||
{
|
||||
model = "models/w_argrenade.mdl";
|
||||
}
|
||||
|
||||
void
|
||||
ammo_ARgrenades::Touch(entity eToucher)
|
||||
{
|
||||
if not (eToucher.flags & FL_CLIENT) {
|
||||
return;
|
||||
}
|
||||
if (eToucher.classname == "player") {
|
||||
player pl = (player)eToucher;
|
||||
if (pl.ammo_m203_grenade < MAX_A_M203_GRENADE) {
|
||||
pl.ammo_m203_grenade = bound(0, pl.ammo_m203_grenade + 2, MAX_A_M203_GRENADE);
|
||||
item_ammo::Touch(eToucher);
|
||||
}
|
||||
}
|
||||
}
|
||||
CLASSEXPORT(ammo_mp5grenades, ammo_ARgrenades)
|
||||
|
||||
/*QUAKED ammo_buckshot (0 0 0.8) (-16 -16 0) (16 16 32)
|
||||
|
||||
HALF-LIFE (1998) ENTITY
|
||||
|
||||
Ammo for the Shotgun.
|
||||
A single ammo_buckshot will provide 12 shells.
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_shotbox.mdl"
|
||||
*/
|
||||
|
||||
class ammo_buckshot:item_ammo
|
||||
{
|
||||
void(void) ammo_buckshot;
|
||||
virtual void(entity) Touch;
|
||||
};
|
||||
|
||||
void
|
||||
ammo_buckshot::ammo_buckshot(void)
|
||||
{
|
||||
model = "models/w_shotbox.mdl";
|
||||
}
|
||||
|
||||
void
|
||||
ammo_buckshot::Touch(entity eToucher)
|
||||
{
|
||||
if not (eToucher.flags & FL_CLIENT) {
|
||||
return;
|
||||
}
|
||||
if (eToucher.classname == "player") {
|
||||
player pl = (player)eToucher;
|
||||
if (pl.ammo_buckshot < MAX_A_BUCKSHOT) {
|
||||
pl.ammo_buckshot = bound(0, pl.ammo_buckshot + 12, MAX_A_BUCKSHOT);
|
||||
item_ammo::Touch(eToucher);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*QUAKED ammo_crossbow (0 0 0.8) (-16 -16 0) (16 16 32)
|
||||
|
||||
HALF-LIFE (1998) ENTITY
|
||||
|
||||
Ammo for the Crossbow.
|
||||
A single ammo_crossbow will provide 5 bolts.
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_crossbow_clip.mdl"
|
||||
*/
|
||||
|
||||
class ammo_crossbow:item_ammo
|
||||
{
|
||||
void(void) ammo_crossbow;
|
||||
virtual void(entity) Touch;
|
||||
};
|
||||
|
||||
void
|
||||
ammo_crossbow::ammo_crossbow(void)
|
||||
{
|
||||
model = "models/w_crossbow_clip.mdl";
|
||||
}
|
||||
|
||||
void
|
||||
ammo_crossbow::Touch(entity eToucher)
|
||||
{
|
||||
if not (eToucher.flags & FL_CLIENT) {
|
||||
return;
|
||||
}
|
||||
if (eToucher.classname == "player") {
|
||||
player pl = (player)eToucher;
|
||||
if (pl.ammo_bolt < MAX_A_BOLT) {
|
||||
pl.ammo_bolt = bound(0, pl.ammo_bolt + 5, MAX_A_BOLT);
|
||||
item_ammo::Touch(eToucher);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*QUAKED ammo_gaussclip (0 0 0.8) (-16 -16 0) (16 16 32)
|
||||
|
||||
HALF-LIFE (1998) ENTITY
|
||||
|
||||
Ammo for the Tau Cannon and the Gluon Gun.
|
||||
A single ammo_gaussclip will provide 20 cells.
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_gaussammo.mdl"
|
||||
*/
|
||||
|
||||
class ammo_gaussclip:item_ammo
|
||||
{
|
||||
void(void) ammo_gaussclip;
|
||||
virtual void(entity) Touch;
|
||||
};
|
||||
|
||||
void
|
||||
ammo_gaussclip::ammo_gaussclip(void)
|
||||
{
|
||||
model = "models/w_gaussammo.mdl";
|
||||
}
|
||||
|
||||
void
|
||||
ammo_gaussclip::Touch(entity eToucher)
|
||||
{
|
||||
if not (eToucher.flags & FL_CLIENT) {
|
||||
return;
|
||||
}
|
||||
|
||||
player pl = (player)eToucher;
|
||||
if (pl.ammo_uranium < MAX_A_URANIUM) {
|
||||
pl.ammo_uranium = bound(0, pl.ammo_uranium + 20, MAX_A_URANIUM);
|
||||
item_ammo::Touch(eToucher);
|
||||
}
|
||||
}
|
||||
|
||||
/*QUAKED ammo_rpgclip (0 0 0.8) (-16 -16 0) (16 16 32)
|
||||
|
||||
HALF-LIFE (1998) ENTITY
|
||||
|
||||
Ammo for the RPG.
|
||||
A single ammo_rpgclip will provide 1 rocket.
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_rpgammo.mdl"
|
||||
*/
|
||||
|
||||
class ammo_rpgclip:item_ammo
|
||||
{
|
||||
void(void) ammo_rpgclip;
|
||||
virtual void(entity) Touch;
|
||||
};
|
||||
|
||||
void
|
||||
ammo_rpgclip::ammo_rpgclip(void)
|
||||
{
|
||||
model = "models/w_rpgammo.mdl";
|
||||
}
|
||||
|
||||
void
|
||||
ammo_rpgclip::Touch(entity eToucher)
|
||||
{
|
||||
if not (eToucher.flags & FL_CLIENT) {
|
||||
return;
|
||||
}
|
||||
|
||||
player pl = (player)eToucher;
|
||||
if (pl.ammo_rocket < MAX_A_ROCKET) {
|
||||
pl.ammo_rocket = bound(0, pl.ammo_rocket + 1, MAX_A_ROCKET);
|
||||
item_ammo::Touch(eToucher);
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2022 Vera Visions LLC.
|
||||
*
|
||||
* 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.
|
||||
*/
|
|
@ -110,35 +110,49 @@ HLSingleplayerRules::ImpulseCommand(NSClient pl, float num)
|
|||
pl.SetHealth(100);
|
||||
pl.SetMaxHealth(100);
|
||||
pl.SetArmor(100);
|
||||
#if 0
|
||||
pl.g_items |= ITEM_SUIT;
|
||||
Weapons_AddItem(pl, WEAPON_CROWBAR, -1);
|
||||
Weapons_AddItem(pl, WEAPON_GLOCK, -1);
|
||||
Weapons_AddItem(pl, WEAPON_PYTHON, -1);
|
||||
Weapons_AddItem(pl, WEAPON_MP5, -1);
|
||||
Weapons_AddItem(pl, WEAPON_SHOTGUN, -1);
|
||||
Weapons_AddItem(pl, WEAPON_CROSSBOW, -1);
|
||||
Weapons_AddItem(pl, WEAPON_RPG, -1);
|
||||
Weapons_AddItem(pl, WEAPON_GAUSS, -1);
|
||||
Weapons_AddItem(pl, WEAPON_EGON, -1);
|
||||
Weapons_AddItem(pl, WEAPON_HORNETGUN, -1);
|
||||
Weapons_AddItem(pl, WEAPON_HANDGRENADE, -1);
|
||||
Weapons_AddItem(pl, WEAPON_SATCHEL, -1);
|
||||
Weapons_AddItem(pl, WEAPON_TRIPMINE, -1);
|
||||
Weapons_AddItem(pl, WEAPON_SNARK, -1);
|
||||
pl.ammo_m203_grenade = 10;
|
||||
pl.GiveItem("item_suit");
|
||||
pl.GiveItem("weapon_357");
|
||||
pl.GiveItem("weapon_9mmAR");
|
||||
pl.GiveItem("weapon_9mmhandgun");
|
||||
pl.GiveItem("weapon_crossbow");
|
||||
pl.GiveItem("weapon_crowbar");
|
||||
pl.GiveItem("weapon_egon");
|
||||
pl.GiveItem("weapon_gauss");
|
||||
pl.GiveItem("weapon_handgrenade");
|
||||
pl.GiveItem("weapon_hornetgun");
|
||||
pl.GiveItem("weapon_rpg");
|
||||
pl.GiveItem("weapon_satchel");
|
||||
pl.GiveItem("weapon_shotgun");
|
||||
pl.GiveItem("weapon_snark");
|
||||
pl.GiveItem("weapon_tripmine");
|
||||
pl.GiveAmmo(ammoNumForName("ammo_9mm"), 255);
|
||||
pl.GiveAmmo(ammoNumForName("ammo_357"), 255);
|
||||
pl.GiveAmmo(ammoNumForName("ammo_buckshot"), 255);
|
||||
pl.GiveAmmo(ammoNumForName("ammo_bolt"), 255);
|
||||
pl.GiveAmmo(ammoNumForName("ammo_rocket"), 255);
|
||||
pl.GiveAmmo(ammoNumForName("ammo_uranium"), 255);
|
||||
pl.GiveAmmo(ammoNumForName("ammo_handgrenade"), 255);
|
||||
pl.GiveAmmo(ammoNumForName("ammo_satchel"), 255);
|
||||
pl.GiveAmmo(ammoNumForName("ammo_tripmine"), 255);
|
||||
pl.GiveAmmo(ammoNumForName("ammo_snark"), 255);
|
||||
pl.GiveAmmo(ammoNumForName("ammo_hornet"), 255);
|
||||
pl.GiveAmmo(ammoNumForName("ammo_m203_grenade"), 255);
|
||||
#ifdef GEARBOX
|
||||
Weapons_AddItem(pl, WEAPON_PIPEWRENCH, -1);
|
||||
Weapons_AddItem(pl, WEAPON_KNIFE, -1);
|
||||
Weapons_AddItem(pl, WEAPON_GRAPPLE, -1);
|
||||
Weapons_AddItem(pl, WEAPON_EAGLE, -1);
|
||||
Weapons_AddItem(pl, WEAPON_PENGUIN, -1);
|
||||
Weapons_AddItem(pl, WEAPON_M249, -1);
|
||||
Weapons_AddItem(pl, WEAPON_DISPLACER, -1);
|
||||
Weapons_AddItem(pl, WEAPON_SNIPERRIFLE, -1);
|
||||
Weapons_AddItem(pl, WEAPON_SPORELAUNCHER, -1);
|
||||
Weapons_AddItem(pl, WEAPON_SHOCKRIFLE, -1);
|
||||
#endif
|
||||
pl.GiveItem("weapon_displacer");
|
||||
pl.GiveItem("weapon_eagle");
|
||||
pl.GiveItem("weapon_grapple");
|
||||
pl.GiveItem("weapon_knife");
|
||||
pl.GiveItem("weapon_m249");
|
||||
pl.GiveItem("weapon_penguin");
|
||||
pl.GiveItem("weapon_pipewrench");
|
||||
pl.GiveItem("weapon_shockrifle");
|
||||
pl.GiveItem("weapon_sniperrifle");
|
||||
pl.GiveItem("weapon_sporelauncher");
|
||||
pl.GiveAmmo(ammoNumForName("ammo_556"), 255);
|
||||
pl.GiveAmmo(ammoNumForName("ammo_762"), 255);
|
||||
pl.GiveAmmo(ammoNumForName("ammo_spore"), 255);
|
||||
pl.GiveAmmo(ammoNumForName("ammo_shock"), 255);
|
||||
pl.GiveAmmo(ammoNumForName("ammo_penguin"), 255);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -11,15 +11,11 @@
|
|||
../../../src/shared/defs.h
|
||||
../../../src/server/defs.h
|
||||
../../../src/botlib/botinfo.h
|
||||
|
||||
../../../src/gs-entbase/server.src
|
||||
../../../src/gs-entbase/shared.src
|
||||
|
||||
defs.h
|
||||
|
||||
../../../valve/src/server/defs.h
|
||||
../shared/include.src
|
||||
|
||||
player.qc
|
||||
../../../valve/src/server/player.qc
|
||||
//items.qc
|
||||
//item_longjump.qc
|
||||
//item_suit.qc
|
||||
|
@ -27,24 +23,20 @@ player.qc
|
|||
//item_battery.qc
|
||||
//item_weaponbox.qc
|
||||
//world_items.qc
|
||||
HLScientist.qc
|
||||
xen_spore_small.qc
|
||||
xen_spore_medium.qc
|
||||
xen_spore_large.qc
|
||||
xen_hair.qc
|
||||
xen_plantlight.qc
|
||||
//ammo.qc
|
||||
|
||||
../../../src/botlib/include.src
|
||||
|
||||
gamerules.qc
|
||||
gamerules_singleplayer.qc
|
||||
gamerules_multiplayer.qc
|
||||
server.qc
|
||||
damage.qc
|
||||
flashlight.qc
|
||||
|
||||
spawn.qc
|
||||
|
||||
../../../valve/src/server/gamerules.qc
|
||||
../../../valve/src/server/gamerules_singleplayer.qc
|
||||
../../../valve/src/server/gamerules_multiplayer.qc
|
||||
../../../valve/src/server/server.qc
|
||||
../../../valve/src/server/flashlight.qc
|
||||
../../../valve/src/server/spawn.qc
|
||||
../../../src/server/include.src
|
||||
../../../src/shared/include.src
|
||||
#endlist
|
||||
|
|
|
@ -1,51 +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.
|
||||
*/
|
||||
|
||||
#define ITEM_CROWBAR 0x00000001i
|
||||
#define ITEM_GLOCK 0x00000002i
|
||||
#define ITEM_PYTHON 0x00000004i
|
||||
#define ITEM_MP5 0x00000008i
|
||||
#define ITEM_CROSSBOW 0x00000010i
|
||||
#define ITEM_SHOTGUN 0x00000020i
|
||||
#define ITEM_RPG 0x00000040i
|
||||
#define ITEM_GAUSS 0x00000080i
|
||||
|
||||
#define ITEM_EGON 0x00000100i
|
||||
#define ITEM_HORNETGUN 0x00000200i
|
||||
#define ITEM_HANDGRENADE 0x00000400i
|
||||
#define ITEM_TRIPMINE 0x00000800i
|
||||
#define ITEM_SATCHEL 0x00001000i
|
||||
#define ITEM_SNARK 0x00002000i
|
||||
#define ITEM_SUIT 0x00004000i
|
||||
#define ITEM_LONGJUMP 0x00008000i
|
||||
|
||||
#define ITEM_UNUSED17 0x00010000i
|
||||
#define ITEM_UNUSED18 0x00020000i
|
||||
#define ITEM_UNUSED19 0x00040000i
|
||||
#define ITEM_UNUSED20 0x00080000i
|
||||
#define ITEM_UNUSED21 0x00100000i
|
||||
#define ITEM_UNUSED22 0x00200000i
|
||||
#define ITEM_UNUSED23 0x00400000i
|
||||
#define ITEM_UNUSED24 0x00800000i
|
||||
|
||||
#define ITEM_UNUSED25 0x01000000i
|
||||
#define ITEM_UNUSED26 0x02000000i
|
||||
#define ITEM_UNUSED27 0x04000000i
|
||||
#define ITEM_UNUSED28 0x08000000i
|
||||
#define ITEM_UNUSED29 0x10000000i
|
||||
#define ITEM_UNUSED30 0x20000000i
|
||||
#define ITEM_UNUSED31 0x40000000i
|
||||
#define ITEM_UNUSED32 0x80000000i
|
|
@ -1,390 +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.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
CROSSBOW_IDLE1,
|
||||
CROSSBOW_IDLE2,
|
||||
CROSSBOW_FIDGET1,
|
||||
CROSSBOW_FIDGET2,
|
||||
CROSSBOW_FIRE1,
|
||||
CROSSBOW_FIRE2,
|
||||
CROSSBOW_FIRE3,
|
||||
CROSSBOW_RELOAD,
|
||||
CROSSBOW_DRAW1,
|
||||
CROSSBOW_DRAW2,
|
||||
CROSSBOW_HOLSTER1,
|
||||
CROSSBOW_HOLSTER2
|
||||
};
|
||||
|
||||
void
|
||||
w_crossbow_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_crossbow.fire");
|
||||
Sound_Precache("weapon_crossbow.empty");
|
||||
Sound_Precache("weapon_crossbow.hit");
|
||||
Sound_Precache("weapon_crossbow.hitbody");
|
||||
Sound_Precache("weapon_crossbow.reload");
|
||||
precache_model("models/crossbow_bolt.mdl");
|
||||
precache_model("models/w_crossbow.mdl");
|
||||
#else
|
||||
precache_model("models/v_crossbow.mdl");
|
||||
precache_model("models/p_crossbow.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_crossbow_updateammo(NSClientPlayer pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.crossbow_mag, pl.ammo_bolt, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_crossbow_wmodel(void)
|
||||
{
|
||||
return "models/w_crossbow.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_crossbow_pmodel(NSClientPlayer pl)
|
||||
{
|
||||
return "models/p_crossbow.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_crossbow_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_crossbow_pickup(NSClientPlayer pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
int addAmmo = (startammo == -1) ? 5 : startammo;
|
||||
|
||||
if (new) {
|
||||
pl.crossbow_mag = addAmmo;
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (pl.ammo_bolt < MAX_A_BOLT) {
|
||||
pl.ammo_bolt = bound(0, pl.ammo_bolt + addAmmo, MAX_A_BOLT);
|
||||
} else {
|
||||
if (!new)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_crossbow_draw(NSClientPlayer pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_crossbow.mdl");
|
||||
|
||||
if (pl.crossbow_mag <= 0)
|
||||
Weapons_ViewAnimation(pl, CROSSBOW_DRAW2);
|
||||
else
|
||||
Weapons_ViewAnimation(pl, CROSSBOW_DRAW1);
|
||||
}
|
||||
|
||||
void
|
||||
w_crossbow_holster(NSClientPlayer pl)
|
||||
{
|
||||
Weapons_ViewAnimation(pl, CROSSBOW_HOLSTER1);
|
||||
}
|
||||
|
||||
void
|
||||
w_crossbow_primary(NSClientPlayer pl)
|
||||
{
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.gflags & GF_SEMI_TOGGLED)
|
||||
return;
|
||||
|
||||
/* ammo check */
|
||||
if ((pl.crossbow_mag <= 0i) ? true : false) {
|
||||
#ifdef SERVER
|
||||
Sound_Play(pl, CHAN_AUTO, "weapon_crossbow.empty");
|
||||
#endif
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
return;
|
||||
}
|
||||
|
||||
pl.crossbow_mag--;
|
||||
|
||||
#ifndef CLIENT
|
||||
HLGameRules rules = (HLGameRules) g_grMode;
|
||||
|
||||
/* multiplayer uses hitscan when zoomed in */
|
||||
if (rules.IsMultiplayer() == true && pl.viewzoom < 1.0) {
|
||||
vector src, dest;
|
||||
src = pl.origin + pl.view_ofs;
|
||||
Weapons_MakeVectors(pl);
|
||||
dest = src + v_forward * 4096;
|
||||
traceline(src, dest, MOVE_LAGGED, pl);
|
||||
|
||||
if (trace_ent.takedamage == DAMAGE_YES)
|
||||
Damage_Apply(trace_ent, pl, Skill_GetValue("plr_xbow_bolt_monster", 50), WEAPON_CROSSBOW, DMG_BLUNT);
|
||||
|
||||
if (other.iBleeds == FALSE)
|
||||
pointparticles(particleeffectnum("platform.spark"), self.origin, trace_plane_normal, 1);
|
||||
else
|
||||
FX_Blood(trace_endpos, [1,0,0]);
|
||||
|
||||
/* fake bolt */
|
||||
if (trace_ent == world) {
|
||||
NSRenderableEntity bolt_used = spawn(NSRenderableEntity);
|
||||
bolt_used.SetSolid(SOLID_NOT);
|
||||
bolt_used.SetMovetype(MOVETYPE_NONE);
|
||||
bolt_used.SetModel("models/crossbow_bolt.mdl");
|
||||
bolt_used.SetSize([0,0,0], [0,0,0]);
|
||||
bolt_used.SetAngles(pl.v_angle);
|
||||
bolt_used.SetOrigin(trace_endpos + v_forward * -16);
|
||||
bolt_used.think = Util_Destroy;
|
||||
bolt_used.nextthink = time + 10.0f;
|
||||
}
|
||||
} else {
|
||||
/* zoomed out = explosive */
|
||||
if (rules.IsMultiplayer() == true) {
|
||||
NSProjectile_SpawnDef("projectile_arrowExplosive", pl);
|
||||
} else {
|
||||
NSProjectile_SpawnDef("projectile_arrow", pl);
|
||||
}
|
||||
}
|
||||
|
||||
if (pl.crossbow_mag > 0) {
|
||||
Sound_Play(pl, 8, "weapon_crossbow.hitbody");
|
||||
}
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_crossbow.fire");
|
||||
#endif
|
||||
|
||||
if (pl.crossbow_mag) {
|
||||
Weapons_ViewAnimation(pl, CROSSBOW_FIRE1);
|
||||
} else {
|
||||
Weapons_ViewAnimation(pl, CROSSBOW_FIRE3);
|
||||
}
|
||||
|
||||
if (pl.IsCrouching())
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTBOW, 0.25f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTBOW, 0.25f);
|
||||
|
||||
Weapons_ViewPunchAngle(pl, [-2,0,0]);
|
||||
|
||||
pl.w_attack_next = 0.75f;
|
||||
pl.w_idle_next = 10.0f;
|
||||
}
|
||||
|
||||
void
|
||||
w_crossbow_secondary(player pl)
|
||||
{
|
||||
if (pl.w_attack_next) {
|
||||
return;
|
||||
}
|
||||
/* Simple toggle of fovs */
|
||||
if (pl.viewzoom == 1.0f) {
|
||||
pl.viewzoom = 0.2f;
|
||||
} else {
|
||||
pl.viewzoom = 1.0f;
|
||||
}
|
||||
pl.w_attack_next = 0.5f;
|
||||
}
|
||||
|
||||
void
|
||||
w_crossbow_reload(player pl)
|
||||
{
|
||||
NSTimer reload = __NULL__;
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.ammo_bolt <= 0) {
|
||||
return;
|
||||
}
|
||||
if (pl.crossbow_mag >= 5) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* undo our zoom */
|
||||
pl.viewzoom = 1.0f;
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_crossbow_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::crossbow_mag, player::ammo_bolt, 5);
|
||||
}
|
||||
|
||||
reload.TemporaryTimer(pl, w_crossbow_reload_done, 4.4f, false);
|
||||
Sound_Play(pl, CHAN_ITEM, "weapon_crossbow.reload");
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(pl, CROSSBOW_RELOAD);
|
||||
|
||||
pl.w_attack_next = 4.5f;
|
||||
pl.w_idle_next = 10.0f;
|
||||
}
|
||||
|
||||
void
|
||||
w_crossbow_release(player pl)
|
||||
{
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.crossbow_mag == 0 && pl.ammo_bolt > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int r = floor(pseudorandom() * 2.0f);
|
||||
if (r == 1) {
|
||||
if (pl.crossbow_mag) {
|
||||
Weapons_ViewAnimation(pl, CROSSBOW_IDLE1);
|
||||
} else {
|
||||
Weapons_ViewAnimation(pl, CROSSBOW_IDLE2);
|
||||
}
|
||||
} else {
|
||||
if (pl.crossbow_mag) {
|
||||
Weapons_ViewAnimation(pl, CROSSBOW_FIDGET1);
|
||||
} else {
|
||||
Weapons_ViewAnimation(pl, CROSSBOW_FIDGET2);
|
||||
}
|
||||
}
|
||||
|
||||
pl.w_idle_next = 3.0f;
|
||||
}
|
||||
|
||||
void
|
||||
w_crossbow_crosshair(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector aicon_pos;
|
||||
|
||||
if (pl.viewzoom == 1) {
|
||||
Cross_DrawSub(g_cross_spr, [24,24], [72/128,0], [0.1875, 0.1875]);
|
||||
} else {
|
||||
Cross_DrawSub(g_cross_spr, [104,16], [24/128,96/128], [104/128, 16/128]);
|
||||
}
|
||||
|
||||
HUD_DrawAmmo1();
|
||||
HUD_DrawAmmo2();
|
||||
|
||||
aicon_pos = g_hudmins + [g_hudres[0] - 48, g_hudres[1] - 42];
|
||||
drawsubpic(
|
||||
aicon_pos,
|
||||
[24,24],
|
||||
g_hud7_spr,
|
||||
[96/256,72/128],
|
||||
[24/256, 24/128],
|
||||
g_hud_color,
|
||||
pSeatLocal->m_flAmmo2Alpha,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
float
|
||||
w_crossbow_aimanim(player pl)
|
||||
{
|
||||
return pl.IsCrouching() ? ANIM_CR_AIMBOW : ANIM_AIMBOW;
|
||||
}
|
||||
|
||||
void
|
||||
w_crossbow_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (pl.crossbow_mag == 0 && pl.ammo_bolt == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud5_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud2_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_bolt, MAX_A_BOLT, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_crossbow_isempty(player pl)
|
||||
{
|
||||
if (pl.crossbow_mag <= 0 && pl.ammo_bolt <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
weapontype_t w_crossbow_type(player pl)
|
||||
{
|
||||
return WPNTYPE_RANGED;
|
||||
}
|
||||
|
||||
weapon_t w_crossbow =
|
||||
{
|
||||
.name = "crossbow",
|
||||
.id = ITEM_CROSSBOW,
|
||||
.slot = 2,
|
||||
.slot_pos = 2,
|
||||
.weight = 10,
|
||||
.draw = w_crossbow_draw,
|
||||
.holster = w_crossbow_holster,
|
||||
.primary = w_crossbow_primary,
|
||||
.secondary = w_crossbow_secondary,
|
||||
.reload = w_crossbow_reload,
|
||||
.release = w_crossbow_release,
|
||||
.postdraw = w_crossbow_crosshair,
|
||||
.precache = w_crossbow_precache,
|
||||
.pickup = w_crossbow_pickup,
|
||||
.updateammo = w_crossbow_updateammo,
|
||||
.wmodel = w_crossbow_wmodel,
|
||||
.pmodel = w_crossbow_pmodel,
|
||||
.deathmsg = w_crossbow_deathmsg,
|
||||
.aimanim = w_crossbow_aimanim,
|
||||
.isempty = w_crossbow_isempty,
|
||||
.type = w_crossbow_type,
|
||||
.hudpic = w_crossbow_hudpic
|
||||
};
|
|
@ -1,230 +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.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
CBAR_IDLE,
|
||||
CBAR_DRAW,
|
||||
CBAR_HOLSTER,
|
||||
CBAR_ATTACK1HIT,
|
||||
CBAR_ATTACK1MISS,
|
||||
CBAR_ATTACK2MISS,
|
||||
CBAR_ATTACK2HIT,
|
||||
CBAR_ATTACK3MISS,
|
||||
CBAR_ATTACK3HIT
|
||||
};
|
||||
|
||||
void
|
||||
HLCrowbar::Precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_crowbar.hit");
|
||||
Sound_Precache("weapon_crowbar.miss");
|
||||
Sound_Precache("weapon_crowbar.hitbody");
|
||||
precache_model("models/w_crowbar.mdl");
|
||||
#else
|
||||
precache_model("models/v_crowbar.mdl");
|
||||
precache_model("models/p_crowbar.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_crowbar_updateammo(player pl)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
string
|
||||
w_crowbar_wmodel(void)
|
||||
{
|
||||
return "models/w_crowbar.mdl";
|
||||
}
|
||||
string
|
||||
w_crowbar_pmodel(player pl)
|
||||
{
|
||||
return "models/p_crowbar.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_crowbar_deathmsg(void)
|
||||
{
|
||||
return "%s was assaulted by %s's Crowbar.";
|
||||
}
|
||||
|
||||
void
|
||||
HLCrowbar::Draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_crowbar.mdl");
|
||||
Weapons_ViewAnimation(pl, CBAR_DRAW);
|
||||
}
|
||||
|
||||
void
|
||||
HLCrowbar::Holster(player pl)
|
||||
{
|
||||
Weapons_ViewAnimation(pl, CBAR_HOLSTER);
|
||||
}
|
||||
|
||||
void
|
||||
HLCrowbar::Primary(player pl)
|
||||
{
|
||||
int anim = 0;
|
||||
vector src;
|
||||
|
||||
if (pl.w_attack_next) {
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_MakeVectors(pl);
|
||||
src = pl.origin + pl.view_ofs;
|
||||
|
||||
/* make sure we can gib corpses */
|
||||
int oldhitcontents = pl.hitcontentsmaski;
|
||||
pl.hitcontentsmaski = CONTENTBITS_POINTSOLID | CONTENTBIT_CORPSE;
|
||||
traceline(src, src + (v_forward * 32), FALSE, pl);
|
||||
pl.hitcontentsmaski = oldhitcontents;
|
||||
|
||||
if (trace_fraction >= 1.0) {
|
||||
pl.w_attack_next = 0.5f;
|
||||
} else {
|
||||
pl.w_attack_next = 0.25f;
|
||||
}
|
||||
pl.w_idle_next = 2.5f;
|
||||
|
||||
int r = (float)input_sequence % 3.0f;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, trace_fraction >= 1 ? CBAR_ATTACK1MISS:CBAR_ATTACK1HIT);
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, trace_fraction >= 1 ? CBAR_ATTACK2MISS:CBAR_ATTACK2HIT);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, trace_fraction >= 1 ? CBAR_ATTACK3MISS:CBAR_ATTACK3HIT);
|
||||
}
|
||||
|
||||
if (pl.IsCrouching())
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTCROWBAR, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f);
|
||||
|
||||
#ifdef SERVER
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_crowbar.miss");
|
||||
|
||||
if (trace_fraction >= 1.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* don't bother with decals, we got squibs */
|
||||
if (trace_ent.iBleeds) {
|
||||
FX_Blood(trace_endpos, [1,0,0]);
|
||||
}
|
||||
|
||||
if (trace_ent.takedamage) {
|
||||
Damage_Apply(trace_ent, pl, Skill_GetValue("plr_crowbar", 10), WEAPON_CROWBAR, DMG_BLUNT);
|
||||
if (trace_ent.iBleeds) {
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_crowbar.hitbody");
|
||||
}
|
||||
} else {
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_crowbar.hit");
|
||||
DecalGroups_Place("Impact.Shot", trace_endpos + (v_forward * -2));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
HLCrowbar::Release(player pl)
|
||||
{
|
||||
if (pl.w_idle_next) {
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_ViewAnimation(pl, CBAR_IDLE);
|
||||
pl.w_idle_next = 15.0f;
|
||||
}
|
||||
|
||||
float
|
||||
HLCrowbar::PlayerAnim(player pl)
|
||||
{
|
||||
return pl.IsCrouching() ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR;
|
||||
}
|
||||
|
||||
void
|
||||
HLCrowbar::WeaponIcon(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud4_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud1_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
HLCrowbar::IsEmpty(player pl)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
weapontype_t
|
||||
HLCrowbar::Type(player pl)
|
||||
{
|
||||
return WPNTYPE_CLOSE;
|
||||
}
|
||||
|
||||
weapon_t w_crowbar =
|
||||
{
|
||||
.name = "crowbar",
|
||||
.id = ITEM_CROWBAR,
|
||||
.slot = 0,
|
||||
.slot_pos = 0,
|
||||
.weight = 0,
|
||||
.draw = w_crowbar_draw,
|
||||
.holster = w_crowbar_holster,
|
||||
.primary = w_crowbar_primary,
|
||||
.secondary = __NULL__,
|
||||
.reload = __NULL__,
|
||||
.release = w_crowbar_release,
|
||||
.postdraw = __NULL__,
|
||||
.precache = w_crowbar_precache,
|
||||
.pickup = __NULL__,
|
||||
.updateammo = w_crowbar_updateammo,
|
||||
.wmodel = w_crowbar_wmodel,
|
||||
.pmodel = w_crowbar_pmodel,
|
||||
.deathmsg = w_crowbar_deathmsg,
|
||||
.aimanim = w_crowbar_aimanim,
|
||||
.isempty = w_crowbar_isempty,
|
||||
.type = w_crowbar_type,
|
||||
.hudpic = w_crowbar_hudpic
|
||||
};
|
|
@ -1,338 +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 float TRAIL_EGONBEAM;
|
||||
|
||||
string w_egon_sparkframes[11];
|
||||
|
||||
void
|
||||
w_egon_beamfx(vector vecPos, vector vecEndPos, entity eOwner)
|
||||
{
|
||||
trailparticles(TRAIL_EGONBEAM, eOwner, vecPos, vecEndPos);
|
||||
}
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
EGON_IDLE1,
|
||||
EGON_FIDGET1,
|
||||
EGON_ALTFIREON,
|
||||
EGON_ALTFIRECYCLE,
|
||||
EGON_ALTFIREOFF,
|
||||
EGON_FIRE1,
|
||||
EGON_FIRE2,
|
||||
EGON_FIRE3,
|
||||
EGON_FIRE4,
|
||||
EGON_DRAW,
|
||||
EGON_HOLSTER
|
||||
};
|
||||
|
||||
void w_egon_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
precache_sound("weapons/egon_windup2.wav");
|
||||
precache_sound("weapons/egon_run3.wav");
|
||||
precache_sound("weapons/egon_off1.wav");
|
||||
precache_model("models/w_egon.mdl");
|
||||
Sound_Precache("weapon_egon.empty");
|
||||
#else
|
||||
TRAIL_EGONBEAM = particleeffectnum("weapon_egon.beam");
|
||||
precache_model("models/v_egon.mdl");
|
||||
precache_model("models/p_egon.mdl");
|
||||
precache_model("sprites/xspark1.spr");
|
||||
|
||||
for (int i = 0; i < 11; i++)
|
||||
w_egon_sparkframes[i] = spriteframe("sprites/xspark1.spr", i, 0.0f);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_egon_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_uranium, -1);
|
||||
}
|
||||
|
||||
string w_egon_wmodel(void)
|
||||
{
|
||||
return "models/w_egon.mdl";
|
||||
}
|
||||
|
||||
string w_egon_pmodel(player pl)
|
||||
{
|
||||
return "models/p_egon.mdl";
|
||||
}
|
||||
|
||||
string w_egon_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int w_egon_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
int addAmmo = (startammo == -1) ? 20 : startammo;
|
||||
|
||||
if (pl.ammo_uranium < MAX_A_URANIUM) {
|
||||
pl.ammo_uranium = bound(0, pl.ammo_uranium + addAmmo, MAX_A_URANIUM);
|
||||
} else {
|
||||
if (!new)
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void w_egon_draw(player pl)
|
||||
{
|
||||
pl.mode_tempstate = 0;
|
||||
|
||||
Weapons_SetModel("models/v_egon.mdl");
|
||||
Weapons_ViewAnimation(pl, EGON_DRAW);
|
||||
}
|
||||
|
||||
void w_egon_holster(player pl)
|
||||
{
|
||||
Weapons_ViewAnimation(pl, EGON_HOLSTER);
|
||||
}
|
||||
|
||||
void w_egon_release(player pl);
|
||||
|
||||
void w_egon_primary(player pl)
|
||||
{
|
||||
if (pl.w_attack_next > 0.0f) {
|
||||
return;
|
||||
}
|
||||
if (pl.gflags & GF_SEMI_TOGGLED) {
|
||||
w_egon_release(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
bool out_of_ammo = (pl.ammo_uranium <= 0i) ? true : false;
|
||||
if (out_of_ammo || pl.WaterLevel() >= WATERLEVEL_SUBMERGED) {
|
||||
#ifdef SERVER
|
||||
Sound_Play(pl, CHAN_AUTO, "weapon_egon.empty");
|
||||
#endif
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
w_egon_release(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
Weapons_MakeVectors(pl);
|
||||
vector src = Weapons_GetCameraPos(pl);
|
||||
vector endpos = src + v_forward * 1024;
|
||||
traceline(src, endpos, FALSE, pl);
|
||||
Damage_Radius(trace_endpos, pl, 14, 64, TRUE, WEAPON_EGON);
|
||||
Client_ShakeOnce(trace_endpos, 128, 0.2, 1.0, 1.0f);
|
||||
#endif
|
||||
|
||||
int r = (float)input_sequence % 2.0f;
|
||||
|
||||
pl.ammo_uranium--;
|
||||
pl.gflags |= GF_EGONBEAM;
|
||||
|
||||
if (pl.mode_tempstate == 0) {
|
||||
#ifdef SERVER
|
||||
sound(pl, CHAN_WEAPON, "weapons/egon_windup2.wav", 1, ATTN_NORM, 100, 0);
|
||||
#endif
|
||||
pl.mode_tempstate = 1;
|
||||
//Weapons_ViewPunchAngle(pl, [-5,0,0]);
|
||||
if (r) {
|
||||
Weapons_ViewAnimation(pl, EGON_FIRE3);
|
||||
} else {
|
||||
Weapons_ViewAnimation(pl, EGON_FIRE4);
|
||||
}
|
||||
pl.w_idle_next = 1.5f;
|
||||
} else if not (pl.w_idle_next > 0.0f) {
|
||||
/* wait 3 seconds (idle next) */
|
||||
if (pl.mode_tempstate == 1) {
|
||||
if (r) {
|
||||
Weapons_ViewAnimation(pl, EGON_FIRE3);
|
||||
} else {
|
||||
Weapons_ViewAnimation(pl, EGON_FIRE4);
|
||||
}
|
||||
#ifdef SERVER
|
||||
sound(pl, CHAN_WEAPON, "weapons/egon_run3.wav", 1, ATTN_NORM, 100);
|
||||
#endif
|
||||
pl.mode_tempstate = 2;
|
||||
}
|
||||
pl.w_idle_next = 3.0f;
|
||||
}
|
||||
|
||||
pl.w_attack_next = 0.2f;
|
||||
}
|
||||
|
||||
void w_egon_reload(player pl)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void w_egon_release(player pl)
|
||||
{
|
||||
if (pl.mode_tempstate != 0 && pl.mode_tempstate < 3) {
|
||||
#ifdef SERVER
|
||||
sound(pl, CHAN_WEAPON, "weapons/egon_off1.wav", 1, ATTN_NORM, 100, 0);
|
||||
#endif
|
||||
pl.mode_tempstate = 3;
|
||||
//Weapons_ViewPunchAngle(pl, [-2,0,0]);
|
||||
}
|
||||
|
||||
pl.gflags &= ~GF_EGONBEAM;
|
||||
|
||||
if (pl.mode_tempstate == 3) {
|
||||
/* This is hack that is unwise for custom content, but it needs to terminate. */
|
||||
Weapons_ViewAnimation(pl, EGON_FIRE1);
|
||||
pl.w_idle_next = 1.0f;
|
||||
pl.w_attack_next = 1.1f;
|
||||
pl.mode_tempstate = 0;
|
||||
} else {
|
||||
if (pl.w_idle_next > 0.0f) {
|
||||
return;
|
||||
}
|
||||
int r = floor(pseudorandom() * 3.0f);
|
||||
if (r == 1) {
|
||||
Weapons_ViewAnimation(pl, EGON_FIDGET1);
|
||||
pl.w_idle_next = 2.666667f;
|
||||
} else {
|
||||
Weapons_ViewAnimation(pl, EGON_IDLE1);
|
||||
pl.w_idle_next = 2.0f;
|
||||
}
|
||||
pl.mode_tempstate = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
w_egon_postdraw(player pl, int thirdperson)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
if (!(pl.gflags & GF_EGONBEAM))
|
||||
return;
|
||||
|
||||
vector src;
|
||||
vector endpos;
|
||||
|
||||
if (thirdperson) {
|
||||
makevectors(pl.v_angle);
|
||||
src = pl.origin;
|
||||
endpos = pl.origin + (v_forward * 1024);
|
||||
traceline(src, endpos, MOVE_NORMAL, pl);
|
||||
w_egon_beamfx(gettaginfo(pl.p_model, 10), trace_endpos, pl);
|
||||
} else {
|
||||
vector gunpos = gettaginfo(pSeat->m_eViewModel, 33);
|
||||
src = gettaginfo(pSeat->m_eViewModel, 0);
|
||||
makevectors(view_angles);
|
||||
endpos = src + v_forward * 1024;
|
||||
traceline(src, endpos, FALSE, pl);
|
||||
w_egon_beamfx(gunpos, endpos, pl);
|
||||
}
|
||||
|
||||
int i = (cltime*10.0f) % 11.0f;
|
||||
vector fsize = [32,32];
|
||||
makevectors(view_angles);
|
||||
trace_endpos += v_forward * -16; /* nudge towards our camera */
|
||||
dynamiclight_add(trace_endpos, 128, [0.5, 0.5, 1.0]);
|
||||
|
||||
R_BeginPolygon(w_egon_sparkframes[i], 1, 0);
|
||||
R_PolygonVertex(trace_endpos + v_right * fsize[0] - v_up * fsize[1],
|
||||
[1,1], [1,1,1], 1.0f);
|
||||
R_PolygonVertex(trace_endpos - v_right * fsize[0] - v_up * fsize[1],
|
||||
[0,1], [1,1,1], 1.0f);
|
||||
R_PolygonVertex(trace_endpos - v_right * fsize[0] + v_up * fsize[1],
|
||||
[0,0], [1,1,1], 1.0f);
|
||||
R_PolygonVertex(trace_endpos + v_right * fsize[0] + v_up * fsize[1],
|
||||
[1,0], [1,1,1], 1.0f);
|
||||
R_EndPolygon();
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_egon_crosshair(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Cross_DrawSub(g_cross_spr, [24,24], [72/128,48/128], [0.1875, 0.1875]);
|
||||
|
||||
HUD_DrawAmmo2();
|
||||
vector aicon_pos = g_hudmins + [g_hudres[0] - 48, g_hudres[1] - 42];
|
||||
drawsubpic(aicon_pos, [24,24], g_hud7_spr, [0,96/128], [24/256, 24/128], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
float w_egon_aimanim(player pl)
|
||||
{
|
||||
return pl.IsCrouching() ? ANIM_CR_AIMEGON : ANIM_AIMEGON;
|
||||
}
|
||||
|
||||
void w_egon_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (pl.ammo_uranium == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(pos, [170,45], g_hud5_spr, [0,135/256], [170/256,45/256], hud_col, a, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], g_hud2_spr, [0,135/256], [170/256,45/256], hud_col, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_uranium, MAX_A_URANIUM, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_egon_isempty(player pl)
|
||||
{
|
||||
if (pl.ammo_uranium <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
weapontype_t
|
||||
w_egon_type(player pl)
|
||||
{
|
||||
return WPNTYPE_FULLAUTO;
|
||||
}
|
||||
|
||||
weapon_t w_egon =
|
||||
{
|
||||
.name = "egon",
|
||||
.id = ITEM_EGON,
|
||||
.slot = 3,
|
||||
.slot_pos = 2,
|
||||
.weight = 15,
|
||||
.draw = w_egon_draw,
|
||||
.holster = w_egon_holster,
|
||||
.primary = w_egon_primary,
|
||||
.secondary = w_egon_release,
|
||||
.reload = w_egon_reload,
|
||||
.release = w_egon_release,
|
||||
.postdraw = w_egon_crosshair,
|
||||
.precache = w_egon_precache,
|
||||
.pickup = w_egon_pickup,
|
||||
.updateammo = w_egon_updateammo,
|
||||
.wmodel = w_egon_wmodel,
|
||||
.pmodel = w_egon_pmodel,
|
||||
.deathmsg = w_egon_deathmsg,
|
||||
.aimanim = w_egon_aimanim,
|
||||
.hudpic = w_egon_hudpic,
|
||||
.isempty = w_egon_isempty,
|
||||
.type = w_egon_type,
|
||||
.predraw = w_egon_postdraw
|
||||
};
|
|
@ -1,466 +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.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
GAUSS_IDLE1,
|
||||
GAUSS_IDLE2,
|
||||
GAUSS_FIDGET,
|
||||
GAUSS_SPINUP,
|
||||
GAUSS_SPIN,
|
||||
GAUSS_FIRE1,
|
||||
GAUSS_FIRE2,
|
||||
GAUSS_HOLSTER,
|
||||
GAUSS_DRAW
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
GAUSSTATE_IDLE,
|
||||
GAUSSTATE_REVVINGUP,
|
||||
GAUSSTATE_FULL
|
||||
};
|
||||
|
||||
void w_gauss_release(player pl);
|
||||
|
||||
void w_gauss_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
precache_model("models/w_gauss.mdl");
|
||||
precache_model("sprites/yelflare1.spr");
|
||||
precache_model("sprites/xbeam1.spr");
|
||||
precache_sound("weapons/electro4.wav");
|
||||
precache_sound("weapons/electro5.wav");
|
||||
precache_sound("weapons/electro6.wav");
|
||||
Sound_Precache("weapon_gauss.empty");
|
||||
Sound_Precache("weapon_gauss.fire");
|
||||
Sound_Precache("weapon_gauss.overcharge");
|
||||
#else
|
||||
precache_model("models/v_gauss.mdl");
|
||||
precache_model("models/p_gauss.mdl");
|
||||
#endif
|
||||
|
||||
precache_sound("ambience/pulsemachine.wav");
|
||||
}
|
||||
void w_gauss_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_uranium, -1);
|
||||
}
|
||||
string w_gauss_wmodel(void)
|
||||
{
|
||||
return "models/w_gauss.mdl";
|
||||
}
|
||||
string w_gauss_pmodel(player pl)
|
||||
{
|
||||
return "models/p_gauss.mdl";
|
||||
}
|
||||
string w_gauss_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int w_gauss_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
int addAmmo = (startammo == -1) ? 20 : startammo;
|
||||
|
||||
if (pl.ammo_uranium < MAX_A_URANIUM) {
|
||||
pl.ammo_uranium = bound(0, pl.ammo_uranium + addAmmo, MAX_A_URANIUM);
|
||||
} else {
|
||||
if (!new)
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void w_gauss_draw(player pl)
|
||||
{
|
||||
pl.mode_tempstate = GAUSSTATE_IDLE;
|
||||
Weapons_SetModel("models/v_gauss.mdl");
|
||||
Weapons_ViewAnimation(pl, GAUSS_DRAW);
|
||||
}
|
||||
|
||||
void w_gauss_holster(player pl)
|
||||
{
|
||||
Weapons_ViewAnimation(pl, GAUSS_HOLSTER);
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
void w_gauss_fire(player pl, int one)
|
||||
{
|
||||
int iLoop = 6;
|
||||
vector vecCurPlane;
|
||||
vector vecCurPos;
|
||||
vector vecSrc;
|
||||
vector vecEndPos;
|
||||
vector vecDir;
|
||||
|
||||
Weapons_MakeVectors(pl);
|
||||
vecDir = v_forward;
|
||||
vecSrc = Weapons_GetCameraPos(pl);
|
||||
vecEndPos = vecSrc + v_forward * 1024;
|
||||
traceline(vecSrc, vecEndPos, FALSE, pl);
|
||||
vecCurPlane = trace_plane_normal;
|
||||
vecCurPos = trace_endpos;
|
||||
|
||||
pl.StartSoundDef("weapon_gauss.fire", CHAN_WEAPON, true);
|
||||
int iDamage = one ? 20 : (int)rint((bound(0, pl.ammo_gauss_volume, 10) * 20));
|
||||
|
||||
if (serverkeyfloat("*bspversion") == BSPVER_HL)
|
||||
if (getsurfacetexture(trace_ent, getsurfacenearpoint(trace_ent, trace_endpos)) == "sky") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (trace_ent.takedamage == DAMAGE_YES) {
|
||||
Damage_Apply(trace_ent, pl, iDamage, WEAPON_GAUSS, DMG_ELECTRO);
|
||||
sound(trace_ent, CHAN_ITEM, sprintf("weapons/electro%d.wav", random(0,3)+4), 1, ATTN_NORM);
|
||||
}
|
||||
|
||||
// reflection equation:
|
||||
Weapons_MakeVectors(pl);
|
||||
vecDir = v_forward;
|
||||
trace_plane_normal = vecCurPlane;
|
||||
trace_endpos = vecCurPos;
|
||||
|
||||
while (iLoop > 0) {
|
||||
vector newDir;
|
||||
trace_plane_normal = vecCurPlane;
|
||||
trace_endpos = vecCurPos;
|
||||
newDir = vecDir - 2 * (vecDir * trace_plane_normal) * trace_plane_normal;
|
||||
vecDir = newDir;
|
||||
vecSrc = trace_endpos + (vecDir * -1);
|
||||
vecEndPos = trace_endpos + (vecDir * 8192);
|
||||
traceline(vecSrc, vecEndPos, FALSE, pl);
|
||||
vecCurPlane = trace_plane_normal;
|
||||
vecCurPos = trace_endpos;
|
||||
iLoop--;
|
||||
|
||||
if (trace_ent.takedamage == DAMAGE_YES) {
|
||||
Damage_Apply(trace_ent, pl, iDamage, WEAPON_GAUSS, DMG_ELECTRO);
|
||||
sound(trace_ent, CHAN_ITEM, sprintf("weapons/electro%d.wav", random(0,3)+4), 1, ATTN_NORM);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void w_gauss_primary(player pl)
|
||||
{
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.gflags & GF_SEMI_TOGGLED)
|
||||
return;
|
||||
|
||||
/* Ammo check */
|
||||
if ((pl.ammo_uranium < 2) || (pl.WaterLevel() >= WATERLEVEL_SUBMERGED)) {
|
||||
#ifdef SERVER
|
||||
pl.StartSoundDef("weapon_gauss.fire", CHAN_WEAPON, true);
|
||||
#endif
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_ViewAnimation(pl, GAUSS_FIRE2);
|
||||
Weapons_ViewPunchAngle(pl, [-2,0,0]);
|
||||
#ifdef SERVER
|
||||
w_gauss_fire(pl, 1);
|
||||
FX_GaussBeam(Weapons_GetCameraPos(pl), input_angles, 0, pl);
|
||||
#endif
|
||||
|
||||
pl.ammo_uranium -= 2;
|
||||
|
||||
if (pl.IsCrouching())
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTGAUSS, 0.43f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTGAUSS, 0.43f);
|
||||
|
||||
pl.w_attack_next = 0.2f;
|
||||
pl.w_idle_next = 2.5f;
|
||||
}
|
||||
|
||||
void w_gauss_release(player pl)
|
||||
{
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* do nothing if we overcharged */
|
||||
if (pl.ammo_gauss_volume == 100) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* if multiplayer then always fling the player
|
||||
* FIXME need a check for coop */
|
||||
if (serverkeyfloat("sv_playerslots") > 1) {
|
||||
if (pl.mode_tempstate != GAUSSTATE_IDLE) {
|
||||
int iForce = (int)rint((bound(5, pl.ammo_gauss_volume, 10) * 20));
|
||||
Weapons_MakeVectors(pl);
|
||||
|
||||
/* Apply force */
|
||||
pl.velocity += v_forward * (-iForce * 4);
|
||||
}
|
||||
}
|
||||
|
||||
if (pl.mode_tempstate == GAUSSTATE_REVVINGUP) {
|
||||
pl.w_attack_next = 0.0f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
w_gauss_primary(pl);
|
||||
pl.ammo_gauss_volume = 0;
|
||||
pl.mode_tempstate = GAUSSTATE_IDLE;
|
||||
return;
|
||||
} else if (pl.mode_tempstate == GAUSSTATE_FULL) {
|
||||
Weapons_ViewAnimation(pl, GAUSS_FIRE1);
|
||||
|
||||
if (pl.IsCrouching())
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTGAUSS, 0.43f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTGAUSS, 0.43f);
|
||||
|
||||
Weapons_ViewPunchAngle(pl, [-5,0,0]);
|
||||
#ifdef SERVER
|
||||
w_gauss_fire(pl, 0);
|
||||
pl.ammo_gauss_volume = 0;
|
||||
FX_GaussBeam(Weapons_GetCameraPos(pl), input_angles, 6, pl);
|
||||
#endif
|
||||
pl.w_attack_next = 1.5f;
|
||||
pl.w_idle_next = 4.0f;
|
||||
pl.mode_tempstate = GAUSSTATE_IDLE;
|
||||
return;
|
||||
}
|
||||
|
||||
int r = floor(pseudorandom() * 3.0f);
|
||||
switch (r) {
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, GAUSS_IDLE2);
|
||||
pl.w_idle_next = 4.0f;
|
||||
break;
|
||||
#ifndef GEARBOX
|
||||
case 2:
|
||||
Weapons_ViewAnimation(pl, GAUSS_FIDGET);
|
||||
pl.w_idle_next = 3.0f;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, GAUSS_IDLE1);
|
||||
pl.w_idle_next = 4.0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void w_gauss_secondary(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.gflags & GF_SEMI_TOGGLED)
|
||||
return;
|
||||
|
||||
/* release gauss when out of ammo and revving */
|
||||
if (pl.ammo_uranium <= 0) {
|
||||
if (pl.mode_tempstate > GAUSSTATE_IDLE) {
|
||||
w_gauss_release(pl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* regular ammo check */
|
||||
if ((pl.ammo_uranium <= 0) || (pl.WaterLevel() >= WATERLEVEL_SUBMERGED)) {
|
||||
#ifdef SERVER
|
||||
pl.StartSoundDef("weapon_gauss.empty", CHAN_AUTO, true);
|
||||
#endif
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
return;
|
||||
}
|
||||
|
||||
pl.w_attack_next = 0.1f;
|
||||
|
||||
/* take away 10 uranium max */
|
||||
if (pl.ammo_gauss_volume < 10)
|
||||
pl.ammo_uranium--;
|
||||
|
||||
/* Set pitch sound shift */
|
||||
pl.ammo_gauss_volume += 1;
|
||||
|
||||
/* holding it for too long, damage our owner (overcharge) */
|
||||
if (pl.ammo_gauss_volume > 100) {
|
||||
pl.ammo_gauss_volume = 100;
|
||||
w_gauss_release(pl);
|
||||
#ifdef SERVER
|
||||
Damage_Apply(pl, pl, 50, WEAPON_GAUSS, DMG_ELECTRO);
|
||||
pl.StartSoundDef("weapon_gauss.overcharge", CHAN_AUTO, true);
|
||||
pl.StopSound(CHAN_WEAPON, true);
|
||||
#endif
|
||||
pl.mode_tempstate = GAUSSTATE_IDLE;
|
||||
pl.w_attack_next = 0.5f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
pl.ammo_gauss_volume = 0;
|
||||
Weapons_ViewAnimation(pl, GAUSS_IDLE1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.mode_tempstate == GAUSSTATE_REVVINGUP) {
|
||||
Weapons_ViewAnimation(pl, GAUSS_SPIN);
|
||||
pl.mode_tempstate = GAUSSTATE_FULL;
|
||||
pl.w_idle_next = 0.0f; // fire immediately if we let go
|
||||
pl.w_attack_next = 0.5f;
|
||||
} else if (!pl.mode_tempstate) {
|
||||
Weapons_ViewAnimation(pl, GAUSS_SPINUP);
|
||||
pl.mode_tempstate = GAUSSTATE_REVVINGUP;
|
||||
#ifdef SERVER
|
||||
sound(pl, CHAN_WEAPON, "ambience/pulsemachine.wav", 2, ATTN_NORM);
|
||||
#endif
|
||||
pl.w_idle_next = 0.5f; // delay if we let go
|
||||
pl.w_attack_next = 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
/* set globals for the overcharge's overlay */
|
||||
.float overlay_state;
|
||||
.float overlay_alpha;
|
||||
|
||||
void w_gauss_crosshair(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector aicon_pos;
|
||||
Cross_DrawSub(g_cross_spr, [24,24], [48/128,48/128], [0.1875, 0.1875]);
|
||||
|
||||
aicon_pos = g_hudmins + [g_hudres[0] - 48, g_hudres[1] - 42];
|
||||
|
||||
drawsubpic(
|
||||
aicon_pos,
|
||||
[24,24],
|
||||
g_hud7_spr,
|
||||
[0,96/128],
|
||||
[24/256,24/128],
|
||||
g_hud_color,
|
||||
pSeatLocal->m_flAmmo2Alpha,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
||||
HUD_DrawAmmo2();
|
||||
|
||||
/* overchage flashes the player */
|
||||
if (pl.ammo_gauss_volume == 100) {
|
||||
/* check for the state, give a default alpha */
|
||||
if (pl.overlay_state == 0)
|
||||
pl.overlay_alpha = 0.8f;
|
||||
|
||||
pl.overlay_state = 1;
|
||||
}
|
||||
|
||||
if (pl.overlay_state == 1) {
|
||||
/* give us a nice fadeout about 3 seconds */
|
||||
pl.overlay_alpha -= frametime * 0.3;
|
||||
|
||||
drawfill(
|
||||
video_mins,
|
||||
video_res,
|
||||
[0.6,0.3,0],
|
||||
pl.overlay_alpha,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
||||
if (pl.overlay_alpha < 0.1f) {
|
||||
pl.overlay_state = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
float w_gauss_aimanim(player pl)
|
||||
{
|
||||
return pl.IsCrouching() ? ANIM_CR_AIMGAUSS : ANIM_AIMGAUSS;
|
||||
}
|
||||
|
||||
void w_gauss_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (pl.ammo_uranium == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud5_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud2_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_uranium, MAX_A_URANIUM, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_gauss_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.ammo_uranium <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
weapontype_t
|
||||
w_gauss_type(player pl)
|
||||
{
|
||||
return WPNTYPE_RANGED;
|
||||
}
|
||||
|
||||
weapon_t w_gauss =
|
||||
{
|
||||
.name = "gauss",
|
||||
.id = ITEM_GAUSS,
|
||||
.slot = 3,
|
||||
.slot_pos = 1,
|
||||
.weight = 20,
|
||||
.draw = w_gauss_draw,
|
||||
.holster = w_gauss_holster,
|
||||
.primary = w_gauss_primary,
|
||||
.secondary = w_gauss_secondary,
|
||||
.reload = __NULL__,
|
||||
.release = w_gauss_release,
|
||||
.postdraw = w_gauss_crosshair,
|
||||
.precache = w_gauss_precache,
|
||||
.pickup = w_gauss_pickup,
|
||||
.updateammo = w_gauss_updateammo,
|
||||
.wmodel = w_gauss_wmodel,
|
||||
.pmodel = w_gauss_pmodel,
|
||||
.deathmsg = w_gauss_deathmsg,
|
||||
.aimanim = w_gauss_aimanim,
|
||||
.isempty = w_gauss_isempty,
|
||||
.type = w_gauss_type,
|
||||
.hudpic = w_gauss_hudpic
|
||||
};
|
|
@ -1,403 +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.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
GLOCK_IDLE1,
|
||||
GLOCK_IDLE2,
|
||||
GLOCK_IDLE3,
|
||||
GLOCK_SHOOT,
|
||||
GLOCK_SHOOT_EMPTY,
|
||||
GLOCK_RELOAD_EMPTY,
|
||||
GLOCK_RELOAD,
|
||||
GLOCK_DRAW,
|
||||
GLOCK_HOLSTER
|
||||
};
|
||||
|
||||
#ifdef CLIENT
|
||||
void w_glock_ejectshell(void)
|
||||
{
|
||||
static void w_glock_ejectshell_death(void) {
|
||||
remove(self);
|
||||
}
|
||||
static void w_glock_ejectshell_touch(void) {
|
||||
if (other == world)
|
||||
Sound_Play(self, CHAN_BODY, "modelevent_shell.land");
|
||||
}
|
||||
entity eShell = spawn();
|
||||
setmodel(eShell, "models/shell.mdl");
|
||||
eShell.solid = SOLID_BBOX;
|
||||
eShell.movetype = MOVETYPE_BOUNCE;
|
||||
eShell.drawmask = MASK_ENGINE;
|
||||
eShell.angles = [pSeat->m_eViewModel.angles[0], pSeat->m_eViewModel.angles[1], 0];
|
||||
eShell.velocity = pSeat->m_vecPredictedVelocity;
|
||||
|
||||
makevectors(pSeat->m_eViewModel.angles);
|
||||
eShell.velocity += (v_forward * 0);
|
||||
eShell.velocity += (v_right * 80);
|
||||
eShell.velocity += (v_up * 100);
|
||||
eShell.touch = w_glock_ejectshell_touch;
|
||||
|
||||
eShell.avelocity = [0,45,900];
|
||||
eShell.think = w_glock_ejectshell_death;
|
||||
eShell.nextthink = time + 2.5f;
|
||||
setsize(eShell, [0,0,0], [0,0,0]);
|
||||
setorigin(eShell, pSeat->m_eViewModel.origin + (v_forward * 26) + (v_right * 8) + (v_up * -4));
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
w_glock_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_glock.fire");
|
||||
Sound_Precache("weapon_glock.empty");
|
||||
precache_model("models/w_9mmhandgun.mdl");
|
||||
precache_model("models/shell.mdl");
|
||||
#else
|
||||
precache_model("models/v_9mmhandgun.mdl");
|
||||
precache_model("models/p_9mmhandgun.mdl");
|
||||
precache_model("models/shell.mdl");
|
||||
Sound_Precache("modelevent_shell.land");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_glock_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.glock_mag, pl.ammo_9mm, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_glock_wmodel(void)
|
||||
{
|
||||
return "models/w_9mmhandgun.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_glock_pmodel(player pl)
|
||||
{
|
||||
return "models/p_9mmhandgun.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_glock_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_glock_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
int addAmmo = (startammo == -1) ? 18 : startammo;
|
||||
|
||||
if (new) {
|
||||
pl.glock_mag = addAmmo;
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (pl.ammo_9mm < MAX_A_9MM) {
|
||||
pl.ammo_9mm = bound(0, pl.ammo_9mm + addAmmo, MAX_A_9MM);
|
||||
} else {
|
||||
if (!new)
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_glock_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_9mmhandgun.mdl");
|
||||
Weapons_ViewAnimation(pl, GLOCK_DRAW);
|
||||
}
|
||||
|
||||
void
|
||||
w_glock_holster(player pl)
|
||||
{
|
||||
Weapons_ViewAnimation(pl, GLOCK_HOLSTER);
|
||||
}
|
||||
|
||||
int
|
||||
w_glock_isempty(player pl)
|
||||
{
|
||||
if (pl.glock_mag <= 0 && pl.ammo_9mm <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_glock_primary(player pl)
|
||||
{
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.gflags & GF_SEMI_TOGGLED)
|
||||
return;
|
||||
|
||||
/* ammo check */
|
||||
if ((pl.glock_mag <= 0i) ? true : false) {
|
||||
#ifdef SERVER
|
||||
Sound_Play(pl, CHAN_AUTO, "weapon_glock.empty");
|
||||
#endif
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
return;
|
||||
}
|
||||
|
||||
/* actual firing */
|
||||
pl.glock_mag--;
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_SMALL);
|
||||
View_AddEvent(w_glock_ejectshell, 0.0f);
|
||||
#else
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, Skill_GetValue("plr_9mm_bullet", 8), [0.01,0.01], WEAPON_GLOCK, "Impact.BigShot");
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_glock.fire");
|
||||
#endif
|
||||
|
||||
Weapons_ViewPunchAngle(pl, [-2,0,0]);
|
||||
|
||||
if (pl.glock_mag) {
|
||||
Weapons_ViewAnimation(pl, GLOCK_SHOOT);
|
||||
} else {
|
||||
Weapons_ViewAnimation(pl, GLOCK_SHOOT_EMPTY);
|
||||
}
|
||||
|
||||
if (pl.IsCrouching())
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.2f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.2f);
|
||||
|
||||
pl.w_attack_next = 0.3f;
|
||||
pl.w_idle_next = 5.0f;
|
||||
}
|
||||
|
||||
void
|
||||
w_glock_secondary(player pl)
|
||||
{
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.gflags & GF_SEMI_TOGGLED)
|
||||
return;
|
||||
|
||||
/* ammo check */
|
||||
if ((pl.glock_mag <= 0i) ? true : false) {
|
||||
#ifdef SERVER
|
||||
Sound_Play(pl, CHAN_AUTO, "weapon_glock.empty");
|
||||
#endif
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
return;
|
||||
}
|
||||
|
||||
pl.glock_mag--;
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_SMALL);
|
||||
View_AddEvent(w_glock_ejectshell, 0.0f);
|
||||
#else
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, Skill_GetValue("plr_9mm_bullet", 8), [0.1,0.1], WEAPON_GLOCK, "Impact.BigShot");
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_glock.fire");
|
||||
#endif
|
||||
|
||||
Weapons_ViewPunchAngle(pl, [-2,0,0]);
|
||||
|
||||
if (pl.glock_mag) {
|
||||
Weapons_ViewAnimation(pl, GLOCK_SHOOT);
|
||||
} else {
|
||||
Weapons_ViewAnimation(pl, GLOCK_SHOOT_EMPTY);
|
||||
}
|
||||
|
||||
if (pl.IsCrouching())
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.2f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.2f);
|
||||
|
||||
pl.w_attack_next = 0.2f;
|
||||
pl.w_idle_next = 5.0f;
|
||||
}
|
||||
|
||||
void
|
||||
w_glock_reload(player pl)
|
||||
{
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.glock_mag >= 18) {
|
||||
return;
|
||||
}
|
||||
if (pl.ammo_9mm <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.glock_mag) {
|
||||
Weapons_ViewAnimation(pl, GLOCK_RELOAD);
|
||||
} else {
|
||||
Weapons_ViewAnimation(pl, GLOCK_RELOAD_EMPTY);
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_glock_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::glock_mag, player::ammo_9mm, 18);
|
||||
}
|
||||
|
||||
pl.think = w_glock_reload_done;
|
||||
pl.nextthink = time + 1.9f;
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 2.0f;
|
||||
pl.w_idle_next = 10.0f;
|
||||
}
|
||||
|
||||
void
|
||||
w_glock_release(player pl)
|
||||
{
|
||||
int r;
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.glock_mag == 0 && pl.ammo_9mm > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
if (w_glock_isempty(pl))
|
||||
return;
|
||||
if (pl.w_idle_next > 0.0)
|
||||
return;
|
||||
|
||||
r = floor(pseudorandom() * 3.0f);
|
||||
switch (r) {
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, GLOCK_IDLE2);
|
||||
pl.w_idle_next = 2.5f;
|
||||
break;
|
||||
case 2:
|
||||
Weapons_ViewAnimation(pl, GLOCK_IDLE3);
|
||||
pl.w_idle_next = 3.5f;
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, GLOCK_IDLE1);
|
||||
pl.w_idle_next = 3.75f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_glock_aimanim(player pl)
|
||||
{
|
||||
return pl.IsCrouching() ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND;
|
||||
}
|
||||
|
||||
void
|
||||
w_glock_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector aicon_pos;
|
||||
|
||||
aicon_pos = g_hudmins + [g_hudres[0] - 48, g_hudres[1] - 42];
|
||||
|
||||
Cross_DrawSub(g_cross_spr, [24,24], [0.1875,0], [0.1875, 0.1875]);
|
||||
|
||||
HUD_DrawAmmo1();
|
||||
HUD_DrawAmmo2();
|
||||
|
||||
drawsubpic(
|
||||
aicon_pos,
|
||||
[24,24],
|
||||
g_hud7_spr,
|
||||
[0,72/128],
|
||||
[24/256, 24/128],
|
||||
g_hud_color,
|
||||
pSeatLocal->m_flAmmo2Alpha,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_glock_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (pl.glock_mag == 0 && pl.ammo_9mm == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud4_spr,
|
||||
[0,45/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud1_spr,
|
||||
[0,45/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_9mm, MAX_A_9MM, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
weapontype_t
|
||||
w_glock_type(player pl)
|
||||
{
|
||||
return WPNTYPE_RANGED;
|
||||
}
|
||||
|
||||
weapon_t w_glock =
|
||||
{
|
||||
.name = "9mmhandgun",
|
||||
.id = ITEM_GLOCK,
|
||||
.slot = 1,
|
||||
.slot_pos = 0,
|
||||
.weight = 10,
|
||||
.draw = w_glock_draw,
|
||||
.holster = w_glock_holster,
|
||||
.primary = w_glock_primary,
|
||||
.secondary = w_glock_secondary,
|
||||
.reload = w_glock_reload,
|
||||
.release = w_glock_release,
|
||||
.postdraw = w_glock_hud,
|
||||
.precache = w_glock_precache,
|
||||
.pickup = w_glock_pickup,
|
||||
.updateammo = w_glock_updateammo,
|
||||
.wmodel = w_glock_wmodel,
|
||||
.pmodel = w_glock_pmodel,
|
||||
.deathmsg = w_glock_deathmsg,
|
||||
.aimanim = w_glock_aimanim,
|
||||
.isempty = w_glock_isempty,
|
||||
.type = w_glock_type,
|
||||
.hudpic = w_glock_hudpic
|
||||
};
|
|
@ -1,252 +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 SERVER
|
||||
.float nadeCookingTime;
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
HANDGRENADE_IDLE,
|
||||
HANDGRENADE_FIDGET,
|
||||
HANDGRENADE_PULLPIN,
|
||||
HANDGRENADE_THROW1,
|
||||
HANDGRENADE_THROW2,
|
||||
HANDGRENADE_THROW3,
|
||||
HANDGRENADE_HOLSTER,
|
||||
HANDGRENADE_DRAW
|
||||
};
|
||||
|
||||
void w_handgrenade_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_handgrenade.bounce");
|
||||
precache_model("models/w_grenade.mdl");
|
||||
particleeffectnum("fx_explosion.main");
|
||||
precache_model("sprites/fexplo.spr");
|
||||
#else
|
||||
precache_model("models/v_grenade.mdl");
|
||||
precache_model("models/p_grenade.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_handgrenade_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_handgrenade, -1);
|
||||
}
|
||||
|
||||
string w_handgrenade_wmodel(void)
|
||||
{
|
||||
return "models/w_grenade.mdl";
|
||||
}
|
||||
|
||||
string w_handgrenade_pmodel(player pl)
|
||||
{
|
||||
return "models/p_grenade.mdl";
|
||||
}
|
||||
|
||||
string w_handgrenade_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int w_handgrenade_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
int addAmmo = (startammo == -1) ? 1 : startammo;
|
||||
|
||||
if (pl.ammo_handgrenade < MAX_A_HANDGRENADE) {
|
||||
pl.ammo_handgrenade = bound(0, pl.ammo_handgrenade + addAmmo, MAX_A_HANDGRENADE);
|
||||
} else {
|
||||
if (!new)
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void w_handgrenade_draw(player pl)
|
||||
{
|
||||
pl.mode_tempstate = 0;
|
||||
|
||||
Weapons_SetModel("models/v_grenade.mdl");
|
||||
Weapons_ViewAnimation(pl, HANDGRENADE_DRAW);
|
||||
}
|
||||
|
||||
void w_handgrenade_holster(player pl)
|
||||
{
|
||||
|
||||
}
|
||||
void w_handgrenade_primary(player pl)
|
||||
{
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* We're abusing this network variable for the holding check */
|
||||
if (pl.mode_tempstate > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
if (pl.ammo_handgrenade <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_ViewAnimation(pl, HANDGRENADE_PULLPIN);
|
||||
|
||||
pl.mode_tempstate = 1;
|
||||
pl.w_attack_next = 0.5f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
|
||||
#ifdef SERVER
|
||||
pl.nadeCookingTime = time;
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_handgrenade_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
HUD_DrawAmmo2();
|
||||
vector aicon_pos = g_hudmins + [g_hudres[0] - 48, g_hudres[1] - 42];
|
||||
drawsubpic(aicon_pos, [24,24], g_hud7_spr, [48/256,96/128], [24/256, 24/128], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_handgrenade_release(player pl)
|
||||
{
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.mode_tempstate == 1) {
|
||||
Weapons_ViewAnimation(pl, HANDGRENADE_THROW1);
|
||||
#ifdef SERVER
|
||||
vector throwDirection;
|
||||
float throwingStrength;
|
||||
|
||||
NSProjectile nade = (NSProjectile )EntityDef_CreateClassname("projectile_handgrenade");
|
||||
nade.SetOwner(pl);
|
||||
|
||||
throwDirection = pl.v_angle;
|
||||
throwDirection[0] = -10.0f; /* always aim a bit up */
|
||||
|
||||
/* diminish when aiming up */
|
||||
if (pl.v_angle[0] < 0) {
|
||||
throwDirection[0] += (pl.v_angle[0] * 0.9f);
|
||||
} else { /* increase when aiming down */
|
||||
throwDirection[0] += (pl.v_angle[0] * 1.1f);
|
||||
}
|
||||
|
||||
throwingStrength = bound(0, (90 - throwDirection[0]) * 5.0f, 1000);
|
||||
|
||||
nade.Launch(pl.GetEyePos(), pl.v_angle, time - pl.nadeCookingTime, 0.0f, 0.0f);
|
||||
makevectors(throwDirection);
|
||||
nade.SetVelocity((v_forward * throwingStrength) + pl.GetVelocity());
|
||||
#endif
|
||||
pl.ammo_handgrenade--;
|
||||
pl.mode_tempstate = 2;
|
||||
pl.w_attack_next = 1.0f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
|
||||
if (pl.IsCrouching())
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTCROWBAR, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f);
|
||||
} else if (pl.mode_tempstate == 2) {
|
||||
Weapons_ViewAnimation(pl, HANDGRENADE_DRAW);
|
||||
#ifdef SERVER
|
||||
if (!pl.ammo_handgrenade) {
|
||||
Weapons_RemoveItem(pl, WEAPON_HANDGRENADE);
|
||||
}
|
||||
#endif
|
||||
pl.w_attack_next = 0.5f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
pl.mode_tempstate = 0;
|
||||
} else {
|
||||
int r = floor(pseudorandom() * 8.0f);
|
||||
if (r == 1) {
|
||||
Weapons_ViewAnimation(pl, HANDGRENADE_FIDGET);
|
||||
pl.w_idle_next = 2.5f;
|
||||
} else {
|
||||
Weapons_ViewAnimation(pl, HANDGRENADE_IDLE);
|
||||
pl.w_idle_next = 3.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_handgrenade_aimanim(player pl)
|
||||
{
|
||||
return pl.IsCrouching() ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR;
|
||||
}
|
||||
|
||||
void
|
||||
w_handgrenade_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(pos, [170,45], g_hud6_spr, [0,0], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], g_hud3_spr, [0,0], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_handgrenade, MAX_A_HANDGRENADE, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_handgrenade_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.ammo_handgrenade <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
weapontype_t
|
||||
w_handgrenade_type(player pl)
|
||||
{
|
||||
return WPNTYPE_THROW;
|
||||
}
|
||||
|
||||
weapon_t w_handgrenade =
|
||||
{
|
||||
.name = "grenade",
|
||||
.id = ITEM_HANDGRENADE,
|
||||
.slot = 4,
|
||||
.slot_pos = 0,
|
||||
.weight = 5,
|
||||
.draw = w_handgrenade_draw,
|
||||
.holster = w_handgrenade_holster,
|
||||
.primary = w_handgrenade_primary,
|
||||
.secondary = __NULL__,
|
||||
.reload = __NULL__,
|
||||
.release = w_handgrenade_release,
|
||||
.postdraw = w_handgrenade_hud,
|
||||
.precache = w_handgrenade_precache,
|
||||
.pickup = w_handgrenade_pickup,
|
||||
.updateammo = w_handgrenade_updateammo,
|
||||
.wmodel = w_handgrenade_wmodel,
|
||||
.pmodel = w_handgrenade_pmodel,
|
||||
.deathmsg = w_handgrenade_deathmsg,
|
||||
.aimanim = w_handgrenade_aimanim,
|
||||
.isempty = w_handgrenade_isempty,
|
||||
.type = w_handgrenade_type,
|
||||
.hudpic = w_handgrenade_hudpic
|
||||
};
|
|
@ -1,314 +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.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
HORNETGUN_IDLE,
|
||||
HORNETGUN_FIDGET1,
|
||||
HORNETGUN_FIDGET2,
|
||||
HORNETGUN_HOLSTER,
|
||||
HORNETGUN_DRAW,
|
||||
HORNETGUN_SHOOT
|
||||
};
|
||||
|
||||
void
|
||||
w_hornetgun_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_hornetgun.fire");
|
||||
Sound_Precache("weapon_hornetgun.buzz");
|
||||
Sound_Precache("weapon_hornetgun.hit");
|
||||
precache_model("models/w_hgun.mdl");
|
||||
precache_model("models/hornet.mdl");
|
||||
#else
|
||||
precache_model("models/v_hgun.mdl");
|
||||
precache_model("models/p_hgun.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_hornetgun_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
/* only pick it up once */
|
||||
if (new) {
|
||||
pl.ammo_hornet = MAX_A_HORNET;
|
||||
return (1);
|
||||
}
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
w_hornetgun_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_hornet, -1);
|
||||
}
|
||||
string w_hornetgun_wmodel(void)
|
||||
{
|
||||
return "models/w_hgun.mdl";
|
||||
}
|
||||
string w_hornetgun_pmodel(player pl)
|
||||
{
|
||||
return "models/p_hgun.mdl";
|
||||
}
|
||||
string w_hornetgun_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void
|
||||
w_hornetgun_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_hgun.mdl");
|
||||
Weapons_ViewAnimation(pl, HORNETGUN_DRAW);
|
||||
}
|
||||
|
||||
void
|
||||
w_hornetgun_holster(player pl)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
w_hornetgun_shoothornet(player pl)
|
||||
{
|
||||
static void Hornet_Touch(void) {
|
||||
if (other.takedamage == DAMAGE_YES) {
|
||||
Damage_Apply(other, self.owner, Skill_GetValue("plr_hornet", 10), WEAPON_HORNETGUN, DMG_GENERIC);
|
||||
Sound_Play(other, CHAN_VOICE, "weapon_hornetgun.hit");
|
||||
} else {
|
||||
Sound_Play(self, CHAN_VOICE, "weapon_hornetgun.buzz");
|
||||
}
|
||||
remove(self);
|
||||
}
|
||||
|
||||
Weapons_MakeVectors(pl);
|
||||
entity bolt = spawn();
|
||||
setmodel(bolt, "models/hornet.mdl");
|
||||
setorigin(bolt, Weapons_GetCameraPos(pl) + (v_forward * 16) + (v_up * -8));
|
||||
bolt.owner = pl;
|
||||
bolt.velocity = v_forward * 1000;
|
||||
bolt.movetype = MOVETYPE_FLY;
|
||||
bolt.solid = SOLID_BBOX;
|
||||
//bolt.flags |= FL_LAGGEDMOVE;
|
||||
bolt.gravity = 0.5f;
|
||||
bolt.angles = vectoangles(bolt.velocity);
|
||||
bolt.touch = Hornet_Touch;
|
||||
bolt.traileffectnum = particleeffectnum("weapon_hornet.trail");
|
||||
setsize(bolt, [0,0,0], [0,0,0]);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
w_hornetgun_release(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* slow regeneration of ammunition */
|
||||
if (pl.ammo_hornet < MAX_A_HORNET) {
|
||||
pl.ammo_hornet = bound(0, pl.ammo_hornet + 1, MAX_A_HORNET);
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_hornet, -1);
|
||||
pl.w_idle_next = 0.35f;
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int r;
|
||||
r = floor(pseudorandom() * 3.0f);
|
||||
switch (r) {
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, HORNETGUN_FIDGET1);
|
||||
pl.w_idle_next = 2.5f;
|
||||
break;
|
||||
case 2:
|
||||
Weapons_ViewAnimation(pl, HORNETGUN_FIDGET2);
|
||||
pl.w_idle_next = 2.1875f;
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, HORNETGUN_IDLE);
|
||||
pl.w_idle_next = 1.875f;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
w_hornetgun_primary(player pl)
|
||||
{
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
if (pl.ammo_hornet <= 0) {
|
||||
w_hornetgun_release(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
w_hornetgun_shoothornet(pl);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_hornetgun.fire");
|
||||
#endif
|
||||
|
||||
pl.ammo_hornet--;
|
||||
Weapons_ViewAnimation(pl, HORNETGUN_SHOOT);
|
||||
|
||||
if (pl.IsCrouching())
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTHIVE, 0.43f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTHIVE, 0.43f);
|
||||
|
||||
pl.w_attack_next = 0.25;
|
||||
pl.w_idle_next = 1.0f;
|
||||
}
|
||||
|
||||
void
|
||||
w_hornetgun_secondary(player pl)
|
||||
{
|
||||
if (pl.w_attack_next) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
if (pl.ammo_hornet <= 0) {
|
||||
w_hornetgun_release(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
w_hornetgun_shoothornet(pl);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_hornetgun.fire");
|
||||
#endif
|
||||
|
||||
pl.ammo_hornet--;
|
||||
Weapons_ViewAnimation(pl, HORNETGUN_SHOOT);
|
||||
|
||||
if (pl.IsCrouching())
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTHIVE, 0.43f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTHIVE, 0.43f);
|
||||
|
||||
pl.w_attack_next = 0.1;
|
||||
pl.w_idle_next = 1.0f;
|
||||
}
|
||||
|
||||
void
|
||||
w_hornetgun_crosshair(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector aicon_pos;
|
||||
|
||||
Cross_DrawSub(g_cross_spr, [24,24], [72/128,24/128], [0.1875, 0.1875]);
|
||||
aicon_pos = g_hudmins + [g_hudres[0] - 48, g_hudres[1] - 42];
|
||||
|
||||
HUD_DrawAmmo2();
|
||||
|
||||
drawsubpic(
|
||||
aicon_pos,
|
||||
[24,24],
|
||||
g_hud7_spr,
|
||||
[24/256,96/128],
|
||||
[24/256, 24/128],
|
||||
g_hud_color,
|
||||
pSeatLocal->m_flAmmo2Alpha,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
float
|
||||
w_hornetgun_aimanim(player pl)
|
||||
{
|
||||
return pl.IsCrouching() ? ANIM_CR_AIMHIVE : ANIM_AIMHIVE;
|
||||
}
|
||||
|
||||
void
|
||||
w_hornetgun_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud5_spr,
|
||||
[0,180/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud2_spr,
|
||||
[0,180/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_hornet, MAX_A_HORNET, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_hornetgun_isempty(player pl)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
weapontype_t
|
||||
w_hornetgun_type(player pl)
|
||||
{
|
||||
return WPNTYPE_RANGED;
|
||||
}
|
||||
|
||||
weapon_t w_hornetgun =
|
||||
{
|
||||
.name = "hornet",
|
||||
.id = ITEM_HORNETGUN,
|
||||
.slot = 3,
|
||||
.slot_pos = 3,
|
||||
.weight = 10,
|
||||
.draw = w_hornetgun_draw,
|
||||
.holster = w_hornetgun_holster,
|
||||
.primary = w_hornetgun_primary,
|
||||
.secondary = w_hornetgun_secondary,
|
||||
.reload = __NULL__,
|
||||
.release = w_hornetgun_release,
|
||||
.postdraw = w_hornetgun_crosshair,
|
||||
.precache = w_hornetgun_precache,
|
||||
.pickup = w_hornetgun_pickup,
|
||||
.updateammo = w_hornetgun_updateammo,
|
||||
.wmodel = w_hornetgun_wmodel,
|
||||
.pmodel = w_hornetgun_pmodel,
|
||||
.deathmsg = w_hornetgun_deathmsg,
|
||||
.aimanim = w_hornetgun_aimanim,
|
||||
.isempty = w_hornetgun_isempty,
|
||||
.type = w_hornetgun_type,
|
||||
.hudpic = w_hornetgun_hudpic
|
||||
};
|
|
@ -1,359 +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.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
PYTHON_IDLE1,
|
||||
PYTHON_FIDGET,
|
||||
PYTHON_FIRE1,
|
||||
PYTHON_RELOAD,
|
||||
PYTHON_HOLSTER,
|
||||
PYTHON_DRAW,
|
||||
PYTHON_IDLE2,
|
||||
PYTHON_IDLE3
|
||||
};
|
||||
|
||||
void
|
||||
w_python_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_357.shoot");
|
||||
Sound_Precache("weapon_357.empty");
|
||||
Sound_Precache("weapon_357.reload");
|
||||
precache_model("models/w_357.mdl");
|
||||
#else
|
||||
precache_model("models/v_357.mdl");
|
||||
precache_model("models/p_357.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_python_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
int addAmmo = (startammo == -1) ? 6 : startammo;
|
||||
|
||||
if (new) {
|
||||
pl.python_mag = addAmmo;
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (pl.ammo_357 < MAX_A_357) {
|
||||
pl.ammo_357 = bound(0, pl.ammo_357 + addAmmo, MAX_A_357);
|
||||
} else {
|
||||
if (!new)
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_python_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.python_mag, pl.ammo_357, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_python_wmodel(void)
|
||||
{
|
||||
return "models/w_357.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_python_pmodel(player pl)
|
||||
{
|
||||
return "models/p_357.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_python_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void
|
||||
w_python_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_357.mdl");
|
||||
|
||||
/* singleplayer doesn't do scope */
|
||||
if (serverkeyfloat("sv_playerslots") == 1) {
|
||||
Weapons_SetGeomset("geomset 4 1\n");
|
||||
} else {
|
||||
Weapons_SetGeomset("geomset 4 2\n");
|
||||
}
|
||||
|
||||
Weapons_ViewAnimation(pl, PYTHON_DRAW);
|
||||
}
|
||||
|
||||
void
|
||||
w_python_holster(player pl)
|
||||
{
|
||||
Weapons_ViewAnimation(pl, PYTHON_HOLSTER);
|
||||
}
|
||||
|
||||
void
|
||||
w_python_primary(player pl)
|
||||
{
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.gflags & GF_SEMI_TOGGLED)
|
||||
return;
|
||||
|
||||
/* Ammo check */
|
||||
if ((pl.python_mag <= 0) || (pl.WaterLevel() >= WATERLEVEL_SUBMERGED)) {
|
||||
#ifdef SERVER
|
||||
Sound_Play(pl, CHAN_AUTO, "weapon_357.empty");
|
||||
#endif
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
return;
|
||||
}
|
||||
|
||||
pl.python_mag--;
|
||||
|
||||
/* Actual firing */
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_SMALL);
|
||||
#else
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, Skill_GetValue("plr_357_bullet", 40), [0.008, 0.008], WEAPON_PYTHON, "Impact.BigShot");
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_357.shoot");
|
||||
#endif
|
||||
|
||||
Weapons_ViewPunchAngle(pl, [-10,0,0]);
|
||||
Weapons_ViewAnimation(pl, PYTHON_FIRE1);
|
||||
|
||||
if (pl.IsCrouching())
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTPYTHON, 0.43f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTPYTHON, 0.43f);
|
||||
|
||||
pl.w_attack_next = 0.75f;
|
||||
pl.w_idle_next = 10.0f;
|
||||
}
|
||||
|
||||
void
|
||||
w_python_secondary(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* singleplayer doesn't do scope */
|
||||
if (serverkeyfloat("sv_playerslots") == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Simple toggle of fovs */
|
||||
if (pl.viewzoom == 1.0f) {
|
||||
pl.viewzoom = 0.5f;
|
||||
} else {
|
||||
pl.viewzoom = 1.0f;
|
||||
}
|
||||
|
||||
pl.w_attack_next = 0.25f;
|
||||
}
|
||||
|
||||
void
|
||||
w_python_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
if (pl.python_mag >= 6) {
|
||||
return;
|
||||
}
|
||||
if (pl.ammo_357 <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* undo our zoom */
|
||||
pl.viewzoom = 1.0f;
|
||||
|
||||
/* Audio-Visual bit */
|
||||
Weapons_ViewAnimation(pl, PYTHON_RELOAD);
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_python_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::python_mag, player::ammo_357, 6);
|
||||
}
|
||||
|
||||
pl.think = w_python_reload_done;
|
||||
pl.nextthink = time + 3.15f;
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_357.reload");
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 3.25f;
|
||||
pl.w_idle_next = 10.0f;
|
||||
}
|
||||
|
||||
void
|
||||
w_python_release(player pl)
|
||||
{
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.python_mag == 0 && pl.ammo_357 > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int r = floor(pseudorandom() * 4.0f);
|
||||
|
||||
switch (r) {
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, PYTHON_IDLE1);
|
||||
pl.w_idle_next = 2.33f;
|
||||
break;
|
||||
case 2:
|
||||
Weapons_ViewAnimation(pl, PYTHON_FIDGET);
|
||||
pl.w_idle_next = 5.66f;
|
||||
break;
|
||||
case 3:
|
||||
Weapons_ViewAnimation(pl, PYTHON_IDLE2);
|
||||
pl.w_idle_next = 2.0f;
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, PYTHON_IDLE3);
|
||||
pl.w_idle_next = 2.93f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
w_python_crosshair(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector aicon_pos;
|
||||
|
||||
if (pl.viewzoom == 1) {
|
||||
Cross_DrawSub(g_cross_spr, [24,24], [48/128,0], [0.1875, 0.1875]);
|
||||
} else {
|
||||
Cross_DrawSub(g_cross_spr, [24,24], [96/128,0], [0.1875, 0.1875]);
|
||||
}
|
||||
|
||||
HUD_DrawAmmo1();
|
||||
HUD_DrawAmmo2();
|
||||
|
||||
aicon_pos = g_hudmins + [g_hudres[0] - 48, g_hudres[1] - 42];
|
||||
drawsubpic(
|
||||
aicon_pos,
|
||||
[24,24],
|
||||
g_hud7_spr,
|
||||
[24/256,72/128],
|
||||
[24/256, 24/128],
|
||||
g_hud_color,
|
||||
pSeatLocal->m_flAmmo2Alpha,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
float
|
||||
w_python_aimanim(player pl)
|
||||
{
|
||||
return pl.IsCrouching() ? ANIM_CR_AIMPYTHON : ANIM_AIMPYTHON;
|
||||
}
|
||||
|
||||
void
|
||||
w_python_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (pl.python_mag == 0 && pl.ammo_357 == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud4_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud1_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_357, MAX_A_357, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_python_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.python_mag <= 0 && pl.ammo_357 <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
weapontype_t
|
||||
w_python_type(player pl)
|
||||
{
|
||||
return WPNTYPE_RANGED;
|
||||
}
|
||||
|
||||
weapon_t w_python =
|
||||
{
|
||||
.name = "357",
|
||||
.id = ITEM_PYTHON,
|
||||
.slot = 1,
|
||||
.slot_pos = 1,
|
||||
.weight = 15,
|
||||
.draw = w_python_draw,
|
||||
.holster = w_python_holster,
|
||||
.primary = w_python_primary,
|
||||
.secondary = w_python_secondary,
|
||||
.reload = w_python_reload,
|
||||
.release = w_python_release,
|
||||
.postdraw = w_python_crosshair,
|
||||
.precache = w_python_precache,
|
||||
.pickup = w_python_pickup,
|
||||
.updateammo = w_python_updateammo,
|
||||
.wmodel = w_python_wmodel,
|
||||
.pmodel = w_python_pmodel,
|
||||
.deathmsg = w_python_deathmsg,
|
||||
.aimanim = w_python_aimanim,
|
||||
.isempty = w_python_isempty,
|
||||
.type = w_python_type,
|
||||
.hudpic = w_python_hudpic
|
||||
};
|
|
@ -1,333 +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.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
RPG_IDLE,
|
||||
RPG_FIDGET,
|
||||
RPG_RELOAD,
|
||||
RPG_FIRE2,
|
||||
RPG_HOLSTER1,
|
||||
RPG_DRAW1,
|
||||
RPG_HOLSTER2,
|
||||
RPG_DRAW_UL,
|
||||
RPG_IDLE_UL,
|
||||
RPG_FIDGET_UL,
|
||||
};
|
||||
|
||||
void w_rpg_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_rpg.shoot");
|
||||
Sound_Precache("weapon_rpg.empty");
|
||||
precache_model("models/w_rpg.mdl");
|
||||
precache_model("models/rpgrocket.mdl");
|
||||
Sound_Precache("fx.explosion");
|
||||
#else
|
||||
precache_model("models/v_rpg.mdl");
|
||||
precache_model("models/p_rpg.mdl");
|
||||
precache_model("sprites/laserdot.spr");
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_rpg_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.rpg_mag, pl.ammo_rocket, -1);
|
||||
}
|
||||
string w_rpg_wmodel(void)
|
||||
{
|
||||
return "models/w_rpg.mdl";
|
||||
}
|
||||
string w_rpg_pmodel(player pl)
|
||||
{
|
||||
return "models/p_rpg.mdl";
|
||||
}
|
||||
string w_rpg_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int w_rpg_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
int addAmmo = (startammo == -1) ? 2 : startammo;
|
||||
|
||||
if (new) {
|
||||
if (addAmmo > 1) {
|
||||
pl.rpg_mag = 1;
|
||||
pl.ammo_rocket = bound(0, pl.ammo_rocket + 1, MAX_A_ROCKET);
|
||||
} else {
|
||||
pl.rpg_mag = addAmmo;
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (pl.ammo_rocket < MAX_A_ROCKET) {
|
||||
pl.ammo_rocket = bound(0, pl.ammo_rocket + 2, MAX_A_ROCKET);
|
||||
} else {
|
||||
if (!new)
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void w_rpg_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_rpg.mdl");
|
||||
Weapons_ViewAnimation(pl, RPG_DRAW1);
|
||||
pl.ammo_rpg_state = 1;
|
||||
}
|
||||
|
||||
void w_rpg_holster(player pl)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void w_rpg_primary(player pl)
|
||||
{
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.gflags & GF_SEMI_TOGGLED)
|
||||
return;
|
||||
|
||||
/* ammo check */
|
||||
if ((pl.rpg_mag <= 0i) ? true : false) {
|
||||
#ifdef SERVER
|
||||
Sound_Play(pl, CHAN_AUTO, "weapon_rpg.empty");
|
||||
#endif
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
return;
|
||||
}
|
||||
|
||||
pl.rpg_mag--;
|
||||
|
||||
#ifdef SERVER
|
||||
if (pl.ammo_rpg_state > 0) {
|
||||
NSProjectile_SpawnDef("projectile_rocket_homing", pl);
|
||||
} else {
|
||||
NSProjectile_SpawnDef("projectile_rocket", pl);
|
||||
}
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_rpg.shoot");
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(pl, RPG_FIRE2);
|
||||
Weapons_ViewPunchAngle(pl, [-10,0,0]);
|
||||
|
||||
if (pl.IsCrouching())
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTRPG, 0.43f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTRPG, 0.43f);
|
||||
|
||||
pl.w_attack_next =
|
||||
pl.w_idle_next = 2.5f;
|
||||
}
|
||||
|
||||
void w_rpg_reload(player pl)
|
||||
{
|
||||
if (pl.w_attack_next > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
if (pl.rpg_mag >= 1) {
|
||||
return;
|
||||
}
|
||||
if (pl.ammo_rocket <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_ViewAnimation(pl, RPG_RELOAD);
|
||||
|
||||
/* Audio-Visual Bit */
|
||||
#ifdef SERVER
|
||||
static void w_rpg_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::rpg_mag, player::ammo_rocket, 1);
|
||||
}
|
||||
|
||||
pl.think = w_rpg_reload_done;
|
||||
pl.nextthink = time + 2.15f;
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 2.25f;
|
||||
pl.w_idle_next = 10.0f;
|
||||
}
|
||||
|
||||
void w_rpg_release(player pl)
|
||||
{
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.rpg_mag == 0 && pl.ammo_rocket > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int r = floor(pseudorandom() * 3.0f);
|
||||
|
||||
if (pl.rpg_mag > 0) {
|
||||
if (r == 1) {
|
||||
Weapons_ViewAnimation(pl, RPG_FIDGET);
|
||||
} else {
|
||||
Weapons_ViewAnimation(pl, RPG_IDLE);
|
||||
}
|
||||
} else {
|
||||
if (r == 1) {
|
||||
Weapons_ViewAnimation(pl, RPG_FIDGET_UL);
|
||||
} else {
|
||||
Weapons_ViewAnimation(pl, RPG_IDLE_UL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void w_rpg_secondary(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* toggle laser */
|
||||
pl.ammo_rpg_state = 1 - pl.ammo_rpg_state;
|
||||
|
||||
pl.w_attack_next = 0.25f;
|
||||
w_rpg_release(pl);
|
||||
}
|
||||
|
||||
float w_rpg_aimanim(player pl)
|
||||
{
|
||||
return pl.IsCrouching() ? ANIM_CR_AIMRPG : ANIM_AIMRPG;
|
||||
}
|
||||
|
||||
void w_rpg_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (pl.rpg_mag == 0 && pl.ammo_rocket == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(pos, [170,45], g_hud5_spr, [0,45/256], [170/256,45/256], hud_col, a, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], g_hud2_spr, [0,45/256], [170/256,45/256], hud_col, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_rocket, MAX_A_ROCKET, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_rpg_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector laser_pos;
|
||||
vector aicon_pos;
|
||||
|
||||
/* crosshair/laser */
|
||||
if (pl.ammo_rpg_state == 1) {
|
||||
float lerpValue;
|
||||
vector jitter = [0.0f, 0.0f, 0.0f];
|
||||
Weapons_MakeVectors(pl);
|
||||
vector src = pl.origin + pl.view_ofs;
|
||||
traceline(src, src + (v_forward * 256), FALSE, pl);
|
||||
lerpValue = lerp(18,6, trace_fraction);
|
||||
jitter[0] = (random(0,2) - 2) * (1 - trace_fraction);
|
||||
jitter[1] = (random(0,2) - 2) * (1 - trace_fraction);
|
||||
laser_pos = g_hudmins + (g_hudres / 2) + ([-lerpValue,-lerpValue] / 2);
|
||||
|
||||
drawsubpic(
|
||||
laser_pos + jitter,
|
||||
[lerpValue,lerpValue],
|
||||
g_laser_spr,
|
||||
[0,0],
|
||||
[1.0, 1.0],
|
||||
[1,1,1],
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
||||
Cross_DrawSub(g_cross_spr, [24,24], [24/128,48/128], [0.1875, 0.1875]);
|
||||
} else {
|
||||
Cross_DrawSub(g_cross_spr, [24,24], [24/128,48/128], [0.1875, 0.1875]);
|
||||
}
|
||||
|
||||
/* ammo counters */
|
||||
HUD_DrawAmmo1();
|
||||
HUD_DrawAmmo2();
|
||||
|
||||
/* ammo icon */
|
||||
aicon_pos = g_hudmins + [g_hudres[0] - 48, g_hudres[1] - 42];
|
||||
drawsubpic(
|
||||
aicon_pos,
|
||||
[24,24],
|
||||
"sprites/640hud7.spr_0.tga",
|
||||
[120/256,72/128],
|
||||
[24/256, 24/128],
|
||||
g_hud_color,
|
||||
pSeatLocal->m_flAmmo2Alpha,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_rpg_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.rpg_mag <= 0 && pl.ammo_rocket <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
weapontype_t
|
||||
w_rpg_type(player pl)
|
||||
{
|
||||
return WPNTYPE_RANGED;
|
||||
}
|
||||
|
||||
weapon_t w_rpg =
|
||||
{
|
||||
.name = "rpg_rocket",
|
||||
.id = ITEM_RPG,
|
||||
.slot = 3,
|
||||
.slot_pos = 0,
|
||||
.weight = 20,
|
||||
.draw = w_rpg_draw,
|
||||
.holster = w_rpg_holster,
|
||||
.primary = w_rpg_primary,
|
||||
.secondary = w_rpg_secondary,
|
||||
.reload = w_rpg_reload,
|
||||
.release = w_rpg_release,
|
||||
.postdraw = w_rpg_hud,
|
||||
.precache = w_rpg_precache,
|
||||
.pickup = w_rpg_pickup,
|
||||
.updateammo = w_rpg_updateammo,
|
||||
.wmodel = w_rpg_wmodel,
|
||||
.pmodel = w_rpg_pmodel,
|
||||
.deathmsg = w_rpg_deathmsg,
|
||||
.aimanim = w_rpg_aimanim,
|
||||
.isempty = w_rpg_isempty,
|
||||
.type = w_rpg_type,
|
||||
.hudpic = w_rpg_hudpic
|
||||
};
|
|
@ -1,308 +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.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
SATCHEL_IDLE,
|
||||
SATCHEL_FIDGET,
|
||||
SATCHEL_DRAW,
|
||||
SATCHEL_THROW
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RADIO_IDLE,
|
||||
RADIO_FIDGET,
|
||||
RADIO_DRAW,
|
||||
RADIO_USE,
|
||||
RADIO_HOLSTER
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
s_satchel_detonate(entity master)
|
||||
{
|
||||
for (entity b = world; (b = find(b, ::classname, "projectile_satchel"));) {
|
||||
if (b.owner != master)
|
||||
continue;
|
||||
|
||||
NSEntity satchelEnt = (NSEntity)b;
|
||||
satchelEnt.Trigger(master, TRIG_TOGGLE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
w_satchel_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.satchel_chg, pl.ammo_satchel, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_satchel_wmodel(void)
|
||||
{
|
||||
return "models/w_satchel.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_satchel_pmodel(player pl)
|
||||
{
|
||||
return "models/p_satchel.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_satchel_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void
|
||||
w_satchel_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_satchel.bounce");
|
||||
precache_model("models/w_satchel.mdl");
|
||||
#else
|
||||
precache_model("models/v_satchel.mdl");
|
||||
precache_model("models/v_satchel_radio.mdl");
|
||||
precache_model("models/p_satchel.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_satchel_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
int addAmmo = (startammo == -1) ? 1 : startammo;
|
||||
|
||||
if (pl.ammo_satchel < MAX_A_SATCHEL) {
|
||||
pl.ammo_satchel = bound(0, pl.ammo_satchel + addAmmo, MAX_A_SATCHEL);
|
||||
} else {
|
||||
if (!new)
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_satchel_draw(player pl)
|
||||
{
|
||||
if (pl.satchel_chg > 0) {
|
||||
Weapons_SetModel("models/v_satchel_radio.mdl");
|
||||
Weapons_ViewAnimation(pl, RADIO_DRAW);
|
||||
|
||||
} else {
|
||||
Weapons_SetModel("models/v_satchel.mdl");
|
||||
Weapons_ViewAnimation(pl, SATCHEL_DRAW);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
w_satchel_holster(player pl)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
w_satchel_primary(player pl)
|
||||
{
|
||||
if (pl.w_attack_next) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
if (pl.satchel_chg <= 0 && pl.ammo_satchel <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.satchel_chg <= 0) {
|
||||
Weapons_ViewAnimation(pl, RADIO_DRAW);
|
||||
} else {
|
||||
Weapons_ViewAnimation(pl, RADIO_USE);
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
/* if we don't have any satchels placed yet, place one */
|
||||
if (!pl.satchel_chg) {
|
||||
NSProjectile_SpawnDef("projectile_satchel", pl);
|
||||
pl.satchel_chg++;
|
||||
pl.ammo_satchel--;
|
||||
pl.mode_tempstate = 1; /* mark us as having deployed something */
|
||||
|
||||
if (pl.IsCrouching())
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTSQUEAK, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTSQUEAK, 0.5f);
|
||||
} else {
|
||||
/* detonate all we have */
|
||||
s_satchel_detonate(pl);
|
||||
pl.satchel_chg = 0;
|
||||
|
||||
/* no satchels left to place? just get rid of this thing */
|
||||
if (pl.ammo_satchel <= 0) {
|
||||
Weapons_RemoveItem(pl, WEAPON_SATCHEL);
|
||||
}
|
||||
}
|
||||
#else
|
||||
Weapons_SetModel("models/v_satchel_radio.mdl");
|
||||
|
||||
/* same thing as the SERVER ifdef above... */
|
||||
if (!pl.satchel_chg) {
|
||||
pl.satchel_chg++;
|
||||
pl.ammo_satchel--;
|
||||
} else {
|
||||
pl.satchel_chg = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 1.0f;
|
||||
pl.w_idle_next = 1.0f;
|
||||
}
|
||||
|
||||
void
|
||||
w_satchel_secondary(player pl)
|
||||
{
|
||||
if (pl.w_attack_next) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
if (pl.ammo_satchel <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_SetModel("models/v_satchel_radio.mdl");
|
||||
Weapons_ViewAnimation(pl, RADIO_DRAW);
|
||||
|
||||
#ifdef SERVER
|
||||
NSProjectile_SpawnDef("projectile_satchel", pl);
|
||||
#endif
|
||||
|
||||
if (pl.IsCrouching())
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTSQUEAK, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTSQUEAK, 0.5f);
|
||||
|
||||
pl.satchel_chg++;
|
||||
pl.ammo_satchel--;
|
||||
pl.mode_tempstate = 1; /* mark us as having deployed something */
|
||||
|
||||
pl.w_attack_next = 1.0f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
}
|
||||
|
||||
void
|
||||
w_satchel_reload(player pl)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
w_satchel_release(player pl)
|
||||
{
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* keep track of the model via tempstates */
|
||||
if (pl.satchel_chg < 1i && pl.mode_tempstate != 0) {
|
||||
pl.mode_tempstate = 0;
|
||||
Weapons_SetModel("models/v_satchel.mdl");
|
||||
Weapons_ViewAnimation(pl, SATCHEL_DRAW);
|
||||
pl.w_idle_next = 15.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.satchel_chg <= 0) {
|
||||
Weapons_ViewAnimation(pl, SATCHEL_FIDGET);
|
||||
} else {
|
||||
Weapons_ViewAnimation(pl, RADIO_FIDGET);
|
||||
}
|
||||
pl.w_idle_next = 15.0f;
|
||||
}
|
||||
|
||||
float
|
||||
w_satchel_aimanim(player pl)
|
||||
{
|
||||
return pl.IsCrouching() ? ANIM_CR_AIMSQUEAK : ANIM_AIMSQUEAK;
|
||||
}
|
||||
|
||||
void
|
||||
w_satchel_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
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,96/128], [24/256, 24/128], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_satchel_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(pos, [170,45], g_hud6_spr, [0,45/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], g_hud3_spr, [0,45/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_satchel, MAX_A_SATCHEL, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_satchel_isempty(player pl)
|
||||
{
|
||||
if (pl.ammo_satchel <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
weapontype_t
|
||||
w_satchel_type(player pl)
|
||||
{
|
||||
return WPNTYPE_THROW;
|
||||
}
|
||||
|
||||
weapon_t w_satchel =
|
||||
{
|
||||
.name = "satchel",
|
||||
.id = ITEM_SATCHEL,
|
||||
.slot = 4,
|
||||
.slot_pos = 1,
|
||||
.weight = -20,
|
||||
.draw = w_satchel_draw,
|
||||
.holster = w_satchel_holster,
|
||||
.primary = w_satchel_primary,
|
||||
.secondary = w_satchel_secondary,
|
||||
.reload = w_satchel_reload,
|
||||
.release = w_satchel_release,
|
||||
.postdraw = w_satchel_hud,
|
||||
.precache = w_satchel_precache,
|
||||
.pickup = w_satchel_pickup,
|
||||
.updateammo = w_satchel_updateammo,
|
||||
.wmodel = w_satchel_wmodel,
|
||||
.pmodel = w_satchel_pmodel,
|
||||
.deathmsg = w_satchel_deathmsg,
|
||||
.aimanim = w_satchel_aimanim,
|
||||
.isempty = w_satchel_isempty,
|
||||
.type = w_satchel_type,
|
||||
.hudpic = w_satchel_hudpic
|
||||
};
|
|
@ -1,449 +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.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
SHOTGUN_IDLE1,
|
||||
SHOTGUN_FIRE1,
|
||||
SHOTGUN_FIRE2,
|
||||
SHOTGUN_RELOAD,
|
||||
SHOTGUN_PUMP,
|
||||
SHOTGUN_START_RELOAD,
|
||||
SHOTGUN_DRAW,
|
||||
SHOTGUN_HOLSTER,
|
||||
SHOTGUN_IDLE2,
|
||||
SHOTGUN_IDLE3
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
SHOTTY_IDLE,
|
||||
SHOTTY_RELOAD_START,
|
||||
SHOTTY_RELOAD,
|
||||
SHOTTY_RELOAD_END,
|
||||
SHOTTY_COCKSOUND
|
||||
};
|
||||
|
||||
#ifdef CLIENT
|
||||
void w_shotgun_ejectshell(void)
|
||||
{
|
||||
static void w_shotgun_ejectshell_death(void) {
|
||||
remove(self);
|
||||
}
|
||||
static void w_shotgun_ejectshell_touch(void) {
|
||||
if (other == world)
|
||||
Sound_Play(self, CHAN_BODY, "modelevent_shotgunshell.land");
|
||||
}
|
||||
|
||||
entity eShell = spawn();
|
||||
setmodel(eShell, "models/shotgunshell.mdl");
|
||||
eShell.solid = SOLID_BBOX;
|
||||
eShell.movetype = MOVETYPE_BOUNCE;
|
||||
eShell.drawmask = MASK_ENGINE;
|
||||
eShell.angles = [pSeat->m_eViewModel.angles[0], pSeat->m_eViewModel.angles[1], 0];
|
||||
eShell.velocity = pSeat->m_vecPredictedVelocity;
|
||||
|
||||
makevectors(pSeat->m_eViewModel.angles);
|
||||
eShell.velocity += (v_forward * 0);
|
||||
eShell.velocity += (v_right * 80);
|
||||
eShell.velocity += (v_up * 100);
|
||||
eShell.touch = w_shotgun_ejectshell_touch;
|
||||
|
||||
eShell.avelocity = [0,45,900];
|
||||
eShell.think = w_shotgun_ejectshell_death;
|
||||
eShell.nextthink = time + 2.5f;
|
||||
setsize(eShell, [0,0,0], [0,0,0]);
|
||||
setorigin(eShell, pSeat->m_eViewModel.origin + (v_forward * 26) + (v_right * 8) + (v_up * -8));
|
||||
}
|
||||
#endif
|
||||
|
||||
void w_shotgun_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_shotgun.single");
|
||||
Sound_Precache("weapon_shotgun.empty");
|
||||
Sound_Precache("weapon_shotgun.double");
|
||||
Sound_Precache("weapon_shotgun.reload");
|
||||
Sound_Precache("weapon_shotgun.cock");
|
||||
precache_model("models/w_shotgun.mdl");
|
||||
precache_model("models/shotgunshell.mdl");
|
||||
#else
|
||||
precache_model("models/v_shotgun.mdl");
|
||||
precache_model("models/p_shotgun.mdl");
|
||||
precache_model("models/shotgunshell.mdl");
|
||||
Sound_Precache("modelevent_shotgunshell.land");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_shotgun_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.shotgun_mag, pl.ammo_buckshot, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_shotgun_wmodel(void)
|
||||
{
|
||||
return "models/w_shotgun.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_shotgun_pmodel(player pl)
|
||||
{
|
||||
return "models/p_shotgun.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_shotgun_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_shotgun_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
int addAmmo = (startammo == -1) ? 8 : startammo;
|
||||
|
||||
if (new) {
|
||||
pl.shotgun_mag = addAmmo;
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (pl.ammo_buckshot < MAX_A_BUCKSHOT) {
|
||||
pl.ammo_buckshot = bound(0, pl.ammo_buckshot + addAmmo, MAX_A_BUCKSHOT);
|
||||
} else {
|
||||
if (!new)
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_shotgun_draw(player pl)
|
||||
{
|
||||
pl.mode_tempstate = 0;
|
||||
|
||||
Weapons_SetModel("models/v_shotgun.mdl");
|
||||
Weapons_ViewAnimation(pl, SHOTGUN_DRAW);
|
||||
}
|
||||
|
||||
void
|
||||
w_shotgun_holster(player pl)
|
||||
{
|
||||
Weapons_ViewAnimation(pl, SHOTGUN_HOLSTER);
|
||||
}
|
||||
|
||||
void w_shotgun_release(player pl);
|
||||
|
||||
void
|
||||
w_shotgun_reload(player pl)
|
||||
{
|
||||
if (pl.shotgun_mag >= 8) {
|
||||
return;
|
||||
}
|
||||
if (pl.ammo_buckshot <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.mode_tempstate > SHOTTY_IDLE) {
|
||||
return;
|
||||
}
|
||||
pl.mode_tempstate = SHOTTY_RELOAD_START;
|
||||
pl.w_idle_next = 0.0f;
|
||||
}
|
||||
|
||||
void
|
||||
w_shotgun_primary(player pl)
|
||||
{
|
||||
if (pl.gflags & GF_SEMI_TOGGLED)
|
||||
return;
|
||||
|
||||
/* Ammo check */
|
||||
if ((pl.shotgun_mag <= 0) || (pl.WaterLevel() >= WATERLEVEL_SUBMERGED)) {
|
||||
#ifdef SERVER
|
||||
Sound_Play(pl, CHAN_AUTO, "weapon_shotgun.empty");
|
||||
#endif
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.w_attack_next > 0.0f) {
|
||||
w_shotgun_release(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
/* interrupt reloading if no longer empty */
|
||||
if (pl.mode_tempstate == SHOTTY_RELOAD && pl.shotgun_mag >= 1) {
|
||||
pl.mode_tempstate = SHOTTY_RELOAD_END;
|
||||
w_shotgun_release(pl);
|
||||
return;
|
||||
} else if (pl.mode_tempstate > SHOTTY_IDLE) {
|
||||
w_shotgun_release(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
if (pl.shotgun_mag <= 0) {
|
||||
w_shotgun_release(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
/* Singleplayer is more accurate */
|
||||
if (serverkeyfloat("sv_playerslots") == 1) {
|
||||
TraceAttack_FireBulletsWithDecal(6, pl.origin + pl.view_ofs, Skill_GetValue("plr_buckshot", 5), [0.08716,0.08716], WEAPON_SHOTGUN, "Impact.BigShot");
|
||||
} else {
|
||||
TraceAttack_FireBulletsWithDecal(4, pl.origin + pl.view_ofs, Skill_GetValue("plr_buckshot", 5), [0.08716,0.04362], WEAPON_SHOTGUN, "Impact.BigShot");
|
||||
}
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_shotgun.single");
|
||||
#else
|
||||
View_SetMuzzleflash(MUZZLE_WEIRD);
|
||||
View_AddEvent(w_shotgun_ejectshell, 0.5f);
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(pl, SHOTGUN_FIRE1);
|
||||
Weapons_ViewPunchAngle(pl, [-5,0,0]);
|
||||
|
||||
if (pl.IsCrouching())
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTSHOTGUN, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTSHOTGUN, 0.5f);
|
||||
|
||||
pl.shotgun_mag--;
|
||||
|
||||
/* after 1/2 a second, play the cocksound and eject shell */
|
||||
pl.mode_tempstate = SHOTTY_COCKSOUND;
|
||||
pl.w_idle_next = 0.5f;
|
||||
|
||||
pl.w_attack_next = 0.75;
|
||||
}
|
||||
|
||||
void
|
||||
w_shotgun_secondary(player pl)
|
||||
{
|
||||
if (pl.gflags & GF_SEMI_TOGGLED)
|
||||
return;
|
||||
|
||||
/* Ammo check */
|
||||
if ((pl.shotgun_mag <= 1) || (pl.WaterLevel() >= WATERLEVEL_SUBMERGED)) {
|
||||
#ifdef SERVER
|
||||
Sound_Play(pl, CHAN_AUTO, "weapon_shotgun.empty");
|
||||
#endif
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.w_attack_next > 0.0f) {
|
||||
w_shotgun_release(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
/* interrupt reloading if no longer empty */
|
||||
if (pl.mode_tempstate == SHOTTY_RELOAD && pl.shotgun_mag >= 2) {
|
||||
pl.mode_tempstate = SHOTTY_RELOAD_END;
|
||||
w_shotgun_release(pl);
|
||||
return;
|
||||
} else if (pl.mode_tempstate > SHOTTY_IDLE) {
|
||||
w_shotgun_release(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
if (pl.shotgun_mag <= 1) {
|
||||
w_shotgun_reload(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_ViewAnimation(pl, SHOTGUN_FIRE2);
|
||||
Weapons_ViewPunchAngle(pl, [-10,0,0]);
|
||||
|
||||
if (pl.IsCrouching())
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTSHOTGUN, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTSHOTGUN, 0.5f);
|
||||
|
||||
#ifdef SERVER
|
||||
/* Singleplayer is more accurate */
|
||||
if (serverkeyfloat("sv_playerslots") == 1) {
|
||||
TraceAttack_FireBulletsWithDecal(12, pl.origin + pl.view_ofs, 5, [0.08716,0.08716], WEAPON_SHOTGUN, "Impact.BigShot");
|
||||
} else {
|
||||
TraceAttack_FireBulletsWithDecal(8, pl.origin + pl.view_ofs, 5, [0.17365,0.04362], WEAPON_SHOTGUN, "Impact.BigShot");
|
||||
}
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_shotgun.double");
|
||||
#else
|
||||
View_SetMuzzleflash(MUZZLE_WEIRD);
|
||||
View_AddEvent(w_shotgun_ejectshell, 1.0f);
|
||||
#endif
|
||||
/* after 1 second, play the cocksound and eject shell */
|
||||
pl.mode_tempstate = SHOTTY_COCKSOUND;
|
||||
pl.w_idle_next = 1.0f;
|
||||
|
||||
pl.shotgun_mag -= 2;
|
||||
pl.w_attack_next = 1.5f;
|
||||
}
|
||||
|
||||
void
|
||||
w_shotgun_release(player pl)
|
||||
{
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.mode_tempstate == SHOTTY_IDLE && pl.shotgun_mag == 0 && pl.ammo_buckshot > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (pl.mode_tempstate) {
|
||||
case SHOTTY_RELOAD_START:
|
||||
Weapons_ViewAnimation(pl, SHOTGUN_START_RELOAD);
|
||||
pl.mode_tempstate = SHOTTY_RELOAD;
|
||||
pl.w_idle_next = 0.65f;
|
||||
break;
|
||||
case SHOTTY_RELOAD:
|
||||
Weapons_ViewAnimation(pl, SHOTGUN_RELOAD);
|
||||
pl.shotgun_mag++;
|
||||
pl.ammo_buckshot--;
|
||||
#ifdef SERVER
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_shotgun.reload");
|
||||
#endif
|
||||
if (pl.ammo_buckshot <= 0 || pl.shotgun_mag >= 8) {
|
||||
pl.mode_tempstate = SHOTTY_RELOAD_END;
|
||||
}
|
||||
Weapons_UpdateAmmo(pl, pl.shotgun_mag, pl.ammo_buckshot, pl.mode_tempstate);
|
||||
pl.w_idle_next = 0.5f;
|
||||
break;
|
||||
case SHOTTY_RELOAD_END:
|
||||
Weapons_ViewAnimation(pl, SHOTGUN_PUMP);
|
||||
#ifdef SERVER
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_shotgun.cock");
|
||||
#endif
|
||||
pl.mode_tempstate = SHOTTY_IDLE;
|
||||
pl.w_idle_next = 10.0f;
|
||||
pl.w_attack_next = 0.5f;
|
||||
break;
|
||||
case SHOTTY_COCKSOUND:
|
||||
#ifdef SERVER
|
||||
Sound_Play(pl, CHAN_AUTO, "weapon_shotgun.cock");
|
||||
#endif
|
||||
pl.mode_tempstate = SHOTTY_IDLE;
|
||||
pl.w_idle_next = 10.0f;
|
||||
pl.w_attack_next = 0.5f;
|
||||
break;
|
||||
case SHOTTY_IDLE:
|
||||
default:
|
||||
int r = floor(pseudorandom() * 3.0f);
|
||||
switch (r) {
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, SHOTGUN_IDLE2);
|
||||
pl.w_idle_next = 2.222222f;
|
||||
break;
|
||||
case 2:
|
||||
Weapons_ViewAnimation(pl, SHOTGUN_IDLE3);
|
||||
pl.w_idle_next = 5.0f;
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, SHOTGUN_IDLE1);
|
||||
pl.w_idle_next = 2.222222f;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
w_shotgun_crosshair(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Cross_DrawSub(g_cross_spr, [24,24], [48/128,24/128], [0.1875, 0.1875]);
|
||||
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_shotgun_aimanim(player pl)
|
||||
{
|
||||
return pl.IsCrouching() ? ANIM_CR_AIMSHOTGUN : ANIM_AIMSHOTGUN;
|
||||
}
|
||||
|
||||
void
|
||||
w_shotgun_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (pl.shotgun_mag == 0 && pl.ammo_buckshot == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(pos, [170,45], g_hud4_spr, [0,180/256], [170/256,45/256], hud_col, a, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], g_hud1_spr, [0,180/256], [170/256,45/256], hud_col, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_buckshot, MAX_A_BUCKSHOT, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_shotgun_isempty(player pl)
|
||||
{
|
||||
if (pl.shotgun_mag <= 0 && pl.ammo_buckshot <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
weapontype_t
|
||||
w_shotgun_type(player pl)
|
||||
{
|
||||
return WPNTYPE_RANGED;
|
||||
}
|
||||
|
||||
weapon_t w_shotgun =
|
||||
{
|
||||
.name = "shotgun",
|
||||
.id = ITEM_SHOTGUN,
|
||||
.slot = 2,
|
||||
.slot_pos = 1,
|
||||
.weight = 15,
|
||||
.draw = w_shotgun_draw,
|
||||
.holster = w_shotgun_holster,
|
||||
.primary = w_shotgun_primary,
|
||||
.secondary = w_shotgun_secondary,
|
||||
.reload = w_shotgun_reload,
|
||||
.release = w_shotgun_release,
|
||||
.postdraw = w_shotgun_crosshair,
|
||||
.precache = w_shotgun_precache,
|
||||
.pickup = w_shotgun_pickup,
|
||||
.updateammo = w_shotgun_updateammo,
|
||||
.wmodel = w_shotgun_wmodel,
|
||||
.pmodel = w_shotgun_pmodel,
|
||||
.deathmsg = w_shotgun_deathmsg,
|
||||
.aimanim = w_shotgun_aimanim,
|
||||
.isempty = w_shotgun_isempty,
|
||||
.type = w_shotgun_type,
|
||||
.hudpic = w_shotgun_hudpic
|
||||
};
|
|
@ -1,356 +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.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
SNARK_IDLE,
|
||||
SNARK_FIDGET1,
|
||||
SNARK_FIDGET2,
|
||||
SNARK_HOLSTER,
|
||||
SNARK_DRAW,
|
||||
SNARK_THROW
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
class monster_snark:NSMonster
|
||||
{
|
||||
float m_flJump;
|
||||
entity m_eTarget;
|
||||
|
||||
void(void) monster_snark;
|
||||
|
||||
virtual void(void) customphysics;
|
||||
virtual void(void) Pain;
|
||||
virtual void(void) Death;
|
||||
virtual void(void) Respawn;
|
||||
};
|
||||
|
||||
void
|
||||
monster_snark::customphysics(void)
|
||||
{
|
||||
input_movevalues = [250,0,0];
|
||||
input_buttons = 0;
|
||||
input_impulse = 0;
|
||||
input_angles = angles;
|
||||
input_timelength = frametime;
|
||||
|
||||
if (health <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_flJump <= 0.0 && m_eTarget == __NULL__) {
|
||||
float shortest = 999999;
|
||||
for (entity ef = world; (ef = findfloat(ef, ::movetype, MOVETYPE_WALK));) {
|
||||
float len = vlen(ef.origin - origin);
|
||||
if (ef.classname != "monster_snark" && len < shortest && ef.health > 0) {
|
||||
owner = __NULL__;
|
||||
m_eTarget = ef;
|
||||
shortest = len;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_eTarget) {
|
||||
angles = input_angles = vectoangles(m_eTarget.origin - origin);
|
||||
}
|
||||
|
||||
if (m_eTarget && m_flJump <= 0.0) {
|
||||
m_flJump = 0.5f + random();
|
||||
Sound_Play(this, CHAN_VOICE, "weapon_snark.hunt");
|
||||
input_buttons = 2;
|
||||
Damage_Apply(this, world, 1, 0, DMG_GENERIC);
|
||||
|
||||
makevectors(angles);
|
||||
traceline(origin, origin + (v_forward * 128), 0, this);
|
||||
|
||||
if (trace_ent.takedamage == DAMAGE_YES) {
|
||||
Sound_Play(this, CHAN_BODY, "weapon_snark.deploy");
|
||||
Damage_Apply(trace_ent, real_owner, Skill_GetValue("snark_dmg_bite", 10), WEAPON_SNARK, DMG_GENERIC);
|
||||
FX_Blood(origin + [0,0,16], [1,0,0]);
|
||||
}
|
||||
|
||||
/* TODO this needs to be cleaned up and use isAlive in the future */
|
||||
if (m_eTarget.solid == SOLID_CORPSE) {
|
||||
m_eTarget = __NULL__;
|
||||
}
|
||||
}
|
||||
|
||||
m_flJump -= frametime;
|
||||
|
||||
mins = [0,0,0];
|
||||
maxs = [0,0,0];
|
||||
runstandardplayerphysics(this);
|
||||
mins = [-8.0f, -8.0f, 0.0f];
|
||||
mins = [8.0f, 8.0f, 8.0f];
|
||||
}
|
||||
|
||||
void
|
||||
monster_snark::Pain(void)
|
||||
{
|
||||
/* anything else will kill us immediately */
|
||||
if (g_dmg_eAttacker != world) {
|
||||
health = 0;
|
||||
Death();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
monster_snark::Death(void)
|
||||
{
|
||||
float dmg = Skill_GetValue("snark_dmg_pop", 5);
|
||||
Damage_Radius(origin, goalentity, dmg, dmg * 2.5f, TRUE, WEAPON_SNARK);
|
||||
FX_Blood(origin + [0,0,16], [203,183,15] / 255);
|
||||
Sound_Play(this, CHAN_VOICE, "weapon_snark.die");
|
||||
Sound_Play(this, CHAN_BODY, "weapon_snark.blast");
|
||||
customphysics = __NULL__;
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void
|
||||
monster_snark::Respawn(void)
|
||||
{
|
||||
netname = "Snark";
|
||||
SetModel("models/w_squeak.mdl");
|
||||
flags |= FL_MONSTER;
|
||||
SetSolid(SOLID_CORPSE);
|
||||
SetMovetype(MOVETYPE_WALK);
|
||||
SetSize([-8,-8,0], [8,8,8]);
|
||||
SetFrame(3); /* running like crazy. */
|
||||
angles = goalentity.angles;
|
||||
health = 20;
|
||||
takedamage = DAMAGE_YES;
|
||||
m_eTarget = __NULL__;
|
||||
m_flJump = 1.0f;
|
||||
owner = __NULL__;
|
||||
}
|
||||
|
||||
void
|
||||
monster_snark::monster_snark(void)
|
||||
{
|
||||
Respawn();
|
||||
}
|
||||
#endif
|
||||
|
||||
int w_snark_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
int addAmmo = (startammo == -1) ? 5 : startammo;
|
||||
|
||||
if (pl.ammo_snark < MAX_A_SNARK) {
|
||||
pl.ammo_snark = bound(0, pl.ammo_snark + addAmmo, MAX_A_SNARK);
|
||||
} else {
|
||||
if (!new)
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void w_snark_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_squeak.mdl");
|
||||
Weapons_ViewAnimation(pl, SNARK_DRAW);
|
||||
}
|
||||
|
||||
void w_snark_holster(player pl)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
void w_snark_deploy(entity snark_owner)
|
||||
{
|
||||
monster_snark snark = spawn(monster_snark, real_owner: snark_owner, goalentity: snark_owner, spawnflags: MSF_MULTIPLAYER);
|
||||
makevectors(snark_owner.v_angle);
|
||||
snark.Respawn();
|
||||
snark.SetOrigin(snark_owner.origin + v_forward * 32);
|
||||
}
|
||||
#endif
|
||||
|
||||
void w_snark_primary(player pl)
|
||||
{
|
||||
if (pl.WaterLevel() >= WATERLEVEL_SUBMERGED)
|
||||
return;
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.ammo_snark <= 0)
|
||||
return;
|
||||
|
||||
pl.ammo_snark--;
|
||||
|
||||
/* Audio-Visual Bit */
|
||||
Weapons_ViewAnimation(pl, SNARK_THROW);
|
||||
|
||||
if (pl.IsCrouching())
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTSQUEAK, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTSQUEAK, 0.5f);
|
||||
|
||||
#ifdef SERVER
|
||||
w_snark_deploy(pl);
|
||||
|
||||
if (pl.ammo_snark <= 0) {
|
||||
Weapons_RemoveItem(pl, WEAPON_SNARK);
|
||||
}
|
||||
#endif
|
||||
|
||||
pl.w_idle_next = 1.0f;
|
||||
pl.w_attack_next = 0.25f;
|
||||
|
||||
}
|
||||
|
||||
void w_snark_secondary(player pl)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void w_snark_reload(player pl)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void w_snark_release(player pl)
|
||||
{
|
||||
int r;
|
||||
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
r = floor(pseudorandom() * 3.0f);
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, SNARK_IDLE);
|
||||
pl.w_idle_next = 1.875f;
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, SNARK_FIDGET1);
|
||||
pl.w_idle_next = 4.375f;
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, SNARK_FIDGET2);
|
||||
pl.w_idle_next = 5.0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void w_snark_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_snark.deploy");
|
||||
Sound_Precache("weapon_snark.die");
|
||||
Sound_Precache("weapon_snark.blast");
|
||||
Sound_Precache("weapon_snark.hunt");
|
||||
precache_model("models/w_sqknest.mdl");
|
||||
precache_model("models/w_squeak.mdl");
|
||||
#else
|
||||
precache_model("models/p_squeak.mdl");
|
||||
precache_model("models/v_squeak.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_snark_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_snark, -1);
|
||||
}
|
||||
|
||||
string w_snark_wmodel(void)
|
||||
{
|
||||
return "models/w_sqknest.mdl";
|
||||
}
|
||||
|
||||
string w_snark_pmodel(player pl)
|
||||
{
|
||||
return "models/p_squeak.mdl";
|
||||
}
|
||||
|
||||
string w_snark_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
float w_snark_aimanim(player pl)
|
||||
{
|
||||
return pl.IsCrouching() ? ANIM_CR_AIMSQUEAK : ANIM_AIMSQUEAK;
|
||||
}
|
||||
|
||||
void w_snark_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
HUD_DrawAmmo2();
|
||||
vector aicon_pos = g_hudmins + [g_hudres[0] - 48, g_hudres[1] - 42];
|
||||
drawsubpic(aicon_pos, [24,24], g_hud7_spr, [96/256,96/128], [24/256, 24/128], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_snark_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
if (selected) {
|
||||
drawsubpic(pos, [170,45], g_hud6_spr,
|
||||
[0,135/256], [170/256,45/256],
|
||||
g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], g_hud3_spr,
|
||||
[0,135/256], [170/256,45/256],
|
||||
g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_snark, MAX_A_SNARK, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_snark_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.ammo_snark <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
weapontype_t
|
||||
w_snark_type(player pl)
|
||||
{
|
||||
return WPNTYPE_RANGED;
|
||||
}
|
||||
|
||||
weapon_t w_snark =
|
||||
{
|
||||
.name = "snark",
|
||||
.id = ITEM_SNARK,
|
||||
.slot = 4,
|
||||
.slot_pos = 3,
|
||||
.weight = 5,
|
||||
.draw = w_snark_draw,
|
||||
.holster = w_snark_holster,
|
||||
.primary = w_snark_primary,
|
||||
.secondary = w_snark_secondary,
|
||||
.reload = w_snark_reload,
|
||||
.release = w_snark_release,
|
||||
.postdraw = w_snark_hud,
|
||||
.precache = w_snark_precache,
|
||||
.pickup = w_snark_pickup,
|
||||
.updateammo = w_snark_updateammo,
|
||||
.wmodel = w_snark_wmodel,
|
||||
.pmodel = w_snark_pmodel,
|
||||
.deathmsg = w_snark_deathmsg,
|
||||
.aimanim = w_snark_aimanim,
|
||||
.isempty = w_snark_isempty,
|
||||
.type = w_snark_type,
|
||||
.hudpic = w_snark_hudpic
|
||||
};
|
|
@ -1,34 +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_t w_null = {};
|
||||
weapon_t g_weapons[] = {
|
||||
w_null,
|
||||
w_crowbar,
|
||||
w_glock,
|
||||
w_python,
|
||||
w_mp5,
|
||||
w_shotgun,
|
||||
w_crossbow,
|
||||
w_rpg,
|
||||
w_gauss,
|
||||
w_egon,
|
||||
w_hornetgun,
|
||||
w_handgrenade,
|
||||
w_satchel,
|
||||
w_tripmine,
|
||||
w_snark
|
||||
};
|
Binary file not shown.
Binary file not shown.
|
@ -40,23 +40,23 @@ set cg_viewmodelScale
|
|||
|
||||
set chatplug_filter
|
||||
|
||||
set cl_backspeed
|
||||
set cl_decals
|
||||
set cl_forwardspeed
|
||||
set cl_musicstyle
|
||||
set cl_sidespeed
|
||||
set cl_backspeed "400" // Client's desired backwards speed.
|
||||
set cl_decals "128"
|
||||
set cl_forwardspeed "400" // Client's desired forward speed.
|
||||
set cl_musicstyle "0"
|
||||
set cl_sidespeed "400" // Client's desired side-step speed.
|
||||
|
||||
set con_color
|
||||
set con_color "255 150 0"
// HUD color value, R G B, 0-255 for each channel.
|
||||
|
||||
set dev_cornerspeed
|
||||
set dev_loddistance
|
||||
set dev_rotspeed
|
||||
set dev_skyscale
|
||||
|
||||
set dsp_soundscapes "1"
|
||||
set dsp_soundscapes "1" // Enable the use of sound scapes.
|
||||
|
||||
set g_developer "0" // Show debug messages from the game-logic.
|
||||
set g_developerTimestamps "0"
|
||||
set g_logLevel "2" // Game console log levels. 0 = None, 1 = Errors, 2 = Warnings, 3 = Extra Messages
|
||||
set g_logTimestamps "0" // When 1, will print time stamps before the log message
|
||||
set g_gravity "800" // Global gravity setting.
|
||||
|
||||
set in_zoomSensitivity "1.0" // Input sensitivity multiplier for when you're zoomed in.
|
||||
|
@ -119,13 +119,13 @@ set pm_waterjumpheight "350"
|
|||
|
||||
set r_autoscale "1" // When set, will ensure the game is at 640x480 type scaling.
|
||||
set r_drawdecals "1" // Shows decal entities managed by the game when set.
|
||||
set r_pixelscale "1" // ???
|
||||
set r_renderEntityInfo "0"
|
||||
set r_showDlights "0"
|
||||
set r_showPhysicsInfo "0"
|
||||
set r_skipGlows "0"
|
||||
set r_skipLensFlares "0"
|
||||
set r_skipWorld "0"
|
||||
set r_pixelscale "0" // When set, will ensure the 3D rendered scene is restricted to 640x480 resolution in definition.
|
||||
set r_renderEntityInfo "0" // Display visual information about entities in-world.
|
||||
set r_showDlights "0" // Displays dynamic light representations in-world.
|
||||
set r_showPhysicsInfo "0" // Displays physics entity information in-world.
|
||||
set r_skipGlows "0" // Skip rendering of glowing sprites.
|
||||
set r_skipLensFlares "0" // Skip rendering of lens flares.
|
||||
set r_skipWorld "0" // Skip rendering of the world.
|
||||
|
||||
set rm_unlit_additive "1" // Render entities with the 'additive' rendermode fullbright.
|
||||
set rm_unlit_texture "1" // Render entities with the 'texture' rendermode fullbright.
|
||||
|
@ -136,7 +136,7 @@ set rope_maxsegments "-1" // Limit rope segments. -1 means no limit.
|
|||
set rope_sag "2" // Rope sagging multiplier.
|
||||
set rope_swing "2" // Rope swinging multiplier.
|
||||
|
||||
set s_developer "0" // Show debug prints related to the sound system.
|
||||
set s_logLevel "2" // Sound console log levels. 0 = None, 1 = Errors, 2 = Warnings, 3 = Extra Messages
|
||||
|
||||
set sp_decals "128"
|
||||
|
||||
|
@ -153,8 +153,8 @@ set vid_gamma "1" // Controls gamma level.
|
|||
set vid_desktopgamma "0"
|
||||
set vid_hardwaregamma "2"
|
||||
|
||||
set violence_ablood "1" // Enable alien blood.
|
||||
set violence_agibs "1" // Enable alien gibs.
|
||||
set violence_ablood "1" // Enable non-human (alternative) blood.
|
||||
set violence_agibs "1" // Enable non-human (alternative) gibs.
|
||||
set violence_hblood "1" // Enable human blood.
|
||||
set violence_hgibs "1" // Enable human giblets.
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
entityDef monster_scientist
|
||||
{
|
||||
"spawnclass" "NSTalkMonster"
|
||||
"spawnclass" "HLScientist"
|
||||
"model" "models/scientist.mdl"
|
||||
"netname" "Scientist"
|
||||
"health" "skill:scientist_health"
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
entityDef info_player_start
|
||||
{
|
||||
"spawnclass" "NSSpawnPoint"
|
||||
"editor_mins" "-16 -16 -36"
|
||||
"editor_maxs" "16 16 36"
|
||||
"editor_description" "Singleplayer Spawn Point"
|
||||
"editor_color" "1 0 0"
|
||||
"spawnclass" "NSSpawnPoint"
|
||||
}
|
||||
|
||||
entityDef info_player_deathmatch
|
||||
{
|
||||
"spawnclass" "NSSpawnPoint"
|
||||
"editor_mins" "-16 -16 -36"
|
||||
"editor_maxs" "16 16 36"
|
||||
"editor_description" "Deathmatch Spawn Point"
|
||||
"editor_color" "1 0 0"
|
||||
"spawnclass" "NSSpawnPoint"
|
||||
}
|
||||
|
||||
entityDef info_player_coop
|
||||
{
|
||||
"spawnclass" "NSSpawnPoint"
|
||||
"editor_mins" "-16 -16 -36"
|
||||
"editor_maxs" "16 16 36"
|
||||
"editor_description" "Cooperative Spawn Point"
|
||||
"editor_color" "1 0 0"
|
||||
"spawnclass" "NSSpawnPoint"
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ bind F2 "vote no"
|
|||
bind LEFTARROW "+left"
|
||||
bind MOUSE1 "+attack"
|
||||
bind MOUSE2 "+attack2"
|
||||
bind MWHEELDOWN "invnext"
|
||||
bind MWHEELUP "invprev"
|
||||
bind MWHEELDOWN "weapnext"
|
||||
bind MWHEELUP "weapprev"
|
||||
bind RIGHTARROW "+right"
|
||||
bind SHIFT "+speed"
|
||||
bind SPACE "+jump"
|
||||
|
@ -35,16 +35,7 @@ bind t "impulse 201"
|
|||
bind u "messagemode2"
|
||||
bind w "+forward"
|
||||
bind y "messagemode"
|
||||
bind q "weaplast"
|
||||
bind ~ "toggleconsole"
|
||||
seta cg_muzzleDLight "0"
|
||||
seta con_color "255 150 0"
|
||||
seta cross_color "0 255 0"
|
||||
seta gl_ldr "1
"
|
||||
seta gl_overbright "0
"
|
||||
seta hostname "FreeHL Server"
|
||||
seta maxplayers "8"
|
||||
seta r_lightmap_format "rgb8
"
|
||||
seta rate "30000"
|
||||
seta vgui_color "255 170 0"
|
||||
|
||||
exec cvar_defaults.cfg
|
|
@ -5,8 +5,8 @@ bind SPACE "+gostand"
|
|||
bind CTRL "+duck"
|
||||
bind MOUSE1 "+attack"
|
||||
bind MOUSE2 "+attack2"
|
||||
bind MWHEELDOWN "invnext"
|
||||
bind MWHEELUP "invprev"
|
||||
bind MWHEELDOWN "weapnext"
|
||||
bind MWHEELUP "weapprev"
|
||||
bind SHIFT "+sprint"
|
||||
bind F1 "toggle r_speeds 0 2"
|
||||
bind F2 "toggle show_fps 0 2"
|
||||
|
@ -41,7 +41,7 @@ bind z "toggle sv_gamespeed 0.5 1"
|
|||
seta brightness "0"
|
||||
seta cl_chatmode "2"
|
||||
seta con_stayhidden "0"
|
||||
seta con_textfont "fonts/Share-TechMono.otf?col=1,1,1"
|
||||
seta con_textfont "fonts/IBMPlexMono-Text.otf?col=1,1,1"
|
||||
seta con_textsize "14"
|
||||
seta con_timestamps "0"
|
||||
seta contrast "1"
|
||||
|
|
BIN
zpak001.pk3dir/fonts/IBMPlexMono-Text.otf
Normal file
BIN
zpak001.pk3dir/fonts/IBMPlexMono-Text.otf
Normal file
Binary file not shown.
|
@ -1,93 +1,92 @@
|
|||
Copyright © 2017 IBM Corp. with Reserved Font Name "Plex"
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
|
||||
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
Copyright © 2017 IBM Corp. with Reserved Font Name "Plex"
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
@ -1,93 +0,0 @@
|
|||
Copyright 2016 The Saira Project Authors (omnibus.type@gmail.com), with reserved font name "Saira".
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
https://openfontlicense.org
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
@ -1,81 +0,0 @@
|
|||
Roboto Condensed Variable Font
|
||||
==============================
|
||||
|
||||
This download contains Roboto Condensed as both variable fonts and static fonts.
|
||||
|
||||
Roboto Condensed is a variable font with this axis:
|
||||
wght
|
||||
|
||||
This means all the styles are contained in these files:
|
||||
RobotoCondensed-VariableFont_wght.ttf
|
||||
RobotoCondensed-Italic-VariableFont_wght.ttf
|
||||
|
||||
If your app fully supports variable fonts, you can now pick intermediate styles
|
||||
that aren’t available as static fonts. Not all apps support variable fonts, and
|
||||
in those cases you can use the static font files for Roboto Condensed:
|
||||
static/RobotoCondensed-Thin.ttf
|
||||
static/RobotoCondensed-ExtraLight.ttf
|
||||
static/RobotoCondensed-Light.ttf
|
||||
static/RobotoCondensed-Regular.ttf
|
||||
static/RobotoCondensed-Medium.ttf
|
||||
static/RobotoCondensed-SemiBold.ttf
|
||||
static/RobotoCondensed-Bold.ttf
|
||||
static/RobotoCondensed-ExtraBold.ttf
|
||||
static/RobotoCondensed-Black.ttf
|
||||
static/RobotoCondensed-ThinItalic.ttf
|
||||
static/RobotoCondensed-ExtraLightItalic.ttf
|
||||
static/RobotoCondensed-LightItalic.ttf
|
||||
static/RobotoCondensed-Italic.ttf
|
||||
static/RobotoCondensed-MediumItalic.ttf
|
||||
static/RobotoCondensed-SemiBoldItalic.ttf
|
||||
static/RobotoCondensed-BoldItalic.ttf
|
||||
static/RobotoCondensed-ExtraBoldItalic.ttf
|
||||
static/RobotoCondensed-BlackItalic.ttf
|
||||
|
||||
Get started
|
||||
-----------
|
||||
|
||||
1. Install the font files you want to use
|
||||
|
||||
2. Use your app's font picker to view the font family and all the
|
||||
available styles
|
||||
|
||||
Learn more about variable fonts
|
||||
-------------------------------
|
||||
|
||||
https://developers.google.com/web/fundamentals/design-and-ux/typography/variable-fonts
|
||||
https://variablefonts.typenetwork.com
|
||||
https://medium.com/variable-fonts
|
||||
|
||||
In desktop apps
|
||||
|
||||
https://theblog.adobe.com/can-variable-fonts-illustrator-cc
|
||||
https://helpx.adobe.com/nz/photoshop/using/fonts.html#variable_fonts
|
||||
|
||||
Online
|
||||
|
||||
https://developers.google.com/fonts/docs/getting_started
|
||||
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Fonts/Variable_Fonts_Guide
|
||||
https://developer.microsoft.com/en-us/microsoft-edge/testdrive/demos/variable-fonts
|
||||
|
||||
Installing fonts
|
||||
|
||||
MacOS: https://support.apple.com/en-us/HT201749
|
||||
Linux: https://www.google.com/search?q=how+to+install+a+font+on+gnu%2Blinux
|
||||
Windows: https://support.microsoft.com/en-us/help/314960/how-to-install-or-remove-a-font-in-windows
|
||||
|
||||
Android Apps
|
||||
|
||||
https://developers.google.com/fonts/docs/android
|
||||
https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts
|
||||
|
||||
License
|
||||
-------
|
||||
Please read the full license text (OFL.txt) to understand the permissions,
|
||||
restrictions and requirements for usage, redistribution, and modification.
|
||||
|
||||
You can use them in your products & projects – print or digital,
|
||||
commercial or otherwise.
|
||||
|
||||
This isn't legal advice, please consider consulting a lawyer and see the full
|
||||
license for all details.
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue