Rebase against Nuclide Develop, convert most things over
This commit is contained in:
parent
9893e8bc3e
commit
1550f8cbe1
132 changed files with 2957 additions and 10055 deletions
|
@ -1,4 +1,4 @@
|
|||
# FreeCS
|
||||
# Tactical Retreat (FreeCS)
|
||||
[As seen on phoronix.com](https://phoronix.com/scan.php?page=news_item&px=FreeCS-Open-Counter-Strike)
|
||||
|
||||
Clean-room reimplementation of Counter-Strike 1.5 (mod-version).
|
||||
|
|
14
manifest.fmf
14
manifest.fmf
|
@ -1,14 +0,0 @@
|
|||
FTEMANIFEST 1
|
||||
GAME cstrike
|
||||
NAME "Counter-Strike"
|
||||
BASEGAME platform
|
||||
BASEGAME valve
|
||||
BASEGAME cstrike
|
||||
|
||||
// you don't really want to change these
|
||||
RTCBROKER master.frag-net.com:27950
|
||||
PROTOCOLNAME "Nuclide"
|
||||
MAINCONFIG game.cfg
|
||||
DOWNLOADSURL "http://www.frag-net.com/dl/packages"
|
||||
|
||||
-exec platform_default.cfg
|
26
radiant.game
Normal file
26
radiant.game
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<game
|
||||
type="hl"
|
||||
name="Counter-Strike"
|
||||
enginepath_linux="/usr/local/games/halflife/"
|
||||
enginepath_win32="c:/sierra/half-life/"
|
||||
engine_win32="hl.exe"
|
||||
engine_linux="hl_linux"
|
||||
basegame="cstrike"
|
||||
basegamename="Counter-Strike"
|
||||
unknowngamename="Custom Counter-Strike modification"
|
||||
default_scale="1.0"
|
||||
no_patch="1"
|
||||
no_bsp_monitor="1"
|
||||
show_wads="1"
|
||||
archivetypes="pak wad"
|
||||
texturetypes="tga jpg mip hlw"
|
||||
modeltypes="mdl"
|
||||
maptypes="mapq1"
|
||||
shaders="quake3"
|
||||
entityclass="quake3"
|
||||
entityclasstype="def xml"
|
||||
entities="quake3"
|
||||
brushtypes="quake"
|
||||
patchtypes="quake3"
|
||||
/>
|
76
radiant.xml
Normal file
76
radiant.xml
Normal file
|
@ -0,0 +1,76 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
to avoid naming conflicts, the tools are assumed to be named 'hlcsg', 'hlbsp', 'hlvis' and 'hlrad' in your path
|
||||
-->
|
||||
<project version="2.0">
|
||||
<var name="csg">"hlcsg"</var>
|
||||
<var name="bsp">"hlbsp"</var>
|
||||
<var name="vis">"hlvis"</var>
|
||||
<var name="light">"hlrad"</var>
|
||||
|
||||
<var name="qbsp">qbsp -hlbsp -basedir "[EnginePath]" -gamedir "[GameName]" -path "[UserEnginePath]"</var>
|
||||
<var name="qvis">qvis -basedir "[EnginePath]" -gamedir "[GameName]" -path "[UserEnginePath]"</var>
|
||||
<var name="qlight">qlight -basedir "[EnginePath]" -gamedir "[GameName]" -path "[UserEnginePath]"</var>
|
||||
|
||||
<build name="extra fidelity">
|
||||
<command>[csg] "[MapFile]"</command>
|
||||
<command>[bsp] "[MapFile]"</command>
|
||||
<command>[vis] -full "[MapFile]"</command>
|
||||
<command>[light] -extra "[MapFile]"</command>
|
||||
</build>
|
||||
<build name="standard fidelity">
|
||||
<command>[csg] "[MapFile]"</command>
|
||||
<command>[bsp] "[MapFile]"</command>
|
||||
<command>[vis] "[MapFile]"</command>
|
||||
<command>[light] "[MapFile]"</command>
|
||||
</build>
|
||||
<build name="quick compile">
|
||||
<command>[csg] "[MapFile]"</command>
|
||||
<command>[bsp] "[MapFile]"</command>
|
||||
<command>[vis] -fast "[MapFile]"</command>
|
||||
<command>[light] -fast "[MapFile]"</command>
|
||||
</build>
|
||||
<build name="fast vis only">
|
||||
<command>[csg] "[MapFile]"</command>
|
||||
<command>[bsp] "[MapFile]"</command>
|
||||
<command>[vis] -fast "[MapFile]"</command>
|
||||
</build>
|
||||
<build name="no vis, no lighting">
|
||||
<command>[csg] "[MapFile]"</command>
|
||||
<command>[bsp] "[MapFile]"</command>
|
||||
</build>
|
||||
<build name="only entities">
|
||||
<command>[csg] -onlyents "[MapFile]"</command>
|
||||
<command>[bsp]"[MapFile]"</command>
|
||||
</build>
|
||||
|
||||
<!--
|
||||
in case you want to use free-software tools
|
||||
-->
|
||||
<build name="tyrutils extra fidelity">
|
||||
<command>[qbsp] "[MapFile]"</command>
|
||||
<command>[qvis] "[MapFile]"</command>
|
||||
<command>[qlight] -extra "[MapFile]"</command>
|
||||
</build>
|
||||
<build name="tyrutils standard fidelity">
|
||||
<command>[qbsp] "[MapFile]"</command>
|
||||
<command>[qvis] "[MapFile]"</command>
|
||||
<command>[qlight] "[MapFile]"</command>
|
||||
</build>
|
||||
<build name="tyrutils quick compile">
|
||||
<command>[qbsp] "[MapFile]"</command>
|
||||
<command>[qvis] -fast "[MapFile]"</command>
|
||||
<command>[qlight] -fast "[MapFile]"</command>
|
||||
</build>
|
||||
<build name="tyrutils fast vis only">
|
||||
<command>[qbsp] "[MapFile]"</command>
|
||||
<command>[qvis] -fast "[MapFile]"</command>
|
||||
</build>
|
||||
<build name="tyrutils no vis, no lighting">
|
||||
<command>[qbsp] "[MapFile]"</command>
|
||||
</build>
|
||||
<build name="tyrutils only entities">
|
||||
<command>[qbsp] -onlyents "[MapFile]"</command>
|
||||
</build>
|
||||
</project>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
CC=fteqcc
|
||||
QCC=fteqcc
|
||||
|
||||
all:
|
||||
$(CC) progs.src
|
||||
$(QCC) progs.src
|
||||
|
|
|
@ -33,7 +33,7 @@ CMD_ChooseTeam(void)
|
|||
void
|
||||
CMD_BuyMenu(void)
|
||||
{
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
CSPlayer pl = (CSPlayer)pSeat->m_ePlayer;
|
||||
|
||||
/* only in buy zones... */
|
||||
if (!(pl.gflags & GF_BUYZONE)) {
|
||||
|
|
|
@ -27,19 +27,18 @@ var bool autocvar_cl_crosshair_additive = true;
|
|||
#define CS_CROSS_THICKNESS autocvar_cl_crosshair_thickness
|
||||
|
||||
void
|
||||
Cstrike_DrawCrosshair(void)
|
||||
Cstrike_DrawCrosshair(CSPlayer pl)
|
||||
{
|
||||
player pl = (player)self;
|
||||
int cross_dist;
|
||||
int line_length;
|
||||
|
||||
/* these are defined in the weapon-code files */
|
||||
float distance = pl.cs_cross_mindist;
|
||||
float delta = pl.cs_cross_deltadist;
|
||||
float distance = (float)pl.cs_cross_mindist;
|
||||
float delta = (float)pl.cs_cross_deltadist;
|
||||
|
||||
if (!(pl.flags & FL_ONGROUND)) {
|
||||
distance = distance * 2.0f;
|
||||
} else if (pl.flags & FL_CROUCHING) { /* crouching... */
|
||||
} else if (pl.IsCrouching()) { /* crouching... */
|
||||
distance = distance * 0.5f;
|
||||
} else if (vlen(pl.velocity) > 120) { /* running, not walking */
|
||||
distance = distance * 1.5f;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "hud.h"
|
||||
#include "radio.h"
|
||||
#include "../../../valve/src/client/obituary.h"
|
||||
#include "../../../valve/src/client/hud_sprite.h"
|
||||
|
||||
var int autocvar_cl_autoweaponswitch = TRUE;
|
||||
|
||||
|
@ -87,7 +88,6 @@ void HUD_DrawAmmo3(void);
|
|||
void HUD_WeaponPickupNotify(int);
|
||||
void HUD_DrawAmmoBar(vector pos, float val, float max, float a);
|
||||
|
||||
void Cstrike_DrawCrosshair(void);
|
||||
void Cstrike_DrawSimpleCrosshair(void);
|
||||
void Cstrike_DrawScope(void);
|
||||
void Textmenu_Call(string);
|
||||
|
|
|
@ -21,6 +21,12 @@ ClientGame_EntityUpdate(float id, float new)
|
|||
case ENT_C4BOMB:
|
||||
w_c4bomb_parse();
|
||||
break;
|
||||
case ENT_PLAYER:
|
||||
NSENTITY_READENTITY(CSPlayer, new)
|
||||
break;
|
||||
case ENT_WEAPON:
|
||||
NSENTITY_READENTITY(CSWeapon, new)
|
||||
break;
|
||||
default:
|
||||
return (0);
|
||||
}
|
||||
|
|
|
@ -284,7 +284,7 @@ void
|
|||
HUD_DrawHealth(void)
|
||||
{
|
||||
vector pos;
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
CSPlayer pl = (CSPlayer)pSeat->m_ePlayer;
|
||||
|
||||
if (pl.health != pSeatLocal->m_iHealthOld) {
|
||||
pSeatLocal->m_flHealthAlpha = 1.0;
|
||||
|
@ -331,7 +331,7 @@ void
|
|||
HUD_DrawArmor(void)
|
||||
{
|
||||
vector pos;
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
CSPlayer pl = (CSPlayer)pSeat->m_ePlayer;
|
||||
|
||||
pos = g_hudmins + [198, g_hudres[1] - 42];
|
||||
|
||||
|
@ -405,7 +405,7 @@ HUD_DrawArmor(void)
|
|||
void
|
||||
HUD_DrawAmmo1(void)
|
||||
{
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
CSPlayer pl = (CSPlayer)pSeat->m_ePlayer;
|
||||
vector pos;
|
||||
|
||||
if (pl.a_ammo1 != pSeatLocal->m_iAmmo1Old) {
|
||||
|
@ -428,7 +428,7 @@ HUD_DrawAmmo1(void)
|
|||
void
|
||||
HUD_DrawAmmo2(void)
|
||||
{
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
CSPlayer pl = (CSPlayer)pSeat->m_ePlayer;
|
||||
vector pos;
|
||||
|
||||
if (pl.a_ammo2 != pSeatLocal->m_iAmmo2Old) {
|
||||
|
@ -450,7 +450,7 @@ HUD_DrawAmmo2(void)
|
|||
void
|
||||
HUD_DrawAmmo3(void)
|
||||
{
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
CSPlayer pl = (CSPlayer)pSeat->m_ePlayer;
|
||||
vector pos;
|
||||
|
||||
if (pl.a_ammo3 != pSeatLocal->m_iAmmo3Old) {
|
||||
|
@ -486,7 +486,7 @@ void
|
|||
HUD_DrawFlashlight(void)
|
||||
{
|
||||
vector pos;
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
CSPlayer pl = (CSPlayer)pSeat->m_ePlayer;
|
||||
pos = g_hudmins + [g_hudres[0] - 48, 16];
|
||||
|
||||
/* both on, draw both sprites at full intensity */
|
||||
|
@ -531,7 +531,7 @@ HUD_DrawZones(void)
|
|||
{
|
||||
int zc = 0;
|
||||
vector pos = [0,0,0];
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
CSPlayer pl = (CSPlayer)pSeat->m_ePlayer;
|
||||
|
||||
if (pl.gflags & GF_BUYZONE) {
|
||||
zc++;
|
||||
|
@ -652,7 +652,7 @@ HUD_DrawProgress(void)
|
|||
void
|
||||
HUD_DrawNotify(void)
|
||||
{
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
CSPlayer pl = (CSPlayer)pSeat->m_ePlayer;
|
||||
vector pos;
|
||||
float a;
|
||||
|
||||
|
@ -666,7 +666,7 @@ HUD_DrawNotify(void)
|
|||
}
|
||||
|
||||
a = bound(0.0, pSeatLocal->m_flPickupAlpha, 1.0);
|
||||
Weapons_HUDPic(pl, pSeatLocal->m_iPickupWeapon, 1, pos, a);
|
||||
//Weapons_HUDPic(pl, pSeatLocal->m_iPickupWeapon, 1, pos, a);
|
||||
pos[0] += 148;
|
||||
pos[1] -= 32;
|
||||
HUD_AmmoNotify_Draw(pos);
|
||||
|
@ -720,12 +720,14 @@ HUD_PlayerNames(void)
|
|||
void
|
||||
HUD_Draw(void)
|
||||
{
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
CSPlayer pl = (CSPlayer)pSeat->m_ePlayer;
|
||||
|
||||
g_hud_color = autocvar_con_color * (1 / 255);
|
||||
|
||||
/* little point in not drawing these, even if you don't have a suit */
|
||||
Weapons_DrawCrosshair(pl);
|
||||
if (pl.m_activeWeapon)
|
||||
pl.m_activeWeapon.UpdateGUI();
|
||||
|
||||
HUD_DrawWeaponSelect();
|
||||
Obituary_Draw();
|
||||
|
||||
|
@ -734,7 +736,7 @@ HUD_Draw(void)
|
|||
HUD_DrawMoney();
|
||||
HUD_DrawTimer(0);
|
||||
|
||||
if (!(pl.g_items & ITEM_SUIT)) {
|
||||
if (pl.HasItem("item_suit") == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -761,7 +763,7 @@ HUD_DrawSpectator(void)
|
|||
g_specHUD = spawn(CSSpectateHUD);
|
||||
|
||||
g_specHUD.SetPos(video_mins);
|
||||
g_specHUD.SetSize(video_res);
|
||||
g_specHUD.SetSize(g_vidsize);
|
||||
g_specHUD.Draw();
|
||||
|
||||
}
|
||||
|
|
|
@ -83,8 +83,9 @@ HUD_AmmoNotify_Insert(int type, int count)
|
|||
|
||||
/* called whenever we should check for pickup updates */
|
||||
void
|
||||
HUD_AmmoNotify_Check(player pl)
|
||||
HUD_AmmoNotify_Check(CSPlayer pl)
|
||||
{
|
||||
#if 0
|
||||
HUD_AmmoNotify_Insert(0, pl.ammo_50ae - pl.ammo_50ae_net);
|
||||
HUD_AmmoNotify_Insert(1, pl.ammo_762mm - pl.ammo_762mm_net);
|
||||
HUD_AmmoNotify_Insert(2, pl.ammo_556mm - pl.ammo_556mm_net);
|
||||
|
@ -98,4 +99,5 @@ HUD_AmmoNotify_Check(player pl)
|
|||
HUD_AmmoNotify_Insert(10, pl.ammo_hegrenade - pl.ammo_hegrenade_net);
|
||||
HUD_AmmoNotify_Insert(11, pl.ammo_fbgrenade - pl.ammo_fbgrenade_net);
|
||||
HUD_AmmoNotify_Insert(12, pl.ammo_smokegrenade - pl.ammo_smokegrenade_net);
|
||||
#endif
|
||||
}
|
|
@ -14,7 +14,7 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
void View_ForceChange(player pl, int targetWeapon);
|
||||
void View_ForceChange(CSPlayer pl, int targetWeapon);
|
||||
|
||||
vector g_vecHUDNums[6] =
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ vector g_vecHUDNums[6] =
|
|||
void
|
||||
HUD_DrawWeaponSelect_Forward(void)
|
||||
{
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
CSPlayer pl = (CSPlayer)pSeat->m_ePlayer;
|
||||
|
||||
if (!pl.activeweapon) {
|
||||
return;
|
||||
|
@ -57,7 +57,7 @@ HUD_DrawWeaponSelect_Forward(void)
|
|||
void
|
||||
HUD_DrawWeaponSelect_Back(void)
|
||||
{
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
CSPlayer pl = (CSPlayer)pSeat->m_ePlayer;
|
||||
|
||||
if (!pl.activeweapon) {
|
||||
return;
|
||||
|
@ -85,7 +85,7 @@ HUD_DrawWeaponSelect_Back(void)
|
|||
void
|
||||
HUD_DrawWeaponSelect_Trigger(void)
|
||||
{
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
CSPlayer pl = (CSPlayer)pSeat->m_ePlayer;
|
||||
|
||||
if (pl.activeweapon != pSeat->m_iHUDWeaponSelected)
|
||||
View_ForceChange(pl, pSeat->m_iHUDWeaponSelected);
|
||||
|
@ -98,7 +98,7 @@ HUD_DrawWeaponSelect_Trigger(void)
|
|||
void
|
||||
HUD_DrawWeaponSelect_Last(void)
|
||||
{
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
CSPlayer pl = (CSPlayer)pSeat->m_ePlayer;
|
||||
if (pl.g_items & g_weapons[pSeat->m_iOldWeapon].id) {
|
||||
pl.activeweapon = pSeat->m_iOldWeapon;
|
||||
sendevent("PlayerSwitchWeapon", "i", pSeat->m_iOldWeapon);
|
||||
|
@ -114,7 +114,7 @@ HUD_DrawWeaponSelect_Num(vector vecPos, int val)
|
|||
int
|
||||
HUD_InSlotPos(int slot, int pos)
|
||||
{
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
CSPlayer pl = (CSPlayer)pSeat->m_ePlayer;
|
||||
for (int i = 1; i < g_weapons.length; i++) {
|
||||
if (g_weapons[i].slot == slot && g_weapons[i].slot_pos == pos) {
|
||||
if (pl.g_items & g_weapons[i].id) {
|
||||
|
@ -130,7 +130,7 @@ HUD_InSlotPos(int slot, int pos)
|
|||
void
|
||||
HUD_SlotSelect(int slot)
|
||||
{
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
CSPlayer pl = (CSPlayer)pSeat->m_ePlayer;
|
||||
int curslot = g_weapons[pSeat->m_iHUDWeaponSelected].slot;
|
||||
int i;
|
||||
|
||||
|
@ -184,7 +184,7 @@ HUD_SlotSelect(int slot)
|
|||
void
|
||||
HUD_DrawWeaponSelect(void)
|
||||
{
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
CSPlayer pl = (CSPlayer)pSeat->m_ePlayer;
|
||||
if (!pl.activeweapon) {
|
||||
return;
|
||||
}
|
||||
|
@ -211,13 +211,13 @@ HUD_DrawWeaponSelect(void)
|
|||
slot_selected = TRUE;
|
||||
if (x == wantpos) {
|
||||
// Selected Sprite
|
||||
Weapons_HUDPic(pl, pSeat->m_iHUDWeaponSelected, 1, vecPos, 1.0f);
|
||||
//Weapons_HUDPic(pl, pSeat->m_iHUDWeaponSelected, 1, vecPos, 1.0f);
|
||||
drawsubpic(vecPos, [170,45], g_hud3_spr,
|
||||
[0,180/256], [170/256,45/256], g_hud_color, 1, DRAWFLAG_ADDITIVE);
|
||||
vecPos[1] += 50;
|
||||
} else if ((b=HUD_InSlotPos(i, x)) != -1) {
|
||||
// Unselected Sprite
|
||||
Weapons_HUDPic(pl, b, 0, vecPos, 1.0f);
|
||||
//Weapons_HUDPic(pl, b, 0, vecPos, 1.0f);
|
||||
vecPos[1] += 50;
|
||||
}
|
||||
} else if (HUD_InSlotPos(i, x) != -1) {
|
||||
|
|
|
@ -115,6 +115,9 @@ ClientGame_Init(float apilevel, string enginename, float engineversion)
|
|||
bool
|
||||
ClientGame_IsUsingVGUI(void)
|
||||
{
|
||||
#if defined(CZERO) || defined(CSSOURCE)
|
||||
return true;
|
||||
#else
|
||||
/* FTE has a bug with _ infokeys, so we'll accept both formats in case
|
||||
that gets fixed in the future :/ */
|
||||
if (getplayerkeyfloat(player_localnum, "vgui_menus") == 1)
|
||||
|
@ -123,6 +126,7 @@ ClientGame_IsUsingVGUI(void)
|
|||
return true;
|
||||
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void VGUI_ShowMOTD(void);
|
||||
|
|
|
@ -17,12 +17,14 @@
|
|||
void
|
||||
Nightvision_Toggle(void)
|
||||
{
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
CSPlayer pl = (CSPlayer)pSeat->m_ePlayer;
|
||||
|
||||
#if 0
|
||||
if (!(pl.g_items & ITEM_NIGHTVISION)) {
|
||||
pSeatLocal->m_iNightvision = 0;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
pSeatLocal->m_iNightvision = 1 - pSeatLocal->m_iNightvision;
|
||||
|
||||
|
@ -35,15 +37,17 @@ Nightvision_Toggle(void)
|
|||
void
|
||||
Nightvision_PreFrame(void)
|
||||
{
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
CSPlayer pl = (CSPlayer)pSeat->m_ePlayer;
|
||||
|
||||
if (!pSeatLocal->m_iNightvision)
|
||||
return;
|
||||
|
||||
#if 0
|
||||
if (!(pl.g_items & ITEM_NIGHTVISION)) {
|
||||
pSeatLocal->m_iNightvision = 0;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
dynamiclight_add(pSeat->m_vecPredictedOrigin, 768, [1,1,1]);
|
||||
}
|
||||
|
@ -51,15 +55,17 @@ Nightvision_PreFrame(void)
|
|||
void
|
||||
Nightvision_PostFrame(void)
|
||||
{
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
CSPlayer pl = (CSPlayer)pSeat->m_ePlayer;
|
||||
|
||||
if (!pSeatLocal->m_iNightvision)
|
||||
return;
|
||||
|
||||
#if 0
|
||||
if (!(pl.g_items & ITEM_NIGHTVISION)) {
|
||||
pSeatLocal->m_iNightvision = 0;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
drawpic(video_mins, "fade_modulate", g_hudres, [0,1,0], 1.0f, 0);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma target fte_5768
|
||||
//#pragma flag enable assumeint
|
||||
#pragma progs_dat "../../csprogs.dat"
|
||||
#pragma progs_dat "../../zpak001.pk3dir/csprogs.dat"
|
||||
|
||||
#define CSQC
|
||||
#define CLIENT
|
||||
|
@ -36,8 +36,8 @@ crosshair.qc
|
|||
hud_ammonotify.qc
|
||||
vgui_spectator.qc
|
||||
hud.qc
|
||||
hud_weaponselect.qc
|
||||
../../../valve/src/client/hud_sprite.qc
|
||||
../../../valve/src/client/hud_weaponselect.qc
|
||||
../../../valve/src/client/scoreboard.qc
|
||||
radio.qc
|
||||
|
||||
|
|
|
@ -17,69 +17,27 @@
|
|||
#define CSRADAR_DISTANCE 1024
|
||||
|
||||
var string g_cs_radar;
|
||||
var NSRadar g_csRadar;
|
||||
|
||||
void
|
||||
Radar_Init(void)
|
||||
{
|
||||
g_cs_radar = spriteframe("sprites/radar640.spr", 0, 0.0f);
|
||||
|
||||
g_csRadar = NSRadar::InitEmpty();
|
||||
}
|
||||
|
||||
void
|
||||
Radar_Draw(void)
|
||||
{
|
||||
vector radpos = g_hudmins + [16,16];
|
||||
vector radpos = g_view.GetHUDCanvasPos() + [16,16];
|
||||
|
||||
drawpic(radpos, g_cs_radar, [128,128], [1,1,1], 0.25f, DRAWFLAG_ADDITIVE);
|
||||
|
||||
for (entity a = world; (a = find(a, ::classname, "player"));) {
|
||||
vector color;
|
||||
vector own_pos = pSeat->m_vecPredictedOrigin;
|
||||
vector difference = (a.origin - own_pos);
|
||||
/* these need constant adjustment for when the display changes */
|
||||
g_csRadar.SetViewPosition(radpos);
|
||||
g_csRadar.SetViewSize([128,128]);
|
||||
g_csRadar.UpdateView();
|
||||
|
||||
/* don't draw when we're exceeding the view radius */
|
||||
if (vlen(difference) > CSRADAR_DISTANCE)
|
||||
continue;
|
||||
|
||||
/* this is perhaps a bit too aggressive, so fix this and uncomment */
|
||||
#if 0
|
||||
/* test if we can actually see the player */
|
||||
traceline(a.origin, own_pos + pSeat->m_ePlayer.view_ofs, MOVE_NORMAL, pSeat->m_ePlayer);
|
||||
if (trace_ent != a) {
|
||||
traceline(a.origin + [0,0,a.maxs[2]], own_pos + pSeat->m_ePlayer.view_ofs, MOVE_OTHERONLY, pSeat->m_ePlayer);
|
||||
if (trace_ent != a) {
|
||||
traceline(a.origin + [0,0,a.mins[2]], own_pos + pSeat->m_ePlayer.view_ofs, MOVE_OTHERONLY, pSeat->m_ePlayer);
|
||||
if (trace_ent != a) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
vector matrix;
|
||||
float ht;
|
||||
makevectors([0,view_angles[1] - 90, 0]);
|
||||
matrix[0] = dotproduct(difference, v_forward);
|
||||
matrix[1] = dotproduct(difference, v_right);
|
||||
matrix[2] = 0;
|
||||
|
||||
/* we need to fit 1024 in-game units into the 64px radar image */
|
||||
vector apos = radpos + [62,62] + (matrix * (64/CSRADAR_DISTANCE));
|
||||
|
||||
if (getplayerkeyfloat(a.entnum-1, "*team") == TEAM_CT)
|
||||
color = [115, 155, 205] / 255;
|
||||
else
|
||||
color = [190, 52, 57] / 255;
|
||||
|
||||
drawfill(apos, [4,4], color, 1.0f, DRAWFLAG_NORMAL);
|
||||
|
||||
/* do the line indicating the height of the player relative to us */
|
||||
ht = fabs(difference[2] * (64 / CSRADAR_DISTANCE));
|
||||
|
||||
if (difference[2] > 0)
|
||||
drawfill(apos + [1,0], [2,ht], color, 1.0f, DRAWFLAG_NORMAL);
|
||||
else if (difference[2] < 0)
|
||||
drawfill(apos + [1,-ht], [2,ht], color, 1.0f, DRAWFLAG_NORMAL);
|
||||
|
||||
//drawpic(apos, "fade_modulate", [4,4], color, 1.0f, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,8 +85,8 @@ CT_SELECT(int n)
|
|||
void
|
||||
BUY(int n)
|
||||
{
|
||||
player pl;
|
||||
pl = (player)pSeat->m_ePlayer;
|
||||
CSPlayer pl;
|
||||
pl = (CSPlayer)pSeat->m_ePlayer;
|
||||
int inteam = getplayerkeyfloat(pl.entnum-1, "*team");
|
||||
|
||||
switch (n) {
|
||||
|
|
|
@ -220,5 +220,5 @@ VGUI_BuyMenu(void)
|
|||
}
|
||||
|
||||
winBuyMenu.Show();
|
||||
winBuyMenu.SetPos((video_res / 2) - (winBuyMenu.GetSize() / 2));
|
||||
winBuyMenu.SetPos((g_vidsize / 2) - (winBuyMenu.GetSize() / 2));
|
||||
}
|
||||
|
|
|
@ -30,6 +30,10 @@ typedef enum
|
|||
BUYITEM_FIVESEVEN,
|
||||
BUYITEM_M3,
|
||||
BUYITEM_XM1014,
|
||||
#if defined(CZERO) || defined(CSSOURCE)
|
||||
BUYITEM_FAMAS,
|
||||
BUYITEM_GALIL,
|
||||
#endif
|
||||
BUYITEM_AK47,
|
||||
BUYITEM_SG552,
|
||||
BUYITEM_M4A1,
|
||||
|
@ -62,7 +66,7 @@ typedef struct
|
|||
string titleName; /* the name of the titles.txt entry */
|
||||
} buyItems_t;
|
||||
|
||||
const buyItems_t g_buyItemList [29] = {
|
||||
const buyItems_t g_buyItemList [] = {
|
||||
{ "BuyWeapon", WEAPON_USP45, "classes/usp.txt", "gfx/vgui/640_usp", "USP45" },
|
||||
{ "BuyWeapon", WEAPON_GLOCK18, "classes/glock18.txt", "gfx/vgui/640_glock18", "Glock18" },
|
||||
{ "BuyWeapon", WEAPON_DEAGLE, "classes/deagle.txt", "gfx/vgui/640_deagle", "DesertEagle" },
|
||||
|
@ -71,6 +75,10 @@ const buyItems_t g_buyItemList [29] = {
|
|||
{ "BuyWeapon", WEAPON_FIVESEVEN, "classes/fiveseven.txt", "gfx/vgui/640_fiveseven", "FiveSeven" },
|
||||
{ "BuyWeapon", WEAPON_M3, "classes/m3.txt", "gfx/vgui/640_m3", "Super90" },
|
||||
{ "BuyWeapon", WEAPON_XM1014, "classes/xm1014.txt", "gfx/vgui/640_xm1014", "XM1014" },
|
||||
#if defined(CZERO) || defined(CSSOURCE)
|
||||
{ "BuyWeapon", WEAPON_FAMAS, "classes/famas.txt", "gfx/vgui/640_famas", "Famas" },
|
||||
{ "BuyWeapon", WEAPON_GALIL, "classes/galil.txt", "gfx/vgui/640_galil", "Galil" },
|
||||
#endif
|
||||
{ "BuyWeapon", WEAPON_AK47, "classes/ak47.txt", "gfx/vgui/640_ak47", "AK47" },
|
||||
{ "BuyWeapon", WEAPON_SG552, "classes/sg552.txt", "gfx/vgui/640_sg552", "SG552" },
|
||||
{ "BuyWeapon", WEAPON_M4A1, "classes/m4a1.txt", "gfx/vgui/640_m4a1", "M4A1" },
|
||||
|
@ -156,7 +164,7 @@ VGUI_BuyMenu_Page(int buyPage)
|
|||
static CSBuyItemButton btnBuyItem8;
|
||||
static CSBuyItemButton btnBuyItem9;
|
||||
|
||||
player pl = (player)pSeat->m_ePlayer;
|
||||
CSPlayer pl = (CSPlayer)pSeat->m_ePlayer;
|
||||
|
||||
int inTeam = getplayerkeyfloat(pl.entnum-1, "*team");
|
||||
|
||||
|
@ -284,7 +292,7 @@ VGUI_BuyMenu_Page(int buyPage)
|
|||
imgBuyItemPic.SetImage("");
|
||||
|
||||
winBuyMenuPage.Show();
|
||||
winBuyMenuPage.SetPos((video_res / 2) - (winBuyMenuPage.GetSize() / 2));
|
||||
winBuyMenuPage.SetPos((g_vidsize / 2) - (winBuyMenuPage.GetSize() / 2));
|
||||
|
||||
switch (buyPage) {
|
||||
case BUYPAGE_PISTOLS:
|
||||
|
@ -386,6 +394,18 @@ VGUI_BuyMenu_Page(int buyPage)
|
|||
btnBuyItem8.Show();
|
||||
btnBuyItem9.Hide();
|
||||
|
||||
#if defined(CZERO) || defined(CSSOURCE)
|
||||
if (inTeam == TEAM_CT) {
|
||||
btnBuyItem9.SetTitle(Titles_GetTextBody("Famas"));
|
||||
btnBuyItem9.SetTag(BUYITEM_FAMAS);
|
||||
btnBuyItem9.Show();
|
||||
} else {
|
||||
btnBuyItem9.SetTitle(Titles_GetTextBody("Galil"));
|
||||
btnBuyItem9.SetTag(BUYITEM_GALIL);
|
||||
btnBuyItem9.Show();
|
||||
}
|
||||
#endif
|
||||
|
||||
btnBuyItem1.SetTitle(Titles_GetTextBody("AK47"));
|
||||
btnBuyItem1.SetTag(BUYITEM_AK47);
|
||||
btnBuyItem2.SetTitle(Titles_GetTextBody("Krieg552"));
|
||||
|
|
|
@ -192,5 +192,5 @@ VGUI_ChooseClassCT(void)
|
|||
}
|
||||
|
||||
winClassSelectionCT.Show();
|
||||
winClassSelectionCT.SetPos((video_res / 2) - (winClassSelectionCT.GetSize() / 2));
|
||||
winClassSelectionCT.SetPos((g_vidsize / 2) - (winClassSelectionCT.GetSize() / 2));
|
||||
}
|
|
@ -193,5 +193,5 @@ VGUI_ChooseClassT(void)
|
|||
}
|
||||
|
||||
winClassSelection.Show();
|
||||
winClassSelection.SetPos((video_res / 2) - (winClassSelection.GetSize() / 2));
|
||||
winClassSelection.SetPos((g_vidsize / 2) - (winClassSelection.GetSize() / 2));
|
||||
}
|
|
@ -163,5 +163,5 @@ VGUI_ChooseTeam(void)
|
|||
}
|
||||
|
||||
winChooseTeam.Show();
|
||||
winChooseTeam.SetPos((video_res / 2) - (winChooseTeam.GetSize() / 2));
|
||||
winChooseTeam.SetPos((g_vidsize / 2) - (winChooseTeam.GetSize() / 2));
|
||||
}
|
||||
|
|
|
@ -68,5 +68,5 @@ VGUI_ShowMOTD(void)
|
|||
}
|
||||
|
||||
winMotd.Show();
|
||||
winMotd.SetPos((video_res / 2) - (winMotd.GetSize() / 2));
|
||||
winMotd.SetPos((g_vidsize / 2) - (winMotd.GetSize() / 2));
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
CC=fteqcc
|
||||
QCC=fteqcc
|
||||
|
||||
all:
|
||||
$(CC) progs.src
|
||||
$(QCC) progs.src
|
||||
|
|
|
@ -108,11 +108,12 @@ ammoinfo_t cs_ammoinfo[11] = {
|
|||
};
|
||||
|
||||
int
|
||||
Ammo_BuyCaliber(player pl, int cal, int free)
|
||||
Ammo_BuyCaliber(CSPlayer pl, int cal, int free)
|
||||
{
|
||||
int *ptr_ammo = __NULL__;
|
||||
int rv = 0;
|
||||
|
||||
#if 0
|
||||
while (pl.money - cs_ammoinfo[cal].price > 0 || free) {
|
||||
switch (cal) {
|
||||
case CALIBER_50AE:
|
||||
|
@ -166,6 +167,7 @@ Ammo_BuyCaliber(player pl, int cal, int free)
|
|||
rv = 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -173,9 +175,10 @@ Ammo_BuyCaliber(player pl, int cal, int free)
|
|||
void
|
||||
Ammo_BuySecondary(NSClientPlayer pp, int free)
|
||||
{
|
||||
#if 0
|
||||
int cal = 0;
|
||||
int ps = 0;
|
||||
player pl = (player)pp;
|
||||
CSPlayer pl = (CSPlayer)pp;
|
||||
|
||||
for (int i = 1; i < g_weapons.length; i++) {
|
||||
if ((pl.g_items & g_weapons[i].id) && (g_weapons[i].slot == 1)) {
|
||||
|
@ -210,6 +213,7 @@ Ammo_BuySecondary(NSClientPlayer pp, int free)
|
|||
Sound_Play(pl, CHAN_ITEM, "buy.ammo");
|
||||
}
|
||||
Weapons_RefreshAmmo(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* We want to loop through all the possible weapons in case the server
|
||||
|
@ -217,7 +221,7 @@ Ammo_BuySecondary(NSClientPlayer pp, int free)
|
|||
void
|
||||
CSEv_AmmoBuySecondary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
CSPlayer pl = (CSPlayer)self;
|
||||
|
||||
CSGameRules rules = (CSGameRules)g_grMode;
|
||||
if (rules.BuyingPossible(pl) == FALSE) {
|
||||
|
@ -230,9 +234,10 @@ CSEv_AmmoBuySecondary(void)
|
|||
void
|
||||
Ammo_BuyPrimary(NSClientPlayer pp, int free)
|
||||
{
|
||||
#if 0
|
||||
int ps = 0;
|
||||
int cal = 0;
|
||||
player pl = (player)pp;
|
||||
CSPlayer pl = (CSPlayer)pp;
|
||||
|
||||
for (int i = 1; i < g_weapons.length; i++) {
|
||||
if ((pl.g_items & g_weapons[i].id) && (g_weapons[i].slot == 0)) {
|
||||
|
@ -258,6 +263,14 @@ Ammo_BuyPrimary(NSClientPlayer pp, int free)
|
|||
case WEAPON_TMP:
|
||||
cal = CALIBER_9MM;
|
||||
break;
|
||||
#if defined(CZERO) || defined(CSSOURCE)
|
||||
case WEAPON_GALIL:
|
||||
cal = CALIBER_762MM;
|
||||
break;
|
||||
case WEAPON_FAMAS:
|
||||
cal = CALIBER_762MM;
|
||||
break;
|
||||
#endif
|
||||
case WEAPON_AK47:
|
||||
cal = CALIBER_762MM;
|
||||
break;
|
||||
|
@ -298,12 +311,13 @@ Ammo_BuyPrimary(NSClientPlayer pp, int free)
|
|||
}
|
||||
|
||||
Weapons_RefreshAmmo(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
CSEv_AmmoBuyPrimary(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
CSPlayer pl = (CSPlayer)self;
|
||||
|
||||
CSGameRules rules = (CSGameRules)g_grMode;
|
||||
if (rules.BuyingPossible(pl) == FALSE) {
|
||||
|
@ -316,7 +330,7 @@ CSEv_AmmoBuyPrimary(void)
|
|||
void
|
||||
Ammo_AutoFill(NSClientPlayer pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
CSPlayer pl = (CSPlayer)pp;
|
||||
|
||||
if (autocvar_fcs_fillweapons == FALSE) {
|
||||
return;
|
||||
|
|
|
@ -53,26 +53,26 @@ List of available items:
|
|||
|
||||
var int autocvar_fcs_nopickups = FALSE;
|
||||
|
||||
int g_cstrike_armouryitems[19] = {
|
||||
WEAPON_MP5,
|
||||
WEAPON_TMP,
|
||||
WEAPON_P90,
|
||||
WEAPON_MAC10,
|
||||
WEAPON_AK47,
|
||||
WEAPON_SG552,
|
||||
WEAPON_M4A1,
|
||||
WEAPON_AUG,
|
||||
WEAPON_SCOUT,
|
||||
WEAPON_G3SG1,
|
||||
WEAPON_AWP,
|
||||
WEAPON_M3,
|
||||
WEAPON_XM1014,
|
||||
WEAPON_PARA,
|
||||
WEAPON_FLASHBANG,
|
||||
WEAPON_HEGRENADE,
|
||||
0,/*EQUIPMENT_KEVLAR,*/
|
||||
0,/*EQUIPMENT_HELMET,*/
|
||||
WEAPON_SMOKEGRENADE
|
||||
string g_cstrike_armouryitems[19] = {
|
||||
"weapon_mp5navy",
|
||||
"weapon_tmp",
|
||||
"weapon_p90",
|
||||
"weapon_max10",
|
||||
"weapon_ak47",
|
||||
"weapon_sg552",
|
||||
"weapon_m4a1",
|
||||
"weapon_aug",
|
||||
"weapon_scout",
|
||||
"weapon_g3sg1",
|
||||
"weapon_awp",
|
||||
"weapon_m3",
|
||||
"weapon_xm1014",
|
||||
"weapon_m249",
|
||||
"weapon_flashbang",
|
||||
"weapon_hegrenade",
|
||||
"equipment_kevlar",
|
||||
"equipment_helmet",
|
||||
"weapon_smokegrenade"
|
||||
};
|
||||
|
||||
string g_cstrike_armourymodels[19] = {
|
||||
|
@ -165,12 +165,12 @@ armoury_entity::Restore(string strKey, string strValue)
|
|||
void
|
||||
armoury_entity::Touch(entity eToucher)
|
||||
{
|
||||
player pl;
|
||||
CSPlayer pl;
|
||||
if (eToucher.classname != "player") {
|
||||
return;
|
||||
}
|
||||
|
||||
pl = (player)eToucher;
|
||||
pl = (CSPlayer)eToucher;
|
||||
|
||||
/* armor is separate from weapons */
|
||||
if (m_iID == 17 || m_iID == 16) {
|
||||
|
@ -194,7 +194,7 @@ armoury_entity::Touch(entity eToucher)
|
|||
|
||||
sound(pl, CHAN_ITEM, "items/tr_kevlar.wav", 1, ATTN_NORM);
|
||||
} else { /* weapon pickup code */
|
||||
if (Weapons_AddItem(pl, g_cstrike_armouryitems[m_iID], -1) == FALSE)
|
||||
if (pl.GiveItem(g_cstrike_armouryitems[m_iID]) == FALSE)
|
||||
return;
|
||||
|
||||
sound(pl, CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_NORM);
|
||||
|
@ -211,7 +211,7 @@ armoury_entity::Touch(entity eToucher)
|
|||
void
|
||||
armoury_entity::Respawn(void)
|
||||
{
|
||||
SetOrigin(GetSpawnOrigin());
|
||||
super::Respawn();
|
||||
SetSolid(SOLID_TRIGGER);
|
||||
SetModel(g_cstrike_armourymodels[m_iID]);
|
||||
SetSize([-16,-16,0], [16,16,16]);
|
||||
|
|
|
@ -159,31 +159,8 @@ void csbot::Roam(vector roamOrigin, int maxDistance) {
|
|||
randLoc.x += sin(radian) * distance;
|
||||
randLoc.y += cos(radian) * distance;
|
||||
|
||||
/* Find closest waypoint to our random location. */
|
||||
float flBestDist = COST_INFINITE;
|
||||
int iBestNodeIndex = -1;
|
||||
for (int i = 0; i < g_iNodes; i++) {
|
||||
float fDist = vlen(g_pNodes[i].origin - randLoc) - g_pNodes[i].radius;
|
||||
|
||||
if (fDist > (float)maxDistance) {
|
||||
/* Distance is greater then our maxDistance */
|
||||
continue;
|
||||
}
|
||||
|
||||
if (fDist < flBestDist) {
|
||||
flBestDist = fDist;
|
||||
iBestNodeIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (iBestNodeIndex == -1) {
|
||||
/* TODO No waypoint in range found */
|
||||
print("WARNING!: Roaming failed, could not find waypoint in range.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Go to the random waypoint. */
|
||||
RouteToPosition(g_pNodes[iBestNodeIndex].origin);
|
||||
RouteToPosition(Nodes_PositionOfClosestNode(randLoc));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -236,7 +213,7 @@ csbot::CreateObjective(void)
|
|||
} else {
|
||||
/* Aim at the bomb. */
|
||||
input_buttons |= INPUT_BUTTON8; // duck
|
||||
if ((flags & FL_ONUSABLE)) {
|
||||
if ((HasVFlags(VFL_ONUSABLE))) {
|
||||
// Aimed at the bomb, ready to defuse!
|
||||
ChatSayTeam("Defusing!");
|
||||
input_buttons |= INPUT_BUTTON5;
|
||||
|
@ -262,13 +239,14 @@ csbot::CreateObjective(void)
|
|||
else {
|
||||
if (team == TEAM_T) {
|
||||
/* T-bot: plant bomb */
|
||||
if ((g_items & ITEM_C4BOMB)) {
|
||||
if (HasItem("weapon_c4")) {
|
||||
/* We carry the bomb */
|
||||
if (m_gflagsBackup & GF_BOMBZONE) {
|
||||
/* We are at a bombsite and ready to plant the bomb */
|
||||
if (activeweapon != WEAPON_C4BOMB) {
|
||||
/* TODO: REPLACE THIS WITH NSNAVAI METHOD */
|
||||
activeweapon = WEAPON_C4BOMB;
|
||||
Weapons_Draw((player)self);
|
||||
//Weapons_Draw((CSPlayer)self);
|
||||
}
|
||||
|
||||
if (!m_actionIsPlanting) {
|
||||
|
@ -346,27 +324,17 @@ void csbot::AimLerp(vector aimpos, float flLerp) {
|
|||
vector oldAngle = v_angle;
|
||||
|
||||
/* that's the old angle */
|
||||
makevectors(v_angle);
|
||||
vecNewAngles = v_forward;
|
||||
vecNewAngles = anglesToForward(v_angle);
|
||||
|
||||
/* aimdir = new final angle */
|
||||
aimdir = vectoangles(aimpos - origin);
|
||||
makevectors(aimdir);
|
||||
aimdir = vectorToAngles(aimpos - origin);
|
||||
|
||||
/* slowly lerp towards the final angle */
|
||||
vecNewAngles[0] = Math_Lerp(vecNewAngles[0], v_forward[0], flLerp);
|
||||
vecNewAngles[1] = Math_Lerp(vecNewAngles[1], v_forward[1], flLerp);
|
||||
vecNewAngles[2] = Math_Lerp(vecNewAngles[2], v_forward[2], flLerp);
|
||||
vecNewAngles = vectorLerp(vecNewAngles, anglesToForward(aimdir), flLerp);
|
||||
|
||||
/* make sure we're aiming tight */
|
||||
v_angle = vectoangles(vecNewAngles);
|
||||
v_angle[0] = Math_FixDelta(v_angle[0]);
|
||||
v_angle[1] = Math_FixDelta(v_angle[1]);
|
||||
v_angle[2] = Math_FixDelta(v_angle[2]);
|
||||
angles[0] = Math_FixDelta(v_angle[0]);
|
||||
angles[1] = Math_FixDelta(v_angle[1]);
|
||||
angles[2] = Math_FixDelta(v_angle[2]);
|
||||
input_angles = v_angle;
|
||||
v_angle = vectorToAngles(vecNewAngles);
|
||||
input_angles = angles = v_angle = fixAngle(v_angle);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -386,6 +354,7 @@ csbot::WeaponThink(void)
|
|||
if (activeweapon == WEAPON_KNIFE)
|
||||
return;
|
||||
|
||||
#if FIXME
|
||||
/* clip empty */
|
||||
if (a_ammo1 == 0) {
|
||||
/* still got ammo left, reload! */
|
||||
|
@ -396,6 +365,7 @@ csbot::WeaponThink(void)
|
|||
Weapons_SwitchBest(this);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
/** @brief Get entity by class name and index **/
|
||||
|
@ -491,7 +461,7 @@ CSBot_BuyStart_Shop(void)
|
|||
{
|
||||
int done = 0;
|
||||
int count = 0;
|
||||
player pl = (player)self;
|
||||
CSPlayer pl = (CSPlayer)self;
|
||||
|
||||
pl.team = infokeyf(pl, "*team");
|
||||
|
||||
|
@ -546,6 +516,7 @@ CSBot_BuyStart_Shop(void)
|
|||
CSEv_BuyEquipment_f(1);
|
||||
}
|
||||
|
||||
#if FIXME
|
||||
/* make SURE we switch to it */
|
||||
for (int i = 0; i < g_weapons.length; i++)
|
||||
if (pl.g_items & g_weapons[i].id) {
|
||||
|
@ -553,6 +524,7 @@ CSBot_BuyStart_Shop(void)
|
|||
Weapons_Draw(pl);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* force buy right now */
|
||||
CSEv_AmmoBuyPrimary();
|
||||
|
|
|
@ -17,10 +17,11 @@
|
|||
void
|
||||
CSEv_BuyWeapon_f(float fWeapon)
|
||||
{
|
||||
#if 0
|
||||
CSGameRules rules = (CSGameRules)g_grMode;
|
||||
|
||||
int iWeapon;
|
||||
player pl = (player)self;
|
||||
CSPlayer pl = (CSPlayer)self;
|
||||
iWeapon = (int)fWeapon;
|
||||
|
||||
if (rules.BuyingPossible(pl) == FALSE) {
|
||||
|
@ -77,15 +78,17 @@ CSEv_BuyWeapon_f(float fWeapon)
|
|||
} else {
|
||||
//centerprint(pl, "You have insufficient funds!");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
CSEv_BuyEquipment_f(float fUtil)
|
||||
{
|
||||
#if 0
|
||||
CSGameRules rules = (CSGameRules)g_grMode;
|
||||
|
||||
int iUtil;
|
||||
player pl = (player)self;
|
||||
CSPlayer pl = (CSPlayer)self;
|
||||
iUtil = (int)fUtil;
|
||||
|
||||
if (rules.BuyingPossible(pl) == FALSE) {
|
||||
|
@ -162,10 +165,10 @@ CSEv_BuyEquipment_f(float fUtil)
|
|||
Sound_Play(pl, CHAN_ITEM, "buy.weapon");
|
||||
break;
|
||||
case 6:
|
||||
if (pl.g_items & ITEM_NIGHTVISION)
|
||||
if (pl.m_bHasNightvision == true)
|
||||
return;
|
||||
|
||||
pl.g_items |= ITEM_NIGHTVISION;
|
||||
pl.m_bHasNightvision = true;
|
||||
Sound_Play(pl, CHAN_ITEM, "buy.weapon");
|
||||
break;
|
||||
}
|
||||
|
@ -173,4 +176,5 @@ CSEv_BuyEquipment_f(float fUtil)
|
|||
} else {
|
||||
centerprint(pl, "You have insufficient funds!");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ func_bomb_target::Respawn(void)
|
|||
void
|
||||
func_bomb_target::Touch(entity eToucher)
|
||||
{
|
||||
player pl = (player)eToucher;
|
||||
CSPlayer pl = (CSPlayer)eToucher;
|
||||
|
||||
if (!(eToucher.flags & FL_CLIENT)) {
|
||||
return;
|
||||
|
|
|
@ -76,7 +76,7 @@ func_buyzone::SpawnKey(string strKey, string strValue)
|
|||
void
|
||||
func_buyzone::Touch(entity eToucher)
|
||||
{
|
||||
player pl = (player)eToucher;
|
||||
CSPlayer pl = (CSPlayer)eToucher;
|
||||
|
||||
if (!(eToucher.flags & FL_CLIENT))
|
||||
return;
|
||||
|
|
|
@ -61,7 +61,7 @@ func_escapezone::Touch(entity eToucher)
|
|||
if (to_escape > 3)
|
||||
to_escape = 3;
|
||||
|
||||
player pl = (player)eToucher;
|
||||
CSPlayer pl = (CSPlayer)eToucher;
|
||||
|
||||
/* don't matter when rules are not active */
|
||||
if (g_cs_gamestate != GAME_ACTIVE)
|
||||
|
@ -78,7 +78,7 @@ func_escapezone::Touch(entity eToucher)
|
|||
/* balancing tweak: for every escaped T, each and every CT will lose funds */
|
||||
if (autocvar_fcs_escapepenalty != 0) {
|
||||
for (entity eFind = world; (eFind = find(eFind, ::classname, "player"));) {
|
||||
player ct = (player)eFind;
|
||||
CSPlayer ct = (CSPlayer)eFind;
|
||||
|
||||
if (ct.team == TEAM_CT) {
|
||||
Money_AddMoney(ct, autocvar_fcs_escapepenalty);
|
||||
|
|
|
@ -52,7 +52,7 @@ void
|
|||
func_hostage_rescue::Touch(entity eToucher)
|
||||
{
|
||||
if (eToucher.flags & FL_CLIENT) {
|
||||
player pl = (player)eToucher;
|
||||
CSPlayer pl = (CSPlayer)eToucher;
|
||||
pl.gflags |= GF_RESCUEZONE;
|
||||
return;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ func_hostage_rescue::Touch(entity eToucher)
|
|||
return;
|
||||
}
|
||||
|
||||
hostage_entity hosty = (hostage_entity)eToucher;
|
||||
CSHostage hosty = (CSHostage)eToucher;
|
||||
|
||||
if (hosty.GetSolid() == SOLID_NOT) {
|
||||
return;
|
||||
|
@ -73,7 +73,7 @@ func_hostage_rescue::Touch(entity eToucher)
|
|||
Radio_BroadcastMessage(RADIO_RESCUED);
|
||||
g_cs_hostagesrescued++;
|
||||
|
||||
Money_AddMoney((player)hosty.m_eFollowing, 1000);
|
||||
Money_AddMoney((CSPlayer)hosty.m_eFollowing, 1000);
|
||||
CSBot_HostageRescueNotify();
|
||||
|
||||
/* In Hostage Rescue, all Counter-Terrorists receive an $850
|
||||
|
|
|
@ -52,7 +52,7 @@ func_vip_safetyzone::Touch(entity eToucher)
|
|||
{
|
||||
CSMultiplayerRules rule = (CSMultiplayerRules)g_grMode;
|
||||
|
||||
player pl = (player)eToucher;
|
||||
CSPlayer pl = (CSPlayer)eToucher;
|
||||
|
||||
if (pl.classname != "player")
|
||||
return;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
void
|
||||
Money_AddMoney(NSClientPlayer pp, int iMoneyValue)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
CSPlayer pl = (CSPlayer)pp;
|
||||
dprint(sprintf("^2Money_AddMoney^7: giving %s $%i\n", pl.netname, iMoneyValue));
|
||||
pl.money += (float)iMoneyValue;
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
class CSGameRules:CGameRules
|
||||
{
|
||||
virtual void PlayerKill(NSClientPlayer);
|
||||
virtual void PlayerPreFrame(NSClientPlayer);
|
||||
virtual void PlayerDeath(NSClientPlayer);
|
||||
virtual void PlayerPain(NSClientPlayer);
|
||||
|
|
|
@ -49,7 +49,7 @@ CSGameRules::PlayerPreFrame(NSClientPlayer pp)
|
|||
void
|
||||
CSGameRules::LevelDecodeParms(NSClientPlayer pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
CSPlayer pl = (CSPlayer)pp;
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
|
@ -62,45 +62,9 @@ CSGameRules::LevelDecodeParms(NSClientPlayer pp)
|
|||
pl.g_items = parm10;
|
||||
pl.activeweapon = parm11;
|
||||
pl.flags = parm64;
|
||||
|
||||
pl.ammo_50ae = parm12;
|
||||
pl.ammo_762mm = parm13;
|
||||
pl.ammo_556mm = parm14;
|
||||
pl.ammo_556mmbox = parm15;
|
||||
pl.ammo_338mag = parm16;
|
||||
pl.ammo_9mm = parm17;
|
||||
pl.ammo_buckshot = parm18;
|
||||
pl.ammo_45acp = parm19;
|
||||
pl.ammo_357sig = parm20;
|
||||
pl.ammo_57mm = parm21;
|
||||
pl.ammo_hegrenade = parm22;
|
||||
pl.ammo_fbgrenade = parm23;
|
||||
pl.ammo_smokegrenade = parm24;
|
||||
pl.usp45_mag = parm25;
|
||||
pl.glock18_mag = parm26;
|
||||
pl.deagle_mag = parm27;
|
||||
pl.p228_mag = parm28;
|
||||
pl.elites_mag = parm29;
|
||||
pl.fiveseven_mag = parm30;
|
||||
pl.m3_mag = parm31;
|
||||
pl.xm1014_mag = parm32;
|
||||
pl.mp5_mag = parm33;
|
||||
pl.p90_mag = parm34;
|
||||
pl.ump45_mag = parm35;
|
||||
pl.mac10_mag = parm36;
|
||||
pl.tmp_mag = parm37;
|
||||
pl.ak47_mag = parm38;
|
||||
pl.sg552_mag = parm39;
|
||||
pl.m4a1_mag = parm40;
|
||||
pl.aug_mag = parm41;
|
||||
pl.scout_mag = parm42;
|
||||
pl.awp_mag = parm43;
|
||||
pl.g3sg1_mag = parm44;
|
||||
pl.sg550_mag = parm45;
|
||||
pl.para_mag = parm46;
|
||||
pl.gflags = parm63;
|
||||
|
||||
if (pl.flags & FL_CROUCHING) {
|
||||
if (pl.IsCrouching()) {
|
||||
setsize(pl, VEC_CHULL_MIN, VEC_CHULL_MAX);
|
||||
} else {
|
||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
|
@ -110,7 +74,7 @@ CSGameRules::LevelDecodeParms(NSClientPlayer pp)
|
|||
void
|
||||
CSGameRules::LevelChangeParms(NSClientPlayer pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
CSPlayer pl = (CSPlayer)pp;
|
||||
parm1 = g_landmarkpos[0];
|
||||
parm2 = g_landmarkpos[1];
|
||||
parm3 = g_landmarkpos[2];
|
||||
|
@ -124,42 +88,6 @@ CSGameRules::LevelChangeParms(NSClientPlayer pp)
|
|||
parm64 = pl.flags;
|
||||
parm10 = pl.g_items;
|
||||
parm11 = pl.activeweapon;
|
||||
|
||||
parm12 = pl.ammo_50ae;
|
||||
parm13 = pl.ammo_762mm;
|
||||
parm14 = pl.ammo_556mm;
|
||||
parm15 = pl.ammo_556mmbox;
|
||||
parm16 = pl.ammo_338mag;
|
||||
parm17 = pl.ammo_9mm;
|
||||
parm18 = pl.ammo_buckshot;
|
||||
parm19 = pl.ammo_45acp;
|
||||
parm20 = pl.ammo_357sig;
|
||||
parm21 = pl.ammo_57mm;
|
||||
parm22 = pl.ammo_hegrenade;
|
||||
parm23 = pl.ammo_fbgrenade;
|
||||
parm24 = pl.ammo_smokegrenade;
|
||||
parm25 = pl.usp45_mag;
|
||||
parm26 = pl.glock18_mag;
|
||||
parm27 = pl.deagle_mag;
|
||||
parm28 = pl.p228_mag;
|
||||
parm29 = pl.elites_mag;
|
||||
parm30 = pl.fiveseven_mag;
|
||||
parm31 = pl.m3_mag;
|
||||
parm32 = pl.xm1014_mag;
|
||||
parm33 = pl.mp5_mag;
|
||||
parm34 = pl.p90_mag;
|
||||
parm35 = pl.ump45_mag;
|
||||
parm36 = pl.mac10_mag;
|
||||
parm37 = pl.tmp_mag;
|
||||
parm38 = pl.ak47_mag;
|
||||
parm39 = pl.sg552_mag;
|
||||
parm40 = pl.m4a1_mag;
|
||||
parm41 = pl.aug_mag;
|
||||
parm42 = pl.scout_mag;
|
||||
parm43 = pl.awp_mag;
|
||||
parm44 = pl.g3sg1_mag;
|
||||
parm45 = pl.sg550_mag;
|
||||
parm46 = pl.para_mag;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -175,28 +103,10 @@ CSGameRules::LevelNewParms(void)
|
|||
parm64 = FL_CLIENT;
|
||||
}
|
||||
|
||||
void
|
||||
CSGameRules::PlayerKill(NSClientPlayer pl)
|
||||
{
|
||||
Damage_Apply(pl, pl, pl.health, WEAPON_NONE, DMG_SKIP_ARMOR);
|
||||
}
|
||||
|
||||
void
|
||||
TriggerFlashlight(NSClient target)
|
||||
{
|
||||
entity oldself = self;
|
||||
self = target;
|
||||
Flashlight_Toggle();
|
||||
self = oldself;
|
||||
}
|
||||
|
||||
bool
|
||||
CSGameRules::ImpulseCommand(NSClient bp, float num)
|
||||
{
|
||||
switch (num) {
|
||||
case 100:
|
||||
TriggerFlashlight(bp);
|
||||
break;
|
||||
default:
|
||||
return super::ImpulseCommand(bp, num);
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ CSDeathmatchRules::PlayerDeath(NSClientPlayer pl)
|
|||
/* explode all satchels */
|
||||
s_satchel_detonate((entity)pl);
|
||||
/* drop their posessions into a weaponbox item */
|
||||
weaponbox_spawn((player)pl);
|
||||
weaponbox_spawn((CSPlayer)pl);
|
||||
#endif
|
||||
|
||||
/* either gib, or make a corpse */
|
||||
|
@ -128,12 +128,12 @@ CSDeathmatchRules::PlayerDeath(NSClientPlayer pl)
|
|||
float gibStrength = g_dmg_iDamage * 2.0f;
|
||||
BreakModel_Entity(pl, gibDir, gibStrength);
|
||||
} else {
|
||||
FX_Corpse_Spawn((player)pl, ANIM_DEATH1);
|
||||
//FX_Corpse_Spawn((player)pl, ANIM_DIESIMPLE);
|
||||
FX_Corpse_Spawn((CSPlayer)pl, ANIM_DEATH1);
|
||||
//FX_Corpse_Spawn((CSPlayer)pl, ANIM_DIESIMPLE);
|
||||
}
|
||||
|
||||
/* now let's make the real client invisible */
|
||||
pl.Death();
|
||||
//pl.Death();
|
||||
pl.SetTakedamage(DAMAGE_NO);
|
||||
pl.gflags &= ~GF_FLASHLIGHT;
|
||||
|
||||
|
@ -149,7 +149,7 @@ CSDeathmatchRules::PlayerDeath(NSClientPlayer pl)
|
|||
void
|
||||
CSDeathmatchRules::PlayerSpawn(NSClientPlayer pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
CSPlayer pl = (CSPlayer)pp;
|
||||
/* this is where the mods want to deviate */
|
||||
entity spot;
|
||||
|
||||
|
@ -223,7 +223,7 @@ CSDeathmatchRules::PlayerSpawn(NSClientPlayer pp)
|
|||
pl.SetInfoKey("*dead", "0");
|
||||
pl.SetInfoKey("*deaths", ftos(pl.deaths));
|
||||
pl.SetPropData("actor_human");
|
||||
pl.SetCanBleed(true);
|
||||
pl.EnableBleeding();
|
||||
|
||||
LevelNewParms();
|
||||
LevelDecodeParms(pl);
|
||||
|
@ -232,9 +232,9 @@ CSDeathmatchRules::PlayerSpawn(NSClientPlayer pp)
|
|||
pl.activeweapon = WEAPON_KNIFE;
|
||||
|
||||
int randomGun = (int)rint(random(WEAPON_USP45, WEAPON_FIVESEVEN));
|
||||
Weapons_AddItem(pl, randomGun, -1);
|
||||
//Weapons_AddItem(pl, randomGun, -1);
|
||||
randomGun = (int)rint(random(WEAPON_M3, WEAPON_PARA));
|
||||
Weapons_AddItem(pl, randomGun, -1);
|
||||
//Weapons_AddItem(pl, randomGun, -1);
|
||||
pl.activeweapon = randomGun;
|
||||
|
||||
Ammo_BuyPrimary(pl, TRUE);
|
||||
|
@ -242,7 +242,6 @@ CSDeathmatchRules::PlayerSpawn(NSClientPlayer pp)
|
|||
|
||||
spot = Spawn_SelectRandom("info_player_deathmatch");
|
||||
pl.Transport(spot.origin, spot.angles);
|
||||
Weapons_RefreshAmmo(pl);
|
||||
Client_FixAngle(pl, pl.angles);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,14 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef CSSOURCE
|
||||
#define SPAWNPOINT_CT "info_player_counterterrorist"
|
||||
#define SPAWNPOINT_T "info_player_terrorist"
|
||||
#else
|
||||
#define SPAWNPOINT_CT "info_player_start"
|
||||
#define SPAWNPOINT_T "info_player_deathmatch"
|
||||
#endif
|
||||
|
||||
string
|
||||
CSMultiplayerRules::Title(void)
|
||||
{
|
||||
|
@ -42,12 +50,12 @@ CSMultiplayerRules::PlayerDisconnect(NSClientPlayer pl)
|
|||
void
|
||||
CSMultiplayerRules::PlayerDeath(NSClientPlayer pl)
|
||||
{
|
||||
player targ = (player)g_dmg_eTarget;
|
||||
player attk = (player)g_dmg_eAttacker;
|
||||
CSPlayer targ = (CSPlayer)g_dmg_eTarget;
|
||||
CSPlayer attk = (CSPlayer)g_dmg_eAttacker;
|
||||
NSRenderableEntity newCorpse;
|
||||
float deathAnimation = ANIM_DEATH1;
|
||||
|
||||
if (targ.flags & FL_CROUCHING) {
|
||||
if (targ.IsCrouching()) {
|
||||
deathAnimation = ANIM_CROUCH_DIE;
|
||||
} else {
|
||||
switch (g_dmg_iHitBody) {
|
||||
|
@ -128,21 +136,25 @@ CSMultiplayerRules::PlayerDeath(NSClientPlayer pl)
|
|||
targ.SetInfoKey("*icon1_b", "0");
|
||||
}
|
||||
|
||||
Weapon_DropCurrentWeapon(targ);
|
||||
/* TODO: implement this in NSNavAI */
|
||||
//targ.DropActiveWeapon();
|
||||
|
||||
///Weapon_DropCurrentWeapon(targ);
|
||||
|
||||
/* if we're the bomb carrier, make sure we drop the bomb. */
|
||||
if (targ.g_items & ITEM_C4BOMB) {
|
||||
targ.activeweapon = WEAPON_C4BOMB;
|
||||
Weapon_DropCurrentWeapon(targ);
|
||||
if (targ.HasItem("weapon_c4")) {
|
||||
//targ.SwitchToWeapon("weapon_c4");
|
||||
//Weapon_DropCurrentWeapon(targ);
|
||||
} else {
|
||||
targ.activeweapon = Cstrike_WeaponToDropUponDeath(targ);
|
||||
Weapon_DropCurrentWeapon(targ);
|
||||
//targ.activeweapon = Cstrike_WeaponToDropUponDeath(targ);
|
||||
//Weapon_DropCurrentWeapon(targ);
|
||||
}
|
||||
|
||||
/* clear all ammo and inventory... */
|
||||
PlayerClearWeaponry(targ);
|
||||
targ.Death();
|
||||
targ.RemoveAllWeapons();
|
||||
// targ.Death();
|
||||
targ.gflags &= ~GF_FLASHLIGHT;
|
||||
targ.m_bHasNightvision = false;
|
||||
|
||||
targ.StartSoundDef("Player.Death", CHAN_AUTO, true);
|
||||
|
||||
|
@ -170,7 +182,7 @@ CSMultiplayerRules::PlayerPreFrame(NSClientPlayer pl)
|
|||
happen here */
|
||||
{
|
||||
vector sourcePos, destPos;
|
||||
player p = (player)pl;
|
||||
CSPlayer p = (CSPlayer)pl;
|
||||
|
||||
sourcePos = pl.GetEyePos();
|
||||
destPos = sourcePos + (pl.GetForward() * 512);
|
||||
|
@ -235,7 +247,7 @@ CSMultiplayerRules::CreateRescueZones(void)
|
|||
return;
|
||||
|
||||
/* hostage zones need to go somewhere */
|
||||
for (entity e = world; (e = find(e, ::classname, "info_player_start"));) {
|
||||
for (entity e = world; (e = find(e, ::classname, SPAWNPOINT_CT));) {
|
||||
info_hostage_rescue newzone = spawn(info_hostage_rescue, origin: e.origin);
|
||||
newzone.Respawn();
|
||||
}
|
||||
|
@ -258,7 +270,7 @@ CSMultiplayerRules::CreateCTBuyzones(void)
|
|||
return;
|
||||
|
||||
/* since no buyzones are available, let's create one around every CT spawn */
|
||||
for (entity e = world; (e = find(e, ::classname, "info_player_start"));) {
|
||||
for (entity e = world; (e = find(e, ::classname, SPAWNPOINT_CT));) {
|
||||
info_buyzone newzone = spawn(info_buyzone, origin: e.origin);
|
||||
newzone.Respawn();
|
||||
newzone.team = TEAM_CT;
|
||||
|
@ -282,7 +294,7 @@ CSMultiplayerRules::CreateTBuyzones(void)
|
|||
return;
|
||||
|
||||
/* since no buyzones are available, let's create one around every T spawn */
|
||||
for (entity e = world; (e = find(e, ::classname, "info_player_deathmatch"));) {
|
||||
for (entity e = world; (e = find(e, ::classname, SPAWNPOINT_T));) {
|
||||
info_buyzone newzone = spawn(info_buyzone, origin: e.origin);
|
||||
newzone.Respawn();
|
||||
newzone.team = TEAM_T;
|
||||
|
@ -292,6 +304,39 @@ CSMultiplayerRules::CreateTBuyzones(void)
|
|||
void
|
||||
CSMultiplayerRules::InitPostEnts(void)
|
||||
{
|
||||
EntityDef_Precache("CSBasePistol");
|
||||
EntityDef_Precache("CSBaseRifle");
|
||||
EntityDef_Precache("CSBaseShotgun");
|
||||
EntityDef_Precache("weapon_ak47");
|
||||
EntityDef_Precache("weapon_aug");
|
||||
EntityDef_Precache("weapon_awp");
|
||||
EntityDef_Precache("weapon_c4");
|
||||
EntityDef_Precache("weapon_deagle");
|
||||
EntityDef_Precache("weapon_elites");
|
||||
EntityDef_Precache("weapon_famas");
|
||||
EntityDef_Precache("weapon_fiveseven");
|
||||
EntityDef_Precache("weapon_flashbang");
|
||||
EntityDef_Precache("weapon_g3sg1");
|
||||
EntityDef_Precache("weapon_galil");
|
||||
EntityDef_Precache("weapon_glock18");
|
||||
EntityDef_Precache("weapon_hegrenade");
|
||||
EntityDef_Precache("weapon_knife");
|
||||
EntityDef_Precache("weapon_m249");
|
||||
EntityDef_Precache("weapon_m3");
|
||||
EntityDef_Precache("weapon_m4a1");
|
||||
EntityDef_Precache("weapon_mac10");
|
||||
EntityDef_Precache("weapon_mp5navy");
|
||||
EntityDef_Precache("weapon_p228");
|
||||
EntityDef_Precache("weapon_p90");
|
||||
EntityDef_Precache("weapon_scout");
|
||||
EntityDef_Precache("weapon_sg550");
|
||||
EntityDef_Precache("weapon_sg552");
|
||||
EntityDef_Precache("weapon_smokegrenade");
|
||||
EntityDef_Precache("weapon_tmp");
|
||||
EntityDef_Precache("weapon_ump45");
|
||||
EntityDef_Precache("weapon_usp");
|
||||
EntityDef_Precache("weapon_xm1014");
|
||||
|
||||
MOTD_LoadDefault();
|
||||
|
||||
/* let's check if we need to create buyzones */
|
||||
|
@ -482,7 +527,7 @@ CSMultiplayerRules::BuyingPossible(NSClientPlayer pl)
|
|||
void
|
||||
CSMultiplayerRules::MakeBomber(NSClientPlayer pl)
|
||||
{
|
||||
Weapons_AddItem(pl, WEAPON_C4BOMB, -1);
|
||||
pl.GiveItem("weapon_c4");
|
||||
env_message_single(pl, "Hint_you_have_the_bomb");
|
||||
}
|
||||
|
||||
|
@ -511,7 +556,7 @@ CSMultiplayerRules::RestartRound(int iWipe)
|
|||
m_iSwapTeamRoundCounter = 0;
|
||||
|
||||
for (entity eFind = world; (eFind = find(eFind, ::classname, "player"));) {
|
||||
player pl = (player)eFind;
|
||||
CSPlayer pl = (CSPlayer)eFind;
|
||||
|
||||
if (pl.team == TEAM_T) {
|
||||
pl.team = TEAM_CT; /* temp for CT */
|
||||
|
@ -532,7 +577,7 @@ CSMultiplayerRules::RestartRound(int iWipe)
|
|||
if (!(eFind.flags & FL_CLIENT))
|
||||
continue;
|
||||
|
||||
player pl = (player)eFind;
|
||||
CSPlayer pl = (CSPlayer)eFind;
|
||||
|
||||
if (pl.health > 0 && iWipe == FALSE) {
|
||||
PlayerRespawn(pl, pl.team);
|
||||
|
@ -551,7 +596,7 @@ CSMultiplayerRules::RestartRound(int iWipe)
|
|||
if (!(eFind.flags & FL_CLIENT))
|
||||
continue;
|
||||
|
||||
player pl = (player)eFind;
|
||||
CSPlayer pl = (CSPlayer)eFind;
|
||||
|
||||
if (pl.health > 0 && iWipe == FALSE) {
|
||||
PlayerRespawn(pl, pl.team);
|
||||
|
@ -572,7 +617,7 @@ CSMultiplayerRules::RestartRound(int iWipe)
|
|||
if (!(eFind.flags & FL_CLIENT))
|
||||
continue;
|
||||
|
||||
player pl = (player)eFind;
|
||||
CSPlayer pl = (CSPlayer)eFind;
|
||||
pl.team = TEAM_CT;
|
||||
|
||||
if (pl.health > 0 && iWipe == FALSE) {
|
||||
|
@ -590,7 +635,7 @@ CSMultiplayerRules::RestartRound(int iWipe)
|
|||
}
|
||||
|
||||
for (entity eFind = world; (eFind = find(eFind, ::classname, "tempdecal"));) {
|
||||
decal dec = (decal)eFind;
|
||||
NSDecal dec = (NSDecal)eFind;
|
||||
dec.m_strTexture = "";
|
||||
dec.SendFlags = -1;
|
||||
}
|
||||
|
@ -598,12 +643,6 @@ CSMultiplayerRules::RestartRound(int iWipe)
|
|||
NSEntity e = (NSEntity)eFind;
|
||||
e.Destroy();
|
||||
}
|
||||
// Remove potential bomb backpack model from the world, else bots will go
|
||||
// chase a ghost.
|
||||
entity e = find(world, ::model, "models/w_backpack.mdl");
|
||||
if (e != world) {
|
||||
remove(e);
|
||||
}
|
||||
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_CLEARDECALS);
|
||||
|
@ -620,7 +659,7 @@ CSMultiplayerRules::RestartRound(int iWipe)
|
|||
iPickT++;
|
||||
|
||||
if (iPickT == iRandomT) {
|
||||
MakeBomber((player)eFind);
|
||||
MakeBomber((CSPlayer)eFind);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -635,7 +674,7 @@ CSMultiplayerRules::RestartRound(int iWipe)
|
|||
if (eFind.team == TEAM_CT) {
|
||||
iPickCT++;
|
||||
if (iPickCT == iRandomCT) {
|
||||
MakeVIP((player)eFind);
|
||||
MakeVIP((CSPlayer)eFind);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -658,7 +697,10 @@ CSMultiplayerRules::RestartRound(int iWipe)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef BOT
|
||||
CSBot_BuyStart();
|
||||
#endif
|
||||
|
||||
TimerBegin(autocvar_mp_freezetime, GAME_FREEZE);
|
||||
Money_ResetTeamReward();
|
||||
}
|
||||
|
@ -751,7 +793,7 @@ CSMultiplayerRules::SwitchTeams(void)
|
|||
int iCTW, iTW;
|
||||
|
||||
for (entity eFind = world; (eFind = find(eFind, ::classname, "player"));) {
|
||||
player pl = (player)eFind;
|
||||
CSPlayer pl = (CSPlayer)eFind;
|
||||
if (pl.team == TEAM_CT) {
|
||||
pl.team = TEAM_T;
|
||||
pl.charmodel -= 4;
|
||||
|
@ -866,24 +908,24 @@ CSMultiplayerRules::PlayerFindSpawn(float t)
|
|||
entity point = world;
|
||||
|
||||
if (t == TEAM_T) {
|
||||
m_eLastTSpawn = find(m_eLastTSpawn, ::classname, "info_player_deathmatch");
|
||||
m_eLastTSpawn = find(m_eLastTSpawn, ::classname, SPAWNPOINT_T);
|
||||
|
||||
if (m_eLastTSpawn == world) {
|
||||
m_eLastTSpawn = find(m_eLastTSpawn, ::classname, "info_player_deathmatch");
|
||||
m_eLastTSpawn = find(m_eLastTSpawn, ::classname, SPAWNPOINT_T);
|
||||
}
|
||||
point = m_eLastTSpawn;
|
||||
} else if (t == TEAM_CT) {
|
||||
m_eLastCTSpawn = find(m_eLastCTSpawn, ::classname, "info_player_start");
|
||||
m_eLastCTSpawn = find(m_eLastCTSpawn, ::classname, SPAWNPOINT_CT);
|
||||
|
||||
if (m_eLastCTSpawn == world) {
|
||||
m_eLastCTSpawn = find(m_eLastCTSpawn, ::classname, "info_player_start");
|
||||
m_eLastCTSpawn = find(m_eLastCTSpawn, ::classname, SPAWNPOINT_CT);
|
||||
}
|
||||
point = m_eLastCTSpawn;
|
||||
} else if (t == TEAM_VIP) {
|
||||
point = find(world, ::classname, "info_vip_start");
|
||||
|
||||
if (!point)
|
||||
point = find(m_eLastTSpawn, ::classname, "info_player_start");
|
||||
point = find(m_eLastTSpawn, ::classname, SPAWNPOINT_CT);
|
||||
}
|
||||
|
||||
if (point == world) {
|
||||
|
@ -903,35 +945,29 @@ Called whenever a player survived a round and needs a basic respawn.
|
|||
void
|
||||
CSMultiplayerRules::PlayerRespawn(NSClientPlayer pp, int fTeam)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
|
||||
entity eSpawn;
|
||||
forceinfokey(pl, "*spec", "0");
|
||||
eSpawn = PlayerFindSpawn(pl.team);
|
||||
|
||||
pl.classname = "player";
|
||||
pl.health = pl.max_health = 100;
|
||||
forceinfokey(pl, "*dead", "0");
|
||||
CountPlayers();
|
||||
|
||||
pl.takedamage = DAMAGE_YES;
|
||||
pl.solid = SOLID_SLIDEBOX;
|
||||
pl.movetype = MOVETYPE_WALK;
|
||||
pl.flags = FL_CLIENT;
|
||||
pl.iBleeds = TRUE;
|
||||
pl.viewzoom = 1.0;
|
||||
pl.g_items &= ~ITEM_C4BOMB;
|
||||
CSPlayer pl = (CSPlayer)pp;
|
||||
NSEntity eSpawn = (NSEntity)PlayerFindSpawn(pl.team);
|
||||
|
||||
pl.MakePlayer();
|
||||
pl.GiveItem("item_suit");
|
||||
pl.SetOrigin(eSpawn.origin);
|
||||
pl.angles = eSpawn.angles;
|
||||
pl.SendFlags = UPDATE_ALL;
|
||||
pl.SetAngles(eSpawn.angles);
|
||||
Client_FixAngle(pl, pl.angles);
|
||||
|
||||
CountPlayers();
|
||||
|
||||
pl.SetInfoKey("*icon1", "");
|
||||
pl.SetInfoKey("*icon1_r", "1");
|
||||
pl.SetInfoKey("*icon1_g", "1");
|
||||
pl.SetInfoKey("*icon1_b", "1");
|
||||
|
||||
/* VIP starts with 200 armor and an extra mag */
|
||||
if (pl.team == TEAM_VIP) {
|
||||
pl.SetArmor(200);
|
||||
pl.GiveItem("weapon_usp");
|
||||
}
|
||||
|
||||
#ifndef CSSOURCE
|
||||
switch (pl.charmodel) {
|
||||
case 1:
|
||||
pl.model = "models/player/terror/terror.mdl";
|
||||
|
@ -960,118 +996,89 @@ CSMultiplayerRules::PlayerRespawn(NSClientPlayer pp, int fTeam)
|
|||
default:
|
||||
pl.model = "models/player/vip/vip.mdl";
|
||||
}
|
||||
#else
|
||||
switch (pl.charmodel) {
|
||||
case 1:
|
||||
pl.model = "models/player/t_phoenix.mdl";
|
||||
break;
|
||||
case 2:
|
||||
pl.model = "models/player/t_leet.mdl";
|
||||
break;
|
||||
case 3:
|
||||
pl.model = "models/player/t_arctic.mdl";
|
||||
break;
|
||||
case 4:
|
||||
pl.model = "models/player/t_guerilla.mdl";
|
||||
break;
|
||||
case 5:
|
||||
pl.model = "models/player/ct_urban.mdl";
|
||||
break;
|
||||
case 6:
|
||||
pl.model = "models/player/ct_gsg9.mdl";
|
||||
break;
|
||||
case 7:
|
||||
pl.model = "models/player/ct_sas.mdl";
|
||||
break;
|
||||
case 8:
|
||||
pl.model = "models/player/ct_gign.mdl";
|
||||
break;
|
||||
default:
|
||||
pl.model = "models/player/vip/vip.mdl";
|
||||
}
|
||||
#endif
|
||||
|
||||
pl.SetModel(pl.model);
|
||||
pl.SetSize(VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
|
||||
pl.velocity = [0,0,0];
|
||||
pl.ClearVelocity();
|
||||
pl.progress = 0.0f;
|
||||
Weapons_SwitchBest(pl);
|
||||
/* TODO: Implement this in NSNavAI*/
|
||||
//Weapons_SwitchBest(pl);
|
||||
Ammo_AutoFill(pl);
|
||||
}
|
||||
|
||||
void
|
||||
CSMultiplayerRules::PlayerClearWeaponry(NSClientPlayer pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
CSPlayer pl = (CSPlayer)pp;
|
||||
|
||||
pl.g_items = 0x0;
|
||||
pl.activeweapon = 0;
|
||||
pl.ammo_50ae = 0;
|
||||
pl.ammo_762mm = 0;
|
||||
pl.ammo_556mm = 0;
|
||||
pl.ammo_556mmbox = 0;
|
||||
pl.ammo_338mag = 0;
|
||||
pl.ammo_9mm = 0;
|
||||
pl.ammo_buckshot = 0;
|
||||
pl.ammo_45acp = 0;
|
||||
pl.ammo_357sig = 0;
|
||||
pl.ammo_57mm = 0;
|
||||
pl.ammo_hegrenade = 0;
|
||||
pl.ammo_fbgrenade = 0;
|
||||
pl.ammo_smokegrenade = 0;
|
||||
pl.usp45_mag = 0;
|
||||
pl.glock18_mag = 0;
|
||||
pl.deagle_mag = 0;
|
||||
pl.p228_mag = 0;
|
||||
pl.elites_mag = 0;
|
||||
pl.fiveseven_mag = 0;
|
||||
pl.m3_mag = 0;
|
||||
pl.xm1014_mag = 0;
|
||||
pl.mp5_mag = 0;
|
||||
pl.p90_mag = 0;
|
||||
pl.ump45_mag = 0;
|
||||
pl.mac10_mag = 0;
|
||||
pl.tmp_mag = 0;
|
||||
pl.ak47_mag = 0;
|
||||
pl.sg552_mag = 0;
|
||||
pl.m4a1_mag = 0;
|
||||
pl.aug_mag = 0;
|
||||
pl.scout_mag = 0;
|
||||
pl.awp_mag = 0;
|
||||
pl.g3sg1_mag = 0;
|
||||
pl.sg550_mag = 0;
|
||||
pl.para_mag = 0;
|
||||
pl.viewzoom = 1.0f;
|
||||
pl.mode_temp = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
PlayerMakePlayable
|
||||
|
||||
Called whenever need a full-reinit of a player.
|
||||
This may be after a player had died or when the game starts for the first time.
|
||||
=================
|
||||
*/
|
||||
|
||||
static void
|
||||
MakePlayable(entity targ)
|
||||
{
|
||||
entity oself = self;
|
||||
self = targ;
|
||||
|
||||
if (clienttype(targ) != CLIENTTYPE_REAL)
|
||||
spawnfunc_csbot();
|
||||
else
|
||||
spawnfunc_player();
|
||||
|
||||
self = oself;
|
||||
pl.m_bHasNightvision = false;
|
||||
}
|
||||
|
||||
void
|
||||
CSMultiplayerRules::PlayerMakePlayable(NSClientPlayer pp, int chara)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
CSPlayer pl = (CSPlayer)pp;
|
||||
/* spectator */
|
||||
if (chara == 0) {
|
||||
PlayerSpawn(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
MakePlayable(pp);
|
||||
pl.g_items |= ITEM_SUIT;
|
||||
Weapons_AddItem(pl, WEAPON_KNIFE, -1);
|
||||
pl.ingame = TRUE;
|
||||
forceinfokey(pl, "*team", ftos(pl.team));
|
||||
PlayerRespawn(pl, pl.team);
|
||||
|
||||
/* terrorists */
|
||||
if (chara < 5) {
|
||||
pl.team = TEAM_T;
|
||||
if (autocvar_fcs_knifeonly == FALSE) {
|
||||
Weapons_AddItem(pl, WEAPON_GLOCK18, -1);
|
||||
pl.ammo_9mm = 40;
|
||||
pl.GiveItem("weapon_glock18");
|
||||
//pl.ammo_9mm = 40;
|
||||
}
|
||||
} else {
|
||||
pl.team = TEAM_CT;
|
||||
|
||||
if (autocvar_fcs_knifeonly == FALSE) {
|
||||
Weapons_AddItem(pl, WEAPON_USP45, -1);
|
||||
pl.ammo_45acp = 24;
|
||||
pl.GiveItem("weapon_usp");
|
||||
//pl.ammo_45acp = 24;
|
||||
}
|
||||
}
|
||||
|
||||
pl.ingame = TRUE;
|
||||
forceinfokey(pl, "*team", ftos(pl.team));
|
||||
PlayerRespawn(pl, pl.team);
|
||||
pl.GiveItem("weapon_knife");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1084,7 +1091,7 @@ Force the player to become an observer.
|
|||
void
|
||||
CSMultiplayerRules::PlayerMakeSpectator(NSClientPlayer pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
CSPlayer pl = (CSPlayer)pp;
|
||||
pl.MakeTempSpectator();
|
||||
PlayerClearWeaponry(pl);
|
||||
pl.view_ofs = g_vec_null;
|
||||
|
@ -1101,7 +1108,7 @@ another player joins and causes the game rules/scores to reset fully
|
|||
void
|
||||
CSMultiplayerRules::PlayerReset(NSClientPlayer pl)
|
||||
{
|
||||
player p = (player)pl;
|
||||
CSPlayer p = (CSPlayer)pl;
|
||||
|
||||
/* give the initial server-joining money */
|
||||
p.money = 0;
|
||||
|
@ -1111,6 +1118,7 @@ CSMultiplayerRules::PlayerReset(NSClientPlayer pl)
|
|||
p.m_seenFriend = false;
|
||||
p.m_seenEnemy = false;
|
||||
p.m_seenHostage = false;
|
||||
p.m_bHasNightvision = false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1177,7 +1185,7 @@ void
|
|||
CSEv_JoinTeam_f(float flChar)
|
||||
{
|
||||
CSMultiplayerRules rules;
|
||||
player pl;
|
||||
CSPlayer pl;
|
||||
|
||||
/* matches Game_InitRules() */
|
||||
if (cvar("sv_playerslots") == 1 || cvar("coop") == 1) {
|
||||
|
@ -1185,7 +1193,7 @@ CSEv_JoinTeam_f(float flChar)
|
|||
}
|
||||
|
||||
rules = (CSMultiplayerRules)g_grMode;
|
||||
pl = (player)self;
|
||||
pl = (CSPlayer)self;
|
||||
|
||||
if (pl.team == TEAM_VIP) {
|
||||
centerprint(pl, "You are the VIP!\nYou cannot switch roles now.\n");
|
||||
|
|
|
@ -52,7 +52,6 @@ CSSingleplayerRules::PlayerSpawn(NSClientPlayer pl)
|
|||
setmodel(pl, pl.model);
|
||||
|
||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
pl.view_ofs = PHY_VIEWPOS;
|
||||
pl.velocity = [0,0,0];
|
||||
pl.gravity = __NULL__;
|
||||
pl.frame = 1;
|
||||
|
@ -75,6 +74,5 @@ CSSingleplayerRules::PlayerSpawn(NSClientPlayer pl)
|
|||
pl.angles = spot.angles;
|
||||
}
|
||||
|
||||
Weapons_RefreshAmmo(pl);
|
||||
Client_FixAngle(pl, pl.angles);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*!QUAKED hostage_entity (0 1 0) (-16 -16 0) (16 16 72)
|
||||
/*!QUAKED CSHostage (0 1 0) (-16 -16 0) (16 16 72)
|
||||
# OVERVIEW
|
||||
Hostage NPC.
|
||||
Used in the Hostage Rescue mode (cs_* maps).
|
||||
|
@ -79,23 +79,23 @@ enum
|
|||
HOSA_DEADTABLE3
|
||||
};
|
||||
|
||||
class hostage_entity:NSTalkMonster
|
||||
class CSHostage:NSTalkMonster
|
||||
{
|
||||
int m_iUsedOnce;
|
||||
|
||||
void(void) hostage_entity;
|
||||
void CSHostage(void);
|
||||
|
||||
virtual void OnPlayerUse(void);
|
||||
virtual void Pain(entity, entity, int, vector, int);
|
||||
virtual void Death(entity, entity, int, vector, int);
|
||||
|
||||
virtual void(void) Respawn;
|
||||
virtual void(void) OnPlayerUse;
|
||||
virtual void(void) Pain;
|
||||
virtual void(void) Death;
|
||||
};
|
||||
|
||||
void
|
||||
hostage_entity::OnPlayerUse(void)
|
||||
CSHostage::OnPlayerUse(void)
|
||||
{
|
||||
if (eActivator.team == TEAM_T) {
|
||||
player pl = (player)eActivator;
|
||||
CSPlayer pl = (CSPlayer)eActivator;
|
||||
|
||||
if (g_csMode.ShowHints() == true)
|
||||
if (pl.m_hostMessageT == false) {
|
||||
|
@ -110,7 +110,7 @@ hostage_entity::OnPlayerUse(void)
|
|||
|
||||
/* CT reward, first time only */
|
||||
if (m_iUsedOnce == FALSE) {
|
||||
Money_AddMoney((player)eActivator, 150);
|
||||
Money_AddMoney((CSPlayer)eActivator, 150);
|
||||
m_iUsedOnce = TRUE;
|
||||
}
|
||||
|
||||
|
@ -118,12 +118,14 @@ hostage_entity::OnPlayerUse(void)
|
|||
}
|
||||
|
||||
void
|
||||
hostage_entity::Pain(void)
|
||||
CSHostage::Pain(entity inflictor, entity attacker, int damage, vector dir, int location)
|
||||
{
|
||||
super::Pain(inflictor, attacker, damage, dir, location);
|
||||
|
||||
if (IsAlive() == false)
|
||||
return;
|
||||
|
||||
switch (g_dmg_iHitBody) {
|
||||
switch (location) {
|
||||
case BODY_HEAD:
|
||||
case BODY_DEFAULT:
|
||||
case BODY_CHEST:
|
||||
|
@ -145,19 +147,19 @@ hostage_entity::Pain(void)
|
|||
}
|
||||
|
||||
/* penalties */
|
||||
if (g_dmg_eAttacker.classname != "player")
|
||||
if (attacker.classname != "player")
|
||||
return;
|
||||
|
||||
Money_AddMoney((NSClientPlayer)g_dmg_eAttacker, -(g_dmg_iDamage * 25));
|
||||
Money_AddMoney((NSClientPlayer)attacker, -(damage * 25i));
|
||||
}
|
||||
|
||||
void
|
||||
hostage_entity::Death(void)
|
||||
CSHostage::Death(entity inflictor, entity attacker, int damage, vector dir, int location)
|
||||
{
|
||||
WarnAllies();
|
||||
|
||||
if (IsAlive() == true) {
|
||||
switch (g_dmg_iHitBody) {
|
||||
switch (location) {
|
||||
case BODY_HEAD:
|
||||
SetFrame(HOSA_DIE_HEADSHOT);
|
||||
break;
|
||||
|
@ -169,11 +171,11 @@ hostage_entity::Death(void)
|
|||
break;
|
||||
}
|
||||
|
||||
if (g_dmg_eAttacker.classname == "player") {
|
||||
if (g_dmg_iDamage >= 100)
|
||||
Money_AddMoney((NSClientPlayer)g_dmg_eAttacker, -2500);
|
||||
if (attacker.classname == "player") {
|
||||
if (damage >= 100)
|
||||
Money_AddMoney((NSClientPlayer)attacker, -2500);
|
||||
else
|
||||
Money_AddMoney((NSClientPlayer)g_dmg_eAttacker, -500);
|
||||
Money_AddMoney((NSClientPlayer)attacker, -500);
|
||||
|
||||
Radio_BroadcastMessage(RADIO_HOSDOWN);
|
||||
}
|
||||
|
@ -183,52 +185,13 @@ hostage_entity::Death(void)
|
|||
SetHealth(0);
|
||||
|
||||
/* now mark our state as 'dead' */
|
||||
super::Death();
|
||||
super::Death(inflictor, attacker, damage, dir, location);
|
||||
SetSolid(SOLID_NOT);
|
||||
}
|
||||
|
||||
void
|
||||
hostage_entity::Respawn(void)
|
||||
{
|
||||
spawnflags |= MSF_MULTIPLAYER;
|
||||
model = "models/hostage.mdl";
|
||||
netname = "Hostage";
|
||||
base_health = 100;
|
||||
base_mins = [-16,-16,0];
|
||||
base_maxs = [16,16,72];
|
||||
|
||||
super::Respawn();
|
||||
|
||||
m_iFlags |= MONSTER_CANFOLLOW;
|
||||
m_iUsedOnce = FALSE;
|
||||
PlayerUse = OnPlayerUse;
|
||||
}
|
||||
|
||||
void
|
||||
hostage_entity::hostage_entity(void)
|
||||
CSHostage::CSHostage(void)
|
||||
{
|
||||
Sound_Precache("hostage_entity.follow");
|
||||
|
||||
m_talkAnswer = "";
|
||||
m_talkAsk = "";
|
||||
m_talkAllyShot = "";
|
||||
m_talkGreet = "";
|
||||
m_talkIdle = "";
|
||||
m_talkHearing = "";
|
||||
m_talkSmelling = "";
|
||||
m_talkStare = "";
|
||||
m_talkSurvived = "";
|
||||
m_talkWounded = "";
|
||||
|
||||
m_talkPlayerAsk = "";
|
||||
m_talkPlayerGreet = "";
|
||||
m_talkPlayerIdle = "";
|
||||
m_talkPlayerWounded1 = "";
|
||||
m_talkPlayerWounded2 = "";
|
||||
m_talkPlayerWounded3 = "";
|
||||
m_talkUnfollow = "";
|
||||
m_talkFollow = "";
|
||||
m_talkStopFollow = "";
|
||||
|
||||
g_cs_hostagestotal++;
|
||||
}
|
||||
|
|
|
@ -42,15 +42,14 @@ info_buyzone::info_buyzone(void)
|
|||
void
|
||||
info_buyzone::Respawn(void)
|
||||
{
|
||||
SetSolid(SOLID_TRIGGER);
|
||||
super::Respawn();
|
||||
SetSize([-128,-128,-128], [128,128,128]);
|
||||
SetOrigin(GetSpawnOrigin());
|
||||
}
|
||||
|
||||
void
|
||||
info_buyzone::Touch(entity eToucher)
|
||||
{
|
||||
player pl = (player)eToucher;
|
||||
CSPlayer pl = (CSPlayer)eToucher;
|
||||
|
||||
if (!(eToucher.flags & FL_CLIENT))
|
||||
return;
|
||||
|
|
|
@ -45,16 +45,15 @@ info_hostage_rescue::info_hostage_rescue(void)
|
|||
void
|
||||
info_hostage_rescue::Respawn(void)
|
||||
{
|
||||
SetSolid(SOLID_TRIGGER);
|
||||
super::Respawn();
|
||||
SetSize([-128,-128,-128], [128,128,128]);
|
||||
SetOrigin(GetSpawnOrigin());
|
||||
}
|
||||
|
||||
void
|
||||
info_hostage_rescue::Touch(entity eToucher)
|
||||
{
|
||||
if (eToucher.flags & FL_CLIENT) {
|
||||
player pl = (player)eToucher;
|
||||
CSPlayer pl = (CSPlayer)eToucher;
|
||||
pl.gflags |= GF_RESCUEZONE;
|
||||
return;
|
||||
}
|
||||
|
@ -70,14 +69,14 @@ info_hostage_rescue::Touch(entity eToucher)
|
|||
}
|
||||
|
||||
/* some custom maps are very smart... */
|
||||
if (!((player)hosty.m_eFollowing))
|
||||
if (!((CSPlayer)hosty.m_eFollowing))
|
||||
return;
|
||||
|
||||
Radio_BroadcastMessage(RADIO_RESCUED);
|
||||
CSBot_HostageRescueNotify();
|
||||
g_cs_hostagesrescued++;
|
||||
|
||||
Money_AddMoney((player)hosty.m_eFollowing, 1000);
|
||||
Money_AddMoney((CSPlayer)hosty.m_eFollowing, 1000);
|
||||
|
||||
/* In Hostage Rescue, all Counter-Terrorists receive an $850
|
||||
* bonus for every hostage they rescue, even if they lose the round. */
|
||||
|
|
|
@ -42,18 +42,17 @@ item_suit::Spawned(void)
|
|||
void
|
||||
item_suit::Respawn(void)
|
||||
{
|
||||
super::Respawn();
|
||||
SetSolid(SOLID_TRIGGER);
|
||||
SetMovetype(MOVETYPE_TOSS);
|
||||
SetModel(GetSpawnModel());
|
||||
SetSize(VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
SetOrigin(GetSpawnOrigin());
|
||||
ReleaseThink();
|
||||
}
|
||||
|
||||
void
|
||||
item_suit::Touch(entity eToucher)
|
||||
{
|
||||
player pl = (player)eToucher;
|
||||
CSPlayer pl = (CSPlayer)eToucher;
|
||||
|
||||
if (pl.classname != "player") {
|
||||
return;
|
||||
|
|
|
@ -14,15 +14,6 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
void Weapons_Draw(player);
|
||||
|
||||
void
|
||||
CSEv_PlayerSwitchWeapon_i(int w)
|
||||
{
|
||||
player pl = (player)self;
|
||||
pl.activeweapon = w;
|
||||
Weapons_Draw(pl);
|
||||
}
|
||||
|
||||
void
|
||||
Player_Precache(void)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma target fte_5768
|
||||
//#pragma flag enable assumeint
|
||||
#pragma progs_dat "../../progs.dat"
|
||||
#pragma progs_dat "../../zpak001.pk3dir/progs.dat"
|
||||
|
||||
#define QWSSQC
|
||||
#define SERVER
|
||||
|
@ -34,7 +34,6 @@ info_hostage_rescue.qc
|
|||
func_vip_safetyzone.qc
|
||||
info_map_parameters.qc
|
||||
item_suit.qc
|
||||
../../../valve/src/server/items.qc
|
||||
|
||||
../../../src/botlib/include.src
|
||||
bot.qc
|
||||
|
@ -49,9 +48,7 @@ radio.qc
|
|||
ammo.qc
|
||||
buy.qc
|
||||
server.qc
|
||||
../../../valve/src/server/damage.qc
|
||||
../../../valve/src/server/flashlight.qc
|
||||
../../../valve/src/server/modelevent.qc
|
||||
|
||||
spawn.qc
|
||||
|
||||
|
|
|
@ -60,11 +60,10 @@ Game_Worldspawn(void)
|
|||
Sound_Precache("item.respawn");
|
||||
Sound_Precache("weapon.pickup");
|
||||
|
||||
Weapons_Init();
|
||||
FX_Corpse_Init();
|
||||
|
||||
clientstat(STAT_MONEY, EV_INTEGER, player::money);
|
||||
clientstat(STAT_PROGRESS, EV_FLOAT, player::progress);
|
||||
clientstat(STAT_MONEY, EV_INTEGER, CSPlayer::money);
|
||||
clientstat(STAT_PROGRESS, EV_FLOAT, CSPlayer::progress);
|
||||
|
||||
pointerstat(STAT_GAMETIME, EV_FLOAT, &g_cs_gametime);
|
||||
pointerstat(STAT_GAMESTATE, EV_INTEGER, &g_cs_gamestate);
|
||||
|
|
8
src/shared/CSProjectile.h
Normal file
8
src/shared/CSProjectile.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
class
|
||||
CSProjectile:NSProjectile
|
||||
{
|
||||
void CSProjectile(void);
|
||||
|
||||
|
||||
};
|
||||
|
5
src/shared/CSProjectile.qc
Normal file
5
src/shared/CSProjectile.qc
Normal file
|
@ -0,0 +1,5 @@
|
|||
void
|
||||
CSProjectile::CSProjectile(void)
|
||||
{
|
||||
|
||||
}
|
220
src/shared/CSWeapon.qc
Normal file
220
src/shared/CSWeapon.qc
Normal file
|
@ -0,0 +1,220 @@
|
|||
|
||||
#ifdef CLIENT
|
||||
void Cstrike_DrawCrosshair(CSPlayer);
|
||||
#endif
|
||||
|
||||
class
|
||||
CSWeapon:NSWeapon
|
||||
{
|
||||
void CSWeapon(void);
|
||||
|
||||
#ifdef CLIENT
|
||||
int m_iHudSlot;
|
||||
int m_iHudSlotPos;
|
||||
|
||||
string m_ammoIcon;
|
||||
string m_crossHair;
|
||||
NSWeapon m_nextWeapon;
|
||||
virtual void AddedToInventory(void);
|
||||
virtual void UpdateGUI(void);
|
||||
#endif
|
||||
|
||||
virtual void Draw(void);
|
||||
virtual void PrimaryAttack(void);
|
||||
virtual void SecondaryAttack(void);
|
||||
virtual void Release(void);
|
||||
virtual void HitscanAttack(string);
|
||||
virtual void SwitchedToWeapon(void);
|
||||
};
|
||||
|
||||
void
|
||||
CSWeapon::CSWeapon(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
CSWeapon::SwitchedToWeapon(void)
|
||||
{
|
||||
w_cstrke_switched((CSPlayer)owner);
|
||||
}
|
||||
|
||||
void
|
||||
CSWeapon::PrimaryAttack(void)
|
||||
{
|
||||
if (GetDefBool("altAlternates") == true) {
|
||||
if (CanFire() == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_iMode = 1 - m_iMode;
|
||||
}
|
||||
|
||||
if (m_iMode) {
|
||||
super::SecondaryAttack();
|
||||
return;
|
||||
}
|
||||
|
||||
super::PrimaryAttack();
|
||||
}
|
||||
|
||||
void
|
||||
CSWeapon::SecondaryAttack(void)
|
||||
{
|
||||
if (GetDefBool("altSilences") == true) {
|
||||
if (CanFire() == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
float silAnimation = 0;
|
||||
float silTime;
|
||||
|
||||
m_iMode = 1 - m_iMode;
|
||||
|
||||
if (m_iMode)
|
||||
silAnimation = GetDefAct("actAddSil");
|
||||
else
|
||||
silAnimation = GetDefAct("actDetachSil");
|
||||
|
||||
SetWeaponFrame(silAnimation);
|
||||
silTime = frameduration(m_viewModel, silAnimation);
|
||||
SetAttackNext(silTime);
|
||||
SetIdleNext(silTime + 1.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
super::SecondaryAttack();
|
||||
}
|
||||
|
||||
void
|
||||
CSWeapon::HitscanAttack(string defName)
|
||||
{
|
||||
CSPlayer ourOwner = (CSPlayer)owner;
|
||||
int numProjectiles = GetSubDefInt(defName, "numProjectiles");
|
||||
string traceInfo = GetSubDefString(defName, "def_projectile");
|
||||
float flAccuracyDivisor = GetSubDefFloat(defName,"accuracyDivisor");
|
||||
float flAccuracyMovementPenalty = GetSubDefFloat(defName,"accuracyMovementPenalty");
|
||||
float flAccuracyMultiplier = GetSubDefFloat(defName,"accuracyMultiplier");
|
||||
float flAccuracyAdd= GetSubDefFloat(defName,"accuracyAdd");
|
||||
float flRangeModifier = GetSubDefFloat(defName,"rangeModifier");
|
||||
float flPenetrationPower = GetSubDefFloat(defName,"penetrationPower");
|
||||
float flBulletStrength = GetSubDefFloat(defName,"bulletStrength");
|
||||
float flMultiplierShots = GetSubDefFloat(defName,"multiplierShots");
|
||||
float flMultiplierStrength = GetSubDefFloat(defName,"multiplierStrength");
|
||||
float flMultiplierInaccuracy = GetSubDefFloat(defName,"multiplierInaccuracy");
|
||||
float accuracy = Cstrike_CalculateAccuracy(ourOwner, flAccuracyDivisor, flAccuracyMovementPenalty) / flAccuracyMultiplier;
|
||||
accuracy += flAccuracyAdd;
|
||||
vector bulletSpread = [accuracy, accuracy];
|
||||
|
||||
/* always fire at least 1 */
|
||||
if (numProjectiles <= 0i) {
|
||||
numProjectiles = 1i;
|
||||
}
|
||||
|
||||
if (flBulletStrength) {
|
||||
Cstrike_BulletRecoil_ApplyPre(ourOwner, flBulletStrength);
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
float traceDamage = GetSubDefFloat(traceInfo, "damage");
|
||||
|
||||
/* don't bother with shotguns */
|
||||
if (numProjectiles <= 3i) {
|
||||
//TraceAttack_SetRangeModifier(flRangeModifier);
|
||||
//TraceAttack_SetPenetrationPower(flPenetrationPower);
|
||||
} else {
|
||||
bulletSpread = [random(-1,1) * 0.1,random(-1,1) * 0.05];
|
||||
}
|
||||
|
||||
for (int i = 0i; i < numProjectiles; i++) {
|
||||
// TraceAttack_FireBulletsWithDecal(1, ourOwner.GetEyePos(), traceDamage, bulletSpread, 0, "Impact.BigShot", ourOwner);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (flBulletStrength) {
|
||||
Cstrike_BulletRecoil_ApplyPost(ourOwner, flBulletStrength);
|
||||
}
|
||||
|
||||
/* don't bother with shotguns */
|
||||
if (numProjectiles <= 3i) {
|
||||
Cstrike_ShotMultiplierAdd(ourOwner, flMultiplierShots, flMultiplierStrength,accuracy* flMultiplierInaccuracy);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CSWeapon::Draw(void)
|
||||
{
|
||||
super::Draw();
|
||||
|
||||
#ifdef CLIENT
|
||||
CSPlayer ourOwner = (CSPlayer)owner;
|
||||
ourOwner.cs_cross_mindist = GetDefInt("crossMinDist");
|
||||
ourOwner.cs_cross_deltadist = GetDefInt("crossDeltaDist");
|
||||
|
||||
CStrikeView_UpdateGeomset(ourOwner);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
CSWeapon::Release(void)
|
||||
{
|
||||
owner.v_angle = input_angles;
|
||||
w_cstrike_weaponrelease((CSPlayer)owner);
|
||||
input_angles = owner.v_angle;
|
||||
super::Release();
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
void
|
||||
CSWeapon::AddedToInventory(void)
|
||||
{
|
||||
super::AddedToInventory();
|
||||
|
||||
m_ammoIcon = GetDefString("ammoIcon");
|
||||
|
||||
if (m_ammoIcon == "") {
|
||||
m_ammoIcon = sprintf("%s.ammo", strtolower(classname));
|
||||
}
|
||||
|
||||
m_crossHair = GetDefString("crosshair");
|
||||
|
||||
if (m_crossHair == "") {
|
||||
m_crossHair = sprintf("%s.crosshair", strtolower(classname));
|
||||
}
|
||||
|
||||
m_iHudSlot = GetDefInt("hudSlot");
|
||||
m_iHudSlotPos = GetDefInt("hudSlotPos");
|
||||
}
|
||||
|
||||
void
|
||||
CSWeapon::UpdateGUI(void)
|
||||
{
|
||||
CSPlayer ourOwner = (CSPlayer)GetOwner();
|
||||
|
||||
/* draw crosshair */
|
||||
Cstrike_DrawCrosshair(ourOwner);
|
||||
|
||||
/* draw ammo icon */
|
||||
if (m_ammoIcon) {
|
||||
vector ammoPos = g_hudmins + [g_hudres[0] - 48, g_hudres[1] - 42];
|
||||
HLSprite_Draw_RGBA(m_ammoIcon, ammoPos, g_hud_color, pSeatLocal->m_flAmmo2Alpha, true);
|
||||
}
|
||||
|
||||
if (m_bAmmoRequired == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_iClipSize > 0i) {
|
||||
ourOwner.a_ammo1 = m_iClip;
|
||||
HUD_DrawAmmo1();
|
||||
}
|
||||
|
||||
ourOwner.a_ammo2 = ourOwner.GetReserveAmmo(m_primaryAmmoType);
|
||||
HUD_DrawAmmo2();
|
||||
|
||||
if (m_secondaryAmmoType && m_primaryAmmoType != m_secondaryAmmoType) {
|
||||
ourOwner.a_ammo3 = ourOwner.GetReserveAmmo(m_secondaryAmmoType);
|
||||
HUD_DrawAmmo3();
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -101,9 +101,9 @@ enum
|
|||
ANIM_RELOAD_AK47,
|
||||
ANIM_GUT_FLINCH,
|
||||
ANIM_HEAD_FLINCH,
|
||||
ANIM_DEATH1,
|
||||
ANIM_DEATH2,
|
||||
ANIM_DEATH3,
|
||||
ANIM_DEATH1, /* land on stomach */
|
||||
ANIM_DEATH2, /* land on back */
|
||||
ANIM_DEATH3, /* dramatic death */
|
||||
ANIM_DIE_HEAD,
|
||||
ANIM_DIE_GUT,
|
||||
ANIM_DIE_LEFT,
|
||||
|
|
|
@ -40,7 +40,7 @@ void Animation_Print(string sWow) {
|
|||
}
|
||||
|
||||
void
|
||||
Animation_TimerUpdate(player pl, float ftime)
|
||||
Animation_TimerUpdate(CSPlayer pl, float ftime)
|
||||
{
|
||||
makevectors([0, pl.v_angle[1], 0]);
|
||||
|
||||
|
@ -65,28 +65,28 @@ depending on what the player is doing
|
|||
=================
|
||||
*/
|
||||
void
|
||||
Animation_PlayerUpdate(player pl)
|
||||
Animation_PlayerUpdate(CSPlayer pl)
|
||||
{
|
||||
pl.basebone = gettagindex(pl, "-- R shoulder outside");
|
||||
|
||||
if (pl.anim_top_delay <= 0.0f) {
|
||||
pl.anim_top = Weapons_GetAim(pl, pl.activeweapon);
|
||||
pl.anim_top = 0;//Weapons_GetAim(pl, pl.activeweapon);
|
||||
}
|
||||
|
||||
if (vlen(pl.velocity) == 0) {
|
||||
if (pl.flags & FL_CROUCHING) {
|
||||
if (pl.IsCrouching()) {
|
||||
pl.anim_bottom = ANIM_IDLE_CROUCH;
|
||||
} else {
|
||||
pl.anim_bottom = ANIM_IDLE;
|
||||
}
|
||||
} else if (vlen(pl.velocity) < 150) {
|
||||
if (pl.flags & FL_CROUCHING) {
|
||||
if (pl.IsCrouching()) {
|
||||
pl.anim_bottom = ANIM_RUN_CROUCH;
|
||||
} else {
|
||||
pl.anim_bottom = ANIM_WALK;
|
||||
}
|
||||
} else if (vlen(pl.velocity) > 150) {
|
||||
if (pl.flags & FL_CROUCHING) {
|
||||
if (pl.IsCrouching()) {
|
||||
pl.anim_bottom = ANIM_RUN_CROUCH;
|
||||
} else {
|
||||
pl.anim_bottom = ANIM_RUN;
|
||||
|
@ -128,7 +128,7 @@ Animation_PlayerUpdate(player pl)
|
|||
}
|
||||
|
||||
void
|
||||
Animation_PlayerTop(player pl, float topanim, float timer)
|
||||
Animation_PlayerTop(CSPlayer pl, float topanim, float timer)
|
||||
{
|
||||
#if 0
|
||||
pl.anim_top = topanim;
|
||||
|
@ -138,7 +138,7 @@ Animation_PlayerTop(player pl, float topanim, float timer)
|
|||
}
|
||||
|
||||
void
|
||||
Animation_PlayerBottom(player pl, float botanim, float timer)
|
||||
Animation_PlayerBottom(CSPlayer pl, float botanim, float timer)
|
||||
{
|
||||
pl.anim_bottom = botanim;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "items.h"
|
||||
#include "entities.h"
|
||||
#include "events.h"
|
||||
#include "pmove.h"
|
||||
|
||||
#define TEAM_SPECTATOR 0
|
||||
#define TEAM_T 1
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#includelist
|
||||
flags.h
|
||||
player.h
|
||||
../../../valve/src/shared/weapon_common.h
|
||||
animations.h
|
||||
animations.qc
|
||||
|
||||
|
@ -11,37 +10,8 @@ item_c4bomb.h
|
|||
../../../valve/src/shared/fx_corpse.qc
|
||||
fx_flashbang.qc
|
||||
fx_smokenade.qc
|
||||
|
||||
weapons_cstrike.qc
|
||||
w_ak47.qc
|
||||
w_deagle.qc
|
||||
w_knife.qc
|
||||
w_usp45.qc
|
||||
w_glock18.qc
|
||||
w_p228.qc
|
||||
w_elites.qc
|
||||
w_fiveseven.qc
|
||||
w_m3.qc
|
||||
w_xm1014.qc
|
||||
w_mp5.qc
|
||||
w_p90.qc
|
||||
w_ump45.qc
|
||||
w_mac10.qc
|
||||
w_tmp.qc
|
||||
w_sg552.qc
|
||||
w_m4a1.qc
|
||||
w_aug.qc
|
||||
w_scout.qc
|
||||
w_awp.qc
|
||||
w_g3sg1.qc
|
||||
w_sg550.qc
|
||||
w_para.qc
|
||||
w_c4bomb.qc
|
||||
w_flashbang.qc
|
||||
w_hegrenade.qc
|
||||
w_smokegrenade.qc
|
||||
weapons.qc
|
||||
../../../valve/src/shared/weapon_common.qc
|
||||
pmove.qc
|
||||
item_c4bomb.qc
|
||||
weapons_cstrike.qc
|
||||
CSWeapon.qc
|
||||
pmove.qc
|
||||
#endlist
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
#ifdef SERVER
|
||||
void C4Bomb_Plant(NSClientPlayer);
|
||||
#endif
|
||||
|
||||
#ifdef CLIENT
|
||||
string g_c4bombled_spr;
|
||||
void w_c4bomb_parse(void);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
class item_c4:NSRenderableEntity
|
||||
class CSBombEntity:NSRenderableEntity
|
||||
{
|
||||
#ifdef SERVER
|
||||
entity m_eUser;
|
||||
|
@ -24,7 +24,7 @@ class item_c4:NSRenderableEntity
|
|||
#endif
|
||||
|
||||
#ifdef SERVER
|
||||
void item_c4(void);
|
||||
void CSBombEntity(void);
|
||||
|
||||
virtual void Spawned(void);
|
||||
virtual float SendEntity(entity, float);
|
||||
|
@ -35,14 +35,14 @@ class item_c4:NSRenderableEntity
|
|||
#endif
|
||||
|
||||
#ifdef CLIENT
|
||||
void item_c4(void);
|
||||
void CSBombEntity(void);
|
||||
virtual void DrawLED(void);
|
||||
virtual float predraw(void);
|
||||
#endif
|
||||
};
|
||||
|
||||
void
|
||||
item_c4::item_c4(void)
|
||||
CSBombEntity::CSBombEntity(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
m_eUser = __NULL__;
|
||||
|
@ -54,7 +54,7 @@ item_c4::item_c4(void)
|
|||
|
||||
#ifdef SERVER
|
||||
float
|
||||
item_c4::SendEntity(entity pvsent, float flags)
|
||||
CSBombEntity::SendEntity(entity pvsent, float flags)
|
||||
{
|
||||
WriteByte(MSG_ENTITY, ENT_C4BOMB);
|
||||
WriteCoord(MSG_ENTITY, origin[0]);
|
||||
|
@ -68,19 +68,19 @@ item_c4::SendEntity(entity pvsent, float flags)
|
|||
}
|
||||
|
||||
void
|
||||
item_c4::ClearProgress(void)
|
||||
CSBombEntity::ClearProgress(void)
|
||||
{
|
||||
if (m_eUser != world) {
|
||||
player pl = (player)m_eUser;
|
||||
CSPlayer pl = (CSPlayer)m_eUser;
|
||||
pl.progress = 0.0f;
|
||||
pl.flags &= ~FL_FROZEN;
|
||||
pl.RemoveVFlags(VFL_FROZEN);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
item_c4::OnPlayerUse(void)
|
||||
CSBombEntity::OnPlayerUse(void)
|
||||
{
|
||||
player pl = (player)eActivator;
|
||||
CSPlayer pl = (CSPlayer)eActivator;
|
||||
|
||||
/* obvious check */
|
||||
if (pl.team != TEAM_CT) {
|
||||
|
@ -95,13 +95,13 @@ item_c4::OnPlayerUse(void)
|
|||
}
|
||||
|
||||
void
|
||||
item_c4::Logic(void)
|
||||
CSBombEntity::Logic(void)
|
||||
{
|
||||
CSMultiplayerRules rules = (CSMultiplayerRules)g_grMode;
|
||||
|
||||
/* check if we're being used */
|
||||
if (m_eUser != world) {
|
||||
player pl = (player)m_eUser;
|
||||
CSPlayer pl = (CSPlayer)m_eUser;
|
||||
|
||||
/* we need to check if the user has changed every frame. */
|
||||
if (!m_eUser.button5) {
|
||||
|
@ -121,7 +121,7 @@ item_c4::Logic(void)
|
|||
|
||||
/* tracked stat */
|
||||
pl.progress = m_flDefusalState;
|
||||
pl.flags |= FL_FROZEN;
|
||||
pl.AddVFlags(VFL_FROZEN);
|
||||
|
||||
g_cs_bombbeingdefused = TRUE;
|
||||
}
|
||||
|
@ -143,7 +143,11 @@ item_c4::Logic(void)
|
|||
/* In Bomb Defusal, all Terrorists receive $3500
|
||||
* if they won by detonating the bomb. */
|
||||
rules.RoundOver(TEAM_T, 3500, FALSE);
|
||||
Damage_Radius(origin, this.real_owner, 500, g_cstrike_bombradius, false, WEAPON_C4BOMB);
|
||||
|
||||
radiusDamage(origin, -g_cstrike_bombradius, 0i, 500i, real_owner);
|
||||
//Damage_Radius(origin, this.real_owner, 500, g_cstrike_bombradius, false, WEAPON_C4BOMB);
|
||||
|
||||
|
||||
StartSoundDef("weapon_c4bomb.explode", CHAN_VOICE, true);
|
||||
|
||||
for (entity e = world; (e = find(e, ::classname, "func_bomb_target"));) {
|
||||
|
@ -183,7 +187,7 @@ item_c4::Logic(void)
|
|||
}
|
||||
|
||||
void
|
||||
item_c4::OnRemoveEntity(void)
|
||||
CSBombEntity::OnRemoveEntity(void)
|
||||
{
|
||||
ClearProgress();
|
||||
m_flBeepTime = 0.0f;
|
||||
|
@ -193,7 +197,7 @@ item_c4::OnRemoveEntity(void)
|
|||
}
|
||||
|
||||
void
|
||||
item_c4::Spawned(void)
|
||||
CSBombEntity::Spawned(void)
|
||||
{
|
||||
super::Spawned();
|
||||
|
||||
|
@ -208,33 +212,13 @@ item_c4::Spawned(void)
|
|||
customphysics = Logic;
|
||||
PlayerUse = OnPlayerUse;
|
||||
m_flExplodeTime = time + 45.0f;
|
||||
StartSoundDef("weapon_c4bomb.plant", CHAN_WEAPON, true);
|
||||
}
|
||||
|
||||
void
|
||||
C4Bomb_Plant(NSClientPlayer planter)
|
||||
{
|
||||
item_c4 bomb = spawn(item_c4);
|
||||
bomb.Spawned();
|
||||
bomb.real_owner = planter;
|
||||
|
||||
/* place directly below */
|
||||
traceline(planter.origin, planter.origin + [0,0,-64], FALSE, planter);
|
||||
setorigin(bomb, trace_endpos);
|
||||
bomb.SendFlags = -1;
|
||||
|
||||
/* push the player out if we're on top */
|
||||
setorigin_safe(planter, planter.origin);
|
||||
|
||||
Radio_BroadcastMessage(RADIO_BOMBPL);
|
||||
CSBot_BombPlantedNotify();
|
||||
g_cs_bombplanted = TRUE;
|
||||
StartSoundDef("c4.plant", CHAN_WEAPON, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CLIENT
|
||||
void
|
||||
item_c4::DrawLED(void)
|
||||
CSBombEntity::DrawLED(void)
|
||||
{
|
||||
vector cameraPos = g_view.GetCameraOrigin();
|
||||
float ledAlpha = 1.0 - (time - floor(time));
|
||||
|
@ -266,7 +250,7 @@ item_c4::DrawLED(void)
|
|||
}
|
||||
|
||||
float
|
||||
item_c4::predraw(void)
|
||||
CSBombEntity::predraw(void)
|
||||
{
|
||||
DrawLED();
|
||||
addentity(this);
|
||||
|
@ -276,8 +260,8 @@ item_c4::predraw(void)
|
|||
void
|
||||
w_c4bomb_parse(void)
|
||||
{
|
||||
item_c4 tm = (item_c4)self;
|
||||
spawnfunc_item_c4();
|
||||
CSBombEntity tm = (CSBombEntity)self;
|
||||
spawnfunc_CSBombEntity();
|
||||
|
||||
g_c4bombled_spr = spriteframe("sprites/ledglow.spr", 0, 0.0f);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#define ITEM_MAC10 0x00001000i
|
||||
#define ITEM_TMP 0x00002000i
|
||||
#define ITEM_SUIT 0x00004000i
|
||||
#define ITEM_LONGJUMP 0x00008000i
|
||||
#define ITEM_FAMAS 0x00008000i
|
||||
|
||||
#define ITEM_AK47 0x00010000i
|
||||
#define ITEM_SG552 0x00020000i
|
||||
|
@ -47,5 +47,5 @@
|
|||
#define ITEM_HEGRENADE 0x08000000i
|
||||
#define ITEM_SMOKEGRENADE 0x10000000i
|
||||
#define ITEM_DEFUSAL 0x20000000i
|
||||
#define ITEM_NIGHTVISION 0x40000000i
|
||||
#define ITEM_GALIL 0x40000000i
|
||||
#define ITEM_HELMET 0x80000000i
|
||||
|
|
|
@ -101,59 +101,14 @@ string g_pbones[] =
|
|||
enumflags
|
||||
{
|
||||
PLAYER_TOPFRAME = PLAYER_CUSTOMFIELDSTART,
|
||||
PLAYER_BOTTOMFRAME,
|
||||
PLAYER_AMMO1,
|
||||
PLAYER_AMMO2,
|
||||
PLAYER_AMMO3,
|
||||
PLAYER_CSTIMERS
|
||||
PLAYER_BOTTOMFRAME = PLAYER_CUSTOMFIELDSTART,
|
||||
PLAYER_CSTIMERS = PLAYER_CUSTOMFIELDSTART
|
||||
};
|
||||
|
||||
class player:NSClientPlayer
|
||||
class CSPlayer:NSClientPlayer
|
||||
{
|
||||
int ingame;
|
||||
|
||||
PREDICTED_INT(usp45_mag)
|
||||
PREDICTED_INT(glock18_mag)
|
||||
PREDICTED_INT(deagle_mag)
|
||||
PREDICTED_INT(p228_mag)
|
||||
PREDICTED_INT(elites_mag)
|
||||
PREDICTED_INT(fiveseven_mag)
|
||||
PREDICTED_INT(m3_mag)
|
||||
PREDICTED_INT(xm1014_mag)
|
||||
PREDICTED_INT(mp5_mag)
|
||||
PREDICTED_INT(p90_mag)
|
||||
PREDICTED_INT(ump45_mag)
|
||||
PREDICTED_INT(mac10_mag)
|
||||
PREDICTED_INT(tmp_mag)
|
||||
PREDICTED_INT(ak47_mag)
|
||||
PREDICTED_INT(sg552_mag)
|
||||
PREDICTED_INT(m4a1_mag)
|
||||
PREDICTED_INT(aug_mag)
|
||||
PREDICTED_INT(scout_mag)
|
||||
PREDICTED_INT(awp_mag)
|
||||
PREDICTED_INT(g3sg1_mag)
|
||||
PREDICTED_INT(sg550_mag)
|
||||
PREDICTED_INT(para_mag)
|
||||
|
||||
PREDICTED_INT(ammo_50ae)
|
||||
PREDICTED_INT(ammo_762mm)
|
||||
PREDICTED_INT(ammo_556mm)
|
||||
PREDICTED_INT(ammo_556mmbox)
|
||||
PREDICTED_INT(ammo_338mag)
|
||||
PREDICTED_INT(ammo_9mm)
|
||||
PREDICTED_INT(ammo_buckshot)
|
||||
PREDICTED_INT(ammo_45acp)
|
||||
PREDICTED_INT(ammo_357sig)
|
||||
PREDICTED_INT(ammo_57mm)
|
||||
PREDICTED_INT(ammo_hegrenade)
|
||||
PREDICTED_INT(ammo_fbgrenade)
|
||||
PREDICTED_INT(ammo_smokegrenade)
|
||||
|
||||
PREDICTED_INT(mode_usp45)
|
||||
PREDICTED_INT(mode_m4a1)
|
||||
PREDICTED_INT(mode_glock18)
|
||||
PREDICTED_INT(mode_temp)
|
||||
|
||||
PREDICTED_FLOAT(cs_shotmultiplier)
|
||||
PREDICTED_FLOAT(cs_shottime)
|
||||
PREDICTED_FLOAT(cs_prev_hor_rec)
|
||||
|
@ -200,6 +155,7 @@ class player:NSClientPlayer
|
|||
bool m_seenEnemy;
|
||||
bool m_seenHostage;
|
||||
bool m_seenBombSite;
|
||||
bool m_bHasNightvision;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -207,7 +163,7 @@ float punchangle_recovery(float punchangle) {
|
|||
return 0.05 * (-0.2 * pow(1.2, fabs(punchangle)) + 4);
|
||||
}
|
||||
void
|
||||
player::Physics_InputPostMove(void)
|
||||
CSPlayer::Physics_InputPostMove(void)
|
||||
{
|
||||
//start of this function is taken from super::Physics_InputPostMove
|
||||
float punch;
|
||||
|
@ -224,15 +180,16 @@ player::Physics_InputPostMove(void)
|
|||
|
||||
/* player animation code */
|
||||
UpdatePlayerAnimation(input_timelength);
|
||||
|
||||
RemoveFlags(FL_FROZEN);
|
||||
RemoveVFlags(VFL_FROZEN);
|
||||
RemoveVFlags(VFL_NOATTACK);
|
||||
|
||||
#ifdef SERVER
|
||||
if (g_cs_gamestate == GAME_FREEZE) {
|
||||
#else
|
||||
if (getstati(STAT_GAMESTATE) == GAME_FREEZE) {
|
||||
#endif
|
||||
flags |= FL_FROZEN;
|
||||
AddVFlags(VFL_FROZEN);
|
||||
AddVFlags(VFL_NOATTACK);
|
||||
|
||||
if (input_buttons & INPUT_BUTTON0) {
|
||||
w_attack_next = (w_attack_next > 0.1) ? w_attack_next : 0.1f;
|
||||
|
@ -242,11 +199,11 @@ player::Physics_InputPostMove(void)
|
|||
ProcessInput();
|
||||
}
|
||||
|
||||
void Animation_PlayerUpdate(player);
|
||||
void Animation_TimerUpdate(player, float);
|
||||
void Animation_PlayerUpdate(CSPlayer);
|
||||
void Animation_TimerUpdate(CSPlayer, float);
|
||||
|
||||
void
|
||||
player::UpdatePlayerAnimation(float timelength)
|
||||
CSPlayer::UpdatePlayerAnimation(float timelength)
|
||||
{
|
||||
/* calculate our skeletal progression */
|
||||
Animation_PlayerUpdate(this);
|
||||
|
@ -260,7 +217,7 @@ void Camera_StrafeRoll(__inout vector camera_angle);
|
|||
void Shake_Update(NSClientPlayer);
|
||||
|
||||
void
|
||||
player::UpdateAliveCam(void)
|
||||
CSPlayer::UpdateAliveCam(void)
|
||||
{
|
||||
vector cam_pos = GetEyePos();
|
||||
Camera_RunPosBob(view_angles, cam_pos);
|
||||
|
@ -289,10 +246,10 @@ player::UpdateAliveCam(void)
|
|||
}
|
||||
|
||||
.string oldmodel;
|
||||
string Weapons_GetPlayermodel(player, int);
|
||||
///string Weapons_GetPlayermodel(NSClientPlayer, int);
|
||||
|
||||
void
|
||||
player::UpdatePlayerAttachments(bool visible)
|
||||
CSPlayer::UpdatePlayerAttachments(bool visible)
|
||||
{
|
||||
/* draw the flashlight */
|
||||
if (gflags & GF_FLASHLIGHT) {
|
||||
|
@ -324,7 +281,7 @@ player::UpdatePlayerAttachments(bool visible)
|
|||
return;
|
||||
|
||||
/* what's the current weapon model supposed to be anyway? */
|
||||
p_model.oldmodel = Weapons_GetPlayermodel(this, activeweapon);
|
||||
p_model.oldmodel = 0;//Weapons_GetPlayermodel(this, activeweapon);
|
||||
|
||||
/* we changed weapons, update skeletonindex */
|
||||
if (p_model.model != p_model.oldmodel) {
|
||||
|
@ -369,17 +326,16 @@ player::UpdatePlayerAttachments(bool visible)
|
|||
}
|
||||
}
|
||||
|
||||
void Weapons_AmmoUpdate(entity);
|
||||
void HUD_AmmoNotify_Check(player pl);
|
||||
void HUD_AmmoNotify_Check(CSPlayer pl);
|
||||
/*
|
||||
=================
|
||||
player::ReceiveEntity
|
||||
CSPlayer::ReceiveEntity
|
||||
=================
|
||||
*/
|
||||
void
|
||||
player::ReceiveEntity(float flIsNew, float flChanged)
|
||||
CSPlayer::ReceiveEntity(float flIsNew, float flChanged)
|
||||
{
|
||||
NSClientPlayer::ReceiveEntity(flIsNew, flChanged);
|
||||
super::ReceiveEntity(flIsNew, flChanged);
|
||||
|
||||
/* animation */
|
||||
READENTITY_BYTE(anim_top, PLAYER_TOPFRAME)
|
||||
|
@ -387,110 +343,35 @@ player::ReceiveEntity(float flIsNew, float flChanged)
|
|||
READENTITY_FLOAT(anim_top_delay, PLAYER_TOPFRAME)
|
||||
READENTITY_BYTE(anim_bottom, PLAYER_BOTTOMFRAME)
|
||||
READENTITY_FLOAT(anim_bottom_time, PLAYER_BOTTOMFRAME)
|
||||
READENTITY_BYTE(usp45_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(glock18_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(deagle_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(p228_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(elites_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(fiveseven_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(m3_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(xm1014_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(mp5_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(p90_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(ump45_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(mac10_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(tmp_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(ak47_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(sg552_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(m4a1_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(aug_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(scout_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(awp_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(g3sg1_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(sg550_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(para_mag, PLAYER_AMMO1)
|
||||
READENTITY_BYTE(ammo_50ae, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_762mm, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_556mm, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_556mmbox, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_338mag, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_9mm, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_buckshot, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_45acp, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_357sig, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_57mm, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_hegrenade, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_fbgrenade, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(ammo_smokegrenade, PLAYER_AMMO2)
|
||||
READENTITY_BYTE(mode_usp45, PLAYER_AMMO3)
|
||||
READENTITY_BYTE(mode_m4a1, PLAYER_AMMO3)
|
||||
READENTITY_BYTE(mode_glock18, PLAYER_AMMO3)
|
||||
READENTITY_BYTE(mode_temp, PLAYER_AMMO3)
|
||||
|
||||
READENTITY_BYTE(cs_shotmultiplier, PLAYER_CSTIMERS)
|
||||
READENTITY_FLOAT(cs_shottime, PLAYER_CSTIMERS)
|
||||
READENTITY_FLOAT(cs_prev_hor_rec, PLAYER_CSTIMERS)
|
||||
READENTITY_BYTE(cs_hor_rec_sign, PLAYER_CSTIMERS)
|
||||
READENTITY_FLOAT(cs_rec_reverse_chance, PLAYER_CSTIMERS)
|
||||
if (flChanged & PLAYER_AMMO1 || flChanged & PLAYER_AMMO2 || flChanged & PLAYER_AMMO3) {
|
||||
Weapons_AmmoUpdate(this);
|
||||
|
||||
#if 0
|
||||
if (flChanged & PLAYER_AMMOTYPE) {
|
||||
HUD_AmmoNotify_Check(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
setorigin(this, origin);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
player::PredictPostFrame
|
||||
CSPlayer::PredictPostFrame
|
||||
|
||||
Save the last valid server values away in the _net variants of each field
|
||||
so we can roll them back later.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
player::PredictPreFrame(void)
|
||||
CSPlayer::PredictPreFrame(void)
|
||||
{
|
||||
NSClientPlayer::PredictPreFrame();
|
||||
super::PredictPreFrame();
|
||||
|
||||
SAVE_STATE(usp45_mag)
|
||||
SAVE_STATE(glock18_mag)
|
||||
SAVE_STATE(deagle_mag)
|
||||
SAVE_STATE(p228_mag)
|
||||
SAVE_STATE(elites_mag)
|
||||
SAVE_STATE(fiveseven_mag)
|
||||
SAVE_STATE(m3_mag)
|
||||
SAVE_STATE(xm1014_mag)
|
||||
SAVE_STATE(mp5_mag)
|
||||
SAVE_STATE(p90_mag)
|
||||
SAVE_STATE(ump45_mag)
|
||||
SAVE_STATE(mac10_mag)
|
||||
SAVE_STATE(tmp_mag)
|
||||
SAVE_STATE(ak47_mag)
|
||||
SAVE_STATE(sg552_mag)
|
||||
SAVE_STATE(m4a1_mag)
|
||||
SAVE_STATE(aug_mag)
|
||||
SAVE_STATE(scout_mag)
|
||||
SAVE_STATE(awp_mag)
|
||||
SAVE_STATE(g3sg1_mag)
|
||||
SAVE_STATE(sg550_mag)
|
||||
SAVE_STATE(para_mag)
|
||||
SAVE_STATE(ammo_50ae)
|
||||
SAVE_STATE(ammo_762mm)
|
||||
SAVE_STATE(ammo_556mm)
|
||||
SAVE_STATE(ammo_556mmbox)
|
||||
SAVE_STATE(ammo_338mag)
|
||||
SAVE_STATE(ammo_9mm)
|
||||
SAVE_STATE(ammo_buckshot)
|
||||
SAVE_STATE(ammo_45acp)
|
||||
SAVE_STATE(ammo_357sig)
|
||||
SAVE_STATE(ammo_57mm)
|
||||
SAVE_STATE(ammo_hegrenade)
|
||||
SAVE_STATE(ammo_fbgrenade)
|
||||
SAVE_STATE(ammo_smokegrenade)
|
||||
SAVE_STATE(mode_usp45)
|
||||
SAVE_STATE(mode_m4a1)
|
||||
SAVE_STATE(mode_glock18)
|
||||
SAVE_STATE(mode_temp)
|
||||
SAVE_STATE(cs_shotmultiplier)
|
||||
SAVE_STATE(cs_shottime)
|
||||
SAVE_STATE(cs_prev_hor_rec)
|
||||
|
@ -505,55 +386,16 @@ player::PredictPreFrame(void)
|
|||
|
||||
/*
|
||||
=================
|
||||
player::PredictPostFrame
|
||||
CSPlayer::PredictPostFrame
|
||||
|
||||
Where we roll back our values to the ones last sent/verified by the server.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
player::PredictPostFrame(void)
|
||||
CSPlayer::PredictPostFrame(void)
|
||||
{
|
||||
NSClientPlayer::PredictPostFrame();
|
||||
super::PredictPostFrame();
|
||||
|
||||
ROLL_BACK(usp45_mag)
|
||||
ROLL_BACK(glock18_mag)
|
||||
ROLL_BACK(deagle_mag)
|
||||
ROLL_BACK(p228_mag)
|
||||
ROLL_BACK(elites_mag)
|
||||
ROLL_BACK(fiveseven_mag)
|
||||
ROLL_BACK(m3_mag)
|
||||
ROLL_BACK(xm1014_mag)
|
||||
ROLL_BACK(mp5_mag)
|
||||
ROLL_BACK(p90_mag)
|
||||
ROLL_BACK(ump45_mag)
|
||||
ROLL_BACK(mac10_mag)
|
||||
ROLL_BACK(tmp_mag)
|
||||
ROLL_BACK(ak47_mag)
|
||||
ROLL_BACK(sg552_mag)
|
||||
ROLL_BACK(m4a1_mag)
|
||||
ROLL_BACK(aug_mag)
|
||||
ROLL_BACK(scout_mag)
|
||||
ROLL_BACK(awp_mag)
|
||||
ROLL_BACK(g3sg1_mag)
|
||||
ROLL_BACK(sg550_mag)
|
||||
ROLL_BACK(para_mag)
|
||||
ROLL_BACK(ammo_50ae)
|
||||
ROLL_BACK(ammo_762mm)
|
||||
ROLL_BACK(ammo_556mm)
|
||||
ROLL_BACK(ammo_556mmbox)
|
||||
ROLL_BACK(ammo_338mag)
|
||||
ROLL_BACK(ammo_9mm)
|
||||
ROLL_BACK(ammo_buckshot)
|
||||
ROLL_BACK(ammo_45acp)
|
||||
ROLL_BACK(ammo_357sig)
|
||||
ROLL_BACK(ammo_57mm)
|
||||
ROLL_BACK(ammo_hegrenade)
|
||||
ROLL_BACK(ammo_fbgrenade)
|
||||
ROLL_BACK(ammo_smokegrenade)
|
||||
ROLL_BACK(mode_usp45)
|
||||
ROLL_BACK(mode_m4a1)
|
||||
ROLL_BACK(mode_glock18)
|
||||
ROLL_BACK(mode_temp)
|
||||
ROLL_BACK(cs_shotmultiplier)
|
||||
ROLL_BACK(cs_shottime)
|
||||
ROLL_BACK(cs_prev_hor_rec)
|
||||
|
@ -568,60 +410,22 @@ player::PredictPostFrame(void)
|
|||
|
||||
#else
|
||||
void
|
||||
player::ServerInputFrame(void)
|
||||
CSPlayer::ServerInputFrame(void)
|
||||
{
|
||||
super::ServerInputFrame();
|
||||
}
|
||||
|
||||
void
|
||||
player::EvaluateEntity(void)
|
||||
CSPlayer::EvaluateEntity(void)
|
||||
{
|
||||
NSClientPlayer::EvaluateEntity();
|
||||
super::EvaluateEntity();
|
||||
|
||||
EVALUATE_FIELD(anim_top, PLAYER_TOPFRAME)
|
||||
EVALUATE_FIELD(anim_top_time, PLAYER_TOPFRAME)
|
||||
EVALUATE_FIELD(anim_top_delay, PLAYER_TOPFRAME)
|
||||
EVALUATE_FIELD(anim_bottom, PLAYER_BOTTOMFRAME)
|
||||
EVALUATE_FIELD(anim_bottom_time, PLAYER_BOTTOMFRAME)
|
||||
EVALUATE_FIELD(usp45_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(glock18_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(deagle_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(p228_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(elites_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(fiveseven_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(m3_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(xm1014_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(mp5_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(p90_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(ump45_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(mac10_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(tmp_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(ak47_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(sg552_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(m4a1_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(aug_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(scout_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(awp_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(g3sg1_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(sg550_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(para_mag, PLAYER_AMMO1)
|
||||
EVALUATE_FIELD(ammo_50ae, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_762mm, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_556mm, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_556mmbox, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_338mag, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_9mm, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_buckshot, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_45acp, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_357sig, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_57mm, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_hegrenade, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_fbgrenade, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(ammo_smokegrenade, PLAYER_AMMO2)
|
||||
EVALUATE_FIELD(mode_usp45, PLAYER_AMMO3)
|
||||
EVALUATE_FIELD(mode_m4a1, PLAYER_AMMO3)
|
||||
EVALUATE_FIELD(mode_glock18, PLAYER_AMMO3)
|
||||
EVALUATE_FIELD(mode_temp, PLAYER_AMMO3)
|
||||
|
||||
EVALUATE_FIELD(cs_shotmultiplier, PLAYER_CSTIMERS)
|
||||
EVALUATE_FIELD(cs_shottime, PLAYER_CSTIMERS)
|
||||
EVALUATE_FIELD(cs_prev_hor_rec, PLAYER_CSTIMERS)
|
||||
|
@ -631,11 +435,11 @@ player::EvaluateEntity(void)
|
|||
|
||||
/*
|
||||
=================
|
||||
player::SendEntity
|
||||
CSPlayer::SendEntity
|
||||
=================
|
||||
*/
|
||||
float
|
||||
player::SendEntity(entity ePEnt, float flChanged)
|
||||
CSPlayer::SendEntity(entity ePEnt, float flChanged)
|
||||
{
|
||||
/* don't broadcast invisible players */
|
||||
if (IsFakeSpectator() && ePEnt != this)
|
||||
|
@ -645,55 +449,14 @@ player::SendEntity(entity ePEnt, float flChanged)
|
|||
|
||||
flChanged = OptimiseChangedFlags(ePEnt, flChanged);
|
||||
|
||||
WriteByte(MSG_ENTITY, ENT_PLAYER);
|
||||
WriteFloat(MSG_ENTITY, flChanged);
|
||||
|
||||
NSClientPlayer::SendEntity(ePEnt, flChanged);
|
||||
super::SendEntity(ePEnt, flChanged);
|
||||
|
||||
SENDENTITY_BYTE(anim_top, PLAYER_TOPFRAME)
|
||||
SENDENTITY_FLOAT(anim_top_time, PLAYER_TOPFRAME)
|
||||
SENDENTITY_FLOAT(anim_top_delay, PLAYER_TOPFRAME)
|
||||
SENDENTITY_BYTE(anim_bottom, PLAYER_BOTTOMFRAME)
|
||||
SENDENTITY_FLOAT(anim_bottom_time, PLAYER_BOTTOMFRAME)
|
||||
SENDENTITY_BYTE(usp45_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(glock18_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(deagle_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(p228_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(elites_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(fiveseven_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(m3_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(xm1014_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(mp5_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(p90_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(ump45_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(mac10_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(tmp_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(ak47_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(sg552_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(m4a1_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(aug_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(scout_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(awp_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(g3sg1_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(sg550_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(para_mag, PLAYER_AMMO1)
|
||||
SENDENTITY_BYTE(ammo_50ae, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_762mm, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_556mm, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_556mmbox, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_338mag, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_9mm, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_buckshot, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_45acp, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_357sig, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_57mm, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_hegrenade, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_fbgrenade, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(ammo_smokegrenade, PLAYER_AMMO2)
|
||||
SENDENTITY_BYTE(mode_usp45, PLAYER_AMMO3)
|
||||
SENDENTITY_BYTE(mode_m4a1, PLAYER_AMMO3)
|
||||
SENDENTITY_BYTE(mode_glock18, PLAYER_AMMO3)
|
||||
SENDENTITY_BYTE(mode_temp, PLAYER_AMMO3)
|
||||
|
||||
SENDENTITY_BYTE(cs_shotmultiplier, PLAYER_CSTIMERS)
|
||||
SENDENTITY_FLOAT(cs_shottime, PLAYER_CSTIMERS)
|
||||
SENDENTITY_FLOAT(cs_prev_hor_rec, PLAYER_CSTIMERS)
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
#define PMOVE_STEPHEIGHT 18
|
||||
#define PMOVE_AIRSTEPHEIGHT 0
|
||||
#define PMOVE_FRICTION 4
|
||||
#define PMOVE_EDGEFRICTION 1
|
||||
#define PMOVE_STOPSPEED 75
|
||||
#define PMOVE_GRAVITY 800
|
||||
#define PMOVE_AIRACCELERATE 10
|
||||
#define PMOVE_WATERACCELERATE 8
|
||||
#define PMOVE_ACCELERATE 4
|
||||
#define PMOVE_MAXSPEED 250
|
||||
|
||||
/* Counter-Strike players are hunched over a little bit */
|
||||
#define PHY_VIEWPOS [0,0,18]
|
||||
#define PHY_VIEWPOS_CROUCHED [0,0,12]
|
||||
|
||||
#define PHY_HULL_MIN [-16,-16,-36]
|
||||
#define PHY_HULL_MAX [16,16,36]
|
||||
#define PHY_HULL_CROUCHED_MIN [-16,-16,-18]
|
||||
#define PHY_HULL_CROUCHED_MAX [16,16,18]
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2021 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,14 +14,36 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define PMOVE_STEPHEIGHT 18
|
||||
#define PMOVE_AIRSTEPHEIGHT 0
|
||||
#define PMOVE_FRICTION 4
|
||||
#define PMOVE_EDGEFRICTION 1
|
||||
#define PMOVE_STOPSPEED 75
|
||||
#define PMOVE_GRAVITY 800
|
||||
#define PMOVE_AIRACCELERATE 10
|
||||
#define PMOVE_WATERACCELERATE 8
|
||||
#define PMOVE_ACCELERATE 4
|
||||
#define PMOVE_MAXSPEED 250
|
||||
#define PMOVE_STEP_WALKSPEED 270
|
||||
#define PMOVE_STEP_CROUCHSPEED 90
|
||||
#define PMOVE_BOXCENTER true
|
||||
#define PMOVE_NORMAL_HEIGHT 72
|
||||
#define PMOVE_NORMAL_VIEWHEIGHT 54
|
||||
#define PMOVE_CROUCH_HEIGHT 36
|
||||
#define PMOVE_CROUCH_VIEWHEIGHT 30
|
||||
|
||||
/* disable prone, run and lean */
|
||||
#define PMOVE_STEP_RUNSPEED 0
|
||||
#define PMOVE_PRONE_HEIGHT 0
|
||||
|
||||
.float waterlevel;
|
||||
.float watertype;
|
||||
|
||||
/* values courtesy of https://wiki.alliedmods.net/Cs_weapons_information */
|
||||
float
|
||||
player::Physics_MaxSpeed(void)
|
||||
CSPlayer::Physics_MaxSpeed(void)
|
||||
{
|
||||
float spd = serverkeyfloat("phy_maxspeed");
|
||||
float spd = super::Physics_MaxSpeed();
|
||||
|
||||
switch (activeweapon)
|
||||
{
|
||||
|
@ -109,21 +131,17 @@ player::Physics_MaxSpeed(void)
|
|||
default:
|
||||
}
|
||||
|
||||
if (flags & FL_CROUCHING) {
|
||||
spd *= 0.5f;
|
||||
}
|
||||
|
||||
return spd;
|
||||
}
|
||||
|
||||
void
|
||||
player::Physics_Fall(float impactspeed)
|
||||
CSPlayer::Physics_Fall(float impactspeed)
|
||||
{
|
||||
impactspeed *= 1.25f;
|
||||
if (impactspeed > 580) {
|
||||
#ifdef SERVER
|
||||
float fFallDamage = (impactspeed - 580) * (100 / (1024 - 580)) * 0.75f;
|
||||
Damage_Apply(this, world, fFallDamage, 0, DMG_FALL | DMG_SKIP_ARMOR);
|
||||
//Damage_Apply(this, world, fFallDamage, 0, DMG_FALL | DMG_SKIP_ARMOR);
|
||||
|
||||
if (random() < 0.5)
|
||||
sound(this, CHAN_AUTO, "player/pl_pain2.wav", 1.0, ATTN_NORM);
|
||||
|
@ -134,7 +152,7 @@ player::Physics_Fall(float impactspeed)
|
|||
}
|
||||
|
||||
void
|
||||
player::Physics_Jump(void)
|
||||
CSPlayer::Physics_Jump(void)
|
||||
{
|
||||
if (waterlevel >= 2) {
|
||||
if (watertype == CONTENT_WATER) {
|
||||
|
|
|
@ -1,342 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_ak47 (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
AK-47 Weapon
|
||||
|
||||
- Buy Menu -
|
||||
Price: $2500
|
||||
Terrorists only weapon
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_ak47.mdl"
|
||||
*/
|
||||
|
||||
#ifdef CLIENT
|
||||
void
|
||||
w_rifle_ejectshell(void)
|
||||
{
|
||||
static void w_rifle_ejectshell_death(void) {
|
||||
remove(self);
|
||||
}
|
||||
static void w_rifle_ejectshell_touch(void) {
|
||||
if (other == world)
|
||||
Sound_Play(self, CHAN_BODY, "modelevent_shell.land");
|
||||
}
|
||||
entity eShell = spawn();
|
||||
setmodel(eShell, "models/rshell.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 * 80);
|
||||
eShell.touch = w_rifle_ejectshell_touch;
|
||||
|
||||
eShell.avelocity = [0,45,900];
|
||||
eShell.think = w_rifle_ejectshell_death;
|
||||
eShell.nextthink = time + 2.5f;
|
||||
setsize(eShell, [0,0,0], [0,0,0]);
|
||||
setorigin(eShell, gettaginfo(pSeat->m_eViewModel, pSeat->m_iVMBones + 1));
|
||||
}
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
AK47_IDLE,
|
||||
AK47_RELOAD,
|
||||
AK47_DRAW,
|
||||
AK47_SHOOT1,
|
||||
AK47_SHOOT2,
|
||||
AK47_SHOOT3
|
||||
};
|
||||
|
||||
void
|
||||
w_ak47_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_ak47.fire");
|
||||
precache_model("models/w_ak47.mdl");
|
||||
#else
|
||||
Sound_Precache("modelevent_shell.land");
|
||||
precache_model("models/v_ak47.mdl");
|
||||
precache_model("models/p_ak47.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_ak47_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.ak47_mag, pl.ammo_762mm, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_ak47_wmodel(void)
|
||||
{
|
||||
return "models/w_ak47.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_ak47_pmodel(player pl)
|
||||
{
|
||||
return "models/p_ak47.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_ak47_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_ak47_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (new) {
|
||||
if (startammo == -1)
|
||||
pl.ak47_mag = 30;
|
||||
else
|
||||
pl.ak47_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_762mm < AMMO_MAX_762MM) {
|
||||
pl.ammo_762mm = bound(0, pl.ammo_762mm + 30, AMMO_MAX_762MM);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_ak47_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_ak47.mdl");
|
||||
Weapons_ViewAnimation(pl, AK47_DRAW);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 4;
|
||||
pl.cs_cross_deltadist = 4;
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_ak47_primary(player pl)
|
||||
{
|
||||
int dmg = 0;
|
||||
|
||||
if (pl.w_attack_next > 0) {
|
||||
return;
|
||||
}
|
||||
if (!pl.ak47_mag) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 30,3)/1.5;
|
||||
pl.ak47_mag--;
|
||||
|
||||
int r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, AK47_SHOOT1);
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, AK47_SHOOT2);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, AK47_SHOOT3);
|
||||
break;
|
||||
}
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_AK47, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_AK47, 0.45f);
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
View_AddEvent(w_rifle_ejectshell, 0.0f);
|
||||
#else
|
||||
dmg = Skill_GetValue("plr_ak47_dmg", 36);
|
||||
TraceAttack_SetRangeModifier(2.375); /* 18 units!!! */
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
Cstrike_BulletRecoil_ApplyPre(pl,1.2);
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_AK47, "Impact.BigShot");
|
||||
Cstrike_BulletRecoil_ApplyPost(pl,1.2);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_ak47.fire");
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1.1f, 0.92f,accuracy*0.5);
|
||||
pl.w_attack_next = 0.0975f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_ak47_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
if (pl.ak47_mag >= 30) {
|
||||
return;
|
||||
}
|
||||
if (!pl.ammo_762mm) {
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_ViewAnimation(pl, AK47_RELOAD);
|
||||
|
||||
pl.w_attack_next = 2.4f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_weapon_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::ak47_mag, player::ammo_762mm, 30);
|
||||
Cstrike_ShotReset(pl);
|
||||
}
|
||||
|
||||
pl.think = w_weapon_reload_done;
|
||||
pl.nextthink = time + pl.w_attack_next - 0.1f;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_ak47_release(player pl)
|
||||
{
|
||||
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.ak47_mag == 0 && pl.ammo_762mm > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_ak47_aimanim(player pl)
|
||||
{
|
||||
return pl.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_AK47 : ANIM_AIM_AK47;
|
||||
}
|
||||
|
||||
void
|
||||
w_ak47_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Cstrike_DrawCrosshair();
|
||||
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/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_ak47_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.ak47_mag <= 0 && pl.ammo_762mm <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_ak47_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (w_ak47_isempty(pl))
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_762mm, AMMO_MAX_762MM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud11_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud11_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_ak47 =
|
||||
{
|
||||
.name = "ak47",
|
||||
.id = ITEM_AK47,
|
||||
.slot = 0,
|
||||
.slot_pos = 7,
|
||||
.weight = 25,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_ak47_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_ak47_primary,
|
||||
.secondary = __NULL__,
|
||||
.reload = w_ak47_reload,
|
||||
.release = w_ak47_release,
|
||||
.postdraw = w_ak47_hud,
|
||||
.precache = w_ak47_precache,
|
||||
.pickup = w_ak47_pickup,
|
||||
.updateammo = w_ak47_updateammo,
|
||||
.wmodel = w_ak47_wmodel,
|
||||
.pmodel = w_ak47_pmodel,
|
||||
.deathmsg = w_ak47_deathmsg,
|
||||
.aimanim = w_ak47_aimanim,
|
||||
.hudpic = w_ak47_hudpic,
|
||||
.type = csweapon_ranged_type,
|
||||
.isempty = w_ak47_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_ak47(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_AK47);
|
||||
}
|
||||
#endif
|
|
@ -1,329 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2022 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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_aug (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
Steyr AUG Weapon
|
||||
|
||||
- Buy Menu -
|
||||
Price: $3500
|
||||
Counter-Terrorists only weapon
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_aug.mdl"
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
AUG_IDLE,
|
||||
AUG_RELOAD,
|
||||
AUG_DRAW,
|
||||
AUG_SHOOT1,
|
||||
AUG_SHOOT2,
|
||||
AUG_SHOOT3
|
||||
};
|
||||
|
||||
void
|
||||
w_aug_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_aug.fire");
|
||||
precache_model("models/w_aug.mdl");
|
||||
#else
|
||||
precache_model("models/v_aug.mdl");
|
||||
precache_model("models/p_aug.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_aug_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.aug_mag, pl.ammo_762mm, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_aug_wmodel(void)
|
||||
{
|
||||
return "models/w_aug.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_aug_pmodel(player pl)
|
||||
{
|
||||
return "models/p_aug.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_aug_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_aug_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (new) {
|
||||
if (startammo == -1)
|
||||
pl.aug_mag = 30;
|
||||
else
|
||||
pl.aug_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_762mm < AMMO_MAX_762MM) {
|
||||
pl.ammo_762mm = bound(0, pl.ammo_762mm + 30, AMMO_MAX_762MM);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_aug_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_aug.mdl");
|
||||
Weapons_ViewAnimation(pl, AUG_DRAW);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 3;
|
||||
pl.cs_cross_deltadist = 3;
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_aug_primary(player pl)
|
||||
{
|
||||
int dmg = 0;
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
if (!pl.aug_mag) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 35,2);
|
||||
pl.aug_mag--;
|
||||
|
||||
int r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, AUG_SHOOT1);
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, AUG_SHOOT2);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, AUG_SHOOT3);
|
||||
break;
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
View_AddEvent(w_rifle_ejectshell, 0.0f);
|
||||
#else
|
||||
dmg = Skill_GetValue("plr_aug_dmg", 32);
|
||||
TraceAttack_SetRangeModifier(2.125);
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
Cstrike_BulletRecoil_ApplyPre(pl,1.03);
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_AUG, "Impact.BigShot");
|
||||
Cstrike_BulletRecoil_ApplyPost(pl,1.03);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_aug.fire");
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 0.7f, 1.1f,accuracy);
|
||||
if (pl.viewzoom == 1.0f) {
|
||||
pl.w_attack_next = 0.0825f;
|
||||
} else {
|
||||
pl.w_attack_next = 0.15f;
|
||||
}
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_aug_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_aug_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
if (pl.aug_mag >= 30) {
|
||||
return;
|
||||
}
|
||||
if (!pl.ammo_762mm) {
|
||||
return;
|
||||
}
|
||||
Weapons_ViewAnimation(pl, AUG_RELOAD);
|
||||
pl.w_attack_next = 3.3f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_weapon_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::aug_mag, player::ammo_762mm, 30);
|
||||
Cstrike_ShotReset(pl);
|
||||
}
|
||||
|
||||
pl.think = w_weapon_reload_done;
|
||||
pl.nextthink = time + pl.w_attack_next - 0.1f;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_aug_release(player pl)
|
||||
{
|
||||
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.aug_mag == 0 && pl.ammo_762mm > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_aug_aimanim(player pl)
|
||||
{
|
||||
return w_ak47_aimanim(pl);
|
||||
}
|
||||
|
||||
void
|
||||
w_aug_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
if (pl.viewzoom == 1.0f) {
|
||||
Cstrike_DrawCrosshair();
|
||||
} else {
|
||||
Cstrike_DrawSimpleCrosshair();
|
||||
}
|
||||
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/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_aug_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.aug_mag <= 0 && pl.ammo_762mm <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_aug_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (w_aug_isempty(pl))
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_762mm, AMMO_MAX_762MM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud15_spr,
|
||||
[0,45/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud14_spr,
|
||||
[0,45/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_aug =
|
||||
{
|
||||
.name = "aug",
|
||||
.id = ITEM_AUG,
|
||||
.slot = 0,
|
||||
.slot_pos = 10,
|
||||
.weight = 25,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_aug_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_aug_primary,
|
||||
.secondary = w_aug_secondary,
|
||||
.reload = w_aug_reload,
|
||||
.release = w_aug_release,
|
||||
.postdraw = w_aug_hud,
|
||||
.precache = w_aug_precache,
|
||||
.pickup = w_aug_pickup,
|
||||
.updateammo = w_aug_updateammo,
|
||||
.wmodel = w_aug_wmodel,
|
||||
.pmodel = w_aug_pmodel,
|
||||
.deathmsg = w_aug_deathmsg,
|
||||
.aimanim = w_aug_aimanim,
|
||||
.hudpic = w_aug_hudpic,
|
||||
.type = csweapon_ranged_type,
|
||||
.isempty = w_aug_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_aug(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_AUG);
|
||||
}
|
||||
#endif
|
|
@ -1,383 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_awp (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
AWP (AI Arctic Warfare/Magnum) Weapon
|
||||
|
||||
- Buy Menu -
|
||||
Price: $4750
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_awp.mdl"
|
||||
*/
|
||||
|
||||
#ifdef CLIENT
|
||||
void
|
||||
w_sniper_ejectshell(void)
|
||||
{
|
||||
static void w_sniper_ejectshelldeath(void) {
|
||||
remove(self);
|
||||
}
|
||||
static void w_sniper_ejectshell_touch(void) {
|
||||
if (other == world)
|
||||
Sound_Play(self, CHAN_BODY, "modelevent_shell.land");
|
||||
}
|
||||
entity eShell = spawn();
|
||||
setmodel(eShell, "models/rshell_big.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_sniper_ejectshell_touch;
|
||||
|
||||
eShell.avelocity = [0,45,900];
|
||||
eShell.think = w_sniper_ejectshelldeath;
|
||||
eShell.nextthink = time + 2.5f;
|
||||
setsize(eShell, [0,0,0], [0,0,0]);
|
||||
setorigin(eShell, gettaginfo(pSeat->m_eViewModel, pSeat->m_iVMBones + 1));
|
||||
}
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
AWP_IDLE,
|
||||
AWP_SHOOT1,
|
||||
AWP_SHOOT2,
|
||||
AWP_SHOOT3,
|
||||
AWP_RELOAD,
|
||||
AWP_DRAW
|
||||
};
|
||||
|
||||
void
|
||||
w_awp_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_awp.fire");
|
||||
Sound_Precache("weapon_awp.zoom");
|
||||
precache_model("models/w_awp.mdl");
|
||||
#else
|
||||
precache_model("models/v_awp.mdl");
|
||||
precache_model("models/p_awp.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_awp_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.awp_mag, pl.ammo_338mag, pl.mode_temp);
|
||||
}
|
||||
|
||||
string
|
||||
w_awp_wmodel(void)
|
||||
{
|
||||
return "models/w_awp.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_awp_pmodel(player pl)
|
||||
{
|
||||
return "models/p_awp.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_awp_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_awp_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (new) {
|
||||
if (startammo == -1)
|
||||
pl.awp_mag = 10;
|
||||
else
|
||||
pl.awp_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_338mag < 20) {
|
||||
pl.ammo_338mag = bound(0, pl.ammo_338mag + 10, 20);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_awp_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_awp.mdl");
|
||||
Weapons_ViewAnimation(pl, AWP_DRAW);
|
||||
pl.mode_temp = 0;
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 8;
|
||||
pl.cs_cross_deltadist = 3;
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_awp_release(player pl)
|
||||
{
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.awp_mag == 0 && pl.ammo_338mag > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.w_idle_next > 0.0f) {
|
||||
pl.viewzoom = 1.0f;
|
||||
Weapons_EnableModel();
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.mode_temp == 1) {
|
||||
pl.viewzoom = 0.45f;
|
||||
Weapons_DisableModel();
|
||||
} else if (pl.mode_temp == 2) {
|
||||
pl.viewzoom = 0.1f;
|
||||
Weapons_DisableModel();
|
||||
} else {
|
||||
pl.viewzoom = 1.0f;
|
||||
Weapons_EnableModel();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
w_awp_secondary(player pl)
|
||||
{
|
||||
if (pl.w_attack_next) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef SSQC
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_awp.zoom");
|
||||
#endif
|
||||
|
||||
/* Simple toggle of fovs */
|
||||
if (pl.mode_temp == 1) {
|
||||
pl.mode_temp = 2;
|
||||
} else if (pl.mode_temp == 2) {
|
||||
pl.mode_temp = 0;
|
||||
} else {
|
||||
pl.mode_temp = 1;
|
||||
}
|
||||
|
||||
pl.w_attack_next = 0.3f;
|
||||
pl.w_idle_next = 0.0f;
|
||||
w_awp_release(pl);
|
||||
}
|
||||
|
||||
void
|
||||
w_awp_primary(player pl)
|
||||
{
|
||||
int dmg = 0;
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
w_awp_release(pl);
|
||||
return;
|
||||
}
|
||||
if (!pl.awp_mag) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, -1);
|
||||
|
||||
pl.awp_mag--;
|
||||
|
||||
int r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, AWP_SHOOT1);
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, AWP_SHOOT2);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, AWP_SHOOT3);
|
||||
break;
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
View_AddEvent(w_sniper_ejectshell, 0.9f);
|
||||
#else
|
||||
dmg = Skill_GetValue("plr_awp_dmg", 115);
|
||||
TraceAttack_SetRangeModifier(1.375);
|
||||
TraceAttack_SetPenetrationPower(2); /* however, we can only penetrate one wall if the first one is 5 units thick or higher */
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_AWP, "Impact.BigShot");
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_awp.fire");
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1, 1,accuracy);
|
||||
pl.w_attack_next = 1.2f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_awp_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.awp_mag >= 10)
|
||||
return;
|
||||
if (!pl.ammo_338mag)
|
||||
return;
|
||||
|
||||
Weapons_ViewAnimation(pl, AWP_RELOAD);
|
||||
|
||||
pl.w_attack_next = 2.9f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_weapon_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::awp_mag, player::ammo_338mag, 10);
|
||||
Cstrike_ShotReset(pl);
|
||||
}
|
||||
|
||||
pl.think = w_weapon_reload_done;
|
||||
pl.nextthink = time + pl.w_attack_next - 0.1f;
|
||||
#endif
|
||||
}
|
||||
|
||||
float
|
||||
w_awp_aimanim(player pl)
|
||||
{
|
||||
return w_ak47_aimanim(pl);
|
||||
}
|
||||
|
||||
void
|
||||
w_awp_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
if (pl.viewzoom < 1.0f) {
|
||||
Cstrike_DrawScope();
|
||||
}
|
||||
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, [24/256,96/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_awp_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.awp_mag <= 0 && pl.ammo_338mag <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_awp_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (w_awp_isempty(pl))
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_338mag, AMMO_MAX_338MAG, a);
|
||||
|
||||
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
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_awp =
|
||||
{
|
||||
.name = "awp",
|
||||
.id = ITEM_AWP,
|
||||
.slot = 0,
|
||||
.slot_pos = 12,
|
||||
.weight = 30,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_awp_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_awp_primary,
|
||||
.secondary = w_awp_secondary,
|
||||
.reload = w_awp_reload,
|
||||
.release = w_awp_release,
|
||||
.postdraw = w_awp_hud,
|
||||
.precache = w_awp_precache,
|
||||
.pickup = w_awp_pickup,
|
||||
.updateammo = w_awp_updateammo,
|
||||
.wmodel = w_awp_wmodel,
|
||||
.pmodel = w_awp_pmodel,
|
||||
.deathmsg = w_awp_deathmsg,
|
||||
.aimanim = w_awp_aimanim,
|
||||
.hudpic = w_awp_hudpic,
|
||||
.type = csweapon_ranged_type,
|
||||
.isempty = w_awp_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_awp(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_AWP);
|
||||
}
|
||||
#endif
|
|
@ -1,262 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_c4bomb (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
C4 Bomb Weapon, Bomb Defusal Gamemode Entity
|
||||
|
||||
Default arsenal for Terrorists
|
||||
|
||||
Can only be picked up by Terrorists and planted in
|
||||
func_bombtarget brush entities.
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_c4.mdl"
|
||||
*/
|
||||
|
||||
/* C4 weapon logic */
|
||||
|
||||
enum
|
||||
{
|
||||
C4_IDLE,
|
||||
C4_DRAW,
|
||||
C4_DROP,
|
||||
C4_ENTERCODE
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
C4S_NONE,
|
||||
C4S_ENTERINGCODE,
|
||||
C4S_DROPPING,
|
||||
C4S_DONE
|
||||
};
|
||||
|
||||
void
|
||||
w_c4bomb_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_c4bomb.disarm");
|
||||
Sound_Precache("weapon_c4bomb.disarmed");
|
||||
Sound_Precache("weapon_c4bomb.explode");
|
||||
Sound_Precache("weapon_c4bomb.plant");
|
||||
Sound_Precache("weapon_c4bomb.beep1");
|
||||
Sound_Precache("weapon_c4bomb.beep2");
|
||||
Sound_Precache("weapon_c4bomb.beep3");
|
||||
Sound_Precache("weapon_c4bomb.beep4");
|
||||
Sound_Precache("weapon_c4bomb.beep5");
|
||||
precache_sound("weapons/c4_beep1.wav");
|
||||
precache_sound("weapons/c4_beep2.wav");
|
||||
precache_sound("weapons/c4_beep3.wav");
|
||||
precache_sound("weapons/c4_beep4.wav");
|
||||
precache_sound("weapons/c4_beep5.wav");
|
||||
precache_sound("weapons/c4_disarmed.wav");
|
||||
precache_sound("weapons/c4_disarm.wav");
|
||||
precache_model("models/w_c4.mdl");
|
||||
precache_model("models/w_backpack.mdl");
|
||||
precache_model("sprites/ledglow.spr");
|
||||
#else
|
||||
precache_model("models/v_c4.mdl");
|
||||
precache_model("models/p_c4.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_c4bomb_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, -1, 1, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_c4bomb_wmodel(void)
|
||||
{
|
||||
return "models/w_backpack.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_c4bomb_pmodel(player pl)
|
||||
{
|
||||
return "models/p_c4.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_c4bomb_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void
|
||||
w_c4bomb_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_c4.mdl");
|
||||
Weapons_ViewAnimation(pl, C4_DRAW);
|
||||
pl.mode_temp = 0;
|
||||
|
||||
#ifdef CLIENT
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_c4bomb_release(player pl)
|
||||
{
|
||||
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
if (pl.mode_temp == C4S_DROPPING) {
|
||||
if (pl.w_idle_next <= 0.0f) {
|
||||
pl.mode_temp = C4S_DONE;
|
||||
#ifdef SERVER
|
||||
C4Bomb_Plant(pl);
|
||||
Weapons_RemoveItem(pl, WEAPON_C4BOMB);
|
||||
#endif
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* reset animation */
|
||||
if (pl.mode_temp != C4S_NONE) {
|
||||
Weapons_ViewAnimation(pl, C4_IDLE);
|
||||
}
|
||||
pl.mode_temp = C4S_NONE;
|
||||
pl.w_idle_next = 0.0f;
|
||||
}
|
||||
|
||||
void
|
||||
w_c4bomb_primary(player pl)
|
||||
{
|
||||
|
||||
if (!(pl.gflags & GF_BOMBZONE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
pl.flags |= FL_FROZEN;
|
||||
input_movevalues = [0,0,0];
|
||||
|
||||
switch (pl.mode_temp) {
|
||||
case C4S_NONE:
|
||||
pl.mode_temp = C4S_ENTERINGCODE;
|
||||
Weapons_ViewAnimation(pl, C4_ENTERCODE);
|
||||
pl.w_idle_next = 3.0f;
|
||||
break;
|
||||
case C4S_ENTERINGCODE:
|
||||
if (pl.w_idle_next <= 0.0f) {
|
||||
pl.mode_temp = C4S_DROPPING;
|
||||
Weapons_ViewAnimation(pl, C4_DROP);
|
||||
pl.w_idle_next = 1.0f;
|
||||
}
|
||||
break;
|
||||
case C4S_DROPPING:
|
||||
w_c4bomb_release(pl);
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
pl.w_attack_next = 0.0f;
|
||||
}
|
||||
|
||||
float
|
||||
w_c4bomb_aimanim(player pl)
|
||||
{
|
||||
return self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_C4 : ANIM_AIM_C4;
|
||||
}
|
||||
|
||||
void
|
||||
w_c4bomb_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/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_c4bomb_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (pl.team != TEAM_T)
|
||||
return (0);
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_c4bomb_hudpic(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
|
||||
}
|
||||
|
||||
weapon_t w_c4bomb =
|
||||
{
|
||||
.name = "c4",
|
||||
.id = ITEM_C4BOMB,
|
||||
.slot = 4,
|
||||
.slot_pos = 0,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_c4bomb_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_c4bomb_primary,
|
||||
.secondary = __NULL__,
|
||||
.reload = __NULL__,
|
||||
.release = w_c4bomb_release,
|
||||
.postdraw = w_c4bomb_hud,
|
||||
.precache = w_c4bomb_precache,
|
||||
.pickup = w_c4bomb_pickup,
|
||||
.updateammo = w_c4bomb_updateammo,
|
||||
.wmodel = w_c4bomb_wmodel,
|
||||
.pmodel = w_c4bomb_pmodel,
|
||||
.deathmsg = w_c4bomb_deathmsg,
|
||||
.aimanim = w_c4bomb_aimanim,
|
||||
.hudpic = w_c4bomb_hudpic
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_c4bomb(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_C4BOMB);
|
||||
}
|
||||
#endif
|
|
@ -1,339 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_deagle (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
Desert Eagle .50 AE Weapon
|
||||
|
||||
- Buy Menu -
|
||||
Price: $650
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_deagle.mdl"
|
||||
*/
|
||||
|
||||
#ifdef CLIENT
|
||||
void
|
||||
w_pistol_ejectshell(void)
|
||||
{
|
||||
static void w_pistol_ejectshell_death(void) {
|
||||
remove(self);
|
||||
}
|
||||
static void w_pistol_ejectshell_touch(void) {
|
||||
if (other == world)
|
||||
Sound_Play(self, CHAN_BODY, "modelevent_shell.land");
|
||||
}
|
||||
entity eShell = spawn();
|
||||
setmodel(eShell, "models/pshell.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_pistol_ejectshell_touch;
|
||||
|
||||
eShell.avelocity = [0,45,900];
|
||||
eShell.think = w_pistol_ejectshell_death;
|
||||
eShell.nextthink = time + 2.5f;
|
||||
setsize(eShell, [0,0,0], [0,0,0]);
|
||||
setorigin(eShell, gettaginfo(pSeat->m_eViewModel, pSeat->m_iVMBones + 1));
|
||||
}
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
DEAGLE_IDLE,
|
||||
DEAGLE_SHOOT1,
|
||||
DEAGLE_SHOOT2,
|
||||
DEAGLE_SHOOT_EMPTY,
|
||||
DEAGLE_RELOAD,
|
||||
DEAGLE_DRAW
|
||||
};
|
||||
|
||||
void
|
||||
w_deagle_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_deagle.fire");
|
||||
precache_model("models/w_deagle.mdl");
|
||||
#else
|
||||
precache_model("models/v_deagle.mdl");
|
||||
precache_model("models/p_deagle.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_deagle_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.deagle_mag, pl.ammo_50ae, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_deagle_wmodel(void)
|
||||
{
|
||||
return "models/w_deagle.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_deagle_pmodel(player pl)
|
||||
{
|
||||
return "models/p_deagle.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_deagle_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_deagle_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (new) {
|
||||
if (startammo == -1)
|
||||
pl.deagle_mag = 7;
|
||||
else
|
||||
pl.deagle_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_50ae < AMMO_MAX_50AE) {
|
||||
pl.ammo_50ae = bound(0, pl.ammo_50ae + 7, AMMO_MAX_50AE);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_deagle_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_deagle.mdl");
|
||||
Weapons_ViewAnimation(pl, DEAGLE_DRAW);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 8;
|
||||
pl.cs_cross_deltadist = 3;
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_deagle_primary(player pl)
|
||||
{
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.gflags & GF_SEMI_TOGGLED)
|
||||
return;
|
||||
if (!pl.deagle_mag)
|
||||
return;
|
||||
|
||||
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 55,1.5)+0.005;
|
||||
pl.deagle_mag--;
|
||||
|
||||
if (pl.deagle_mag <= 0) {
|
||||
Weapons_ViewAnimation(pl, DEAGLE_SHOOT_EMPTY);
|
||||
} else {
|
||||
int r = (float)input_sequence % 2;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, DEAGLE_SHOOT1);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, DEAGLE_SHOOT2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_ONEHAND, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_ONEHAND, 0.45f);
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
View_AddEvent(w_pistol_ejectshell, 0.0f);
|
||||
#else
|
||||
int dmg = Skill_GetValue("plr_deagle_dmg", 54);
|
||||
TraceAttack_SetRangeModifier(1.875); /* 14 but not 15 */
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
Cstrike_BulletRecoil_ApplyPre(pl,0.5);
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_DEAGLE, "Impact.BigShot");
|
||||
Cstrike_BulletRecoil_ApplyPost(pl,0.5);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_deagle.fire");
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 10, .35,accuracy*0.5);
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
pl.w_attack_next = 0.2f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_deagle_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
if (pl.deagle_mag >= 7) {
|
||||
return;
|
||||
}
|
||||
if (!pl.ammo_50ae) {
|
||||
return;
|
||||
}
|
||||
Weapons_ViewAnimation(pl, DEAGLE_RELOAD);
|
||||
|
||||
pl.w_attack_next = 2.1f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_weapon_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::deagle_mag, player::ammo_50ae, 7);
|
||||
Cstrike_ShotReset(pl);
|
||||
}
|
||||
|
||||
pl.think = w_weapon_reload_done;
|
||||
pl.nextthink = time + pl.w_attack_next - 0.1f;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_deagle_release(player pl)
|
||||
{
|
||||
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.deagle_mag == 0 && pl.ammo_50ae > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_deagle_aimanim(player pl)
|
||||
{
|
||||
return pl.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_ONEHAND : ANIM_AIM_ONEHAND;
|
||||
}
|
||||
|
||||
void
|
||||
w_deagle_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Cstrike_DrawCrosshair();
|
||||
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, [24/256,72/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_deagle_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.deagle_mag <= 0 && pl.ammo_50ae <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_deagle_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (w_deagle_isempty(pl))
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_50ae, AMMO_MAX_50AE, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud11_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud10_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_deagle =
|
||||
{
|
||||
.name = "deagle",
|
||||
.id = ITEM_DEAGLE,
|
||||
.slot = 1,
|
||||
.slot_pos = 2,
|
||||
.weight = 7,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_deagle_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_deagle_primary,
|
||||
.secondary = __NULL__,
|
||||
.reload = w_deagle_reload,
|
||||
.release = w_deagle_release,
|
||||
.postdraw = w_deagle_hud,
|
||||
.precache = w_deagle_precache,
|
||||
.pickup = w_deagle_pickup,
|
||||
.updateammo = w_deagle_updateammo,
|
||||
.wmodel = w_deagle_wmodel,
|
||||
.pmodel = w_deagle_pmodel,
|
||||
.deathmsg = w_deagle_deathmsg,
|
||||
.aimanim = w_deagle_aimanim,
|
||||
.hudpic = w_deagle_hudpic,
|
||||
.type = csweapon_ranged_type,
|
||||
.isempty = w_deagle_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_deagle(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_DEAGLE);
|
||||
}
|
||||
#endif
|
|
@ -1,410 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_elites (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
Dual Beretta 96G (Elites) Weapon
|
||||
|
||||
- Buy Menu -
|
||||
Price: $1000
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_elite.mdl"
|
||||
*/
|
||||
|
||||
#ifdef CLIENT
|
||||
void
|
||||
w_elites_ejectshell(int side)
|
||||
{
|
||||
static void w_elites_ejectshell_death(void) {
|
||||
remove(self);
|
||||
}
|
||||
static void w_elites_ejectshell_touch(void) {
|
||||
if (other == world)
|
||||
Sound_Play(self, CHAN_BODY, "modelevent_shell.land");
|
||||
}
|
||||
entity eShell = spawn();
|
||||
setmodel(eShell, "models/pshell.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_elites_ejectshell_touch;
|
||||
|
||||
eShell.avelocity = [0,45,900];
|
||||
eShell.think = w_elites_ejectshell_death;
|
||||
eShell.nextthink = time + 2.5f;
|
||||
setsize(eShell, [0,0,0], [0,0,0]);
|
||||
setorigin(eShell, gettaginfo(pSeat->m_eViewModel, pSeat->m_iVMBones + 1 + side));
|
||||
}
|
||||
|
||||
void
|
||||
w_pistol_ejectshell_left(void)
|
||||
{
|
||||
w_elites_ejectshell(1);
|
||||
}
|
||||
|
||||
void
|
||||
w_pistol_ejectshell_right(void)
|
||||
{
|
||||
w_elites_ejectshell(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
ELITES_IDLE,
|
||||
ELITES_IDLE_LEFTEMPTY,
|
||||
ELITES_SHOOT_LEFT1,
|
||||
ELITES_SHOOT_LEFT2,
|
||||
ELITES_SHOOT_LEFT3,
|
||||
ELITES_SHOOT_LEFT4,
|
||||
ELITES_SHOOT_LEFT5,
|
||||
ELITES_SHOOT_LEFTLAST,
|
||||
ELITES_SHOOT_RIGHT1,
|
||||
ELITES_SHOOT_RIGHT2,
|
||||
ELITES_SHOOT_RIGHT3,
|
||||
ELITES_SHOOT_RIGHT4,
|
||||
ELITES_SHOOT_RIGHT5,
|
||||
ELITES_SHOOT_RIGHTLAST,
|
||||
ELITES_RELOAD,
|
||||
ELITES_DRAW
|
||||
};
|
||||
|
||||
void
|
||||
w_elites_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_elites.fire");
|
||||
precache_model("models/w_elite.mdl");
|
||||
#else
|
||||
precache_model("models/v_elite.mdl");
|
||||
precache_model("models/p_elite.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_elites_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.elites_mag, pl.ammo_9mm, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_elites_wmodel(void)
|
||||
{
|
||||
return "models/w_elite.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_elites_pmodel(player pl)
|
||||
{
|
||||
return "models/p_elite.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_elites_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_elites_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (new) {
|
||||
if (startammo == -1)
|
||||
pl.elites_mag = 30;
|
||||
else
|
||||
pl.elites_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_9mm < AMMO_MAX_9MM) {
|
||||
pl.ammo_9mm = bound(0, pl.ammo_9mm + 30, AMMO_MAX_9MM);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_elites_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_elite.mdl");
|
||||
Weapons_ViewAnimation(pl, ELITES_DRAW);
|
||||
pl.mode_temp = 0;
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 4;
|
||||
pl.cs_cross_deltadist = 3;
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_elites_primary(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
if (pl.gflags & GF_SEMI_TOGGLED) {
|
||||
return;
|
||||
}
|
||||
if (!pl.elites_mag) {
|
||||
return;
|
||||
}
|
||||
|
||||
pl.mode_temp = 1 - pl.mode_temp;
|
||||
|
||||
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 150,1)+0.002;
|
||||
int dmg = 0;
|
||||
pl.elites_mag--;
|
||||
|
||||
int r = (float)input_sequence % 5;
|
||||
if (pl.mode_temp) {
|
||||
if (pl.elites_mag <= 0) {
|
||||
Weapons_ViewAnimation(pl, ELITES_SHOOT_LEFTLAST);
|
||||
} else {
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, ELITES_SHOOT_LEFT1);
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, ELITES_SHOOT_LEFT2);
|
||||
break;
|
||||
case 2:
|
||||
Weapons_ViewAnimation(pl, ELITES_SHOOT_LEFT3);
|
||||
break;
|
||||
case 3:
|
||||
Weapons_ViewAnimation(pl, ELITES_SHOOT_LEFT4);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, ELITES_SHOOT_LEFT1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (pl.elites_mag <= 0) {
|
||||
Weapons_ViewAnimation(pl, ELITES_SHOOT_RIGHTLAST);
|
||||
} else {
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, ELITES_SHOOT_RIGHT1);
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, ELITES_SHOOT_RIGHT2);
|
||||
break;
|
||||
case 2:
|
||||
Weapons_ViewAnimation(pl, ELITES_SHOOT_RIGHT3);
|
||||
break;
|
||||
case 3:
|
||||
Weapons_ViewAnimation(pl, ELITES_SHOOT_RIGHT4);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, ELITES_SHOOT_RIGHT1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING) {
|
||||
if (pl.mode_temp)
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT2_DUALPISTOLS, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_DUALPISTOLS, 0.45f);
|
||||
} else {
|
||||
if (pl.mode_temp)
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT2_DUALPISTOLS, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_DUALPISTOLS, 0.45f);
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
|
||||
if (pl.mode_temp)
|
||||
View_AddEvent(w_pistol_ejectshell_left, 0.0f);
|
||||
else
|
||||
View_AddEvent(w_pistol_ejectshell_right, 0.0f);
|
||||
#else
|
||||
dmg = Skill_GetValue("plr_elites_dmg", 45);
|
||||
TraceAttack_SetRangeModifier(1.875); /* 14 but not 15 */
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
Cstrike_BulletRecoil_ApplyPre(pl,.9f);
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_ELITES, "Impact.BigShot");
|
||||
Cstrike_BulletRecoil_ApplyPost(pl,.9f);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_elites.fire");
|
||||
#endif
|
||||
Cstrike_ShotMultiplierAdd(pl, 3, .85,accuracy);
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
pl.w_attack_next = 0.13f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_elites_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.elites_mag >= 30)
|
||||
return;
|
||||
if (!pl.ammo_9mm)
|
||||
return;
|
||||
|
||||
Weapons_ViewAnimation(pl, ELITES_RELOAD);
|
||||
|
||||
pl.w_attack_next = 4.6f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_weapon_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::elites_mag, player::ammo_9mm, 30);
|
||||
Cstrike_ShotReset(pl);
|
||||
}
|
||||
|
||||
pl.think = w_weapon_reload_done;
|
||||
pl.nextthink = time + pl.w_attack_next - 0.1f;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_elites_release(player pl)
|
||||
{
|
||||
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.elites_mag == 0 && pl.ammo_9mm > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_elites_aimanim(player pl)
|
||||
{
|
||||
return pl.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_DUALPISTOLS : ANIM_AIM_DUALPISTOLS;
|
||||
}
|
||||
|
||||
void
|
||||
w_elites_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Cstrike_DrawCrosshair();
|
||||
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, [48/256,72/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_elites_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.elites_mag <= 0 && pl.ammo_9mm <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_elites_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (w_elites_isempty(pl))
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_9mm, AMMO_MAX_9MM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud15_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud14_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_elites =
|
||||
{
|
||||
.name = "elites",
|
||||
.id = ITEM_ELITES,
|
||||
.slot = 1,
|
||||
.slot_pos = 4,
|
||||
.weight = 5,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_elites_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_elites_primary,
|
||||
.secondary = __NULL__,
|
||||
.reload = w_elites_reload,
|
||||
.release = w_elites_release,
|
||||
.postdraw = w_elites_hud,
|
||||
.precache = w_elites_precache,
|
||||
.pickup = w_elites_pickup,
|
||||
.updateammo = w_elites_updateammo,
|
||||
.wmodel = w_elites_wmodel,
|
||||
.pmodel = w_elites_pmodel,
|
||||
.deathmsg = w_elites_deathmsg,
|
||||
.aimanim = w_elites_aimanim,
|
||||
.hudpic = w_elites_hudpic,
|
||||
.type = csweapon_ranged_type,
|
||||
.isempty = w_elites_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_elites(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_ELITES);
|
||||
}
|
||||
#endif
|
|
@ -1,309 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_fiveseven (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
Five-SeveN Weapon
|
||||
|
||||
- Buy Menu -
|
||||
Price: $750
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_fiveseven.mdl"
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
FIVESEVEN_IDLE,
|
||||
FIVESEVEN_SHOOT1,
|
||||
FIVESEVEN_SHOOT2,
|
||||
FIVESEVEN_SHOOT_EMPTY,
|
||||
FIVESEVEN_RELOAD,
|
||||
FIVESEVEN_DRAW
|
||||
};
|
||||
|
||||
void
|
||||
w_fiveseven_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_fiveseven.fire");
|
||||
precache_model("models/w_fiveseven.mdl");
|
||||
#else
|
||||
precache_model("models/v_fiveseven.mdl");
|
||||
precache_model("models/p_fiveseven.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_fiveseven_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.fiveseven_mag, pl.ammo_57mm, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_fiveseven_wmodel(void)
|
||||
{
|
||||
return "models/w_fiveseven.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_fiveseven_pmodel(player pl)
|
||||
{
|
||||
return "models/p_fiveseven.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_fiveseven_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_fiveseven_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (new) {
|
||||
if (startammo == -1)
|
||||
pl.fiveseven_mag = 20;
|
||||
else
|
||||
pl.fiveseven_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_57mm < AMMO_MAX_57MM) {
|
||||
pl.ammo_57mm = bound(0, pl.ammo_57mm + 20, AMMO_MAX_57MM);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_fiveseven_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_fiveseven.mdl");
|
||||
Weapons_ViewAnimation(pl, FIVESEVEN_DRAW);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 8;
|
||||
pl.cs_cross_deltadist = 3;
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_fiveseven_primary(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.gflags & GF_SEMI_TOGGLED) {
|
||||
return;
|
||||
}
|
||||
if (!pl.fiveseven_mag) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl,200,1.4)+ 0.0055f;
|
||||
int dmg = 0;
|
||||
pl.fiveseven_mag--;
|
||||
|
||||
if (pl.fiveseven_mag <= 0) {
|
||||
Weapons_ViewAnimation(pl, FIVESEVEN_SHOOT_EMPTY);
|
||||
} else {
|
||||
int r = (float)input_sequence % 2;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, FIVESEVEN_SHOOT1);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, FIVESEVEN_SHOOT2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_ONEHAND, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_ONEHAND, 0.45f);
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
View_AddEvent(w_pistol_ejectshell, 0.0f);
|
||||
#else
|
||||
dmg = Skill_GetValue("plr_fiveseven_dmg", 25);
|
||||
TraceAttack_SetRangeModifier(1.875); /* 14 but not 15 */
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
Cstrike_BulletRecoil_ApplyPre(pl,0.5f);
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_FIVESEVEN, "Impact.BigShot");
|
||||
Cstrike_BulletRecoil_ApplyPost(pl,0.5f);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_fiveseven.fire");
|
||||
#endif
|
||||
Cstrike_ShotMultiplierAdd(pl, 10, .4,accuracy);
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
pl.w_attack_next = 0.155f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_fiveseven_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.fiveseven_mag >= 20)
|
||||
return;
|
||||
if (!pl.ammo_57mm)
|
||||
return;
|
||||
|
||||
Weapons_ViewAnimation(pl, FIVESEVEN_RELOAD);
|
||||
|
||||
pl.w_attack_next = 3.1f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_weapon_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::fiveseven_mag, player::ammo_57mm, 20);
|
||||
Cstrike_ShotReset(pl);
|
||||
}
|
||||
|
||||
pl.think = w_weapon_reload_done;
|
||||
pl.nextthink = time + pl.w_attack_next - 0.1f;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_fiveseven_release(player pl)
|
||||
{
|
||||
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.fiveseven_mag == 0 && pl.ammo_57mm > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_fiveseven_aimanim(player pl)
|
||||
{
|
||||
return pl.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_ONEHAND : ANIM_AIM_ONEHAND;
|
||||
}
|
||||
|
||||
void
|
||||
w_fiveseven_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Cstrike_DrawCrosshair();
|
||||
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, [120/256,96/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_fiveseven_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.fiveseven_mag <= 0 && pl.ammo_57mm <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_fiveseven_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (w_fiveseven_isempty(pl))
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_57mm, AMMO_MAX_57MM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud15_spr,
|
||||
[0,135/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud14_spr,
|
||||
[0,135/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_fiveseven =
|
||||
{
|
||||
.name = "fiveseven",
|
||||
.id = ITEM_FIVESEVEN,
|
||||
.slot = 1,
|
||||
.slot_pos = 5,
|
||||
.weight = 5,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_fiveseven_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_fiveseven_primary,
|
||||
.secondary = __NULL__,
|
||||
.reload = w_fiveseven_reload,
|
||||
.release = w_fiveseven_release,
|
||||
.postdraw = w_fiveseven_hud,
|
||||
.precache = w_fiveseven_precache,
|
||||
.pickup = w_fiveseven_pickup,
|
||||
.updateammo = w_fiveseven_updateammo,
|
||||
.wmodel = w_fiveseven_wmodel,
|
||||
.pmodel = w_fiveseven_pmodel,
|
||||
.deathmsg = w_fiveseven_deathmsg,
|
||||
.aimanim = w_fiveseven_aimanim,
|
||||
.hudpic = w_fiveseven_hudpic,
|
||||
.type = csweapon_ranged_type,
|
||||
.isempty = w_fiveseven_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_fiveseven(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_FIVESEVEN);
|
||||
}
|
||||
#endif
|
|
@ -1,307 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_flashbang (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
Concussion (Flashbang) Grenade Weapon
|
||||
|
||||
When thrown, nearby players become blinded temporarily from the blast.
|
||||
|
||||
- Buy Menu -
|
||||
Price: $200
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_flashbang.mdl"
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
FLASHBANG_IDLE,
|
||||
FLASHBANG_PULLPIN,
|
||||
FLASHBANG_THROW,
|
||||
FLASHBANG_DRAW,
|
||||
};
|
||||
|
||||
void
|
||||
w_flashbang_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_flashbang.bounce");
|
||||
Sound_Precache("weapon_flashbang.explode");
|
||||
precache_model("models/w_flashbang.mdl");
|
||||
#else
|
||||
precache_model("models/v_flashbang.mdl");
|
||||
precache_model("models/p_flashbang.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_flashbang_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_fbgrenade, pl.mode_temp);
|
||||
}
|
||||
|
||||
int
|
||||
w_flashbang_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (pl.ammo_fbgrenade < AMMO_MAX_FLASHBANG) {
|
||||
pl.ammo_fbgrenade = bound(0, pl.ammo_fbgrenade + 1, AMMO_MAX_FLASHBANG);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
string
|
||||
w_flashbang_wmodel(void)
|
||||
{
|
||||
return "models/w_flashbang.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_flashbang_pmodel(player pl)
|
||||
{
|
||||
return "models/p_flashbang.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_flashbang_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void
|
||||
w_flashbang_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_flashbang.mdl");
|
||||
Weapons_ViewAnimation(pl, FLASHBANG_DRAW);
|
||||
pl.mode_temp = 0;
|
||||
|
||||
#ifdef CLIENT
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
w_flashbang_throw(player pl)
|
||||
{
|
||||
static void flashbang_explode(void)
|
||||
{
|
||||
FX_Flashbang(self.origin);
|
||||
Sound_Play(self, CHAN_BODY, "weapon_flashbang.explode");
|
||||
remove(self);
|
||||
}
|
||||
|
||||
static void flashbang_touch(void)
|
||||
{
|
||||
if (other.takedamage == DAMAGE_YES) {
|
||||
Damage_Apply(other, self.owner, 15, WEAPON_FLASHBANG, DMG_BLUNT);
|
||||
} else {
|
||||
Sound_Play(self, CHAN_BODY, "weapon_flashbang.bounce");
|
||||
}
|
||||
self.frame = 0;
|
||||
}
|
||||
|
||||
vector vPLAngle = pl.v_angle;
|
||||
if (vPLAngle[0] < 0) {
|
||||
vPLAngle[0] = -10 + vPLAngle[0] * ((90 - 10) / 90.0);
|
||||
} else {
|
||||
vPLAngle[0] = -10 + vPLAngle[0] * ((90 + 10) / 90.0);
|
||||
}
|
||||
|
||||
float flVel = (90 - vPLAngle[0]) * 5;
|
||||
if (flVel > 1000) {
|
||||
flVel = 1000;
|
||||
}
|
||||
|
||||
makevectors(vPLAngle);
|
||||
vector vecSrc = pl.origin + pl.view_ofs + v_forward * 16;
|
||||
vector vecThrow = v_forward * flVel + pl.velocity;
|
||||
|
||||
entity eGrenade = spawn();
|
||||
eGrenade.owner = pl;
|
||||
eGrenade.classname = "remove_me";
|
||||
eGrenade.solid = SOLID_BBOX;
|
||||
eGrenade.frame = 1;
|
||||
eGrenade.velocity = vecThrow;
|
||||
eGrenade.movetype = MOVETYPE_BOUNCE;
|
||||
eGrenade.think = flashbang_explode;
|
||||
eGrenade.touch = flashbang_touch;
|
||||
eGrenade.nextthink = time + 4.0f;
|
||||
setmodel(eGrenade, "models/w_flashbang.mdl");
|
||||
setsize(eGrenade, [0,0,0], [0,0,0]);
|
||||
setorigin(eGrenade, vecSrc);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
w_flashbang_primary(player pl)
|
||||
{
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* We're abusing this network variable for the holding check */
|
||||
if (pl.mode_temp > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
if (pl.ammo_fbgrenade <= 0) {
|
||||
#ifdef SERVER
|
||||
Weapons_RemoveItem(pl, WEAPON_FLASHBANG);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_ViewAnimation(pl, FLASHBANG_PULLPIN);
|
||||
|
||||
pl.mode_temp = 1;
|
||||
pl.w_attack_next = 0.975f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_flashbang_release(player pl)
|
||||
{
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.mode_temp == 1) {
|
||||
pl.ammo_fbgrenade--;
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(pl, FLASHBANG_THROW);
|
||||
#else
|
||||
w_flashbang_throw(pl);
|
||||
#endif
|
||||
pl.mode_temp = 2;
|
||||
pl.w_attack_next = 1.0f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
} else if (pl.mode_temp == 2) {
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(pl, FLASHBANG_DRAW);
|
||||
#else
|
||||
if (!pl.ammo_fbgrenade) {
|
||||
Weapons_RemoveItem(pl, WEAPON_FLASHBANG);
|
||||
}
|
||||
#endif
|
||||
pl.w_attack_next = 0.5f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
pl.mode_temp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_flashbang_aimanim(player pl)
|
||||
{
|
||||
return self.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_GRENADE : ANIM_AIM_GRENADE;
|
||||
}
|
||||
|
||||
void
|
||||
w_flashbang_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/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_flashbang_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.ammo_fbgrenade <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_flashbang_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_fbgrenade, AMMO_MAX_FLASHBANG, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud6_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud3_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_flashbang =
|
||||
{
|
||||
.name = "flashbang",
|
||||
.id = ITEM_FLASHBANG,
|
||||
.slot = 3,
|
||||
.slot_pos = 1,
|
||||
.allow_drop = FALSE,
|
||||
.draw = w_flashbang_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_flashbang_primary,
|
||||
.secondary = __NULL__,
|
||||
.reload = __NULL__,
|
||||
.release = w_flashbang_release,
|
||||
.postdraw = w_flashbang_hud,
|
||||
.precache = w_flashbang_precache,
|
||||
.pickup = w_flashbang_pickup,
|
||||
.updateammo = w_flashbang_updateammo,
|
||||
.wmodel = w_flashbang_wmodel,
|
||||
.pmodel = w_flashbang_pmodel,
|
||||
.deathmsg = w_flashbang_deathmsg,
|
||||
.aimanim = w_flashbang_aimanim,
|
||||
.hudpic = w_flashbang_hudpic,
|
||||
.isempty = w_flashbang_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_flashbang(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_FLASHBANG);
|
||||
}
|
||||
#endif
|
|
@ -1,318 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_g3sg1 (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
Heckler & Koch G3/SG-1 Weapon
|
||||
|
||||
- Buy Menu -
|
||||
Price: $5000
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_g3sg1.mdl"*/
|
||||
|
||||
enum
|
||||
{
|
||||
G3SG1_IDLE,
|
||||
G3SG1_SHOOT1,
|
||||
G3SG1_SHOOT2,
|
||||
G3SG1_RELOAD,
|
||||
G3SG1_DRAW
|
||||
};
|
||||
|
||||
void
|
||||
w_g3sg1_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_g3sg1.fire");
|
||||
precache_model("models/w_g3sg1.mdl");
|
||||
#else
|
||||
precache_model("models/v_g3sg1.mdl");
|
||||
precache_model("models/p_g3sg1.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_g3sg1_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.g3sg1_mag, pl.ammo_762mm, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_g3sg1_wmodel(void)
|
||||
{
|
||||
return "models/w_g3sg1.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_g3sg1_pmodel(player pl)
|
||||
{
|
||||
return "models/p_g3sg1.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_g3sg1_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_g3sg1_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (new) {
|
||||
if (startammo == -1)
|
||||
pl.g3sg1_mag = 20;
|
||||
else
|
||||
pl.g3sg1_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_762mm < AMMO_MAX_762MM) {
|
||||
pl.ammo_762mm = bound(0, pl.ammo_762mm + 20, AMMO_MAX_762MM);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_g3sg1_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_g3sg1.mdl");
|
||||
Weapons_ViewAnimation(pl, G3SG1_DRAW);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 6;
|
||||
pl.cs_cross_deltadist = 4;
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_g3sg1_primary(player pl)
|
||||
{
|
||||
int dmg = 0;
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
if (!pl.g3sg1_mag) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
|
||||
Cstrike_ShotMultiplierAdd(pl, 1, 1,accuracy);
|
||||
pl.g3sg1_mag--;
|
||||
|
||||
int r = (float)input_sequence % 2;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, SCOUT_SHOOT1);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, SCOUT_SHOOT2);
|
||||
break;
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
View_AddEvent(w_rifle_ejectshell, 0.0f);
|
||||
#else
|
||||
dmg = Skill_GetValue("plr_g3sg1_dmg", 80);
|
||||
TraceAttack_SetRangeModifier(2.375);
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_G3SG1, "Impact.BigShot");
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_g3sg1.fire");
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 0.25f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_g3sg1_secondary(player pl)
|
||||
{
|
||||
if (pl.w_attack_next) {
|
||||
return;
|
||||
}
|
||||
/* Simple toggle of fovs */
|
||||
if (pl.viewzoom == 1.0f) {
|
||||
pl.viewzoom = 0.45f;
|
||||
Weapons_DisableModel();
|
||||
} else if (pl.viewzoom == 0.45f) {
|
||||
pl.viewzoom = 0.1f;
|
||||
Weapons_DisableModel();
|
||||
} else {
|
||||
pl.viewzoom = 1.0f;
|
||||
Weapons_EnableModel();
|
||||
}
|
||||
pl.w_attack_next = 0.5f;
|
||||
}
|
||||
|
||||
void
|
||||
w_g3sg1_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.g3sg1_mag >= 20)
|
||||
return;
|
||||
if (!pl.ammo_762mm)
|
||||
return;
|
||||
|
||||
Weapons_ViewAnimation(pl, G3SG1_RELOAD);
|
||||
pl.w_attack_next = 4.6f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_weapon_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::g3sg1_mag, player::ammo_762mm, 20);
|
||||
Cstrike_ShotReset(pl);
|
||||
}
|
||||
|
||||
pl.think = w_weapon_reload_done;
|
||||
pl.nextthink = time + pl.w_attack_next - 0.1f;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_g3sg1_release(player pl)
|
||||
{
|
||||
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.g3sg1_mag == 0 && pl.ammo_762mm > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_g3sg1_aimanim(player pl)
|
||||
{
|
||||
return w_ak47_aimanim(pl);
|
||||
}
|
||||
|
||||
void
|
||||
w_g3sg1_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
if (pl.viewzoom < 1.0f) {
|
||||
Cstrike_DrawScope();
|
||||
}
|
||||
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/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_g3sg1_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.g3sg1_mag <= 0 && pl.ammo_762mm <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_g3sg1_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (w_g3sg1_isempty(pl))
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_762mm, AMMO_MAX_762MM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud5_spr,
|
||||
[0,180/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud2_spr,
|
||||
[0,180/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_g3sg1 =
|
||||
{
|
||||
.name = "g3sg1",
|
||||
.id = ITEM_G3SG1,
|
||||
.slot = 0,
|
||||
.slot_pos = 13,
|
||||
.weight = 25,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_g3sg1_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_g3sg1_primary,
|
||||
.secondary = w_g3sg1_secondary,
|
||||
.reload = w_g3sg1_reload,
|
||||
.release = w_g3sg1_release,
|
||||
.postdraw = w_g3sg1_hud,
|
||||
.precache = w_g3sg1_precache,
|
||||
.pickup = w_g3sg1_pickup,
|
||||
.updateammo = w_g3sg1_updateammo,
|
||||
.wmodel = w_g3sg1_wmodel,
|
||||
.pmodel = w_g3sg1_pmodel,
|
||||
.deathmsg = w_g3sg1_deathmsg,
|
||||
.aimanim = w_g3sg1_aimanim,
|
||||
.hudpic = w_g3sg1_hudpic,
|
||||
.type = csweapon_ranged_type,
|
||||
.isempty = w_g3sg1_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_g3sg1(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_G3SG1);
|
||||
}
|
||||
#endif
|
|
@ -1,395 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_glock18 (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
Glock 18 Select Fire Weapon
|
||||
|
||||
Default arsenal for Terrorists
|
||||
|
||||
- Buy Menu -
|
||||
Price: $400
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_glock18.mdl"
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
GLOCK_IDLE1,
|
||||
GLOCK_IDLE2,
|
||||
GLOCK_IDLE3,
|
||||
GLOCK_SHOOT_BURST1,
|
||||
GLOCK_SHOOT_BURST2,
|
||||
GLOCK_SHOOT,
|
||||
GLOCK_SHOOT_EMPTY,
|
||||
GLOCK_RELOAD1,
|
||||
GLOCK_DRAW1,
|
||||
GLOCK_UNUSED1,
|
||||
GLOCK_UNUSED2,
|
||||
GLOCK_DRAW2,
|
||||
GLOCK_RELOAD2
|
||||
};
|
||||
|
||||
void
|
||||
w_glock18_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_glock18.fire");
|
||||
Sound_Precache("weapon_glock18.burstfire");
|
||||
precache_model("models/w_glock18.mdl");
|
||||
#else
|
||||
precache_model("models/v_glock18.mdl");
|
||||
precache_model("models/p_glock18.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_glock18_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.glock18_mag, pl.ammo_9mm, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_glock18_wmodel(void)
|
||||
{
|
||||
return "models/w_glock18.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_glock18_pmodel(player pl)
|
||||
{
|
||||
return "models/p_glock18.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_glock18_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_glock18_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (new) {
|
||||
if (startammo == -1)
|
||||
pl.glock18_mag = 20;
|
||||
else
|
||||
pl.glock18_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_9mm < AMMO_MAX_9MM) {
|
||||
pl.ammo_9mm = bound(0, pl.ammo_9mm + 20, AMMO_MAX_9MM);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_glock18_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_glock18.mdl");
|
||||
|
||||
int r = (float)input_sequence % 2;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, GLOCK_DRAW1);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, GLOCK_DRAW2);
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 8;
|
||||
pl.cs_cross_deltadist = 3;
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_glock18_primary(player pl)
|
||||
{
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.gflags & GF_SEMI_TOGGLED)
|
||||
return;
|
||||
if (!pl.glock18_mag)
|
||||
return;
|
||||
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, (pl.mode_glock18) ? 75 : 120,1.2);
|
||||
int shotcount = (pl.mode_glock18) ? 3 : 1;
|
||||
int dmg = 0;
|
||||
|
||||
/* fix shotcount if we're < 3 in burst mode */
|
||||
if (pl.glock18_mag < 3 && pl.mode_glock18)
|
||||
shotcount = pl.glock18_mag;
|
||||
|
||||
for (int i = 0; i < shotcount; i ++) {
|
||||
|
||||
|
||||
accuracy += 0.0035;
|
||||
pl.glock18_mag--;
|
||||
#ifdef SERVER
|
||||
dmg = Skill_GetValue("plr_glock18_dmg", 25);
|
||||
TraceAttack_SetRangeModifier(1.25); /* penetrates 9 units, but not 10 */
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
Cstrike_BulletRecoil_ApplyPre(pl,0.6);
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_GLOCK18, "Impact.BigShot");
|
||||
Cstrike_BulletRecoil_ApplyPost(pl,0.6);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (pl.mode_glock18) {
|
||||
int r = (float)input_sequence % 2;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, GLOCK_SHOOT_BURST1);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, GLOCK_SHOOT_BURST2);
|
||||
break;
|
||||
}
|
||||
pl.w_attack_next = 0.5f;
|
||||
} else {
|
||||
if (pl.glock18_mag <= 0) {
|
||||
Weapons_ViewAnimation(pl, GLOCK_SHOOT_EMPTY);
|
||||
} else {
|
||||
Weapons_ViewAnimation(pl, GLOCK_SHOOT);
|
||||
}
|
||||
pl.w_attack_next = 0.13f;
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_ONEHAND, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_ONEHAND, 0.45f);
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
View_AddEvent(w_pistol_ejectshell, 0.0f);
|
||||
#else
|
||||
if (pl.mode_glock18) {
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_glock18.burstfire");
|
||||
} else {
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_glock18.fire");
|
||||
}
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 2, .7,accuracy);
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
pl.w_idle_next = pl.w_attack_next + 1.0f;
|
||||
}
|
||||
|
||||
void
|
||||
w_glock18_secondary(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* toggle burst-fire */
|
||||
pl.mode_glock18 = 1 - pl.mode_glock18;
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.mode_glock18) {
|
||||
CSQC_Parse_CenterPrint("Switched to Burst-Fire mode");
|
||||
} else {
|
||||
CSQC_Parse_CenterPrint("Switched to Semi-Automatic mode");
|
||||
}
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 0.5f;
|
||||
pl.w_idle_next = pl.w_attack_next + 1.0f;
|
||||
}
|
||||
|
||||
void
|
||||
w_glock18_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.glock18_mag >= 20)
|
||||
return;
|
||||
if (!pl.ammo_9mm)
|
||||
return;
|
||||
|
||||
int r = (float)input_sequence % 2;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, GLOCK_RELOAD1);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, GLOCK_RELOAD2);
|
||||
break;
|
||||
}
|
||||
|
||||
pl.w_attack_next = 2.1f;
|
||||
pl.w_idle_next = pl.w_attack_next + 1.0f;
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_weapon_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::glock18_mag, player::ammo_9mm, 20);
|
||||
Cstrike_ShotReset(pl);
|
||||
}
|
||||
|
||||
pl.think = w_weapon_reload_done;
|
||||
pl.nextthink = time + pl.w_attack_next - 0.1f;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_glock18_release(player pl)
|
||||
{
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.glock18_mag == 0 && pl.ammo_9mm > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.w_idle_next)
|
||||
return;
|
||||
|
||||
int r = floor(pseudorandom() * 3);
|
||||
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, GLOCK_IDLE1);
|
||||
pl.w_idle_next = 2.8125f;
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, GLOCK_IDLE2);
|
||||
pl.w_idle_next = 2.25f;
|
||||
break;
|
||||
case 2:
|
||||
Weapons_ViewAnimation(pl, GLOCK_IDLE3);
|
||||
pl.w_idle_next = 2.5f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_glock18_aimanim(player pl)
|
||||
{
|
||||
return w_deagle_aimanim(pl);
|
||||
}
|
||||
|
||||
void
|
||||
w_glock18_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Cstrike_DrawCrosshair();
|
||||
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, [48/256,72/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_glock18_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.glock18_mag <= 0 && pl.ammo_9mm <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_glock18_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (w_glock18_isempty(pl))
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_9mm, AMMO_MAX_9MM, a);
|
||||
|
||||
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
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_glock18 =
|
||||
{
|
||||
.name = "glock18",
|
||||
.id = ITEM_GLOCK18,
|
||||
.slot = 1,
|
||||
.slot_pos = 1,
|
||||
.weight = 5,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_glock18_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_glock18_primary,
|
||||
.secondary = w_glock18_secondary,
|
||||
.reload = w_glock18_reload,
|
||||
.release = w_glock18_release,
|
||||
.postdraw = w_glock18_hud,
|
||||
.precache = w_glock18_precache,
|
||||
.pickup = w_glock18_pickup,
|
||||
.updateammo = w_glock18_updateammo,
|
||||
.wmodel = w_glock18_wmodel,
|
||||
.pmodel = w_glock18_pmodel,
|
||||
.deathmsg = w_glock18_deathmsg,
|
||||
.aimanim = w_glock18_aimanim,
|
||||
.hudpic = w_glock18_hudpic,
|
||||
.type = csweapon_ranged_type,
|
||||
.isempty = w_glock18_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_glock18(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_GLOCK18);
|
||||
}
|
||||
#endif
|
|
@ -1,310 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_hegrenade (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
HE (High Explosive) Grenade Weapon
|
||||
|
||||
When thrown, explodes with a fairly deadly blast radius to players.
|
||||
|
||||
- Buy Menu -
|
||||
Price: $300
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_hegrenade.mdl"
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
HEGRENADE_IDLE,
|
||||
HEGRENADE_PULLPIN,
|
||||
HEGRENADE_THROW,
|
||||
HEGRENADE_DRAW,
|
||||
};
|
||||
|
||||
void
|
||||
w_hegrenade_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_hegrenade.bounce");
|
||||
Sound_Precache("weapon_hegrenade.explode");
|
||||
precache_model("models/w_hegrenade.mdl");
|
||||
#else
|
||||
precache_model("models/v_hegrenade.mdl");
|
||||
precache_model("models/p_hegrenade.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_hegrenade_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_hegrenade, pl.mode_temp);
|
||||
}
|
||||
|
||||
int
|
||||
w_hegrenade_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (pl.ammo_hegrenade < AMMO_MAX_HENADE) {
|
||||
pl.ammo_hegrenade = bound(0, pl.ammo_hegrenade + 1, AMMO_MAX_HENADE);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
string
|
||||
w_hegrenade_wmodel(void)
|
||||
{
|
||||
return "models/w_hegrenade.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_hegrenade_pmodel(player pl)
|
||||
{
|
||||
return "models/p_hegrenade.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_hegrenade_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void
|
||||
w_hegrenade_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_hegrenade.mdl");
|
||||
Weapons_ViewAnimation(pl, HEGRENADE_DRAW);
|
||||
pl.mode_temp = 0;
|
||||
|
||||
#ifdef CLIENT
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
w_hegrenade_throw(player pl)
|
||||
{
|
||||
static void hegrenade_explode(void)
|
||||
{
|
||||
float dmg = 100;
|
||||
pointparticles(particleeffectnum("fx_explosion.main"), self.origin, [0,0,0], 1);
|
||||
Damage_Radius(self.origin, self.owner, dmg, dmg * 2.5f, TRUE, WEAPON_HEGRENADE);
|
||||
Sound_Play(self, CHAN_BODY, "weapon_hegrenade.explode");
|
||||
remove(self);
|
||||
}
|
||||
|
||||
static void hegrenade_touch(void)
|
||||
{
|
||||
if (other.takedamage == DAMAGE_YES) {
|
||||
Damage_Apply(other, self.owner, 15, WEAPON_HEGRENADE, DMG_BLUNT);
|
||||
} else {
|
||||
Sound_Play(self, CHAN_BODY, "weapon_hegrenade.bounce");
|
||||
}
|
||||
self.frame = 0;
|
||||
}
|
||||
|
||||
vector vPLAngle = pl.v_angle;
|
||||
if (vPLAngle[0] < 0) {
|
||||
vPLAngle[0] = -10 + vPLAngle[0] * ((90 - 10) / 90.0);
|
||||
} else {
|
||||
vPLAngle[0] = -10 + vPLAngle[0] * ((90 + 10) / 90.0);
|
||||
}
|
||||
|
||||
float flVel = (90 - vPLAngle[0]) * 5;
|
||||
if (flVel > 1000) {
|
||||
flVel = 1000;
|
||||
}
|
||||
|
||||
makevectors(vPLAngle);
|
||||
vector vecSrc = pl.origin + pl.view_ofs + v_forward * 16;
|
||||
vector vecThrow = v_forward * flVel + pl.velocity;
|
||||
|
||||
entity eGrenade = spawn();
|
||||
eGrenade.owner = pl;
|
||||
eGrenade.classname = "remove_me";
|
||||
eGrenade.solid = SOLID_BBOX;
|
||||
eGrenade.frame = 1;
|
||||
eGrenade.velocity = vecThrow;
|
||||
eGrenade.movetype = MOVETYPE_BOUNCE;
|
||||
eGrenade.think = hegrenade_explode;
|
||||
eGrenade.touch = hegrenade_touch;
|
||||
eGrenade.nextthink = time + 4.0f;
|
||||
setmodel(eGrenade, "models/w_hegrenade.mdl");
|
||||
setsize(eGrenade, [0,0,0], [0,0,0]);
|
||||
setorigin(eGrenade, vecSrc);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
w_hegrenade_primary(player pl)
|
||||
{
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* We're abusing this network variable for the holding check */
|
||||
if (pl.mode_temp > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
if (pl.ammo_hegrenade <= 0) {
|
||||
#ifdef SERVER
|
||||
Weapons_RemoveItem(pl, WEAPON_HEGRENADE);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_ViewAnimation(pl, HEGRENADE_PULLPIN);
|
||||
|
||||
pl.mode_temp = 1;
|
||||
pl.w_attack_next = 0.975f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_hegrenade_release(player pl)
|
||||
{
|
||||
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.mode_temp == 1) {
|
||||
pl.ammo_hegrenade--;
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(pl, HEGRENADE_THROW);
|
||||
#else
|
||||
w_hegrenade_throw(pl);
|
||||
#endif
|
||||
pl.mode_temp = 2;
|
||||
pl.w_attack_next = 1.0f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
} else if (pl.mode_temp == 2) {
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(pl, HEGRENADE_DRAW);
|
||||
#else
|
||||
if (!pl.ammo_hegrenade) {
|
||||
Weapons_RemoveItem(pl, WEAPON_HEGRENADE);
|
||||
}
|
||||
#endif
|
||||
pl.w_attack_next = 0.5f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
pl.mode_temp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_hegrenade_aimanim(player pl)
|
||||
{
|
||||
return w_flashbang_aimanim(pl);
|
||||
}
|
||||
|
||||
void
|
||||
w_hegrenade_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/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_hegrenade_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.ammo_hegrenade <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_hegrenade_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_hegrenade, AMMO_MAX_HENADE, a);
|
||||
|
||||
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
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_hegrenade =
|
||||
{
|
||||
.name = "hegrenade",
|
||||
.id = ITEM_HEGRENADE,
|
||||
.slot = 3,
|
||||
.slot_pos = 0,
|
||||
.allow_drop = FALSE,
|
||||
.draw = w_hegrenade_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_hegrenade_primary,
|
||||
.secondary = __NULL__,
|
||||
.reload = __NULL__,
|
||||
.release = w_hegrenade_release,
|
||||
.postdraw = w_hegrenade_hud,
|
||||
.precache = w_hegrenade_precache,
|
||||
.pickup = w_hegrenade_pickup,
|
||||
.updateammo = w_hegrenade_updateammo,
|
||||
.wmodel = w_hegrenade_wmodel,
|
||||
.pmodel = w_hegrenade_pmodel,
|
||||
.deathmsg = w_hegrenade_deathmsg,
|
||||
.aimanim = w_hegrenade_aimanim,
|
||||
.hudpic = w_hegrenade_hudpic,
|
||||
.isempty = w_hegrenade_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_hegrenade(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_HEGRENADE);
|
||||
}
|
||||
#endif
|
|
@ -1,323 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_knife (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
Knife Weapon
|
||||
|
||||
Default arsenal on both teams
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_knife.mdl"
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
KNIFE_IDLE1,
|
||||
KNIFE_SLASH1,
|
||||
KNIFE_SLASH2,
|
||||
KNIFE_DRAW,
|
||||
KNIFE_STAB,
|
||||
KNIFE_STAB_MISS,
|
||||
KNIFE_MIDSLASH1,
|
||||
KNIFE_MIDSLASH2
|
||||
};
|
||||
|
||||
void
|
||||
w_knife_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_knife.hit");
|
||||
Sound_Precache("weapon_knife.hitbody");
|
||||
Sound_Precache("weapon_knife.hithard");
|
||||
Sound_Precache("weapon_knife.miss");
|
||||
precache_model("models/w_knife.mdl");
|
||||
#else
|
||||
precache_model("models/v_knife.mdl");
|
||||
precache_model("models/p_knife.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_knife_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, -1, -1, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_knife_wmodel(void)
|
||||
{
|
||||
return "models/w_knife.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_knife_pmodel(player pl)
|
||||
{
|
||||
return "models/p_knife.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_knife_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void
|
||||
w_knife_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_knife.mdl");
|
||||
Weapons_ViewAnimation(pl, KNIFE_DRAW);
|
||||
|
||||
#ifdef CLIENT
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_knife_primary(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
pl.w_attack_next = 0.7f;
|
||||
|
||||
int r = (float)input_sequence % 2;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, KNIFE_SLASH1);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, KNIFE_SLASH2);
|
||||
break;
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_KNIFE, 1.33f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_KNIFE, 1.33f);
|
||||
|
||||
#ifdef SERVER
|
||||
vector src;
|
||||
int range = Skill_GetValue("plr_knife_range", 48);
|
||||
|
||||
Weapons_MakeVectors(pl);
|
||||
src = pl.origin + pl.view_ofs;
|
||||
traceline(src, src + (v_forward * range), MOVE_HITMODEL, pl);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_knife.miss");
|
||||
|
||||
if (trace_fraction >= 1.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (trace_ent.iBleeds) {
|
||||
FX_Blood(trace_endpos, [1,0,0]);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_knife.hitbody");
|
||||
} else {
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_knife.hit");
|
||||
}
|
||||
|
||||
/* let's calculate damage! */
|
||||
if (trace_ent.takedamage) {
|
||||
/* values taken from https://counterstrike.fandom.com/wiki/Knife */
|
||||
int dmg = 0;
|
||||
|
||||
switch (trace_surface_id) {
|
||||
case BODY_HEAD:
|
||||
dmg = Skill_GetValue("plr_knife_dmghead", 60);
|
||||
break;
|
||||
case BODY_STOMACH:
|
||||
dmg = Skill_GetValue("plr_knife_dmgstomach", 18);
|
||||
break;
|
||||
case BODY_LEGLEFT:
|
||||
case BODY_LEGRIGHT:
|
||||
dmg = Skill_GetValue("plr_knife_dmglegs", 11);
|
||||
break;
|
||||
case BODY_CHEST:
|
||||
dmg = Skill_GetValue("plr_knife_dmgchest", 15);
|
||||
break;
|
||||
case BODY_ARMLEFT:
|
||||
case BODY_ARMRIGHT:
|
||||
dmg = Skill_GetValue("plr_knife_dmgarms", 15);
|
||||
break;
|
||||
case BODY_DEFAULT:
|
||||
default:
|
||||
dmg = Skill_GetValue("plr_knife_dmg", 15);
|
||||
break;
|
||||
}
|
||||
Damage_Apply(trace_ent, pl, dmg, WEAPON_KNIFE, DMG_SLASH);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_knife_secondary(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
pl.w_attack_next = 1.2f;
|
||||
|
||||
|
||||
Weapons_ViewAnimation(pl, KNIFE_STAB);
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_KNIFE, 1.33f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_KNIFE, 1.33f);
|
||||
|
||||
#ifdef SERVER
|
||||
vector src;
|
||||
int range = Skill_GetValue("plr_knife_altrange", 48);
|
||||
|
||||
Weapons_MakeVectors(pl);
|
||||
src = pl.origin + pl.view_ofs;
|
||||
traceline(src, src + (v_forward * range), MOVE_HITMODEL, pl);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_knife.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]);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_knife.hitbody");
|
||||
} else {
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_knife.hit");
|
||||
}
|
||||
|
||||
/* let's calculate damage! */
|
||||
if (trace_ent.takedamage) {
|
||||
/* values taken from https://counterstrike.fandom.com/wiki/Knife */
|
||||
int dmg = 0;
|
||||
switch (trace_surface_id) {
|
||||
case BODY_HEAD:
|
||||
dmg = Skill_GetValue("plr_knife_altdmghead", 260);
|
||||
break;
|
||||
case BODY_STOMACH:
|
||||
dmg = Skill_GetValue("plr_knife_altdmgstomach", 81);
|
||||
break;
|
||||
case BODY_LEGLEFT:
|
||||
case BODY_LEGRIGHT:
|
||||
dmg = Skill_GetValue("plr_knife_altdmglegs", 48);
|
||||
break;
|
||||
case BODY_CHEST:
|
||||
dmg = Skill_GetValue("plr_knife_altdmgchest", 65);
|
||||
break;
|
||||
case BODY_ARMLEFT:
|
||||
case BODY_ARMRIGHT:
|
||||
dmg = Skill_GetValue("plr_knife_altdmgarms", 65);
|
||||
break;
|
||||
case BODY_DEFAULT:
|
||||
default:
|
||||
dmg = Skill_GetValue("plr_knife_altdmg", 65);
|
||||
break;
|
||||
}
|
||||
|
||||
/* secondary can do a backstab */
|
||||
if (trace_ent.classname == "player") {
|
||||
player otherpl = (player)trace_ent;
|
||||
if (otherpl.IsFacing(pl) == false) {
|
||||
dmg *= 3;
|
||||
}
|
||||
}
|
||||
|
||||
Damage_Apply(trace_ent, pl, dmg, WEAPON_KNIFE, DMG_SLASH);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
float
|
||||
w_knife_aimanim(player pl)
|
||||
{
|
||||
return pl.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_KNIFE : ANIM_AIM_KNIFE;
|
||||
}
|
||||
|
||||
int
|
||||
w_knife_isempty(player pl)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_knife_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud11_spr,
|
||||
[0,135/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud10_spr,
|
||||
[0,135/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_knife =
|
||||
{
|
||||
.name = "knife",
|
||||
.id = ITEM_KNIFE,
|
||||
.slot = 2,
|
||||
.slot_pos = 0,
|
||||
.allow_drop = FALSE,
|
||||
.draw = w_knife_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_knife_primary,
|
||||
.secondary = w_knife_secondary,
|
||||
.reload = __NULL__,
|
||||
.release = __NULL__,
|
||||
.postdraw = __NULL__,
|
||||
.precache = w_knife_precache,
|
||||
.pickup = __NULL__,
|
||||
.updateammo = w_knife_updateammo,
|
||||
.wmodel = w_knife_wmodel,
|
||||
.pmodel = w_knife_pmodel,
|
||||
.deathmsg = w_knife_deathmsg,
|
||||
.aimanim = w_knife_aimanim,
|
||||
.hudpic = w_knife_hudpic,
|
||||
.type = csweapon_melee_type,
|
||||
.isempty = w_knife_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_knife(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_KNIFE);
|
||||
}
|
||||
#endif
|
|
@ -1,378 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_m3 (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
Benneli M3 Super90 Weapon
|
||||
|
||||
- Buy Menu -
|
||||
Price: $1700
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_m3.mdl"
|
||||
*/
|
||||
|
||||
#ifdef CLIENT
|
||||
void
|
||||
w_m3_ejectshell(void)
|
||||
{
|
||||
static void w_m3_ejectshell_death(void) {
|
||||
remove(self);
|
||||
}
|
||||
static void w_m3_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] + 20, 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_m3_ejectshell_touch;
|
||||
|
||||
eShell.avelocity = [0,45,900];
|
||||
eShell.think = w_m3_ejectshell_death;
|
||||
eShell.renderflags |= RF_DEPTHHACK;
|
||||
eShell.nextthink = time + 2.5f;
|
||||
setsize(eShell, [0,0,0], [0,0,0]);
|
||||
setorigin(eShell, pSeat->m_eViewModel.origin + (v_forward * 10) + (v_right * 10) + (v_up * -8));
|
||||
}
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
M3_IDLE,
|
||||
M3_SHOOT1,
|
||||
M3_SHOOT2,
|
||||
M3_INSERT,
|
||||
M3_RELOAD_END,
|
||||
M3_RELOAD_START,
|
||||
M3_DRAW
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
M3S_IDLE,
|
||||
M3S_RELOAD_START,
|
||||
M3S_RELOAD,
|
||||
M3S_RELOAD_END
|
||||
};
|
||||
|
||||
void
|
||||
w_m3_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_m3.fire");
|
||||
precache_model("models/w_m3.mdl");
|
||||
#else
|
||||
precache_model("models/v_m3.mdl");
|
||||
precache_model("models/p_m3.mdl");
|
||||
Sound_Precache("modelevent_shotgunshell.land");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_m3_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.m3_mag, pl.ammo_buckshot, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_m3_wmodel(void)
|
||||
{
|
||||
return "models/w_m3.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_m3_pmodel(player pl)
|
||||
{
|
||||
return "models/p_m3.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_m3_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_m3_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (new) {
|
||||
if (startammo == -1)
|
||||
pl.m3_mag = 8;
|
||||
else
|
||||
pl.m3_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_buckshot < AMMO_MAX_BUCKSHOT) {
|
||||
pl.ammo_buckshot = bound(0, pl.ammo_buckshot + 8, AMMO_MAX_BUCKSHOT);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_m3_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_m3.mdl");
|
||||
Weapons_ViewAnimation(pl, M3_DRAW);
|
||||
pl.mode_temp = 0;
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 8;
|
||||
pl.cs_cross_deltadist = 6;
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_m3_release(player pl);
|
||||
|
||||
void
|
||||
w_m3_primary(player pl)
|
||||
{
|
||||
int dmg = 0;
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
w_m3_release(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
/* interrupt reloading if no longer empty */
|
||||
if (pl.mode_temp == M3S_RELOAD && pl.m3_mag >= 1) {
|
||||
pl.mode_temp = M3S_RELOAD_END;
|
||||
w_m3_release(pl);
|
||||
return;
|
||||
} else if (pl.mode_temp > M3S_IDLE) {
|
||||
w_m3_release(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
if (pl.m3_mag <= 0) {
|
||||
w_m3_release(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
pl.m3_mag--;
|
||||
|
||||
int r = (float)input_sequence % 2;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, M3_SHOOT1);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, M3_SHOOT2);
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
View_AddEvent(w_m3_ejectshell, 0.6f);
|
||||
#else
|
||||
dmg = Skill_GetValue("plr_m3_dmg", 26);
|
||||
TraceAttack_SetPenetrationPower(0); /* shotties can't wallbang?! */
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_SHOTGUN, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_SHOTGUN, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_m3.fire");
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
Cstrike_ShotMultiplierAdd(pl, 1, 1,1);
|
||||
pl.punchangle[0] = -4 * (9 / 6);
|
||||
#ifdef SERVER
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [random(-1,1) * 0.1,random(-1,1) * 0.05], WEAPON_M3, "Impact.BigShot");
|
||||
#endif
|
||||
}
|
||||
|
||||
pl.w_attack_next = 1.0f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_m3_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.m3_mag >= 8) {
|
||||
return;
|
||||
}
|
||||
if (pl.ammo_buckshot <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.mode_temp > M3S_IDLE) {
|
||||
return;
|
||||
}
|
||||
pl.mode_temp = M3S_RELOAD_START;
|
||||
pl.w_idle_next = 0.0f;
|
||||
}
|
||||
|
||||
void
|
||||
w_m3_release(player pl)
|
||||
{
|
||||
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.mode_temp == M3S_IDLE && pl.m3_mag == 0 && pl.ammo_buckshot > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.mode_temp == M3S_RELOAD_START) {
|
||||
Weapons_ViewAnimation(pl, M3_RELOAD_START);
|
||||
pl.mode_temp = M3S_RELOAD;
|
||||
pl.w_idle_next = 0.65f;
|
||||
} else if (pl.mode_temp == M3S_RELOAD) {
|
||||
Weapons_ViewAnimation(pl, M3_INSERT);
|
||||
pl.m3_mag++;
|
||||
pl.ammo_buckshot--;
|
||||
w_m3_updateammo(pl);
|
||||
if (pl.ammo_buckshot <= 0 || pl.m3_mag >= 8) {
|
||||
pl.mode_temp = M3S_RELOAD_END;
|
||||
}
|
||||
pl.w_idle_next = 0.5f;
|
||||
} else if (pl.mode_temp == M3S_RELOAD_END) {
|
||||
Weapons_ViewAnimation(pl, M3_RELOAD_END);
|
||||
pl.mode_temp = M3S_IDLE;
|
||||
pl.w_idle_next = 10.0f;
|
||||
pl.w_attack_next = 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_m3_aimanim(player pl)
|
||||
{
|
||||
return w_ak47_aimanim(pl);
|
||||
}
|
||||
|
||||
void
|
||||
w_m3_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Cstrike_DrawCrosshair();
|
||||
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, [0,72/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_m3_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.m3_mag <= 0 && pl.ammo_buckshot <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_m3_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (w_m3_isempty(pl))
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_buckshot, AMMO_MAX_BUCKSHOT, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud4_spr,
|
||||
[0,135/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud1_spr,
|
||||
[0,135/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_m3 =
|
||||
{
|
||||
.name = "m3",
|
||||
.id = ITEM_M3,
|
||||
.slot = 0,
|
||||
.slot_pos = 0,
|
||||
.weight = 20,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_m3_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_m3_primary,
|
||||
.secondary = __NULL__,
|
||||
.reload = w_m3_reload,
|
||||
.release = w_m3_release,
|
||||
.postdraw = w_m3_hud,
|
||||
.precache = w_m3_precache,
|
||||
.pickup = w_m3_pickup,
|
||||
.updateammo = w_m3_updateammo,
|
||||
.wmodel = w_m3_wmodel,
|
||||
.pmodel = w_m3_pmodel,
|
||||
.deathmsg = w_m3_deathmsg,
|
||||
.aimanim = w_m3_aimanim,
|
||||
.hudpic = w_m3_hudpic,
|
||||
.type = csweapon_ranged_type,
|
||||
.isempty = w_m3_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_m3(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_M3);
|
||||
}
|
||||
#endif
|
|
@ -1,383 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_m4a1 (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
Colt M4A1 Carbine Weapon
|
||||
|
||||
- Buy Menu -
|
||||
Price: $3100
|
||||
Counter-Terrorists only weapon
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_m4a1.mdl"
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
M4A1_IDLE,
|
||||
M4A1_SHOOT1,
|
||||
M4A1_SHOOT2,
|
||||
M4A1_SHOOT3,
|
||||
M4A1_RELOAD,
|
||||
M4A1_DRAW,
|
||||
M4A1_ADDSIL,
|
||||
M4A1_IDLEUNSIL,
|
||||
M4A1_SHOOT1UNSIL,
|
||||
M4A1_SHOOT2UNSIL,
|
||||
M4A1_SHOOT3UNSIL,
|
||||
M4A1_RELOADUNSIL,
|
||||
M4A1_DRAWUNSIL,
|
||||
M4A1_DETACHSIL
|
||||
};
|
||||
|
||||
void
|
||||
w_m4a1_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_m4a1.fire");
|
||||
Sound_Precache("weapon_m4a1.silenced");
|
||||
precache_model("models/w_m4a1.mdl");
|
||||
#else
|
||||
precache_model("models/v_m4a1.mdl");
|
||||
precache_model("models/p_m4a1.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_m4a1_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.m4a1_mag, pl.ammo_556mm, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_m4a1_wmodel(void)
|
||||
{
|
||||
return "models/w_m4a1.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_m4a1_pmodel(player pl)
|
||||
{
|
||||
return "models/p_m4a1.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_m4a1_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_m4a1_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Cstrike_ShotMultiplierUpdate(pl);
|
||||
if (new) {
|
||||
if (startammo == -1)
|
||||
pl.m4a1_mag = 30;
|
||||
else
|
||||
pl.m4a1_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_556mm < AMMO_MAX_556MM) {
|
||||
pl.ammo_556mm = bound(0, pl.ammo_556mm + 30, AMMO_MAX_556MM);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_m4a1_draw(player pl)
|
||||
{
|
||||
|
||||
Weapons_SetModel("models/v_m4a1.mdl");
|
||||
|
||||
if (pl.mode_m4a1 == 1) {
|
||||
Weapons_ViewAnimation(pl, M4A1_DRAW);
|
||||
} else {
|
||||
Weapons_ViewAnimation(pl, M4A1_DRAWUNSIL);
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 4;
|
||||
pl.cs_cross_deltadist = 3;
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_m4a1_primary(player pl)
|
||||
{
|
||||
int dmg = 0;
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
if (!pl.m4a1_mag) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 60, 3);
|
||||
// accuracy += pl.cs_shotmultiplier*pl.cs_shotmultiplier / 500;
|
||||
pl.m4a1_mag--;
|
||||
|
||||
int r = (float)input_sequence % 3;
|
||||
if (pl.mode_m4a1 == 1) {
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, M4A1_SHOOT1);
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, M4A1_SHOOT2);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, M4A1_SHOOT3);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, M4A1_SHOOT1UNSIL);
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, M4A1_SHOOT2UNSIL);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, M4A1_SHOOT3UNSIL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
/* actual firing */
|
||||
#ifdef CLIENT
|
||||
if (pl.mode_m4a1 == 1) {
|
||||
View_SetMuzzleflash(0);
|
||||
} else {
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
}
|
||||
View_AddEvent(w_rifle_ejectshell, 0.0f);
|
||||
#else
|
||||
/* Different sounds without silencer */
|
||||
if (pl.mode_m4a1 == 1) {
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_m4a1.silenced");
|
||||
} else {
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_m4a1.fire");
|
||||
}
|
||||
|
||||
dmg = Skill_GetValue("plr_m4a1_dmg", 33);
|
||||
TraceAttack_SetRangeModifier(2.125);
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
Cstrike_BulletRecoil_ApplyPre(pl,.96f);
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_M4A1, "Impact.BigShot");
|
||||
Cstrike_BulletRecoil_ApplyPost(pl,.96f);
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 0.8f, 1.025f,accuracy*0.8);
|
||||
pl.w_attack_next = 0.0875f;
|
||||
pl.w_idle_next = 2.0f;
|
||||
}
|
||||
|
||||
void
|
||||
w_m4a1_secondary(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* toggle silencer */
|
||||
pl.mode_m4a1 = 1 - pl.mode_m4a1;
|
||||
|
||||
/* play the animation */
|
||||
if (pl.mode_m4a1) {
|
||||
Weapons_ViewAnimation(pl, M4A1_ADDSIL);
|
||||
} else {
|
||||
Weapons_ViewAnimation(pl, M4A1_DETACHSIL);
|
||||
}
|
||||
|
||||
pl.w_attack_next = 2.0f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_m4a1_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.m4a1_mag >= 30)
|
||||
return;
|
||||
if (!pl.ammo_556mm)
|
||||
return;
|
||||
Cstrike_ShotMultiplierUpdate(pl);
|
||||
|
||||
if (pl.mode_m4a1 == 1)
|
||||
Weapons_ViewAnimation(pl, M4A1_RELOAD);
|
||||
else
|
||||
Weapons_ViewAnimation(pl, M4A1_RELOADUNSIL);
|
||||
|
||||
pl.w_attack_next = 3.1f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_weapon_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::m4a1_mag, player::ammo_556mm, 30);
|
||||
Cstrike_ShotReset(pl);
|
||||
}
|
||||
|
||||
pl.think = w_weapon_reload_done;
|
||||
pl.nextthink = time + pl.w_attack_next - 0.1f;
|
||||
#endif
|
||||
}
|
||||
|
||||
float
|
||||
w_m4a1_aimanim(player pl)
|
||||
{
|
||||
return pl.flags & FL_CROUCHING ? ANIM_CROUCH_AIM_RIFLE : ANIM_AIM_RIFLE;
|
||||
}
|
||||
|
||||
void
|
||||
w_m4a1_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Cstrike_DrawCrosshair();
|
||||
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, [0,96/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_m4a1_release(player pl)
|
||||
{
|
||||
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.m4a1_mag == 0 && pl.ammo_556mm > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.mode_m4a1) {
|
||||
Weapons_ViewAnimation(pl, M4A1_IDLE);
|
||||
} else {
|
||||
Weapons_ViewAnimation(pl, M4A1_IDLEUNSIL);
|
||||
}
|
||||
pl.w_idle_next = 5.0f;
|
||||
}
|
||||
|
||||
int
|
||||
w_m4a1_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.m4a1_mag <= 0 && pl.ammo_556mm <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_m4a1_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (w_m4a1_isempty(pl))
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_556mm, AMMO_MAX_556MM, a);
|
||||
|
||||
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
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_m4a1 =
|
||||
{
|
||||
.name = "m4a1",
|
||||
.id = ITEM_M4A1,
|
||||
.slot = 0,
|
||||
.slot_pos = 9,
|
||||
.weight = 25,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_m4a1_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_m4a1_primary,
|
||||
.secondary = w_m4a1_secondary,
|
||||
.reload = w_m4a1_reload,
|
||||
.release = w_m4a1_release,
|
||||
.postdraw = w_m4a1_hud,
|
||||
.precache = w_m4a1_precache,
|
||||
.pickup = w_m4a1_pickup,
|
||||
.updateammo = w_m4a1_updateammo,
|
||||
.wmodel = w_m4a1_wmodel,
|
||||
.pmodel = w_m4a1_pmodel,
|
||||
.deathmsg = w_m4a1_deathmsg,
|
||||
.aimanim = w_m4a1_aimanim,
|
||||
.hudpic = w_m4a1_hudpic,
|
||||
.type = csweapon_ranged_type,
|
||||
.isempty = w_m4a1_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_m4a1(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_M4A1);
|
||||
}
|
||||
#endif
|
|
@ -1,304 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_mac10 (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
Ingram MAC-10 Weapon
|
||||
|
||||
- Buy Menu -
|
||||
Price: $1400
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_mac10.mdl"
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
MAC10_IDLE,
|
||||
MAC10_RELOAD,
|
||||
MAC10_DRAW,
|
||||
MAC10_SHOOT1,
|
||||
MAC10_SHOOT2,
|
||||
MAC10_SHOOT3
|
||||
};
|
||||
|
||||
void
|
||||
w_mac10_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_mac10.fire");
|
||||
precache_model("models/w_mac10.mdl");
|
||||
#else
|
||||
precache_model("models/v_mac10.mdl");
|
||||
precache_model("models/p_mac10.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_mac10_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.mac10_mag, pl.ammo_45acp, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_mac10_wmodel(void)
|
||||
{
|
||||
return "models/w_mac10.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_mac10_pmodel(player pl)
|
||||
{
|
||||
return "models/p_mac10.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_mac10_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_mac10_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (new) {
|
||||
if (startammo == -1)
|
||||
pl.mac10_mag = 30;
|
||||
else
|
||||
pl.mac10_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_45acp < AMMO_MAX_45ACP) {
|
||||
pl.ammo_45acp = bound(0, pl.ammo_45acp + 30, AMMO_MAX_45ACP);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_mac10_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_mac10.mdl");
|
||||
Weapons_ViewAnimation(pl, MAC10_DRAW);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 9;
|
||||
pl.cs_cross_deltadist = 3;
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_mac10_primary(player pl)
|
||||
{
|
||||
int dmg = 0;
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
if (!pl.mac10_mag) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 50,0.8)+0.0095f;
|
||||
pl.mac10_mag--;
|
||||
|
||||
int r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, MAC10_SHOOT1);
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, MAC10_SHOOT2);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, MAC10_SHOOT3);
|
||||
break;
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_MP5, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_MP5, 0.45f);
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
View_AddEvent(w_pistol_ejectshell, 0.0f);
|
||||
#else
|
||||
dmg = Skill_GetValue("plr_mac10_dmg", 29);
|
||||
TraceAttack_SetRangeModifier(1.25); /* 9, but not 10 */
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
Cstrike_BulletRecoil_ApplyPre(pl,1.115);
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_MAC10, "Impact.BigShot");
|
||||
Cstrike_BulletRecoil_ApplyPost(pl,1.115);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_mac10.fire");
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 2, 0.7f,accuracy);
|
||||
pl.w_attack_next = 0.07f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_mac10_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.mac10_mag >= 30)
|
||||
return;
|
||||
if (!pl.ammo_45acp)
|
||||
return;
|
||||
|
||||
Weapons_ViewAnimation(pl, MAC10_RELOAD);
|
||||
|
||||
pl.w_attack_next = 3.2f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_weapon_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::mac10_mag, player::ammo_45acp, 30);
|
||||
Cstrike_ShotReset(pl);
|
||||
}
|
||||
|
||||
pl.think = w_weapon_reload_done;
|
||||
pl.nextthink = time + pl.w_attack_next - 0.1f;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_mac10_release(player pl)
|
||||
{
|
||||
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.mac10_mag == 0 && pl.ammo_45acp > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_mac10_aimanim(player pl)
|
||||
{
|
||||
return w_deagle_aimanim(pl);
|
||||
}
|
||||
|
||||
void
|
||||
w_mac10_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Cstrike_DrawCrosshair();
|
||||
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, [96/256,72/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_mac10_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.mac10_mag <= 0 && pl.ammo_45acp <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_mac10_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (w_mac10_isempty(pl))
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_45acp, AMMO_MAX_45ACP, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud15_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud14_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_mac10 =
|
||||
{
|
||||
.name = "mac10",
|
||||
.id = ITEM_MAC10,
|
||||
.slot = 0,
|
||||
.slot_pos = 5,
|
||||
.weight = 25,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_mac10_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_mac10_primary,
|
||||
.secondary = __NULL__,
|
||||
.reload = w_mac10_reload,
|
||||
.release = w_mac10_release,
|
||||
.postdraw = w_mac10_hud,
|
||||
.precache = w_mac10_precache,
|
||||
.pickup = w_mac10_pickup,
|
||||
.updateammo = w_mac10_updateammo,
|
||||
.wmodel = w_mac10_wmodel,
|
||||
.pmodel = w_mac10_pmodel,
|
||||
.deathmsg = w_mac10_deathmsg,
|
||||
.aimanim = w_mac10_aimanim,
|
||||
.hudpic = w_mac10_hudpic,
|
||||
.type = csweapon_ranged_type,
|
||||
.isempty = w_mac10_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_mac10(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_MAC10);
|
||||
}
|
||||
#endif
|
|
@ -1,302 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_mp5navy (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
Heckler & Koch MP5-Navy Weapon
|
||||
|
||||
- Buy Menu -
|
||||
Price: $1500
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_mp5.mdl"
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
MP5_IDLE,
|
||||
MP5_RELOAD,
|
||||
MP5_DRAW,
|
||||
MP5_SHOOT1,
|
||||
MP5_SHOOT2,
|
||||
MP5_SHOOT3
|
||||
};
|
||||
|
||||
void
|
||||
w_mp5_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_mp5.fire");
|
||||
precache_model("models/w_mp5.mdl");
|
||||
#else
|
||||
precache_model("models/v_mp5.mdl");
|
||||
precache_model("models/p_mp5.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_mp5_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.mp5_mag, pl.ammo_9mm, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_mp5_wmodel(void)
|
||||
{
|
||||
return "models/w_mp5.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_mp5_pmodel(player pl)
|
||||
{
|
||||
return "models/p_mp5.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_mp5_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_mp5_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (new) {
|
||||
if (startammo == -1)
|
||||
pl.mp5_mag = 30;
|
||||
else
|
||||
pl.mp5_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_9mm < AMMO_MAX_9MM) {
|
||||
pl.ammo_9mm = bound(0, pl.ammo_9mm + 30, AMMO_MAX_9MM);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_mp5_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_mp5.mdl");
|
||||
Weapons_ViewAnimation(pl, MP5_DRAW);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 5;
|
||||
pl.cs_cross_deltadist = 2;
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_mp5_primary(player pl)
|
||||
{
|
||||
int dmg = 0;
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (!pl.mp5_mag)
|
||||
return;
|
||||
|
||||
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl,60,1.25)+0.0045f;
|
||||
pl.mp5_mag--;
|
||||
|
||||
int r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, MP5_SHOOT1);
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, MP5_SHOOT2);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, MP5_SHOOT3);
|
||||
break;
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_MP5, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_MP5, 0.45f);
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
View_AddEvent(w_pistol_ejectshell, 0.0f);
|
||||
#else
|
||||
dmg = Skill_GetValue("plr_mp5_dmg", 26);
|
||||
TraceAttack_SetRangeModifier(1.25); /* 9 units but not 10 */
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
Cstrike_BulletRecoil_ApplyPre(pl,.825f);
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_MP5, "Impact.BigShot");
|
||||
Cstrike_BulletRecoil_ApplyPost(pl,.825f);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_mp5.fire");
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, .5f, 1.25f,accuracy);
|
||||
pl.w_attack_next = 0.08f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_mp5_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.mp5_mag >= 30)
|
||||
return;
|
||||
if (!pl.ammo_9mm)
|
||||
return;
|
||||
|
||||
Weapons_ViewAnimation(pl, MP5_RELOAD);
|
||||
|
||||
pl.w_attack_next = 2.6f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_weapon_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::mp5_mag, player::ammo_9mm, 30);
|
||||
Cstrike_ShotReset(pl);
|
||||
}
|
||||
|
||||
pl.think = w_weapon_reload_done;
|
||||
pl.nextthink = time + pl.w_attack_next - 0.1f;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_mp5_release(player pl)
|
||||
{
|
||||
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.mp5_mag == 0 && pl.ammo_9mm > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_mp5_aimanim(player pl)
|
||||
{
|
||||
return w_ak47_aimanim(pl);
|
||||
}
|
||||
|
||||
void
|
||||
w_mp5_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Cstrike_DrawCrosshair();
|
||||
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, [48/256,72/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_mp5_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.mp5_mag <= 0 && pl.ammo_9mm <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_mp5_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (w_mp5_isempty(pl))
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_9mm, AMMO_MAX_9MM, a);
|
||||
|
||||
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
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_mp5 =
|
||||
{
|
||||
.name = "mp5navy",
|
||||
.id = ITEM_MP5,
|
||||
.slot = 0,
|
||||
.slot_pos = 2,
|
||||
.weight = 25,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_mp5_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_mp5_primary,
|
||||
.secondary = __NULL__,
|
||||
.reload = w_mp5_reload,
|
||||
.release = w_mp5_release,
|
||||
.postdraw = w_mp5_hud,
|
||||
.precache = w_mp5_precache,
|
||||
.pickup = w_mp5_pickup,
|
||||
.updateammo = w_mp5_updateammo,
|
||||
.wmodel = w_mp5_wmodel,
|
||||
.pmodel = w_mp5_pmodel,
|
||||
.deathmsg = w_mp5_deathmsg,
|
||||
.aimanim = w_mp5_aimanim,
|
||||
.hudpic = w_mp5_hudpic,
|
||||
.type = csweapon_ranged_type,
|
||||
.isempty = w_mp5_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_mp5navy(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_MP5);
|
||||
}
|
||||
#endif
|
|
@ -1,310 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_p228 (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
SIG P228 Weapon
|
||||
|
||||
- Buy Menu -
|
||||
Price: $600
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_p228.mdl"
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
P228_IDLE,
|
||||
P228_SHOOT1,
|
||||
P228_SHOOT2,
|
||||
P228_SHOOT3,
|
||||
P228_SHOOT_EMPTY,
|
||||
P228_RELOAD,
|
||||
P228_DRAW
|
||||
};
|
||||
|
||||
void
|
||||
w_p228_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_p228.fire");
|
||||
precache_model("models/w_p228.mdl");
|
||||
#else
|
||||
precache_model("models/v_p228.mdl");
|
||||
precache_model("models/p_p228.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_p228_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.p228_mag, pl.ammo_357sig, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_p228_wmodel(void)
|
||||
{
|
||||
return "models/w_p228.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_p228_pmodel(player pl)
|
||||
{
|
||||
return "models/p_p228.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_p228_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_p228_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (new) {
|
||||
if (startammo == -1)
|
||||
pl.p228_mag = 13;
|
||||
else
|
||||
pl.p228_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_357sig < AMMO_MAX_357SIG) {
|
||||
pl.ammo_357sig = bound(0, pl.ammo_357sig + 13, AMMO_MAX_357SIG);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_p228_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_p228.mdl");
|
||||
Weapons_ViewAnimation(pl, P228_DRAW);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 8;
|
||||
pl.cs_cross_deltadist = 3;
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_p228_primary(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.gflags & GF_SEMI_TOGGLED)
|
||||
return;
|
||||
if (!pl.p228_mag)
|
||||
return;
|
||||
|
||||
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 200,1.6) + 0.004f;
|
||||
int dmg = 0;
|
||||
pl.p228_mag--;
|
||||
|
||||
if (pl.p228_mag <= 0) {
|
||||
Weapons_ViewAnimation(pl, P228_SHOOT_EMPTY);
|
||||
} else {
|
||||
int r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, P228_SHOOT1);
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, P228_SHOOT2);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, P228_SHOOT3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_ONEHAND, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_ONEHAND, 0.45f);
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
View_AddEvent(w_pistol_ejectshell, 0.0f);
|
||||
#else
|
||||
dmg = Skill_GetValue("plr_p228_dmg", 40);
|
||||
TraceAttack_SetRangeModifier(1.5); /* penetrates 11, but not 12 units */
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
Cstrike_BulletRecoil_ApplyPre(pl,1.05);
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_P228, "Impact.BigShot");
|
||||
Cstrike_BulletRecoil_ApplyPost(pl,1.05);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_p228.fire");
|
||||
#endif
|
||||
Cstrike_ShotMultiplierAdd(pl, 6, 0.5f,accuracy);
|
||||
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
pl.w_attack_next = 0.1425f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_p228_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.p228_mag >= 13)
|
||||
return;
|
||||
if (!pl.ammo_357sig)
|
||||
return;
|
||||
|
||||
Weapons_ViewAnimation(pl, P228_RELOAD);
|
||||
|
||||
pl.w_attack_next = 2.7f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_weapon_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::p228_mag, player::ammo_357sig, 13);
|
||||
Cstrike_ShotReset(pl);
|
||||
}
|
||||
|
||||
pl.think = w_weapon_reload_done;
|
||||
pl.nextthink = time + pl.w_attack_next - 0.1f;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_p228_release(player pl)
|
||||
{
|
||||
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.p228_mag == 0 && pl.ammo_357sig > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_p228_aimanim(player pl)
|
||||
{
|
||||
return w_deagle_aimanim(pl);
|
||||
}
|
||||
|
||||
void
|
||||
w_p228_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Cstrike_DrawCrosshair();
|
||||
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, [120/256,72/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_p228_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.p228_mag <= 0 && pl.ammo_357sig <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_p228_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (w_p228_isempty(pl))
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_357sig, AMMO_MAX_357SIG, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud13_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud12_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_p228 =
|
||||
{
|
||||
.name = "p228",
|
||||
.id = ITEM_P228,
|
||||
.slot = 1,
|
||||
.slot_pos = 3,
|
||||
.weight = 5,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_p228_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_p228_primary,
|
||||
.secondary = __NULL__,
|
||||
.reload = w_p228_reload,
|
||||
.release = w_p228_release,
|
||||
.postdraw = w_p228_hud,
|
||||
.precache = w_p228_precache,
|
||||
.pickup = w_p228_pickup,
|
||||
.updateammo = w_p228_updateammo,
|
||||
.wmodel = w_p228_wmodel,
|
||||
.pmodel = w_p228_pmodel,
|
||||
.deathmsg = w_p228_deathmsg,
|
||||
.aimanim = w_p228_aimanim,
|
||||
.hudpic = w_p228_hudpic,
|
||||
.type = csweapon_ranged_type,
|
||||
.isempty = w_p228_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_p228(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_P228);
|
||||
}
|
||||
#endif
|
|
@ -1,302 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_p90 (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
FN P90 Weapon
|
||||
|
||||
- Buy Menu -
|
||||
Price: $2350
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_p90.mdl"
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
P90_IDLE,
|
||||
P90_RELOAD,
|
||||
P90_DRAW,
|
||||
P90_SHOOT1,
|
||||
P90_SHOOT2,
|
||||
P90_SHOOT3
|
||||
};
|
||||
|
||||
void
|
||||
w_p90_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_p90.fire");
|
||||
precache_model("models/w_p90.mdl");
|
||||
#else
|
||||
precache_model("models/v_p90.mdl");
|
||||
precache_model("models/p_p90.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_p90_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.p90_mag, pl.ammo_57mm, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_p90_wmodel(void)
|
||||
{
|
||||
return "models/w_p90.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_p90_pmodel(player pl)
|
||||
{
|
||||
return "models/p_p90.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_p90_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_p90_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (new) {
|
||||
if (startammo == -1)
|
||||
pl.p90_mag = 50;
|
||||
else
|
||||
pl.p90_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_57mm < AMMO_MAX_57MM) {
|
||||
pl.ammo_57mm = bound(0, pl.ammo_57mm + 50, AMMO_MAX_57MM);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_p90_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_p90.mdl");
|
||||
Weapons_ViewAnimation(pl, P90_DRAW);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 7;
|
||||
pl.cs_cross_deltadist = 3;
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_p90_primary(player pl)
|
||||
{
|
||||
int dmg = 0;
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (!pl.p90_mag)
|
||||
return;
|
||||
|
||||
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 50,1.125)+0.0055;
|
||||
pl.p90_mag--;
|
||||
|
||||
int r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, P90_SHOOT1);
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, P90_SHOOT2);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, P90_SHOOT3);
|
||||
break;
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_MP5, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_MP5, 0.45f);
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
View_AddEvent(w_pistol_ejectshell, 0.0f);
|
||||
#else
|
||||
dmg = Skill_GetValue("plr_p90_dmg", 26);
|
||||
TraceAttack_SetRangeModifier(1.875); /* 9 but not 10 */
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
Cstrike_BulletRecoil_ApplyPre(pl,.9);
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_P90, "Impact.BigShot");
|
||||
Cstrike_BulletRecoil_ApplyPost(pl,.9);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_p90.fire");
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1.1, 1.3,accuracy);
|
||||
pl.w_attack_next = 0.07f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_p90_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.p90_mag >= 50)
|
||||
return;
|
||||
if (!pl.ammo_57mm)
|
||||
return;
|
||||
|
||||
Weapons_ViewAnimation(pl, P90_RELOAD);
|
||||
|
||||
pl.w_attack_next = 3.3f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_weapon_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::p90_mag, player::ammo_57mm, 50);
|
||||
Cstrike_ShotReset(pl);
|
||||
}
|
||||
|
||||
pl.think = w_weapon_reload_done;
|
||||
pl.nextthink = time + pl.w_attack_next - 0.1f;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_p90_release(player pl)
|
||||
{
|
||||
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.p90_mag == 0 && pl.ammo_57mm > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_p90_aimanim(player pl)
|
||||
{
|
||||
return w_ak47_aimanim(pl);
|
||||
}
|
||||
|
||||
void
|
||||
w_p90_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Cstrike_DrawCrosshair();
|
||||
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, [120/256,96/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_p90_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.p90_mag <= 0 && pl.ammo_57mm <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_p90_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (w_p90_isempty(pl))
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_57mm, AMMO_MAX_57MM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud13_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud12_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_p90 =
|
||||
{
|
||||
.name = "p90",
|
||||
.id = ITEM_P90,
|
||||
.slot = 0,
|
||||
.slot_pos = 3,
|
||||
.weight = 26,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_p90_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_p90_primary,
|
||||
.secondary = __NULL__,
|
||||
.reload = w_p90_reload,
|
||||
.release = w_p90_release,
|
||||
.postdraw = w_p90_hud,
|
||||
.precache = w_p90_precache,
|
||||
.pickup = w_p90_pickup,
|
||||
.updateammo = w_p90_updateammo,
|
||||
.wmodel = w_p90_wmodel,
|
||||
.pmodel = w_p90_pmodel,
|
||||
.deathmsg = w_p90_deathmsg,
|
||||
.aimanim = w_p90_aimanim,
|
||||
.hudpic = w_p90_hudpic,
|
||||
.type = csweapon_ranged_type,
|
||||
.isempty = w_p90_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_p90(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_P90);
|
||||
}
|
||||
#endif
|
|
@ -1,299 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_m249 (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
FN M249 Para Weapon
|
||||
|
||||
- Buy Menu -
|
||||
Price: $5750
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_m249.mdl"
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
PARA_IDLE,
|
||||
PARA_SHOOT1,
|
||||
PARA_SHOOT2,
|
||||
PARA_RELOAD,
|
||||
PARA_DRAW
|
||||
};
|
||||
|
||||
void
|
||||
w_para_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_para.fire");
|
||||
precache_model("models/w_m249.mdl");
|
||||
#else
|
||||
precache_model("models/v_m249.mdl");
|
||||
precache_model("models/p_m249.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_para_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.para_mag, pl.ammo_556mmbox, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_para_wmodel(void)
|
||||
{
|
||||
return "models/w_m249.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_para_pmodel(player pl)
|
||||
{
|
||||
return "models/p_m249.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_para_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_para_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (new) {
|
||||
if (startammo == -1)
|
||||
pl.para_mag = 100;
|
||||
else
|
||||
pl.para_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_556mmbox < AMMO_MAX_556MMBOX) {
|
||||
pl.ammo_556mmbox = bound(0, pl.ammo_556mmbox + 100, AMMO_MAX_556MMBOX);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_para_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_m249.mdl");
|
||||
Weapons_ViewAnimation(pl, PARA_DRAW);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 6;
|
||||
pl.cs_cross_deltadist = 3;
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_para_primary(player pl)
|
||||
{
|
||||
int dmg = 0;
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (!pl.para_mag)
|
||||
return;
|
||||
|
||||
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 70, 3);
|
||||
|
||||
pl.para_mag--;
|
||||
|
||||
int r = (float)input_sequence % 2;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, SCOUT_SHOOT1);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, SCOUT_SHOOT2);
|
||||
break;
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_PARA, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_PARA, 0.45f);
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
View_AddEvent(w_rifle_ejectshell, 0.0f);
|
||||
#else
|
||||
dmg = Skill_GetValue("plr_para_dmg", 35);
|
||||
TraceAttack_SetRangeModifier(2.125);
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
Cstrike_BulletRecoil_ApplyPre(pl,1);
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_PARA, "Impact.BigShot");
|
||||
Cstrike_BulletRecoil_ApplyPost(pl,1);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_para.fire");
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1, 1,accuracy);
|
||||
pl.w_attack_next = 0.1f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_para_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.para_mag >= 100)
|
||||
return;
|
||||
if (!pl.ammo_556mmbox)
|
||||
return;
|
||||
|
||||
Weapons_ViewAnimation(pl, PARA_RELOAD);
|
||||
|
||||
pl.w_attack_next = 3.0f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_weapon_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::para_mag, player::ammo_556mmbox, 100);
|
||||
Cstrike_ShotReset(pl);
|
||||
}
|
||||
|
||||
pl.think = w_weapon_reload_done;
|
||||
pl.nextthink = time + pl.w_attack_next - 0.1f;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_para_release(player pl)
|
||||
{
|
||||
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.para_mag == 0 && pl.ammo_556mmbox > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_para_aimanim(player pl)
|
||||
{
|
||||
return w_ak47_aimanim(pl);
|
||||
}
|
||||
|
||||
void
|
||||
w_para_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Cstrike_DrawCrosshair();
|
||||
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, [0,96/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_para_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.para_mag <= 0 && pl.ammo_556mmbox <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_para_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (w_para_isempty(pl))
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_556mmbox, AMMO_MAX_556MMBOX, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud6_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud3_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_para =
|
||||
{
|
||||
.name = "m249",
|
||||
.id = ITEM_PARA,
|
||||
.slot = 0,
|
||||
.slot_pos = 15,
|
||||
.weight = 25,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_para_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_para_primary,
|
||||
.secondary = __NULL__,
|
||||
.reload = w_para_reload,
|
||||
.release = w_para_release,
|
||||
.postdraw = w_para_hud,
|
||||
.precache = w_para_precache,
|
||||
.pickup = w_para_pickup,
|
||||
.updateammo = w_para_updateammo,
|
||||
.wmodel = w_para_wmodel,
|
||||
.pmodel = w_para_pmodel,
|
||||
.deathmsg = w_para_deathmsg,
|
||||
.aimanim = w_para_aimanim,
|
||||
.hudpic = w_para_hudpic,
|
||||
.type = csweapon_ranged_type,
|
||||
.isempty = w_para_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_m249(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_PARA);
|
||||
}
|
||||
#endif
|
|
@ -1,344 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_scout (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
Steyr Scout Weapon
|
||||
|
||||
- Buy Menu -
|
||||
Price: $1250
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_scout.mdl"
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
SCOUT_IDLE,
|
||||
SCOUT_SHOOT1,
|
||||
SCOUT_SHOOT2,
|
||||
SCOUT_RELOAD,
|
||||
SCOUT_DRAW
|
||||
};
|
||||
|
||||
void
|
||||
w_scout_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_scout.fire");
|
||||
precache_model("models/w_scout.mdl");
|
||||
#else
|
||||
precache_model("models/v_scout.mdl");
|
||||
precache_model("models/p_scout.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_scout_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.scout_mag, pl.ammo_762mm, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_scout_wmodel(void)
|
||||
{
|
||||
return "models/w_scout.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_scout_pmodel(player pl)
|
||||
{
|
||||
return "models/p_scout.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_scout_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_scout_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (new) {
|
||||
if (startammo == -1)
|
||||
pl.scout_mag = 10;
|
||||
else
|
||||
pl.scout_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_762mm < AMMO_MAX_762MM) {
|
||||
pl.ammo_762mm = bound(0, pl.ammo_762mm + 10, AMMO_MAX_762MM);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_scout_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_scout.mdl");
|
||||
Weapons_ViewAnimation(pl, SCOUT_DRAW);
|
||||
pl.mode_temp = 0;
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 5;
|
||||
pl.cs_cross_deltadist = 3;
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
w_scout_release(player pl)
|
||||
{
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.scout_mag == 0 && pl.ammo_762mm > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.w_idle_next > 0.0f) {
|
||||
pl.viewzoom = 1.0f;
|
||||
Weapons_EnableModel();
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.mode_temp == 1) {
|
||||
pl.viewzoom = 0.45f;
|
||||
Weapons_DisableModel();
|
||||
} else if (pl.mode_temp == 2) {
|
||||
pl.viewzoom = 0.1f;
|
||||
Weapons_DisableModel();
|
||||
} else {
|
||||
pl.viewzoom = 1.0f;
|
||||
Weapons_EnableModel();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
w_scout_secondary(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next)
|
||||
return;
|
||||
|
||||
#ifdef SSQC
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_awp.zoom");
|
||||
#endif
|
||||
|
||||
/* Simple toggle of fovs */
|
||||
if (pl.mode_temp == 1)
|
||||
pl.mode_temp = 2;
|
||||
else if (pl.mode_temp == 2)
|
||||
pl.mode_temp = 0;
|
||||
else
|
||||
pl.mode_temp = 1;
|
||||
|
||||
pl.w_attack_next = 0.3f;
|
||||
pl.w_idle_next = 0.0f;
|
||||
w_scout_release(pl);
|
||||
}
|
||||
|
||||
void
|
||||
w_scout_primary(player pl)
|
||||
{
|
||||
int dmg = 0;
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
w_scout_release(pl);
|
||||
return;
|
||||
}
|
||||
if (!pl.scout_mag) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
|
||||
|
||||
pl.scout_mag--;
|
||||
|
||||
int r = (float)input_sequence % 2;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, SCOUT_SHOOT1);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, SCOUT_SHOOT2);
|
||||
break;
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
View_AddEvent(w_rifle_ejectshell, 0.5f);
|
||||
#else
|
||||
dmg = Skill_GetValue("plr_scout_dmg", 75);
|
||||
TraceAttack_SetRangeModifier(2.375);
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_SCOUT, "Impact.BigShot");
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_scout.fire");
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1, 1,accuracy);
|
||||
pl.w_attack_next = 1.25f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_scout_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.scout_mag >= 10)
|
||||
return;
|
||||
if (!pl.ammo_762mm)
|
||||
return;
|
||||
|
||||
Weapons_ViewAnimation(pl, SCOUT_RELOAD);
|
||||
|
||||
pl.w_attack_next = 2.0f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_weapon_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::scout_mag, player::ammo_762mm, 10);
|
||||
Cstrike_ShotReset(pl);
|
||||
}
|
||||
|
||||
pl.think = w_weapon_reload_done;
|
||||
pl.nextthink = time + pl.w_attack_next - 0.1f;
|
||||
#endif
|
||||
}
|
||||
|
||||
float
|
||||
w_scout_aimanim(player pl)
|
||||
{
|
||||
return w_ak47_aimanim(pl);
|
||||
}
|
||||
|
||||
void
|
||||
w_scout_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
if (pl.viewzoom < 1.0f) {
|
||||
Cstrike_DrawScope();
|
||||
}
|
||||
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/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_scout_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.scout_mag <= 0 && pl.ammo_762mm <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_scout_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (w_scout_isempty(pl))
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_762mm, AMMO_MAX_762MM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud13_spr,
|
||||
[0,45/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud12_spr,
|
||||
[0,45/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_scout =
|
||||
{
|
||||
.name = "scout",
|
||||
.id = ITEM_SCOUT,
|
||||
.slot = 0,
|
||||
.slot_pos = 11,
|
||||
.weight = 30,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_scout_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_scout_primary,
|
||||
.secondary = w_scout_secondary,
|
||||
.reload = w_scout_reload,
|
||||
.release = w_scout_release,
|
||||
.postdraw = w_scout_hud,
|
||||
.precache = w_scout_precache,
|
||||
.pickup = w_scout_pickup,
|
||||
.updateammo = w_scout_updateammo,
|
||||
.wmodel = w_scout_wmodel,
|
||||
.pmodel = w_scout_pmodel,
|
||||
.deathmsg = w_scout_deathmsg,
|
||||
.aimanim = w_scout_aimanim,
|
||||
.hudpic = w_scout_hudpic,
|
||||
.type = csweapon_ranged_type,
|
||||
.isempty = w_scout_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_scout(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_SCOUT);
|
||||
}
|
||||
#endif
|
|
@ -1,321 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_sg550 (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
SIG SG 550 Weapon
|
||||
|
||||
- Buy Menu -
|
||||
Price: $4200
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_sg550.mdl"
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
SG550_IDLE,
|
||||
SG550_SHOOT1,
|
||||
SG550_SHOOT2,
|
||||
SG550_RELOAD,
|
||||
SG550_DRAW,
|
||||
};
|
||||
|
||||
void
|
||||
w_sg550_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_sg550.fire");
|
||||
precache_model("models/w_sg550.mdl");
|
||||
#else
|
||||
precache_model("models/v_sg550.mdl");
|
||||
precache_model("models/p_sg550.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_sg550_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.sg550_mag, pl.ammo_556mm, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_sg550_wmodel(void)
|
||||
{
|
||||
return "models/w_sg550.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_sg550_pmodel(player pl)
|
||||
{
|
||||
return "models/p_sg550.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_sg550_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_sg550_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (new) {
|
||||
if (startammo == -1)
|
||||
pl.sg550_mag = 30;
|
||||
else
|
||||
pl.sg550_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_556mm < AMMO_MAX_556MM) {
|
||||
pl.ammo_556mm = bound(0, pl.ammo_556mm + 30, AMMO_MAX_556MM);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_sg550_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_sg550.mdl");
|
||||
Weapons_ViewAnimation(pl, SG550_DRAW);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 5;
|
||||
pl.cs_cross_deltadist = 3;
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_sg550_primary(player pl)
|
||||
{
|
||||
int dmg = 0;
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (!pl.sg550_mag)
|
||||
return;
|
||||
|
||||
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
|
||||
Cstrike_ShotMultiplierAdd(pl, 1, 1,accuracy);
|
||||
pl.sg550_mag--;
|
||||
|
||||
int r = (float)input_sequence % 2;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, SCOUT_SHOOT1);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, SCOUT_SHOOT2);
|
||||
break;
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
View_AddEvent(w_rifle_ejectshell, 0.0f);
|
||||
#else
|
||||
dmg = Skill_GetValue("plr_sg550_dmg", 70);
|
||||
TraceAttack_SetRangeModifier(2.125);
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_SG550, "Impact.BigShot");
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_sg550.fire");
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 0.25f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_sg550_secondary(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next)
|
||||
return;
|
||||
|
||||
/* Simple toggle of fovs */
|
||||
if (pl.viewzoom == 1.0f) {
|
||||
pl.viewzoom = 0.45f;
|
||||
Weapons_DisableModel();
|
||||
} else if (pl.viewzoom == 0.45f) {
|
||||
pl.viewzoom = 0.1f;
|
||||
Weapons_DisableModel();
|
||||
} else {
|
||||
pl.viewzoom = 1.0f;
|
||||
Weapons_EnableModel();
|
||||
}
|
||||
|
||||
pl.w_attack_next = 0.5f;
|
||||
}
|
||||
|
||||
void
|
||||
w_sg550_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.sg550_mag >= 30)
|
||||
return;
|
||||
if (!pl.ammo_556mm)
|
||||
return;
|
||||
|
||||
Weapons_ViewAnimation(pl, SG550_RELOAD);
|
||||
|
||||
pl.w_attack_next = 3.8f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_weapon_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::sg550_mag, player::ammo_556mm, 30);
|
||||
Cstrike_ShotReset(pl);
|
||||
}
|
||||
|
||||
pl.think = w_weapon_reload_done;
|
||||
pl.nextthink = time + pl.w_attack_next - 0.1f;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_sg550_release(player pl)
|
||||
{
|
||||
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.sg550_mag == 0 && pl.ammo_556mm > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_sg550_aimanim(player pl)
|
||||
{
|
||||
return w_ak47_aimanim(pl);
|
||||
}
|
||||
|
||||
void
|
||||
w_sg550_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
if (pl.viewzoom < 1.0f) {
|
||||
Cstrike_DrawScope();
|
||||
}
|
||||
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, [0,96/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_sg550_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.sg550_mag <= 0 && pl.ammo_556mm <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_sg550_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (w_sg550_isempty(pl))
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_556mm, AMMO_MAX_556MM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud15_spr,
|
||||
[0,180/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud14_spr,
|
||||
[0,180/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_sg550 =
|
||||
{
|
||||
.name = "sg550",
|
||||
.id = ITEM_SG550,
|
||||
.slot = 0,
|
||||
.slot_pos = 14,
|
||||
.weight = 20,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_sg550_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_sg550_primary,
|
||||
.secondary = w_sg550_secondary,
|
||||
.reload = w_sg550_reload,
|
||||
.release = w_sg550_release,
|
||||
.postdraw = w_sg550_hud,
|
||||
.precache = w_sg550_precache,
|
||||
.pickup = w_sg550_pickup,
|
||||
.updateammo = w_sg550_updateammo,
|
||||
.wmodel = w_sg550_wmodel,
|
||||
.pmodel = w_sg550_pmodel,
|
||||
.deathmsg = w_sg550_deathmsg,
|
||||
.aimanim = w_sg550_aimanim,
|
||||
.hudpic = w_sg550_hudpic,
|
||||
.type = csweapon_ranged_type,
|
||||
.isempty = w_sg550_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_sg550(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_SG550);
|
||||
}
|
||||
#endif
|
|
@ -1,326 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_sg552 (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
SIG SG 552 Commando Weapon
|
||||
|
||||
- Buy Menu -
|
||||
Price: $3500
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_sg552.mdl"
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
SG552_IDLE,
|
||||
SG552_RELOAD,
|
||||
SG552_DRAW,
|
||||
SG552_SHOOT1,
|
||||
SG552_SHOOT2,
|
||||
SG552_SHOOT3
|
||||
};
|
||||
|
||||
void
|
||||
w_sg552_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_sg552.fire");
|
||||
precache_model("models/w_sg552.mdl");
|
||||
#else
|
||||
precache_model("models/v_sg552.mdl");
|
||||
precache_model("models/p_sg552.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_sg552_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.sg552_mag, pl.ammo_556mm, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_sg552_wmodel(void)
|
||||
{
|
||||
return "models/w_sg552.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_sg552_pmodel(player pl)
|
||||
{
|
||||
return "models/p_sg552.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_sg552_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_sg552_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (new) {
|
||||
if (startammo == -1)
|
||||
pl.sg552_mag = 30;
|
||||
else
|
||||
pl.sg552_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_556mm < AMMO_MAX_556MM) {
|
||||
pl.ammo_556mm = bound(0, pl.ammo_556mm + 30, AMMO_MAX_556MM);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_sg552_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_sg552.mdl");
|
||||
Weapons_ViewAnimation(pl, SG552_DRAW);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 5;
|
||||
pl.cs_cross_deltadist = 3;
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_sg552_primary(player pl)
|
||||
{
|
||||
int dmg = 0;
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (!pl.sg552_mag)
|
||||
return;
|
||||
|
||||
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 75,3)*pl.viewzoom;
|
||||
pl.sg552_mag--;
|
||||
|
||||
int r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, SG552_SHOOT1);
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, SG552_SHOOT2);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, SG552_SHOOT3);
|
||||
break;
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
View_AddEvent(w_rifle_ejectshell, 0.0f);
|
||||
#else
|
||||
dmg = Skill_GetValue("plr_sg552_dmg", 33);
|
||||
TraceAttack_SetRangeModifier(2.125);
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
Cstrike_BulletRecoil_ApplyPre(pl,0.726f);
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_SG552, "Impact.BigShot");
|
||||
Cstrike_BulletRecoil_ApplyPost(pl,0.725f);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_sg552.fire");
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 2.2, 0.9,accuracy);
|
||||
if (pl.viewzoom == 1.0f)
|
||||
pl.w_attack_next = 0.0825f;
|
||||
else
|
||||
pl.w_attack_next = 0.15f;
|
||||
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_sg552_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_sg552_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.sg552_mag >= 30)
|
||||
return;
|
||||
if (!pl.ammo_556mm)
|
||||
return;
|
||||
|
||||
Weapons_ViewAnimation(pl, SG552_RELOAD);
|
||||
|
||||
pl.w_attack_next = 3.2f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_weapon_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::sg552_mag, player::ammo_556mm, 30);
|
||||
Cstrike_ShotReset(pl);
|
||||
}
|
||||
|
||||
pl.think = w_weapon_reload_done;
|
||||
pl.nextthink = time + pl.w_attack_next - 0.1f;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_sg552_release(player pl)
|
||||
{
|
||||
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.sg552_mag == 0 && pl.ammo_556mm > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_sg552_aimanim(player pl)
|
||||
{
|
||||
return w_ak47_aimanim(pl);
|
||||
}
|
||||
|
||||
void
|
||||
w_sg552_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
if (pl.viewzoom == 1.0f) {
|
||||
Cstrike_DrawCrosshair();
|
||||
} else {
|
||||
Cstrike_DrawSimpleCrosshair();
|
||||
}
|
||||
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, [0,96/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_sg552_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.sg552_mag <= 0 && pl.ammo_556mm <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_sg552_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (w_sg552_isempty(pl))
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_556mm, AMMO_MAX_556MM, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud11_spr,
|
||||
[0,45/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud10_spr,
|
||||
[0,45/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_sg552 =
|
||||
{
|
||||
.name = "sg552",
|
||||
.id = ITEM_SG552,
|
||||
.slot = 0,
|
||||
.slot_pos = 8,
|
||||
.weight = 25,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_sg552_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_sg552_primary,
|
||||
.secondary = w_sg552_secondary,
|
||||
.reload = w_sg552_reload,
|
||||
.release = w_sg552_release,
|
||||
.postdraw = w_sg552_hud,
|
||||
.precache = w_sg552_precache,
|
||||
.pickup = w_sg552_pickup,
|
||||
.updateammo = w_sg552_updateammo,
|
||||
.wmodel = w_sg552_wmodel,
|
||||
.pmodel = w_sg552_pmodel,
|
||||
.deathmsg = w_sg552_deathmsg,
|
||||
.aimanim = w_sg552_aimanim,
|
||||
.hudpic = w_sg552_hudpic,
|
||||
.type = csweapon_ranged_type,
|
||||
.isempty = w_sg552_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_sg552(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_SG552);
|
||||
}
|
||||
#endif
|
|
@ -1,306 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_smokegrenade (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
Smoke Grenade Weapon
|
||||
|
||||
When thrown, the explosion casts view-blocking smoke in that radius.
|
||||
|
||||
- Buy Menu -
|
||||
Price: $300
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_smokegrenade.mdl"
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
SMOKEGRENADE_IDLE,
|
||||
SMOKEGRENADE_PULLPIN,
|
||||
SMOKEGRENADE_THROW,
|
||||
SMOKEGRENADE_DRAW,
|
||||
};
|
||||
|
||||
void
|
||||
w_smokegrenade_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_smokegrenade.bounce");
|
||||
Sound_Precache("weapon_smokegrenade.explode");
|
||||
precache_model("models/w_smokegrenade.mdl");
|
||||
#else
|
||||
precache_model("models/v_smokegrenade.mdl");
|
||||
precache_model("models/p_smokegrenade.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_smokegrenade_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_smokegrenade, pl.mode_temp);
|
||||
}
|
||||
|
||||
int
|
||||
w_smokegrenade_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (pl.ammo_smokegrenade < AMMO_MAX_SMOKE) {
|
||||
pl.ammo_smokegrenade = bound(0, pl.ammo_smokegrenade + 1, AMMO_MAX_SMOKE);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
string
|
||||
w_smokegrenade_wmodel(void)
|
||||
{
|
||||
return "models/w_smokegrenade.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_smokegrenade_pmodel(player pl)
|
||||
{
|
||||
return "models/p_smokegrenade.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_smokegrenade_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void
|
||||
w_smokegrenade_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_smokegrenade.mdl");
|
||||
Weapons_ViewAnimation(pl, SMOKEGRENADE_DRAW);
|
||||
pl.mode_temp = 0;
|
||||
|
||||
#ifdef CLIENT
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
w_smokegrenade_throw(player pl)
|
||||
{
|
||||
static void smokegrenade_explode(void)
|
||||
{
|
||||
FX_Smokenade(self.origin);
|
||||
Sound_Play(self, CHAN_BODY, "weapon_smokegrenade.explode");
|
||||
remove(self);
|
||||
}
|
||||
|
||||
static void smokegrenade_touch(void)
|
||||
{
|
||||
if (other.takedamage == DAMAGE_YES) {
|
||||
Damage_Apply(other, self.owner, 15, WEAPON_SMOKEGRENADE, DMG_BLUNT);
|
||||
} else {
|
||||
Sound_Play(self, CHAN_BODY, "weapon_smokegrenade.bounce");
|
||||
}
|
||||
self.frame = 0;
|
||||
}
|
||||
|
||||
vector vPLAngle = pl.v_angle;
|
||||
if (vPLAngle[0] < 0) {
|
||||
vPLAngle[0] = -10 + vPLAngle[0] * ((90 - 10) / 90.0);
|
||||
} else {
|
||||
vPLAngle[0] = -10 + vPLAngle[0] * ((90 + 10) / 90.0);
|
||||
}
|
||||
|
||||
float flVel = (90 - vPLAngle[0]) * 5;
|
||||
if (flVel > 1000) {
|
||||
flVel = 1000;
|
||||
}
|
||||
|
||||
makevectors(vPLAngle);
|
||||
vector vecSrc = pl.origin + pl.view_ofs + v_forward * 16;
|
||||
vector vecThrow = v_forward * flVel + pl.velocity;
|
||||
|
||||
entity eGrenade = spawn();
|
||||
eGrenade.owner = pl;
|
||||
eGrenade.classname = "remove_me";
|
||||
eGrenade.solid = SOLID_BBOX;
|
||||
eGrenade.frame = 1;
|
||||
eGrenade.velocity = vecThrow;
|
||||
eGrenade.movetype = MOVETYPE_BOUNCE;
|
||||
eGrenade.think = smokegrenade_explode;
|
||||
eGrenade.touch = smokegrenade_touch;
|
||||
eGrenade.nextthink = time + 4.0f;
|
||||
setmodel(eGrenade, "models/w_smokegrenade.mdl");
|
||||
setsize(eGrenade, [0,0,0], [0,0,0]);
|
||||
setorigin(eGrenade, vecSrc);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
w_smokegrenade_primary(player pl)
|
||||
{
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* We're abusing this network variable for the holding check */
|
||||
if (pl.mode_temp > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
if (pl.ammo_smokegrenade <= 0) {
|
||||
#ifdef SERVER
|
||||
Weapons_RemoveItem(pl, WEAPON_SMOKEGRENADE);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_ViewAnimation(pl, SMOKEGRENADE_PULLPIN);
|
||||
pl.mode_temp = 1;
|
||||
pl.w_attack_next = 0.975f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_smokegrenade_release(player pl)
|
||||
{
|
||||
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.mode_temp == 1) {
|
||||
pl.ammo_smokegrenade--;
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(pl, SMOKEGRENADE_THROW);
|
||||
#else
|
||||
w_smokegrenade_throw(pl);
|
||||
#endif
|
||||
pl.mode_temp = 2;
|
||||
pl.w_attack_next = 1.0f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
} else if (pl.mode_temp == 2) {
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(pl, SMOKEGRENADE_DRAW);
|
||||
#else
|
||||
if (!pl.ammo_smokegrenade) {
|
||||
Weapons_RemoveItem(pl, WEAPON_SMOKEGRENADE);
|
||||
}
|
||||
#endif
|
||||
pl.w_attack_next = 0.5f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
pl.mode_temp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_smokegrenade_aimanim(player pl)
|
||||
{
|
||||
return w_flashbang_aimanim(pl);
|
||||
}
|
||||
|
||||
void
|
||||
w_smokegrenade_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, [144/256,96/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_smokegrenade_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.ammo_smokegrenade <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_smokegrenade_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_smokegrenade, AMMO_MAX_SMOKE, a);
|
||||
|
||||
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
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_smokegrenade =
|
||||
{
|
||||
.name = "smokegrenade",
|
||||
.id = ITEM_SMOKEGRENADE,
|
||||
.slot = 3,
|
||||
.slot_pos = 2,
|
||||
.allow_drop = FALSE,
|
||||
.draw = w_smokegrenade_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_smokegrenade_primary,
|
||||
.secondary = __NULL__,
|
||||
.reload = __NULL__,
|
||||
.release = w_smokegrenade_release,
|
||||
.postdraw = w_smokegrenade_hud,
|
||||
.precache = w_smokegrenade_precache,
|
||||
.pickup = w_smokegrenade_pickup,
|
||||
.updateammo = w_smokegrenade_updateammo,
|
||||
.wmodel = w_smokegrenade_wmodel,
|
||||
.pmodel = w_smokegrenade_pmodel,
|
||||
.deathmsg = w_smokegrenade_deathmsg,
|
||||
.aimanim = w_smokegrenade_aimanim,
|
||||
.hudpic = w_smokegrenade_hudpic,
|
||||
.isempty = w_smokegrenade_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_smokegrenade(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_SMOKEGRENADE);
|
||||
}
|
||||
#endif
|
|
@ -1,302 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_tmp (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
Steyr Tactical Weapon
|
||||
|
||||
- Buy Menu -
|
||||
Price: $1250
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_tmp.mdl"
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
TMP_IDLE,
|
||||
TMP_RELOAD,
|
||||
TMP_DRAW,
|
||||
TMP_SHOOT1,
|
||||
TMP_SHOOT2,
|
||||
TMP_SHOOT3
|
||||
};
|
||||
|
||||
void
|
||||
w_tmp_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_tmp.fire");
|
||||
precache_model("models/w_tmp.mdl");
|
||||
#else
|
||||
precache_model("models/v_tmp.mdl");
|
||||
precache_model("models/p_tmp.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_tmp_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.tmp_mag, pl.ammo_9mm, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_tmp_wmodel(void)
|
||||
{
|
||||
return "models/w_tmp.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_tmp_pmodel(player pl)
|
||||
{
|
||||
return "models/p_tmp.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_tmp_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_tmp_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (new) {
|
||||
if (startammo == -1)
|
||||
pl.tmp_mag = 30;
|
||||
else
|
||||
pl.tmp_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_9mm < AMMO_MAX_9MM) {
|
||||
pl.ammo_9mm = bound(0, pl.ammo_9mm + 30, AMMO_MAX_9MM);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_tmp_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_tmp.mdl");
|
||||
Weapons_ViewAnimation(pl, TMP_DRAW);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 7;
|
||||
pl.cs_cross_deltadist = 3;
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_tmp_primary(player pl)
|
||||
{
|
||||
int dmg = 0;
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (!pl.tmp_mag)
|
||||
return;
|
||||
|
||||
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 30,0.95)+0.0035;
|
||||
pl.tmp_mag--;
|
||||
|
||||
int r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, TMP_SHOOT1);
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, TMP_SHOOT2);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, TMP_SHOOT3);
|
||||
break;
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_MP5, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_MP5, 0.45f);
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
View_AddEvent(w_pistol_ejectshell, 0.0f);
|
||||
#else
|
||||
dmg = Skill_GetValue("plr_tmp_dmg", 26);
|
||||
TraceAttack_SetRangeModifier(1.25); /* 9 but not 10 */
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
Cstrike_BulletRecoil_ApplyPre(pl,0.8);
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_TMP, "Impact.BigShot");
|
||||
Cstrike_BulletRecoil_ApplyPost(pl,0.8);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_tmp.fire");
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 0.95, 1.25,accuracy);
|
||||
pl.w_attack_next = 0.07f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_tmp_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.tmp_mag >= 30)
|
||||
return;
|
||||
if (!pl.ammo_9mm)
|
||||
return;
|
||||
|
||||
Weapons_ViewAnimation(pl, TMP_RELOAD);
|
||||
|
||||
pl.w_attack_next = 2.1f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_weapon_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::tmp_mag, player::ammo_9mm, 30);
|
||||
Cstrike_ShotReset(pl);
|
||||
}
|
||||
|
||||
pl.think = w_weapon_reload_done;
|
||||
pl.nextthink = time + pl.w_attack_next - 0.1f;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_tmp_release(player pl)
|
||||
{
|
||||
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.tmp_mag == 0 && pl.ammo_9mm > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_tmp_aimanim(player pl)
|
||||
{
|
||||
return w_ak47_aimanim(pl);
|
||||
}
|
||||
|
||||
void
|
||||
w_tmp_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Cstrike_DrawCrosshair();
|
||||
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, [48/256,72/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_tmp_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.tmp_mag <= 0 && pl.ammo_9mm <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_tmp_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (w_tmp_isempty(pl))
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_9mm, AMMO_MAX_9MM, a);
|
||||
|
||||
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
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_tmp =
|
||||
{
|
||||
.name = "tmp",
|
||||
.id = ITEM_TMP,
|
||||
.slot = 0,
|
||||
.slot_pos = 6,
|
||||
.weight = 25,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_tmp_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_tmp_primary,
|
||||
.secondary = __NULL__,
|
||||
.reload = w_tmp_reload,
|
||||
.release = w_tmp_release,
|
||||
.postdraw = w_tmp_hud,
|
||||
.precache = w_tmp_precache,
|
||||
.pickup = w_tmp_pickup,
|
||||
.updateammo = w_tmp_updateammo,
|
||||
.wmodel = w_tmp_wmodel,
|
||||
.pmodel = w_tmp_pmodel,
|
||||
.deathmsg = w_tmp_deathmsg,
|
||||
.aimanim = w_tmp_aimanim,
|
||||
.hudpic = w_tmp_hudpic,
|
||||
.type = csweapon_ranged_type,
|
||||
.isempty = w_tmp_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_tmp(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_TMP);
|
||||
}
|
||||
#endif
|
|
@ -1,301 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_ump45 (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
Heckler & Koch UMP .45 ACP Weapon
|
||||
|
||||
- Buy Menu -
|
||||
Price: $1700
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_ump45.mdl"
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
UMP45_IDLE,
|
||||
UMP45_RELOAD,
|
||||
UMP45_DRAW,
|
||||
UMP45_SHOOT1,
|
||||
UMP45_SHOOT2,
|
||||
UMP45_SHOOT3
|
||||
};
|
||||
|
||||
void
|
||||
w_ump45_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_ump45.fire");
|
||||
precache_model("models/w_ump45.mdl");
|
||||
#else
|
||||
precache_model("models/v_ump45.mdl");
|
||||
precache_model("models/p_ump45.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_ump45_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.ump45_mag, pl.ammo_45acp, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_ump45_wmodel(void)
|
||||
{
|
||||
return "models/w_ump45.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_ump45_pmodel(player pl)
|
||||
{
|
||||
return "models/p_ump45.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_ump45_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_ump45_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (new) {
|
||||
if (startammo == -1)
|
||||
pl.ump45_mag = 25;
|
||||
else
|
||||
pl.ump45_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_45acp < AMMO_MAX_45ACP) {
|
||||
pl.ammo_45acp = bound(0, pl.ammo_45acp + 25, AMMO_MAX_45ACP);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_ump45_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_ump45.mdl");
|
||||
Weapons_ViewAnimation(pl, UMP45_DRAW);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 6;
|
||||
pl.cs_cross_deltadist = 3;
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_ump45_primary(player pl)
|
||||
{
|
||||
int dmg = 0;
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (!pl.ump45_mag)
|
||||
return;
|
||||
|
||||
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 100,1)+0.003;
|
||||
pl.ump45_mag--;
|
||||
|
||||
int r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, UMP45_SHOOT1);
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, UMP45_SHOOT2);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, UMP45_SHOOT3);
|
||||
break;
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_MP5, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_MP5, 0.45f);
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
View_AddEvent(w_pistol_ejectshell, 0.0f);
|
||||
#else
|
||||
dmg = Skill_GetValue("plr_ump45_dmg", 30);
|
||||
TraceAttack_SetRangeModifier(0.875); /* 6, but not 7 */
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
Cstrike_BulletRecoil_ApplyPre(pl,1.2);
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_UMP45, "Impact.BigShot");
|
||||
Cstrike_BulletRecoil_ApplyPost(pl,1.2);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_ump45.fire");
|
||||
#endif
|
||||
Cstrike_ShotMultiplierAdd(pl, 1, .9,accuracy);
|
||||
pl.w_attack_next = 0.105f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_ump45_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.ump45_mag >= 25)
|
||||
return;
|
||||
if (!pl.ammo_45acp)
|
||||
return;
|
||||
|
||||
Weapons_ViewAnimation(pl, UMP45_RELOAD);
|
||||
|
||||
pl.w_attack_next = 3.5f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_weapon_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::ump45_mag, player::ammo_45acp, 25);
|
||||
Cstrike_ShotReset(pl);
|
||||
}
|
||||
|
||||
pl.think = w_weapon_reload_done;
|
||||
pl.nextthink = time + pl.w_attack_next - 0.1f;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_ump45_release(player pl)
|
||||
{
|
||||
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.ump45_mag == 0 && pl.ammo_45acp > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_ump45_aimanim(player pl)
|
||||
{
|
||||
return w_ak47_aimanim(pl);
|
||||
}
|
||||
|
||||
void
|
||||
w_ump45_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Cstrike_DrawCrosshair();
|
||||
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, [96/256,72/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_ump45_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.ump45_mag <= 0 && pl.ammo_45acp <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_ump45_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (w_ump45_isempty(pl))
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_45acp, AMMO_MAX_45ACP, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud16_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud16_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_ump45 =
|
||||
{
|
||||
.name = "ump45",
|
||||
.id = ITEM_UMP45,
|
||||
.slot = 0,
|
||||
.slot_pos = 4,
|
||||
.weight = 25,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_ump45_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_ump45_primary,
|
||||
.secondary = __NULL__,
|
||||
.reload = w_ump45_reload,
|
||||
.release = w_ump45_release,
|
||||
.postdraw = w_ump45_hud,
|
||||
.precache = w_ump45_precache,
|
||||
.pickup = w_ump45_pickup,
|
||||
.updateammo = w_ump45_updateammo,
|
||||
.wmodel = w_ump45_wmodel,
|
||||
.pmodel = w_ump45_pmodel,
|
||||
.deathmsg = w_ump45_deathmsg,
|
||||
.aimanim = w_ump45_aimanim,
|
||||
.hudpic = w_ump45_hudpic,
|
||||
.type = csweapon_ranged_type,
|
||||
.isempty = w_ump45_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_ump45(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_UMP45);
|
||||
}
|
||||
#endif
|
|
@ -1,376 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_usp45 (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
Heckler & Koch USP .45 Tactical Weapon
|
||||
|
||||
Default arsenal for Counter-Terrorists
|
||||
|
||||
- Buy Menu -
|
||||
Price: $500
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_usp45.mdl"
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
USP45_IDLE,
|
||||
USP45_SHOOT1,
|
||||
USP45_SHOOT2,
|
||||
USP45_SHOOT3,
|
||||
USP45_SHOOTLAST,
|
||||
USP45_RELOAD,
|
||||
USP45_DRAW,
|
||||
USP45_ADDSIL,
|
||||
USP45_IDLEUNSIL,
|
||||
USP45_SHOOT1UNSIL,
|
||||
USP45_SHOOT2UNSIL,
|
||||
USP45_SHOOT3UNSIL,
|
||||
USP45_SHOOTLASTUNSIL,
|
||||
USP45_RELOADUNSIL,
|
||||
USP45_DRAWUNSIL,
|
||||
USP45_DETACHSIL
|
||||
};
|
||||
|
||||
void
|
||||
w_usp45_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_usp45.fire");
|
||||
Sound_Precache("weapon_usp45.silenced");
|
||||
precache_model("models/w_usp.mdl");
|
||||
#else
|
||||
precache_model("models/v_usp.mdl");
|
||||
precache_model("models/p_usp.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_usp45_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.usp45_mag, pl.ammo_45acp, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_usp45_wmodel(void)
|
||||
{
|
||||
return "models/w_usp.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_usp45_pmodel(player pl)
|
||||
{
|
||||
return "models/p_usp.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_usp45_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_usp45_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (new) {
|
||||
if (startammo == -1)
|
||||
pl.usp45_mag = 12;
|
||||
else
|
||||
pl.usp45_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_45acp < AMMO_MAX_45ACP) {
|
||||
pl.ammo_45acp = bound(0, pl.ammo_45acp + 12, AMMO_MAX_45ACP);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_usp45_draw(player pl)
|
||||
{
|
||||
|
||||
Weapons_SetModel("models/v_usp.mdl");
|
||||
if (pl.mode_usp45 == 1) {
|
||||
Weapons_ViewAnimation(pl, USP45_DRAW);
|
||||
} else {
|
||||
Weapons_ViewAnimation(pl, USP45_DRAWUNSIL);
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 8;
|
||||
pl.cs_cross_deltadist = 3;
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_usp45_primary(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.gflags & GF_SEMI_TOGGLED)
|
||||
return;
|
||||
if (!pl.usp45_mag)
|
||||
return;
|
||||
|
||||
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl,25,2.2);
|
||||
int dmg = 0;
|
||||
pl.usp45_mag--;
|
||||
|
||||
/* this stuff is predicted */
|
||||
int r = (float)input_sequence % 3;
|
||||
if (pl.mode_usp45 == 1) {
|
||||
if (pl.usp45_mag <= 0) {
|
||||
Weapons_ViewAnimation(pl, USP45_SHOOTLAST);
|
||||
} else {
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, USP45_SHOOT1);
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, USP45_SHOOT2);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, USP45_SHOOT3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (pl.usp45_mag <= 0) {
|
||||
Weapons_ViewAnimation(pl, USP45_SHOOTLASTUNSIL);
|
||||
} else {
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, USP45_SHOOT1UNSIL);
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(pl, USP45_SHOOT2UNSIL);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, USP45_SHOOT3UNSIL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_ONEHAND, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_ONEHAND, 0.45f);
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_SMALL);
|
||||
View_AddEvent(w_pistol_ejectshell, 0.0f);
|
||||
#else
|
||||
/* Different sounds without silencer */
|
||||
if (pl.mode_usp45 == 1) {
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_usp45.silenced");
|
||||
} else {
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_usp45.fire");
|
||||
}
|
||||
|
||||
/* actual firing */
|
||||
dmg = Skill_GetValue("plr_usp45_dmg", 33);
|
||||
TraceAttack_SetRangeModifier(0.79); /* can penetrate 6 but not 7 units */
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
Cstrike_BulletRecoil_ApplyPre(pl,0.625);
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [accuracy,accuracy], WEAPON_USP45, "Impact.BigShot");
|
||||
Cstrike_BulletRecoil_ApplyPost(pl,0.625);
|
||||
#endif
|
||||
Cstrike_ShotMultiplierAdd(pl, 2.5, .5,accuracy*0.5);
|
||||
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
pl.w_attack_next = 0.15f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_usp45_secondary(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0)
|
||||
return;
|
||||
|
||||
/* toggle silencer */
|
||||
pl.mode_usp45 = 1 - pl.mode_usp45;
|
||||
|
||||
/* play the animation */
|
||||
if (pl.mode_usp45)
|
||||
Weapons_ViewAnimation(pl, USP45_ADDSIL);
|
||||
else
|
||||
Weapons_ViewAnimation(pl, USP45_DETACHSIL);
|
||||
|
||||
pl.w_attack_next = 3.1f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_usp45_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.w_attack_next > 0.0)
|
||||
return;
|
||||
if (pl.usp45_mag >= 12)
|
||||
return;
|
||||
if (!pl.ammo_45acp)
|
||||
return;
|
||||
|
||||
if (pl.mode_usp45 == 1)
|
||||
Weapons_ViewAnimation(pl, USP45_RELOAD);
|
||||
else
|
||||
Weapons_ViewAnimation(pl, USP45_RELOADUNSIL);
|
||||
|
||||
pl.w_attack_next = 2.5f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
||||
#ifdef SERVER
|
||||
static void w_weapon_reload_done(void) {
|
||||
player pl = (player)self;
|
||||
Weapons_ReloadWeapon(pl, player::usp45_mag, player::ammo_45acp, 12);
|
||||
Cstrike_ShotReset(pl);
|
||||
}
|
||||
|
||||
pl.think = w_weapon_reload_done;
|
||||
pl.nextthink = time + pl.w_attack_next - 0.1f;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_usp45_release(player pl)
|
||||
{
|
||||
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.usp45_mag == 0 && pl.ammo_45acp > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_usp45_aimanim(player pl)
|
||||
{
|
||||
return w_deagle_aimanim(pl);
|
||||
}
|
||||
|
||||
void
|
||||
w_usp45_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Cstrike_DrawCrosshair();
|
||||
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, [96/256,72/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_usp45_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.usp45_mag <= 0 && pl.ammo_45acp <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_usp45_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (w_usp45_isempty(pl))
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_45acp, AMMO_MAX_45ACP, a);
|
||||
|
||||
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
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_usp45 =
|
||||
{
|
||||
.name = "usp",
|
||||
.id = ITEM_USP45,
|
||||
.slot = 1,
|
||||
.slot_pos = 0,
|
||||
.weight = 5,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_usp45_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_usp45_primary,
|
||||
.secondary = w_usp45_secondary,
|
||||
.reload = w_usp45_reload,
|
||||
.release = w_usp45_release,
|
||||
.postdraw = w_usp45_hud,
|
||||
.precache = w_usp45_precache,
|
||||
.pickup = w_usp45_pickup,
|
||||
.updateammo = w_usp45_updateammo,
|
||||
.wmodel = w_usp45_wmodel,
|
||||
.pmodel = w_usp45_pmodel,
|
||||
.deathmsg = w_usp45_deathmsg,
|
||||
.aimanim = w_usp45_aimanim,
|
||||
.hudpic = w_usp45_hudpic,
|
||||
.type = csweapon_ranged_type,
|
||||
.isempty = w_usp45_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_usp45(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_USP45);
|
||||
}
|
||||
#endif
|
|
@ -1,381 +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.
|
||||
*/
|
||||
|
||||
/*!QUAKED weapon_xm1014 (0 0 1) (-16 -16 0) (16 16 32)
|
||||
|
||||
COUNTER-STRIKE (1999) ENTITY
|
||||
|
||||
Benneli XM1014 Weapon
|
||||
|
||||
- Buy Menu -
|
||||
Price: $3000
|
||||
|
||||
-------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
|
||||
model="models/w_xm1014.mdl"
|
||||
*/
|
||||
|
||||
#ifdef CLIENT
|
||||
void
|
||||
w_xm1014_ejectshell(void)
|
||||
{
|
||||
static void w_xm1014_ejectshell_death(void) {
|
||||
remove(self);
|
||||
}
|
||||
static void w_xm1014_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_xm1014_ejectshell_touch;
|
||||
|
||||
eShell.avelocity = [0,45,900];
|
||||
eShell.think = w_xm1014_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
|
||||
|
||||
enum
|
||||
{
|
||||
XM1014_IDLE,
|
||||
XM1014_SHOOT1,
|
||||
XM1014_SHOOT2,
|
||||
XM1014_INSERT,
|
||||
XM1014_RELOAD_END,
|
||||
XM1014_RELOAD_START,
|
||||
XM1014_DRAW
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
XM1014S_IDLE,
|
||||
XM1014S_RELOAD_START,
|
||||
XM1014S_RELOAD,
|
||||
XM1014S_RELOAD_END
|
||||
};
|
||||
|
||||
void
|
||||
w_xm1014_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Sound_Precache("weapon_xm1014.fire");
|
||||
Sound_Precache("weapon_xm1014.insertshell");
|
||||
precache_model("models/w_xm1014.mdl");
|
||||
#else
|
||||
precache_model("models/v_xm1014.mdl");
|
||||
precache_model("models/p_xm1014.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_xm1014_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, pl.xm1014_mag, pl.ammo_buckshot, -1);
|
||||
}
|
||||
|
||||
string
|
||||
w_xm1014_wmodel(void)
|
||||
{
|
||||
return "models/w_xm1014.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_xm1014_pmodel(player pl)
|
||||
{
|
||||
return "models/p_xm1014.mdl";
|
||||
}
|
||||
|
||||
string
|
||||
w_xm1014_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int
|
||||
w_xm1014_pickup(player pl, int new, int startammo)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
||||
if (new) {
|
||||
if (startammo == -1)
|
||||
pl.xm1014_mag = 7;
|
||||
else
|
||||
pl.xm1014_mag = startammo;
|
||||
} else {
|
||||
if (pl.ammo_buckshot < AMMO_MAX_BUCKSHOT) {
|
||||
pl.ammo_buckshot = bound(0, pl.ammo_buckshot + 7, AMMO_MAX_BUCKSHOT);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
w_xm1014_draw(player pl)
|
||||
{
|
||||
Weapons_SetModel("models/v_xm1014.mdl");
|
||||
Weapons_ViewAnimation(pl, XM1014_DRAW);
|
||||
pl.mode_temp = 0;
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 9;
|
||||
pl.cs_cross_deltadist = 4;
|
||||
CStrikeView_UpdateGeomset(pl);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void w_xm1014_release(player pl);
|
||||
|
||||
void
|
||||
w_xm1014_primary(player pl)
|
||||
{
|
||||
int dmg = 0;
|
||||
int r = 0;
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
w_xm1014_release(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
/* interrupt reloading if no longer empty */
|
||||
if (pl.mode_temp == XM1014S_RELOAD && pl.xm1014_mag >= 1) {
|
||||
pl.mode_temp = XM1014S_RELOAD_END;
|
||||
w_xm1014_release(pl);
|
||||
return;
|
||||
} else if (pl.mode_temp > XM1014S_IDLE) {
|
||||
w_xm1014_release(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
if (pl.xm1014_mag <= 0) {
|
||||
w_xm1014_release(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
pl.xm1014_mag--;
|
||||
|
||||
r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(pl, XM1014_SHOOT1);
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(pl, XM1014_SHOOT2);
|
||||
break;
|
||||
}
|
||||
|
||||
if (pl.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_SHOOT_SHOTGUN, 0.45f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_CROUCH_SHOOT_SHOTGUN, 0.45f);
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
View_AddEvent(w_xm1014_ejectshell, 0.0f);
|
||||
#else
|
||||
dmg = Skill_GetValue("plr_xm1014_dmg", 22);
|
||||
TraceAttack_SetPenetrationPower(0); /* shotties can't wallbang?! */
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_xm1014.fire");
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
Cstrike_ShotMultiplierAdd(pl, 1, 1,1);
|
||||
pl.punchangle[0] = -4 * (6 / 6);
|
||||
#ifdef SERVER
|
||||
TraceAttack_FireBulletsWithDecal(1, pl.origin + pl.view_ofs, dmg, [random(-1,1) * 0.1,random(-1,1) * 0.05], WEAPON_M3, "Impact.BigShot");
|
||||
#endif
|
||||
}
|
||||
|
||||
pl.w_attack_next = 0.25f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
||||
void
|
||||
w_xm1014_reload(player pl)
|
||||
{
|
||||
|
||||
if (pl.xm1014_mag >= 7) {
|
||||
return;
|
||||
}
|
||||
if (pl.ammo_buckshot <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.mode_temp > XM1014S_IDLE) {
|
||||
return;
|
||||
}
|
||||
pl.mode_temp = XM1014S_RELOAD_START;
|
||||
pl.w_idle_next = 0.0f;
|
||||
}
|
||||
|
||||
void
|
||||
w_xm1014_release(player pl)
|
||||
{
|
||||
|
||||
w_cstrike_weaponrelease();
|
||||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.mode_temp == XM1014S_IDLE && pl.xm1014_mag == 0 && pl.ammo_buckshot > 0) {
|
||||
Weapons_Reload(pl);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.mode_temp == XM1014S_RELOAD_START) {
|
||||
Weapons_ViewAnimation(pl, XM1014_RELOAD_START);
|
||||
pl.mode_temp = XM1014S_RELOAD;
|
||||
pl.w_idle_next = 0.65f;
|
||||
} else if (pl.mode_temp == XM1014S_RELOAD) {
|
||||
Weapons_ViewAnimation(pl, XM1014_INSERT);
|
||||
pl.xm1014_mag++;
|
||||
pl.ammo_buckshot--;
|
||||
w_xm1014_updateammo(pl);
|
||||
#ifdef SERVER
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_xm1014.insertshell");
|
||||
#endif
|
||||
if (pl.ammo_buckshot <= 0 || pl.xm1014_mag >= 7) {
|
||||
pl.mode_temp = XM1014S_RELOAD_END;
|
||||
}
|
||||
pl.w_idle_next = 0.5f;
|
||||
} else if (pl.mode_temp == XM1014S_RELOAD_END) {
|
||||
Weapons_ViewAnimation(pl, XM1014_RELOAD_END);
|
||||
pl.mode_temp = XM1014S_IDLE;
|
||||
pl.w_idle_next = 10.0f;
|
||||
pl.w_attack_next = 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
w_xm1014_aimanim(player pl)
|
||||
{
|
||||
return w_ak47_aimanim(pl);
|
||||
}
|
||||
|
||||
void
|
||||
w_xm1014_hud(player pl)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Cstrike_DrawCrosshair();
|
||||
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, [0,72/256], [24/256, 24/256], g_hud_color, pSeatLocal->m_flAmmo2Alpha, DRAWFLAG_ADDITIVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
w_xm1014_isempty(player pl)
|
||||
{
|
||||
|
||||
if (pl.xm1014_mag <= 0 && pl.ammo_buckshot <= 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_xm1014_hudpic(player pl, int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
vector hud_col;
|
||||
|
||||
if (w_xm1014_isempty(pl))
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
HUD_DrawAmmoBar(pos, pl.ammo_buckshot, AMMO_MAX_BUCKSHOT, a);
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud13_spr,
|
||||
[0,135/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
} else {
|
||||
drawsubpic(
|
||||
pos,
|
||||
[170,45],
|
||||
g_hud12_spr,
|
||||
[0,135/256],
|
||||
[170/256,45/256],
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_xm1014 =
|
||||
{
|
||||
.name = "xm1014",
|
||||
.id = ITEM_XM1014,
|
||||
.slot = 0,
|
||||
.slot_pos = 1,
|
||||
.weight = 20,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_xm1014_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_xm1014_primary,
|
||||
.secondary = __NULL__,
|
||||
.reload = w_xm1014_reload,
|
||||
.release = w_xm1014_release,
|
||||
.postdraw = w_xm1014_hud,
|
||||
.precache = w_xm1014_precache,
|
||||
.pickup = w_xm1014_pickup,
|
||||
.updateammo = w_xm1014_updateammo,
|
||||
.wmodel = w_xm1014_wmodel,
|
||||
.pmodel = w_xm1014_pmodel,
|
||||
.deathmsg = w_xm1014_deathmsg,
|
||||
.aimanim = w_xm1014_aimanim,
|
||||
.hudpic = w_xm1014_hudpic,
|
||||
.type = csweapon_ranged_type,
|
||||
.isempty = w_xm1014_isempty
|
||||
};
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
weapon_xm1014(void)
|
||||
{
|
||||
Weapons_InitItem(WEAPON_XM1014);
|
||||
}
|
||||
#endif
|
|
@ -25,6 +25,10 @@ enum
|
|||
WEAPON_UMP45,
|
||||
WEAPON_MAC10,
|
||||
WEAPON_TMP,
|
||||
#if defined(CZERO) || defined(CSSOURCE)
|
||||
WEAPON_FAMAS,
|
||||
WEAPON_GALIL,
|
||||
#endif
|
||||
WEAPON_AK47,
|
||||
WEAPON_SG552,
|
||||
WEAPON_M4A1,
|
||||
|
|
|
@ -1,64 +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_m3,
|
||||
w_xm1014,
|
||||
w_mp5,
|
||||
w_p90,
|
||||
w_ump45,
|
||||
w_mac10,
|
||||
w_tmp,
|
||||
w_ak47,
|
||||
w_sg552,
|
||||
w_m4a1,
|
||||
w_aug,
|
||||
w_scout,
|
||||
w_awp,
|
||||
w_g3sg1,
|
||||
w_sg550,
|
||||
w_para,
|
||||
w_usp45,
|
||||
w_glock18,
|
||||
w_deagle,
|
||||
w_p228,
|
||||
w_elites,
|
||||
w_fiveseven,
|
||||
w_knife,
|
||||
w_hegrenade,
|
||||
w_flashbang,
|
||||
w_smokegrenade,
|
||||
w_c4bomb
|
||||
};
|
||||
|
||||
int
|
||||
Cstrike_WeaponToDropUponDeath(player pl)
|
||||
{
|
||||
int best_weapon = WEAPON_KNIFE; /* this will never drop, so an okay default */
|
||||
|
||||
for (int i = 0; i < g_weapons.length; i++) {
|
||||
if (pl.g_items & g_weapons[i].id) {
|
||||
if (g_weapons[i].slot == 0)
|
||||
return i; /* immediately choose this primary weapon */
|
||||
|
||||
best_weapon = i;
|
||||
}
|
||||
}
|
||||
|
||||
return best_weapon;
|
||||
}
|
|
@ -34,19 +34,19 @@ var float autocvar_fcs_guns_movement_inaccuracy = 1.0f;
|
|||
var float autocvar_fcs_guns_firing_inaccuracy = 1.0f;
|
||||
|
||||
weapontype_t
|
||||
csweapon_ranged_type(player pl)
|
||||
csweapon_ranged_type(CSPlayer pl)
|
||||
{
|
||||
return WPNTYPE_RANGED;
|
||||
}
|
||||
|
||||
weapontype_t
|
||||
csweapon_melee_type(player pl)
|
||||
csweapon_melee_type(CSPlayer pl)
|
||||
{
|
||||
return WPNTYPE_CLOSE;
|
||||
}
|
||||
|
||||
float
|
||||
Cstrike_CalculateMovementInaccuracy(player pl) {
|
||||
Cstrike_CalculateMovementInaccuracy(CSPlayer pl) {
|
||||
float m = 1.0f;
|
||||
float maxspeed = 250;
|
||||
float speedlimit_low = maxspeed/3;
|
||||
|
@ -61,7 +61,7 @@ Cstrike_CalculateMovementInaccuracy(player pl) {
|
|||
}
|
||||
if (!(pl.flags & FL_ONGROUND)) {
|
||||
m = 2.5f;
|
||||
}else if (pl.flags & FL_CROUCHING) {
|
||||
}else if (pl.IsCrouching()) {
|
||||
m *= 0.6f;
|
||||
}
|
||||
return bound(0.75f,m,2.5f);
|
||||
|
@ -69,7 +69,7 @@ Cstrike_CalculateMovementInaccuracy(player pl) {
|
|||
|
||||
/* called whenever a cstrike gun fires a successful shot */
|
||||
void
|
||||
Cstrike_ShotMultiplierAdd(player pl, float shots, float strength, float inaccuracy)
|
||||
Cstrike_ShotMultiplierAdd(CSPlayer pl, float shots, float strength, float inaccuracy)
|
||||
{
|
||||
int r;
|
||||
inaccuracy = bound(.95,inaccuracy*50+0.1,1.6);
|
||||
|
@ -154,7 +154,7 @@ Cstrike_ShotMultiplierAdd(player pl, float shots, float strength, float inaccura
|
|||
|
||||
/* generate an accuracy value that we'll pass onto TraceAttack */
|
||||
float
|
||||
Cstrike_CalculateAccuracy(player pl, float divisor, float movement_penalty=1)
|
||||
Cstrike_CalculateAccuracy(CSPlayer pl, float divisor, float movement_penalty=1)
|
||||
{
|
||||
float inacc = 0;
|
||||
float m = Cstrike_CalculateMovementInaccuracy(pl);
|
||||
|
@ -179,12 +179,12 @@ Cstrike_CalculateAccuracy(player pl, float divisor, float movement_penalty=1)
|
|||
|
||||
|
||||
void
|
||||
Cstrike_BulletRecoil_ApplyPre(player pl, float strength) {
|
||||
Cstrike_BulletRecoil_ApplyPre(CSPlayer pl, float strength) {
|
||||
strength *= autocvar_fcs_guns_recoil_strength;
|
||||
pl.v_angle += strength*pl.punchangle*(2 - pl.cs_shotmultiplier/100*0.2);
|
||||
}
|
||||
void
|
||||
Cstrike_BulletRecoil_ApplyPost(player pl, float strength) {
|
||||
Cstrike_BulletRecoil_ApplyPost(CSPlayer pl, float strength) {
|
||||
strength *= autocvar_fcs_guns_recoil_strength;
|
||||
pl.v_angle -= strength*pl.punchangle*(2 - pl.cs_shotmultiplier/100*0.2);
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ Cstrike_BulletRecoil_ApplyPost(player pl, float strength) {
|
|||
|
||||
/* called whenever cstrike guns aren't firing */
|
||||
void
|
||||
Cstrike_ShotMultiplierUpdate(player pl)
|
||||
Cstrike_ShotMultiplierUpdate(CSPlayer pl)
|
||||
{
|
||||
if ((pl.cs_shotmultiplier > 0) && (pl.cs_shottime <= 0.0f)) {
|
||||
pl.cs_shottime = pl.w_attack_next + 0.01;
|
||||
|
@ -203,29 +203,28 @@ Cstrike_ShotMultiplierUpdate(player pl)
|
|||
}
|
||||
|
||||
void
|
||||
Cstrike_ShotReset(player pl)
|
||||
Cstrike_ShotReset(CSPlayer pl)
|
||||
{
|
||||
pl.cs_shottime = 0.0f;
|
||||
pl.cs_shotmultiplier = 0;
|
||||
}
|
||||
|
||||
void
|
||||
w_cstrike_weaponrelease(void)
|
||||
w_cstrike_weaponrelease(CSPlayer pl)
|
||||
{
|
||||
player pl = (player)self;
|
||||
pl.punchangle[1] *= 0.95;
|
||||
//pl.punchangle[1] *= 0.95;
|
||||
Cstrike_ShotMultiplierUpdate(pl);
|
||||
}
|
||||
|
||||
void
|
||||
w_cstrke_switched(player pl)
|
||||
w_cstrke_switched(CSPlayer pl)
|
||||
{
|
||||
Cstrike_ShotReset(pl);
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
void
|
||||
CStrikeView_UpdateGeomset(player pl)
|
||||
CStrikeView_UpdateGeomset(CSPlayer pl)
|
||||
{
|
||||
if (getplayerkeyfloat(pl.entnum-1, "*team") == TEAM_CT) {
|
||||
setcustomskin(pSeat->m_eViewModel, "", "geomset 0 2\ngeomset 1 1\n");
|
||||
|
|
1
zpak001.pk3dir/PAK_NAME
Normal file
1
zpak001.pk3dir/PAK_NAME
Normal file
|
@ -0,0 +1 @@
|
|||
package_cstrike.pk3
|
|
@ -2,6 +2,10 @@
|
|||
// this is so that users can tweak all the stuff we mostly guessed
|
||||
// and can make it more like how they want it to behave.
|
||||
|
||||
set sk_hostage_health1 100
|
||||
set sk_hostage_health2 100
|
||||
set sk_hostage_health3 100
|
||||
|
||||
// knife: primary attack range
|
||||
set sk_plr_knife_range1 48
|
||||
set sk_plr_knife_range2 48
|
||||
|
@ -177,7 +181,7 @@ set sk_plr_awp_dmg1 115
|
|||
set sk_plr_awp_dmg2 115
|
||||
set sk_plr_awp_dmg3 115
|
||||
|
||||
// para: bullet damage
|
||||
set sk_plr_para_dmg1 35
|
||||
set sk_plr_para_dmg2 35
|
||||
set sk_plr_para_dmg3 35
|
||||
// m249: bullet damage
|
||||
set sk_plr_m249_dmg1 35
|
||||
set sk_plr_m249_dmg2 35
|
||||
set sk_plr_m249_dmg3 35
|
||||
|
|
19
zpak001.pk3dir/csprogs.dat.en.po → zpak001.pk3dir/csprogs.dat.default.po
Executable file → Normal file
19
zpak001.pk3dir/csprogs.dat.en.po → zpak001.pk3dir/csprogs.dat.default.po
Executable file → Normal file
|
@ -1,21 +1,4 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-06-21 15:30+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
# English (Default) Locale file
|
||||
|
||||
msgid "VGUI_TITLE_MOTD"
|
||||
msgstr "Message Of The Day"
|
116
zpak001.pk3dir/def/ammo.def
Normal file
116
zpak001.pk3dir/def/ammo.def
Normal file
|
@ -0,0 +1,116 @@
|
|||
// these have to be defined by the game.
|
||||
entityDef ammo_types {
|
||||
"ammo_none" "0"
|
||||
"ammo_338magnum" "1"
|
||||
"ammo_357sig" "2"
|
||||
"ammo_45acp" "3"
|
||||
"ammo_50ae" "4"
|
||||
"ammo_556nato" "5"
|
||||
"ammo_556natobox" "6"
|
||||
"ammo_57mm" "7"
|
||||
"ammo_762nato" "8"
|
||||
"ammo_9mm" "9"
|
||||
"ammo_buckshot" "10"
|
||||
"ammo_hegrenade" "11"
|
||||
"ammo_smokegrenade" "12"
|
||||
"ammo_flashbang" "13"
|
||||
}
|
||||
|
||||
entityDef ammo_names {
|
||||
"ammo_none" "None"
|
||||
"ammo_338magnum" ".338 Lapua Magnum"
|
||||
"ammo_357sig" ".357 SIG"
|
||||
"ammo_45acp" ".45 ACP"
|
||||
"ammo_50ae" ".50 Action Express"
|
||||
"ammo_556nato" "5.56×45mm NATO"
|
||||
"ammo_556natobox" "5.56×45mm NATO BOX"
|
||||
"ammo_57mm" "FN 5.7×28mm"
|
||||
"ammo_762nato" "7.62×51mm NATO"
|
||||
"ammo_9mm" "9×19mm Parabellum"
|
||||
"ammo_buckshot" "Buckshot"
|
||||
"ammo_hegrenade" "HE Grenade"
|
||||
"ammo_smokegrenade" "Smoke Grenade"
|
||||
"ammo_flashbang" "Flashbang"
|
||||
}
|
||||
|
||||
entityDef ammo_base
|
||||
{
|
||||
"spawnclass" "NSItem"
|
||||
"snd_acquire" "ammo.pickup"
|
||||
"snd_respawn" "ammo.respawn"
|
||||
"mins" "-16 -16 0"
|
||||
"maxs" "16 16 16"
|
||||
"model" "models/w_backpack.mdl"
|
||||
}
|
||||
|
||||
// these don't exist as pickups in the game, but
|
||||
// might be helpful nonetheless
|
||||
entityDef ammo_338magnum
|
||||
{
|
||||
"editor_usage" "Ammo used by weapon_awp"
|
||||
"inherit" "ammo_base"
|
||||
"inv_ammo_338magnum" "10"
|
||||
}
|
||||
|
||||
entityDef ammo_357sig
|
||||
{
|
||||
"editor_usage" "Ammo used by weapon_p228"
|
||||
"inherit" "ammo_base"
|
||||
"inv_ammo_357sig" "13"
|
||||
}
|
||||
|
||||
entityDef ammo_45acp
|
||||
{
|
||||
"editor_usage" "Ammo used by weapon_mac10, weapon_ump45, weapon_usp45"
|
||||
"inherit" "ammo_base"
|
||||
"inv_ammo_45acp" "12"
|
||||
}
|
||||
|
||||
entityDef ammo_50ae
|
||||
{
|
||||
"editor_usage" "Ammo used by weapon_deagle"
|
||||
"inherit" "ammo_base"
|
||||
"inv_ammo_50ae" "7"
|
||||
}
|
||||
|
||||
entityDef ammo_556nato
|
||||
{
|
||||
"editor_usage" "Ammo used by weapon_m4a1, weapon_sg550, weapon_sg552"
|
||||
"inherit" "ammo_base"
|
||||
"inv_ammo_556nato" "30"
|
||||
}
|
||||
|
||||
entityDef ammo_556natobox
|
||||
{
|
||||
"editor_usage" "Ammo used by weapon_m249"
|
||||
"inherit" "ammo_base"
|
||||
"inv_ammo_556natobox" "30"
|
||||
}
|
||||
|
||||
entityDef ammo_57mm
|
||||
{
|
||||
"editor_usage" "Ammo used by weapon_fiveseven, weapon_p90"
|
||||
"inherit" "ammo_base"
|
||||
"inv_ammo_57mm" "50"
|
||||
}
|
||||
|
||||
entityDef ammo_762nato
|
||||
{
|
||||
"editor_usage" "Ammo used by weapon_aug, weapon_famas, weapon_g3sg1, weapon_galil, weapon_ak47, weapon_scout"
|
||||
"inherit" "ammo_base"
|
||||
"inv_ammo_762nato" "30"
|
||||
}
|
||||
|
||||
entityDef ammo_9mm
|
||||
{
|
||||
"editor_usage" "Ammo used by weapon_elites, weapon_glock18, weapon_mp5navy, weapon_tmp"
|
||||
"inherit" "ammo_base"
|
||||
"inv_ammo_9mm" "30"
|
||||
}
|
||||
|
||||
entityDef ammo_buckshot
|
||||
{
|
||||
"editor_usage" "Ammo used by weapon_m3, weapon_xm1014"
|
||||
"inherit" "ammo_base"
|
||||
"inv_ammo_buckshot" "8"
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
entityDef bot
|
||||
{
|
||||
spawnclass csbot
|
||||
}
|
16
zpak001.pk3dir/def/hostage.def
Normal file
16
zpak001.pk3dir/def/hostage.def
Normal file
|
@ -0,0 +1,16 @@
|
|||
entityDef hostage_entity
|
||||
{
|
||||
"spawnclass" "CSHostage"
|
||||
"model" "models/hostage.mdl"
|
||||
"netname" "Hostage"
|
||||
"health" "skill:hostage_health"
|
||||
"mins" "-16 -16 0"
|
||||
"maxs" "16 16 72"
|
||||
"eye_height" "64"
|
||||
"team" "0"
|
||||
"propdata" "actor_human"
|
||||
|
||||
"follow_on_use" "1"
|
||||
"speed_walk" "64"
|
||||
"speed_run" "364"
|
||||
}
|
12
zpak001.pk3dir/def/item_c4.def
Normal file
12
zpak001.pk3dir/def/item_c4.def
Normal file
|
@ -0,0 +1,12 @@
|
|||
entityDef item_c4
|
||||
{
|
||||
"spawnclass" "CSBombEntity"
|
||||
"model" "models/w_c4.mdl"
|
||||
"model_led" "sprites/ledglow.spr"
|
||||
"snd_beep1" "weapon_c4bomb.beep1"
|
||||
"snd_beep2" "weapon_c4bomb.beep2"
|
||||
"snd_beep3" "weapon_c4bomb.beep3"
|
||||
"snd_beep4" "weapon_c4bomb.beep4"
|
||||
"snd_beep5" "weapon_c4bomb.beep5"
|
||||
"snd_planted" "c4.plant"
|
||||
}
|
4
zpak001.pk3dir/def/player.def
Normal file
4
zpak001.pk3dir/def/player.def
Normal file
|
@ -0,0 +1,4 @@
|
|||
entityDef player
|
||||
{
|
||||
"spawnclass" "CSPlayer"
|
||||
}
|
26
zpak001.pk3dir/def/spawns.def
Normal file
26
zpak001.pk3dir/def/spawns.def
Normal file
|
@ -0,0 +1,26 @@
|
|||
entityDef info_player_start
|
||||
{
|
||||
"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
|
||||
{
|
||||
"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
|
||||
{
|
||||
"editor_mins" "-16 -16 -36"
|
||||
"editor_maxs" "16 16 36"
|
||||
"editor_description" "Cooperative Spawn Point"
|
||||
"editor_color" "1 0 0"
|
||||
"spawnclass" "NSSpawnPoint"
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
#include "weapons/ak47.def"
|
||||
#include "weapons/aug.def"
|
||||
#include "weapons/awp.def"
|
||||
#include "weapons/c4.def"
|
||||
#include "weapons/deagle.def"
|
||||
#include "weapons/elites.def"
|
||||
#include "weapons/famas.def"
|
||||
#include "weapons/fiveseven.def"
|
||||
#include "weapons/flashbang.def"
|
||||
#include "weapons/g3sg1.def"
|
||||
#include "weapons/galil.def"
|
||||
#include "weapons/glock18.def"
|
||||
#include "weapons/hegrenade.def"
|
||||
#include "weapons/knife.def"
|
||||
#include "weapons/m249.def"
|
||||
#include "weapons/m3.def"
|
||||
#include "weapons/m4a1.def"
|
||||
#include "weapons/mac10.def"
|
||||
#include "weapons/mp5navy.def"
|
||||
#include "weapons/p228.def"
|
||||
#include "weapons/p90.def"
|
||||
#include "weapons/scout.def"
|
||||
#include "weapons/sg550.def"
|
||||
#include "weapons/sg552.def"
|
||||
#include "weapons/smokegrenade.def"
|
||||
#include "weapons/tmp.def"
|
||||
#include "weapons/ump45.def"
|
||||
#include "weapons/usp.def"
|
||||
#include "weapons/xm1014.def"
|
||||
|
||||
entityDef CSBaseMelee
|
||||
{
|
||||
"spawnclass" "CSWeapon"
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"snd_acquire" "Player.PickupWeapon"
|
||||
}
|
||||
|
||||
entityDef CSBasePistol
|
||||
{
|
||||
"spawnclass" "CSWeapon"
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"semiAuto" "1"
|
||||
"snd_acquire" "Player.PickupWeapon"
|
||||
"snd_empty" "Default.ClipEmpty_Pistol"
|
||||
}
|
||||
|
||||
entityDef CSBaseRifle
|
||||
{
|
||||
"spawnclass" "CSWeapon"
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"snd_acquire" "Player.PickupWeapon"
|
||||
"snd_empty" "Default.ClipEmpty_Rifle"
|
||||
}
|
||||
|
||||
entityDef CSBaseShotgun
|
||||
{
|
||||
"spawnclass" "CSWeapon"
|
||||
"editor_color" ".3 .3 1"
|
||||
"editor_mins" "-16 -16 -16"
|
||||
"editor_maxs" "16 16 16"
|
||||
"editor_rotatable" "1"
|
||||
|
||||
"snd_acquire" "Player.PickupWeapon"
|
||||
}
|
54
zpak001.pk3dir/def/weapons/ak47.def
Normal file
54
zpak001.pk3dir/def/weapons/ak47.def
Normal file
|
@ -0,0 +1,54 @@
|
|||
entityDef weapon_ak47
|
||||
{
|
||||
"inherit" "CSBaseRifle"
|
||||
"editor_usage" "AK-47 Weapon - Uses ammo_762nato"
|
||||
|
||||
"model" "models/w_ak47.mdl"
|
||||
"model_view" "models/v_ak47.mdl"
|
||||
|
||||
"inv_name" "AK-47 Weapon"
|
||||
"def_fireInfo" "fireInfo_ak47"
|
||||
"clipSize" "30"
|
||||
|
||||
"actFire" "3,4,5"
|
||||
"actReload" "1"
|
||||
"actDraw" "2"
|
||||
"actIdle" "0"
|
||||
|
||||
"snd_fire" "Weapon_AK47.Single"
|
||||
|
||||
"speed_mod" "0.884"
|
||||
"price" "2500"
|
||||
"crossMinDist" "4"
|
||||
"crossDeltaDist" "4"
|
||||
"accuracyDivisor" "30"
|
||||
"accuracyMovementPenalty" "3"
|
||||
"accuracyMultiplier" "1.5"
|
||||
"rangeModifier" "2.375"
|
||||
"penetrationPower" "1.0"
|
||||
"bulletStrength" "1.2"
|
||||
"multiplierShots" "1.1"
|
||||
"multiplierStrength" "0.92"
|
||||
"multiplierInaccuracy" "0.5"
|
||||
|
||||
"hudSlot" "0"
|
||||
"hudSlotPos" "7"
|
||||
"weight" "25"
|
||||
}
|
||||
|
||||
entityDef projectile_ak47
|
||||
{
|
||||
"inherit" "projectile_bullet_base"
|
||||
"damage" "skill:plr_ak47_dmg"
|
||||
}
|
||||
|
||||
entityDef fireInfo_ak47
|
||||
{
|
||||
"def_onFire" "projectile_ak47"
|
||||
"ammoType" "ammo_762nato"
|
||||
"ammoRequired" "1"
|
||||
"ammoPerShot" "1"
|
||||
"fireRate" ".0975"
|
||||
"punchAngle" "-2 0 0"
|
||||
"model_flash" "sprites/muzzleflash2.spr"
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue