From 42a97f73d37846ac59edbc8633045f8b4cb353dd Mon Sep 17 00:00:00 2001 From: Chris Dawalt Date: Sat, 7 Aug 2021 06:05:46 -0400 Subject: [PATCH] Major weapons cleanup and default pitched sound support --- src/client/game_event.qc | 3 + src/client/hud.qc | 35 +- src/client/hud_weaponselect.qc | 8 +- src/client/inventory_logic_draw.h | 1 - src/client/inventory_logic_draw.qc | 25 +- src/client/precache.qc | 46 +- src/client/vgui_buysidemenu.qc | 103 +- src/server/precache.qc | 72 +- src/shared/ammo.h | 33 +- src/shared/ammo.qc | 40 +- src/shared/event_custom.h | 4 +- src/shared/event_custom.qc | 20 +- src/shared/event_enum.h | 1 + src/shared/include.src | 12 +- src/shared/input.qc | 16 +- src/shared/inventory_logic.qc | 2 +- src/shared/player.h | 49 +- src/shared/player.qc | 29 +- src/shared/precache.qc | 238 ++--- src/shared/sound_pitched.qc | 173 +++- src/shared/weapons.h | 208 ++-- src/shared/weapons.qc | 411 ++++---- src/shared/weapons/weapon_ak47.qc | 88 +- src/shared/weapons/weapon_akimbocolts.qc | 115 +-- src/shared/weapons/weapon_barrett_m82.qc | 294 ------ src/shared/weapons/weapon_barrettm82.qc | 260 +++++ src/shared/weapons/weapon_benellim3.qc | 111 +-- src/shared/weapons/weapon_beretta.qc | 113 +-- src/shared/weapons/weapon_beretta_akimbo.qc | 117 +-- src/shared/weapons/weapon_combatknife.qc | 130 +-- src/shared/weapons/weapon_contenderg2.qc | 117 +-- src/shared/weapons/weapon_deserteagle.qc | 97 +- src/shared/weapons/weapon_fiveseven.qc | 98 +- src/shared/weapons/weapon_fiveseven_akimbo.qc | 123 +-- src/shared/weapons/weapon_glock18.qc | 91 +- src/shared/weapons/weapon_glock20.qc | 89 +- src/shared/weapons/weapon_hk_pdw.qc | 297 ------ src/shared/weapons/weapon_hkpdw.qc | 266 +++++ src/shared/weapons/weapon_karate.qc | 128 +-- src/shared/weapons/weapon_katana.qc | 116 +-- src/shared/weapons/weapon_m16a4.qc | 80 +- src/shared/weapons/weapon_m4a1.qc | 84 +- src/shared/weapons/weapon_m60.qc | 80 +- src/shared/weapons/weapon_m61grenade.qc | 134 +-- src/shared/weapons/weapon_mac10.qc | 80 +- src/shared/weapons/weapon_miniuzi.qc | 101 +- src/shared/weapons/weapon_miniuzi_akimbo.qc | 107 +- src/shared/weapons/weapon_mossberg500.qc | 142 +-- src/shared/weapons/weapon_mp5k.qc | 82 +- src/shared/weapons/weapon_mp5sd.qc | 72 +- src/shared/weapons/weapon_ragingbull.qc | 90 +- src/shared/weapons/weapon_rugermk1.qc | 88 +- src/shared/weapons/weapon_sawedoff.qc | 110 +-- src/shared/weapons/weapon_sealknife.qc | 96 +- src/shared/weapons/weapon_skorpion.qc | 82 +- src/shared/weapons/weapon_skorpion_akimbo.qc | 110 +-- src/shared/weapons/weapon_socom_mk23.qc | 311 ------ src/shared/weapons/weapon_socommk23.qc | 276 ++++++ ...3_akimbo.qc => weapon_socommk23_akimbo.qc} | 916 +++++++++--------- src/shared/weapons/weapon_spas12.qc | 96 +- src/shared/weapons/weapon_steyr_aug.qc | 293 ------ src/shared/weapons/weapon_steyr_tmp.qc | 309 ------ src/shared/weapons/weapon_steyraug.qc | 259 +++++ src/shared/weapons/weapon_steyrtmp.qc | 274 ++++++ src/shared/weapons/weapon_ump.qc | 83 +- src/shared/weapons/weapon_usas12.qc | 87 +- 66 files changed, 3540 insertions(+), 5081 deletions(-) delete mode 100644 src/shared/weapons/weapon_barrett_m82.qc create mode 100644 src/shared/weapons/weapon_barrettm82.qc delete mode 100644 src/shared/weapons/weapon_hk_pdw.qc create mode 100644 src/shared/weapons/weapon_hkpdw.qc delete mode 100644 src/shared/weapons/weapon_socom_mk23.qc create mode 100644 src/shared/weapons/weapon_socommk23.qc rename src/shared/weapons/{weapon_socom_mk23_akimbo.qc => weapon_socommk23_akimbo.qc} (54%) delete mode 100644 src/shared/weapons/weapon_steyr_aug.qc delete mode 100644 src/shared/weapons/weapon_steyr_tmp.qc create mode 100644 src/shared/weapons/weapon_steyraug.qc create mode 100644 src/shared/weapons/weapon_steyrtmp.qc diff --git a/src/client/game_event.qc b/src/client/game_event.qc index 20a632b..8fac1e0 100644 --- a/src/client/game_event.qc +++ b/src/client/game_event.qc @@ -198,6 +198,9 @@ ClientGame_EventParse(float fHeader) case EVENT_TS::SOUNDPITCHED: SoundPitched_Receive(); break; + case EVENT_TS::SOUNDPITCHED_CHANNEL: + SoundPitched_Channel_Receive(); + break; /* // can this even happen anymore? // If a drop-weapon call can be signaled by the server, not shared with the client & server diff --git a/src/client/hud.qc b/src/client/hud.qc index 878f58c..12902f1 100644 --- a/src/client/hud.qc +++ b/src/client/hud.qc @@ -75,9 +75,10 @@ HUD_Draw(void) if(pl.flZoomLevel < 0.5){ //is this < 40? yes. HUD_DrawScope(); }else{ - // We'll leave details like extra details for the lasersight and the weight bars at a - // bare minimum (should be drawn at all times, oversight in TS 2.1 that they're missing - // from melee views like with knives, katana, corrected in 3.0 of all things) + // We'll leave details like extra details for the lasersight and the + // weight bars at a bare minimum (should be drawn at all times, oversight + // in TS 2.1 that they're missing from melee views like with knives, + // katana, corrected in 3.0 of all things) HUD_DrawCrosshair(); } ////////////////////////////////////////////////////////////// @@ -88,10 +89,8 @@ HUD_Draw(void) ////////////////////////////////////////////////////////////// drawTimer(); drawPlayerStats(); - //TAGGG - CRITICAL. Nope, Weapons_DrawCrosshair actually calls a weapon's custom HUD drawing - // method. Odd name, but yes, it's not actually focused on just crosshairs. TS uses the more - // generic "HUD_DrawCrosshair" call above. - //drawPlayerCurrentWeaponStats(); + + // ---OLD LOCATION for weapon stats drawing (Weapons_DrawCrosshair) ////////////////////////////////////////////////////////////// @@ -104,9 +103,10 @@ HUD_Draw(void) HUD_DrawNotify(); // Nuclide provided method, draws the HL pain arrows - // Nope! Replaced with a completely new version that does that and more for more control. - // And not even calling from here, leaving that to PostDraw (draw.qc) instead. - // Might stop the pain flash from affecting the color of HUD draw's. + // Nope! Replaced with a completely new version that does that and more for + // more control. And not even calling from here, leaving that to PostDraw + // (draw.qc) instead. Might stop the pain flash from affecting the color of + // HUD draw's. //Damage_Draw(); //ClientGame_DamageDraw(); @@ -114,10 +114,11 @@ HUD_Draw(void) // Fake spectator, or the temporary forced third-person on death (not yet implemented). drawfont = FONT_20; - // TAGGG - could have some message from server-to-client on changing from player to spectator - // to call this only then, but I think doing this every frame for spectator is harmless anyway. - // Changing the FOV isn't necessary, that already comes with the spec/player change, some - // things are nicely defaulted for us in FTE. + // TAGGG - could have some message from server-to-client on changing from + // player to spectator to call this only then, but I think doing this every + // frame for spectator is harmless anyway. Changing the FOV isn't necessary, + // that already comes with the spec/player change, some things are nicely + // defaulted for us in FTE. setsensitivityscaler(1.0f); pSeat->m_iHUDWeaponSelected = 0; @@ -151,9 +152,9 @@ string g_specmodes[] = { "First Person" }; -// specatator main entry -// NOTE! This is for the real, Nuclide-provided spectator. -// The fake spectator is a normal player entity with iState set to PLAYER_STATE::NOCLIP. +// specatator main entry (method cloned from FreeHL) +// -NOTE! This is for the real, Nuclide-provided spectator. The fake spectator is a +// normal player entity with iState set to PLAYER_STATE::NOCLIP. // HUD_DRAW above is still called in that case. That needs the MoTD and buymenu. void HUD_DrawSpectator(void) diff --git a/src/client/hud_weaponselect.qc b/src/client/hud_weaponselect.qc index 493c391..c4c6cae 100644 --- a/src/client/hud_weaponselect.qc +++ b/src/client/hud_weaponselect.qc @@ -223,7 +223,7 @@ TS_HUD_DrawWeaponSelect(void) // the below methods. if(pSeat->m_flHUDWeaponSelectTime != -1){ pSeat->m_flHUDWeaponSelectTime = -1; - + //printfline("HUD_DrawWeaponSelect IM closin my weapon select 1"); TS_HUD_CloseWeaponSelect(TRUE); @@ -682,6 +682,9 @@ TS_HUD_CloseWeaponSelect(BOOL playOffSound) { player pl = (player)pSeat->m_ePlayer; + pl.weaponSelectHighlightID = -1; + pl.weaponSelectHighlightAkimbo = FALSE; + if(pSeat->m_flHUDWeaponSelectTime != -1){ if(playOffSound && getplayerkeyvalue(player_localnum, "*spec") == "0" ){ @@ -689,9 +692,6 @@ TS_HUD_CloseWeaponSelect(BOOL playOffSound) } //pSeat->fHUDWeaponSelected = 0; //no harm but no need now - pl.weaponSelectHighlightID = -1; - pl.weaponSelectHighlightAkimbo = FALSE; - pSeat->m_flHUDWeaponSelectTime = -1; return TRUE; } diff --git a/src/client/inventory_logic_draw.h b/src/client/inventory_logic_draw.h index 3bd3a84..a8fbf20 100644 --- a/src/client/inventory_logic_draw.h +++ b/src/client/inventory_logic_draw.h @@ -61,7 +61,6 @@ void drawPlayerInventory(BOOL arg_fBuyMode); void drawPlayerInventory_place(int arg_iSlot, int arg_iRow, string arg_sWeaponSpritePath, string arg_sSelectedWeaponDisplayName, BOOL arg_fBuyMode, optional int ammoCount, optional BOOL hasAnyAmmo, optional int bitsUpgradeOpts); -void drawPlayerCurrentWeaponStats(void); void drawPlayerStats(void); void drawTimer(void); diff --git a/src/client/inventory_logic_draw.qc b/src/client/inventory_logic_draw.qc index 883700f..051957e 100644 --- a/src/client/inventory_logic_draw.qc +++ b/src/client/inventory_logic_draw.qc @@ -19,7 +19,7 @@ drawWeaponOptionBar( }else{ DRAW_IMAGE_ADDITIVE(img_item_installed, tempVec, clrPaleBlue, arg_opac - 0.50f) } -}//drawWeaponOptionBar +}// drawWeaponOptionBar void @@ -68,7 +68,7 @@ drawPlayerInventory_TopBar(int arg_iSlotSelected, BOOL arg_fBuyMode) vWeaponsBar_drawLoc.y = vWeaponsBar_drawBase.y + 0; DRAW_IMAGE_CROPPED_ADDITIVE(spr_number5, vWeaponsBar_drawLoc, clrPaleBlue, 0.89f) -}//drawPlayerInventory_TopBar +}// drawPlayerInventory_TopBar // While in the buy screen, draw each slot according to the current temp config. @@ -349,24 +349,9 @@ drawPlayerInventory_place DRAW_IMAGE_ADDITIVE(img_weapon, vDrawPos, clrHUDWeaponEmpty, fOpac) } -}//drawPlayerInventory_place +}// drawPlayerInventory_place -void -drawPlayerCurrentWeaponStats(void) -{ - player pl = (player)pSeat->m_ePlayer; - - if(pl.inventoryEquippedIndex == -1){ - return; - } - - weapondynamic_t dynaRef = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapondata_basic_t* basicPointer = (weapondata_basic_t*) pl.getEquippedWeaponData(); - weapondata_basic_t basicRef = *(basicPointer); - - return basicRef.vOnDrawHUD(pl, dynaRef); -}//drawPlayerCurrentWeaponStats // See screenshots for what the bottom-left corner of the HUD ingame should look like. @@ -450,7 +435,7 @@ drawPlayerStats(void) offsetRight = drawSpriteNumber(ary_LCD_numberSet, drawerX + 8, drawerY + 20 + 2, getstati(STAT_RULE_MAXWEIGHTSLOTS) - pl.iTotalSlots, 8, BITS_DIGITOPT_NONE, clrPaleBlue, 0.92f); Gfx_Text( [drawerX + 8 + offsetRight + 6, drawerY + 20 + 4], "free slots", vButtonFontSize, clrPaleBlue, 0.96f, DRAWFLAG_ADDITIVE, FONT_ARIAL_STD ); -}//drawPlayerStats +}// drawPlayerStats void @@ -488,6 +473,6 @@ drawTimer(void) Gfx_Text( [drawerX + numberFontWidth*3 + 4, drawerY + 1], ":", vFontSizeNumSlash, clrDraw, fOpac, DRAWFLAG_ADDITIVE, FONT_ARIAL_NUMSLASH ); drawSpriteNumber(ary_LCD_numberSet, drawerX + numberFontWidth*4, drawerY, iSeconds, 2, BITS_DIGITOPT_FILLER0, clrDraw, fOpac); -}//drawTimer +}// drawTimer diff --git a/src/client/precache.qc b/src/client/precache.qc index 425db58..1312c9f 100644 --- a/src/client/precache.qc +++ b/src/client/precache.qc @@ -7,25 +7,22 @@ void ClientGame_Precache(void){ printfline("***ClientGame_Precache called***"); SharedGame_Precache(); + // these might be redundant with shell sounds being precached, but then + // again some are from the valve gamemod + Sound_Precache("modelevent_shell.land"); + Sound_Precache("modelevent_shotgunshell.land"); - - //TAGGG - From FreeHL. Anything that ends up unused by FreeTS can be removed, - // including sound config files that are then unused. + //TAGGG - From FreeHL. + // Does TS use something else? //////////////////////////////////////////////////////////// - precache_model("models/shell.mdl"); - precache_model("models/shotgunshell.mdl"); precache_model("sprites/muzzleflash1.spr"); precache_model("sprites/muzzleflash2.spr"); precache_model("sprites/muzzleflash3.spr"); - - Sound_Precache("modelevent_shell.land"); //////////////////////////////////////////////////////////// - precache_sound("weapons/draw.wav"); - PART_EXPLOSION = particleeffectnum("explosion.explosion_grenade"); @@ -45,34 +42,10 @@ void ClientGame_Precache(void){ precache_model("sprites/player/stand.spr"); - for(int i = 1; i < WEAPON_ID::LAST_ID; i++){ - if(ary_weaponData[i] != NULL){ - weapondata_basic_t* basicPointer = (weapondata_basic_t*) ary_weaponData[i]; - weapondata_basic_t basicRef = *(basicPointer); - - if(basicRef.sIconFilePath != NULL){ - precache_model(basicRef.sIconFilePath); - } - } - } - for(int i = 1; i < WEAPON_AKIMBO_UPGRADE_ID::LAST_ID; i++){ - if(ary_akimboUpgradeData[i] != NULL){ - weapondata_basic_t* basicPointer = (weapondata_basic_t*) ary_akimboUpgradeData[i]; - weapondata_basic_t basicRef = *(basicPointer); - - if(basicRef.sIconFilePath != NULL){ - precache_model(basicRef.sIconFilePath); - } - } - } - - - precache_model("sprites/weapons/item_installed.spr"); precache_model("sprites/weapons/item_not_installed.spr"); - precache_model("sprites/wires/bwire.spr"); precache_model("sprites/wires/bwirecutted.spr"); precache_model("sprites/wires/gwire.spr"); @@ -161,7 +134,7 @@ void ClientGame_Precache(void){ precache_model("sprites/xsmoke1.spr"); - // for tga's only. drop the extension... I think. + // for tga's only precache_pic("textures/quarterscope.tga"); //precache_pic("textures/scope_cross_plus.tga"); precache_pic("textures/scope_cross_plus_odd.tga"); @@ -169,14 +142,13 @@ void ClientGame_Precache(void){ //precache_pic("textures/cal_9x18mm.tga"); - //...do we know what of these we even need? + // do we know what of these we even need? precache_model("sprites/fexplo.spr"); precache_sound("common/wpn_hudon.wav"); precache_sound("common/wpn_hudoff.wav"); precache_sound("common/wpn_moveselect.wav"); - precache_sound("common/wpn_select.wav"); - + // "common/wpn_select.wav" is precached shared according to FreeHL? } diff --git a/src/client/vgui_buysidemenu.qc b/src/client/vgui_buysidemenu.qc index 9cd214d..688c3af 100644 --- a/src/client/vgui_buysidemenu.qc +++ b/src/client/vgui_buysidemenu.qc @@ -124,50 +124,49 @@ var CBuySideMenu_BasicButton buysidemenu_btn_Buy_Rifles; var CBuySideMenu_BasicButton buysidemenu_btn_Buy_Shotguns; var CBuySideMenu_BasicButton buysidemenu_btn_Buy_SpecialPurpose; -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_Glock18; -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_SOCOM_MK23; -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_DesertEagle; -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_FiveSeven; -//var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_AkimboBerettas; -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_Beretta; -//var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_GoldenColts; -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_AkimboColts; +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_GLOCK18; +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_SOCOMMK23; +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_DESERTEAGLE; +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_FIVESEVEN; +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_BERETTA; +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_AKIMBOCOLTS; -//var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_Glock20C; -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_Glock20; +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_GLOCK20; -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_RugerMK1; -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_RagingBull; -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_ContenderG2; +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_RUGERMK1; +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_RAGINGBULL; +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_CONTENDERG2; -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_MiniUzi; +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_MINIUZI; var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_MP5SD; var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_MP5K; -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_STEYR_TMP; -// called the MP7PDW ingame? -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_HK_PDW; +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_STEYRTMP; + +// called the MP7PDW ingame? ts_fgd refers to it as "HK Pdw" though +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_HKPDW; + var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_MAC10; var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_UMP; -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_Skorpion; +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_SKORPION; var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_M4A1; var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_AK47; -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_STEYR_AUG; +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_STEYRAUG; var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_M16A4; -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_Barrett_M82; +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_BARRETTM82; -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_BenelliM3; +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_BENELLIM3; var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_USAS12; var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_SPAS12; -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_Mossberg500; -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_SawedOff; +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_MOSSBERG500; +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_SAWEDOFF; -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_M61Grenade; -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_CombatKnife; +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_M61GRENADE; +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_COMBATKNIFE; var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_M60; -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_Katana; -var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_SealKnife; +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_KATANA; +var CBuySideMenu_WeaponButton buysidemenu_btn_Buy_SEALKNIFE; @@ -1351,51 +1350,51 @@ VGUI_BuySideMenu_OnInit(void) weapondata_basic_t tempWeapRef; - INITIALIZE_WEAPONBUTTON(Glock18, "1", clrPaleBlue, NULL, Handguns) - INITIALIZE_WEAPONBUTTON(SOCOM_MK23, "2", clrPaleBlue, NULL, Handguns) - INITIALIZE_WEAPONBUTTON(DesertEagle, "3", clrPaleBlue, NULL, Handguns) - INITIALIZE_WEAPONBUTTON(FiveSeven, "4", clrPaleBlue, NULL, Handguns) - INITIALIZE_WEAPONBUTTON(Beretta, "5", clrPaleBlue, NULL, Handguns) - INITIALIZE_WEAPONBUTTON(AkimboColts, "6", clrPaleBlue, NULL, Handguns) - INITIALIZE_WEAPONBUTTON(Glock20, "7", clrPaleBlue, NULL, Handguns) - INITIALIZE_WEAPONBUTTON(RugerMK1, "8", clrPaleBlue, NULL, Handguns) - INITIALIZE_WEAPONBUTTON(RagingBull, "9", clrPaleBlue, NULL, Handguns) - INITIALIZE_WEAPONBUTTON(ContenderG2, "A", clrPaleBlue, NULL, Handguns) + INITIALIZE_WEAPONBUTTON(GLOCK18, "1", clrPaleBlue, NULL, Handguns) + INITIALIZE_WEAPONBUTTON(SOCOMMK23, "2", clrPaleBlue, NULL, Handguns) + INITIALIZE_WEAPONBUTTON(DESERTEAGLE, "3", clrPaleBlue, NULL, Handguns) + INITIALIZE_WEAPONBUTTON(FIVESEVEN, "4", clrPaleBlue, NULL, Handguns) + INITIALIZE_WEAPONBUTTON(BERETTA, "5", clrPaleBlue, NULL, Handguns) + INITIALIZE_WEAPONBUTTON(AKIMBOCOLTS, "6", clrPaleBlue, NULL, Handguns) + INITIALIZE_WEAPONBUTTON(GLOCK20, "7", clrPaleBlue, NULL, Handguns) + INITIALIZE_WEAPONBUTTON(RUGERMK1, "8", clrPaleBlue, NULL, Handguns) + INITIALIZE_WEAPONBUTTON(RAGINGBULL, "9", clrPaleBlue, NULL, Handguns) + INITIALIZE_WEAPONBUTTON(CONTENDERG2, "A", clrPaleBlue, NULL, Handguns) - INITIALIZE_WEAPONBUTTON(MiniUzi, "1", clrPaleBlue, NULL, SMGs) + INITIALIZE_WEAPONBUTTON(MINIUZI, "1", clrPaleBlue, NULL, SMGs) INITIALIZE_WEAPONBUTTON(MP5SD, "2", clrPaleBlue, NULL, SMGs) INITIALIZE_WEAPONBUTTON(MP5K, "3", clrPaleBlue, NULL, SMGs) - INITIALIZE_WEAPONBUTTON(STEYR_TMP, "4", clrPaleBlue, NULL, SMGs) - INITIALIZE_WEAPONBUTTON(HK_PDW, "5", clrPaleBlue, NULL, SMGs) + INITIALIZE_WEAPONBUTTON(STEYRTMP, "4", clrPaleBlue, NULL, SMGs) + INITIALIZE_WEAPONBUTTON(HKPDW, "5", clrPaleBlue, NULL, SMGs) INITIALIZE_WEAPONBUTTON(UMP, "6", clrPaleBlue, NULL, SMGs) - INITIALIZE_WEAPONBUTTON(Skorpion, "7", clrPaleBlue, NULL, SMGs) + INITIALIZE_WEAPONBUTTON(SKORPION, "7", clrPaleBlue, NULL, SMGs) INITIALIZE_WEAPONBUTTON(MAC10, "8", clrPaleBlue, NULL, SMGs) INITIALIZE_WEAPONBUTTON(M4A1, "1", clrPaleBlue, NULL, Rifles) INITIALIZE_WEAPONBUTTON(AK47, "2", clrPaleBlue, NULL, Rifles) - INITIALIZE_WEAPONBUTTON(STEYR_AUG, "3", clrPaleBlue, NULL, Rifles) + INITIALIZE_WEAPONBUTTON(STEYRAUG, "3", clrPaleBlue, NULL, Rifles) INITIALIZE_WEAPONBUTTON(M16A4, "4", clrPaleBlue, NULL, Rifles) - INITIALIZE_WEAPONBUTTON(Barrett_M82, "5", clrPaleBlue, NULL, Rifles) + INITIALIZE_WEAPONBUTTON(BARRETTM82, "5", clrPaleBlue, NULL, Rifles) - INITIALIZE_WEAPONBUTTON(BenelliM3, "1", clrPaleBlue, NULL, Shotguns) + INITIALIZE_WEAPONBUTTON(BENELLIM3, "1", clrPaleBlue, NULL, Shotguns) INITIALIZE_WEAPONBUTTON(USAS12, "2", clrPaleBlue, NULL, Shotguns) INITIALIZE_WEAPONBUTTON(SPAS12, "3", clrPaleBlue, NULL, Shotguns) - INITIALIZE_WEAPONBUTTON(Mossberg500, "4", clrPaleBlue, NULL, Shotguns) - INITIALIZE_WEAPONBUTTON(SawedOff, "5", clrPaleBlue, NULL, Shotguns) + INITIALIZE_WEAPONBUTTON(MOSSBERG500, "4", clrPaleBlue, NULL, Shotguns) + INITIALIZE_WEAPONBUTTON(SAWEDOFF, "5", clrPaleBlue, NULL, Shotguns) // LATER - make purchaseable only if the gamemode is team/scenario. (mercs vs specialists) - INITIALIZE_WEAPONBUTTON(M61Grenade, "1", clrPaleBlue, NULL, SpecialPurpose) + INITIALIZE_WEAPONBUTTON(M61GRENADE, "1", clrPaleBlue, NULL, SpecialPurpose) - INITIALIZE_WEAPONBUTTON(CombatKnife, "2", clrPaleBlue, NULL, SpecialPurpose) + INITIALIZE_WEAPONBUTTON(COMBATKNIFE, "2", clrPaleBlue, NULL, SpecialPurpose) INITIALIZE_WEAPONBUTTON(M60, "3", clrPaleBlue, NULL, SpecialPurpose) - INITIALIZE_WEAPONBUTTON(Katana, "4", clrPaleBlue, NULL, SpecialPurpose) - INITIALIZE_WEAPONBUTTON(SealKnife, "5", clrPaleBlue, NULL, SpecialPurpose) + INITIALIZE_WEAPONBUTTON(KATANA, "4", clrPaleBlue, NULL, SpecialPurpose) + INITIALIZE_WEAPONBUTTON(SEALKNIFE, "5", clrPaleBlue, NULL, SpecialPurpose) //TODO - set these up. items are simpler than weapons and have no default behavior. // in fact the kevlar just puts armor on the player at spawn, stealthshoes may as well @@ -1403,8 +1402,8 @@ VGUI_BuySideMenu_OnInit(void) // Last parameter is the cost instead of the buy category, since we don't have // any weapondata to get the cost from. // ...we still need the category too though. - //INITIALIZE_ITEMBUTTON_ADV(Kevlar, "1", 48+1, clrPaleBlue, NULL, PlayerAccessory, 1900); - //INITIALIZE_ITEMBUTTON_ADV(StealthShoes, "2", 48+2, clrPaleBlue, NULL, PlayerAccessory, 700); + //INITIALIZE_ITEMBUTTON_ADV(KEVLAR, "1", 48+1, clrPaleBlue, NULL, PlayerAccessory, 1900); + //INITIALIZE_ITEMBUTTON_ADV(STEALTHSHOES, "2", 48+2, clrPaleBlue, NULL, PlayerAccessory, 700); buysidemenu_btn_Back_updateText(); //just in case. diff --git a/src/server/precache.qc b/src/server/precache.qc index 6baf5f5..f4a4528 100644 --- a/src/server/precache.qc +++ b/src/server/precache.qc @@ -15,25 +15,12 @@ void ServerGame_Precache(void){ Sound_Precache("player.lightfall"); precache_model("models/player.mdl"); - // no. - //precache_model("models/w_weaponbox.mdl"); //////////////////////////////////////////////////////////// - - //precache_sound("weapons/pistol-empty.wav"); - precache_sound("weapons/fnh/fnh-fire.wav"); - - //counterstikre leftovers... remove ASAP. - precache_sound("weapons/knife_slash1.wav"); - precache_sound("weapons/knife_slash2.wav"); - precache_sound("weapons/ak47-1.wav"); - precache_sound("weapons/ak47-2.wav"); - precache_model("models/powerup.mdl"); - // player models in cstrike are precached // serverside only, so we can too I suppose precache_model("models/player/agent/agent.mdl"); @@ -46,61 +33,13 @@ void ServerGame_Precache(void){ - - for(int i = 1; i < WEAPON_ID::LAST_ID; i++){ - if(ary_weaponData[i] != NULL){ - weapondata_basic_t* basicPointer = (weapondata_basic_t*) ary_weaponData[i]; - weapondata_basic_t basicRef = *(basicPointer); - - if(basicRef.sViewModelPath != NULL){ - precache_model(basicRef.sViewModelPath); - } - if(basicRef.sPlayerModelPath != NULL){ - precache_model(basicRef.sPlayerModelPath); - } - if(basicRef.sPlayerSilencerModelPath != NULL){ - precache_model(basicRef.sPlayerSilencerModelPath); - } - if(basicRef.sWorldModelPath != NULL){ - //printfline("I PRECACHED THIS %s", basicRef.sWorldModelPath); - precache_model(basicRef.sWorldModelPath); - } - //precache_model(basicRef.sIconFilePath); - } - } - for(int i = 1; i < WEAPON_AKIMBO_UPGRADE_ID::LAST_ID; i++){ - if(ary_akimboUpgradeData[i] != NULL){ - weapondata_basic_t* basicPointer = (weapondata_basic_t*) ary_akimboUpgradeData[i]; - weapondata_basic_t basicRef = *(basicPointer); - - if(basicRef.sViewModelPath != NULL){ - precache_model(basicRef.sViewModelPath); - } - if(basicRef.sPlayerModelPath != NULL){ - precache_model(basicRef.sPlayerModelPath); - } - if(basicRef.sPlayerSilencerModelPath != NULL){ - precache_model(basicRef.sPlayerSilencerModelPath); - } - if(basicRef.sWorldModelPath != NULL){ - //printfline("I PRECACHED THIS %s", basicRef.sWorldModelPath); - precache_model(basicRef.sWorldModelPath); - } - //precache_model(basicRef.sIconFilePath); - } - } - - - // do 3D models too. precache_model("models/ammopack.mdl"); - precache_model("sprites/glow01.spr"); - precache_sound("player/die1.wav"); precache_sound("player/die2.wav"); precache_sound("player/die3.wav"); @@ -115,13 +54,11 @@ void ServerGame_Precache(void){ precache_sound("player/pain3.wav"); precache_sound("player/pain4.wav"); - - + // for the grenade only so far. precache_sound("weapons/grenbounce1.wav"); precache_sound("weapons/grenbounce2.wav"); precache_sound("weapons/grenbounce3.wav"); precache_sound("weapons/grenbounce4.wav"); - precache_sound("explo/explode.wav"); precache_sound("explo/explode1.wav"); precache_sound("explo/explode2.wav"); @@ -131,12 +68,5 @@ void ServerGame_Precache(void){ precache_sound("goslow.wav"); - //Other weapons related... should this be in "shared" instead? - precache_sound("weapons/ak47/fire.wav"); - precache_sound("weapons/aug/aug-fire.wav"); - precache_sound("weapons/aug/aug-fire-sil.wav"); - precache_sound("weapons/barrett/fire.wav"); - //...ETC - } diff --git a/src/shared/ammo.h b/src/shared/ammo.h index df25e8c..9997499 100644 --- a/src/shared/ammo.h +++ b/src/shared/ammo.h @@ -1,39 +1,40 @@ +#define ASSIGN_AMMODATA(arg_constName) ary_ammoData[AMMO_ID::##arg_constName] = (ammodata_t*) &ammo_##arg_constName; +#define DECLARE_AMMODATA(arg_varName, arg_sDisplayName, arg_fPricePerBullet, arg_iMax) ammodata_t ammo_##arg_varName = {arg_sDisplayName, arg_fPricePerBullet, arg_iMax}; + + enum AMMO_ID{ NONE = 0, - _9x19mm = 1, - _45Acp = 2, - _p50AE = 3, + _9X19MM = 1, + _45ACP = 2, + _P50AE = 3, - _5p7x28 = 4, + _5P7X28 = 4, - _10mmAUTO = 5, - _p22LR = 6, - _p454Casull = 7, - _5p56Nato = 8, - _7p62x39mm = 9, + _10MMAUTO = 5, + _P22LR = 6, + _P454CASULL = 7, + _5P56NATO = 8, + _7P62X39MM = 9, _50BMG = 10, _SHELLS = 11, - //needed for the cut weapons from TS 2.0 + // needed for the cut weapons from TS 2.0 _32ACP = 12, - _7p62x51mm = 13, + _7P62X51MM = 13, LAST_ID = 14 }; -#define ASSIGN_AMMODATA(arg_constName) ary_ammoData[AMMO_ID::##arg_constName] = (ammodata_t*) &ammo_##arg_constName; -#define DECLARE_AMMODATA(arg_varName, arg_sDisplayName, arg_fPricePerBullet, arg_iMax) ammodata_t ammo_##arg_varName = {arg_sDisplayName, arg_fPricePerBullet, arg_iMax}; - - typedef struct{ string sDisplayName; float fPricePerBullet; int iMax; - // fPricePerBullet * iMax = total cost to fill (added for the first weapon of a given ammo type purchased) + // fPricePerBullet * iMax = total cost to fill (added for the first weapon of a + // given ammo type purchased) } ammodata_t; diff --git a/src/shared/ammo.qc b/src/shared/ammo.qc index 9ff1f32..49dde8d 100644 --- a/src/shared/ammo.qc +++ b/src/shared/ammo.qc @@ -1,35 +1,15 @@ - - DECLARE_AMMODATA(NONE, "_NONE_", 0, 0) -DECLARE_AMMODATA(_9x19mm, "9 x 19mm", 1.6666666666, 210) -DECLARE_AMMODATA(_45Acp, ".45Acp", 5.1, 200) - -DECLARE_AMMODATA(_p50AE, ".50AE", 7, 70) - - -DECLARE_AMMODATA(_5p7x28, "5.7 x 28", 6, 200) - - -DECLARE_AMMODATA(_10mmAUTO, "10mm AUTO", 4.9, 100) - -DECLARE_AMMODATA(_p22LR, ".22 LR", 6, 150) - -DECLARE_AMMODATA(_p454Casull, ".454 Casull", 30, 50) - -DECLARE_AMMODATA(_5p56Nato, "5.56 Nato", 2.6666666666, 90) - -DECLARE_AMMODATA(_7p62x39mm, "7.62 x 39mm", 3.3333333333, 90) - +DECLARE_AMMODATA(_9X19MM, "9 x 19mm", 1.6666666666, 210) +DECLARE_AMMODATA(_45ACP, ".45Acp", 5.1, 200) +DECLARE_AMMODATA(_P50AE, ".50AE", 7, 70) +DECLARE_AMMODATA(_5P7X28, "5.7 x 28", 6, 200) +DECLARE_AMMODATA(_10MMAUTO, "10mm AUTO", 4.9, 100) +DECLARE_AMMODATA(_P22LR, ".22 LR", 6, 150) +DECLARE_AMMODATA(_P454CASULL, ".454 Casull", 30, 50) +DECLARE_AMMODATA(_5P56NATO, "5.56 Nato", 2.6666666666, 90) +DECLARE_AMMODATA(_7P62X39MM, "7.62 x 39mm", 3.3333333333, 90) DECLARE_AMMODATA(_50BMG, "50BMG", 100, 20) - DECLARE_AMMODATA(_SHELLS, "SHELLS", 16, 60) - DECLARE_AMMODATA(_32ACP, ".32 ACP", 0.5, 300) -DECLARE_AMMODATA(_7p62x51mm, "7.62 x 51mm", 30, 35) - - - - - - \ No newline at end of file +DECLARE_AMMODATA(_7P62X51MM, "7.62 x 51mm", 30, 35) diff --git a/src/shared/event_custom.h b/src/shared/event_custom.h index 204364e..413a939 100644 --- a/src/shared/event_custom.h +++ b/src/shared/event_custom.h @@ -1,7 +1,7 @@ -void TS_Weapon_PrimaryAttackRelease(player pl, BOOL hasAmmo); -void TS_Weapon_SecondaryAttackRelease(player pl, BOOL hasAmmo); +void TS_Weapon_PrimaryAttackRelease(player pl); +void TS_Weapon_SecondaryAttackRelease(player pl); void TS_Weapon_Draw_extra(void); diff --git a/src/shared/event_custom.qc b/src/shared/event_custom.qc index 167d980..7968611 100644 --- a/src/shared/event_custom.qc +++ b/src/shared/event_custom.qc @@ -1,13 +1,7 @@ void -TS_Weapon_PrimaryAttackRelease(player pl, BOOL hasAmmo){ - // WARNING! This comment is really out of date, fWeaponEventPlayer is no longer a thing - // ------------------------------ - // what are "fWeaponEventPlayer" and "player_localentnum"? - // we need to figure this shizz out - // "fWeaponEventPlayer" is in "ts/client/defs.h". its assigned a lot in "ts/client/event.c". - // at least "player_localentnum" is part of the builtins. +TS_Weapon_PrimaryAttackRelease(player pl){ if(pl.inventoryEquippedIndex == -1){ return; } @@ -15,12 +9,12 @@ TS_Weapon_PrimaryAttackRelease(player pl, BOOL hasAmmo){ weapondynamic_t dynaRef = pl.ary_myWeapons[pl.inventoryEquippedIndex]; weapondata_basic_t* basicP = pl.getEquippedWeaponData(); - (*basicP).vOnPrimaryAttackRelease(pl, dynaRef, hasAmmo); + (*basicP).funOnPrimaryAttackRelease(pl, dynaRef); } void -TS_Weapon_SecondaryAttackRelease(player pl, BOOL hasAmmo){ +TS_Weapon_SecondaryAttackRelease(player pl){ if(pl.inventoryEquippedIndex == -1){ return; } @@ -28,7 +22,7 @@ TS_Weapon_SecondaryAttackRelease(player pl, BOOL hasAmmo){ weapondynamic_t dynaRef = pl.ary_myWeapons[pl.inventoryEquippedIndex]; weapondata_basic_t* basicP = pl.getEquippedWeaponData(); - (*basicP).vOnSecondaryAttackRelease(pl, dynaRef, hasAmmo); + (*basicP).funOnSecondaryAttackRelease(pl, dynaRef); } @@ -801,7 +795,7 @@ _TS_playerCallAlt2(void){ weapondynamic_t dynaRef = pl.ary_myWeapons[pl.inventoryEquippedIndex]; weapondata_basic_t* basicP = pl.getEquippedWeaponData(); if(basicP != NULL){ - (*basicP).vOnColdCock(pl, dynaRef); + (*basicP).funOnColdCock(pl, dynaRef); }else{ // what. how. printfline("WHAT. HOW."); @@ -813,13 +807,13 @@ _TS_playerCallAlt2(void){ /////////////////////////////////////////////////////////////////////////////////////// -//!!!! SERVER EVENTS ONLY BELOW HERE +// SERVER EVENTS ONLY BELOW HERE #ifdef SERVER /////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////// -// !!! DEBUG STUFF? +// DEBUG STUFF? void CSEv_TS_Debug_getOrigin_(void ) { diff --git a/src/shared/event_enum.h b/src/shared/event_enum.h index 5b70d32..fbe0c80 100644 --- a/src/shared/event_enum.h +++ b/src/shared/event_enum.h @@ -14,6 +14,7 @@ enum EVENT_TS{ EV_PLACEDECAL, EV_IMPACT_MELEE, SOUNDPITCHED, + SOUNDPITCHED_CHANNEL, TEST, }; diff --git a/src/shared/include.src b/src/shared/include.src index d8bc0cd..22066fb 100644 --- a/src/shared/include.src +++ b/src/shared/include.src @@ -75,8 +75,8 @@ sound_pitched.qc weapons/weapon_karate.qc weapons/weapon_glock18.qc -weapons/weapon_socom_mk23.qc -weapons/weapon_socom_mk23_akimbo.qc +weapons/weapon_socommk23.qc +weapons/weapon_socommk23_akimbo.qc weapons/weapon_deserteagle.qc weapons/weapon_fiveseven.qc weapons/weapon_fiveseven_akimbo.qc @@ -92,8 +92,8 @@ weapons/weapon_miniuzi.qc weapons/weapon_miniuzi_akimbo.qc weapons/weapon_mp5sd.qc weapons/weapon_mp5k.qc -weapons/weapon_steyr_tmp.qc -weapons/weapon_hk_pdw.qc +weapons/weapon_steyrtmp.qc +weapons/weapon_hkpdw.qc weapons/weapon_ump.qc weapons/weapon_skorpion.qc weapons/weapon_skorpion_akimbo.qc @@ -101,9 +101,9 @@ weapons/weapon_mac10.qc weapons/weapon_m4a1.qc weapons/weapon_ak47.qc -weapons/weapon_steyr_aug.qc +weapons/weapon_steyraug.qc weapons/weapon_m16a4.qc -weapons/weapon_barrett_m82.qc +weapons/weapon_barrettm82.qc weapons/weapon_benellim3.qc weapons/weapon_usas12.qc diff --git a/src/shared/input.qc b/src/shared/input.qc index 537ce21..b4d49b9 100644 --- a/src/shared/input.qc +++ b/src/shared/input.qc @@ -106,7 +106,7 @@ Game_Input(void) }else{ // held down the previous frame, but not now? That's a release. if(pl.gflags & GF_SEMI_TOGGLED){ - TS_Weapon_PrimaryAttackRelease(pl, TRUE); + TS_Weapon_PrimaryAttackRelease(pl); pl.gflags &= ~GF_SEMI_TOGGLED; } } @@ -114,7 +114,7 @@ Game_Input(void) pl.gflags |= GF_SEMI_SECONDARY_TOGGLED; }else{ if(pl.gflags & GF_SEMI_SECONDARY_TOGGLED){ - TS_Weapon_SecondaryAttackRelease(pl, TRUE); + TS_Weapon_SecondaryAttackRelease(pl); pl.gflags &= ~GF_SEMI_SECONDARY_TOGGLED; } } @@ -143,7 +143,7 @@ Game_Input(void) - // better TS way, weapon thinks happen alongside checking inputs + // TS way, weapon thinks happen alongside checking inputs pl.callWeaponThink(); @@ -169,7 +169,7 @@ Game_Input(void) }else{ // held down the previous frame, but not now? That's a release. if(pl.gflags & GF_SEMI_TOGGLED){ - TS_Weapon_PrimaryAttackRelease(pl, TRUE); + TS_Weapon_PrimaryAttackRelease(pl); pl.gflags &= ~GF_SEMI_TOGGLED; } } @@ -178,7 +178,7 @@ Game_Input(void) pl.gflags |= GF_SEMI_SECONDARY_TOGGLED; }else{ if(pl.gflags & GF_SEMI_SECONDARY_TOGGLED){ - TS_Weapon_SecondaryAttackRelease(pl, TRUE); + TS_Weapon_SecondaryAttackRelease(pl); pl.gflags &= ~GF_SEMI_SECONDARY_TOGGLED; } } @@ -282,12 +282,12 @@ Game_Input(void) if(pl.inputPrimaryReleasedQueue && pl.inputPrimaryTapFrameCount == 0){ pl.inputPrimaryReleasedQueue = FALSE; // TODO - remove 2nd parameter from that! - TS_Weapon_PrimaryAttackRelease(pl, TRUE); + TS_Weapon_PrimaryAttackRelease(pl); } if(pl.inputSecondaryReleasedQueue && pl.inputSecondaryTapFrameCount == 0){ pl.inputSecondaryReleasedQueue = FALSE; // TODO - remove 2nd parameter from that! - TS_Weapon_SecondaryAttackRelease(pl, TRUE); + TS_Weapon_SecondaryAttackRelease(pl); } #endif// INPUT_TAP_DETECT_CHOICE @@ -422,7 +422,7 @@ void processInputs(void){ /* // These SEMI flag removals only happen if this area is reached // (note the 'return' statements above with button presses) - // Nuclide already does that first one + // Nuclide already does that first one (only if Weapons_Release is called!) //pl.gflags &= ~GF_SEMI_TOGGLED; pl.gflags &= ~GF_SEMI_SECONDARY_TOGGLED; */ diff --git a/src/shared/inventory_logic.qc b/src/shared/inventory_logic.qc index 4840fb1..aa52539 100644 --- a/src/shared/inventory_logic.qc +++ b/src/shared/inventory_logic.qc @@ -1863,7 +1863,7 @@ void deployConfig(void){ printfline("deployConfig CALLED !!! Money? %i", CONFIG_PLAYER_MONEY); // the player always gets karate at a bare minimum - sendevent("PlayerBuyWeapon_TS", "ii", (int)WEAPON_ID::Karate, (int)BITS_WEAPONOPT_NONE); + sendevent("PlayerBuyWeapon_TS", "ii", (int)WEAPON_ID::KARATE, (int)BITS_WEAPONOPT_NONE); for(int i = 0; i < pSeatLocal->m_clientinfo.weaponconfig_current.ary_myWeapons_softMax; i++){ diff --git a/src/shared/player.h b/src/shared/player.h index 2bb7de6..98e49d1 100644 --- a/src/shared/player.h +++ b/src/shared/player.h @@ -279,20 +279,6 @@ class player:base_player // ALSO! Call Byte vars 'floats' because FTE makes 'readbyte' give a float. PREDICTED_FLOAT(shotgunReloadIndex); - // Not networked! For keeping track of changes to shotgunReloadIndex outside of the - // client directly, like if the client and server are waiting for a reload anim to finish, - // but the server finishes first and gives the client the new shotgunReloadIndex. This - // leaves the client to skip picking the new shotgunReloadIndex itself and the viewmodel - // animation call that goes with it. - // (NOT INVOLVED YET. Is this even a good idea?) - float shotgunReloadIndexPrev; - - // Same as shotgunReloadIndex, but for keeping track of the next - // value to turn when the current one is done. - // reload2 is completely interruptable at any point, but reload1 and - // reload3 have to finish completely before changing to a new animation. - // Left-clicking during reload1 will now terminate - PREDICTED_FLOAT(shotgunReloadIndexQueued); // In pump-action mode, set to TRUE after firing the shotgun. The next click pumps // instead. @@ -303,36 +289,24 @@ class player:base_player // (was BOOL) PREDICTED_FLOAT(shotgunWaitingForPump); - // how long into the 2nd reload do we actually load a bullet into the shotgun? - float shotgunReload2_ammoLoadDelay; - - // When do I want to move on to the next phase? - // For reload2 without a changed shotgunReloadIndexQueued or seeing the shotgun is full, - // it wants to repeat to put more bullets in. PREDICTED_FLOAT(shotgunAddAmmoTime); PREDICTED_FLOAT(shotgunAddAmmoSoundTime); #ifdef CLIENT // This time must pass before re-setting the shotgunAddAmmoTime/shotgunAddAmmoSoundTime counters is allowed. // Why do we need to do this? Ask FTE. - float shotgunAddAmmoTime_cooldownSetTime; + // NEVERMIND. Canned + //float shotgunAddAmmoTime_cooldownSetTime; #endif + // What ary_shotgunExtra element to use for extra reload-reloated information in + // the shotgun. Not networked, set on draw or right before a reload in the case + // of ironsight weapons. Might be better ways of handling this but this is better + // than setting seven vars every time. + int iShotgunExtraDataID; - // shared - - // length of time for the start, intermediate (ammo loading) and end animations. - // Set by the shotgun on a reload call so these are known. - int shotgunReload1_seq; - float shotgunReload1_Duration; - int shotgunReload2_seq; - float shotgunReload2_Duration; - int shotgunReload3_seq; - float shotgunReload3_Duration; - - - // was BOOL + // was BOOL (a test, not even networked though) PREDICTED_FLOAT(doFiremodeChange); @@ -382,13 +356,6 @@ class player:base_player PREDICTED_FLOAT(akimboDualFireToleranceTime); - // When firing akimbo weapons, which one fired recently? - // Just use FALSE or TRUE to see which, left/right. - // This isn't whether to alternate firing both akimbo weapons, but which to use next - // IF we are doing alt fire for pressing primary over and over. - // The fireMode controls whether this variable is relevant at all - // (another firemode makes primary / secondary fire use either akimbo weapon consistently) - PREDICTED_FLOAT(recentAkimboAttackChoice); // What is the next way I want to try firing if only primary is supposed to be used? // Only used for certain firemode(s). PREDICTED_FLOAT(nextAkimboAttackPreference); diff --git a/src/shared/player.qc b/src/shared/player.qc index d43219c..9e40437 100644 --- a/src/shared/player.qc +++ b/src/shared/player.qc @@ -172,7 +172,6 @@ player::ReceiveEntity(float new, float fl) isReloading = readbyte(); isChangingIronsight = readbyte(); flTargetZoom = readfloat(); - recentAkimboAttackChoice = readbyte(); nextAkimboAttackPreference = readbyte(); akimboDualFireToleranceTime = readfloat(); grenadeFireIndex = readbyte() - 1; @@ -198,9 +197,7 @@ player::ReceiveEntity(float new, float fl) shotgunReloadIndex = readbyte(); - shotgunReloadIndexQueued = readbyte(); shotgunWaitingForPump = readbyte(); - //shotgunReload2_ammoLoadDelay = readbyte(); shotgunAddAmmoTime = readfloat(); shotgunAddAmmoSoundTime = readfloat(); @@ -349,14 +346,12 @@ player::PredictPreFrame(void) SAVE_STATE(isReloading); SAVE_STATE(isChangingIronsight); SAVE_STATE(flTargetZoom); - SAVE_STATE(recentAkimboAttackChoice); SAVE_STATE(nextAkimboAttackPreference); SAVE_STATE(akimboDualFireToleranceTime); SAVE_STATE(grenadeFireIndex); SAVE_STATE(grenadeToss); SAVE_STATE(shotgunReloadIndex); - SAVE_STATE(shotgunReloadIndexQueued); SAVE_STATE(shotgunWaitingForPump); SAVE_STATE(shotgunAddAmmoTime); @@ -449,14 +444,12 @@ player::PredictPostFrame(void) ROLL_BACK(isReloading); ROLL_BACK(isChangingIronsight); ROLL_BACK(flTargetZoom); - ROLL_BACK(recentAkimboAttackChoice); ROLL_BACK(nextAkimboAttackPreference); ROLL_BACK(akimboDualFireToleranceTime); ROLL_BACK(grenadeFireIndex); ROLL_BACK(grenadeToss); ROLL_BACK(shotgunReloadIndex); - ROLL_BACK(shotgunReloadIndexQueued); ROLL_BACK(shotgunWaitingForPump); ROLL_BACK(shotgunAddAmmoTime); @@ -637,7 +630,6 @@ player::EvaluateEntity(void) SAVE_STATE(isReloading); SAVE_STATE(isChangingIronsight); SAVE_STATE(flTargetZoom); - SAVE_STATE(recentAkimboAttackChoice); SAVE_STATE(nextAkimboAttackPreference); SAVE_STATE(akimboDualFireToleranceTime); SAVE_STATE(grenadeFireIndex); @@ -645,7 +637,6 @@ player::EvaluateEntity(void) SAVE_STATE(shotgunReloadIndex); - SAVE_STATE(shotgunReloadIndexQueued); SAVE_STATE(shotgunWaitingForPump); SAVE_STATE(shotgunAddAmmoTime); @@ -793,7 +784,6 @@ player::SendEntity(entity ePEnt, float fChanged) WriteByte(MSG_ENTITY, isReloading ); WriteByte(MSG_ENTITY, isChangingIronsight ); WriteFloat(MSG_ENTITY, flTargetZoom); - WriteByte(MSG_ENTITY, recentAkimboAttackChoice); WriteByte(MSG_ENTITY, nextAkimboAttackPreference); WriteFloat(MSG_ENTITY, akimboDualFireToleranceTime); WriteByte(MSG_ENTITY, grenadeFireIndex + 1); @@ -819,9 +809,7 @@ player::SendEntity(entity ePEnt, float fChanged) WriteByte(MSG_ENTITY, shotgunReloadIndex ); - WriteByte(MSG_ENTITY, shotgunReloadIndexQueued ); WriteByte(MSG_ENTITY, shotgunWaitingForPump ); - //WriteByte(MSG_ENTITY, shotgunReload2_ammoLoadDelay ); WriteFloat(MSG_ENTITY, shotgunAddAmmoTime ); WriteFloat(MSG_ENTITY, shotgunAddAmmoSoundTime ); @@ -1096,21 +1084,11 @@ player::reset(BOOL resetInventory){ //NOTICE - all networked now, testing. shotgunReloadIndex = 0; - shotgunReloadIndexPrev = 0; - shotgunReloadIndexQueued = 0; - shotgunWaitingForPump = FALSE; - shotgunReload2_ammoLoadDelay = -1; shotgunAddAmmoTime = -1; shotgunAddAmmoSoundTime = -1; #ifdef CLIENT - shotgunAddAmmoTime_cooldownSetTime = -1; + //shotgunAddAmmoTime_cooldownSetTime = -1; #endif - shotgunReload1_seq = -1; - shotgunReload1_Duration = -1; - shotgunReload2_seq = -1; - shotgunReload2_Duration = -1; - shotgunReload3_seq = -1; - shotgunReload3_Duration = -1; doFiremodeChange = FALSE; @@ -1133,7 +1111,6 @@ player::reset(BOOL resetInventory){ #endif - recentAkimboAttackChoice = BITS_AKIMBOCHOICE_NONE; nextAkimboAttackPreference = BITS_AKIMBOCHOICE_LEFT; recentAttackHadAmmo = FALSE; @@ -1158,6 +1135,8 @@ player::reset(BOOL resetInventory){ setInventoryEquippedIndex(-1); + shotgunWaitingForPump = FALSE; + #ifdef SERVER // other projects do that so sure? weapon = 0; @@ -1420,7 +1399,7 @@ player::callWeaponThink(void){ weapondata_basic_t* basicPointer = (weapondata_basic_t*) this.getEquippedWeaponData(); weapondata_basic_t basicRef = *(basicPointer); - basicRef.vOnThink(this, dynaRef); + basicRef.funOnThink(this, dynaRef); }// weaponEquipped check } diff --git a/src/shared/precache.qc b/src/shared/precache.qc index 0473573..2f6c15c 100644 --- a/src/shared/precache.qc +++ b/src/shared/precache.qc @@ -46,44 +46,78 @@ void SharedGame_Precache(void){ // Raging bull drops 6 bullet shells in 3rd person instead (not 1st person) - //FROM BASE HL (Valve folder) + // FROM BASE HL (Valve folder) precache_sound("common/wpn_denyselect.wav"); precache_sound("common/wpn_select.wav"); - precache_sound("items/gunpickup2.wav"); - precache_sound("items/weapondrop1.wav"); - - // similar sounds... but the 1st one is more authentic to what I heard. + // similar sounds, but the first one is more authentic to what I heard. precache_sound("items/9mmclip1.wav"); //precache_sound("weapons/reload1.wav"); - + + // should any of these be server or client only? No idea with a lot of these + // common ones precache_sound("weapons/pistol-empty.wav"); precache_sound("weapons/insert-shell.wav"); - precache_sound("weapons/m3/m3-pump.wav"); - precache_sound("weapons/weapondrop.wav"); + precache_sound("items/weapondrop1.wav"); + precache_sound("items/gunpickup2.wav"); + //Needed, apparently. + precache_sound("common/null.wav"); + + //precache_sound("weapons/insert-shell.wav"); + precache_sound("weapons/items.wav"); + precache_sound("weapons/weapon_items.wav"); + + // TODO - precache only clientside later, UI-only sound. + // Same for others where that applies + precache_sound("weapons/switch.wav"); + + precache_sound("weapons/shell.wav"); + precache_sound("weapons/sshell.wav"); + precache_sound("weapons/sshell1.wav"); + precache_sound("weapons/sshell2.wav"); + precache_sound("weapons/sshell3.wav"); + + precache_model("sprites/new/glow02.spr"); + //precache_sound("weapons/weapondrop.wav"); + + + // ? Are these leftover test sounds? Awfully inspecific + precache_sound("weapons/fire-inslow-sil.wav"); + precache_sound("weapons/fire-inslow.wav"); + precache_sound("weapons/sfire-inslow.wav"); + + precache_sound("weapons/generic_reload.wav"); + + // Anything with a coldcock attack needs these too, but some melee + // weapon precache methods handle them. + //precache_sound("player/closecombat.wav"); + //precache_sound("weapons/knife/knife_hitbody.wav"); - //karate - precache_sound("player/closecombat.wav"); - precache_sound("player/kevlarhit.wav"); - precache_sound("player/kungfuhit.wav"); - precache_sound("player/block.wav"); precache_sound("player/land.wav"); precache_sound("player/superjump-land.wav"); precache_sound("player/airwheel.wav"); precache_sound("player/dive.wav"); - + // Is this for karate? Unsure, but it was grouped with those sounds before. + // TODO: when does this play, if it does, in original TS? + // Bullet hits with kevlar on? Melee hits with kevlar on? Verify. + precache_sound("player/kevlarhit.wav"); // ... what? precache_sound("player/pl_pain2.wav"); precache_sound("player/pl_pain4.wav"); + //TAGGG - TODO. A lot of these are likely redundant with fx_breakmodel. + // TS might not even make use of that at all, I forget if it does. + // For now, not precaching this. Should be precached clientside only most + // likely anyway, it is for fx_breakmodel. + /* precache_sound("debris/bustcrate1.wav"); precache_sound("debris/bustcrate2.wav"); precache_sound("debris/bustcrate3.wav"); @@ -117,177 +151,19 @@ void SharedGame_Precache(void){ precache_sound("debris/wood1.wav"); precache_sound("debris/wood2.wav"); precache_sound("debris/wood3.wav"); + */ + + + // ? What uses these? No clue, could be shared, but handled by model + // precaches (event-driven) if needed anyway. + //precache_sound("weapons/mp5/boltpull.wav"); + //precache_sound("weapons/mp5/boltslap.wav"); + //precache_sound("weapons/mp5/clipin.wav"); + //precache_sound("weapons/mp5/clipout.wav"); - precache_sound("weapons/ak47/clipin.wav"); - precache_sound("weapons/ak47/clipout.wav"); - precache_sound("weapons/ak47/fire.wav"); - precache_sound("weapons/ak47/slideback.wav"); - precache_sound("weapons/aug/aug-fire-sil.wav"); - precache_sound("weapons/aug/aug-fire.wav"); - precache_sound("weapons/aug/boltpull.wav"); - precache_sound("weapons/aug/boltslap.wav"); - precache_sound("weapons/aug/clipin.wav"); - precache_sound("weapons/aug/clipout.wav"); - precache_sound("weapons/barrett/clipin.wav"); - precache_sound("weapons/barrett/clipout.wav"); - precache_sound("weapons/barrett/fire.wav"); - precache_sound("weapons/barrett/slideback.wav"); - precache_sound("weapons/beretta/clipin.wav"); - precache_sound("weapons/beretta/clipout.wav"); - precache_sound("weapons/beretta/fire-sil.wav"); - precache_sound("weapons/beretta/fire.wav"); - precache_sound("weapons/beretta/sliderelease.wav"); - precache_sound("weapons/bull/cylinderin.wav"); - precache_sound("weapons/bull/cylinderout.wav"); - precache_sound("weapons/bull/fire01.wav"); - precache_sound("weapons/bull/hammerback.wav"); - precache_sound("weapons/bull/insert-shell.wav"); - precache_sound("weapons/bull/shellsout.wav"); - precache_sound("weapons/contender/close.wav"); - precache_sound("weapons/contender/fire.wav"); - precache_sound("weapons/contender/hammerback.wav"); - precache_sound("weapons/contender/insert-shell.wav"); - precache_sound("weapons/contender/open.wav"); - precache_sound("weapons/contender/shellout.wav"); - precache_sound("weapons/deagle/clipin.wav"); - precache_sound("weapons/deagle/clipout.wav"); - precache_sound("weapons/deagle/fire-sil.wav"); - precache_sound("weapons/deagle/fire.wav"); - precache_sound("weapons/deagle/slideback.wav"); - precache_sound("weapons/draw.wav"); - precache_sound("weapons/fire-inslow-sil.wav"); - precache_sound("weapons/fire-inslow.wav"); - precache_sound("weapons/fnh/clipin.wav"); - precache_sound("weapons/fnh/clipout.wav"); - precache_sound("weapons/fnh/fnh-fire-sil.wav"); - precache_sound("weapons/fnh/fnh-fire.wav"); - precache_sound("weapons/fnh/sliderelease.wav"); - precache_sound("weapons/generic_reload.wav"); - precache_sound("weapons/glock/clipin.wav"); - precache_sound("weapons/glock/clipout.wav"); - precache_sound("weapons/glock/glock-fire-sil.wav"); - precache_sound("weapons/glock/glock-fire.wav"); - precache_sound("weapons/glock/slideback.wav"); - precache_sound("weapons/glock22/glock22-fire-sil.wav"); - precache_sound("weapons/glock22/glock22-fire.wav"); - precache_sound("weapons/gold/clipin.wav"); - precache_sound("weapons/gold/clipout.wav"); - precache_sound("weapons/gold/gold-fire.wav"); - precache_sound("weapons/gold/sliderelease.wav"); - precache_sound("weapons/grenbounce1.wav"); - precache_sound("weapons/grenbounce2.wav"); - precache_sound("weapons/grenbounce3.wav"); - precache_sound("weapons/grenbounce4.wav"); - precache_sound("weapons/gr_pull.wav"); - precache_sound("weapons/gr_safe.wav"); - precache_sound("weapons/insert-shell.wav"); - precache_sound("weapons/items.wav"); - precache_sound("weapons/katana/hit-body.wav"); - precache_sound("weapons/katana/hit.wav"); - precache_sound("weapons/katana/hit1.wav"); - precache_sound("weapons/katana/miss.wav"); - precache_sound("weapons/katana/miss1.wav"); - precache_sound("weapons/knife/knife_hit.wav"); - precache_sound("weapons/knife/knife_hitbody.wav"); - precache_sound("weapons/knife/knife_miss.wav"); - precache_sound("weapons/m16/fire.wav"); - precache_sound("weapons/m3/m3-fire.wav"); - precache_sound("weapons/m3/m3-pump.wav"); - precache_sound("weapons/m4/boltpull.wav"); - precache_sound("weapons/m4/clipin.wav"); - precache_sound("weapons/m4/clipout.wav"); - precache_sound("weapons/m4/m4-fire-sil.wav"); - precache_sound("weapons/m4/m4-fire.wav"); - precache_sound("weapons/m60/ammo_belt.wav"); - precache_sound("weapons/m60/boltpull.wav"); - precache_sound("weapons/m60/close.wav"); - precache_sound("weapons/m60/m60-fire.wav"); - precache_sound("weapons/m60/open.wav"); - precache_sound("weapons/mac10/clipin.wav"); - precache_sound("weapons/mac10/clipout.wav"); - precache_sound("weapons/mac10/mac10-fire-sil.wav"); - precache_sound("weapons/mac10/mac10-fire.wav"); - precache_sound("weapons/mac10/slideback.wav"); - precache_sound("weapons/mk23/clipin.wav"); - precache_sound("weapons/mk23/clipout.wav"); - precache_sound("weapons/mk23/mk23-fire-sil.wav"); - precache_sound("weapons/mk23/mk23-fire.wav"); - precache_sound("weapons/mk23/sliderelease.wav"); - precache_sound("weapons/mossberg/fire.wav"); - precache_sound("weapons/mp5/boltpull.wav"); - precache_sound("weapons/mp5/boltslap.wav"); - precache_sound("weapons/mp5/clipin.wav"); - precache_sound("weapons/mp5/clipout.wav"); - precache_sound("weapons/mp5k/mp5k-fire-sil.wav"); - precache_sound("weapons/mp5k/mp5k-fire.wav"); - precache_sound("weapons/mp5sd/mp5sd-fire.wav"); - precache_sound("weapons/pdw/clipin.wav"); - precache_sound("weapons/pdw/clipout.wav"); - precache_sound("weapons/pdw/fire-sil.wav"); - precache_sound("weapons/pdw/fire.wav"); - precache_sound("weapons/pdw/slideback.wav"); - precache_sound("weapons/pistol-empty.wav"); - precache_sound("weapons/ruger/clipin.wav"); - precache_sound("weapons/ruger/clipout.wav"); - precache_sound("weapons/ruger/fire.wav"); - precache_sound("weapons/ruger/slide.wav"); - precache_sound("weapons/sawedoff/close.wav"); - precache_sound("weapons/sawedoff/fire.wav"); - // the ak47 fire sound is copied here... why? - //precache_sound("weapons/sawedoff/fire1.wav"); - - precache_sound("weapons/sawedoff/insert-shell.wav"); - precache_sound("weapons/sawedoff/open.wav"); - precache_sound("weapons/sawedoff/shelldrop.wav"); - precache_sound("weapons/sawedoff/shellout.wav"); - precache_sound("weapons/sawedoff/tapspan.wav"); - precache_sound("weapons/sfire-inslow.wav"); - precache_sound("weapons/shell.wav"); - precache_sound("weapons/skorpion/fire.wav"); - precache_sound("weapons/spas12/spas12-fire.wav"); - precache_sound("weapons/spas12/spas12-pump.wav"); - precache_sound("weapons/sshell.wav"); - precache_sound("weapons/sshell1.wav"); - precache_sound("weapons/sshell2.wav"); - precache_sound("weapons/sshell3.wav"); - - // TODO - precache only clientside later, UI-only sound. - // Same for others where that applies - precache_sound("weapons/switch.wav"); - - precache_sound("weapons/tmp/clipin.wav"); - precache_sound("weapons/tmp/clipout.wav"); - precache_sound("weapons/tmp/fire-sil.wav"); - precache_sound("weapons/tmp/fire.wav"); - precache_sound("weapons/tmp/slideback.wav"); - precache_sound("weapons/ump/boltpull.wav"); - precache_sound("weapons/ump/boltslap.wav"); - precache_sound("weapons/ump/clipin.wav"); - precache_sound("weapons/ump/clipout.wav"); - precache_sound("weapons/ump/clipslap.wav"); - precache_sound("weapons/ump/slideback.wav"); - precache_sound("weapons/ump/ump-fire-sil.wav"); - precache_sound("weapons/ump/ump-fire.wav"); - precache_sound("weapons/usas/clipin.wav"); - precache_sound("weapons/usas/clipout.wav"); - precache_sound("weapons/usas/slideback.wav"); - precache_sound("weapons/usas/usas-fire.wav"); - precache_sound("weapons/uzi/clipin.wav"); - precache_sound("weapons/uzi/clipout.wav"); - precache_sound("weapons/uzi/slideback.wav"); - precache_sound("weapons/uzi/uzi-fire-sil.wav"); - precache_sound("weapons/uzi/uzi-fire.wav"); - precache_sound("weapons/weapondrop.wav"); - precache_sound("weapons/weapon_items.wav"); - //Needed, apparently. - precache_sound("common/null.wav"); - - - precache_model("sprites/new/glow02.spr"); - } diff --git a/src/shared/sound_pitched.qc b/src/shared/sound_pitched.qc index 923669a..27d91fd 100644 --- a/src/shared/sound_pitched.qc +++ b/src/shared/sound_pitched.qc @@ -14,17 +14,68 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +// Some sounds are not pitched down, don't involve in this system! +// All knife sounds, karate sounds, shotgun pump sounds, and all +// katana sounds except miss and miss1 are pitched normally in the +// as-is sound files. + typedef enum { - SNDP_AK47, - SNDP_AKIMBOCOLTS, - SNDP_BARRETTM82, - SNDP_M3_FIRE, - SNDP_BERETTA, - SNDP_BERETTA_SIL, + SNDP_AK47_FIRE, + SNDP_AKIMBOCOLTS_FIRE, + SNDP_BARRETTM82_FIRE, + SNDP_BENELLIM3_FIRE, + SNDP_BERETTA_FIRE, + SNDP_BERETTA_FIRE_SIL, + SNDP_CONTENDERG2_FIRE, + SNDP_DESERTEAGLE_FIRE, + SNDP_DESERTEAGLE_FIRE_SIL, + SNDP_FIVESEVEN_FIRE, + SNDP_FIVESEVEN_FIRE_SIL, + SNDP_GLOCK18_FIRE, + SNDP_GLOCK18_FIRE_SIL, + SNDP_GLOCK20_FIRE, + SNDP_GLOCK20_FIRE_SIL, + SNDP_HKPDW_FIRE, + SNDP_HKPDW_FIRE_SIL, + SNDP_KATANA_MISS, + SNDP_KATANA_MISS1, + SNDP_M4A1_FIRE, + SNDP_M4A1_FIRE_SIL, + SNDP_M16A4_FIRE, + SNDP_M60_FIRE, + SNDP_MAC10_FIRE, + SNDP_MAC10_FIRE_SIL, + SNDP_MINIUZI_FIRE, + SNDP_MINIUZI_FIRE_SIL, + SNDP_MOSSBERG500_FIRE, + SNDP_MP5K_FIRE, + SNDP_MP5K_FIRE_SIL, + SNDP_MP5SD_FIRE, + SNDP_RAGINGBULL_FIRE, + SNDP_RUGERMK1_FIRE, + SNDP_SAWEDOFF_FIRE, + SNDP_SKORPION_FIRE, + SNDP_SOCOMMK23_FIRE, + SNDP_SOCOMMK23_FIRE_SIL, + SNDP_SPAS12_FIRE, + SNDP_STEYRAUG_FIRE, + SNDP_STEYRAUG_FIRE_SIL, + SNDP_STEYRTMP_FIRE, + SNDP_STEYRTMP_FIRE_SIL, + SNDP_UMP_FIRE, + SNDP_UMP_FIRE_SIL, + SNDP_USAS12_FIRE, + SNDP_EXPLODE, + SNDP_EXPLODE1, + SNDP_EXPLODE2, + SNDP_EXPLODE3, + SNDP_EXPLODE4 } sfx_pitched_t; + void SoundPitched_Send(entity ent, int id) { @@ -39,8 +90,25 @@ SoundPitched_Send(entity ent, int id) #endif } +// like above, but takes the channel to play on +// Could be cloned per channel as there are not many channels that need to be +// pick-able. +void +SoundPitched_Channel_Send(entity ent, int id, float chan) +{ +#ifdef SERVER + WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); + WriteByte(MSG_MULTICAST, EVENT_TS::SOUNDPITCHED_CHANNEL); + WriteEntity(MSG_MULTICAST, ent); + WriteByte(MSG_MULTICAST, id); + WriteByte(MSG_MULTICAST, (int)chan); + + msg_entity = ent; + multicast(ent.origin, MULTICAST_PHS); +#endif +} + #ifdef CLIENT -/* TODO: add the rest */ const string sfx_pitched_s[] = { "weapons/ak47/fire.wav", @@ -48,7 +116,51 @@ const string sfx_pitched_s[] = "weapons/barrett/fire.wav", "weapons/m3/m3-fire.wav", "weapons/beretta/fire.wav", - "weapons/beretta/fire-sil.wav" + "weapons/beretta/fire-sil.wav", + "weapons/contender/fire.wav", + "weapons/deagle/fire-sil.wav", + "weapons/deagle/fire.wav", + "weapons/fnh/fnh-fire-sil.wav", + "weapons/fnh/fnh-fire.wav", + "weapons/glock/glock-fire-sil.wav", + "weapons/glock/glock-fire.wav", + "weapons/glock22/glock22-fire-sil.wav", + "weapons/glock22/glock22-fire.wav", + "weapons/pdw/fire-sil.wav", + "weapons/pdw/fire.wav", + "weapons/katana/miss.wav", + "weapons/katana/miss1.wav", + "weapons/m4/m4-fire-sil.wav", + "weapons/m4/m4-fire.wav", + "weapons/m16/fire.wav", + "weapons/m60/m60-fire.wav", + "weapons/mac10/mac10-fire-sil.wav", + "weapons/mac10/mac10-fire.wav", + "weapons/uzi/uzi-fire-sil.wav", + "weapons/uzi/uzi-fire.wav", + "weapons/mossberg/fire.wav", + "weapons/mp5k/mp5k-fire-sil.wav", + "weapons/mp5k/mp5k-fire.wav", + "weapons/mp5sd/mp5sd-fire.wav", + "weapons/bull/fire01.wav", + "weapons/ruger/fire.wav", + "weapons/sawedoff/fire.wav", + "weapons/skorpion/fire.wav", + "weapons/mk23/mk23-fire-sil.wav", + "weapons/mk23/mk23-fire.wav", + "weapons/spas12/spas12-fire.wav", + "weapons/aug/aug-fire-sil.wav", + "weapons/aug/aug-fire.wav", + "weapons/tmp/fire-sil.wav", + "weapons/tmp/fire.wav", + "weapons/ump/ump-fire-sil.wav", + "weapons/ump/ump-fire.wav", + "weapons/usas/usas-fire.wav", + "explo/explode.wav", + "explo/explode1.wav", + "explo/explode2.wav", + "explo/explode3.wav", + "explo/explode4.wav" }; void @@ -56,8 +168,53 @@ SoundPitched_Receive(void) { entity ent = findfloat(world, entnum, readentitynum()); int id = readbyte(); + + //printfline("SoundPitched_Receive %i:%s", id, sfx_pitched_s[id]); if (ent) sound(ent, CHAN_WEAPON, sfx_pitched_s[id], 1.0f, ATTN_NORM, 400, SOUNDFLAG_FOLLOW); } + +void +SoundPitched_Channel_Receive(void) +{ + entity ent = findfloat(world, entnum, readentitynum()); + int id = readbyte(); + float chan = (float)readbyte(); + + if (ent) + sound(ent, chan, sfx_pitched_s[id], 1.0f, ATTN_NORM, 400, SOUNDFLAG_FOLLOW); +} + +/* +// ISSUE: sounds seem to play only for the entity that called for +// the message to be played from serverside. If it's a spawned entity +// (like a grenade sending itself to make the explosion sound), no player +// can hear it. No idea if adjusting the volume to go lower the distance +// the listener is from the source (also considering attenuation) is a good +// idea. + +// DEBUG VERSION: with the 'ent-search' requirement removed, this plays +// for any listening player nearby, which the greande explosion sound +// definitely wants. Although I would think most firing sounds should +// be heard by other players too. +void +SoundPitched_Channel_Receive(void) +{ + printfline("---SoundPitched_Channel_Receive"); + + float myEntNum = readentitynum(); + entity ent = findfloat(world, entnum, myEntNum); + int id = readbyte(); + float chan = (float)readbyte(); + + printfline("recventnum:%d self.cln:%s myentnum:%d", myEntNum, self.classname, self.entnum); + printfline("ent found? %i", (int)(ent != NULL)); + + //if (ent) + // sound(ent, chan, sfx_pitched_s[id], 1.0f, ATTN_NORM, 400, SOUNDFLAG_FOLLOW); + sound(self, chan, sfx_pitched_s[id], 1.0f, ATTN_NORM, 400, SOUNDFLAG_FOLLOW); +} +*/ + #endif diff --git a/src/shared/weapons.h b/src/shared/weapons.h index aaf913a..44d2c45 100644 --- a/src/shared/weapons.h +++ b/src/shared/weapons.h @@ -34,18 +34,18 @@ enum MELEE_HIT_RESPONSE{ //to something that is of WEAPONDATA_TYPEID_AKIMBO type. enum WEAPON_AKIMBO_UPGRADE_ID{ NONE = 0, - SOCOM_MK23 = 1, - Beretta = 2, - FiveSeven = 3, - MiniUzi = 4, - Skorpion = 5, + SOCOMMK23 = 1, + BERETTA = 2, + FIVESEVEN = 3, + MINIUZI = 4, + SKORPION = 5, LAST_ID = 6 }; //For quick reference, singular and akimbo ties: -//SOKOM_MK23 = 9, SOCOM_MK23_akimbo = 10 +//SOKOM_MK23 = 9, SOCOMMK23_akimbo = 10 //Beretta = 2, Beretta_akimbo = 8 //FiveSeven = 14, FiveSeven_akimbo = 30 //MiniUzi = 4, MiniUzi_akimbo = 16 @@ -55,38 +55,38 @@ enum WEAPON_AKIMBO_UPGRADE_ID{ //NOTICE - "LAST_WEAPON_ID" must never change. enum WEAPON_ID{ NONE = 0, - Glock18 = 1, - Beretta = 2, + GLOCK18 = 1, + BERETTA = 2, //SLOT2_UNUSED = 2, - MiniUzi = 3, - BenelliM3 = 4, + MINIUZI = 3, + BENELLIM3 = 4, M4A1 = 5, MP5SD = 6, MP5K = 7, - Beretta_akimbo = 8, + BERETTA_AKIMBO = 8, // Berettas will support the singular form and be upgradable into akimbo instead. // ...no, keep akimbo's with their own ID's in here, spawning should know how to handle // this. //Beretta = 8, - SOCOM_MK23 = 9, - SOCOM_MK23_akimbo = 10, + SOCOMMK23 = 9, + SOCOMMK23_AKIMBO = 10, USAS12 = 11, - DesertEagle = 12, + DESERTEAGLE = 12, AK47 = 13, - FiveSeven = 14, - STEYR_AUG = 15, + FIVESEVEN = 14, + STEYRAUG = 15, - MiniUzi_akimbo = 16, + MINIUZI_AKIMBO = 16, - STEYR_TMP = 17, - Barrett_M82 = 18, - HK_PDW = 19, + STEYRTMP = 17, + BARRETTM82 = 18, + HKPDW = 19, SPAS12 = 20, - AkimboColts = 21, - Glock20 = 22, + AKIMBOCOLTS = 21, + GLOCK20 = 22, //NOTICE!!! This (below) used to be "MAC10", but we're pretty sure this ID is really for // the UMP. There is no Mac10 in the specialists 2.1, or whatever I've been using. // This weapon likely replaced what used to be the MAC10 and its ID never got updated. @@ -96,24 +96,24 @@ enum WEAPON_ID{ MAC10 = 23, //UMP = 23, - M61Grenade = 24, //There's the grenade! If it's ever made purchasable. - CombatKnife = 25, - Mossberg500 = 26, + M61GRENADE = 24, //There's the grenade! If it's ever made purchasable. + COMBATKNIFE = 25, + MOSSBERG500 = 26, M16A4 = 27, - RugerMK1 = 28, + RUGERMK1 = 28, C4 = 29, - FiveSeven_akimbo = 30, + FIVESEVEN_AKIMBO = 30, - RagingBull = 31, + RAGINGBULL = 31, M60 = 32, - SawedOff = 33, - Katana = 34, - SealKnife = 35, + SAWEDOFF = 33, + KATANA = 34, + SEALKNIFE = 35, // NEW WEAPONS - ContenderG2 = 36, - Skorpion = 37, - Skorpion_akimbo = 38, + CONTENDERG2 = 36, + SKORPION = 37, + SKORPION_AKIMBO = 38, // could also be MAC10 ? any order for our unofficial weapon ID's is not regulated by maps // made for the original The Specialists. @@ -122,12 +122,12 @@ enum WEAPON_ID{ // SEPARATE. Contained in the same system for convenience. May not be recognized by the map. //Not pickup-able but has to be stored the same way as other weapons. - Karate = 40, + KARATE = 40, // These are items that can be purchased in the team-based game mode in original TS // Not weapons, just here for spawn convenience. Or maybe these ID's will never be used. - Kevlar = 41, - StealthShoes = 42, + KEVLAR = 41, + STEALTHSHOES = 42, LAST_ID = 43 @@ -138,11 +138,11 @@ enum WEAPON_ID{ // For now, a simple way to turn WEAPON_AKIMBO_UPGRADE_ID into WEAPON_ID: int ary_AKIMBO_UPGRADE_TO_WEAPON[] = { WEAPON_ID::NONE, - WEAPON_ID::SOCOM_MK23_akimbo, - WEAPON_ID::Beretta_akimbo, - WEAPON_ID::FiveSeven_akimbo, - WEAPON_ID::MiniUzi_akimbo, - WEAPON_ID::Skorpion_akimbo + WEAPON_ID::SOCOMMK23_AKIMBO, + WEAPON_ID::BERETTA_AKIMBO, + WEAPON_ID::FIVESEVEN_AKIMBO, + WEAPON_ID::MINIUZI_AKIMBO, + WEAPON_ID::SKORPION_AKIMBO }; @@ -260,12 +260,12 @@ string getAkimboFiremodeName(int firemodeBit){ -#define ASSIGN_WEAPONDATA(arg_constName) ary_weaponData[WEAPON_ID::##arg_constName] = (weapondata_basic_t*) &weapon_##arg_constName; +#define ASSIGN_WEAPONDATA(arg_constName, arg_weaponName) ary_weaponData[WEAPON_ID::##arg_constName] = (weapondata_basic_t*) &weapon_##arg_weaponName; // NOTICE - the ID lacks the "_akimbo" suffix. The actual variable name has the "_akimbo" suffix. // Just provide the name of the weapon without the "_akimbo" suffix and it will be added as needed // automatically. -#define ASSIGN_AKIMBOUPGRADEDATA(arg_constName) ary_akimboUpgradeData[WEAPON_AKIMBO_UPGRADE_ID::##arg_constName] = (weapondata_basic_t*) &weapon_##arg_constName##_akimbo; +#define ASSIGN_AKIMBOUPGRADEDATA(arg_constName, arg_weaponName) ary_akimboUpgradeData[WEAPON_AKIMBO_UPGRADE_ID::##arg_constName] = (weapondata_basic_t*) &weapon_##arg_weaponName##_akimbo; @@ -411,7 +411,7 @@ typedef struct{ // TODO - PENDING! Remove vOnPrimaryAttack and vOnSecondaryAttack here and from all weapons, // Nudlie's Primary/Secondary fire calls work in place of those. -// vOnPrimaryAttackRelease and vOnSecondaryAttackRelease are still useless it turns out, +// funOnPrimaryAttackRelease and funOnSecondaryAttackRelease are still useless it turns out, // but they can just lose the "hasAmmo" parameters at least. // ALSO: vOnEquip, vOnUnEquip, vOnDrawHUD, and vOnReload will be removed, Nuclide calls mean these are // no longer used. @@ -431,22 +431,17 @@ typedef struct{ string sWorldModelPath; //a pickup that sits in the map; separated from any players. string sIconFilePath; //icon for the inventory and buy menu. - BOOL(player pl, weapondynamic_t arg_thisWeapon, BOOL hasAmmo) vOnPrimaryAttack; - BOOL(player pl, weapondynamic_t arg_thisWeapon, BOOL hasAmmo) vOnPrimaryAttackRelease; - BOOL(player pl, weapondynamic_t arg_thisWeapon, BOOL hasAmmo) vOnSecondaryAttack; - BOOL(player pl, weapondynamic_t arg_thisWeapon, BOOL hasAmmo) vOnSecondaryAttackRelease; + void(player pl, weapondynamic_t arg_thisWeapon) funOnPrimaryAttackRelease; + void(player pl, weapondynamic_t arg_thisWeapon) funOnSecondaryAttackRelease; + + // Run every frame this weapon is equipped. + // See if two think methods, for earlier or later (preframe / postframe) are needed. + void(player pl, weapondynamic_t arg_thisWeapon) funOnThink; - void(player pl, weapondynamic_t arg_thisWeapon) vOnEquip; //picked from inventory; now active weapon - BOOL(player pl, weapondynamic_t arg_thisWeapon) vOnUnEquip; //selected a different weapon, use for quick cleanup/resetting. Cleanup. Holster anims themselves not supported or present. - //Returns whether the current weapon got deleted, which could otherwise be hard to determine. - void(player pl, weapondynamic_t arg_thisWeapon) vOnThink; //Run every frame this weapon is equipped. - //See if two think methods, for earlier or later (preframe / postframe) are needed. - void(player pl, weapondynamic_t arg_thisWeapon) vOnDrawHUD; //any special behavior for rendering 2D graphics on the player's screen while equipped? - void(player pl, weapondynamic_t arg_thisWeapon) vOnReload; //Called on starting a reload. Sounds to play after a delay? // This event is for a gun's melee attack, if supported. Actual melee weapons still use PrimaryAttack. // To see it in The Specialists (original beta 2), use this in console to bind cold cocking to the "c" key: // bind "c" "+alt2" - void(player pl, weapondynamic_t arg_thisWeapon) vOnColdCock; + void(player pl, weapondynamic_t arg_thisWeapon) funOnColdCock; // We'll handle firing animations (weapon recoil mainly) in their own methods. // Little too much going on. Number of animations to cylce through (shoot1, shoot2)? @@ -512,17 +507,11 @@ typedef struct{ string sWorldModelPath; string sIconFilePath; - BOOL(player pl, weapondynamic_t arg_thisWeapon, BOOL hasAmmo) vOnPrimaryAttack; - BOOL(player pl, weapondynamic_t arg_thisWeapon, BOOL hasAmmo) vOnPrimaryAttackRelease; - BOOL(player pl, weapondynamic_t arg_thisWeapon, BOOL hasAmmo) vOnSecondaryAttack; - BOOL(player pl, weapondynamic_t arg_thisWeapon, BOOL hasAmmo) vOnSecondaryAttackRelease; + void(player pl, weapondynamic_t arg_thisWeapon) funOnPrimaryAttackRelease; + void(player pl, weapondynamic_t arg_thisWeapon) funOnSecondaryAttackRelease; - void(player pl, weapondynamic_t arg_thisWeapon) vOnEquip; - BOOL(player pl, weapondynamic_t arg_thisWeapon) vOnUnEquip; - void(player pl, weapondynamic_t arg_thisWeapon) vOnThink; - void(player pl, weapondynamic_t arg_thisWeapon) vOnDrawHUD; - void(player pl, weapondynamic_t arg_thisWeapon) vOnReload; - void(player pl, weapondynamic_t arg_thisWeapon) vOnColdCock; + void(player pl, weapondynamic_t arg_thisWeapon) funOnThink; + void(player pl, weapondynamic_t arg_thisWeapon) funOnColdCock; int iAnim_Idle_Index; @@ -537,7 +526,7 @@ typedef struct{ int iBitsUpgrade; int iBitsUpgradeAuto; - + //-------------------------------------------------------------------------- int iPrice; int iSlots; @@ -593,17 +582,11 @@ typedef struct{ string sWorldModelPath; string sIconFilePath; - BOOL(player pl, weapondynamic_t arg_thisWeapon, BOOL hasAmmo) vOnPrimaryAttack; - BOOL(player pl, weapondynamic_t arg_thisWeapon, BOOL hasAmmo) vOnPrimaryAttackRelease; - BOOL(player pl, weapondynamic_t arg_thisWeapon, BOOL hasAmmo) vOnSecondaryAttack; - BOOL(player pl, weapondynamic_t arg_thisWeapon, BOOL hasAmmo) vOnSecondaryAttackRelease; + void(player pl, weapondynamic_t arg_thisWeapon) funOnPrimaryAttackRelease; + void(player pl, weapondynamic_t arg_thisWeapon) funOnSecondaryAttackRelease; - void(player pl, weapondynamic_t arg_thisWeapon) vOnEquip; - BOOL(player pl, weapondynamic_t arg_thisWeapon) vOnUnEquip; - void(player pl, weapondynamic_t arg_thisWeapon) vOnThink; - void(player pl, weapondynamic_t arg_thisWeapon) vOnDrawHUD; - void(player pl, weapondynamic_t arg_thisWeapon) vOnReload; - void(player pl, weapondynamic_t arg_thisWeapon) vOnColdCock; + void(player pl, weapondynamic_t arg_thisWeapon) funOnThink; + void(player pl, weapondynamic_t arg_thisWeapon) funOnColdCock; int iAnim_Idle_Index; @@ -663,17 +646,11 @@ typedef struct{ string sWorldModelPath; string sIconFilePath; - BOOL(player pl, weapondynamic_t arg_thisWeapon, BOOL hasAmmo) vOnPrimaryAttack; - BOOL(player pl, weapondynamic_t arg_thisWeapon, BOOL hasAmmo) vOnPrimaryAttackRelease; - BOOL(player pl, weapondynamic_t arg_thisWeapon, BOOL hasAmmo) vOnSecondaryAttack; - BOOL(player pl, weapondynamic_t arg_thisWeapon, BOOL hasAmmo) vOnSecondaryAttackRelease; + void(player pl, weapondynamic_t arg_thisWeapon) funOnPrimaryAttackRelease; + void(player pl, weapondynamic_t arg_thisWeapon) funOnSecondaryAttackRelease; - void(player pl, weapondynamic_t arg_thisWeapon) vOnEquip; - BOOL(player pl, weapondynamic_t arg_thisWeapon) vOnUnEquip; - void(player pl, weapondynamic_t arg_thisWeapon) vOnThink; - void(player pl, weapondynamic_t arg_thisWeapon) vOnDrawHUD; - void(player pl, weapondynamic_t arg_thisWeapon) vOnReload; - void(player pl, weapondynamic_t arg_thisWeapon) vOnColdCock; + void(player pl, weapondynamic_t arg_thisWeapon) funOnThink; + void(player pl, weapondynamic_t arg_thisWeapon) funOnColdCock; int iAnim_Idle_Index; @@ -718,17 +695,11 @@ typedef struct{ string sWorldModelPath; string sIconFilePath; - BOOL(player pl, weapondynamic_t arg_thisWeapon, BOOL hasAmmo) vOnPrimaryAttack; - BOOL(player pl, weapondynamic_t arg_thisWeapon, BOOL hasAmmo) vOnPrimaryAttackRelease; - BOOL(player pl, weapondynamic_t arg_thisWeapon, BOOL hasAmmo) vOnSecondaryAttack; - BOOL(player pl, weapondynamic_t arg_thisWeapon, BOOL hasAmmo) vOnSecondaryAttackRelease; + void(player pl, weapondynamic_t arg_thisWeapon) funOnPrimaryAttackRelease; + void(player pl, weapondynamic_t arg_thisWeapon) funOnSecondaryAttackRelease; - void(player pl, weapondynamic_t arg_thisWeapon) vOnEquip; - BOOL(player pl, weapondynamic_t arg_thisWeapon) vOnUnEquip; - void(player pl, weapondynamic_t arg_thisWeapon) vOnThink; - void(player pl, weapondynamic_t arg_thisWeapon) vOnDrawHUD; - void(player pl, weapondynamic_t arg_thisWeapon) vOnReload; - void(player pl, weapondynamic_t arg_thisWeapon) vOnColdCock; + void(player pl, weapondynamic_t arg_thisWeapon) funOnThink; + void(player pl, weapondynamic_t arg_thisWeapon) funOnColdCock; int iAnim_Idle_Index; @@ -776,6 +747,38 @@ typedef struct{ + +// arbitrary, unreatled to weaponID's. Assign to some var in the player +// at draw (equip) time or send along shotgun-related method calls, no idea +// what route is best. +// No need for a NONE choice, leftover choice on weapon changes doesn't matter +// if the current weapon never does anything that looks at shotgun extra info. +// Also, shotguns that have ironsight need another entry for that because ironsight has +// its own set of sequences. +enum SHOTGUN_EXTRA_ID{ + BENELLIM3 = 0, + MOSSBERG500, + MOSSBERG500_IRONSIGHT, + SPAS12, + LAST_ID +}; + +// There is no 'weapondata_shotgun'. Instead, shotguns can use some extra +// stats. Requires its own enum as there won't be one for every single weaponID. +typedef struct{ + int shotgunReload1_seq; + float shotgunReload1_Duration; + + int shotgunReload2_seq; + float shotgunReload2_Duration; + float shotgunReload2_ammoLoadDelay; + + int shotgunReload3_seq; + float shotgunReload3_Duration; +} weapondata_shotgun_extra_t; + + + //TODO. Is extern'ing these earlier possible? ammodata_t* ary_ammoData[AMMO_ID::LAST_ID]; @@ -785,6 +788,9 @@ ammodata_t* ary_ammoData[AMMO_ID::LAST_ID]; weapondata_basic_t* ary_weaponData[WEAPON_ID::LAST_ID]; weapondata_basic_t* ary_akimboUpgradeData[WEAPON_AKIMBO_UPGRADE_ID::LAST_ID]; +weapondata_shotgun_extra_t* ary_shotgunExtra[SHOTGUN_EXTRA_ID::LAST_ID]; + + @@ -843,9 +849,15 @@ void weapon_gun_onDrawHUD(player pl, weapondata_gun_t* basePRef, weapondynamic_t void weapon_throwable_onDrawHUD(player pl, weapondata_throwable_t* basePRef, weapondynamic_t arg_thisWeapon); void weapon_melee_onDrawHUD(player pl, weapondata_melee_t* basePRef, weapondynamic_t arg_thisWeapon); +void weapon_precache(weapondata_basic_t* basePRef); + +//void weapon_gun_updateAmmo(player pl, weapondata_gun_t* basePRef, weapondynamic_t arg_thisWeapon); +void weapon_gun_updateAmmo(player pl, int weaponTypeID); + void setupWeaponData(void); + // simplified form of dynamic weapon info that only records buy upgrades purchased for a weapon. // Note that, for akimbo-upgraded weapons, the extra akimbo version will be displayed in the inventory // in addition to the singular version, but for removing items this still counts as a single item in the diff --git a/src/shared/weapons.qc b/src/shared/weapons.qc index ea0f401..e0e7e06 100644 --- a/src/shared/weapons.qc +++ b/src/shared/weapons.qc @@ -1,14 +1,4 @@ - - - - - - - - - - weapon_t w_null = {}; // Populate each slot with a member of the enum early on in runtime instead. @@ -176,8 +166,6 @@ weapon_base_onPrimaryAttack_melee_fromCustomDirection( if ( trace_ent.takedamage ) { if ( trace_ent.iBleeds == TRUE ) { FX_Impact( IMPACT_FLESH, trace_endpos, trace_plane_normal ); - //TAGGG - not the sound TS uses at least, this is a counterstrike leftover. - //sound( self, CHAN_WEAPON, sprintf( "weapons/knife_hit%d.wav", floor( ( random() * 4 ) + 1 ) ), 1, ATTN_NORM ); resultHit = MELEE_HIT_RESPONSE::FLESH; }else{ //assume metal then? @@ -438,32 +426,12 @@ weapon_shotgun_onInterrupt( pl.shotgunReloadIndex = 3; } - - /* - if(pl.shotgunReloadIndex == 0){ - // nothing to interrupt. - return FALSE; - } - - //if(pl.shotgunReloadIndexQueued != 3){ - if(pl.shotgunReloadIndex == 1){ - //still on the first? queue the end. - pl.shotgunReloadIndexQueued = 3; - }else if(pl.shotgunReloadIndex == 2){ - //still really. Do we really care about instantly interrupting this? - // eh, just let it put this bullet in. why not. - pl.shotgunReloadIndexQueued = 3; - } - //} - */ - return TRUE; }// weapon_shotgun_onInterrupt -// Method assumes the player's "shotgunReload1_seq" and "_Duration" for vars Reload1, 2, and 3 -// have been set correctly first, probably in the weapon's "onEquip" method. -// few others like shotgunReload2_ammoLoadDelay (serverside) too. nah that's it. +// Method assumes the player's iShotgunExtraDataID has been set first, most likely +// in the weapon's draw (equip) method. void weapon_shotgun_reload( player pl, weapondata_basic_t* basePRef, weapondynamic_t arg_thisWeapon @@ -505,7 +473,6 @@ weapon_shotgun_reload( ////if(pl.shotgunReloadIndex == 0 && (pl.shotgunPumpEndTime == -1 || pl.w_attack_next <= 0) ){ if(pl.shotgunReloadIndex == 0 ){ - }else{ // no. return; @@ -517,20 +484,19 @@ weapon_shotgun_reload( pl.aryNextBurstShotTime_softLength = 0; pl.aryNextBurstShotTime_listenIndex = -1; - //weapon_base_setWholeAttackDelay(pl, baseRef.fAnim_Reload_Duration); - - //printfline("weapon_shotgun_reload %i %d", pl.shotgunReloadIndex, pl.shotgunPumpEndTime); pl.isReloading = TRUE; + + weapondata_shotgun_extra_t* shotgunExtraRef = ary_shotgunExtra[pl.iShotgunExtraDataID]; + + TS_Weapons_ViewAnimation((*shotgunExtraRef).shotgunReload1_seq, (*shotgunExtraRef).shotgunReload1_Duration ); + weapon_base_setWholeAttackDelay(pl, (*shotgunExtraRef).shotgunReload1_Duration); - - //printfline("HERES THAT shotgunReload1_Duration %.2f", pl.shotgunReload1_Duration); - weapon_base_setWholeAttackDelay(pl, pl.shotgunReload1_Duration); - - pl.shotgunReloadIndexQueued = 2; - - TS_Weapons_ViewAnimation(pl.shotgunReload1_seq, pl.shotgunReload1_Duration ); pl.shotgunReloadIndex = 1; + // In original TS, something about ever starting a reload stops the need + // for a pump. Or some part of reloading, good enough I think + pl.shotgunWaitingForPump = FALSE; + }//weapon_shotgun_reload @@ -547,12 +513,11 @@ void viewEv_playShotgunInsertShellSound(void){ // NOTICE - shotguns with typical shotgun reload logic should use this method at all // times. It includes checks for whether the shotgun is actually reloading or not // (don't do anything if not of course) +// Also, this is meant to completely replace the weapon_gun_onThink call that most would have used. void weapon_shotgun_onThink_reloadLogic(player pl, weapondata_gun_t* basePRef, weapondynamic_t arg_thisWeapon){ weapondata_gun_t baseRef = *basePRef; - - //printfline("FRAME att: %.2f", pl.w_attack_next); - + weapondata_shotgun_extra_t* shotgunExtraRef; if(pl.shotgunAddAmmoTime != -1 && pl.w_attack_next <= pl.shotgunAddAmmoTime){ // add the ammo!! @@ -606,28 +571,31 @@ weapon_shotgun_onThink_reloadLogic(player pl, weapondata_gun_t* basePRef, weapon //if(pl.shotgunAddAmmoTime_canSet()){ // pl.shotgunAddAmmoTime_setCooldownSetTime(); - TS_Weapons_ViewAnimation(pl.shotgunReload3_seq, pl.shotgunReload3_Duration); - weapon_base_setWholeAttackDelay(pl, pl.shotgunReload3_Duration); + + shotgunExtraRef = ary_shotgunExtra[pl.iShotgunExtraDataID]; + + TS_Weapons_ViewAnimation((*shotgunExtraRef).shotgunReload3_seq, (*shotgunExtraRef).shotgunReload3_Duration); + weapon_base_setWholeAttackDelay(pl, (*shotgunExtraRef).shotgunReload3_Duration); pl.shotgunReloadIndex = 0; pl.isReloading = FALSE; //} }else{ - TS_Weapons_ViewAnimation(pl.shotgunReload2_seq, pl.shotgunReload2_Duration); - weapon_base_setWholeAttackDelay(pl, pl.shotgunReload2_Duration); + shotgunExtraRef = ary_shotgunExtra[pl.iShotgunExtraDataID]; + + TS_Weapons_ViewAnimation((*shotgunExtraRef).shotgunReload2_seq, (*shotgunExtraRef).shotgunReload2_Duration); + weapon_base_setWholeAttackDelay(pl, (*shotgunExtraRef).shotgunReload2_Duration); pl.shotgunReloadIndex = 2; - - //if(pl.shotgunAddAmmoTime_canSet()){ // pl.shotgunAddAmmoTime_setCooldownSetTime(); printfline("I SET shotgunAddAmmoTime!"); - //View_AddEvent(w_ejectshell_pistol, pl.w_attack_next - pl.shotgunReload2_ammoLoadDelay); + //pl.shotgunAddAmmoSoundTime = (*shotgunExtraRef).shotgunReload2_Duration - ((*shotgunExtraRef).shotgunReload2_ammoLoadDelay - 0.03f); #ifdef CLIENT - View_AddEvent(viewEv_playShotgunInsertShellSound, pl.shotgunReload2_Duration - (pl.shotgunReload2_ammoLoadDelay - 0.03f)); + View_AddEvent(viewEv_playShotgunInsertShellSound, (*shotgunExtraRef).shotgunReload2_Duration - ((*shotgunExtraRef).shotgunReload2_ammoLoadDelay - 0.03f)); #endif - pl.shotgunAddAmmoTime = pl.shotgunReload2_Duration - pl.shotgunReload2_ammoLoadDelay; - //pl.shotgunAddAmmoSoundTime = pl.shotgunReload2_Duration - (pl.shotgunReload2_ammoLoadDelay - 0.03f); + + pl.shotgunAddAmmoTime = (*shotgunExtraRef).shotgunReload2_Duration - (*shotgunExtraRef).shotgunReload2_ammoLoadDelay; //} @@ -638,8 +606,11 @@ weapon_shotgun_onThink_reloadLogic(player pl, weapondata_gun_t* basePRef, weapon }else if(pl.shotgunReloadIndex == 3){ // end of reload anim wanted! - TS_Weapons_ViewAnimation(pl.shotgunReload3_seq, pl.shotgunReload3_Duration); - weapon_base_setWholeAttackDelay(pl, pl.shotgunReload3_Duration); + + shotgunExtraRef = ary_shotgunExtra[pl.iShotgunExtraDataID]; + + TS_Weapons_ViewAnimation((*shotgunExtraRef).shotgunReload3_seq, (*shotgunExtraRef).shotgunReload3_Duration); + weapon_base_setWholeAttackDelay(pl, (*shotgunExtraRef).shotgunReload3_Duration); pl.shotgunReloadIndex = 0; // this will be true when the fire delay expires, but doesn't hurt happening earlier. pl.isReloading = FALSE; @@ -661,7 +632,7 @@ weapon_akimbo_AttackDualHack( return FALSE; } - //printfline("ERE I GO akprev:%i aktest:%i - flagg:%i", pl.akimboFirePrev, pl.akimboTest, arg_flagger); + //printfline("here I go akprev:%i aktest:%i - flagg:%i", pl.akimboFirePrev, pl.akimboTest, arg_flagger); if( pl.akimboDualFireToleranceTime > 0 && @@ -698,7 +669,7 @@ weapon_akimbo_AttackDualHack( // unpacking the method to call at runtime out of paranoia knowing FTE. // Could make a table to know what to use per akimbo weapon ID, having a table // with one space for every single weapon in the game seems pretty wasteful. - // Calls like weapon_SOCOM_MK23_akimbo_attack, etc. + // Calls like weapon_socommk23_akimbo_attack, etc. BOOL(player pl, weapondynamic_t arg_thisWeapon, int attackTypeUsed)* tempRef = arg_akimboFireCallback; (*tempRef)(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_BOTH); @@ -837,7 +808,6 @@ weapon_akimbo_semiAttackChoice( // because whichever non-empty weapon wasn't ready to fire. // If they are both 0, we stopped because the weapon is empty. //pl.recentAttackHadAmmo = (finalAkimboChoice != BITS_AKIMBOCHOICE_NONE); - //pl.recentAkimboAttackChoice = finalAkimboChoice; //return( arg_thisWeapon.iClipLeft == 0 && arg_thisWeapon.iClipAkimboLeft == 0); if(arg_thisWeapon.iClipLeft == 0 && arg_thisWeapon.iClipAkimboLeft == 0){ @@ -946,7 +916,6 @@ weapon_akimbo_semiAttackChoice( } - pl.recentAkimboAttackChoice = finalAkimboChoice; } //printfline("EVERYBODY GET DOWN %i - next:%d", finalAkimboChoice, pl.nextAkimboAttackPreference); @@ -1021,7 +990,6 @@ weapon_akimbo_fullAttackChoice( // because whichever non-empty weapon wasn't ready to fire. // If they are both 0, we stopped because the weapon is empty. //pl.recentAttackHadAmmo = (finalAkimboChoice != BITS_AKIMBOCHOICE_NONE); - //pl.recentAkimboAttackChoice = finalAkimboChoice; //return( arg_thisWeapon.iClipLeft == 0 && arg_thisWeapon.iClipAkimboLeft == 0); if(arg_thisWeapon.iClipLeft == 0 && arg_thisWeapon.iClipAkimboLeft == 0){ // If both clips have no ammo, we assume the reason for failure is being out of ammo. @@ -1143,8 +1111,7 @@ weapon_akimbo_fullAttackChoice( */ } - - pl.recentAkimboAttackChoice = finalAkimboChoice; + \ } return finalAkimboChoice; @@ -1156,7 +1123,7 @@ weapon_ironsight_ToggleIronsight( player pl, weapondata_ironsight_t* basePRef, weapondynamic_t arg_thisWeapon ){ - //weapondata_ironsight_t* basePRef = (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::SOCOM_MK23]; + //weapondata_ironsight_t* basePRef = (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::SOCOMMK23]; weapondata_ironsight_t baseRef = *basePRef; // SEARCH ME!!! @@ -1420,7 +1387,6 @@ weapon_base_onEquip( TS_Weapons_ViewAnimation(baseRef.iAnim_Deploy_Index, baseRef.fAnim_Deploy_Duration); - pl.recentAkimboAttackChoice = BITS_AKIMBOCHOICE_NONE; pl.nextAkimboAttackPreference = BITS_AKIMBOCHOICE_LEFT; arg_thisWeapon.iIronSight = 0; //reset ironsight each time. @@ -1465,7 +1431,9 @@ weapon_gun_fireBurstBullet( //printfline("What now2 %i m:%i", pl.aryNextBurstShotTime_listenIndex, pl.aryNextBurstShotTime_softLength); #endif - // this lets Weapons_Primary ignore + // this tells my Weapons_Primary to ignore normal delay checks. + // The weapon's specific method for this must still check for this firemode + // for it to be effective, it's not magic arg_thisWeapon.iFireMode = BITS_FIREMODE_NONE; Weapons_Primary(); @@ -1679,7 +1647,7 @@ weapon_melee_onDrawHUD(player pl, weapondata_melee_t* basePRef, weapondynamic_t // empty box? ok. drawfill( vEquippedWeaponInfoDraw, [128, 19], clrPaleBlue, 0.86f - 0.60f ); - // drawSpriteNumber(ary_LCD_numberSet, vEquippedWeaponInfoDraw.x + 128 - 2 - 11*3, vEquippedWeaponInfoDraw.y + 0, arg_thisWeapon.iCount, 3, BITS_DIGITOPT_DEFAULT, clrDraw, 0.92f); + //drawSpriteNumber(ary_LCD_numberSet, vEquippedWeaponInfoDraw.x + 128 - 2 - 11*3, vEquippedWeaponInfoDraw.y + 0, arg_thisWeapon.iCount, 3, BITS_DIGITOPT_DEFAULT, clrDraw, 0.92f); vEquippedWeaponInfoDraw.y -= 20; // title @@ -1691,21 +1659,90 @@ weapon_melee_onDrawHUD(player pl, weapondata_melee_t* basePRef, weapondynamic_t -BOOL -dummy1(player pl, weapondynamic_t arg_thisWeapon, BOOL hasAmmo){ - return FALSE; +// SHELL SOUNDS: +// ts/sound/weapons/shell.wav +// ts/sound/weapons/sshell.wav +// ts/sound/weapons/sshell1.wav +// ts/sound/weapons/sshell2.wav +// ts/sound/weapons/sshell3.wav +// valve/sound/player/pl_shell1.wav +// valve/sound/player/pl_shell2.wav +// valve/sound/player/pl_shell3.wav +// ---- +// * sshell1, 2, and 3 are also found in the valve folder, these appear to be clones. +// * pl_shell ones are not cloned but can still be used +// * unknown if weapons/shell and sshell are used in original TS, may only be the +// 1,2,3 ones (shell#, sshell#) for most weapons and shotguns accordingly. + +// + + + + + + +// Precache models and the HUD icon given in FreeTS weapondata. +// Weapon sounds and anything else not in the struct shuold be precached +// in the weapon's own precache method or globally (precache.qc) if reused +// between different weapons like shell models/sounds. +void weapon_precache(weapondata_basic_t* basePRef){ +#ifdef SERVER + if((*basePRef).sWorldModelPath != NULL){ + precache_model((*basePRef).sWorldModelPath); + } +#else //CLIENT + if((*basePRef).sIconFilePath != NULL){ + precache_model((*basePRef).sIconFilePath); + } + if((*basePRef).sViewModelPath != NULL){ + precache_model((*basePRef).sViewModelPath); + } + if((*basePRef).sPlayerModelPath != NULL){ + precache_model((*basePRef).sPlayerModelPath); + } + if((*basePRef).sPlayerSilencerModelPath != NULL){ + precache_model((*basePRef).sPlayerSilencerModelPath); + } +#endif } + + + +// Not sure how to handle the "Weapons_UpdateAmmo" calls for FreeTS. +// Guessing to leave them dummied as HUD drawing already knows where to grab clip and ammo-pool +// values from, the Nuclide base_player's ammo1, 2, 3 vars are never used. +//---------------------- +// More typical way. +/* +void weapon_gun_updateAmmo(player pl, weapondata_gun_t* basePRef, weapondynamic_t arg_thisWeapon){ + Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[(*basePRef).iAmmoDataID], -1); +} +*/ +// Easier way for the caller. +void weapon_gun_updateAmmo(player pl, int weaponTypeID){ + if(pl.inventoryEquippedIndex != -1){ + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + // no need to hardcode ammo names when they're given by weapondata + //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); + weapondata_gun_t* basicP = (weapondata_gun_t*)ary_weaponData[weaponTypeID]; + // route to the above method, give a different name? No, not worth it. + //weapon_gun_updateAmmo(pl, basicP, arg_thisWeapon); + int myAmmoID = (*basicP).iAmmoDataID; + Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[myAmmoID], -1); + }else{ + printfline("!!! weapon_gun_updateAmmo: WARNING: inventoryEquippedIndex was -1"); + } +} + + + void -dummy2(player pl, weapondynamic_t arg_thisWeapon){ +weapons_dummyfun(player pl, weapondynamic_t arg_thisWeapon){ } -BOOL -dummy2b(player pl, weapondynamic_t arg_thisWeapon){ - return FALSE; -} //blank weapon. -weapondata_basic_t weapon_NONE = +weapondata_basic_t weapon_none = { WEAPONDATA_TYPEID_BASIC, "_NONE_", @@ -1714,20 +1751,14 @@ weapondata_basic_t weapon_NONE = "", "", "", - dummy1, - dummy1, - dummy1, - dummy1, - dummy2, - dummy2b, - dummy2, - dummy2, - dummy2, - dummy2, + weapons_dummyfun, + weapons_dummyfun, + weapons_dummyfun, + weapons_dummyfun, 0, 0, 0.0f, - 0.0f, //fire delay. this is most certainly wrong. find something more accurate later. + 0.0f, //fire delay 0.0f, FALSE, BITS_WEAPONOPT_NONE, @@ -1742,7 +1773,7 @@ weapondata_basic_t weapon_NONE = //blank weapon. -weapondata_basic_t weapon_NONE_akimbo = +weapondata_basic_t weapon_none_akimbo = { WEAPONDATA_TYPEID_BASIC, "_NONE_", @@ -1751,16 +1782,10 @@ weapondata_basic_t weapon_NONE_akimbo = "", "", "", - dummy1, - dummy1, - dummy1, - dummy1, - dummy2, - dummy2b, - dummy2, - dummy2, - dummy2, - dummy2, + weapons_dummyfun, + weapons_dummyfun, + weapons_dummyfun, + weapons_dummyfun, 0, 0, 0.0f, @@ -1794,53 +1819,53 @@ setupWeaponData(void){ // Really just do it by ID's with a new ASSIGN_WEAWPONDATA because init lists for offsets that may skip around sounds hellish g_weapons[WEAPON_ID::NONE] = w_null; - g_weapons[WEAPON_ID::Karate] = w_karate; + g_weapons[WEAPON_ID::KARATE] = w_karate; - g_weapons[WEAPON_ID::Glock18] = w_glock18; - g_weapons[WEAPON_ID::SOCOM_MK23] = w_socom_mk23; - g_weapons[WEAPON_ID::SOCOM_MK23_akimbo] = w_socom_mk23_akimbo; - g_weapons[WEAPON_ID::DesertEagle] = w_deserteagle; + g_weapons[WEAPON_ID::GLOCK18] = w_glock18; + g_weapons[WEAPON_ID::SOCOMMK23] = w_socommk23; + g_weapons[WEAPON_ID::SOCOMMK23_AKIMBO] = w_socommk23_akimbo; + g_weapons[WEAPON_ID::DESERTEAGLE] = w_deserteagle; - g_weapons[WEAPON_ID::FiveSeven] = w_fiveseven; - g_weapons[WEAPON_ID::FiveSeven_akimbo] = w_fiveseven_akimbo; - g_weapons[WEAPON_ID::Beretta] = w_beretta; - g_weapons[WEAPON_ID::Beretta_akimbo] = w_beretta_akimbo; + g_weapons[WEAPON_ID::FIVESEVEN] = w_fiveseven; + g_weapons[WEAPON_ID::FIVESEVEN_AKIMBO] = w_fiveseven_akimbo; + g_weapons[WEAPON_ID::BERETTA] = w_beretta; + g_weapons[WEAPON_ID::BERETTA_AKIMBO] = w_beretta_akimbo; - g_weapons[WEAPON_ID::AkimboColts] = w_akimbocolts; + g_weapons[WEAPON_ID::AKIMBOCOLTS] = w_akimbocolts; - g_weapons[WEAPON_ID::Glock20] = w_glock20; - g_weapons[WEAPON_ID::RugerMK1] = w_rugermk1; - g_weapons[WEAPON_ID::RagingBull] = w_ragingbull; - g_weapons[WEAPON_ID::ContenderG2] = w_contenderg2; + g_weapons[WEAPON_ID::GLOCK20] = w_glock20; + g_weapons[WEAPON_ID::RUGERMK1] = w_rugermk1; + g_weapons[WEAPON_ID::RAGINGBULL] = w_ragingbull; + g_weapons[WEAPON_ID::CONTENDERG2] = w_contenderg2; - g_weapons[WEAPON_ID::MiniUzi] = w_miniuzi; - g_weapons[WEAPON_ID::MiniUzi_akimbo] = w_miniuzi_akimbo; + g_weapons[WEAPON_ID::MINIUZI] = w_miniuzi; + g_weapons[WEAPON_ID::MINIUZI_AKIMBO] = w_miniuzi_akimbo; g_weapons[WEAPON_ID::MP5SD] = w_mp5sd; g_weapons[WEAPON_ID::MP5K] = w_mp5k; - g_weapons[WEAPON_ID::STEYR_TMP] = w_steyr_tmp; - g_weapons[WEAPON_ID::HK_PDW] = w_hk_pdw; //MP7-PDW + g_weapons[WEAPON_ID::STEYRTMP] = w_steyrtmp; + g_weapons[WEAPON_ID::HKPDW] = w_hkpdw; //MP7-PDW g_weapons[WEAPON_ID::UMP] = w_ump; - g_weapons[WEAPON_ID::Skorpion] = w_skorpion; - g_weapons[WEAPON_ID::Skorpion_akimbo] = w_skorpion_akimbo; + g_weapons[WEAPON_ID::SKORPION] = w_skorpion; + g_weapons[WEAPON_ID::SKORPION_AKIMBO] = w_skorpion_akimbo; g_weapons[WEAPON_ID::MAC10] = w_mac10; g_weapons[WEAPON_ID::M4A1] = w_m4a1; g_weapons[WEAPON_ID::AK47] = w_ak47; - g_weapons[WEAPON_ID::STEYR_AUG] = w_steyr_aug; + g_weapons[WEAPON_ID::STEYRAUG] = w_steyraug; g_weapons[WEAPON_ID::M16A4] = w_m16a4; - g_weapons[WEAPON_ID::Barrett_M82] = w_barrett_m82; + g_weapons[WEAPON_ID::BARRETTM82] = w_barrettm82; - g_weapons[WEAPON_ID::BenelliM3] = w_benellim3; + g_weapons[WEAPON_ID::BENELLIM3] = w_benellim3; g_weapons[WEAPON_ID::SPAS12] = w_spas12; g_weapons[WEAPON_ID::USAS12] = w_usas12; - g_weapons[WEAPON_ID::Mossberg500] = w_mossberg500; - g_weapons[WEAPON_ID::SawedOff] = w_sawedoff; + g_weapons[WEAPON_ID::MOSSBERG500] = w_mossberg500; + g_weapons[WEAPON_ID::SAWEDOFF] = w_sawedoff; - g_weapons[WEAPON_ID::M61Grenade] = w_m61grenade; - g_weapons[WEAPON_ID::CombatKnife] = w_combatknife; - g_weapons[WEAPON_ID::SealKnife] = w_sealknife; - g_weapons[WEAPON_ID::Katana] = w_katana; + g_weapons[WEAPON_ID::M61GRENADE] = w_m61grenade; + g_weapons[WEAPON_ID::COMBATKNIFE] = w_combatknife; + g_weapons[WEAPON_ID::SEALKNIFE] = w_sealknife; + g_weapons[WEAPON_ID::KATANA] = w_katana; g_weapons[WEAPON_ID::M60] = w_m60; @@ -1848,87 +1873,93 @@ setupWeaponData(void){ ///////////////////////////////////////////////////////// ASSIGN_AMMODATA(NONE) - ASSIGN_AMMODATA(_9x19mm) - ASSIGN_AMMODATA(_45Acp) - ASSIGN_AMMODATA(_p50AE) + ASSIGN_AMMODATA(_9X19MM) + ASSIGN_AMMODATA(_45ACP) + ASSIGN_AMMODATA(_P50AE) - ASSIGN_AMMODATA(_5p7x28) + ASSIGN_AMMODATA(_5P7X28) - ASSIGN_AMMODATA(_10mmAUTO) - ASSIGN_AMMODATA(_p22LR) - ASSIGN_AMMODATA(_p454Casull) - ASSIGN_AMMODATA(_5p56Nato) - ASSIGN_AMMODATA(_7p62x39mm) + ASSIGN_AMMODATA(_10MMAUTO) + ASSIGN_AMMODATA(_P22LR) + ASSIGN_AMMODATA(_P454CASULL) + ASSIGN_AMMODATA(_5P56NATO) + ASSIGN_AMMODATA(_7P62X39MM) ASSIGN_AMMODATA(_50BMG) ASSIGN_AMMODATA(_SHELLS) ASSIGN_AMMODATA(_32ACP) - ASSIGN_AMMODATA(_7p62x51mm) - - //ary_weaponData[WEAPON_ID::Glock18] = (weapondata_generic_t*) &weapon_Glock18; - - ASSIGN_WEAPONDATA(NONE) - ASSIGN_AKIMBOUPGRADEDATA(NONE) + ASSIGN_AMMODATA(_7P62X51MM) - ASSIGN_WEAPONDATA(Karate) - ASSIGN_WEAPONDATA(Glock18) + ASSIGN_WEAPONDATA(NONE, none) + ASSIGN_AKIMBOUPGRADEDATA(NONE, none) - ASSIGN_WEAPONDATA(SOCOM_MK23) - ASSIGN_WEAPONDATA(SOCOM_MK23_akimbo) - ASSIGN_AKIMBOUPGRADEDATA(SOCOM_MK23) + ASSIGN_WEAPONDATA(KARATE, karate) + ASSIGN_WEAPONDATA(GLOCK18, glock18) - ASSIGN_WEAPONDATA(DesertEagle) + ASSIGN_WEAPONDATA(SOCOMMK23, socommk23) + ASSIGN_WEAPONDATA(SOCOMMK23_AKIMBO, socommk23_akimbo) + ASSIGN_AKIMBOUPGRADEDATA(SOCOMMK23, socommk23) - ASSIGN_WEAPONDATA(FiveSeven) - ASSIGN_WEAPONDATA(FiveSeven_akimbo) - ASSIGN_AKIMBOUPGRADEDATA(FiveSeven) - ASSIGN_WEAPONDATA(Beretta) - ASSIGN_WEAPONDATA(Beretta_akimbo) - ASSIGN_AKIMBOUPGRADEDATA(Beretta) + ASSIGN_WEAPONDATA(DESERTEAGLE, deserteagle) - ASSIGN_WEAPONDATA(AkimboColts) + ASSIGN_WEAPONDATA(FIVESEVEN, fiveseven) + ASSIGN_WEAPONDATA(FIVESEVEN_AKIMBO, fiveseven_akimbo) + ASSIGN_AKIMBOUPGRADEDATA(FIVESEVEN, fiveseven) + ASSIGN_WEAPONDATA(BERETTA, beretta) + ASSIGN_WEAPONDATA(BERETTA_AKIMBO, beretta_akimbo) + ASSIGN_AKIMBOUPGRADEDATA(BERETTA, beretta) - ASSIGN_WEAPONDATA(Glock20) - ASSIGN_WEAPONDATA(RugerMK1) - ASSIGN_WEAPONDATA(RagingBull) - ASSIGN_WEAPONDATA(ContenderG2) + ASSIGN_WEAPONDATA(AKIMBOCOLTS, akimbocolts) + + ASSIGN_WEAPONDATA(GLOCK20, glock20) + ASSIGN_WEAPONDATA(RUGERMK1, rugermk1) + ASSIGN_WEAPONDATA(RAGINGBULL, ragingbull) + ASSIGN_WEAPONDATA(CONTENDERG2, contenderg2) - ASSIGN_WEAPONDATA(MiniUzi) - ASSIGN_WEAPONDATA(MiniUzi_akimbo) - ASSIGN_AKIMBOUPGRADEDATA(MiniUzi) + ASSIGN_WEAPONDATA(MINIUZI, miniuzi) + ASSIGN_WEAPONDATA(MINIUZI_AKIMBO, miniuzi_akimbo) + ASSIGN_AKIMBOUPGRADEDATA(MINIUZI, miniuzi) - ASSIGN_WEAPONDATA(MP5SD) - ASSIGN_WEAPONDATA(MP5K) + ASSIGN_WEAPONDATA(MP5SD, mp5sd) + ASSIGN_WEAPONDATA(MP5K, mp5k) - ASSIGN_WEAPONDATA(STEYR_TMP) - ASSIGN_WEAPONDATA(HK_PDW) - ASSIGN_WEAPONDATA(UMP) + ASSIGN_WEAPONDATA(STEYRTMP, steyrtmp) + ASSIGN_WEAPONDATA(HKPDW, hkpdw) + ASSIGN_WEAPONDATA(UMP, ump) - ASSIGN_WEAPONDATA(Skorpion) - ASSIGN_WEAPONDATA(Skorpion_akimbo) - ASSIGN_AKIMBOUPGRADEDATA(Skorpion) + ASSIGN_WEAPONDATA(SKORPION, skorpion) + ASSIGN_WEAPONDATA(SKORPION_AKIMBO, skorpion_akimbo) + ASSIGN_AKIMBOUPGRADEDATA(SKORPION, skorpion) - ASSIGN_WEAPONDATA(MAC10) + ASSIGN_WEAPONDATA(MAC10, mac10) - ASSIGN_WEAPONDATA(M4A1) - ASSIGN_WEAPONDATA(AK47) - ASSIGN_WEAPONDATA(STEYR_AUG) - ASSIGN_WEAPONDATA(M16A4) - ASSIGN_WEAPONDATA(Barrett_M82) + ASSIGN_WEAPONDATA(M4A1, m4a1) + ASSIGN_WEAPONDATA(AK47, ak47) + ASSIGN_WEAPONDATA(STEYRAUG, steyraug) + ASSIGN_WEAPONDATA(M16A4, m16a4) + ASSIGN_WEAPONDATA(BARRETTM82, barrettm82) - ASSIGN_WEAPONDATA(BenelliM3) - ASSIGN_WEAPONDATA(USAS12) - ASSIGN_WEAPONDATA(SPAS12) - ASSIGN_WEAPONDATA(Mossberg500) - ASSIGN_WEAPONDATA(SawedOff) + ASSIGN_WEAPONDATA(BENELLIM3, benellim3) + ASSIGN_WEAPONDATA(USAS12, usas12) + ASSIGN_WEAPONDATA(SPAS12, spas12) + ASSIGN_WEAPONDATA(MOSSBERG500, mossberg500) + ASSIGN_WEAPONDATA(SAWEDOFF, sawedoff) - ASSIGN_WEAPONDATA(M61Grenade) - ASSIGN_WEAPONDATA(CombatKnife) - ASSIGN_WEAPONDATA(M60) - ASSIGN_WEAPONDATA(Katana) - ASSIGN_WEAPONDATA(SealKnife) + ASSIGN_WEAPONDATA(M61GRENADE, m61grenade) + ASSIGN_WEAPONDATA(COMBATKNIFE, combatknife) + ASSIGN_WEAPONDATA(M60, m60) + ASSIGN_WEAPONDATA(KATANA, katana) + ASSIGN_WEAPONDATA(SEALKNIFE, sealknife) + + ary_shotgunExtra[SHOTGUN_EXTRA_ID::BENELLIM3] = &weapon_benellim3_shotgunExtra; + ary_shotgunExtra[SHOTGUN_EXTRA_ID::MOSSBERG500] = &weapon_mossberg500_shotgunExtra; + ary_shotgunExtra[SHOTGUN_EXTRA_ID::MOSSBERG500_IRONSIGHT] = &weapon_mossberg500_shotgunExtra_ironsight; + + ary_shotgunExtra[SHOTGUN_EXTRA_ID::SPAS12] = &weapon_spas12_shotgunExtra; + + }//setupWeaponData diff --git a/src/shared/weapons/weapon_ak47.qc b/src/shared/weapons/weapon_ak47.qc index f87344c..350064c 100644 --- a/src/shared/weapons/weapon_ak47.qc +++ b/src/shared/weapons/weapon_ak47.qc @@ -1,5 +1,4 @@ - enum weaponseq_ak47{ idle, reload, @@ -12,39 +11,21 @@ enum weaponseq_ak47{ reloadb }; - -BOOLEAN weapon_AK47_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; +void weapon_ak47_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_AK47_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_AK47_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_AK47_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} - -void weapon_AK47_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_AK47_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_AK47_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::AK47], arg_thisWeapon); -} -void weapon_AK47_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_AK47_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_AK47_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_ak47_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ } - +void weapon_ak47_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::AK47], arg_thisWeapon); +} +void weapon_ak47_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ -weapondata_ironsight_t weapon_AK47 = +} + +weapondata_ironsight_t weapon_ak47 = { WEAPONDATA_TYPEID_IRONSIGHT, "AK47", @@ -53,16 +34,10 @@ weapondata_ironsight_t weapon_AK47 = "", "models/w_ak47.mdl", "sprites/weapons/ak47.spr", - weapon_AK47_onPrimaryAttack, - weapon_AK47_onPrimaryAttackRelease, - weapon_AK47_onSecondaryAttack, - weapon_AK47_onSecondaryAttackRelease, - weapon_AK47_onEquip, - weapon_AK47_onUnEquip, - weapon_AK47_onThink, - weapon_AK47_onDrawHUD, - weapon_AK47_onReload, - weapon_AK47_onColdCock, + weapon_ak47_onPrimaryAttackRelease, + weapon_ak47_onSecondaryAttackRelease, + weapon_ak47_onThink, + weapon_ak47_onColdCock, weaponseq_ak47::idle, weaponseq_ak47::draw, 31.0f / 35.0f, @@ -79,7 +54,7 @@ weapondata_ironsight_t weapon_AK47 = WEAPON_AKIMBO_UPGRADE_ID::NONE, BITS_FIREMODE_FULL | BITS_FIREMODE_SEMI, BITS_FIREMODE_FULL, - AMMO_ID::_7p62x39mm, + AMMO_ID::_7P62X39MM, 30, //clip 4096, //range weaponseq_ak47::reload, @@ -102,29 +77,23 @@ weapondata_ironsight_t weapon_AK47 = - - void w_ak47_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::AK47]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + //precache_sound("weapons/ak47/clipin.wav"); + //precache_sound("weapons/ak47/clipout.wav"); + precache_sound("weapons/ak47/fire.wav"); + //precache_sound("weapons/ak47/slideback.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_ak47_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string @@ -181,7 +150,7 @@ w_ak47_primary(void) return; } - SoundPitched_Send(pl, SNDP_AK47); /* get around protocol limits */ + SoundPitched_Send(pl, SNDP_AK47_FIRE); /* get around protocol limits */ if(!arg_thisWeapon.iIronSight){ TS_Weapons_ViewAnimation(weaponseq_ak47::shoot, 31.0f/30.0f); @@ -245,7 +214,6 @@ w_ak47_secondary(void) } - void w_ak47_reload(void) { @@ -255,8 +223,6 @@ w_ak47_reload(void) weapon_ironsight_Reload(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::AK47], arg_thisWeapon); } - -// ??? float w_ak47_aimanim(void) { @@ -273,13 +239,6 @@ w_ak47_hud(void) } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted -void -w_ak47_hudpic(int selected, vector pos, float a) -{ - // -} weapon_t w_ak47 = { @@ -307,6 +266,3 @@ weapon_t w_ak47 = }; - - - diff --git a/src/shared/weapons/weapon_akimbocolts.qc b/src/shared/weapons/weapon_akimbocolts.qc index df357cc..b4997dc 100644 --- a/src/shared/weapons/weapon_akimbocolts.qc +++ b/src/shared/weapons/weapon_akimbocolts.qc @@ -1,6 +1,5 @@ enum weaponseq_akimbocolts{ - //... idle, reload, draw, @@ -13,40 +12,21 @@ enum weaponseq_akimbocolts{ }; - - - -BOOLEAN weapon_AkimboColts_akimbo_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_akimbocolts_akimbo_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_AkimboColts_akimbo_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_AkimboColts_akimbo_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_AkimboColts_akimbo_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -void weapon_AkimboColts_akimbo_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_AkimboColts_akimbo_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_AkimboColts_akimbo_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::AkimboColts], arg_thisWeapon); -} -void weapon_AkimboColts_akimbo_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_AkimboColts_akimbo_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_AkimboColts_akimbo_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_akimbocolts_akimbo_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ } - +void weapon_akimbocolts_akimbo_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::AKIMBOCOLTS], arg_thisWeapon); +} +void weapon_akimbocolts_akimbo_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ -weapondata_gun_t weapon_AkimboColts = +} + +weapondata_gun_t weapon_akimbocolts = { WEAPONDATA_TYPEID_GUN, "Golden Colts", @@ -55,20 +35,14 @@ weapondata_gun_t weapon_AkimboColts = "", "models/w_gold.mdl", "sprites/weapons/gold.spr", - weapon_AkimboColts_akimbo_onPrimaryAttack, - weapon_AkimboColts_akimbo_onPrimaryAttackRelease, - weapon_AkimboColts_akimbo_onSecondaryAttack, - weapon_AkimboColts_akimbo_onSecondaryAttackRelease, - weapon_AkimboColts_akimbo_onEquip, - weapon_AkimboColts_akimbo_onUnEquip, - weapon_AkimboColts_akimbo_onThink, - weapon_AkimboColts_akimbo_onDrawHUD, - weapon_AkimboColts_akimbo_onReload, - weapon_AkimboColts_akimbo_onColdCock, + weapon_akimbocolts_akimbo_onPrimaryAttackRelease, + weapon_akimbocolts_akimbo_onSecondaryAttackRelease, + weapon_akimbocolts_akimbo_onThink, + weapon_akimbocolts_akimbo_onColdCock, weaponseq_akimbocolts::idle, weaponseq_akimbocolts::draw, 31.0f / 30.0f, - 0.19f, //fire delay. this is most certainly wrong. find something more accurate later. + 0.19f, //fire delay 15.0f, //dmg TRUE, BITS_WEAPONOPT_AKIMBO, @@ -84,7 +58,7 @@ weapondata_gun_t weapon_AkimboColts = BITS_FIREMODE_AKIMBO_SEMI_AUTO | BITS_FIREMODE_AKIMBO_FREE_SEMI, BITS_FIREMODE_AKIMBO_SEMI_AUTO, - AMMO_ID::_45Acp, + AMMO_ID::_45ACP, 16, //clip 4096, //range weaponseq_akimbocolts::reload, @@ -101,30 +75,26 @@ weapondata_gun_t weapon_AkimboColts = void w_akimbocolts_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::AKIMBOCOLTS]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + //precache_sound("weapons/gold/clipin.wav"); + //precache_sound("weapons/gold/clipout.wav"); + precache_sound("weapons/gold/gold-fire.wav"); + //precache_sound("weapons/gold/sliderelease.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_akimbocolts_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string w_akimbocolts_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::AkimboColts]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::AKIMBOCOLTS]).sWorldModelPath; } string @@ -132,7 +102,7 @@ w_akimbocolts_pmodel(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - return (*ary_weaponData[WEAPON_ID::AkimboColts]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::AKIMBOCOLTS]).sPlayerModelPath; } string @@ -146,7 +116,7 @@ w_akimbocolts_draw(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::AkimboColts], arg_thisWeapon); + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::AKIMBOCOLTS], arg_thisWeapon); } void @@ -161,9 +131,8 @@ w_akimbocolts_holster(void) // Akimbo weapons consistently. // Putting it here avoids duplicating a bunch of code. // Also, "attackTypeUsed" is whether primary (FALSE) or secondary (TRUE) lead to this point. -BOOLEAN weapon_AkimboColts_akimbo_attack(player localPlayer, weapondynamic_t arg_thisWeapon, int attackTypeUsed){ +BOOLEAN weapon_akimbocolts_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, int attackTypeUsed){ float randomChoice; - player pl = localPlayer; //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; //special case @@ -177,7 +146,7 @@ BOOLEAN weapon_AkimboColts_akimbo_attack(player localPlayer, weapondynamic_t arg // Muzzle flashes and shell ejections for akimbo pending! // because I am not copy/pasting this monstrosity 5 times. - finalAkimboChoice = weapon_akimbo_semiAttackChoice(localPlayer, ary_weaponData[WEAPON_ID::AkimboColts], arg_thisWeapon, attackTypeUsed); + finalAkimboChoice = weapon_akimbo_semiAttackChoice(pl, ary_weaponData[WEAPON_ID::AKIMBOCOLTS], arg_thisWeapon, attackTypeUsed); #ifdef CLIENT SAVE_STATE(pl.nextAkimboAttackPreference); @@ -214,7 +183,7 @@ BOOLEAN weapon_AkimboColts_akimbo_attack(player localPlayer, weapondynamic_t arg // sudden dual-fire request though. int effectiveAkimboChoice = finalAkimboChoice & ~pl.akimboTest; //finalAkimboChoice;//BITS_AKIMBOCHOICE_NONE & ~pl.akimboTest - weapon_base_onAttack(localPlayer, ary_weaponData[WEAPON_ID::AkimboColts], arg_thisWeapon, effectiveAkimboChoice); + weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::AKIMBOCOLTS], arg_thisWeapon, effectiveAkimboChoice); #if 0 if(effectiveAkimboChoice & BITS_AKIMBOCHOICE_LEFT){ @@ -224,7 +193,7 @@ BOOLEAN weapon_AkimboColts_akimbo_attack(player localPlayer, weapondynamic_t arg TS_Weapons_PlaySoundDirect(pl, "weapons/gold/gold-fire.wav"); } #else - SoundPitched_Send(pl, SNDP_AKIMBOCOLTS); + SoundPitched_Send(pl, SNDP_AKIMBOCOLTS_FIRE); #endif @@ -294,7 +263,7 @@ BOOLEAN weapon_AkimboColts_akimbo_attack(player localPlayer, weapondynamic_t arg } return TRUE; -}//END OF weapon_AkimboColts_akimbo_attack +}//END OF weapon_akimbocolts_akimbo_attack void @@ -308,15 +277,15 @@ w_akimbocolts_primary(void) // in addition to the primary input, which lead to '_primary' being called at all. if(input_buttons & INPUT_BUTTON3){ - if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_BOTH, &weapon_AkimboColts_akimbo_attack)){ + if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_BOTH, &weapon_akimbocolts_akimbo_attack)){ // nothing unusual here. pl.akimboTest = 0; - weapon_AkimboColts_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_BOTH); + weapon_akimbocolts_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_BOTH); }else{ } }else{ - if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT, &weapon_AkimboColts_akimbo_attack)){ - weapon_AkimboColts_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); + if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT, &weapon_akimbocolts_akimbo_attack)){ + weapon_akimbocolts_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); pl.akimboFirePrev = BITS_AKIMBOCHOICE_LEFT; } @@ -341,11 +310,11 @@ w_akimbocolts_secondary(void) }else{ // fires the right weapon always - //weapon_AkimboColts_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT); + //weapon_akimbocolts_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT); //return; - if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT, &weapon_AkimboColts_akimbo_attack)){ - weapon_AkimboColts_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT); + if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT, &weapon_akimbocolts_akimbo_attack)){ + weapon_akimbocolts_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT); pl.akimboFirePrev = BITS_AKIMBOCHOICE_RIGHT; } } @@ -358,38 +327,32 @@ w_akimbocolts_reload(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::AkimboColts], arg_thisWeapon); + weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::AKIMBOCOLTS], arg_thisWeapon); leftCount = 0; rightCount = 0; } -// ??? float w_akimbocolts_aimanim(void) { return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND; } - void w_akimbocolts_hud(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::AkimboColts], arg_thisWeapon); + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::AKIMBOCOLTS], arg_thisWeapon); } - -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_akimbocolts_hudpic(int selected, vector pos, float a) { // } - weapon_t w_akimbocolts = { diff --git a/src/shared/weapons/weapon_barrett_m82.qc b/src/shared/weapons/weapon_barrett_m82.qc deleted file mode 100644 index 606aee0..0000000 --- a/src/shared/weapons/weapon_barrett_m82.qc +++ /dev/null @@ -1,294 +0,0 @@ - -enum weaponseq_barrett_m82{ - idle, - reload, - draw, - shoot, - shoot2 -}; - - - -BOOLEAN weapon_Barrett_M82_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; -} -BOOLEAN weapon_Barrett_M82_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_Barrett_M82_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_Barrett_M82_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} - -void weapon_Barrett_M82_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_Barrett_M82_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_Barrett_M82_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Barrett_M82], arg_thisWeapon); -} -void weapon_Barrett_M82_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_Barrett_M82_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_Barrett_M82_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ - -} - - -weapondata_gun_t weapon_Barrett_M82 = -{ - WEAPONDATA_TYPEID_GUN, - "Barrett M82A1", - "models/v_m82.mdl", - "models/p_m82.mdl", - "", - "models/w_m82.mdl", - "sprites/weapons/m82.spr", - weapon_Barrett_M82_onPrimaryAttack, - weapon_Barrett_M82_onPrimaryAttackRelease, - weapon_Barrett_M82_onSecondaryAttack, - weapon_Barrett_M82_onSecondaryAttackRelease, - weapon_Barrett_M82_onEquip, - weapon_Barrett_M82_onUnEquip, - weapon_Barrett_M82_onThink, - weapon_Barrett_M82_onDrawHUD, - weapon_Barrett_M82_onReload, - weapon_Barrett_M82_onColdCock, - weaponseq_barrett_m82::idle, - weaponseq_barrett_m82::draw, - 31.0f / 30.0f, - 0.0625f, //fire delay. - 7.0f, //dmg - FALSE, - BITS_WEAPONOPT_LASERSIGHT | BITS_WEAPONOPT_SCOPE, - BITS_WEAPONOPT_SCOPE, - 9000, - 70, - BUYCATEGORY_RIFLES, - 4, - {0.001000, 10.000000, 0.100000}, - WEAPON_AKIMBO_UPGRADE_ID::NONE, - BITS_FIREMODE_SEMI, - BITS_FIREMODE_SEMI, - AMMO_ID::_50BMG, - 5, //clip - 4096, //range - weaponseq_barrett_m82::reload, - 57.0f / 30.0f, - -1, - -1, - -1, - -1 -}; - - - - -void -w_barrett_m82_precache(void) -{ -#ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); -#else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); -#endif -} - -// I guess? I don't know if we really benefit from doing this. -void -w_barrett_m82_updateammo(player pl) -{ - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); -} - -string -w_barrett_m82_wmodel(void) -{ - return (*ary_weaponData[WEAPON_ID::Barrett_M82]).sWorldModelPath; -} - -string -w_barrett_m82_pmodel(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - return (*ary_weaponData[WEAPON_ID::Barrett_M82]).sPlayerModelPath; -} - -string -w_barrett_m82_deathmsg(void) -{ - return ""; -} - -void -w_barrett_m82_draw(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapondata_basic_t* basicP = ary_weaponData[WEAPON_ID::Barrett_M82]; - - weapon_base_onEquip(pl, basicP, arg_thisWeapon); -} - - -void -w_barrett_m82_holster(void) -{ -} - - -void -w_barrett_m82_primary(void) -{ - float randomChoice; - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - - if (pl.w_attack_next > 0.0) { - return; - } - - //if(arg_thisWeapon.iFireMode == BITS_FIREMODE_SEMI){ - INPUT_PRIMARY_TAP_GATE - //} - - if (!arg_thisWeapon.iClipLeft || WEAPON_UNDERWATER_CHECK) { - PLAY_CLICK_SOUND - return; - } - - SoundPitched_Send(pl, SNDP_BARRETTM82); - - if(randomChoice < 0.5){ - TS_Weapons_ViewAnimation(weaponseq_barrett_m82::shoot, 31.0f/30.0f); - }else{ - TS_Weapons_ViewAnimation(weaponseq_barrett_m82::shoot2, 31.0f/30.0f); - } - -#ifdef CLIENT - View_ShowMuzzleflash(MUZZLE_SMALL); - View_AddEvent(w_ejectshell_pistol, 0.0f); -#endif - - weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::Barrett_M82], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); - - weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[arg_thisWeapon.weaponID]).fAttackDelay); - - if (self.flags & FL_CROUCHING){ - Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.2f); - }else{ - Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.2f); - } - -} - - - -void -w_barrett_m82_secondary(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - - if(pl.w_attack_next > 0){ - return; - } - - INPUT_SECONDARY_TAP_GATE - - if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){ - // toggle through the zoom. - switch(pl.currentZoomChoice){ - case -1:{ - //pl.viewzoom = 32/80; - pl.setZoom(0.4f); - pl.currentZoomChoice++; - break;} - case 0:{ - //pl.viewzoom = 8/80; - pl.setZoom(0.10f); - pl.currentZoomChoice++; - break;} - case 1:{ - //pl.viewzoom = 0; - pl.setZoom(1.00f); - pl.currentZoomChoice = -1; - break;} - }//END OF switch - - } - -} - -void -w_barrett_m82_reload(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - - weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Barrett_M82], arg_thisWeapon); -} - -// ??? -float -w_barrett_m82_aimanim(void) -{ - return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND; -} - -void -w_barrett_m82_hud(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Barrett_M82], arg_thisWeapon); -} - - - -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted -void -w_barrett_m82_hudpic(int selected, vector pos, float a) -{ - // -} - - -weapon_t w_barrett_m82 = -{ - - .name = "barrett_m82", - .id = 0, // not using this - .slot = 2, // ? - .slot_pos = 0, // not using this - .weight = 0, // not using this - .draw = w_barrett_m82_draw, - .holster = w_barrett_m82_holster, - .primary = w_barrett_m82_primary, - .secondary = w_barrett_m82_secondary, - .reload = w_barrett_m82_reload, - .release = NULL, - .crosshair = w_barrett_m82_hud, - .precache = w_barrett_m82_precache, - .pickup = NULL, - .updateammo = w_barrett_m82_updateammo, - .wmodel = w_barrett_m82_wmodel, - .pmodel = w_barrett_m82_pmodel, - .deathmsg = w_barrett_m82_deathmsg, - .aimanim = w_barrett_m82_aimanim, - .hudpic = NULL - -}; - diff --git a/src/shared/weapons/weapon_barrettm82.qc b/src/shared/weapons/weapon_barrettm82.qc new file mode 100644 index 0000000..2ebcc82 --- /dev/null +++ b/src/shared/weapons/weapon_barrettm82.qc @@ -0,0 +1,260 @@ + +enum weaponseq_barrettm82{ + idle, + reload, + draw, + shoot, + shoot2 +}; + +void weapon_barrettm82_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + +} +void weapon_barrettm82_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + +} + +void weapon_barrettm82_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::BARRETTM82], arg_thisWeapon); +} +void weapon_barrettm82_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ + +} + +weapondata_gun_t weapon_barrettm82 = +{ + WEAPONDATA_TYPEID_GUN, + "Barrett M82A1", + "models/v_m82.mdl", + "models/p_m82.mdl", + "", + "models/w_m82.mdl", + "sprites/weapons/m82.spr", + weapon_barrettm82_onPrimaryAttackRelease, + weapon_barrettm82_onSecondaryAttackRelease, + weapon_barrettm82_onThink, + weapon_barrettm82_onColdCock, + weaponseq_barrettm82::idle, + weaponseq_barrettm82::draw, + 31.0f / 30.0f, + 0.0625f, //fire delay. + 7.0f, //dmg + FALSE, + BITS_WEAPONOPT_LASERSIGHT | BITS_WEAPONOPT_SCOPE, + BITS_WEAPONOPT_SCOPE, + 9000, + 70, + BUYCATEGORY_RIFLES, + 4, + {0.001000, 10.000000, 0.100000}, + WEAPON_AKIMBO_UPGRADE_ID::NONE, + BITS_FIREMODE_SEMI, + BITS_FIREMODE_SEMI, + AMMO_ID::_50BMG, + 5, //clip + 4096, //range + weaponseq_barrettm82::reload, + 57.0f / 30.0f, + -1, + -1, + -1, + -1 +}; + + + + +void +w_barrettm82_precache(void) +{ + weapon_precache(ary_weaponData[WEAPON_ID::BARRETTM82]); +#ifdef SERVER + //precache_sound("weapons/barrett/clipin.wav"); + //precache_sound("weapons/barrett/clipout.wav"); + precache_sound("weapons/barrett/fire.wav"); + //precache_sound("weapons/barrett/slideback.wav"); +#else + +#endif +} + +void +w_barrettm82_updateammo(player pl) +{ +} + +string +w_barrettm82_wmodel(void) +{ + return (*ary_weaponData[WEAPON_ID::BARRETTM82]).sWorldModelPath; +} + +string +w_barrettm82_pmodel(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + return (*ary_weaponData[WEAPON_ID::BARRETTM82]).sPlayerModelPath; +} + +string +w_barrettm82_deathmsg(void) +{ + return ""; +} + +void +w_barrettm82_draw(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + weapondata_basic_t* basicP = ary_weaponData[WEAPON_ID::BARRETTM82]; + + weapon_base_onEquip(pl, basicP, arg_thisWeapon); +} + + +void +w_barrettm82_holster(void) +{ +} + + +void +w_barrettm82_primary(void) +{ + float randomChoice; + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + + if (pl.w_attack_next > 0.0) { + return; + } + + //if(arg_thisWeapon.iFireMode == BITS_FIREMODE_SEMI){ + INPUT_PRIMARY_TAP_GATE + //} + + if (!arg_thisWeapon.iClipLeft || WEAPON_UNDERWATER_CHECK) { + PLAY_CLICK_SOUND + return; + } + + SoundPitched_Send(pl, SNDP_BARRETTM82_FIRE); + + if(randomChoice < 0.5){ + TS_Weapons_ViewAnimation(weaponseq_barrettm82::shoot, 31.0f/30.0f); + }else{ + TS_Weapons_ViewAnimation(weaponseq_barrettm82::shoot2, 31.0f/30.0f); + } + +#ifdef CLIENT + View_ShowMuzzleflash(MUZZLE_SMALL); + View_AddEvent(w_ejectshell_pistol, 0.0f); +#endif + + weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::BARRETTM82], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); + + weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[arg_thisWeapon.weaponID]).fAttackDelay); + + if (self.flags & FL_CROUCHING){ + Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.2f); + }else{ + Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.2f); + } + +} + + + +void +w_barrettm82_secondary(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + + if(pl.w_attack_next > 0){ + return; + } + + INPUT_SECONDARY_TAP_GATE + + if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){ + // toggle through the zoom. + switch(pl.currentZoomChoice){ + case -1:{ + //pl.viewzoom = 32/80; + pl.setZoom(0.4f); + pl.currentZoomChoice++; + break;} + case 0:{ + //pl.viewzoom = 8/80; + pl.setZoom(0.10f); + pl.currentZoomChoice++; + break;} + case 1:{ + //pl.viewzoom = 0; + pl.setZoom(1.00f); + pl.currentZoomChoice = -1; + break;} + }//END OF switch + + } + +} + +void +w_barrettm82_reload(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + + weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::BARRETTM82], arg_thisWeapon); +} + +float +w_barrettm82_aimanim(void) +{ + return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND; +} + +void +w_barrettm82_hud(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::BARRETTM82], arg_thisWeapon); +} + +void +w_barrettm82_hudpic(int selected, vector pos, float a) +{ + // +} + +weapon_t w_barrettm82 = +{ + + .name = "barrettm82", + .id = 0, // not using this + .slot = 2, // ? + .slot_pos = 0, // not using this + .weight = 0, // not using this + .draw = w_barrettm82_draw, + .holster = w_barrettm82_holster, + .primary = w_barrettm82_primary, + .secondary = w_barrettm82_secondary, + .reload = w_barrettm82_reload, + .release = NULL, + .crosshair = w_barrettm82_hud, + .precache = w_barrettm82_precache, + .pickup = NULL, + .updateammo = w_barrettm82_updateammo, + .wmodel = w_barrettm82_wmodel, + .pmodel = w_barrettm82_pmodel, + .deathmsg = w_barrettm82_deathmsg, + .aimanim = w_barrettm82_aimanim, + .hudpic = NULL + +}; + diff --git a/src/shared/weapons/weapon_benellim3.qc b/src/shared/weapons/weapon_benellim3.qc index b6cb48d..2162beb 100644 --- a/src/shared/weapons/weapon_benellim3.qc +++ b/src/shared/weapons/weapon_benellim3.qc @@ -1,5 +1,4 @@ - enum weaponseq_benellim3{ idle, idle2, @@ -13,37 +12,20 @@ enum weaponseq_benellim3{ pump2 }; - -BOOLEAN weapon_BenelliM3_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; +void weapon_benellim3_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_BenelliM3_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_benellim3_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_BenelliM3_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_benellim3_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_shotgun_onThink_reloadLogic(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::BENELLIM3], arg_thisWeapon); } -BOOLEAN weapon_BenelliM3_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_benellim3_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ + } -void weapon_BenelliM3_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_BenelliM3_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_BenelliM3_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_shotgun_onThink_reloadLogic(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::BenelliM3], arg_thisWeapon); -} -void weapon_BenelliM3_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_BenelliM3_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_BenelliM3_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ -} - - -weapondata_gun_t weapon_BenelliM3 = +weapondata_gun_t weapon_benellim3 = { WEAPONDATA_TYPEID_GUN, "Benelli M3", @@ -52,16 +34,10 @@ weapondata_gun_t weapon_BenelliM3 = "", "models/w_m3.mdl", "sprites/weapons/m3.spr", - weapon_BenelliM3_onPrimaryAttack, - weapon_BenelliM3_onPrimaryAttackRelease, - weapon_BenelliM3_onSecondaryAttack, - weapon_BenelliM3_onSecondaryAttackRelease, - weapon_BenelliM3_onEquip, - weapon_BenelliM3_onUnEquip, - weapon_BenelliM3_onThink, - weapon_BenelliM3_onDrawHUD, - weapon_BenelliM3_onReload, - weapon_BenelliM3_onColdCock, + weapon_benellim3_onPrimaryAttackRelease, + weapon_benellim3_onSecondaryAttackRelease, + weapon_benellim3_onThink, + weapon_benellim3_onColdCock, weaponseq_benellim3::idle, weaponseq_benellim3::draw, 31.0f / 30.0f, @@ -90,36 +66,40 @@ weapondata_gun_t weapon_BenelliM3 = 1 }; +weapondata_shotgun_extra_t weapon_benellim3_shotgunExtra = +{ + weaponseq_benellim3::reload1, + 21.0f/40.0f, + weaponseq_benellim3::reload2, + 21.0f/50.0f, + 10.0f/50.0f, + weaponseq_benellim3::reload3, + 26.0f/30.0f +}; void w_benellim3_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::BENELLIM3]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + precache_sound("weapons/m3/m3-pump.wav"); + precache_sound("weapons/m3/m3-fire.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_benellim3_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string w_benellim3_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::BenelliM3]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::BENELLIM3]).sWorldModelPath; } string @@ -127,7 +107,7 @@ w_benellim3_pmodel(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - return (*ary_weaponData[WEAPON_ID::BenelliM3]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::BENELLIM3]).sPlayerModelPath; } string @@ -142,18 +122,9 @@ w_benellim3_draw(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //shotgun reload settings: shared - pl.shotgunReload1_seq = weaponseq_benellim3::reload1; - pl.shotgunReload1_Duration = 21.0f/40.0f; - pl.shotgunReload2_seq = weaponseq_benellim3::reload2; - pl.shotgunReload2_Duration = 21.0f/50.0f; - pl.shotgunReload3_seq = weaponseq_benellim3::reload3; - pl.shotgunReload3_Duration = 26.0f/30.0f; + pl.iShotgunExtraDataID = SHOTGUN_EXTRA_ID::BENELLIM3; - - pl.shotgunReload2_ammoLoadDelay = 10.0f/50.0f; - - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::BenelliM3], arg_thisWeapon); + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::BENELLIM3], arg_thisWeapon); } @@ -170,7 +141,7 @@ w_benellim3_primary(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - if(!weapon_shotgun_onInterrupt(pl, ary_weaponData[WEAPON_ID::BenelliM3], arg_thisWeapon)){ + if(!weapon_shotgun_onInterrupt(pl, ary_weaponData[WEAPON_ID::BENELLIM3], arg_thisWeapon)){ // no reload to interrupt? ok. }else{ // reload to interrupt? stop this. @@ -194,8 +165,9 @@ w_benellim3_primary(void) // pump instead! pl.shotgunWaitingForPump = FALSE; - TS_Weapons_PlaySoundChannelDirect(pl, "weapons/m3/m3-pump.wav", CHAN_AUTO); - + //SoundPitched_Channel_Send(pl, SNDP_BENELLIM3_PUMP, CHAN_AUTO); + TS_Weapons_PlaySoundChannelDirect(pl, "weapons/m3/m3-pump.wav", CHAN_AUTO); + // these pumps eject shells #ifdef CLIENT View_AddEvent(w_ejectshell_pistol, 0.0f); @@ -224,7 +196,7 @@ w_benellim3_primary(void) } // TS_Weapons_PlaySoundDirect(pl, "weapons/m3/m3-fire.wav"); - SoundPitched_Send(pl, SNDP_M3_FIRE); + SoundPitched_Send(pl, SNDP_BENELLIM3_FIRE); if(arg_thisWeapon.iFireMode == BITS_FIREMODE_PUMP){ TS_Weapons_ViewAnimation(weaponseq_benellim3::shootpump, (31.0f/35.0f) ); @@ -242,7 +214,7 @@ w_benellim3_primary(void) #endif } - weapon_base_onAttack_multi(pl, ary_weaponData[WEAPON_ID::BenelliM3], arg_thisWeapon, 8, BITS_AKIMBOCHOICE_LEFT); + weapon_base_onAttack_multi(pl, ary_weaponData[WEAPON_ID::BENELLIM3], arg_thisWeapon, 8, BITS_AKIMBOCHOICE_LEFT); if(arg_thisWeapon.iFireMode == BITS_FIREMODE_PUMP){ // use the TS stats for delay. @@ -300,17 +272,14 @@ w_benellim3_secondary(void) } } - void w_benellim3_reload(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_shotgun_reload(pl, ary_weaponData[WEAPON_ID::BenelliM3], arg_thisWeapon); + weapon_shotgun_reload(pl, ary_weaponData[WEAPON_ID::BENELLIM3], arg_thisWeapon); } - -// ??? float w_benellim3_aimanim(void) { @@ -322,12 +291,10 @@ w_benellim3_hud(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::BenelliM3], arg_thisWeapon); + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::BENELLIM3], arg_thisWeapon); } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_benellim3_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_beretta.qc b/src/shared/weapons/weapon_beretta.qc index 92ea130..5455f61 100644 --- a/src/shared/weapons/weapon_beretta.qc +++ b/src/shared/weapons/weapon_beretta.qc @@ -1,5 +1,4 @@ - enum weaponseq_beretta{ idle, shoot, @@ -9,61 +8,37 @@ enum weaponseq_beretta{ reload }; - - -BOOLEAN weapon_Beretta_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; +void weapon_beretta_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_Beretta_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_Beretta_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_Beretta_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} - -void weapon_Beretta_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_Beretta_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_Beretta_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Beretta], arg_thisWeapon); -} -void weapon_Beretta_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_Beretta_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_Beretta_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_beretta_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ } +void weapon_beretta_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::BERETTA], arg_thisWeapon); +} +void weapon_beretta_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ + +} -weapondata_gun_t weapon_Beretta = +weapondata_gun_t weapon_beretta = { WEAPONDATA_TYPEID_GUN, - "Beretta", + "beretta", "models/v_beretta.mdl", "models/p_beretta.mdl", "models/p_beretta_sil.mdl", "models/w_berettas.mdl", "sprites/weapons/beretta.spr", - weapon_Beretta_onPrimaryAttack, - weapon_Beretta_onPrimaryAttackRelease, - weapon_Beretta_onSecondaryAttack, - weapon_Beretta_onSecondaryAttackRelease, - weapon_Beretta_onEquip, - weapon_Beretta_onUnEquip, - weapon_Beretta_onThink, - weapon_Beretta_onDrawHUD, - weapon_Beretta_onReload, - weapon_Beretta_onColdCock, + weapon_beretta_onPrimaryAttackRelease, + weapon_beretta_onSecondaryAttackRelease, + weapon_beretta_onThink, + weapon_beretta_onColdCock, weaponseq_beretta::idle, weaponseq_beretta::draw, 31.0f / 30.0f, - 0.19f, //fire delay. this is most certainly wrong. find something more accurate later. + 0.19f, //fire delay 15.0f, //dmg TRUE, BITS_WEAPONOPT_SILENCER | BITS_WEAPONOPT_LASERSIGHT | BITS_WEAPONOPT_FLASHLIGHT | BITS_WEAPONOPT_AKIMBO, @@ -73,10 +48,10 @@ weapondata_gun_t weapon_Beretta = BUYCATEGORY_HANDGUNS, 2, {0.018000, 1.300000, 0.000000}, //ESTIMATE, from how a lot of other stuff went from akimbo -> singular. - WEAPON_AKIMBO_UPGRADE_ID::Beretta, + WEAPON_AKIMBO_UPGRADE_ID::BERETTA, BITS_FIREMODE_SEMI, BITS_FIREMODE_SEMI, - AMMO_ID::_9x19mm, + AMMO_ID::_9X19MM, 15, //clip 4096, //range weaponseq_beretta::reload, @@ -89,40 +64,30 @@ weapondata_gun_t weapon_Beretta = - - - - - - - void w_beretta_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::BERETTA]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + //precache_sound("weapons/beretta/clipin.wav"); + //precache_sound("weapons/beretta/clipout.wav"); + precache_sound("weapons/beretta/fire-sil.wav"); + precache_sound("weapons/beretta/fire.wav"); + //precache_sound("weapons/beretta/sliderelease.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_beretta_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string w_beretta_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::Beretta]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::BERETTA]).sWorldModelPath; } string @@ -132,9 +97,9 @@ w_beretta_pmodel(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - return (*ary_weaponData[WEAPON_ID::Beretta]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::BERETTA]).sPlayerModelPath; } else { - return (*ary_weaponData[WEAPON_ID::Beretta]).sPlayerSilencerModelPath; + return (*ary_weaponData[WEAPON_ID::BERETTA]).sPlayerSilencerModelPath; } } @@ -149,7 +114,7 @@ w_beretta_draw(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapondata_basic_t* basicP = ary_weaponData[WEAPON_ID::Beretta]; + weapondata_basic_t* basicP = ary_weaponData[WEAPON_ID::BERETTA]; weapon_base_onEquip(pl, basicP, arg_thisWeapon); } @@ -183,9 +148,9 @@ w_beretta_primary(void) if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - SoundPitched_Send(pl, SNDP_BERETTA); + SoundPitched_Send(pl, SNDP_BERETTA_FIRE); } else { - SoundPitched_Send(pl, SNDP_BERETTA_SIL); + SoundPitched_Send(pl, SNDP_BERETTA_FIRE_SIL); } @@ -209,7 +174,7 @@ w_beretta_primary(void) #endif - weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::Beretta], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); + weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::BERETTA], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[arg_thisWeapon.weaponID]).fAttackDelay); @@ -228,39 +193,29 @@ w_beretta_secondary(void) { } - - void w_beretta_reload(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Beretta], arg_thisWeapon); + weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::BERETTA], arg_thisWeapon); } - - -// ??? float w_beretta_aimanim(void) { return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND; } - void w_beretta_hud(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Beretta], arg_thisWeapon); + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::BERETTA], arg_thisWeapon); } - - -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_beretta_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_beretta_akimbo.qc b/src/shared/weapons/weapon_beretta_akimbo.qc index 1577090..cc29da6 100644 --- a/src/shared/weapons/weapon_beretta_akimbo.qc +++ b/src/shared/weapons/weapon_beretta_akimbo.qc @@ -1,7 +1,5 @@ - enum weaponseq_beretta_akimbo{ - //... idle_1, reload, draw, @@ -39,36 +37,20 @@ enum weaponseq_beretta_akimbo{ }; - -BOOLEAN weapon_Beretta_akimbo_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ +void weapon_beretta_akimbo_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_Beretta_akimbo_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_beretta_akimbo_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_Beretta_akimbo_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_beretta_akimbo_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::BERETTA_AKIMBO], arg_thisWeapon); } -BOOLEAN weapon_Beretta_akimbo_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -void weapon_Beretta_akimbo_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_Beretta_akimbo_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_Beretta_akimbo_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Beretta_akimbo], arg_thisWeapon); -} -void weapon_Beretta_akimbo_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_Beretta_akimbo_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_Beretta_akimbo_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_beretta_akimbo_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ } - -weapondata_gun_t weapon_Beretta_akimbo = +weapondata_gun_t weapon_beretta_akimbo = { WEAPONDATA_TYPEID_GUN, "Akimbo Berettas", @@ -77,20 +59,14 @@ weapondata_gun_t weapon_Beretta_akimbo = "models/p_berettas_sil.mdl", "models/w_berettas.mdl", "sprites/weapons/berettas.spr", - weapon_Beretta_akimbo_onPrimaryAttack, - weapon_Beretta_akimbo_onPrimaryAttackRelease, - weapon_Beretta_akimbo_onSecondaryAttack, - weapon_Beretta_akimbo_onSecondaryAttackRelease, - weapon_Beretta_akimbo_onEquip, - weapon_Beretta_akimbo_onUnEquip, - weapon_Beretta_akimbo_onThink, - weapon_Beretta_akimbo_onDrawHUD, - weapon_Beretta_akimbo_onReload, - weapon_Beretta_akimbo_onColdCock, + weapon_beretta_akimbo_onPrimaryAttackRelease, + weapon_beretta_akimbo_onSecondaryAttackRelease, + weapon_beretta_akimbo_onThink, + weapon_beretta_akimbo_onColdCock, weaponseq_beretta_akimbo::idle_1, weaponseq_beretta_akimbo::draw, 41.0f / 55.0f, - 0.19f, //fire delay. this is most certainly wrong. find something more accurate later. + 0.19f, //fire delay 15.0f, //dmg TRUE, BITS_WEAPONOPT_SILENCER | BITS_WEAPONOPT_LASERSIGHT | BITS_WEAPONOPT_FLASHLIGHT | BITS_WEAPONOPT_AKIMBO, @@ -100,10 +76,10 @@ weapondata_gun_t weapon_Beretta_akimbo = BUYCATEGORY_HANDGUNS, 5, {0.028000, 1.500000, 0.000000}, - -WEAPON_ID::Beretta, + -WEAPON_ID::BERETTA, BITS_FIREMODE_AKIMBO_SEMI_AUTO | BITS_FIREMODE_AKIMBO_FREE_SEMI, BITS_FIREMODE_AKIMBO_SEMI_AUTO, - AMMO_ID::_9x19mm, + AMMO_ID::_9X19MM, 15, //clip 4096, //range weaponseq_beretta_akimbo::reload, @@ -119,30 +95,23 @@ weapondata_gun_t weapon_Beretta_akimbo = void w_beretta_akimbo_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::BERETTA_AKIMBO]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + // assume the singular variant has handled sounds. #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_beretta_akimbo_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string w_beretta_akimbo_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::Beretta_akimbo]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::BERETTA_AKIMBO]).sWorldModelPath; } string @@ -152,9 +121,9 @@ w_beretta_akimbo_pmodel(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - return (*ary_weaponData[WEAPON_ID::Beretta_akimbo]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::BERETTA_AKIMBO]).sPlayerModelPath; } else { - return (*ary_weaponData[WEAPON_ID::Beretta_akimbo]).sPlayerSilencerModelPath; + return (*ary_weaponData[WEAPON_ID::BERETTA_AKIMBO]).sPlayerSilencerModelPath; } } @@ -169,7 +138,7 @@ w_beretta_akimbo_draw(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::Beretta_akimbo], arg_thisWeapon); + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::BERETTA_AKIMBO], arg_thisWeapon); } void @@ -184,9 +153,8 @@ w_beretta_akimbo_holster(void) // Akimbo weapons consistently. // Putting it here avoids duplicating a bunch of code. // Also, "attackTypeUsed" is whether primary (FALSE) or secondary (TRUE) lead to this point. -BOOLEAN weapon_Beretta_akimbo_attack(player localPlayer, weapondynamic_t arg_thisWeapon, int attackTypeUsed){ +BOOLEAN weapon_beretta_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, int attackTypeUsed){ float randomChoice; - player pl = localPlayer; //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; //special case @@ -200,7 +168,7 @@ BOOLEAN weapon_Beretta_akimbo_attack(player localPlayer, weapondynamic_t arg_thi // Muzzle flashes and shell ejections for akimbo pending! // because I am not copy/pasting this monstrosity 5 times. - finalAkimboChoice = weapon_akimbo_semiAttackChoice(localPlayer, ary_weaponData[WEAPON_ID::Beretta_akimbo], arg_thisWeapon, attackTypeUsed); + finalAkimboChoice = weapon_akimbo_semiAttackChoice(pl, ary_weaponData[WEAPON_ID::BERETTA_AKIMBO], arg_thisWeapon, attackTypeUsed); #ifdef CLIENT SAVE_STATE(pl.nextAkimboAttackPreference); @@ -237,21 +205,21 @@ BOOLEAN weapon_Beretta_akimbo_attack(player localPlayer, weapondynamic_t arg_thi // sudden dual-fire request though. int effectiveAkimboChoice = finalAkimboChoice & ~pl.akimboTest; //finalAkimboChoice;//BITS_AKIMBOCHOICE_NONE & ~pl.akimboTest - weapon_base_onAttack(localPlayer, ary_weaponData[WEAPON_ID::Beretta_akimbo], arg_thisWeapon, effectiveAkimboChoice); + weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::BERETTA_AKIMBO], arg_thisWeapon, effectiveAkimboChoice); if(effectiveAkimboChoice & BITS_AKIMBOCHOICE_LEFT){ if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - SoundPitched_Send(pl, SNDP_BERETTA); + SoundPitched_Send(pl, SNDP_BERETTA_FIRE); } else { - SoundPitched_Send(pl, SNDP_BERETTA_SIL); + SoundPitched_Send(pl, SNDP_BERETTA_FIRE_SIL); } } if(effectiveAkimboChoice & BITS_AKIMBOCHOICE_RIGHT){ if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - SoundPitched_Send(pl, SNDP_BERETTA); + SoundPitched_Send(pl, SNDP_BERETTA_FIRE); } else { - SoundPitched_Send(pl, SNDP_BERETTA_SIL); + SoundPitched_Send(pl, SNDP_BERETTA_FIRE_SIL); } } @@ -346,7 +314,7 @@ BOOLEAN weapon_Beretta_akimbo_attack(player localPlayer, weapondynamic_t arg_thi } return TRUE; -}//END OF weapon_Beretta_akimbo_attack +}//END OF weapon_beretta_akimbo_attack void @@ -360,15 +328,15 @@ w_beretta_akimbo_primary(void) // in addition to the primary input, which lead to '_primary' being called at all. if(input_buttons & INPUT_BUTTON3){ - if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_BOTH, &weapon_Beretta_akimbo_attack)){ + if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_BOTH, &weapon_beretta_akimbo_attack)){ // nothing unusual here. pl.akimboTest = 0; - weapon_Beretta_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_BOTH); + weapon_beretta_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_BOTH); }else{ } }else{ - if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT, &weapon_Beretta_akimbo_attack)){ - weapon_Beretta_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); + if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT, &weapon_beretta_akimbo_attack)){ + weapon_beretta_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); pl.akimboFirePrev = BITS_AKIMBOCHOICE_LEFT; } @@ -393,55 +361,48 @@ w_beretta_akimbo_secondary(void) }else{ // fires the right weapon always - //weapon_Beretta_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT); + //weapon_beretta_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT); //return; - if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT, &weapon_Beretta_akimbo_attack)){ - weapon_Beretta_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT); + if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT, &weapon_beretta_akimbo_attack)){ + weapon_beretta_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT); pl.akimboFirePrev = BITS_AKIMBOCHOICE_RIGHT; } } } - void w_beretta_akimbo_reload(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Beretta_akimbo], arg_thisWeapon); + weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::BERETTA_AKIMBO], arg_thisWeapon); leftCount = 0; rightCount = 0; } -// ??? float w_beretta_akimbo_aimanim(void) { return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND; } - void w_beretta_akimbo_hud(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Beretta_akimbo], arg_thisWeapon); + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::BERETTA_AKIMBO], arg_thisWeapon); } - -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_beretta_akimbo_hudpic(int selected, vector pos, float a) { // } - weapon_t w_beretta_akimbo = { diff --git a/src/shared/weapons/weapon_combatknife.qc b/src/shared/weapons/weapon_combatknife.qc index 5f83b0e..219c515 100644 --- a/src/shared/weapons/weapon_combatknife.qc +++ b/src/shared/weapons/weapon_combatknife.qc @@ -1,65 +1,33 @@ -//TAGGG - TODO (same for seal knife): spark-effect on bouncing off something and hitting something? +//TAGGG - TODO (same for seal knife): spark-effect on bouncing off something and hitting something +// (only if non-organic, i.e. not a player, probably)? // That would be for the resulting throwable object. // Although same effect for any melee hits with knives and the katana too I think. - -/* -Combat Knife -100 Credits -1 Slots -BuyOpts: Full Load (5 knives) -MELEE, THROWABLE -*/ - - enum weaponseq_combatknife{ idle, - idle2, // ??? why? identical. + idle2, // why? identical. draw, slash1, left, right, - hold // ??? WHERE WOULD WE USE THIS? Is there any way to block with melee besides "R" in karate? + hold // WHERE WOULD WE USE THIS? Is there any way to block with melee besides "R" in karate? }; - - -BOOLEAN weapon_CombatKnife_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; -}//END OF onPrimaryAttack - - -BOOLEAN weapon_CombatKnife_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} - - -BOOLEAN weapon_CombatKnife_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; -} -BOOLEAN weapon_CombatKnife_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -void weapon_CombatKnife_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_CombatKnife_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_CombatKnife_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - -} -void weapon_CombatKnife_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_CombatKnife_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ - -} -void weapon_CombatKnife_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ - -} - +void weapon_combatknife_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ -weapondata_throwable_t weapon_CombatKnife = +} +void weapon_combatknife_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + +} +void weapon_combatknife_onThink(player pl, weapondynamic_t arg_thisWeapon){ + +} +void weapon_combatknife_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ + +} + +weapondata_throwable_t weapon_combatknife = { WEAPONDATA_TYPEID_THROWABLE, "Combat Knife", @@ -68,16 +36,10 @@ weapondata_throwable_t weapon_CombatKnife = "", "models/w_knife.mdl", "sprites/weapons/knife.spr", - weapon_CombatKnife_onPrimaryAttack, - weapon_CombatKnife_onPrimaryAttackRelease, - weapon_CombatKnife_onSecondaryAttack, - weapon_CombatKnife_onSecondaryAttackRelease, - weapon_CombatKnife_onEquip, - weapon_CombatKnife_onUnEquip, - weapon_CombatKnife_onThink, - weapon_CombatKnife_onDrawHUD, - weapon_CombatKnife_onReload, - weapon_CombatKnife_onColdCock, + weapon_combatknife_onPrimaryAttackRelease, + weapon_combatknife_onSecondaryAttackRelease, + weapon_combatknife_onThink, + weapon_combatknife_onColdCock, weaponseq_combatknife::idle, weaponseq_combatknife::draw, 31.0f / 30.0f, @@ -101,24 +63,16 @@ weapondata_throwable_t weapon_CombatKnife = - - -// TODO!!! Put things relevant the TS glock here, not HL glock -// Same for the actual sounds to be used, hardcode or put in file formats.. uhhh whatever. -// Also, different sounds are used than here + precached in /client/precache.qc already, -// and so are pmodels/vmodels/wmodels. void w_combatknife_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::COMBATKNIFE]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + precache_sound("weapons/knife/knife_hit.wav"); + precache_sound("weapons/knife/knife_hitbody.wav"); + precache_sound("weapons/knife/knife_miss.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } @@ -131,13 +85,13 @@ w_combatknife_updateammo(player pl) string w_combatknife_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::CombatKnife]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::COMBATKNIFE]).sWorldModelPath; } string w_combatknife_pmodel(void) { - return (*ary_weaponData[WEAPON_ID::CombatKnife]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::COMBATKNIFE]).sPlayerModelPath; } string @@ -152,7 +106,7 @@ w_combatknife_draw(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::CombatKnife], arg_thisWeapon); + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::COMBATKNIFE], arg_thisWeapon); } void @@ -173,19 +127,19 @@ w_combatknife_primary(void) INPUT_PRIMARY_TAP_GATE - weapondata_basic_t baseRef = *ary_weaponData[WEAPON_ID::CombatKnife]; - MELEE_HIT_RESPONSE theReaper = weapon_base_onPrimaryAttack_melee(pl, ary_weaponData[WEAPON_ID::CombatKnife], arg_thisWeapon, baseRef.fAttackDamage, 58); + weapondata_basic_t baseRef = *ary_weaponData[WEAPON_ID::COMBATKNIFE]; + MELEE_HIT_RESPONSE hitRep = weapon_base_onPrimaryAttack_melee(pl, ary_weaponData[WEAPON_ID::COMBATKNIFE], arg_thisWeapon, baseRef.fAttackDamage, 58); // Only the server is doing traces so far to get results for this to be worth checking. #ifdef SERVER - //printfline("melee hit reponse: %d soft? %d", theReaper, (theReaper==MELEE_HIT_RESPONSE::SOFT)); - if (theReaper == MELEE_HIT_RESPONSE::NONE ) { + //printfline("melee hit reponse: %d soft? %d", hitRep, (hitRep==MELEE_HIT_RESPONSE::SOFT)); + if (hitRep == MELEE_HIT_RESPONSE::NONE ) { TS_Weapons_PlaySoundDirect(pl, "weapons/knife/knife_miss.wav"); - }else if(theReaper == MELEE_HIT_RESPONSE::SOFT){ + }else if(hitRep == MELEE_HIT_RESPONSE::SOFT){ //nothin - }else if(theReaper == MELEE_HIT_RESPONSE::METAL){ + }else if(hitRep == MELEE_HIT_RESPONSE::METAL){ TS_Weapons_PlaySoundDirect(pl, "weapons/knife/knife_hit.wav"); - }else if(theReaper == MELEE_HIT_RESPONSE::FLESH){ + }else if(hitRep == MELEE_HIT_RESPONSE::FLESH){ arg_thisWeapon.forceBodygroup1Submodel = 2; TS_Weapons_PlaySoundDirect(pl, "weapons/knife/knife_hitbody.wav"); } @@ -221,7 +175,7 @@ w_combatknife_secondary(void) INPUT_SECONDARY_TAP_GATE - weapondata_basic_t baseRef = *ary_weaponData[WEAPON_ID::CombatKnife]; + weapondata_basic_t baseRef = *ary_weaponData[WEAPON_ID::COMBATKNIFE]; weapon_base_setWholeAttackDelay(pl, baseRef.fAttackDelay); if(arg_thisWeapon.iCount > 0){ @@ -257,41 +211,33 @@ w_combatknife_secondary(void) } - void w_combatknife_reload(void) { // how do you reload a sword } - -// ??? float w_combatknife_aimanim(void) { return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND; } - void w_combatknife_hud(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_throwable_onDrawHUD(pl, (weapondata_throwable_t*)ary_weaponData[WEAPON_ID::CombatKnife], arg_thisWeapon); + weapon_throwable_onDrawHUD(pl, (weapondata_throwable_t*)ary_weaponData[WEAPON_ID::COMBATKNIFE], arg_thisWeapon); } - -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_combatknife_hudpic(int selected, vector pos, float a) { // } - weapon_t w_combatknife = { diff --git a/src/shared/weapons/weapon_contenderg2.qc b/src/shared/weapons/weapon_contenderg2.qc index 5012e27..4b3d11a 100644 --- a/src/shared/weapons/weapon_contenderg2.qc +++ b/src/shared/weapons/weapon_contenderg2.qc @@ -1,6 +1,5 @@ //TODO - is "stock" a melee attack?? - enum weaponseq_contenderg2{ idle, draw, @@ -10,38 +9,19 @@ enum weaponseq_contenderg2{ stock }; - -BOOLEAN weapon_ContenderG2_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; -} -BOOLEAN weapon_ContenderG2_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_ContenderG2_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_ContenderG2_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -void weapon_ContenderG2_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_ContenderG2_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_ContenderG2_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::ContenderG2], arg_thisWeapon); -} -void weapon_ContenderG2_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_ContenderG2_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_ContenderG2_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ -} - - +void weapon_contenderg2_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ -//weapondata_ironsight_t weapon_ContenderG2 = -weapondata_gun_t weapon_ContenderG2 = +} +void weapon_contenderg2_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + +} +void weapon_contenderg2_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::CONTENDERG2], arg_thisWeapon); +} +void weapon_contenderg2_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ +} + +weapondata_gun_t weapon_contenderg2 = { WEAPONDATA_TYPEID_GUN, "Contender G2", @@ -50,20 +30,14 @@ weapondata_gun_t weapon_ContenderG2 = "", "models/w_contender.mdl", "sprites/weapons/contender.spr", - weapon_ContenderG2_onPrimaryAttack, - weapon_ContenderG2_onPrimaryAttackRelease, - weapon_ContenderG2_onSecondaryAttack, - weapon_ContenderG2_onSecondaryAttackRelease, - weapon_ContenderG2_onEquip, - weapon_ContenderG2_onUnEquip, - weapon_ContenderG2_onThink, - weapon_ContenderG2_onDrawHUD, - weapon_ContenderG2_onReload, - weapon_ContenderG2_onColdCock, + weapon_contenderg2_onPrimaryAttackRelease, + weapon_contenderg2_onSecondaryAttackRelease, + weapon_contenderg2_onThink, + weapon_contenderg2_onColdCock, weaponseq_contenderg2::idle, weaponseq_contenderg2::draw, 31.0f / 30.0f, - 0.35f, //fire delay. this is most certainly wrong. find something more accurate later. + 0.35f, //fire delay 60.0f, TRUE, BITS_WEAPONOPT_LASERSIGHT | BITS_WEAPONOPT_SCOPE, @@ -79,7 +53,7 @@ weapondata_gun_t weapon_ContenderG2 = BITS_FIREMODE_SEMI, BITS_FIREMODE_SEMI, - AMMO_ID::_7p62x51mm, + AMMO_ID::_7P62X51MM, 1, 4096, @@ -90,52 +64,35 @@ weapondata_gun_t weapon_ContenderG2 = -1, 2 - /* - //ironsightdata_t - { - weaponseq_contenderg2::change, - 21.0f / 35.0f, - weaponseq_contenderg2::rechange, - 21.0f / 35.0f, - weaponseq_contenderg2::idle, - weaponseq_contenderg2::reload, - 61.0f / 30.0f, - //can have different firestats from ordinary firing. Dbn't know yet though. - {0.010000, 8.000000, 0.000000} - } - */ }; - void w_contenderg2_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::CONTENDERG2]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + //precache_sound("weapons/contender/close.wav"); + precache_sound("weapons/contender/fire.wav"); + //precache_sound("weapons/contender/hammerback.wav"); + //precache_sound("weapons/contender/insert-shell.wav"); + //precache_sound("weapons/contender/open.wav"); + //precache_sound("weapons/contender/shellout.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_contenderg2_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string w_contenderg2_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::ContenderG2]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::CONTENDERG2]).sWorldModelPath; } string @@ -143,7 +100,7 @@ w_contenderg2_pmodel(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - return (*ary_weaponData[WEAPON_ID::ContenderG2]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::CONTENDERG2]).sPlayerModelPath; } string @@ -157,7 +114,7 @@ w_contenderg2_draw(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::ContenderG2], arg_thisWeapon); + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::CONTENDERG2], arg_thisWeapon); } void @@ -171,7 +128,7 @@ w_contenderg2_primary(void) float randomChoice; player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - + if (pl.w_attack_next > 0.0) { return; } @@ -185,7 +142,7 @@ w_contenderg2_primary(void) return; } - TS_Weapons_PlaySoundDirect(pl, "weapons/contender/fire.wav"); + SoundPitched_Send(pl, SNDP_CONTENDERG2_FIRE); if ( random() <= 0.5 ) { TS_Weapons_ViewAnimation(weaponseq_contenderg2::shoot1, 31.0f/30.0f); @@ -198,7 +155,7 @@ w_contenderg2_primary(void) View_AddEvent(w_ejectshell_pistol, 0.0f); #endif - weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::ContenderG2], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); + weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::CONTENDERG2], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[arg_thisWeapon.weaponID]).fAttackDelay); @@ -243,18 +200,15 @@ w_contenderg2_secondary(void) } - void w_contenderg2_reload(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::ContenderG2], arg_thisWeapon); + weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::CONTENDERG2], arg_thisWeapon); } - -// ??? float w_contenderg2_aimanim(void) { @@ -267,12 +221,9 @@ w_contenderg2_hud(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::ContenderG2], arg_thisWeapon); - + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::CONTENDERG2], arg_thisWeapon); } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_contenderg2_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_deserteagle.qc b/src/shared/weapons/weapon_deserteagle.qc index 4551cf3..65e0984 100644 --- a/src/shared/weapons/weapon_deserteagle.qc +++ b/src/shared/weapons/weapon_deserteagle.qc @@ -14,40 +14,20 @@ enum weaponseq_deserteagle{ reloadb = 11 }; - - -BOOLEAN weapon_DesertEagle_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; +void weapon_deserteagle_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_DesertEagle_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_deserteagle_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_DesertEagle_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_deserteagle_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::DESERTEAGLE], arg_thisWeapon); } -BOOLEAN weapon_DesertEagle_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -void weapon_DesertEagle_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_base_onEquip(localPlayer, ary_weaponData[WEAPON_ID::DesertEagle], arg_thisWeapon); -} -BOOLEAN weapon_DesertEagle_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_DesertEagle_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::DesertEagle], arg_thisWeapon); -} -void weapon_DesertEagle_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onDrawHUD(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::DesertEagle], arg_thisWeapon); -} -void weapon_DesertEagle_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_DesertEagle_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_deserteagle_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ } - -weapondata_ironsight_t weapon_DesertEagle = +weapondata_ironsight_t weapon_deserteagle = { WEAPONDATA_TYPEID_IRONSIGHT, "Desert Eagle", @@ -56,20 +36,14 @@ weapondata_ironsight_t weapon_DesertEagle = "models/p_desert.mdl", "models/w_desert.mdl", "sprites/weapons/desert.spr", - weapon_DesertEagle_onPrimaryAttack, - weapon_DesertEagle_onPrimaryAttackRelease, - weapon_DesertEagle_onSecondaryAttack, - weapon_DesertEagle_onSecondaryAttackRelease, - weapon_DesertEagle_onEquip, - weapon_DesertEagle_onUnEquip, - weapon_DesertEagle_onThink, - weapon_DesertEagle_onDrawHUD, - weapon_DesertEagle_onReload, - weapon_DesertEagle_onColdCock, + weapon_deserteagle_onPrimaryAttackRelease, + weapon_deserteagle_onSecondaryAttackRelease, + weapon_deserteagle_onThink, + weapon_deserteagle_onColdCock, weaponseq_deserteagle::idle, weaponseq_deserteagle::draw, 31.0f / 50.0f, - 0.35f, //fire delay. this is most certainly wrong. find something more accurate later. + 0.35f, //fire delay 27.0f, TRUE, BITS_WEAPONOPT_SILENCER | BITS_WEAPONOPT_LASERSIGHT | BITS_WEAPONOPT_SCOPE, @@ -82,7 +56,7 @@ weapondata_ironsight_t weapon_DesertEagle = WEAPON_AKIMBO_UPGRADE_ID::NONE, BITS_FIREMODE_SEMI, BITS_FIREMODE_SEMI, - AMMO_ID::_p50AE, + AMMO_ID::_P50AE, 7, 4096, weaponseq_deserteagle::reload, @@ -108,24 +82,21 @@ weapondata_ironsight_t weapon_DesertEagle = - - void w_deserteagle_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::DESERTEAGLE]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + //precache_sound("weapons/deagle/clipin.wav"); + //precache_sound("weapons/deagle/clipout.wav"); + precache_sound("weapons/deagle/fire-sil.wav"); + precache_sound("weapons/deagle/fire.wav"); + //precache_sound("weapons/deagle/slideback.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_deserteagle_updateammo(player pl) { @@ -136,7 +107,7 @@ w_deserteagle_updateammo(player pl) string w_deserteagle_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::DesertEagle]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::DESERTEAGLE]).sWorldModelPath; } string @@ -146,9 +117,9 @@ w_deserteagle_pmodel(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - return (*ary_weaponData[WEAPON_ID::DesertEagle]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::DESERTEAGLE]).sPlayerModelPath; } else { - return (*ary_weaponData[WEAPON_ID::DesertEagle]).sPlayerSilencerModelPath; + return (*ary_weaponData[WEAPON_ID::DESERTEAGLE]).sPlayerSilencerModelPath; } } @@ -163,7 +134,7 @@ w_deserteagle_draw(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapondata_basic_t* basicP = ary_weaponData[WEAPON_ID::DesertEagle]; + weapondata_basic_t* basicP = ary_weaponData[WEAPON_ID::DESERTEAGLE]; weapon_base_onEquip(pl, basicP, arg_thisWeapon); } @@ -196,9 +167,9 @@ w_deserteagle_primary(void) if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - TS_Weapons_PlaySoundDirect(pl, "weapons/deagle/fire.wav"); + SoundPitched_Send(pl, SNDP_DESERTEAGLE_FIRE); } else { - TS_Weapons_PlaySoundDirect(pl, "weapons/deagle/fire-sil.wav"); + SoundPitched_Send(pl, SNDP_DESERTEAGLE_FIRE_SIL); } @@ -227,7 +198,7 @@ w_deserteagle_primary(void) View_AddEvent(w_ejectshell_pistol, 0.0f); #endif - weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::DesertEagle], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); + weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::DESERTEAGLE], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[arg_thisWeapon.weaponID]).fAttackDelay); @@ -270,7 +241,7 @@ w_deserteagle_secondary(void) }else{ // no scope? we use ironsights then. - weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::DesertEagle], arg_thisWeapon); + weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::DESERTEAGLE], arg_thisWeapon); } } @@ -280,10 +251,9 @@ w_deserteagle_reload(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_ironsight_Reload(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::DesertEagle], arg_thisWeapon); + weapon_ironsight_Reload(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::DESERTEAGLE], arg_thisWeapon); } -// ??? float w_deserteagle_aimanim(void) { @@ -295,20 +265,15 @@ w_deserteagle_hud(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::DesertEagle], arg_thisWeapon); + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::DESERTEAGLE], arg_thisWeapon); } - - -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_deserteagle_hudpic(int selected, vector pos, float a) { // } - weapon_t w_deserteagle = { diff --git a/src/shared/weapons/weapon_fiveseven.qc b/src/shared/weapons/weapon_fiveseven.qc index cac5784..7758712 100644 --- a/src/shared/weapons/weapon_fiveseven.qc +++ b/src/shared/weapons/weapon_fiveseven.qc @@ -1,5 +1,4 @@ - enum weaponseq_fiveseven{ idle = 0, reload = 1, @@ -8,39 +7,20 @@ enum weaponseq_fiveseven{ shootlast = 4 }; - - -BOOLEAN weapon_FiveSeven_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; +void weapon_fiveseven_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_FiveSeven_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_fiveseven_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_FiveSeven_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_fiveseven_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::FIVESEVEN], arg_thisWeapon); } -BOOLEAN weapon_FiveSeven_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} - -void weapon_FiveSeven_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_FiveSeven_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_FiveSeven_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::FiveSeven], arg_thisWeapon); -} -void weapon_FiveSeven_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_FiveSeven_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_FiveSeven_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_fiveseven_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ } - -weapondata_gun_t weapon_FiveSeven = +weapondata_gun_t weapon_fiveseven = { WEAPONDATA_TYPEID_GUN, "Five-seveN", @@ -49,20 +29,14 @@ weapondata_gun_t weapon_FiveSeven = "models/p_fnh_sil.mdl", "models/w_fnh.mdl", "sprites/weapons/fnh.spr", - weapon_FiveSeven_onPrimaryAttack, - weapon_FiveSeven_onPrimaryAttackRelease, - weapon_FiveSeven_onSecondaryAttack, - weapon_FiveSeven_onSecondaryAttackRelease, - weapon_FiveSeven_onEquip, - weapon_FiveSeven_onUnEquip, - weapon_FiveSeven_onThink, - weapon_FiveSeven_onDrawHUD, - weapon_FiveSeven_onReload, - weapon_FiveSeven_onColdCock, + weapon_fiveseven_onPrimaryAttackRelease, + weapon_fiveseven_onSecondaryAttackRelease, + weapon_fiveseven_onThink, + weapon_fiveseven_onColdCock, weaponseq_fiveseven::idle, weaponseq_fiveseven::draw, 31.0f / 30.0f, - 0.19f, //fire delay. this is most certainly wrong. find something more accurate later. + 0.19f, //fire delay 15.0f, //dmg TRUE, BITS_WEAPONOPT_SILENCER | BITS_WEAPONOPT_LASERSIGHT | BITS_WEAPONOPT_FLASHLIGHT | BITS_WEAPONOPT_AKIMBO, @@ -72,10 +46,10 @@ weapondata_gun_t weapon_FiveSeven = BUYCATEGORY_HANDGUNS, 2, {0.010000, 1.300000, 0.000000}, - WEAPON_AKIMBO_UPGRADE_ID::FiveSeven, + WEAPON_AKIMBO_UPGRADE_ID::FIVESEVEN, BITS_FIREMODE_SEMI, BITS_FIREMODE_SEMI, - AMMO_ID::_5p7x28, + AMMO_ID::_5P7X28, 20, //clip 4096, //range weaponseq_fiveseven::reload, @@ -92,30 +66,27 @@ weapondata_gun_t weapon_FiveSeven = void w_fiveseven_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::FIVESEVEN]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + //precache_sound("weapons/fnh/clipin.wav"); + //precache_sound("weapons/fnh/clipout.wav"); + precache_sound("weapons/fnh/fnh-fire-sil.wav"); + precache_sound("weapons/fnh/fnh-fire.wav"); + //precache_sound("weapons/fnh/sliderelease.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_fiveseven_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string w_fiveseven_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::FiveSeven]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::FIVESEVEN]).sWorldModelPath; } string @@ -125,9 +96,9 @@ w_fiveseven_pmodel(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - return (*ary_weaponData[WEAPON_ID::FiveSeven]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::FIVESEVEN]).sPlayerModelPath; } else { - return (*ary_weaponData[WEAPON_ID::FiveSeven]).sPlayerSilencerModelPath; + return (*ary_weaponData[WEAPON_ID::FIVESEVEN]).sPlayerSilencerModelPath; } } @@ -142,7 +113,7 @@ w_fiveseven_draw(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapondata_basic_t* basicP = ary_weaponData[WEAPON_ID::FiveSeven]; + weapondata_basic_t* basicP = ary_weaponData[WEAPON_ID::FIVESEVEN]; weapon_base_onEquip(pl, basicP, arg_thisWeapon); } @@ -174,9 +145,9 @@ w_fiveseven_primary(void) } if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - TS_Weapons_PlaySoundDirect(pl, "weapons/fnh/fnh-fire.wav"); + SoundPitched_Send(pl, SNDP_FIVESEVEN_FIRE); } else { - TS_Weapons_PlaySoundDirect(pl, "weapons/fnh/fnh-fire-sil.wav"); + SoundPitched_Send(pl, SNDP_FIVESEVEN_FIRE_SIL); } if(arg_thisWeapon.iClipLeft > 0){ @@ -192,7 +163,7 @@ w_fiveseven_primary(void) #endif - weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::FiveSeven], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); + weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::FIVESEVEN], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[arg_thisWeapon.weaponID]).fAttackDelay); @@ -204,25 +175,20 @@ w_fiveseven_primary(void) } - - void w_fiveseven_secondary(void) { } - - void w_fiveseven_reload(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::FiveSeven], arg_thisWeapon); + weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::FIVESEVEN], arg_thisWeapon); } -// ??? float w_fiveseven_aimanim(void) { @@ -234,11 +200,9 @@ w_fiveseven_hud(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::FiveSeven], arg_thisWeapon); + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::FIVESEVEN], arg_thisWeapon); } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_fiveseven_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_fiveseven_akimbo.qc b/src/shared/weapons/weapon_fiveseven_akimbo.qc index 9c47e27..22b8871 100644 --- a/src/shared/weapons/weapon_fiveseven_akimbo.qc +++ b/src/shared/weapons/weapon_fiveseven_akimbo.qc @@ -1,6 +1,5 @@ enum weaponseq_fiveseven_akimbo{ - //... idle = 0, draw = 1, shoot_left = 2, @@ -9,39 +8,20 @@ enum weaponseq_fiveseven_akimbo{ reload = 5 }; - - -BOOLEAN weapon_FiveSeven_akimbo_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; +void weapon_fiveseven_akimbo_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_FiveSeven_akimbo_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_fiveseven_akimbo_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_FiveSeven_akimbo_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_fiveseven_akimbo_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::FIVESEVEN_AKIMBO], arg_thisWeapon); } -BOOLEAN weapon_FiveSeven_akimbo_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -void weapon_FiveSeven_akimbo_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_FiveSeven_akimbo_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_FiveSeven_akimbo_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::FiveSeven_akimbo], arg_thisWeapon); -} -void weapon_FiveSeven_akimbo_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_FiveSeven_akimbo_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_FiveSeven_akimbo_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_fiveseven_akimbo_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ } - - -weapondata_gun_t weapon_FiveSeven_akimbo = +weapondata_gun_t weapon_fiveseven_akimbo = { WEAPONDATA_TYPEID_GUN, "Akimbo Five-seveN", //want "Akimbo SOCOM-MK23" but it takes up a bit too much space @@ -50,20 +30,14 @@ weapondata_gun_t weapon_FiveSeven_akimbo = "models/p_fnh_akimbo_sil.mdl", "models/w_fnh.mdl", "sprites/weapons/fnh_akimbo.spr", - weapon_FiveSeven_akimbo_onPrimaryAttack, - weapon_FiveSeven_akimbo_onPrimaryAttackRelease, - weapon_FiveSeven_akimbo_onSecondaryAttack, - weapon_FiveSeven_akimbo_onSecondaryAttackRelease, - weapon_FiveSeven_akimbo_onEquip, - weapon_FiveSeven_akimbo_onUnEquip, - weapon_FiveSeven_akimbo_onThink, - weapon_FiveSeven_akimbo_onDrawHUD, - weapon_FiveSeven_akimbo_onReload, - weapon_FiveSeven_akimbo_onColdCock, + weapon_fiveseven_akimbo_onPrimaryAttackRelease, + weapon_fiveseven_akimbo_onSecondaryAttackRelease, + weapon_fiveseven_akimbo_onThink, + weapon_fiveseven_akimbo_onColdCock, weaponseq_fiveseven_akimbo::idle, weaponseq_fiveseven_akimbo::draw, 31.0f / 40.0f, - 0.19f, //fire delay. this is most certainly wrong. find something more accurate later. + 0.19f, //fire delay 15.0f, //dmg TRUE, BITS_WEAPONOPT_SILENCER | BITS_WEAPONOPT_LASERSIGHT | BITS_WEAPONOPT_FLASHLIGHT | BITS_WEAPONOPT_AKIMBO, @@ -73,10 +47,10 @@ weapondata_gun_t weapon_FiveSeven_akimbo = BUYCATEGORY_HANDGUNS, 5, {0.020000, 1.500000, 0.000000}, - -WEAPON_ID::FiveSeven, + -WEAPON_ID::FIVESEVEN, BITS_FIREMODE_AKIMBO_SEMI_AUTO | BITS_FIREMODE_AKIMBO_FREE_SEMI, BITS_FIREMODE_AKIMBO_SEMI_AUTO, - AMMO_ID::_5p7x28, + AMMO_ID::_5P7X28, 20, //clip 4096, //range weaponseq_fiveseven_akimbo::reload, @@ -89,37 +63,26 @@ weapondata_gun_t weapon_FiveSeven_akimbo = - - - - void w_fiveseven_akimbo_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::FIVESEVEN_AKIMBO]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + // assume the singular variant has handled sounds. #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_fiveseven_akimbo_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string w_fiveseven_akimbo_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::FiveSeven_akimbo]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::FIVESEVEN_AKIMBO]).sWorldModelPath; } string @@ -129,9 +92,9 @@ w_fiveseven_akimbo_pmodel(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - return (*ary_weaponData[WEAPON_ID::FiveSeven_akimbo]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::FIVESEVEN_AKIMBO]).sPlayerModelPath; } else { - return (*ary_weaponData[WEAPON_ID::FiveSeven_akimbo]).sPlayerSilencerModelPath; + return (*ary_weaponData[WEAPON_ID::FIVESEVEN_AKIMBO]).sPlayerSilencerModelPath; } } @@ -146,7 +109,7 @@ w_fiveseven_akimbo_draw(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::FiveSeven_akimbo], arg_thisWeapon); + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::FIVESEVEN_AKIMBO], arg_thisWeapon); } void @@ -165,8 +128,7 @@ var int rightCount = 0; // Akimbo weapons consistently. // Putting it here avoids duplicating a bunch of code. // Also, "attackTypeUsed" is whether primary (FALSE) or secondary (TRUE) lead to this point. -BOOLEAN weapon_FiveSeven_akimbo_attack(player localPlayer, weapondynamic_t arg_thisWeapon, int attackTypeUsed){ - player pl = localPlayer; +BOOLEAN weapon_fiveseven_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, int attackTypeUsed){ //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; //special case @@ -180,7 +142,7 @@ BOOLEAN weapon_FiveSeven_akimbo_attack(player localPlayer, weapondynamic_t arg_t // Muzzle flashes and shell ejections for akimbo pending! // because I am not copy/pasting this monstrosity 5 times. - finalAkimboChoice = weapon_akimbo_semiAttackChoice(localPlayer, ary_weaponData[WEAPON_ID::FiveSeven_akimbo], arg_thisWeapon, attackTypeUsed); + finalAkimboChoice = weapon_akimbo_semiAttackChoice(pl, ary_weaponData[WEAPON_ID::FIVESEVEN_AKIMBO], arg_thisWeapon, attackTypeUsed); #ifdef CLIENT SAVE_STATE(pl.nextAkimboAttackPreference); @@ -233,21 +195,21 @@ BOOLEAN weapon_FiveSeven_akimbo_attack(player localPlayer, weapondynamic_t arg_t // sudden dual-fire request though. int effectiveAkimboChoice = finalAkimboChoice & ~pl.akimboTest; //finalAkimboChoice;//BITS_AKIMBOCHOICE_NONE & ~pl.akimboTest - weapon_base_onAttack(localPlayer, ary_weaponData[WEAPON_ID::FiveSeven_akimbo], arg_thisWeapon, effectiveAkimboChoice); + weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::FIVESEVEN_AKIMBO], arg_thisWeapon, effectiveAkimboChoice); if(effectiveAkimboChoice & BITS_AKIMBOCHOICE_LEFT){ if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - TS_Weapons_PlaySoundDirect(pl, "weapons/fnh/fnh-fire.wav"); + SoundPitched_Send(pl, SNDP_FIVESEVEN_FIRE); } else { - TS_Weapons_PlaySoundDirect(pl, "weapons/fnh/fnh-fire-sil.wav"); + SoundPitched_Send(pl, SNDP_FIVESEVEN_FIRE_SIL); } } if(effectiveAkimboChoice & BITS_AKIMBOCHOICE_RIGHT){ if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - TS_Weapons_PlaySoundDirect(pl, "weapons/fnh/fnh-fire.wav"); + SoundPitched_Send(pl, SNDP_FIVESEVEN_FIRE); } else { - TS_Weapons_PlaySoundDirect(pl, "weapons/fnh/fnh-fire-sil.wav"); + SoundPitched_Send(pl, SNDP_FIVESEVEN_FIRE_SIL); } } @@ -307,7 +269,7 @@ BOOLEAN weapon_FiveSeven_akimbo_attack(player localPlayer, weapondynamic_t arg_t } return TRUE; -}//END OF weapon_FiveSeven_akimbo_attack +}//END OF weapon_fiveseven_akimbo_attack void @@ -321,15 +283,15 @@ w_fiveseven_akimbo_primary(void) // in addition to the primary input, which lead to '_primary' being called at all. if(input_buttons & INPUT_BUTTON3){ - if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_BOTH, &weapon_FiveSeven_akimbo_attack)){ + if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_BOTH, &weapon_fiveseven_akimbo_attack)){ // nothing unusual here. pl.akimboTest = 0; - weapon_FiveSeven_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_BOTH); + weapon_fiveseven_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_BOTH); }else{ } }else{ - if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT, &weapon_FiveSeven_akimbo_attack)){ - weapon_FiveSeven_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); + if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT, &weapon_fiveseven_akimbo_attack)){ + weapon_fiveseven_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); pl.akimboFirePrev = BITS_AKIMBOCHOICE_LEFT; } @@ -354,55 +316,48 @@ w_fiveseven_akimbo_secondary(void) }else{ // fires the right weapon always - //weapon_FiveSeven_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT); + //weapon_fiveseven_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT); //return; - if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT, &weapon_FiveSeven_akimbo_attack)){ - weapon_FiveSeven_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT); + if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT, &weapon_fiveseven_akimbo_attack)){ + weapon_fiveseven_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT); pl.akimboFirePrev = BITS_AKIMBOCHOICE_RIGHT; } } } - void w_fiveseven_akimbo_reload(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::FiveSeven_akimbo], arg_thisWeapon); + weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::FIVESEVEN_AKIMBO], arg_thisWeapon); leftCount = 0; rightCount = 0; } -// ??? float w_fiveseven_akimbo_aimanim(void) { return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND; } - void w_fiveseven_akimbo_hud(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::FiveSeven_akimbo], arg_thisWeapon); + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::FIVESEVEN_AKIMBO], arg_thisWeapon); } - -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_fiveseven_akimbo_hudpic(int selected, vector pos, float a) { // } - weapon_t w_fiveseven_akimbo = { diff --git a/src/shared/weapons/weapon_glock18.qc b/src/shared/weapons/weapon_glock18.qc index 38580fd..0b13c63 100644 --- a/src/shared/weapons/weapon_glock18.qc +++ b/src/shared/weapons/weapon_glock18.qc @@ -8,37 +8,20 @@ enum weaponseq_glock18{ shootempty = 5 }; - -BOOLEAN weapon_Glock18_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; -} -BOOLEAN weapon_Glock18_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ +void weapon_glock18_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ return FALSE; } -BOOLEAN weapon_Glock18_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; -} -BOOLEAN weapon_Glock18_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ +void weapon_glock18_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ return FALSE; } -void weapon_Glock18_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_glock18_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::GLOCK18], arg_thisWeapon); } -BOOLEAN weapon_Glock18_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_Glock18_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Glock18], arg_thisWeapon); -} -void weapon_Glock18_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_Glock18_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_Glock18_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_glock18_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ } - -weapondata_gun_t weapon_Glock18 = +weapondata_gun_t weapon_glock18 = { WEAPONDATA_TYPEID_GUN, "Glock-18", @@ -47,16 +30,10 @@ weapondata_gun_t weapon_Glock18 = "models/p_glock18_sil.mdl", "models/w_glock18.mdl", "sprites/weapons/glock18.spr", - weapon_Glock18_onPrimaryAttack, - weapon_Glock18_onPrimaryAttackRelease, - weapon_Glock18_onSecondaryAttack, - weapon_Glock18_onSecondaryAttackRelease, - weapon_Glock18_onEquip, - weapon_Glock18_onUnEquip, - weapon_Glock18_onThink, - weapon_Glock18_onDrawHUD, - weapon_Glock18_onReload, - weapon_Glock18_onColdCock, + weapon_glock18_onPrimaryAttackRelease, + weapon_glock18_onSecondaryAttackRelease, + weapon_glock18_onThink, + weapon_glock18_onColdCock, weaponseq_glock18::idle, weaponseq_glock18::draw, 31.0f / 30.0f, @@ -74,7 +51,7 @@ weapondata_gun_t weapon_Glock18 = WEAPON_AKIMBO_UPGRADE_ID::NONE, BITS_FIREMODE_SEMI | BITS_FIREMODE_FULL, BITS_FIREMODE_FULL, - AMMO_ID::_9x19mm, + AMMO_ID::_9X19MM, 17, 4096, weaponseq_glock18::reload, @@ -87,38 +64,39 @@ weapondata_gun_t weapon_Glock18 = -// WEAPON_GLOCK -> WEAPON_ID::Glock18 +// WEAPON_GLOCK -> WEAPON_ID::GLOCK18 // .glockmag -> .ary_ammoTotal[AMMO_ID::_9x19mm] void w_glock18_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::GLOCK18]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + //precache_sound("weapons/glock/clipin.wav"); + //precache_sound("weapons/glock/clipout.wav"); + precache_sound("weapons/glock/glock-fire-sil.wav"); + precache_sound("weapons/glock/glock-fire.wav"); + //precache_sound("weapons/glock/slideback.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. +// Should FreeTS even use updateammo? Example of how to use it if so: void w_glock18_updateammo(player pl) { + // FreeHL's way for reference: //Weapons_UpdateAmmo(pl, pl.glock_mag, pl.ammo_9mm, -1); - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); + // FreeTS way to use weapondata stats to make that call: + //weapon_gun_updateAmmo(pl, WEAPON_ID::GLOCK18); } string w_glock18_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::Glock18]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::GLOCK18]).sWorldModelPath; } string @@ -128,9 +106,9 @@ w_glock18_pmodel(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - return (*ary_weaponData[WEAPON_ID::Glock18]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::GLOCK18]).sPlayerModelPath; } else { - return (*ary_weaponData[WEAPON_ID::Glock18]).sPlayerSilencerModelPath; + return (*ary_weaponData[WEAPON_ID::GLOCK18]).sPlayerSilencerModelPath; } } @@ -147,7 +125,7 @@ w_glock18_draw(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::Glock18], arg_thisWeapon); + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::GLOCK18], arg_thisWeapon); } void @@ -178,9 +156,9 @@ w_glock18_primary(void) //TAGGG - TODO - make sndshd files to contain lists for these instead. if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - TS_Weapons_PlaySoundDirect(pl, "weapons/glock/glock-fire.wav"); + SoundPitched_Send(pl, SNDP_GLOCK18_FIRE); } else { - TS_Weapons_PlaySoundDirect(pl, "weapons/glock/glock-fire-sil.wav"); + SoundPitched_Send(pl, SNDP_GLOCK18_FIRE_SIL); } if(arg_thisWeapon.iClipLeft > 1){ @@ -204,7 +182,7 @@ w_glock18_primary(void) View_AddEvent(w_ejectshell_pistol, 0.0f); #endif - weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::Glock18], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); + weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::GLOCK18], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); // nothing too special for that. weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[arg_thisWeapon.weaponID]).fAttackDelay); @@ -224,7 +202,7 @@ w_glock18_reload(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Glock18], arg_thisWeapon); + weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::GLOCK18], arg_thisWeapon); } @@ -243,13 +221,12 @@ w_glock18_hud(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Glock18], arg_thisWeapon); + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::GLOCK18], arg_thisWeapon); } - -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted +// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the +// button with the icon if really wanted void w_glock18_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_glock20.qc b/src/shared/weapons/weapon_glock20.qc index 91f07a3..ea42d3f 100644 --- a/src/shared/weapons/weapon_glock20.qc +++ b/src/shared/weapons/weapon_glock20.qc @@ -8,38 +8,20 @@ enum weaponseq_glock20{ shootempty }; - -BOOLEAN weapon_Glock20_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; +void weapon_glock20_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_Glock20_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_glock20_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_Glock20_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_glock20_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::GLOCK20], arg_thisWeapon); } -BOOLEAN weapon_Glock20_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} - -void weapon_Glock20_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_Glock20_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_Glock20_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Glock20], arg_thisWeapon); -} -void weapon_Glock20_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_Glock20_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_Glock20_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_glock20_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ } - -weapondata_gun_t weapon_Glock20 = +weapondata_gun_t weapon_glock20 = { WEAPONDATA_TYPEID_GUN, "Glock-20C", @@ -48,20 +30,14 @@ weapondata_gun_t weapon_Glock20 = "models/p_glock22_sil.mdl", "models/w_glock22.mdl", "sprites/weapons/glock22.spr", - weapon_Glock20_onPrimaryAttack, - weapon_Glock20_onPrimaryAttackRelease, - weapon_Glock20_onSecondaryAttack, - weapon_Glock20_onSecondaryAttackRelease, - weapon_Glock20_onEquip, - weapon_Glock20_onUnEquip, - weapon_Glock20_onThink, - weapon_Glock20_onDrawHUD, - weapon_Glock20_onReload, - weapon_Glock20_onColdCock, + weapon_glock20_onPrimaryAttackRelease, + weapon_glock20_onSecondaryAttackRelease, + weapon_glock20_onThink, + weapon_glock20_onColdCock, weaponseq_glock20::idle, weaponseq_glock20::draw, 31.0f / 30.0f, - 0.19f, //fire delay. this is most certainly wrong. find something more accurate later. + 0.19f, //fire delay 15.0f, //dmg TRUE, BITS_WEAPONOPT_SILENCER | BITS_WEAPONOPT_LASERSIGHT | BITS_WEAPONOPT_FLASHLIGHT, @@ -74,7 +50,7 @@ weapondata_gun_t weapon_Glock20 = WEAPON_AKIMBO_UPGRADE_ID::NONE, BITS_FIREMODE_SEMI, BITS_FIREMODE_SEMI, - AMMO_ID::_10mmAUTO, + AMMO_ID::_10MMAUTO, 15, //clip 4096, //range weaponseq_glock20::reload, @@ -89,30 +65,24 @@ weapondata_gun_t weapon_Glock20 = void w_glock20_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::GLOCK20]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + precache_sound("weapons/glock22/glock22-fire-sil.wav"); + precache_sound("weapons/glock22/glock22-fire.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_glock20_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string w_glock20_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::Glock20]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::GLOCK20]).sWorldModelPath; } string @@ -122,9 +92,9 @@ w_glock20_pmodel(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - return (*ary_weaponData[WEAPON_ID::Glock20]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::GLOCK20]).sPlayerModelPath; } else { - return (*ary_weaponData[WEAPON_ID::Glock20]).sPlayerSilencerModelPath; + return (*ary_weaponData[WEAPON_ID::GLOCK20]).sPlayerSilencerModelPath; } } @@ -140,7 +110,7 @@ w_glock20_draw(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::Glock20], arg_thisWeapon); + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::GLOCK20], arg_thisWeapon); } void @@ -169,9 +139,9 @@ w_glock20_primary(void) } if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - TS_Weapons_PlaySoundDirect(pl, "weapons/glock22/glock22-fire.wav"); + SoundPitched_Send(pl, SNDP_GLOCK20_FIRE); } else { - TS_Weapons_PlaySoundDirect(pl, "weapons/glock22/glock22-fire-sil.wav"); + SoundPitched_Send(pl, SNDP_GLOCK20_FIRE_SIL); } if(arg_thisWeapon.iClipLeft > 0){ @@ -192,7 +162,7 @@ w_glock20_primary(void) View_AddEvent(w_ejectshell_pistol, 0.0f); #endif - weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::Glock20], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); + weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::GLOCK20], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[arg_thisWeapon.weaponID]).fAttackDelay); @@ -209,18 +179,15 @@ w_glock20_secondary(void) { } - void w_glock20_reload(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Glock20], arg_thisWeapon); + weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::GLOCK20], arg_thisWeapon); } - -// ??? float w_glock20_aimanim(void) { @@ -233,12 +200,10 @@ w_glock20_hud(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Glock20], arg_thisWeapon); + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::GLOCK20], arg_thisWeapon); } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_glock20_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_hk_pdw.qc b/src/shared/weapons/weapon_hk_pdw.qc deleted file mode 100644 index 16ac36b..0000000 --- a/src/shared/weapons/weapon_hk_pdw.qc +++ /dev/null @@ -1,297 +0,0 @@ - -enum weaponseq_hk_pdw{ - idle, - reload, - draw, - shoot, - shoot2, - shoot3 -}; - - -BOOLEAN weapon_HK_PDW_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; -} -BOOLEAN weapon_HK_PDW_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_HK_PDW_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_HK_PDW_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} - -void weapon_HK_PDW_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_HK_PDW_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_HK_PDW_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::HK_PDW], arg_thisWeapon); -} -void weapon_HK_PDW_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_HK_PDW_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_HK_PDW_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ - -} - - -weapondata_gun_t weapon_HK_PDW = -{ - WEAPONDATA_TYPEID_GUN, - "MP7-PDW", - "models/v_pdw.mdl", - "models/p_pdw.mdl", - "models/p_pdw_Sil.mdl", - "models/w_pdw.mdl", - "sprites/weapons/pdw.spr", - weapon_HK_PDW_onPrimaryAttack, - weapon_HK_PDW_onPrimaryAttackRelease, - weapon_HK_PDW_onSecondaryAttack, - weapon_HK_PDW_onSecondaryAttackRelease, - weapon_HK_PDW_onEquip, - weapon_HK_PDW_onUnEquip, - weapon_HK_PDW_onThink, - weapon_HK_PDW_onDrawHUD, - weapon_HK_PDW_onReload, - weapon_HK_PDW_onColdCock, - weaponseq_hk_pdw::idle, - weaponseq_hk_pdw::draw, - 31.0f / 30.0f, - 0.0625f, //fire delay. - 7.0f, //dmg - TRUE, - BITS_WEAPONOPT_SILENCER | BITS_WEAPONOPT_LASERSIGHT | BITS_WEAPONOPT_SCOPE, - BITS_WEAPONOPT_NONE, - 2800, - 30, - BUYCATEGORY_SMGS, - 3, - {0.003000, 1.900000, 0.007500}, - WEAPON_AKIMBO_UPGRADE_ID::NONE, - BITS_FIREMODE_FULL | BITS_FIREMODE_SEMI, - BITS_FIREMODE_FULL, - AMMO_ID::_5p7x28, - 40, //clip - 4096, //range - weaponseq_hk_pdw::reload, - 81.0f / 35.0f, - 1, - -1, - -1, - 2 -}; - - -void -w_hk_pdw_precache(void) -{ -#ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); -#else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); -#endif -} - -// I guess? I don't know if we really benefit from doing this. -void -w_hk_pdw_updateammo(player pl) -{ - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); -} - -string -w_hk_pdw_wmodel(void) -{ - return (*ary_weaponData[WEAPON_ID::HK_PDW]).sWorldModelPath; -} - -string -w_hk_pdw_pmodel(void) -{ - // Do we have the silencer? - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - return (*ary_weaponData[WEAPON_ID::HK_PDW]).sPlayerModelPath; - } else { - return (*ary_weaponData[WEAPON_ID::HK_PDW]).sPlayerSilencerModelPath; - } -} - -string -w_hk_pdw_deathmsg(void) -{ - return ""; -} - -void -w_hk_pdw_draw(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::HK_PDW], arg_thisWeapon); -} - -void -w_hk_pdw_holster(void) -{ -} - -void -w_hk_pdw_primary(void) -{ - float randomChoice; - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - - if (pl.w_attack_next > 0.0) { - return; - } - - if(arg_thisWeapon.iFireMode == BITS_FIREMODE_SEMI){ - INPUT_PRIMARY_TAP_GATE - } - - if (!arg_thisWeapon.iClipLeft || WEAPON_UNDERWATER_CHECK) { - PLAY_CLICK_SOUND - return; - } - - if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - TS_Weapons_PlaySoundDirect(pl, "weapons/pdw/fire.wav"); - } else { - TS_Weapons_PlaySoundDirect(pl, "weapons/pdw/fire-sil.wav"); - } - - randomChoice = random(); - if(randomChoice < 1/3){ - TS_Weapons_ViewAnimation(weaponseq_hk_pdw::shoot, 21.0f/30.0f); - }else if(randomChoice < 2/3){ - TS_Weapons_ViewAnimation(weaponseq_hk_pdw::shoot2, 21.0f/30.0f); - }else{ - TS_Weapons_ViewAnimation(weaponseq_hk_pdw::shoot3, 21.0f/30.0f); - } - -#ifdef CLIENT - View_ShowMuzzleflash(MUZZLE_SMALL); - View_AddEvent(w_ejectshell_pistol, 0.0f); -#endif - - weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::HK_PDW], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); - - weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[arg_thisWeapon.weaponID]).fAttackDelay); - - if (self.flags & FL_CROUCHING){ - Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.2f); - }else{ - Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.2f); - } - -} - -void -w_hk_pdw_secondary(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - - if(pl.w_attack_next > 0){ - return; - } - - INPUT_SECONDARY_TAP_GATE - - if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){ - // toggle through the zoom. - - switch(pl.currentZoomChoice){ - case -1:{ - //pl.viewzoom = 40/80; - pl.setZoom(0.50f); - pl.currentZoomChoice++; - break;} - case 0:{ - //pl.viewzoom = 0; - pl.setZoom(1.00f); - pl.currentZoomChoice = -1; - break;} - - }//END OF switch - - } - -} - - -void -w_hk_pdw_reload(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - - weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::HK_PDW], arg_thisWeapon); -} - - -// ??? -float -w_hk_pdw_aimanim(void) -{ - return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND; -} - -void -w_hk_pdw_hud(void) -{ - player pl = (player)self; - - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::HK_PDW], arg_thisWeapon); - -} - -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted -void -w_hk_pdw_hudpic(int selected, vector pos, float a) -{ - // -} - -weapon_t w_hk_pdw = -{ - - .name = "hk_pdw", - .id = 0, // not using this - .slot = 2, // ? - .slot_pos = 0, // not using this - .weight = 0, // not using this - .draw = w_hk_pdw_draw, - .holster = w_hk_pdw_holster, - .primary = w_hk_pdw_primary, - .secondary = w_hk_pdw_secondary, - .reload = w_hk_pdw_reload, - .release = NULL, - .crosshair = w_hk_pdw_hud, - .precache = w_hk_pdw_precache, - .pickup = NULL, - .updateammo = w_hk_pdw_updateammo, - .wmodel = w_hk_pdw_wmodel, - .pmodel = w_hk_pdw_pmodel, - .deathmsg = w_hk_pdw_deathmsg, - .aimanim = w_hk_pdw_aimanim, - .hudpic = NULL - -}; - diff --git a/src/shared/weapons/weapon_hkpdw.qc b/src/shared/weapons/weapon_hkpdw.qc new file mode 100644 index 0000000..b764ac7 --- /dev/null +++ b/src/shared/weapons/weapon_hkpdw.qc @@ -0,0 +1,266 @@ + +enum weaponseq_hkpdw{ + idle, + reload, + draw, + shoot, + shoot2, + shoot3 +}; + +void weapon_hkpdw_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + +} +void weapon_hkpdw_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + +} +void weapon_hkpdw_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::HKPDW], arg_thisWeapon); +} +void weapon_hkpdw_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ + +} + +weapondata_gun_t weapon_hkpdw = +{ + WEAPONDATA_TYPEID_GUN, + "MP7-PDW", + "models/v_pdw.mdl", + "models/p_pdw.mdl", + "models/p_pdw_Sil.mdl", + "models/w_pdw.mdl", + "sprites/weapons/pdw.spr", + weapon_hkpdw_onPrimaryAttackRelease, + weapon_hkpdw_onSecondaryAttackRelease, + weapon_hkpdw_onThink, + weapon_hkpdw_onColdCock, + weaponseq_hkpdw::idle, + weaponseq_hkpdw::draw, + 31.0f / 30.0f, + 0.0625f, //fire delay. + 7.0f, //dmg + TRUE, + BITS_WEAPONOPT_SILENCER | BITS_WEAPONOPT_LASERSIGHT | BITS_WEAPONOPT_SCOPE, + BITS_WEAPONOPT_NONE, + 2800, + 30, + BUYCATEGORY_SMGS, + 3, + {0.003000, 1.900000, 0.007500}, + WEAPON_AKIMBO_UPGRADE_ID::NONE, + BITS_FIREMODE_FULL | BITS_FIREMODE_SEMI, + BITS_FIREMODE_FULL, + AMMO_ID::_5P7X28, + 40, //clip + 4096, //range + weaponseq_hkpdw::reload, + 81.0f / 35.0f, + 1, + -1, + -1, + 2 +}; + + + +void +w_hkpdw_precache(void) +{ + weapon_precache(ary_weaponData[WEAPON_ID::HKPDW]); +#ifdef SERVER + //precache_sound("weapons/pdw/clipin.wav"); + //precache_sound("weapons/pdw/clipout.wav"); + precache_sound("weapons/pdw/fire-sil.wav"); + precache_sound("weapons/pdw/fire.wav"); + //precache_sound("weapons/pdw/slideback.wav"); +#else + +#endif +} + +void +w_hkpdw_updateammo(player pl) +{ +} + +string +w_hkpdw_wmodel(void) +{ + return (*ary_weaponData[WEAPON_ID::HKPDW]).sWorldModelPath; +} + +string +w_hkpdw_pmodel(void) +{ + // Do we have the silencer? + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ + return (*ary_weaponData[WEAPON_ID::HKPDW]).sPlayerModelPath; + } else { + return (*ary_weaponData[WEAPON_ID::HKPDW]).sPlayerSilencerModelPath; + } +} + +string +w_hkpdw_deathmsg(void) +{ + return ""; +} + +void +w_hkpdw_draw(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::HKPDW], arg_thisWeapon); +} + +void +w_hkpdw_holster(void) +{ +} + +void +w_hkpdw_primary(void) +{ + float randomChoice; + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + + if (pl.w_attack_next > 0.0) { + return; + } + + if(arg_thisWeapon.iFireMode == BITS_FIREMODE_SEMI){ + INPUT_PRIMARY_TAP_GATE + } + + if (!arg_thisWeapon.iClipLeft || WEAPON_UNDERWATER_CHECK) { + PLAY_CLICK_SOUND + return; + } + + if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ + SoundPitched_Send(pl, SNDP_HKPDW_FIRE); + } else { + SoundPitched_Send(pl, SNDP_HKPDW_FIRE_SIL); + } + + randomChoice = random(); + if(randomChoice < 1/3){ + TS_Weapons_ViewAnimation(weaponseq_hkpdw::shoot, 21.0f/30.0f); + }else if(randomChoice < 2/3){ + TS_Weapons_ViewAnimation(weaponseq_hkpdw::shoot2, 21.0f/30.0f); + }else{ + TS_Weapons_ViewAnimation(weaponseq_hkpdw::shoot3, 21.0f/30.0f); + } + +#ifdef CLIENT + View_ShowMuzzleflash(MUZZLE_SMALL); + View_AddEvent(w_ejectshell_pistol, 0.0f); +#endif + + weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::HKPDW], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); + + weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[arg_thisWeapon.weaponID]).fAttackDelay); + + if (self.flags & FL_CROUCHING){ + Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.2f); + }else{ + Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.2f); + } + +} + +void +w_hkpdw_secondary(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + + if(pl.w_attack_next > 0){ + return; + } + + INPUT_SECONDARY_TAP_GATE + + if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){ + // toggle through the zoom. + + switch(pl.currentZoomChoice){ + case -1:{ + //pl.viewzoom = 40/80; + pl.setZoom(0.50f); + pl.currentZoomChoice++; + break;} + case 0:{ + //pl.viewzoom = 0; + pl.setZoom(1.00f); + pl.currentZoomChoice = -1; + break;} + + }//END OF switch + + } + +} + +void +w_hkpdw_reload(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + + weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::HKPDW], arg_thisWeapon); +} + +float +w_hkpdw_aimanim(void) +{ + return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND; +} + +void +w_hkpdw_hud(void) +{ + player pl = (player)self; + + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::HKPDW], arg_thisWeapon); + +} + +void +w_hkpdw_hudpic(int selected, vector pos, float a) +{ + // +} + +weapon_t w_hkpdw = +{ + + .name = "hkpdw", + .id = 0, // not using this + .slot = 2, // ? + .slot_pos = 0, // not using this + .weight = 0, // not using this + .draw = w_hkpdw_draw, + .holster = w_hkpdw_holster, + .primary = w_hkpdw_primary, + .secondary = w_hkpdw_secondary, + .reload = w_hkpdw_reload, + .release = NULL, + .crosshair = w_hkpdw_hud, + .precache = w_hkpdw_precache, + .pickup = NULL, + .updateammo = w_hkpdw_updateammo, + .wmodel = w_hkpdw_wmodel, + .pmodel = w_hkpdw_pmodel, + .deathmsg = w_hkpdw_deathmsg, + .aimanim = w_hkpdw_aimanim, + .hudpic = NULL + +}; + diff --git a/src/shared/weapons/weapon_karate.qc b/src/shared/weapons/weapon_karate.qc index ab020c6..9594061 100644 --- a/src/shared/weapons/weapon_karate.qc +++ b/src/shared/weapons/weapon_karate.qc @@ -5,9 +5,7 @@ // ALSO, weapons that lack world-models will never drop, safe assumption. // That is why karate never drops. - enum weaponseq_karate{ - //nothing = 0 idle, draw, punch_left, @@ -22,37 +20,19 @@ enum weaponseq_karate{ }; - -BOOLEAN weapon_Karate_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; -} -BOOLEAN weapon_Karate_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_Karate_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; -} -BOOLEAN weapon_Karate_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -void weapon_Karate_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_Karate_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_Karate_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_karate_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ } -void weapon_Karate_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} - -void weapon_Karate_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_Karate_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ -} - +void weapon_karate_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ -weapondata_basic_t weapon_Karate = +} +void weapon_karate_onThink(player pl, weapondynamic_t arg_thisWeapon){ + +} +void weapon_karate_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ +} + +weapondata_basic_t weapon_karate = { WEAPONDATA_TYPEID_BASIC, "Karate", @@ -61,20 +41,14 @@ weapondata_basic_t weapon_Karate = "", "", "sprites/weapons/kungfu.spr", - weapon_Karate_onPrimaryAttack, - weapon_Karate_onPrimaryAttackRelease, - weapon_Karate_onSecondaryAttack, - weapon_Karate_onSecondaryAttackRelease, - weapon_Karate_onEquip, - weapon_Karate_onUnEquip, - weapon_Karate_onThink, - weapon_Karate_onDrawHUD, - weapon_Karate_onReload, - weapon_Karate_onColdCock, + weapon_karate_onPrimaryAttackRelease, + weapon_karate_onSecondaryAttackRelease, + weapon_karate_onThink, + weapon_karate_onColdCock, weaponseq_karate::idle, weaponseq_karate::draw, 31 / 35, // 31/35 ? - 0.17f, //fire delay. this is most certainly wrong. find something more accurate later. + 0.17f, //fire delay 20.0f, FALSE, BITS_WEAPONOPT_NONE, @@ -92,15 +66,13 @@ weapondata_basic_t weapon_Karate = void w_karate_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::KARATE]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + precache_sound("player/closecombat.wav"); + precache_sound("player/kungfuhit.wav"); + precache_sound("player/block.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } @@ -113,13 +85,13 @@ w_karate_updateammo(player pl) string w_karate_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::Karate]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::KARATE]).sWorldModelPath; } string w_karate_pmodel(void) { - return (*ary_weaponData[WEAPON_ID::Karate]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::KARATE]).sPlayerModelPath; } string @@ -134,7 +106,7 @@ w_karate_draw(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapondata_basic_t* basicP = ary_weaponData[WEAPON_ID::Karate]; + weapondata_basic_t* basicP = ary_weaponData[WEAPON_ID::KARATE]; weapon_base_onEquip(pl, basicP, arg_thisWeapon); } @@ -159,7 +131,7 @@ w_karate_primary(void) INPUT_PRIMARY_TAP_GATE // TODO - base karate melee damage? I forget. - MELEE_HIT_RESPONSE theReaper = weapon_base_onPrimaryAttack_melee(pl, ary_weaponData[WEAPON_ID::Karate], arg_thisWeapon, 30 * pl.fKarateStamina, 55); + MELEE_HIT_RESPONSE hitRep = weapon_base_onPrimaryAttack_melee(pl, ary_weaponData[WEAPON_ID::KARATE], arg_thisWeapon, 30 * pl.fKarateStamina, 55); //pointsound(vPos, "player/closecombat.wav", impactSoundVolume, ATTN_NORM+0.1); @@ -167,17 +139,17 @@ w_karate_primary(void) weapon_base_setWholeAttackDelay(pl, 0.175f); pl.fMoveBlockDelay = time + 0.09f; //pl.fUncrouchBlockDelay = time + 1.0f; - - + + #ifdef SERVER // need the fleshhit sound - if (theReaper == MELEE_HIT_RESPONSE::NONE ) { + if (hitRep == MELEE_HIT_RESPONSE::NONE ) { TS_Weapons_PlaySoundDirect(pl, "player/closecombat.wav"); - }else if(theReaper == MELEE_HIT_RESPONSE::SOFT){ + }else if(hitRep == MELEE_HIT_RESPONSE::SOFT){ TS_Weapons_PlaySoundDirect(pl, "player/closecombat.wav"); - }else if(theReaper == MELEE_HIT_RESPONSE::METAL){ + }else if(hitRep == MELEE_HIT_RESPONSE::METAL){ TS_Weapons_PlaySoundDirect(pl, "player/closecombat.wav"); - }else if(theReaper == MELEE_HIT_RESPONSE::FLESH){ + }else if(hitRep == MELEE_HIT_RESPONSE::FLESH){ TS_Weapons_PlaySoundDirect(pl, "player/kungfuhit.wav"); } #endif @@ -211,7 +183,7 @@ w_karate_primary(void) // moved to a method so that early termination does not stop too much. -void w_karate_determineSecondaryAttack(MELEE_HIT_RESPONSE* theReaper, int* meleeAnimToPlay){ +void w_karate_determineSecondaryAttack(MELEE_HIT_RESPONSE* hitRep, int* meleeAnimToPlay){ player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; float curSpeed; @@ -222,7 +194,7 @@ void w_karate_determineSecondaryAttack(MELEE_HIT_RESPONSE* theReaper, int* melee //crouching? //spin kick (*meleeAnimToPlay) = 1; - (*theReaper) = weapon_base_onPrimaryAttack_melee(pl, ary_weaponData[WEAPON_ID::Karate], arg_thisWeapon, 40 * pl.fKarateStamina, 72); + (*hitRep) = weapon_base_onPrimaryAttack_melee(pl, ary_weaponData[WEAPON_ID::KARATE], arg_thisWeapon, 40 * pl.fKarateStamina, 72); weapon_base_setWholeAttackDelay(pl, 1); pl.fMoveBlockDelay = time + 1; pl.fKarateStamina = bound(0, pl.fKarateStamina - 0.25, 1); @@ -243,7 +215,7 @@ void w_karate_determineSecondaryAttack(MELEE_HIT_RESPONSE* theReaper, int* melee if(dotproduct(_2d_dir, velocity_dir) <= -0.7 && GET_VIEW_ANGLES.x >= -55 && GET_VIEW_ANGLES.x <= 55){ // moving back-kick (*meleeAnimToPlay) = 2; - (*theReaper) = weapon_base_onPrimaryAttack_melee_fromCustomDirection(pl, ary_weaponData[WEAPON_ID::Katana], arg_thisWeapon, 30 * pl.fKarateStamina, 76, -v_forward); + (*hitRep) = weapon_base_onPrimaryAttack_melee_fromCustomDirection(pl, ary_weaponData[WEAPON_ID::KARATE], arg_thisWeapon, 30 * pl.fKarateStamina, 76, -v_forward); weapon_base_setWholeAttackDelay(pl, 1); pl.fMoveBlockDelay = time + 1; //TAGGG - NOTE. Why is this stamina-loss in original TS so high? @@ -254,7 +226,7 @@ void w_karate_determineSecondaryAttack(MELEE_HIT_RESPONSE* theReaper, int* melee }else{ //moving-kick (*meleeAnimToPlay) = 0; - (*theReaper) = weapon_base_onPrimaryAttack_melee_fromCustomDirection(pl, ary_weaponData[WEAPON_ID::Katana], arg_thisWeapon, 30 * pl.fKarateStamina, 74, v_forward); + (*hitRep) = weapon_base_onPrimaryAttack_melee_fromCustomDirection(pl, ary_weaponData[WEAPON_ID::KARATE], arg_thisWeapon, 30 * pl.fKarateStamina, 74, v_forward); weapon_base_setWholeAttackDelay(pl, 0.53); pl.fMoveBlockDelay = time + 0.46; pl.fKarateStamina = bound(0, pl.fKarateStamina - 0.16, 1); @@ -267,7 +239,7 @@ void w_karate_determineSecondaryAttack(MELEE_HIT_RESPONSE* theReaper, int* melee //standing back-kick. makevectors(GET_VIEW_ANGLES); (*meleeAnimToPlay) = 2; - (*theReaper) = weapon_base_onPrimaryAttack_melee_fromCustomDirection(pl, ary_weaponData[WEAPON_ID::Katana], arg_thisWeapon, 30 * pl.fKarateStamina, 74, -v_forward); + (*hitRep) = weapon_base_onPrimaryAttack_melee_fromCustomDirection(pl, ary_weaponData[WEAPON_ID::KARATE], arg_thisWeapon, 30 * pl.fKarateStamina, 74, -v_forward); weapon_base_setWholeAttackDelay(pl, 1); pl.fMoveBlockDelay = time + 1; pl.fKarateStamina = bound(0, pl.fKarateStamina - 0.3, 1); @@ -277,7 +249,7 @@ void w_karate_determineSecondaryAttack(MELEE_HIT_RESPONSE* theReaper, int* melee // DEFAULT: nothing special then. (*meleeAnimToPlay) = 0; - (*theReaper) = weapon_base_onPrimaryAttack_melee(pl, ary_weaponData[WEAPON_ID::Karate], arg_thisWeapon, 30 * pl.fKarateStamina, 66); + (*hitRep) = weapon_base_onPrimaryAttack_melee(pl, ary_weaponData[WEAPON_ID::KARATE], arg_thisWeapon, 30 * pl.fKarateStamina, 66); weapon_base_setWholeAttackDelay(pl, 0.53); pl.fMoveBlockDelay = time + 0.46; @@ -295,7 +267,7 @@ w_karate_secondary(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; float randomChoice; - MELEE_HIT_RESPONSE theReaper; + MELEE_HIT_RESPONSE hitRep; int meleeAnimToPlay = 0; if(pl.w_attack_next > 0){ @@ -306,26 +278,22 @@ w_karate_secondary(void) pl.fMoveBlockCapSpeed = 35; - // TODO - base karate melee damage? I forget. - //pointsound(vPos, "player/closecombat.wav", impactSoundVolume, ATTN_NORM+0.1); - - w_karate_determineSecondaryAttack(&theReaper, &meleeAnimToPlay); - + w_karate_determineSecondaryAttack(&hitRep, &meleeAnimToPlay); //pl.fUncrouchBlockDelay = time + 1.0f; //Animation_ShootWeapon( self ); #ifdef SERVER // need the fleshhit sound - if (theReaper == MELEE_HIT_RESPONSE::NONE ) { + if (hitRep == MELEE_HIT_RESPONSE::NONE ) { TS_Weapons_PlaySoundDirect(pl, "player/closecombat.wav"); - }else if(theReaper == MELEE_HIT_RESPONSE::SOFT){ + }else if(hitRep == MELEE_HIT_RESPONSE::SOFT){ TS_Weapons_PlaySoundDirect(pl, "player/closecombat.wav"); - }else if(theReaper == MELEE_HIT_RESPONSE::METAL){ + }else if(hitRep == MELEE_HIT_RESPONSE::METAL){ TS_Weapons_PlaySoundDirect(pl, "player/closecombat.wav"); - }else if(theReaper == MELEE_HIT_RESPONSE::FLESH){ + }else if(hitRep == MELEE_HIT_RESPONSE::FLESH){ TS_Weapons_PlaySoundDirect(pl, "player/kungfuhit.wav"); } #endif @@ -358,8 +326,6 @@ w_karate_secondary(void) } - - void w_karate_reload(void) { @@ -375,22 +341,19 @@ w_karate_reload(void) if(time >= pl.flKarateBlockCooldown){ // allow it. Whatever 'it' is TS_Weapons_PlaySoundDirect(pl, "player/block.wav"); + TS_Weapons_ViewAnimation(weaponseq_karate::block_low, (31.0f/30.0f) ); } pl.flKarateBlockCooldown = time + 1.3f; } - -// ??? float w_karate_aimanim(void) { return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND; } - - void w_karate_hud(void) { @@ -399,7 +362,7 @@ w_karate_hud(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapondata_basic_t baseRef = *ary_weaponData[WEAPON_ID::Karate]; + weapondata_basic_t baseRef = *ary_weaponData[WEAPON_ID::KARATE]; vector vEquippedWeaponInfoDraw = [video_res[0] - 128 - 8, video_res[1] - 19 - 8]; @@ -422,15 +385,12 @@ w_karate_hud(void) #endif } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_karate_hudpic(int selected, vector pos, float a) { // } - weapon_t w_karate = { diff --git a/src/shared/weapons/weapon_katana.qc b/src/shared/weapons/weapon_katana.qc index 01b0a8a..60e43a8 100644 --- a/src/shared/weapons/weapon_katana.qc +++ b/src/shared/weapons/weapon_katana.qc @@ -7,38 +7,20 @@ enum weaponseq_katana{ slash3 }; - -BOOLEAN weapon_Katana_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; -} -BOOLEAN weapon_Katana_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_Katana_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; -} -BOOLEAN weapon_Katana_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -void weapon_Katana_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_Katana_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_Katana_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - -} -void weapon_Katana_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_Katana_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ - -} -void weapon_Katana_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ - -} - +void weapon_katana_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ -weapondata_melee_t weapon_Katana = +} +void weapon_katana_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + +} +void weapon_katana_onThink(player pl, weapondynamic_t arg_thisWeapon){ + +} +void weapon_katana_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ + +} + +weapondata_melee_t weapon_katana = { WEAPONDATA_TYPEID_MELEE, "Katana", @@ -47,20 +29,14 @@ weapondata_melee_t weapon_Katana = "", "models/w_katana.mdl", "sprites/weapons/katana.spr", - weapon_Katana_onPrimaryAttack, - weapon_Katana_onPrimaryAttackRelease, - weapon_Katana_onSecondaryAttack, - weapon_Katana_onSecondaryAttackRelease, - weapon_Katana_onEquip, - weapon_Katana_onUnEquip, - weapon_Katana_onThink, - weapon_Katana_onDrawHUD, - weapon_Katana_onReload, - weapon_Katana_onColdCock, + weapon_katana_onPrimaryAttackRelease, + weapon_katana_onSecondaryAttackRelease, + weapon_katana_onThink, + weapon_katana_onColdCock, weaponseq_katana::idle, weaponseq_katana::draw, 31.0f / 33.0f, - 0.33, //fire delay. this is most certainly wrong. find something more accurate later. + 0.33, //fire delay 80, //dmg FALSE, BITS_WEAPONOPT_NONE, @@ -83,15 +59,15 @@ weapondata_melee_t weapon_Katana = void w_katana_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::KATANA]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + precache_sound("weapons/katana/hit-body.wav"); + precache_sound("weapons/katana/hit.wav"); + precache_sound("weapons/katana/hit1.wav"); + precache_sound("weapons/katana/miss.wav"); + precache_sound("weapons/katana/miss1.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } @@ -104,13 +80,13 @@ w_katana_updateammo(player pl) string w_katana_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::Katana]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::KATANA]).sWorldModelPath; } string w_katana_pmodel(void) { - return (*ary_weaponData[WEAPON_ID::Katana]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::KATANA]).sPlayerModelPath; } string @@ -126,7 +102,7 @@ w_katana_draw(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::Katana], arg_thisWeapon); + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::KATANA], arg_thisWeapon); } void @@ -141,7 +117,7 @@ w_katana_primary(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; float randomChoice; - MELEE_HIT_RESPONSE theReaper; + MELEE_HIT_RESPONSE hitRep; int meleeAnimToPlay = 0; if (pl.w_attack_next > 0.0) { @@ -163,15 +139,8 @@ w_katana_primary(void) pl.iMeleeCycler = 0; meleeAnimToPlay = 0; - theReaper = weapon_base_onPrimaryAttack_melee(pl, ary_weaponData[WEAPON_ID::Katana], arg_thisWeapon, 80, 72); + hitRep = weapon_base_onPrimaryAttack_melee(pl, ary_weaponData[WEAPON_ID::KATANA], arg_thisWeapon, 80, 72); - /* - // ??? Why was this here, did original TS do this noise on crouch-attacks in particular? -#ifdef CLIENT - TS_Weapons_PlaySoundDirect(pl, "player/closecombat.wav"); -#endif - */ - weapon_base_setWholeAttackDelay(pl, 0.70); pl.fMoveBlockDelay = time + 1.0f; pl.fUncrouchBlockDelay = time + 1.0f; @@ -183,7 +152,7 @@ w_katana_primary(void) meleeAnimToPlay = 2; makevectors( GET_VIEW_ANGLES ); - theReaper = weapon_base_onPrimaryAttack_melee_fromCustomDirection(pl, ary_weaponData[WEAPON_ID::Katana], arg_thisWeapon, 80, 74, -v_forward); + hitRep = weapon_base_onPrimaryAttack_melee_fromCustomDirection(pl, ary_weaponData[WEAPON_ID::KATANA], arg_thisWeapon, 80, 74, -v_forward); weapon_base_setWholeAttackDelay(pl, 0.75); pl.fMoveBlockDelay = time + 1.0f; @@ -195,33 +164,32 @@ w_katana_primary(void) if(pl.iMeleeCycler >= 2 || pl.iMeleeCycler < 0){ pl.iMeleeCycler = 0; } - theReaper = weapon_base_onPrimaryAttack_melee(pl, ary_weaponData[WEAPON_ID::Katana], arg_thisWeapon, 80, 66); + hitRep = weapon_base_onPrimaryAttack_melee(pl, ary_weaponData[WEAPON_ID::KATANA], arg_thisWeapon, 80, 66); } } - // Don't check 'theReaper' client side, ray-checks to see what was hit are + // Don't check 'hitRep' client side, ray-checks to see what was hit are // ineffective there #ifdef SERVER - if (theReaper == MELEE_HIT_RESPONSE::NONE ) { + if (hitRep == MELEE_HIT_RESPONSE::NONE ) { randomChoice = randomInRange_i(0, 1); if(randomChoice == 0){ - TS_Weapons_PlaySoundDirect(pl, "weapons/katana/miss.wav"); + SoundPitched_Send(pl, SNDP_KATANA_MISS); }else{ - TS_Weapons_PlaySoundDirect(pl, "weapons/katana/miss1.wav"); + SoundPitched_Send(pl, SNDP_KATANA_MISS1); } - }else if(theReaper == MELEE_HIT_RESPONSE::SOFT){ + }else if(hitRep == MELEE_HIT_RESPONSE::SOFT){ //nothin - }else if(theReaper == MELEE_HIT_RESPONSE::METAL){ + }else if(hitRep == MELEE_HIT_RESPONSE::METAL){ randomChoice = randomInRange_i(0, 1); if(randomChoice == 0){ TS_Weapons_PlaySoundDirect(pl, "weapons/katana/hit.wav"); }else{ TS_Weapons_PlaySoundDirect(pl, "weapons/katana/hit1.wav"); } - }else if(theReaper == MELEE_HIT_RESPONSE::FLESH){ + }else if(hitRep == MELEE_HIT_RESPONSE::FLESH){ arg_thisWeapon.forceBodygroup1Submodel = 2; - TS_Weapons_PlaySoundDirect(pl, "weapons/katana/hit-body.wav"); } #endif @@ -250,7 +218,6 @@ w_katana_reload(void) // how do you reload a sword } -// ??? float w_katana_aimanim(void) { @@ -263,19 +230,16 @@ w_katana_hud(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_melee_onDrawHUD(pl, (weapondata_melee_t*)ary_weaponData[WEAPON_ID::Katana], arg_thisWeapon); + weapon_melee_onDrawHUD(pl, (weapondata_melee_t*)ary_weaponData[WEAPON_ID::KATANA], arg_thisWeapon); } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_katana_hudpic(int selected, vector pos, float a) { // } - weapon_t w_katana = { diff --git a/src/shared/weapons/weapon_m16a4.qc b/src/shared/weapons/weapon_m16a4.qc index 748192a..bc11bee 100644 --- a/src/shared/weapons/weapon_m16a4.qc +++ b/src/shared/weapons/weapon_m16a4.qc @@ -1,5 +1,4 @@ - enum weaponseq_m16a4{ idle, reload, @@ -18,43 +17,21 @@ enum weaponseq_m16a4{ reload2 }; - - - -BOOLEAN weapon_M16A4_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; +void weapon_m16a4_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_M16A4_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_m16a4_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_M16A4_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_m16a4_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::M16A4], arg_thisWeapon); + weapon_gun_onThink_burstFireLogic(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::M16A4], arg_thisWeapon); } -BOOLEAN weapon_M16A4_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - //most weapons don't care about releases. Also this only happens the one frame the input is detected - //not held after being held continuously - further logic should be handled in a think method. - return FALSE; -} - -void weapon_M16A4_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_M16A4_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_M16A4_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::M16A4], arg_thisWeapon); - weapon_gun_onThink_burstFireLogic(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::M16A4], arg_thisWeapon); -} -void weapon_M16A4_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_M16A4_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_M16A4_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_m16a4_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ } - -weapondata_ironsight_t weapon_M16A4 = +weapondata_ironsight_t weapon_m16a4 = { WEAPONDATA_TYPEID_IRONSIGHT, "M16A4", @@ -63,16 +40,10 @@ weapondata_ironsight_t weapon_M16A4 = "", "models/w_m16.mdl", "sprites/weapons/m16.spr", - weapon_M16A4_onPrimaryAttack, - weapon_M16A4_onPrimaryAttackRelease, - weapon_M16A4_onSecondaryAttack, - weapon_M16A4_onSecondaryAttackRelease, - weapon_M16A4_onEquip, - weapon_M16A4_onUnEquip, - weapon_M16A4_onThink, - weapon_M16A4_onDrawHUD, - weapon_M16A4_onReload, - weapon_M16A4_onColdCock, + weapon_m16a4_onPrimaryAttackRelease, + weapon_m16a4_onSecondaryAttackRelease, + weapon_m16a4_onThink, + weapon_m16a4_onColdCock, weaponseq_m16a4::idle, weaponseq_m16a4::draw, 31.0f / 35.0f, @@ -89,7 +60,7 @@ weapondata_ironsight_t weapon_M16A4 = WEAPON_AKIMBO_UPGRADE_ID::NONE, BITS_FIREMODE_SEMI | BITS_FIREMODE_BURST, BITS_FIREMODE_SEMI, - AMMO_ID::_5p56Nato, + AMMO_ID::_5P56NATO, 18, //clip 4096, //range weaponseq_m16a4::reload, @@ -115,24 +86,17 @@ weapondata_ironsight_t weapon_M16A4 = void w_m16a4_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::M16A4]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + precache_sound("weapons/m16/fire.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_m16a4_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string @@ -191,7 +155,7 @@ w_m16a4_primary(void) return; } - TS_Weapons_PlaySoundDirect(pl, "weapons/m16/fire.wav"); + SoundPitched_Send(pl, SNDP_M16A4_FIRE); if(!arg_thisWeapon.iIronSight){ randomChoice = random(); @@ -303,7 +267,6 @@ w_m16a4_secondary(void) } - void w_m16a4_reload(void) { @@ -313,15 +276,12 @@ w_m16a4_reload(void) weapon_ironsight_Reload(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::M16A4], arg_thisWeapon); } - -// ??? float w_m16a4_aimanim(void) { return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND; } - void w_m16a4_hud(void) { @@ -332,16 +292,12 @@ w_m16a4_hud(void) } - -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_m16a4_hudpic(int selected, vector pos, float a) { // } - weapon_t w_m16a4 = { diff --git a/src/shared/weapons/weapon_m4a1.qc b/src/shared/weapons/weapon_m4a1.qc index 5c8e017..f2fe06e 100644 --- a/src/shared/weapons/weapon_m4a1.qc +++ b/src/shared/weapons/weapon_m4a1.qc @@ -19,58 +19,41 @@ enum weaponseq_m4a1{ }; - -BOOLEAN weapon_M4A1_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; +void weapon_m4a1_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_M4A1_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_M4A1_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_M4A1_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_m4a1_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -void weapon_M4A1_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_m4a1_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::M4A1], arg_thisWeapon); } -BOOLEAN weapon_M4A1_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_M4A1_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::M4A1], arg_thisWeapon); -} -void weapon_M4A1_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_M4A1_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_M4A1_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ - player pl = localPlayer; +void weapon_m4a1_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ if(pl.w_attack_next > 0){ return; } - MELEE_HIT_RESPONSE theReaper = weapon_base_coldcock(pl, ary_weaponData[WEAPON_ID::M4A1], arg_thisWeapon, 40, 66); + MELEE_HIT_RESPONSE hitRep = weapon_base_coldcock(pl, ary_weaponData[WEAPON_ID::M4A1], arg_thisWeapon, 40, 66); weapon_base_setWholeAttackDelay(pl, 0.73f); TS_Weapons_ViewAnimation_noLaserLock(weaponseq_m4a1::coldcock, 30.0f/40.0f); arg_thisWeapon.iIronSight = 0; //disable, coldcock returns to non-ironsight look - if (theReaper == MELEE_HIT_RESPONSE::NONE ) { + if (hitRep == MELEE_HIT_RESPONSE::NONE ) { TS_Weapons_PlaySoundDirect(pl, "player/closecombat.wav"); - }else if(theReaper == MELEE_HIT_RESPONSE::SOFT){ + }else if(hitRep == MELEE_HIT_RESPONSE::SOFT){ TS_Weapons_PlaySoundDirect(pl, "player/closecombat.wav"); - }else if(theReaper == MELEE_HIT_RESPONSE::METAL){ + }else if(hitRep == MELEE_HIT_RESPONSE::METAL){ TS_Weapons_PlaySoundDirect(pl, "player/closecombat.wav"); - }else if(theReaper == MELEE_HIT_RESPONSE::FLESH){ + }else if(hitRep == MELEE_HIT_RESPONSE::FLESH){ TS_Weapons_PlaySoundDirect(pl, "weapons/knife/knife_hitbody.wav"); } } -weapondata_ironsight_t weapon_M4A1 = +weapondata_ironsight_t weapon_m4a1 = { WEAPONDATA_TYPEID_IRONSIGHT, "M4A1", @@ -79,16 +62,10 @@ weapondata_ironsight_t weapon_M4A1 = "models/p_m4_sil.mdl", "models/w_m4.mdl", "sprites/weapons/m4.spr", - weapon_M4A1_onPrimaryAttack, - weapon_M4A1_onPrimaryAttackRelease, - weapon_M4A1_onSecondaryAttack, - weapon_M4A1_onSecondaryAttackRelease, - weapon_M4A1_onEquip, - weapon_M4A1_onUnEquip, - weapon_M4A1_onThink, - weapon_M4A1_onDrawHUD, - weapon_M4A1_onReload, - weapon_M4A1_onColdCock, + weapon_m4a1_onPrimaryAttackRelease, + weapon_m4a1_onSecondaryAttackRelease, + weapon_m4a1_onThink, + weapon_m4a1_onColdCock, weaponseq_m4a1::idle, weaponseq_m4a1::draw, 31.0f / 35.0f, @@ -105,7 +82,7 @@ weapondata_ironsight_t weapon_M4A1 = WEAPON_AKIMBO_UPGRADE_ID::NONE, BITS_FIREMODE_FULL | BITS_FIREMODE_SEMI, BITS_FIREMODE_FULL, - AMMO_ID::_5p56Nato, + AMMO_ID::_5P56NATO, 30, //clip 4096, //range weaponseq_m4a1::reload, @@ -131,24 +108,21 @@ weapondata_ironsight_t weapon_M4A1 = void w_m4a1_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::M4A1]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + //precache_sound("weapons/m4/boltpull.wav"); + //precache_sound("weapons/m4/clipin.wav"); + //precache_sound("weapons/m4/clipout.wav"); + precache_sound("weapons/m4/m4-fire-sil.wav"); + precache_sound("weapons/m4/m4-fire.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_m4a1_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string @@ -211,9 +185,9 @@ w_m4a1_primary(void) } if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - TS_Weapons_PlaySoundDirect(pl, "weapons/m4/m4-fire.wav"); + SoundPitched_Send(pl, SNDP_M4A1_FIRE); } else { - TS_Weapons_PlaySoundDirect(pl, "weapons/m4/m4-fire-sil.wav"); + SoundPitched_Send(pl, SNDP_M4A1_FIRE_SIL); } if(!arg_thisWeapon.iIronSight){ @@ -303,8 +277,6 @@ w_m4a1_reload(void) weapon_ironsight_Reload(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::M4A1], arg_thisWeapon); } - -// ??? float w_m4a1_aimanim(void) { @@ -321,8 +293,6 @@ w_m4a1_hud(void) } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_m4a1_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_m60.qc b/src/shared/weapons/weapon_m60.qc index 52e56e3..b987a4b 100644 --- a/src/shared/weapons/weapon_m60.qc +++ b/src/shared/weapons/weapon_m60.qc @@ -7,47 +7,18 @@ enum weaponseq_m60{ reload }; - -BOOLEAN weapon_M60_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; +void weapon_m60_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ } -BOOLEAN weapon_M60_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - //most weapons don't care about releases. Also this only happens the one frame the input is detected - //not held after being held continuously - further logic should be handled in a think method. - return FALSE; +void weapon_m60_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ } -BOOLEAN weapon_M60_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - - return FALSE; +void weapon_m60_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::M60], arg_thisWeapon); } -BOOLEAN weapon_M60_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - //most weapons don't care about releases. Also this only happens the one frame the input is detected - //not held after being held continuously - further logic should be handled in a think method. - return FALSE; -} - -void weapon_M60_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_base_onEquip(localPlayer, ary_weaponData[WEAPON_ID::M60], arg_thisWeapon); -} -BOOLEAN weapon_M60_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_M60_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::M60], arg_thisWeapon); - -} -void weapon_M60_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onDrawHUD(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::M60], arg_thisWeapon); -} -void weapon_M60_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_Reload(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::M60], arg_thisWeapon); -} -void weapon_M60_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_m60_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ } - -weapondata_gun_t weapon_M60 = +weapondata_gun_t weapon_m60 = { WEAPONDATA_TYPEID_GUN, "M60E3", @@ -56,16 +27,10 @@ weapondata_gun_t weapon_M60 = "", "models/w_m60.mdl", "sprites/weapons/m60.spr", - weapon_M60_onPrimaryAttack, - weapon_M60_onPrimaryAttackRelease, - weapon_M60_onSecondaryAttack, - weapon_M60_onSecondaryAttackRelease, - weapon_M60_onEquip, - weapon_M60_onUnEquip, - weapon_M60_onThink, - weapon_M60_onDrawHUD, - weapon_M60_onReload, - weapon_M60_onColdCock, + weapon_m60_onPrimaryAttackRelease, + weapon_m60_onSecondaryAttackRelease, + weapon_m60_onThink, + weapon_m60_onColdCock, weaponseq_m60::idle, weaponseq_m60::draw, 31.0f / 33.0f, @@ -82,7 +47,7 @@ weapondata_gun_t weapon_M60 = WEAPON_AKIMBO_UPGRADE_ID::NONE, BITS_FIREMODE_FULL, BITS_FIREMODE_FULL, - AMMO_ID::_5p56Nato, + AMMO_ID::_5P56NATO, 100, //clip 4096, //range weaponseq_m60::reload, @@ -95,28 +60,24 @@ weapondata_gun_t weapon_M60 = - void w_m60_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::M60]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + //precache_sound("weapons/m60/ammo_belt.wav"); + //precache_sound("weapons/m60/boltpull.wav"); + //precache_sound("weapons/m60/close.wav"); + precache_sound("weapons/m60/m60-fire.wav"); + //precache_sound("weapons/m60/open.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_m60_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string @@ -169,7 +130,7 @@ w_m60_primary(void) return; } - TS_Weapons_PlaySoundDirect(pl, "weapons/m60/m60-fire.wav"); + SoundPitched_Send(pl, SNDP_M60_FIRE); randomChoice = random(); if(randomChoice < 0.5){ @@ -212,7 +173,6 @@ w_m60_reload(void) } -// ??? float w_m60_aimanim(void) { @@ -229,8 +189,6 @@ w_m60_hud(void) } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_m60_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_m61grenade.qc b/src/shared/weapons/weapon_m61grenade.qc index 99f8e3d..da5147e 100644 --- a/src/shared/weapons/weapon_m61grenade.qc +++ b/src/shared/weapons/weapon_m61grenade.qc @@ -7,43 +7,27 @@ enum weaponseq_m61grenade{ throw_slide }; -BOOLEAN weapon_grenade_onInputPress(player localPlayer, weapondynamic_t arg_thisWeapon, int attackTypeUsed); -//BOOLEAN weapon_grenade_onInputRelease(player localPlayer, weapondynamic_t arg_thisWeapon); +BOOL weapon_grenade_onInputPress(player pl, weapondynamic_t arg_thisWeapon, int attackTypeUsed); +//BOOL weapon_grenade_onInputRelease(player pl, weapondynamic_t arg_thisWeapon); -BOOLEAN weapon_M61Grenade_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_M61Grenade_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_M61Grenade_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_M61Grenade_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} - - - -void weapon_M61Grenade_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_m61grenade_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ } -BOOLEAN weapon_M61Grenade_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; +void weapon_m61grenade_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } - //Serverside only method, generates an entity #ifdef SERVER -static void weapon_M61Grenade_Touch( void ); -static void weapon_M61Grenade_Explode( void ); +static void weapon_m61grenade_Touch( void ); +static void weapon_m61grenade_Explode( void ); -void weapon_M61Grenade_spawnProjectile(player pl, weapondynamic_t arg_thisWeapon, BOOL wasToss, float heldDuration){ +void weapon_m61grenade_spawnProjectile(player pl, weapondynamic_t arg_thisWeapon, BOOL wasToss, float heldDuration){ - weapondata_throwable_t basicRef = *((weapondata_throwable_t*)ary_weaponData[WEAPON_ID::M61Grenade]); + weapondata_throwable_t basicRef = *((weapondata_throwable_t*)ary_weaponData[WEAPON_ID::M61GRENADE]); makevectors( GET_VIEW_ANGLES ); entity eNade = spawn(); @@ -64,16 +48,16 @@ void weapon_M61Grenade_spawnProjectile(player pl, weapondynamic_t arg_thisWeapon eNade.avelocity = ( v_forward * 1000 ); eNade.movetype = MOVETYPE_BOUNCE; - eNade.touch = weapon_M61Grenade_Touch; + eNade.touch = weapon_m61grenade_Touch; eNade.gravity = 0.5f; - eNade.think = weapon_M61Grenade_Explode; + eNade.think = weapon_m61grenade_Explode; eNade.nextthink = time + 3.0f; } -static void weapon_M61Grenade_Touch( void ) { +static void weapon_m61grenade_Touch( void ) { float randomChoice; if ( other.solid == SOLID_TRIGGER ) { return; @@ -84,7 +68,7 @@ static void weapon_M61Grenade_Touch( void ) { if ( ( other.classname == "func_breakable" ) && ( other.material == GSMATERIAL_GLASS ) ) { // this means, insta-break the breakable glass we hit. // Calling this BLUNT I guess? The grenade is really a rock at this point. - Damage_Apply( other, self.owner, other.health, WEAPON_ID::M61Grenade, DMG_BLUNT); + Damage_Apply( other, self.owner, other.health, WEAPON_ID::M61GRENADE, DMG_BLUNT); } randomChoice = random(); @@ -100,13 +84,13 @@ static void weapon_M61Grenade_Touch( void ) { } -static void weapon_M61Grenade_Explode( void ) { +static void weapon_m61grenade_Explode( void ) { float randomChoice; - //!!! THIS IS THE COUNTERSTIKRE EFFECT. - //Comment/uncomment as needed. - //...we redirect this to the new lines for TS. Easier to keep - //the change to env_explosion and func_breakables that explode. + //!!! THIS IS THE COUNTERSTRIKE EFFECT. + // Comment/uncomment as needed. + // we redirect this to the new lines for TS. Easier to keep + // the change to env_explosion and func_breakables that explode. Effect_CreateExplosion( self.origin ); //Effect_ScreenShake( self.origin, 2048, 255 ); @@ -116,28 +100,28 @@ static void weapon_M61Grenade_Explode( void ) { // 150 health from a powerup, and takes 100 down to 20 from a good distance. // CHANGE! Don't we want to tell who attacked (who threw the grenade), not just give // the grenade itself for the 2nd "eAttacker" parameter? - Damage_Radius( self.origin, self.owner, 160, 380, TRUE, WEAPON_ID::M61Grenade ); - //Damage_Radius( self.origin, self, 75, 550, TRUE, WEAPON_ID::M61Grenade ); + Damage_Radius( self.origin, self.owner, 160, 380, TRUE, WEAPON_ID::M61GRENADE ); + //Damage_Radius( self.origin, self, 75, 550, TRUE, WEAPON_ID::M61GRENADE ); - //Damage_Apply(other, this, m_iDamage, WEAPON_ID::M61Grenade, DMG_GENERIC); + //Damage_Apply(other, this, m_iDamage, WEAPON_ID::M61GRENADE, DMG_GENERIC); // this is mad old //Damage_Apply(plPlayer, world, plPlayer.dmg, DAMAGE_DROWNING, WEAPON_NONE); //Damage_Apply(target, world, 5, DMG_DROWN, 0); - + //Damage_Apply( self, world, fFallDamage, 0, DMG_FALL); - + randomChoice = random(); if(randomChoice < 0.2){ - sound(self, CHAN_WEAPON, "explo/explode.wav", 1, ATTN_NORM); + SoundPitched_Send(self, SNDP_EXPLODE); }else if(randomChoice < 0.4){ - sound(self, CHAN_WEAPON, "explo/explode1.wav", 1, ATTN_NORM); + SoundPitched_Send(self, SNDP_EXPLODE1); }else if(randomChoice < 0.6){ - sound(self, CHAN_WEAPON, "explo/explode2.wav", 1, ATTN_NORM); + SoundPitched_Send(self, SNDP_EXPLODE2); }else if(randomChoice < 0.8){ - sound(self, CHAN_WEAPON, "explo/explode3.wav", 1, ATTN_NORM); + SoundPitched_Send(self, SNDP_EXPLODE3); }else{ - sound(self, CHAN_WEAPON, "explo/explode4.wav", 1, ATTN_NORM); + SoundPitched_Send(self, SNDP_EXPLODE4); } // delay this so damage indicators can figure out where I came from! @@ -148,8 +132,7 @@ static void weapon_M61Grenade_Explode( void ) { #endif -void weapon_M61Grenade_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - player pl = localPlayer; +void weapon_m61grenade_onThink(player pl, weapondynamic_t arg_thisWeapon){ // WARNING!!! // grenadeHeldDuration is not networked! It counts up faster for the client than the server. @@ -171,7 +154,7 @@ void weapon_M61Grenade_onThink(player localPlayer, weapondynamic_t arg_thisWeapo pl.grenadeSpawnTime = -1; #ifdef SERVER - weapon_M61Grenade_spawnProjectile(localPlayer, arg_thisWeapon, pl.grenadeToss, pl.grenadeHeldDuration); + weapon_m61grenade_spawnProjectile(pl, arg_thisWeapon, pl.grenadeToss, pl.grenadeHeldDuration); #endif } } @@ -248,15 +231,12 @@ void weapon_M61Grenade_onThink(player localPlayer, weapondynamic_t arg_thisWeapo } } -void weapon_M61Grenade_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_M61Grenade_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_M61Grenade_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ + +void weapon_m61grenade_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ } -weapondata_throwable_t weapon_M61Grenade = +weapondata_throwable_t weapon_m61grenade = { WEAPONDATA_TYPEID_THROWABLE, "M61 Grenade", @@ -265,21 +245,15 @@ weapondata_throwable_t weapon_M61Grenade = "", "models/w_m61.mdl", "sprites/weapons/m61.spr", - weapon_M61Grenade_onPrimaryAttack, - weapon_M61Grenade_onPrimaryAttackRelease, - weapon_M61Grenade_onSecondaryAttack, - weapon_M61Grenade_onSecondaryAttackRelease, - weapon_M61Grenade_onEquip, - weapon_M61Grenade_onUnEquip, - weapon_M61Grenade_onThink, - weapon_M61Grenade_onDrawHUD, - weapon_M61Grenade_onReload, - weapon_M61Grenade_onColdCock, + weapon_m61grenade_onPrimaryAttackRelease, + weapon_m61grenade_onSecondaryAttackRelease, + weapon_m61grenade_onThink, + weapon_m61grenade_onColdCock, weaponseq_m61grenade::idle, weaponseq_m61grenade::draw, 31.0f / 40.0f, - 0.5, //fire delay. this is most certainly wrong. find something more accurate later. - 8.0f, //dmg + 0.5, //fire delay + 8.0f, //dmg (what) FALSE, BITS_WEAPONOPT_FULLLOAD, BITS_WEAPONOPT_NONE, @@ -295,8 +269,7 @@ weapondata_throwable_t weapon_M61Grenade = -BOOLEAN weapon_grenade_onInputPress(player localPlayer, weapondynamic_t arg_thisWeapon, int attackTypeUsed){ - player pl = localPlayer; +BOOL weapon_grenade_onInputPress(player pl, weapondynamic_t arg_thisWeapon, int attackTypeUsed){ if(arg_thisWeapon.iCount == 0){ // what. how. @@ -342,8 +315,7 @@ BOOLEAN weapon_grenade_onInputPress(player localPlayer, weapondynamic_t arg_this // It makes far more sense to just check for either input still being held-down in the think // method during the pullpin grenade phase. /* -BOOLEAN weapon_grenade_onInputRelease(player localPlayer, weapondynamic_t arg_thisWeapon){ - player pl = localPlayer; +BOOLEAN weapon_grenade_onInputRelease(player pl, weapondynamic_t arg_thisWeapon){ if(pl.w_attack_next > 0){ // wait for w_attack_next to expire before doing logic against grenadeFireIndex choice // (except above, checks a bit differently for spawning the grenade) @@ -364,15 +336,14 @@ BOOLEAN weapon_grenade_onInputRelease(player localPlayer, weapondynamic_t arg_th void w_m61grenade_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::M61GRENADE]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + // grenade-bounce and explode ones are done globally, I could see those + // being re-used + //precache_sound("weapons/gr_pull.wav"); + //precache_sound("weapons/gr_safe.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } @@ -385,13 +356,13 @@ w_m61grenade_updateammo(player pl) string w_m61grenade_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::M61Grenade]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::M61GRENADE]).sWorldModelPath; } string w_m61grenade_pmodel(void) { - return (*ary_weaponData[WEAPON_ID::M61Grenade]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::M61GRENADE]).sPlayerModelPath; } string @@ -411,7 +382,7 @@ w_m61grenade_draw(void) pl.grenadeSpawnTime = -1; pl.grenadeHeldDuration = 0; - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::M61Grenade], arg_thisWeapon); + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::M61GRENADE], arg_thisWeapon); } void @@ -441,7 +412,6 @@ w_m61grenade_reload(void) } -// ??? float w_m61grenade_aimanim(void) { @@ -454,11 +424,9 @@ w_m61grenade_hud(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_throwable_onDrawHUD(pl, (weapondata_throwable_t*)ary_weaponData[WEAPON_ID::M61Grenade], arg_thisWeapon); + weapon_throwable_onDrawHUD(pl, (weapondata_throwable_t*)ary_weaponData[WEAPON_ID::M61GRENADE], arg_thisWeapon); } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_m61grenade_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_mac10.qc b/src/shared/weapons/weapon_mac10.qc index d37cdd6..911e3cd 100644 --- a/src/shared/weapons/weapon_mac10.qc +++ b/src/shared/weapons/weapon_mac10.qc @@ -18,41 +18,23 @@ enum weaponseq_mac10{ sshootb, sshootb2, sshootb3, - reload_2 //RENAMED... really guys, identical name. + reload_2 //RENAMED. Identical sequence name in model }; - -BOOLEAN weapon_MAC10_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; +void weapon_mac10_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_MAC10_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_mac10_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_MAC10_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_mac10_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MAC10], arg_thisWeapon); } -BOOLEAN weapon_MAC10_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} - -void weapon_MAC10_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_MAC10_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_MAC10_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MAC10], arg_thisWeapon); -} -void weapon_MAC10_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_MAC10_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_MAC10_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_mac10_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ } - -weapondata_ironsight_t weapon_MAC10 = +weapondata_ironsight_t weapon_mac10 = { WEAPONDATA_TYPEID_IRONSIGHT, "MAC10", @@ -61,16 +43,10 @@ weapondata_ironsight_t weapon_MAC10 = "models/p_mac10_sil.mdl", "models/w_mac10.mdl", "sprites/weapons/mac10.spr", - weapon_MAC10_onPrimaryAttack, - weapon_MAC10_onPrimaryAttackRelease, - weapon_MAC10_onSecondaryAttack, - weapon_MAC10_onSecondaryAttackRelease, - weapon_MAC10_onEquip, - weapon_MAC10_onUnEquip, - weapon_MAC10_onThink, - weapon_MAC10_onDrawHUD, - weapon_MAC10_onReload, - weapon_MAC10_onColdCock, + weapon_mac10_onPrimaryAttackRelease, + weapon_mac10_onSecondaryAttackRelease, + weapon_mac10_onThink, + weapon_mac10_onColdCock, weaponseq_mac10::idle, weaponseq_mac10::draw, 31.0f / 30.0f, @@ -87,7 +63,7 @@ weapondata_ironsight_t weapon_MAC10 = WEAPON_AKIMBO_UPGRADE_ID::NONE, BITS_FIREMODE_FULL | BITS_FIREMODE_SEMI, BITS_FIREMODE_FULL, - AMMO_ID::_45Acp, + AMMO_ID::_45ACP, 32, //clip 4096, //range weaponseq_mac10::reload, @@ -110,30 +86,24 @@ weapondata_ironsight_t weapon_MAC10 = - - - void w_mac10_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::MAC10]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + //precache_sound("weapons/mac10/clipin.wav"); + //precache_sound("weapons/mac10/clipout.wav"); + precache_sound("weapons/mac10/mac10-fire-sil.wav"); + precache_sound("weapons/mac10/mac10-fire.wav"); + //precache_sound("weapons/mac10/slideback.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_mac10_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string @@ -196,9 +166,9 @@ w_mac10_primary(void) } if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - TS_Weapons_PlaySoundDirect(pl, "weapons/mac10/mac10-fire.wav"); + SoundPitched_Send(pl, SNDP_MAC10_FIRE); } else { - TS_Weapons_PlaySoundDirect(pl, "weapons/mac10/mac10-fire-sil.wav"); + SoundPitched_Send(pl, SNDP_MAC10_FIRE_SIL); } if(!arg_thisWeapon.iIronSight){ @@ -277,8 +247,6 @@ w_mac10_reload(void) weapon_ironsight_Reload(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::MAC10], arg_thisWeapon); } - -// ??? float w_mac10_aimanim(void) { @@ -295,8 +263,6 @@ w_mac10_hud(void) } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_mac10_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_miniuzi.qc b/src/shared/weapons/weapon_miniuzi.qc index d36ae5d..23e415b 100644 --- a/src/shared/weapons/weapon_miniuzi.qc +++ b/src/shared/weapons/weapon_miniuzi.qc @@ -7,54 +7,33 @@ enum weaponseq_miniuzi{ shoot2 = 4, sshoot = 5, sshoot2 = 6, - //idle for ironsight fire (holding from left). why not "idleb"? who knows + // idle for ironsight fire (holding from left). why not "idleb"? idle2 = 7, change = 8, rechange = 9, - //names further given "b"'s for separation, lacking in the actual sequence names + // names further given "b"'s for separation, lacking in model sequence names shootb = 10, shootb2 = 11, sshootb = 12, sshootb2 = 13, - //except this, came with the "b" + // except this, came with the "b" reloadb = 14 }; - - - -BOOLEAN weapon_MiniUzi_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; +void weapon_miniuzi_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_MiniUzi_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_miniuzi_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_MiniUzi_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return weapon_ironsight_ToggleIronsight(localPlayer, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::MiniUzi], arg_thisWeapon); +void weapon_miniuzi_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MINIUZI], arg_thisWeapon); } -BOOLEAN weapon_MiniUzi_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} - -void weapon_MiniUzi_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_MiniUzi_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_MiniUzi_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MiniUzi], arg_thisWeapon); -} -void weapon_MiniUzi_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_MiniUzi_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_MiniUzi_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_miniuzi_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ } - - -weapondata_ironsight_t weapon_MiniUzi = +weapondata_ironsight_t weapon_miniuzi = { WEAPONDATA_TYPEID_IRONSIGHT, "Mini-Uzi", @@ -63,16 +42,10 @@ weapondata_ironsight_t weapon_MiniUzi = "models/p_uzi_sil.mdl", "models/w_uzi.mdl", "sprites/weapons/uzi.spr", - weapon_MiniUzi_onPrimaryAttack, - weapon_MiniUzi_onPrimaryAttackRelease, - weapon_MiniUzi_onSecondaryAttack, - weapon_MiniUzi_onSecondaryAttackRelease, - weapon_MiniUzi_onEquip, - weapon_MiniUzi_onUnEquip, - weapon_MiniUzi_onThink, - weapon_MiniUzi_onDrawHUD, - weapon_MiniUzi_onReload, - weapon_MiniUzi_onColdCock, + weapon_miniuzi_onPrimaryAttackRelease, + weapon_miniuzi_onSecondaryAttackRelease, + weapon_miniuzi_onThink, + weapon_miniuzi_onColdCock, weaponseq_miniuzi::idle, weaponseq_miniuzi::draw, 31.0f / 30.0f, @@ -86,10 +59,10 @@ weapondata_ironsight_t weapon_MiniUzi = BUYCATEGORY_SMGS, 3, {0.030000, 2.000000, 0.005000}, - WEAPON_AKIMBO_UPGRADE_ID::MiniUzi, + WEAPON_AKIMBO_UPGRADE_ID::MINIUZI, BITS_FIREMODE_FULL | BITS_FIREMODE_SEMI, BITS_FIREMODE_FULL, - AMMO_ID::_9x19mm, + AMMO_ID::_9X19MM, 32, //clip 4096, //range weaponseq_miniuzi::reload, @@ -115,30 +88,27 @@ weapondata_ironsight_t weapon_MiniUzi = void w_miniuzi_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::MINIUZI]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + //precache_sound("weapons/uzi/clipin.wav"); + //precache_sound("weapons/uzi/clipout.wav"); + //precache_sound("weapons/uzi/slideback.wav"); + precache_sound("weapons/uzi/uzi-fire-sil.wav"); + precache_sound("weapons/uzi/uzi-fire.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_miniuzi_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string w_miniuzi_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::MiniUzi]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::MINIUZI]).sWorldModelPath; } string @@ -148,9 +118,9 @@ w_miniuzi_pmodel(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - return (*ary_weaponData[WEAPON_ID::MiniUzi]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::MINIUZI]).sPlayerModelPath; } else { - return (*ary_weaponData[WEAPON_ID::MiniUzi]).sPlayerSilencerModelPath; + return (*ary_weaponData[WEAPON_ID::MINIUZI]).sPlayerSilencerModelPath; } } @@ -166,7 +136,7 @@ w_miniuzi_draw(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::MiniUzi], arg_thisWeapon); + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::MINIUZI], arg_thisWeapon); } void @@ -196,9 +166,9 @@ w_miniuzi_primary(void) } if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - TS_Weapons_PlaySoundDirect(pl, "weapons/uzi/uzi-fire.wav"); + SoundPitched_Send(pl, SNDP_MINIUZI_FIRE); } else { - TS_Weapons_PlaySoundDirect(pl, "weapons/uzi/uzi-fire-sil.wav"); + SoundPitched_Send(pl, SNDP_MINIUZI_FIRE_SIL); } if(!arg_thisWeapon.iIronSight){ @@ -230,7 +200,7 @@ w_miniuzi_primary(void) View_AddEvent(w_ejectshell_pistol, 0.0f); #endif - weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::MiniUzi], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); + weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::MINIUZI], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[arg_thisWeapon.weaponID]).fAttackDelay); @@ -255,7 +225,7 @@ w_miniuzi_secondary(void) INPUT_SECONDARY_TAP_GATE - weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::MiniUzi], arg_thisWeapon); + weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::MINIUZI], arg_thisWeapon); } @@ -265,11 +235,10 @@ w_miniuzi_reload(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_ironsight_Reload(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::MiniUzi], arg_thisWeapon); + weapon_ironsight_Reload(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::MINIUZI], arg_thisWeapon); } -// ??? float w_miniuzi_aimanim(void) { @@ -281,12 +250,10 @@ w_miniuzi_hud(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MiniUzi], arg_thisWeapon); + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MINIUZI], arg_thisWeapon); } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_miniuzi_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_miniuzi_akimbo.qc b/src/shared/weapons/weapon_miniuzi_akimbo.qc index 554346b..ea63be4 100644 --- a/src/shared/weapons/weapon_miniuzi_akimbo.qc +++ b/src/shared/weapons/weapon_miniuzi_akimbo.qc @@ -1,7 +1,5 @@ - enum weaponseq_miniuzi_akimbo{ - //... akimbo_idle = 0, side_idle = 1, left_idle = 2, @@ -30,39 +28,21 @@ enum weaponseq_miniuzi_akimbo{ akimbo_left_shoot = 25 }; - - -BOOLEAN weapon_MiniUzi_akimbo_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; +void weapon_miniuzi_akimbo_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_MiniUzi_akimbo_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_miniuzi_akimbo_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_MiniUzi_akimbo_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_miniuzi_akimbo_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MINIUZI_AKIMBO], arg_thisWeapon); } -BOOLEAN weapon_MiniUzi_akimbo_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -void weapon_MiniUzi_akimbo_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_MiniUzi_akimbo_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_MiniUzi_akimbo_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MiniUzi_akimbo], arg_thisWeapon); -} -void weapon_MiniUzi_akimbo_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_MiniUzi_akimbo_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_MiniUzi_akimbo_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_miniuzi_akimbo_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ } - -//weapondata_ironsight_t weapon_MiniUzi_akimbo = -weapondata_gun_t weapon_MiniUzi_akimbo = +//weapondata_ironsight_t weapon_miniuzi_akimbo = +weapondata_gun_t weapon_miniuzi_akimbo = { WEAPONDATA_TYPEID_GUN, "Akimbo Mini-Uzi", @@ -71,16 +51,10 @@ weapondata_gun_t weapon_MiniUzi_akimbo = "models/p_uzi_akimbo_sil.mdl", "models/w_uzi.mdl", "sprites/weapons/uzi_akimbo.spr", - weapon_MiniUzi_akimbo_onPrimaryAttack, - weapon_MiniUzi_akimbo_onPrimaryAttackRelease, - weapon_MiniUzi_akimbo_onSecondaryAttack, - weapon_MiniUzi_akimbo_onSecondaryAttackRelease, - weapon_MiniUzi_akimbo_onEquip, - weapon_MiniUzi_akimbo_onUnEquip, - weapon_MiniUzi_akimbo_onThink, - weapon_MiniUzi_akimbo_onDrawHUD, - weapon_MiniUzi_akimbo_onReload, - weapon_MiniUzi_akimbo_onColdCock, + weapon_miniuzi_akimbo_onPrimaryAttackRelease, + weapon_miniuzi_akimbo_onSecondaryAttackRelease, + weapon_miniuzi_akimbo_onThink, + weapon_miniuzi_akimbo_onColdCock, weaponseq_miniuzi_akimbo::akimbo_idle, weaponseq_miniuzi_akimbo::akimbo_draw, 31.0f / 35.0f, @@ -94,10 +68,10 @@ weapondata_gun_t weapon_MiniUzi_akimbo = BUYCATEGORY_SMGS, 5, {0.030000, 2.000000, 0.005000}, - -WEAPON_ID::MiniUzi, + -WEAPON_ID::MINIUZI, BITS_FIREMODE_AKIMBO_FULL_AUTO | BITS_FIREMODE_AKIMBO_FREE_FULL, BITS_FIREMODE_AKIMBO_FULL_AUTO, - AMMO_ID::_9x19mm, + AMMO_ID::_9X19MM, 32, //clip 4096, //range weaponseq_miniuzi_akimbo::akimbo_reload, @@ -124,30 +98,23 @@ weapondata_gun_t weapon_MiniUzi_akimbo = void w_miniuzi_akimbo_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::MINIUZI_AKIMBO]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + // assume the singular variant has handled sounds. #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_miniuzi_akimbo_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string w_miniuzi_akimbo_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::MiniUzi_akimbo]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::MINIUZI_AKIMBO]).sWorldModelPath; } string @@ -157,9 +124,9 @@ w_miniuzi_akimbo_pmodel(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - return (*ary_weaponData[WEAPON_ID::MiniUzi_akimbo]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::MINIUZI_AKIMBO]).sPlayerModelPath; } else { - return (*ary_weaponData[WEAPON_ID::MiniUzi_akimbo]).sPlayerSilencerModelPath; + return (*ary_weaponData[WEAPON_ID::MINIUZI_AKIMBO]).sPlayerSilencerModelPath; } } @@ -174,7 +141,7 @@ w_miniuzi_akimbo_draw(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::MiniUzi_akimbo], arg_thisWeapon); + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::MINIUZI_AKIMBO], arg_thisWeapon); } void @@ -191,9 +158,8 @@ w_miniuzi_akimbo_holster(void) // Akimbo weapons consistently. // Putting it here avoids duplicating a bunch of code. // Also, "attackTypeUsed" is whether primary (FALSE) or secondary (TRUE) lead to this point. -BOOLEAN weapon_MiniUzi_akimbo_attack(player localPlayer, weapondynamic_t arg_thisWeapon, int attackTypeUsed){ +BOOLEAN weapon_miniuzi_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, int attackTypeUsed){ float randomChoice; - player pl = localPlayer; int finalAkimboChoice = BITS_AKIMBOCHOICE_NONE; //default // NOTE! weapon_akimbo_semiAttackChoice already handles telling to skip firing if @@ -204,7 +170,7 @@ BOOLEAN weapon_MiniUzi_akimbo_attack(player localPlayer, weapondynamic_t arg_thi // Muzzle flashes and shell ejections for akimbo pending! //because I am not copy/pasting this monstrosity 5 times. - finalAkimboChoice = weapon_akimbo_fullAttackChoice(localPlayer, ary_weaponData[WEAPON_ID::MiniUzi_akimbo], arg_thisWeapon, attackTypeUsed); + finalAkimboChoice = weapon_akimbo_fullAttackChoice(pl, ary_weaponData[WEAPON_ID::MINIUZI_AKIMBO], arg_thisWeapon, attackTypeUsed); SAVE_STATE(pl.nextAkimboAttackPreference); @@ -245,21 +211,21 @@ BOOLEAN weapon_MiniUzi_akimbo_attack(player localPlayer, weapondynamic_t arg_thi // sudden dual-fire request though. int effectiveAkimboChoice = finalAkimboChoice & ~pl.akimboTest; //finalAkimboChoice;//BITS_AKIMBOCHOICE_NONE & ~pl.akimboTest - weapon_base_onAttack(localPlayer, ary_weaponData[WEAPON_ID::MiniUzi_akimbo], arg_thisWeapon, effectiveAkimboChoice); + weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::MINIUZI_AKIMBO], arg_thisWeapon, effectiveAkimboChoice); if(effectiveAkimboChoice & BITS_AKIMBOCHOICE_LEFT){ if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - TS_Weapons_PlaySoundDirect(pl, "weapons/uzi/uzi-fire.wav"); + SoundPitched_Send(pl, SNDP_MINIUZI_FIRE); } else { - TS_Weapons_PlaySoundDirect(pl, "weapons/uzi/uzi-fire-sil.wav"); + SoundPitched_Send(pl, SNDP_MINIUZI_FIRE_SIL); } } if(effectiveAkimboChoice & BITS_AKIMBOCHOICE_RIGHT){ if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - TS_Weapons_PlaySoundDirect(pl, "weapons/uzi/uzi-fire.wav"); + SoundPitched_Send(pl, SNDP_MINIUZI_FIRE); } else { - TS_Weapons_PlaySoundDirect(pl, "weapons/uzi/uzi-fire-sil.wav"); + SoundPitched_Send(pl, SNDP_MINIUZI_FIRE_SIL); } } @@ -314,7 +280,7 @@ BOOLEAN weapon_MiniUzi_akimbo_attack(player localPlayer, weapondynamic_t arg_thi } return TRUE; -}//END OF weapon_MiniUzi_akimbo_attack +}//END OF weapon_miniuzi_akimbo_attack void @@ -326,9 +292,9 @@ w_miniuzi_akimbo_primary(void) pl.akimboTest = 0; if(input_buttons & INPUT_BUTTON3){ - weapon_MiniUzi_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_BOTH); + weapon_miniuzi_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_BOTH); }else{ - weapon_MiniUzi_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); + weapon_miniuzi_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); } } @@ -344,7 +310,7 @@ w_miniuzi_akimbo_secondary(void) pl.akimboTest = 0; if(arg_thisWeapon.iFireModeAkimbo == BITS_FIREMODE_AKIMBO_FREE_FULL){ - weapon_MiniUzi_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT); + weapon_miniuzi_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT); //pl.akimboFirePrev = BITS_AKIMBOCHOICE_RIGHT; } } @@ -356,12 +322,11 @@ w_miniuzi_akimbo_reload(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MiniUzi_akimbo], arg_thisWeapon); + weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MINIUZI_AKIMBO], arg_thisWeapon); } -// ??? float w_miniuzi_akimbo_aimanim(void) { @@ -374,12 +339,10 @@ w_miniuzi_akimbo_hud(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MiniUzi_akimbo], arg_thisWeapon); + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MINIUZI_AKIMBO], arg_thisWeapon); } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_miniuzi_akimbo_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_mossberg500.qc b/src/shared/weapons/weapon_mossberg500.qc index 1acd896..e0d80a6 100644 --- a/src/shared/weapons/weapon_mossberg500.qc +++ b/src/shared/weapons/weapon_mossberg500.qc @@ -18,40 +18,21 @@ enum weaponseq_mossberg500{ reload3b }; - -BOOLEAN weapon_Mossberg500_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; +void weapon_mossberg500_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_Mossberg500_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_Mossberg500_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_Mossberg500_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} - -void weapon_Mossberg500_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_Mossberg500_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_Mossberg500_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - //weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Mossberg500], arg_thisWeapon); - weapon_shotgun_onThink_reloadLogic(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Mossberg500], arg_thisWeapon); -} -void weapon_Mossberg500_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onDrawHUD(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Mossberg500], arg_thisWeapon); -} -void weapon_Mossberg500_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_Mossberg500_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_mossberg500_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ } +void weapon_mossberg500_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_shotgun_onThink_reloadLogic(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MOSSBERG500], arg_thisWeapon); +} +void weapon_mossberg500_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ -weapondata_ironsight_t weapon_Mossberg500 = +} + +weapondata_ironsight_t weapon_mossberg500 = { WEAPONDATA_TYPEID_IRONSIGHT, "Mossberg 500", @@ -60,16 +41,10 @@ weapondata_ironsight_t weapon_Mossberg500 = "", "models/w_mossberg.mdl", "sprites/weapons/mossberg.spr", - weapon_Mossberg500_onPrimaryAttack, - weapon_Mossberg500_onPrimaryAttackRelease, - weapon_Mossberg500_onSecondaryAttack, - weapon_Mossberg500_onSecondaryAttackRelease, - weapon_Mossberg500_onEquip, - weapon_Mossberg500_onUnEquip, - weapon_Mossberg500_onThink, - weapon_Mossberg500_onDrawHUD, - weapon_Mossberg500_onReload, - weapon_Mossberg500_onColdCock, + weapon_mossberg500_onPrimaryAttackRelease, + weapon_mossberg500_onSecondaryAttackRelease, + weapon_mossberg500_onThink, + weapon_mossberg500_onColdCock, weaponseq_mossberg500::idle, weaponseq_mossberg500::draw, 31.0f / 35.0f, @@ -110,37 +85,50 @@ weapondata_ironsight_t weapon_Mossberg500 = } }; - +weapondata_shotgun_extra_t weapon_mossberg500_shotgunExtra = +{ + weaponseq_mossberg500::reload1, + 21.0f/40.0f, + weaponseq_mossberg500::reload2, + 21.0f/50.0f, + 10.0f/50.0f, + weaponseq_mossberg500::reload3, + 26.0f/30.0f +}; +weapondata_shotgun_extra_t weapon_mossberg500_shotgunExtra_ironsight = +{ + weaponseq_mossberg500::reload1b, + 21.0f/40.0f, + weaponseq_mossberg500::reload2b, + 21.0f/50.0f, + 10.0f/50.0f, + weaponseq_mossberg500::reload3b, + 26.0f/30.0f +}; void w_mossberg500_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::MOSSBERG500]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + precache_sound("weapons/mossberg/fire.wav"); + // uses the benelli m3's pump sound, but that's precached there. #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_mossberg500_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string w_mossberg500_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::Mossberg500]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::MOSSBERG500]).sWorldModelPath; } string @@ -148,7 +136,7 @@ w_mossberg500_pmodel(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - return (*ary_weaponData[WEAPON_ID::Mossberg500]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::MOSSBERG500]).sPlayerModelPath; } string @@ -163,10 +151,10 @@ w_mossberg500_draw(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - // not setting shotgun stats here, save right before reload anims are called - // since being ironsight or not each gives its own set of sequences. + // not setting shotgun extra data here, done right before reload anims are called + // since being ironsight/not each has a set of sequences. - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::Mossberg500], arg_thisWeapon); + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::MOSSBERG500], arg_thisWeapon); } @@ -183,7 +171,7 @@ w_mossberg500_primary(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - if(!weapon_shotgun_onInterrupt(pl, ary_weaponData[WEAPON_ID::Mossberg500], arg_thisWeapon)){ + if(!weapon_shotgun_onInterrupt(pl, ary_weaponData[WEAPON_ID::MOSSBERG500], arg_thisWeapon)){ // no reload to interrupt? ok. }else{ // reload to interrupt? stop this. @@ -195,11 +183,6 @@ w_mossberg500_primary(void) return; } - /* - if(arg_thisWeapon.iFireMode == BITS_FIREMODE_SEMI){ - INPUT_PRIMARY_TAP_GATE - } - */ //if(arg_thisWeapon.iFireMode == BITS_FIREMODE_PUMP){ if(pl.shotgunWaitingForPump){ @@ -208,8 +191,9 @@ w_mossberg500_primary(void) // Sounds like the mossberg just re-uses the benelli m3's sound, // as the mossberg sound folder lacks a pump sound. + //SoundPitched_Channel_Send(pl, SNDP_BENELLIM3_PUMP, CHAN_AUTO); TS_Weapons_PlaySoundChannelDirect(pl, "weapons/m3/m3-pump.wav", CHAN_AUTO); - + // these pumps eject shells #ifdef CLIENT View_AddEvent(w_ejectshell_pistol, 0.0f); @@ -237,7 +221,7 @@ w_mossberg500_primary(void) return; } - TS_Weapons_PlaySoundDirect(pl, "weapons/mossberg/fire.wav"); + SoundPitched_Send(pl, SNDP_MOSSBERG500_FIRE); // the mossberg only has pump action @@ -257,7 +241,7 @@ w_mossberg500_primary(void) #endif //} - weapon_base_onAttack_multi(pl, ary_weaponData[WEAPON_ID::Mossberg500], arg_thisWeapon, 8, BITS_AKIMBOCHOICE_LEFT); + weapon_base_onAttack_multi(pl, ary_weaponData[WEAPON_ID::MOSSBERG500], arg_thisWeapon, 8, BITS_AKIMBOCHOICE_LEFT); //if(arg_thisWeapon.iFireMode == BITS_FIREMODE_PUMP){ // use the TS stats for delay. @@ -292,7 +276,7 @@ w_mossberg500_secondary(void) } */ - return weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::Mossberg500], arg_thisWeapon); + return weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::MOSSBERG500], arg_thisWeapon); } @@ -302,33 +286,15 @@ w_mossberg500_reload(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - if(!arg_thisWeapon.iIronSight){ - //shotgun reload settings: shared - pl.shotgunReload1_seq = weaponseq_mossberg500::reload1; - pl.shotgunReload1_Duration = 21/40; - pl.shotgunReload2_seq = weaponseq_mossberg500::reload2; - pl.shotgunReload2_Duration = 21/50; - pl.shotgunReload3_seq = weaponseq_mossberg500::reload3; - pl.shotgunReload3_Duration = 26/30; - pl.shotgunReload2_ammoLoadDelay = 10/50; + pl.iShotgunExtraDataID = SHOTGUN_EXTRA_ID::MOSSBERG500; }else{ - //shotgun reload settings: shared - pl.shotgunReload1_seq = weaponseq_mossberg500::reload1b; - pl.shotgunReload1_Duration = 21/40; - pl.shotgunReload2_seq = weaponseq_mossberg500::reload2b; - pl.shotgunReload2_Duration = 21/50; - pl.shotgunReload3_seq = weaponseq_mossberg500::reload3b; - pl.shotgunReload3_Duration = 26/30; - pl.shotgunReload2_ammoLoadDelay = 10/50; + pl.iShotgunExtraDataID = SHOTGUN_EXTRA_ID::MOSSBERG500_IRONSIGHT; } - - weapon_shotgun_reload(pl, ary_weaponData[WEAPON_ID::Mossberg500], arg_thisWeapon); + weapon_shotgun_reload(pl, ary_weaponData[WEAPON_ID::MOSSBERG500], arg_thisWeapon); } - -// ??? float w_mossberg500_aimanim(void) { @@ -340,12 +306,10 @@ w_mossberg500_hud(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Mossberg500], arg_thisWeapon); + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MOSSBERG500], arg_thisWeapon); } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_mossberg500_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_mp5k.qc b/src/shared/weapons/weapon_mp5k.qc index 8083e29..178d732 100644 --- a/src/shared/weapons/weapon_mp5k.qc +++ b/src/shared/weapons/weapon_mp5k.qc @@ -13,41 +13,22 @@ enum weaponseq_mp5k{ reload2 }; - - - -BOOLEAN weapon_MP5K_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; +void weapon_mp5k_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_MP5K_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_MP5K_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_MP5K_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} - -void weapon_MP5K_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_MP5K_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_MP5K_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MP5K], arg_thisWeapon); - weapon_gun_onThink_burstFireLogic(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MP5K], arg_thisWeapon); -} -void weapon_MP5K_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_MP5K_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_MP5K_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_mp5k_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ } +void weapon_mp5k_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MP5K], arg_thisWeapon); + weapon_gun_onThink_burstFireLogic(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MP5K], arg_thisWeapon); +} +void weapon_mp5k_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ + +} -weapondata_ironsight_t weapon_MP5K = +weapondata_ironsight_t weapon_mp5k = { WEAPONDATA_TYPEID_IRONSIGHT, "MP5K", @@ -56,16 +37,10 @@ weapondata_ironsight_t weapon_MP5K = "models/p_mp5k_sil.mdl", "models/w_mp5k.mdl", "sprites/weapons/mp5k.spr", - weapon_MP5K_onPrimaryAttack, - weapon_MP5K_onPrimaryAttackRelease, - weapon_MP5K_onSecondaryAttack, - weapon_MP5K_onSecondaryAttackRelease, - weapon_MP5K_onEquip, - weapon_MP5K_onUnEquip, - weapon_MP5K_onThink, - weapon_MP5K_onDrawHUD, - weapon_MP5K_onReload, - weapon_MP5K_onColdCock, + weapon_mp5k_onPrimaryAttackRelease, + weapon_mp5k_onSecondaryAttackRelease, + weapon_mp5k_onThink, + weapon_mp5k_onColdCock, weaponseq_mp5k::idle, weaponseq_mp5k::draw, 31.0f / 30.0f, @@ -82,7 +57,7 @@ weapondata_ironsight_t weapon_MP5K = WEAPON_AKIMBO_UPGRADE_ID::NONE, BITS_FIREMODE_FULL | BITS_FIREMODE_SEMI | BITS_FIREMODE_BURST, BITS_FIREMODE_FULL, - AMMO_ID::_9x19mm, + AMMO_ID::_9X19MM, 30, //clip 4096, //range weaponseq_mp5k::reload, @@ -105,30 +80,21 @@ weapondata_ironsight_t weapon_MP5K = - - - void w_mp5k_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::MP5K]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + precache_sound("weapons/mp5k/mp5k-fire-sil.wav"); + precache_sound("weapons/mp5k/mp5k-fire.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_mp5k_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string @@ -191,9 +157,9 @@ w_mp5k_primary(void) } if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - TS_Weapons_PlaySoundDirect(pl, "weapons/mp5k/mp5k-fire.wav"); + SoundPitched_Send(pl, SNDP_MP5K_FIRE); } else { - TS_Weapons_PlaySoundDirect(pl, "weapons/mp5k/mp5k-fire-sil.wav"); + SoundPitched_Send(pl, SNDP_MP5K_FIRE_SIL); } if(!arg_thisWeapon.iIronSight){ @@ -286,8 +252,6 @@ w_mp5k_reload(void) weapon_ironsight_Reload(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::MP5K], arg_thisWeapon); } - -// ??? float w_mp5k_aimanim(void) { @@ -304,8 +268,6 @@ w_mp5k_hud(void) } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_mp5k_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_mp5sd.qc b/src/shared/weapons/weapon_mp5sd.qc index 2af7cfd..eb1fafd 100644 --- a/src/shared/weapons/weapon_mp5sd.qc +++ b/src/shared/weapons/weapon_mp5sd.qc @@ -8,41 +8,21 @@ enum weaponseq_mp5sd{ reload }; - - -BOOLEAN weapon_MP5SD_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; -} -BOOLEAN weapon_MP5SD_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_MP5SD_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_MP5SD_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} - -void weapon_MP5SD_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_MP5SD_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_MP5SD_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MP5SD], arg_thisWeapon); - weapon_gun_onThink_burstFireLogic(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MP5SD], arg_thisWeapon); +void weapon_mp5sd_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ } -void weapon_MP5SD_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_mp5sd_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -void weapon_MP5SD_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_mp5sd_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MP5SD], arg_thisWeapon); + weapon_gun_onThink_burstFireLogic(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MP5SD], arg_thisWeapon); } -void weapon_MP5SD_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_mp5sd_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ } - -weapondata_gun_t weapon_MP5SD = +weapondata_gun_t weapon_mp5sd = { WEAPONDATA_TYPEID_GUN, "MP5 SD", @@ -51,16 +31,10 @@ weapondata_gun_t weapon_MP5SD = "", "models/w_mp5sd.mdl", "sprites/weapons/mp5sd.spr", - weapon_MP5SD_onPrimaryAttack, - weapon_MP5SD_onPrimaryAttackRelease, - weapon_MP5SD_onSecondaryAttack, - weapon_MP5SD_onSecondaryAttackRelease, - weapon_MP5SD_onEquip, - weapon_MP5SD_onUnEquip, - weapon_MP5SD_onThink, - weapon_MP5SD_onDrawHUD, - weapon_MP5SD_onReload, - weapon_MP5SD_onColdCock, + weapon_mp5sd_onPrimaryAttackRelease, + weapon_mp5sd_onSecondaryAttackRelease, + weapon_mp5sd_onThink, + weapon_mp5sd_onColdCock, weaponseq_mp5sd::idle, weaponseq_mp5sd::draw, 31.0f / 30.0f, @@ -77,7 +51,7 @@ weapondata_gun_t weapon_MP5SD = WEAPON_AKIMBO_UPGRADE_ID::NONE, BITS_FIREMODE_FULL | BITS_FIREMODE_SEMI | BITS_FIREMODE_BURST, BITS_FIREMODE_FULL, - AMMO_ID::_9x19mm, + AMMO_ID::_9X19MM, 30, //clip 4096, //range weaponseq_mp5sd::reload, @@ -90,28 +64,20 @@ weapondata_gun_t weapon_MP5SD = - void w_mp5sd_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::MP5SD]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + precache_sound("weapons/mp5sd/mp5sd-fire.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_mp5sd_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string @@ -175,7 +141,7 @@ w_mp5sd_primary(void) } // silencer only! - TS_Weapons_PlaySoundDirect(pl, "weapons/mp5sd/mp5sd-fire.wav"); + SoundPitched_Send(pl, SNDP_MP5SD_FIRE); randomChoice = random(); @@ -257,8 +223,6 @@ w_mp5sd_reload(void) weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MP5SD], arg_thisWeapon); } - -// ??? float w_mp5sd_aimanim(void) { @@ -275,8 +239,6 @@ w_mp5sd_hud(void) } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_mp5sd_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_ragingbull.qc b/src/shared/weapons/weapon_ragingbull.qc index 87fe80c..267fe37 100644 --- a/src/shared/weapons/weapon_ragingbull.qc +++ b/src/shared/weapons/weapon_ragingbull.qc @@ -7,38 +7,20 @@ enum weaponseq_ragingbull{ reload }; - -BOOLEAN weapon_RagingBull_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; +void weapon_ragingbull_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_RagingBull_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_ragingbull_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_RagingBull_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_ragingbull_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::RAGINGBULL], arg_thisWeapon); } -BOOLEAN weapon_RagingBull_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -void weapon_RagingBull_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_RagingBull_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_RagingBull_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::RagingBull], arg_thisWeapon); -} -void weapon_RagingBull_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_RagingBull_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_RagingBull_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_ragingbull_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ } - - -weapondata_gun_t weapon_RagingBull = +weapondata_gun_t weapon_ragingbull = { WEAPONDATA_TYPEID_GUN, "Raging Bull", @@ -47,20 +29,14 @@ weapondata_gun_t weapon_RagingBull = "", "models/w_bull.mdl", "sprites/weapons/bull.spr", - weapon_RagingBull_onPrimaryAttack, - weapon_RagingBull_onPrimaryAttackRelease, - weapon_RagingBull_onSecondaryAttack, - weapon_RagingBull_onSecondaryAttackRelease, - weapon_RagingBull_onEquip, - weapon_RagingBull_onUnEquip, - weapon_RagingBull_onThink, - weapon_RagingBull_onDrawHUD, - weapon_RagingBull_onReload, - weapon_RagingBull_onColdCock, + weapon_ragingbull_onPrimaryAttackRelease, + weapon_ragingbull_onSecondaryAttackRelease, + weapon_ragingbull_onThink, + weapon_ragingbull_onColdCock, weaponseq_ragingbull::idle, weaponseq_ragingbull::draw, 31.0f / 33.0f, - 0.35f, //fire delay. this is most certainly wrong. find something more accurate later. + 0.35f, //fire delay 27.0f, TRUE, BITS_WEAPONOPT_LASERSIGHT | BITS_WEAPONOPT_SCOPE, @@ -73,7 +49,7 @@ weapondata_gun_t weapon_RagingBull = WEAPON_AKIMBO_UPGRADE_ID::NONE, BITS_FIREMODE_SEMI, BITS_FIREMODE_SEMI, - AMMO_ID::_p454Casull, + AMMO_ID::_P454CASULL, 5, 4096, weaponseq_ragingbull::reload, @@ -87,34 +63,31 @@ weapondata_gun_t weapon_RagingBull = - void w_ragingbull_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::RAGINGBULL]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + //precache_sound("weapons/bull/cylinderin.wav"); + //precache_sound("weapons/bull/cylinderout.wav"); + precache_sound("weapons/bull/fire01.wav"); + //precache_sound("weapons/bull/hammerback.wav"); + //precache_sound("weapons/bull/insert-shell.wav"); + //precache_sound("weapons/bull/shellsout.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_ragingbull_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string w_ragingbull_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::RagingBull]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::RAGINGBULL]).sWorldModelPath; } string @@ -122,7 +95,7 @@ w_ragingbull_pmodel(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - return (*ary_weaponData[WEAPON_ID::RagingBull]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::RAGINGBULL]).sPlayerModelPath; } string @@ -137,7 +110,7 @@ w_ragingbull_draw(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::RagingBull], arg_thisWeapon); + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::RAGINGBULL], arg_thisWeapon); } void @@ -165,7 +138,8 @@ w_ragingbull_primary(void) return; } - TS_Weapons_PlaySoundDirect(pl, "weapons/bull/fire01.wav"); + SoundPitched_Send(pl, SNDP_RAGINGBULL_FIRE); + if ( random() <= 0.5 ) { TS_Weapons_ViewAnimation(weaponseq_ragingbull::shoot, 31.0f/30.0f); } else { @@ -177,7 +151,7 @@ w_ragingbull_primary(void) View_AddEvent(w_ejectshell_pistol, 0.0f); #endif - weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::RagingBull], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); + weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::RAGINGBULL], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[arg_thisWeapon.weaponID]).fAttackDelay); @@ -229,11 +203,9 @@ w_ragingbull_reload(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::RagingBull], arg_thisWeapon); + weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::RAGINGBULL], arg_thisWeapon); } - -// ??? float w_ragingbull_aimanim(void) { @@ -246,12 +218,10 @@ w_ragingbull_hud(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::RagingBull], arg_thisWeapon); + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::RAGINGBULL], arg_thisWeapon); } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_ragingbull_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_rugermk1.qc b/src/shared/weapons/weapon_rugermk1.qc index 00218e0..05631ab 100644 --- a/src/shared/weapons/weapon_rugermk1.qc +++ b/src/shared/weapons/weapon_rugermk1.qc @@ -7,38 +7,20 @@ enum weaponseq_rugermk1{ reload }; - -BOOLEAN weapon_RugerMK1_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; +void weapon_rugermk1_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_RugerMK1_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_rugermk1_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_RugerMK1_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_rugermk1_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::RUGERMK1], arg_thisWeapon); } -BOOLEAN weapon_RugerMK1_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} - -void weapon_RugerMK1_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_RugerMK1_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_RugerMK1_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::RugerMK1], arg_thisWeapon); -} -void weapon_RugerMK1_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_RugerMK1_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_RugerMK1_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_rugermk1_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ } - -weapondata_gun_t weapon_RugerMK1 = +weapondata_gun_t weapon_rugermk1 = { WEAPONDATA_TYPEID_GUN, "Ruger-MK1", @@ -47,20 +29,14 @@ weapondata_gun_t weapon_RugerMK1 = "models/p_ruger.mdl", //NOTICE - only ever has a silencer, so this never got a separate model (has it here) "models/w_ruger.mdl", "sprites/weapons/ruger.spr", - weapon_RugerMK1_onPrimaryAttack, - weapon_RugerMK1_onPrimaryAttackRelease, - weapon_RugerMK1_onSecondaryAttack, - weapon_RugerMK1_onSecondaryAttackRelease, - weapon_RugerMK1_onEquip, - weapon_RugerMK1_onUnEquip, - weapon_RugerMK1_onThink, - weapon_RugerMK1_onDrawHUD, - weapon_RugerMK1_onReload, - weapon_RugerMK1_onColdCock, + weapon_rugermk1_onPrimaryAttackRelease, + weapon_rugermk1_onSecondaryAttackRelease, + weapon_rugermk1_onThink, + weapon_rugermk1_onColdCock, weaponseq_rugermk1::idle, weaponseq_rugermk1::draw, 31.0f / 35.0f, - 0.19f, //fire delay. this is most certainly wrong. find something more accurate later. + 0.19f, //fire delay 15.0f, //dmg TRUE, BITS_WEAPONOPT_SILENCER | BITS_WEAPONOPT_LASERSIGHT, @@ -73,7 +49,7 @@ weapondata_gun_t weapon_RugerMK1 = WEAPON_AKIMBO_UPGRADE_ID::NONE, BITS_FIREMODE_SEMI, BITS_FIREMODE_SEMI, - AMMO_ID::_p22LR, + AMMO_ID::_P22LR, 17, //clip 4096, //range weaponseq_rugermk1::reload, @@ -89,30 +65,26 @@ weapondata_gun_t weapon_RugerMK1 = void w_rugermk1_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::RUGERMK1]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + //precache_sound("weapons/ruger/clipin.wav"); + //precache_sound("weapons/ruger/clipout.wav"); + precache_sound("weapons/ruger/fire.wav"); + //precache_sound("weapons/ruger/slide.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_rugermk1_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string w_rugermk1_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::RugerMK1]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::RUGERMK1]).sWorldModelPath; } string @@ -122,9 +94,9 @@ w_rugermk1_pmodel(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; //if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - return (*ary_weaponData[WEAPON_ID::RugerMK1]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::RUGERMK1]).sPlayerModelPath; //} else { - // return (*ary_weaponData[WEAPON_ID::RugerMK1]).sPlayerSilencerModelPath; + // return (*ary_weaponData[WEAPON_ID::RUGERMK1]).sPlayerSilencerModelPath; //} } @@ -140,7 +112,7 @@ w_rugermk1_draw(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::RugerMK1], arg_thisWeapon); + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::RUGERMK1], arg_thisWeapon); } void @@ -169,7 +141,7 @@ w_rugermk1_primary(void) } // silencer only! - TS_Weapons_PlaySoundDirect(pl, "weapons/ruger/fire.wav"); + SoundPitched_Send(pl, SNDP_RUGERMK1_FIRE); randomChoice = random(); if(randomChoice < 0.5){ @@ -183,7 +155,7 @@ w_rugermk1_primary(void) View_AddEvent(w_ejectshell_pistol, 0.0f); #endif - weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::RugerMK1], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); + weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::RUGERMK1], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[arg_thisWeapon.weaponID]).fAttackDelay); @@ -207,11 +179,9 @@ w_rugermk1_reload(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::RugerMK1], arg_thisWeapon); + weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::RUGERMK1], arg_thisWeapon); } - -// ??? float w_rugermk1_aimanim(void) { @@ -224,12 +194,10 @@ w_rugermk1_hud(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::RugerMK1], arg_thisWeapon); + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::RUGERMK1], arg_thisWeapon); } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_rugermk1_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_sawedoff.qc b/src/shared/weapons/weapon_sawedoff.qc index ba8f7e9..03c5973 100644 --- a/src/shared/weapons/weapon_sawedoff.qc +++ b/src/shared/weapons/weapon_sawedoff.qc @@ -16,60 +16,41 @@ enum weaponseq_sawedoff{ coldcock }; - -BOOLEAN weapon_SawedOff_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; +void weapon_sawedoff_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_SawedOff_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_sawedoff_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_SawedOff_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ +void weapon_sawedoff_onThink(player pl, weapondynamic_t arg_thisWeapon){ + // not weapon_shotgun_onThink_reloadLogic! Pushes the clip to max in one go like + // any other weapon + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SAWEDOFF], arg_thisWeapon); } -BOOLEAN weapon_SawedOff_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} - -void weapon_SawedOff_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_SawedOff_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_SawedOff_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SawedOff], arg_thisWeapon); - //weapon_shotgun_onThink_reloadLogic(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SawedOff], arg_thisWeapon); -} -void weapon_SawedOff_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_SawedOff_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_SawedOff_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ - player pl; +void weapon_sawedoff_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ if(pl.w_attack_next > 0){ return; } - MELEE_HIT_RESPONSE theReaper = weapon_base_coldcock(localPlayer, ary_weaponData[WEAPON_ID::SawedOff], arg_thisWeapon, 40, 66); - weapon_base_setWholeAttackDelay(localPlayer, 0.73f); + MELEE_HIT_RESPONSE hitRep = weapon_base_coldcock(pl, ary_weaponData[WEAPON_ID::SAWEDOFF], arg_thisWeapon, 40, 66); + weapon_base_setWholeAttackDelay(pl, 0.73f); TS_Weapons_ViewAnimation_noLaserLock(weaponseq_sawedoff::coldcock, (30.0f/30.0f) ); arg_thisWeapon.iIronSight = 0; // disable, coldcock returns to non-ironsight look - // need the fleshhit sound - if (theReaper == MELEE_HIT_RESPONSE::NONE ) { + if (hitRep == MELEE_HIT_RESPONSE::NONE ) { TS_Weapons_PlaySoundDirect(pl, "player/closecombat.wav"); - }else if(theReaper == MELEE_HIT_RESPONSE::SOFT){ + }else if(hitRep == MELEE_HIT_RESPONSE::SOFT){ TS_Weapons_PlaySoundDirect(pl, "player/closecombat.wav"); - }else if(theReaper == MELEE_HIT_RESPONSE::METAL){ + }else if(hitRep == MELEE_HIT_RESPONSE::METAL){ TS_Weapons_PlaySoundDirect(pl, "player/closecombat.wav"); - }else if(theReaper == MELEE_HIT_RESPONSE::FLESH){ + }else if(hitRep == MELEE_HIT_RESPONSE::FLESH){ TS_Weapons_PlaySoundDirect(pl, "weapons/knife/knife_hitbody.wav"); } } - - -weapondata_ironsight_t weapon_SawedOff = +weapondata_ironsight_t weapon_sawedoff = { WEAPONDATA_TYPEID_IRONSIGHT, "Sawed-off", @@ -78,16 +59,10 @@ weapondata_ironsight_t weapon_SawedOff = "", "models/w_sawedoff.mdl", "sprites/weapons/sawedoff.spr", - weapon_SawedOff_onPrimaryAttack, - weapon_SawedOff_onPrimaryAttackRelease, - weapon_SawedOff_onSecondaryAttack, - weapon_SawedOff_onSecondaryAttackRelease, - weapon_SawedOff_onEquip, - weapon_SawedOff_onUnEquip, - weapon_SawedOff_onThink, - weapon_SawedOff_onDrawHUD, - weapon_SawedOff_onReload, - weapon_SawedOff_onColdCock, + weapon_sawedoff_onPrimaryAttackRelease, + weapon_sawedoff_onSecondaryAttackRelease, + weapon_sawedoff_onThink, + weapon_sawedoff_onColdCock, weaponseq_sawedoff::idle, weaponseq_sawedoff::draw, 31.0f / 33.0f, @@ -130,30 +105,33 @@ weapondata_ironsight_t weapon_SawedOff = void w_sawedoff_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::SAWEDOFF]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + //precache_sound("weapons/sawedoff/close.wav"); + precache_sound("weapons/sawedoff/fire.wav"); + + // the ak47 fire sound is copied in the as-is files. Why? + //precache_sound("weapons/sawedoff/fire1.wav"); + + //precache_sound("weapons/sawedoff/insert-shell.wav"); + //precache_sound("weapons/sawedoff/open.wav"); + //precache_sound("weapons/sawedoff/shelldrop.wav"); + //precache_sound("weapons/sawedoff/shellout.wav"); + //precache_sound("weapons/sawedoff/tapspan.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_sawedoff_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string w_sawedoff_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::SawedOff]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::SAWEDOFF]).sWorldModelPath; } string @@ -161,7 +139,7 @@ w_sawedoff_pmodel(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - return (*ary_weaponData[WEAPON_ID::SawedOff]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::SAWEDOFF]).sPlayerModelPath; } string @@ -176,7 +154,7 @@ w_sawedoff_draw(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::SawedOff], arg_thisWeapon); + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::SAWEDOFF], arg_thisWeapon); } void @@ -205,7 +183,7 @@ w_sawedoff_primary(void) return; } - TS_Weapons_PlaySoundDirect(pl, "weapons/sawedoff/fire.wav"); + SoundPitched_Send(pl, SNDP_SAWEDOFF_FIRE); if(!arg_thisWeapon.iIronSight){ randomChoice = random(); @@ -227,7 +205,7 @@ w_sawedoff_primary(void) View_AddEvent(w_ejectshell_pistol, 0.0f); #endif - weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::SawedOff], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); + weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::SAWEDOFF], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[arg_thisWeapon.weaponID]).fAttackDelay); @@ -245,7 +223,7 @@ w_sawedoff_secondary(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - return weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::SawedOff], arg_thisWeapon); + return weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::SAWEDOFF], arg_thisWeapon); } // need custom reload logic, works more like a typical weapon @@ -257,7 +235,7 @@ w_sawedoff_reload(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //weapon_ironsight_Reload(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::SawedOff], arg_thisWeapon); + //weapon_ironsight_Reload(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::SAWEDOFF], arg_thisWeapon); // CHECK - we have two reload anims for ordinary and ironsight mode each. // One for if we have 1 clip left, another for if we have 0 clip left. @@ -279,11 +257,9 @@ w_sawedoff_reload(void) reloadDur = 61.0f/30.0f; - weapon_gun_Reload_CustomSequence(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SawedOff], arg_thisWeapon, reloadSeq, reloadDur); + weapon_gun_Reload_CustomSequence(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SAWEDOFF], arg_thisWeapon, reloadSeq, reloadDur); } - -// ??? float w_sawedoff_aimanim(void) { @@ -295,12 +271,10 @@ w_sawedoff_hud(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SawedOff], arg_thisWeapon); + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SAWEDOFF], arg_thisWeapon); } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_sawedoff_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_sealknife.qc b/src/shared/weapons/weapon_sealknife.qc index 0a05955..cafb482 100644 --- a/src/shared/weapons/weapon_sealknife.qc +++ b/src/shared/weapons/weapon_sealknife.qc @@ -7,35 +7,18 @@ enum weaponseq_sealknife{ slash3 }; - -BOOLEAN weapon_SealKnife_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; +void weapon_sealknife_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_SealKnife_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_sealknife_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + +} +void weapon_sealknife_onThink(player pl, weapondynamic_t arg_thisWeapon){ +} +void weapon_sealknife_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ } -BOOLEAN weapon_SealKnife_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; -} -BOOLEAN weapon_SealKnife_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -void weapon_SealKnife_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} - -BOOLEAN weapon_SealKnife_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_SealKnife_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_SealKnife_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_SealKnife_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_SealKnife_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ -} - -weapondata_throwable_t weapon_SealKnife = +weapondata_throwable_t weapon_sealknife = { WEAPONDATA_TYPEID_THROWABLE, "Seal Knife", @@ -44,20 +27,14 @@ weapondata_throwable_t weapon_SealKnife = "", "models/w_sealknife.mdl", "sprites/weapons/sealknife.spr", - weapon_SealKnife_onPrimaryAttack, - weapon_SealKnife_onPrimaryAttackRelease, - weapon_SealKnife_onSecondaryAttack, - weapon_SealKnife_onSecondaryAttackRelease, - weapon_SealKnife_onEquip, - weapon_SealKnife_onUnEquip, - weapon_SealKnife_onThink, - weapon_SealKnife_onDrawHUD, - weapon_SealKnife_onReload, - weapon_SealKnife_onColdCock, + weapon_sealknife_onPrimaryAttackRelease, + weapon_sealknife_onSecondaryAttackRelease, + weapon_sealknife_onThink, + weapon_sealknife_onColdCock, weaponseq_sealknife::idle, weaponseq_sealknife::draw, 31.0f / 30.0f, - 0.24, //fire delay. this is most certainly wrong. find something more accurate later. + 0.24, //fire delay 15.0f, //dmg FALSE, BITS_WEAPONOPT_FULLLOAD, @@ -77,19 +54,16 @@ weapondata_throwable_t weapon_SealKnife = - void w_sealknife_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::SEALKNIFE]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + precache_sound("weapons/knife/knife_miss.wav"); + precache_sound("weapons/knife/knife_hit.wav"); + precache_sound("weapons/knife/knife_hitbody.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } @@ -102,13 +76,13 @@ w_sealknife_updateammo(player pl) string w_sealknife_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::SealKnife]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::SEALKNIFE]).sWorldModelPath; } string w_sealknife_pmodel(void) { - return (*ary_weaponData[WEAPON_ID::SealKnife]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::SEALKNIFE]).sPlayerModelPath; } string @@ -123,7 +97,7 @@ w_sealknife_draw(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::SealKnife], arg_thisWeapon); + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::SEALKNIFE], arg_thisWeapon); } void @@ -145,25 +119,24 @@ w_sealknife_primary(void) INPUT_PRIMARY_TAP_GATE - weapondata_basic_t baseRef = *ary_weaponData[WEAPON_ID::SealKnife]; - MELEE_HIT_RESPONSE theReaper = weapon_base_onPrimaryAttack_melee(pl, ary_weaponData[WEAPON_ID::SealKnife], arg_thisWeapon, baseRef.fAttackDamage, 55); + weapondata_basic_t baseRef = *ary_weaponData[WEAPON_ID::SEALKNIFE]; + MELEE_HIT_RESPONSE hitRep = weapon_base_onPrimaryAttack_melee(pl, ary_weaponData[WEAPON_ID::SEALKNIFE], arg_thisWeapon, baseRef.fAttackDamage, 55); // Only the server is doing traces so far to get results for this to be worth checking. #ifdef SERVER - //printfline("melee hit reponse: %d soft? %d", theReaper, (theReaper==MELEE_HIT_RESPONSE::SOFT)); - if (theReaper == MELEE_HIT_RESPONSE::NONE ) { + //printfline("melee hit reponse: %d soft? %d", hitRep, (hitRep==MELEE_HIT_RESPONSE::SOFT)); + if (hitRep == MELEE_HIT_RESPONSE::NONE ) { TS_Weapons_PlaySoundDirect(pl, "weapons/knife/knife_miss.wav"); - }else if(theReaper == MELEE_HIT_RESPONSE::SOFT){ + }else if(hitRep == MELEE_HIT_RESPONSE::SOFT){ //nothin - }else if(theReaper == MELEE_HIT_RESPONSE::METAL){ + }else if(hitRep == MELEE_HIT_RESPONSE::METAL){ TS_Weapons_PlaySoundDirect(pl, "weapons/knife/knife_hit.wav"); - }else if(theReaper == MELEE_HIT_RESPONSE::FLESH){ + }else if(hitRep == MELEE_HIT_RESPONSE::FLESH){ arg_thisWeapon.forceBodygroup1Submodel = 2; TS_Weapons_PlaySoundDirect(pl, "weapons/knife/knife_hitbody.wav"); } #endif - //Animation_ShootWeapon( self ); //self.fAttackFinished = time + wptKNIFE.fAttackFinished; @@ -194,7 +167,7 @@ w_sealknife_secondary(void) INPUT_SECONDARY_TAP_GATE - weapondata_basic_t baseRef = *ary_weaponData[WEAPON_ID::SealKnife]; + weapondata_basic_t baseRef = *ary_weaponData[WEAPON_ID::SEALKNIFE]; weapon_base_setWholeAttackDelay(pl, baseRef.fAttackDelay); if(arg_thisWeapon.iCount > 0){ @@ -202,7 +175,7 @@ w_sealknife_secondary(void) arg_thisWeapon.iCount -= 1; pl.updateSlotCountsForEquippedWeapon(); arg_thisWeapon.forceBodygroup1Submodel = 1; //reset, new knife is not bloody. - TS_Weapons_PlaySoundDirect(pl, "weapons/knife/knife_miss.wav", 1); + TS_Weapons_PlaySoundDirect(pl, "weapons/knife/knife_miss.wav"); #ifdef SERVER TSThrownProjectile::generate2(pl, arg_thisWeapon); #endif @@ -230,26 +203,21 @@ w_sealknife_reload(void) // how do you reload a sword } -// ??? float w_sealknife_aimanim(void) { return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND; } - void w_sealknife_hud(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_throwable_onDrawHUD(pl, (weapondata_throwable_t*)ary_weaponData[WEAPON_ID::SealKnife], arg_thisWeapon); + weapon_throwable_onDrawHUD(pl, (weapondata_throwable_t*)ary_weaponData[WEAPON_ID::SEALKNIFE], arg_thisWeapon); } - -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_sealknife_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_skorpion.qc b/src/shared/weapons/weapon_skorpion.qc index d237f4f..15efded 100644 --- a/src/shared/weapons/weapon_skorpion.qc +++ b/src/shared/weapons/weapon_skorpion.qc @@ -1,6 +1,4 @@ -//TAGGG - WARNING. Most of the settings in this are improvised, I have no idea. - enum weaponseq_skorpion{ idle, draw, @@ -11,38 +9,20 @@ enum weaponseq_skorpion{ idlealt }; - -BOOLEAN weapon_Skorpion_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; +void weapon_skorpion_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_Skorpion_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_skorpion_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_Skorpion_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_skorpion_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SKORPION], arg_thisWeapon); } -BOOLEAN weapon_Skorpion_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} - -void weapon_Skorpion_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_Skorpion_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_Skorpion_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Skorpion], arg_thisWeapon); -} -void weapon_Skorpion_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_Skorpion_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_Skorpion_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_skorpion_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ } - -weapondata_gun_t weapon_Skorpion = +weapondata_gun_t weapon_skorpion = { WEAPONDATA_TYPEID_GUN, "Skorpion", @@ -51,16 +31,10 @@ weapondata_gun_t weapon_Skorpion = "", "models/w_skorpion.mdl", "sprites/weapons/skorpion.spr", - weapon_Skorpion_onPrimaryAttack, - weapon_Skorpion_onPrimaryAttackRelease, - weapon_Skorpion_onSecondaryAttack, - weapon_Skorpion_onSecondaryAttackRelease, - weapon_Skorpion_onEquip, - weapon_Skorpion_onUnEquip, - weapon_Skorpion_onThink, - weapon_Skorpion_onDrawHUD, - weapon_Skorpion_onReload, - weapon_Skorpion_onColdCock, + weapon_skorpion_onPrimaryAttackRelease, + weapon_skorpion_onSecondaryAttackRelease, + weapon_skorpion_onThink, + weapon_skorpion_onColdCock, weaponseq_skorpion::idle, weaponseq_skorpion::draw, 31.0f / 30.0f, @@ -75,7 +49,7 @@ weapondata_gun_t weapon_Skorpion = 3, //TAGGG We have to guess these, TS 3.0 where this came form doesn't have this info stored anymore. {0.030000, 0.250000, 0.002500}, - WEAPON_AKIMBO_UPGRADE_ID::Skorpion, + WEAPON_AKIMBO_UPGRADE_ID::SKORPION, BITS_FIREMODE_FULL | BITS_FIREMODE_SEMI, BITS_FIREMODE_FULL, AMMO_ID::_32ACP, @@ -94,30 +68,23 @@ weapondata_gun_t weapon_Skorpion = void w_skorpion_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::SKORPION]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + precache_sound("weapons/skorpion/fire.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_skorpion_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string w_skorpion_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::Skorpion]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::SKORPION]).sWorldModelPath; } string @@ -125,7 +92,7 @@ w_skorpion_pmodel(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - return (*ary_weaponData[WEAPON_ID::Skorpion]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::SKORPION]).sPlayerModelPath; } string @@ -139,7 +106,7 @@ w_skorpion_draw(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::Skorpion], arg_thisWeapon); + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::SKORPION], arg_thisWeapon); } void @@ -168,7 +135,7 @@ w_skorpion_primary(void) return; } - TS_Weapons_PlaySoundDirect(pl, "weapons/skorpion/fire.wav"); + SoundPitched_Send(pl, SNDP_SKORPION_FIRE); randomChoice = random(); if(randomChoice < 1/3){ @@ -184,7 +151,7 @@ w_skorpion_primary(void) View_AddEvent(w_ejectshell_pistol, 0.0f); #endif - weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::Skorpion], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); + weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::SKORPION], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[arg_thisWeapon.weaponID]).fAttackDelay); @@ -208,10 +175,9 @@ w_skorpion_reload(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Skorpion], arg_thisWeapon); + weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SKORPION], arg_thisWeapon); } -// ??? float w_skorpion_aimanim(void) { @@ -223,12 +189,10 @@ w_skorpion_hud(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Skorpion], arg_thisWeapon); + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SKORPION], arg_thisWeapon); } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_skorpion_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_skorpion_akimbo.qc b/src/shared/weapons/weapon_skorpion_akimbo.qc index 88aa6d3..3f3393c 100644 --- a/src/shared/weapons/weapon_skorpion_akimbo.qc +++ b/src/shared/weapons/weapon_skorpion_akimbo.qc @@ -1,8 +1,5 @@ -//TAGGG - WARNING. Most of the stats in this are improvised, I have no idea. - enum weaponseq_skorpion_akimbo{ - //... idle, draw, reload, @@ -12,38 +9,19 @@ enum weaponseq_skorpion_akimbo{ fireright }; - - -BOOLEAN weapon_Skorpion_akimbo_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; -} -BOOLEAN weapon_Skorpion_akimbo_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_Skorpion_akimbo_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_Skorpion_akimbo_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -void weapon_Skorpion_akimbo_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_Skorpion_akimbo_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_Skorpion_akimbo_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Skorpion_akimbo], arg_thisWeapon); -} -void weapon_Skorpion_akimbo_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_Skorpion_akimbo_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_Skorpion_akimbo_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ -} - +void weapon_skorpion_akimbo_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ -//weapondata_ironsight_t weapon_Skorpion_akimbo = -weapondata_gun_t weapon_Skorpion_akimbo = +} +void weapon_skorpion_akimbo_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + +} +void weapon_skorpion_akimbo_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SKORPION_AKIMBO], arg_thisWeapon); +} +void weapon_skorpion_akimbo_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ +} + +weapondata_gun_t weapon_skorpion_akimbo = { WEAPONDATA_TYPEID_GUN, "Akimbo Skorpions", @@ -52,16 +30,10 @@ weapondata_gun_t weapon_Skorpion_akimbo = "", "models/w_skorpion.mdl", "sprites/weapons/skorpion_akimbo.spr", - weapon_Skorpion_akimbo_onPrimaryAttack, - weapon_Skorpion_akimbo_onPrimaryAttackRelease, - weapon_Skorpion_akimbo_onSecondaryAttack, - weapon_Skorpion_akimbo_onSecondaryAttackRelease, - weapon_Skorpion_akimbo_onEquip, - weapon_Skorpion_akimbo_onUnEquip, - weapon_Skorpion_akimbo_onThink, - weapon_Skorpion_akimbo_onDrawHUD, - weapon_Skorpion_akimbo_onReload, - weapon_Skorpion_akimbo_onColdCock, + weapon_skorpion_akimbo_onPrimaryAttackRelease, + weapon_skorpion_akimbo_onSecondaryAttackRelease, + weapon_skorpion_akimbo_onThink, + weapon_skorpion_akimbo_onColdCock, weaponseq_skorpion_akimbo::idle, weaponseq_skorpion_akimbo::draw, 31.0f / 30.0f, @@ -75,7 +47,7 @@ weapondata_gun_t weapon_Skorpion_akimbo = BUYCATEGORY_SMGS, 5, {0.035000, 0.550000, 0.002500}, - -WEAPON_ID::Skorpion, + -WEAPON_ID::SKORPION, BITS_FIREMODE_AKIMBO_FULL_AUTO | BITS_FIREMODE_AKIMBO_FREE_FULL, BITS_FIREMODE_AKIMBO_FULL_AUTO, AMMO_ID::_32ACP, @@ -90,33 +62,27 @@ weapondata_gun_t weapon_Skorpion_akimbo = }; + void w_skorpion_akimbo_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::SKORPION_AKIMBO]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + // assume the singular variant has handled sounds. #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_skorpion_akimbo_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string w_skorpion_akimbo_wmodel(void) { - return (*ary_weaponData[WEAPON_ID::Skorpion_akimbo]).sWorldModelPath; + return (*ary_weaponData[WEAPON_ID::SKORPION_AKIMBO]).sWorldModelPath; } string @@ -124,7 +90,7 @@ w_skorpion_akimbo_pmodel(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - return (*ary_weaponData[WEAPON_ID::Skorpion_akimbo]).sPlayerModelPath; + return (*ary_weaponData[WEAPON_ID::SKORPION_AKIMBO]).sPlayerModelPath; } string @@ -138,7 +104,7 @@ w_skorpion_akimbo_draw(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::Skorpion_akimbo], arg_thisWeapon); + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::SKORPION_AKIMBO], arg_thisWeapon); } void @@ -153,9 +119,8 @@ w_skorpion_akimbo_holster(void) // Akimbo weapons consistently. // Putting it here avoids duplicating a bunch of code. // Also, "attackTypeUsed" is whether primary (FALSE) or secondary (TRUE) lead to this point. -BOOLEAN weapon_Skorpion_akimbo_attack(player localPlayer, weapondynamic_t arg_thisWeapon, int attackTypeUsed){ +BOOLEAN weapon_skorpion_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, int attackTypeUsed){ float randomChoice; - player pl = localPlayer; int finalAkimboChoice = BITS_AKIMBOCHOICE_NONE; //default // NOTE! weapon_akimbo_semiAttackChoice already handles telling to skip firing if @@ -166,7 +131,7 @@ BOOLEAN weapon_Skorpion_akimbo_attack(player localPlayer, weapondynamic_t arg_th // Muzzle flashes and shell ejections for akimbo pending! //because I am not copy/pasting this monstrosity 5 times. - finalAkimboChoice = weapon_akimbo_fullAttackChoice(localPlayer, ary_weaponData[WEAPON_ID::Skorpion_akimbo], arg_thisWeapon, attackTypeUsed); + finalAkimboChoice = weapon_akimbo_fullAttackChoice(pl, ary_weaponData[WEAPON_ID::SKORPION_AKIMBO], arg_thisWeapon, attackTypeUsed); SAVE_STATE(pl.nextAkimboAttackPreference); @@ -207,14 +172,14 @@ BOOLEAN weapon_Skorpion_akimbo_attack(player localPlayer, weapondynamic_t arg_th // sudden dual-fire request though. int effectiveAkimboChoice = finalAkimboChoice & ~pl.akimboTest; //finalAkimboChoice;//BITS_AKIMBOCHOICE_NONE & ~pl.akimboTest - weapon_base_onAttack(localPlayer, ary_weaponData[WEAPON_ID::Skorpion_akimbo], arg_thisWeapon, effectiveAkimboChoice); + weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::SKORPION_AKIMBO], arg_thisWeapon, effectiveAkimboChoice); if(effectiveAkimboChoice & BITS_AKIMBOCHOICE_LEFT){ - TS_Weapons_PlaySoundDirect(pl, "weapons/skorpion/fire.wav"); + SoundPitched_Send(pl, SNDP_SKORPION_FIRE); } if(effectiveAkimboChoice & BITS_AKIMBOCHOICE_RIGHT){ - TS_Weapons_PlaySoundDirect(pl, "weapons/skorpion/fire.wav"); + SoundPitched_Send(pl, SNDP_SKORPION_FIRE); } @@ -260,7 +225,7 @@ BOOLEAN weapon_Skorpion_akimbo_attack(player localPlayer, weapondynamic_t arg_th } return TRUE; -}//END OF weapon_Skorpion_akimbo_attack +}//END OF weapon_skorpion_akimbo_attack void @@ -272,9 +237,9 @@ w_skorpion_akimbo_primary(void) pl.akimboTest = 0; if(input_buttons & INPUT_BUTTON3){ - weapon_Skorpion_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_BOTH); + weapon_skorpion_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_BOTH); }else{ - weapon_Skorpion_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); + weapon_skorpion_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); } } @@ -290,7 +255,7 @@ w_skorpion_akimbo_secondary(void) pl.akimboTest = 0; if(arg_thisWeapon.iFireModeAkimbo == BITS_FIREMODE_AKIMBO_FREE_FULL){ - weapon_Skorpion_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT); + weapon_skorpion_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT); //pl.akimboFirePrev = BITS_AKIMBOCHOICE_RIGHT; } } @@ -301,29 +266,24 @@ w_skorpion_akimbo_reload(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Skorpion_akimbo], arg_thisWeapon); + weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SKORPION_AKIMBO], arg_thisWeapon); } - -// ??? float w_skorpion_akimbo_aimanim(void) { return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND; } - void w_skorpion_akimbo_hud(void) { player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::Skorpion_akimbo], arg_thisWeapon); + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SKORPION_AKIMBO], arg_thisWeapon); } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_skorpion_akimbo_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_socom_mk23.qc b/src/shared/weapons/weapon_socom_mk23.qc deleted file mode 100644 index 486e658..0000000 --- a/src/shared/weapons/weapon_socom_mk23.qc +++ /dev/null @@ -1,311 +0,0 @@ - -enum weaponseq_socom_mk23{ - idleb = 0, - shootb1 = 1, - shootb2 = 2, - shootblast = 3, - drawb = 4, - idlec = 5, - shootc1 = 6, - shootc2 = 7, - shootclast = 8, - change = 9, - rechange = 10, - reload = 11, - reloadb = 12 -}; - - - -BOOLEAN weapon_SOCOM_MK23_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; -} -BOOLEAN weapon_SOCOM_MK23_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_SOCOM_MK23_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_SOCOM_MK23_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} - -void weapon_SOCOM_MK23_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - - weapon_base_onEquip(localPlayer, ary_weaponData[WEAPON_ID::SOCOM_MK23], arg_thisWeapon); -} -BOOLEAN weapon_SOCOM_MK23_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_SOCOM_MK23_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SOCOM_MK23], arg_thisWeapon); -} -void weapon_SOCOM_MK23_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_SOCOM_MK23_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_SOCOM_MK23_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ - -} - - - -weapondata_ironsight_t weapon_SOCOM_MK23 = -{ - WEAPONDATA_TYPEID_IRONSIGHT, - "SOCOM-MK23", - "models/v_mk23.mdl", - "models/p_mk23.mdl", - "models/p_mk23_sil.mdl", - "models/w_mk23.mdl", - "sprites/weapons/mk23.spr", - weapon_SOCOM_MK23_onPrimaryAttack, - weapon_SOCOM_MK23_onPrimaryAttackRelease, - weapon_SOCOM_MK23_onSecondaryAttack, - weapon_SOCOM_MK23_onSecondaryAttackRelease, - weapon_SOCOM_MK23_onEquip, - weapon_SOCOM_MK23_onUnEquip, - weapon_SOCOM_MK23_onThink, - weapon_SOCOM_MK23_onDrawHUD, - weapon_SOCOM_MK23_onReload, - weapon_SOCOM_MK23_onColdCock, - weaponseq_socom_mk23::idleb, - weaponseq_socom_mk23::drawb, - 31.0f / 40.0f, - 0.19f, //fire delay. this is most certainly wrong. find something more accurate later. - 15.0f, //dmg - TRUE, - BITS_WEAPONOPT_SILENCER | BITS_WEAPONOPT_LASERSIGHT | BITS_WEAPONOPT_FLASHLIGHT | BITS_WEAPONOPT_AKIMBO, - BITS_WEAPONOPT_NONE, - 700, - 10, - BUYCATEGORY_HANDGUNS, - 2, - {0.020000, 2.000000, 0.000000}, - WEAPON_AKIMBO_UPGRADE_ID::SOCOM_MK23, - BITS_FIREMODE_SEMI, - BITS_FIREMODE_SEMI, - AMMO_ID::_45Acp, - 12, //clip - 4096, //range - weaponseq_socom_mk23::reload, - 45.0f / 30.0f, - 1, - 2, - 2, - -1, - { - weaponseq_socom_mk23::change, - 21.0f/60.0f, - weaponseq_socom_mk23::rechange, - 21.0f/60.0f, - weaponseq_socom_mk23::idlec, - weaponseq_socom_mk23::reloadb, - 43.0f/30.0f, - {0.020000, 2.000000, 0.000000} - } -}; - - - - -void -w_socom_mk23_precache(void) -{ -#ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); -#else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); -#endif -} - -// I guess? I don't know if we really benefit from doing this. -void -w_socom_mk23_updateammo(player pl) -{ - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); -} - -string -w_socom_mk23_wmodel(void) -{ - return (*ary_weaponData[WEAPON_ID::SOCOM_MK23]).sWorldModelPath; -} - -string -w_socom_mk23_pmodel(void) -{ - // Do we have the silencer? - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - return (*ary_weaponData[WEAPON_ID::SOCOM_MK23]).sPlayerModelPath; - } else { - return (*ary_weaponData[WEAPON_ID::SOCOM_MK23]).sPlayerSilencerModelPath; - } -} - -string -w_socom_mk23_deathmsg(void) -{ - return ""; -} - -void -w_socom_mk23_draw(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapondata_basic_t* basicP = ary_weaponData[WEAPON_ID::SOCOM_MK23]; - - weapon_base_onEquip(pl, basicP, arg_thisWeapon); -} - - -void -w_socom_mk23_holster(void) -{ -} - - -void -w_socom_mk23_primary(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - - if (pl.w_attack_next > 0.0) { - return; - } - - if(arg_thisWeapon.iFireMode == BITS_FIREMODE_SEMI){ - INPUT_PRIMARY_TAP_GATE - } - - if (!arg_thisWeapon.iClipLeft || WEAPON_UNDERWATER_CHECK) { - PLAY_CLICK_SOUND - return; - } - - - if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - TS_Weapons_PlaySoundDirect(pl, "weapons/mk23/mk23-fire.wav"); - } else { - TS_Weapons_PlaySoundDirect(pl, "weapons/mk23/mk23-fire-sil.wav"); - } - - if(!arg_thisWeapon.iIronSight){ - if ( random() <= 0.5 ) { - TS_Weapons_ViewAnimation(weaponseq_socom_mk23::shootb1, (31.0f/30.0f)); - } else { - TS_Weapons_ViewAnimation(weaponseq_socom_mk23::shootb2, (31.0f/30.0f)); - } - }else{ - if ( random() <= 0.5 ) { - TS_Weapons_ViewAnimation(weaponseq_socom_mk23::shootc1, (31.0f/30.0f)); - } else { - TS_Weapons_ViewAnimation(weaponseq_socom_mk23::shootc2, (31.0f/30.0f)); - } - } - -#ifdef CLIENT - View_ShowMuzzleflash(MUZZLE_SMALL); - View_AddEvent(w_ejectshell_pistol, 0.0f); -#endif - - - weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::SOCOM_MK23], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); - - weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[arg_thisWeapon.weaponID]).fAttackDelay); - - if (self.flags & FL_CROUCHING){ - Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.2f); - }else{ - Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.2f); - } - -} - - - -void -w_socom_mk23_secondary(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - - if(pl.w_attack_next > 0){ - return; - } - - INPUT_SECONDARY_TAP_GATE - - weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::SOCOM_MK23], arg_thisWeapon); -} - - - -void -w_socom_mk23_reload(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - - weapon_ironsight_Reload(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::SOCOM_MK23], arg_thisWeapon); -} - -// ??? -float -w_socom_mk23_aimanim(void) -{ - return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND; -} - -void -w_socom_mk23_hud(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SOCOM_MK23], arg_thisWeapon); -} - -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted -void -w_socom_mk23_hudpic(int selected, vector pos, float a) -{ - // -} - -weapon_t w_socom_mk23 = -{ - - .name = "socom_mk23", - .id = 0, // not using this - .slot = 2, // ? - .slot_pos = 0, // not using this - .weight = 0, // not using this - .draw = w_socom_mk23_draw, - .holster = w_socom_mk23_holster, - .primary = w_socom_mk23_primary, - .secondary = w_socom_mk23_secondary, - .reload = w_socom_mk23_reload, - .release = NULL, - .crosshair = w_socom_mk23_hud, - .precache = w_socom_mk23_precache, - .pickup = NULL, - .updateammo = w_socom_mk23_updateammo, - .wmodel = w_socom_mk23_wmodel, - .pmodel = w_socom_mk23_pmodel, - .deathmsg = w_socom_mk23_deathmsg, - .aimanim = w_socom_mk23_aimanim, - .hudpic = NULL - -}; - diff --git a/src/shared/weapons/weapon_socommk23.qc b/src/shared/weapons/weapon_socommk23.qc new file mode 100644 index 0000000..e6112c1 --- /dev/null +++ b/src/shared/weapons/weapon_socommk23.qc @@ -0,0 +1,276 @@ + +enum weaponseq_socommk23{ + idleb = 0, + shootb1 = 1, + shootb2 = 2, + shootblast = 3, + drawb = 4, + idlec = 5, + shootc1 = 6, + shootc2 = 7, + shootclast = 8, + change = 9, + rechange = 10, + reload = 11, + reloadb = 12 +}; + +void weapon_socommk23_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + +} +void weapon_socommk23_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + +} +void weapon_socommk23_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SOCOMMK23], arg_thisWeapon); +} +void weapon_socommk23_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ + +} + +weapondata_ironsight_t weapon_socommk23 = +{ + WEAPONDATA_TYPEID_IRONSIGHT, + "SOCOM-MK23", + "models/v_mk23.mdl", + "models/p_mk23.mdl", + "models/p_mk23_sil.mdl", + "models/w_mk23.mdl", + "sprites/weapons/mk23.spr", + weapon_socommk23_onPrimaryAttackRelease, + weapon_socommk23_onSecondaryAttackRelease, + weapon_socommk23_onThink, + weapon_socommk23_onColdCock, + weaponseq_socommk23::idleb, + weaponseq_socommk23::drawb, + 31.0f / 40.0f, + 0.19f, //fire delay + 15.0f, //dmg + TRUE, + BITS_WEAPONOPT_SILENCER | BITS_WEAPONOPT_LASERSIGHT | BITS_WEAPONOPT_FLASHLIGHT | BITS_WEAPONOPT_AKIMBO, + BITS_WEAPONOPT_NONE, + 700, + 10, + BUYCATEGORY_HANDGUNS, + 2, + {0.020000, 2.000000, 0.000000}, + WEAPON_AKIMBO_UPGRADE_ID::SOCOMMK23, + BITS_FIREMODE_SEMI, + BITS_FIREMODE_SEMI, + AMMO_ID::_45ACP, + 12, //clip + 4096, //range + weaponseq_socommk23::reload, + 45.0f / 30.0f, + 1, + 2, + 2, + -1, + { + weaponseq_socommk23::change, + 21.0f/60.0f, + weaponseq_socommk23::rechange, + 21.0f/60.0f, + weaponseq_socommk23::idlec, + weaponseq_socommk23::reloadb, + 43.0f/30.0f, + {0.020000, 2.000000, 0.000000} + } +}; + + + +void +w_socommk23_precache(void) +{ + weapon_precache(ary_weaponData[WEAPON_ID::SOCOMMK23]); +#ifdef SERVER + //precache_sound("weapons/mk23/clipin.wav"); + //precache_sound("weapons/mk23/clipout.wav"); + precache_sound("weapons/mk23/mk23-fire-sil.wav"); + precache_sound("weapons/mk23/mk23-fire.wav"); + //precache_sound("weapons/mk23/sliderelease.wav"); +#else + +#endif +} + +void +w_socommk23_updateammo(player pl) +{ +} + +string +w_socommk23_wmodel(void) +{ + return (*ary_weaponData[WEAPON_ID::SOCOMMK23]).sWorldModelPath; +} + +string +w_socommk23_pmodel(void) +{ + // Do we have the silencer? + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ + return (*ary_weaponData[WEAPON_ID::SOCOMMK23]).sPlayerModelPath; + } else { + return (*ary_weaponData[WEAPON_ID::SOCOMMK23]).sPlayerSilencerModelPath; + } +} + +string +w_socommk23_deathmsg(void) +{ + return ""; +} + +void +w_socommk23_draw(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + weapondata_basic_t* basicP = ary_weaponData[WEAPON_ID::SOCOMMK23]; + + weapon_base_onEquip(pl, basicP, arg_thisWeapon); +} + + +void +w_socommk23_holster(void) +{ +} + + +void +w_socommk23_primary(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + + if (pl.w_attack_next > 0.0) { + return; + } + + if(arg_thisWeapon.iFireMode == BITS_FIREMODE_SEMI){ + INPUT_PRIMARY_TAP_GATE + } + + if (!arg_thisWeapon.iClipLeft || WEAPON_UNDERWATER_CHECK) { + PLAY_CLICK_SOUND + return; + } + + + if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ + SoundPitched_Send(pl, SNDP_SOCOMMK23_FIRE); + } else { + SoundPitched_Send(pl, SNDP_SOCOMMK23_FIRE_SIL); + } + + if(!arg_thisWeapon.iIronSight){ + if ( random() <= 0.5 ) { + TS_Weapons_ViewAnimation(weaponseq_socommk23::shootb1, (31.0f/30.0f)); + } else { + TS_Weapons_ViewAnimation(weaponseq_socommk23::shootb2, (31.0f/30.0f)); + } + }else{ + if ( random() <= 0.5 ) { + TS_Weapons_ViewAnimation(weaponseq_socommk23::shootc1, (31.0f/30.0f)); + } else { + TS_Weapons_ViewAnimation(weaponseq_socommk23::shootc2, (31.0f/30.0f)); + } + } + +#ifdef CLIENT + View_ShowMuzzleflash(MUZZLE_SMALL); + View_AddEvent(w_ejectshell_pistol, 0.0f); +#endif + + + weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::SOCOMMK23], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); + + weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[arg_thisWeapon.weaponID]).fAttackDelay); + + if (self.flags & FL_CROUCHING){ + Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.2f); + }else{ + Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.2f); + } + +} + + + +void +w_socommk23_secondary(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + + if(pl.w_attack_next > 0){ + return; + } + + INPUT_SECONDARY_TAP_GATE + + weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::SOCOMMK23], arg_thisWeapon); +} + + + +void +w_socommk23_reload(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + + weapon_ironsight_Reload(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::SOCOMMK23], arg_thisWeapon); +} + +float +w_socommk23_aimanim(void) +{ + return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND; +} + +void +w_socommk23_hud(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SOCOMMK23], arg_thisWeapon); +} + +void +w_socommk23_hudpic(int selected, vector pos, float a) +{ + // +} + +weapon_t w_socommk23 = +{ + + .name = "socommk23", + .id = 0, // not using this + .slot = 2, // ? + .slot_pos = 0, // not using this + .weight = 0, // not using this + .draw = w_socommk23_draw, + .holster = w_socommk23_holster, + .primary = w_socommk23_primary, + .secondary = w_socommk23_secondary, + .reload = w_socommk23_reload, + .release = NULL, + .crosshair = w_socommk23_hud, + .precache = w_socommk23_precache, + .pickup = NULL, + .updateammo = w_socommk23_updateammo, + .wmodel = w_socommk23_wmodel, + .pmodel = w_socommk23_pmodel, + .deathmsg = w_socommk23_deathmsg, + .aimanim = w_socommk23_aimanim, + .hudpic = NULL + +}; + diff --git a/src/shared/weapons/weapon_socom_mk23_akimbo.qc b/src/shared/weapons/weapon_socommk23_akimbo.qc similarity index 54% rename from src/shared/weapons/weapon_socom_mk23_akimbo.qc rename to src/shared/weapons/weapon_socommk23_akimbo.qc index 344dbe8..103fcfc 100644 --- a/src/shared/weapons/weapon_socom_mk23_akimbo.qc +++ b/src/shared/weapons/weapon_socommk23_akimbo.qc @@ -1,479 +1,437 @@ - - -enum weaponseq_socom_mk23_akimbo{ - //... - idle = 0, - shoot_right1 = 1, - shoot_right2 = 2, - shoot_left1 = 3, - shoot_left2 = 4, - draw = 5, - idleb = 6, - shoot_rightb1 = 7, - shoot_rightb2 = 8, - shoot_leftb1 = 9, - shoot_leftb2 = 10, - change = 11, - rechange = 12, - reload = 13, - shoot_linked = 14, - shoot_linked_last = 15, - reloadb = 16 - -}; - - - -BOOLEAN weapon_SOCOM_MK23_akimbo_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_SOCOM_MK23_akimbo_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_SOCOM_MK23_akimbo_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_SOCOM_MK23_akimbo_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -void weapon_SOCOM_MK23_akimbo_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_SOCOM_MK23_akimbo_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_SOCOM_MK23_akimbo_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SOCOM_MK23_akimbo], arg_thisWeapon); -} -void weapon_SOCOM_MK23_akimbo_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_SOCOM_MK23_akimbo_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_SOCOM_MK23_akimbo_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ - -} - - - -weapondata_ironsight_t weapon_SOCOM_MK23_akimbo = -{ - WEAPONDATA_TYPEID_IRONSIGHT, - "Ak. SOCOM-MK23", //want "Akimbo SOCOM-MK23" but it takes up a bit too much space - "models/v_mk23_Akimbo.mdl", - "models/p_mk23_Akimbo.mdl", - "models/p_mk23_Akimbo_sil.mdl", - "models/w_mk23.mdl", - "sprites/weapons/mk23_Akimbo.spr", - weapon_SOCOM_MK23_akimbo_onPrimaryAttack, - weapon_SOCOM_MK23_akimbo_onPrimaryAttackRelease, - weapon_SOCOM_MK23_akimbo_onSecondaryAttack, - weapon_SOCOM_MK23_akimbo_onSecondaryAttackRelease, - weapon_SOCOM_MK23_akimbo_onEquip, - weapon_SOCOM_MK23_akimbo_onUnEquip, - weapon_SOCOM_MK23_akimbo_onThink, - weapon_SOCOM_MK23_akimbo_onDrawHUD, - weapon_SOCOM_MK23_akimbo_onReload, - weapon_SOCOM_MK23_akimbo_onColdCock, - weaponseq_socom_mk23_akimbo::idle, - weaponseq_socom_mk23_akimbo::draw, - 31.0f / 40.0f, - 0.19f, //fire delay. this is most certainly wrong. find something more accurate later. - 15.0f, //dmg - TRUE, - BITS_WEAPONOPT_SILENCER | BITS_WEAPONOPT_LASERSIGHT | BITS_WEAPONOPT_FLASHLIGHT | BITS_WEAPONOPT_AKIMBO, - BITS_WEAPONOPT_AKIMBO, - 1400, //for use if bought straight-off Akimbo, not upgraded. - 20, - BUYCATEGORY_HANDGUNS, - 5, - {0.030000, 2.200000, 0.000000}, - // IDEA: for now, let akimbo weapons be able to redirect back to the singular version - // in this space. If negative, this is an akimbo weapon referring to the singular version. - -WEAPON_ID::SOCOM_MK23, - BITS_FIREMODE_AKIMBO_SEMI_AUTO | BITS_FIREMODE_AKIMBO_FREE_SEMI, - BITS_FIREMODE_AKIMBO_SEMI_AUTO, - AMMO_ID::_45Acp, - 12, //clip - 4096, //range - weaponseq_socom_mk23_akimbo::reload, - 76.0f / 30.0f, - 1, - -1, - 2, - -1, - { - weaponseq_socom_mk23_akimbo::change, - 21.0f/60.0f, - weaponseq_socom_mk23_akimbo::rechange, - 21.0f/60.0f, - weaponseq_socom_mk23_akimbo::idleb, - weaponseq_socom_mk23_akimbo::reloadb, - 76.0f/30.0f, - {0.030000, 2.200000, 0.000000} - } -}; - - - - - -void -w_socom_mk23_akimbo_precache(void) -{ -#ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); -#else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); -#endif -} - -// I guess? I don't know if we really benefit from doing this. -void -w_socom_mk23_akimbo_updateammo(player pl) -{ - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); -} - -string -w_socom_mk23_akimbo_wmodel(void) -{ - return (*ary_weaponData[WEAPON_ID::SOCOM_MK23_akimbo]).sWorldModelPath; -} - -string -w_socom_mk23_akimbo_pmodel(void) -{ - // Do we have the silencer? - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - return (*ary_weaponData[WEAPON_ID::SOCOM_MK23_akimbo]).sPlayerModelPath; - } else { - return (*ary_weaponData[WEAPON_ID::SOCOM_MK23_akimbo]).sPlayerSilencerModelPath; - } -} - -string -w_socom_mk23_akimbo_deathmsg(void) -{ - return ""; -} - -void -w_socom_mk23_akimbo_draw(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::SOCOM_MK23_akimbo], arg_thisWeapon); -} - -void -w_socom_mk23_akimbo_holster(void) -{ -} - - - -var int leftCount = 0; -var int rightCount = 0; - -// General attack method to be called by primary or secondary fire as needed. -// The firemode used determines whether only pressing primary fire works (alternate b/w -// the Akimbo weapons with each shot), or primary & secondary control the left/right -// Akimbo weapons consistently. -// Putting it here avoids duplicating a bunch of code. -// Also, "attackTypeUsed" is whether primary (FALSE) or secondary (TRUE) lead to this point. -BOOLEAN weapon_SOCOM_MK23_akimbo_attack(player localPlayer, weapondynamic_t arg_thisWeapon, int attackTypeUsed){ - player pl = localPlayer; - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - - //special case - int finalAkimboChoice = BITS_AKIMBOCHOICE_NONE; //default - - // NOTE! weapon_akimbo_semiAttackChoice already handles telling to skip firing if - // pl.recentAttackHadAmmo == FALSE or finalAkimboChoice is 0 or -1, no need - // to keep track of w_attack_next per variant. - // Also, - //TODO - CRITICAL! - // Muzzle flashes and shell ejections for akimbo pending! - - // because I am not copy/pasting this monstrosity 5 times. - finalAkimboChoice = weapon_akimbo_semiAttackChoice(localPlayer, ary_weaponData[WEAPON_ID::SOCOM_MK23_akimbo], arg_thisWeapon, attackTypeUsed); - -#ifdef CLIENT - SAVE_STATE(pl.nextAkimboAttackPreference); -#endif - - if(finalAkimboChoice == -1){ - //pl.akimboFirePrev = 0; - return FALSE; - } - - - /* - // DEBUG - if(finalAkimboChoice > 0){ - finalAkimboChoice = BITS_AKIMBOCHOICE_BOTH; - } - */ - if(pl.recentAttackHadAmmo == FALSE){ - if((finalAkimboChoice & BITS_AKIMBOCHOICE_LEFT)){ - PLAY_CLICK_SOUND_LEFT - } - if((finalAkimboChoice & BITS_AKIMBOCHOICE_RIGHT)){ - PLAY_CLICK_SOUND_RIGHT - } - return FALSE; - } - - - // ?? Is this even possible? - if(finalAkimboChoice == 0){ - //pl.akimboFirePrev = 0; - return FALSE; - } - - - // DEBUG!!! - if((finalAkimboChoice & BITS_AKIMBOCHOICE_LEFT)){ - leftCount++; - } - if((finalAkimboChoice & BITS_AKIMBOCHOICE_RIGHT)){ - rightCount++; - } - printfline("COUNTS! %i %i", leftCount, rightCount); - - // Use me for things the recent firing round already did to avoid redundancy. - // That is, if left-click was pressed a fraction of a second ago and then right-click - // to force leading here to play the dual-fire anim, no need to do the muzzle flash, - // shell ejection and traceattack call for the left weapon. - // Viewmodel anims (the whole point) and fire delays are OK to set based off the - // sudden dual-fire request though. - int effectiveAkimboChoice = finalAkimboChoice & ~pl.akimboTest; //finalAkimboChoice;//BITS_AKIMBOCHOICE_NONE & ~pl.akimboTest - - weapon_base_onAttack(localPlayer, ary_weaponData[WEAPON_ID::SOCOM_MK23_akimbo], arg_thisWeapon, effectiveAkimboChoice); - - - if(effectiveAkimboChoice & BITS_AKIMBOCHOICE_LEFT){ - if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - TS_Weapons_PlaySoundDirect(pl, "weapons/mk23/mk23-fire.wav"); - } else { - TS_Weapons_PlaySoundDirect(pl, "weapons/mk23/mk23-fire-sil.wav"); - } - } - if(effectiveAkimboChoice & BITS_AKIMBOCHOICE_RIGHT){ - if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - TS_Weapons_PlaySoundDirect(pl, "weapons/mk23/mk23-fire.wav"); - } else { - TS_Weapons_PlaySoundDirect(pl, "weapons/mk23/mk23-fire-sil.wav"); - } - } - - - if(pl.akimboTest == 0 && !(finalAkimboChoice == BITS_AKIMBOCHOICE_BOTH)){ - // Not both fire types chosen - // Firing the opposite way within this time will let the dual animation play. - pl.akimboDualFireToleranceTime = 0.06f; //3.0f; //0.07f; - - if(finalAkimboChoice == BITS_AKIMBOCHOICE_LEFT){ - //printfline("VM: LEFT"); - if(!arg_thisWeapon.iIronSight){ - if ( random() <= 0.5 ) { - TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socom_mk23_akimbo::shoot_left1, (31.0f/40.0f), 2 ); - } else { - TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socom_mk23_akimbo::shoot_left2, (31.0f/40.0f), 2 ); - } - }else{ - if ( random() <= 0.5 ) { - TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socom_mk23_akimbo::shoot_leftb1, (31.0f/40.0f), 2 ); - } else { - TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socom_mk23_akimbo::shoot_leftb2, (31.0f/40.0f), 2 ); - } - } - - weapon_base_setLeftAttackDelay(pl, (*ary_weaponData[pl.activeweapon]).fAttackDelay); - - if(arg_thisWeapon.iFireModeAkimbo == BITS_FIREMODE_AKIMBO_SEMI_AUTO){ - // in semi fire, set the opposite delay a little too. - weapon_base_setRightAttackDelay_AtLeast(pl, (*ary_weaponData[pl.activeweapon]).fAttackDelay * 0.5); - }else if(arg_thisWeapon.iFireModeAkimbo == BITS_FIREMODE_AKIMBO_FREE_SEMI){ - weapon_base_setRightAttackDelay_AtLeast(pl, (*ary_weaponData[pl.activeweapon]).fAttackDelay * 0.3); - } - }else if(finalAkimboChoice == BITS_AKIMBOCHOICE_RIGHT){ - //printfline("VM: RIGHT"); - if(!arg_thisWeapon.iIronSight){ - if ( random() <= 0.5 ) { - TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socom_mk23_akimbo::shoot_right1, (31.0f/40.0f), 2 ); - } else { - TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socom_mk23_akimbo::shoot_right2, (31.0f/40.0f), 2 ); - } - }else{ - if ( random() <= 0.5 ) { - TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socom_mk23_akimbo::shoot_rightb1, (31.0f/40.0f), 2 ); - } else { - TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socom_mk23_akimbo::shoot_rightb2, (31.0f/40.0f), 2 ); - } - } - - weapon_base_setRightAttackDelay(pl, (*ary_weaponData[pl.activeweapon]).fAttackDelay); - - if(arg_thisWeapon.iFireModeAkimbo == BITS_FIREMODE_AKIMBO_SEMI_AUTO){ - weapon_base_setLeftAttackDelay_AtLeast(pl, (*ary_weaponData[pl.activeweapon]).fAttackDelay * 0.5); - }else if(arg_thisWeapon.iFireModeAkimbo == BITS_FIREMODE_AKIMBO_FREE_SEMI){ - weapon_base_setLeftAttackDelay_AtLeast(pl, (*ary_weaponData[pl.activeweapon]).fAttackDelay * 0.3); - } - } - }else{ - //printfline("VM: BOTH"); - - // dual fire'd? Don't use it for doing this again. - pl.akimboDualFireToleranceTime = 0; - - // both fire types? - if(!arg_thisWeapon.iIronSight){ - if(arg_thisWeapon.iClipLeft > 0){ - TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socom_mk23_akimbo::shoot_linked, (31.0f/40.0f), 2); - }else{ - //that is... insanely situational. - TS_Weapons_ViewAnimation( weaponseq_socom_mk23_akimbo::shoot_linked_last, 31.0f/40.0f); - } - }else{ - // not ironsight eh? WE DONT HAVE A LINKED ANIM FOR THAT. - // but hey, original TS had this issue too at least, it just did no anim here. - // Or force idle, whatever. - TS_Weapons_ViewAnimation( weaponseq_socom_mk23_akimbo::idleb, 1.5f ); - } - - weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[pl.activeweapon]).fAttackDelay * 1); - } - - return TRUE; -}//END OF weapon_SOCOM_MK23_akimbo_attack - - -void -w_socom_mk23_akimbo_primary(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - - // reset - pl.akimboTest = 0; - - // in addition to the primary input, which lead to '_primary' being called at all. - if(input_buttons & INPUT_BUTTON3){ - if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_BOTH, &weapon_SOCOM_MK23_akimbo_attack)){ - // nothing unusual here. - pl.akimboTest = 0; - weapon_SOCOM_MK23_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_BOTH); - }else{ - } - }else{ - if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT, &weapon_SOCOM_MK23_akimbo_attack)){ - weapon_SOCOM_MK23_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); - pl.akimboFirePrev = BITS_AKIMBOCHOICE_LEFT; - } - - } - -} - - -void -w_socom_mk23_akimbo_secondary(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - - // reset - pl.akimboTest = 0; - - // NOTE - holding primary is impossible, would've called _primary above if so. - // Only secondary could possibly be held (and, is). - if(arg_thisWeapon.iFireModeAkimbo == BITS_FIREMODE_AKIMBO_SEMI_AUTO){ - // since secondary fire does nothing in semi-auto, we let it do ironsight stuff here - weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::SOCOM_MK23_akimbo], arg_thisWeapon); - - }else{ - // fires the right weapon always - - //weapon_SOCOM_MK23_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT); - //return; - - if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT, &weapon_SOCOM_MK23_akimbo_attack)){ - weapon_SOCOM_MK23_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT); - pl.akimboFirePrev = BITS_AKIMBOCHOICE_RIGHT; - } - } - -} - - -void -w_socom_mk23_akimbo_reload(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_ironsight_Reload(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::SOCOM_MK23_akimbo], arg_thisWeapon); - - leftCount = 0; - rightCount = 0; -} - -// ??? -float -w_socom_mk23_akimbo_aimanim(void) -{ - return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND; -} - - -void -w_socom_mk23_akimbo_hud(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SOCOM_MK23_akimbo], arg_thisWeapon); -} - - -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted -void -w_socom_mk23_akimbo_hudpic(int selected, vector pos, float a) -{ - // -} - - -weapon_t w_socom_mk23_akimbo = -{ - - .name = "socom_mk23", - .id = 0, // not using this - .slot = 2, // ? - .slot_pos = 0, // not using this - .weight = 0, // not using this - .draw = w_socom_mk23_akimbo_draw, - .holster = w_socom_mk23_akimbo_holster, - .primary = w_socom_mk23_akimbo_primary, - .secondary = w_socom_mk23_akimbo_secondary, - .reload = w_socom_mk23_akimbo_reload, - .release = NULL, - .crosshair = w_socom_mk23_akimbo_hud, - .precache = w_socom_mk23_akimbo_precache, - .pickup = NULL, - .updateammo = w_socom_mk23_akimbo_updateammo, - .wmodel = w_socom_mk23_akimbo_wmodel, - .pmodel = w_socom_mk23_akimbo_pmodel, - .deathmsg = w_socom_mk23_akimbo_deathmsg, - .aimanim = w_socom_mk23_akimbo_aimanim, - .hudpic = NULL - -}; - + +enum weaponseq_socommk23_akimbo{ + idle = 0, + shoot_right1 = 1, + shoot_right2 = 2, + shoot_left1 = 3, + shoot_left2 = 4, + draw = 5, + idleb = 6, + shoot_rightb1 = 7, + shoot_rightb2 = 8, + shoot_leftb1 = 9, + shoot_leftb2 = 10, + change = 11, + rechange = 12, + reload = 13, + shoot_linked = 14, + shoot_linked_last = 15, + reloadb = 16 + +}; + +void weapon_socommk23_akimbo_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + +} +void weapon_socommk23_akimbo_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + +} +void weapon_socommk23_akimbo_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SOCOMMK23_AKIMBO], arg_thisWeapon); +} +void weapon_socommk23_akimbo_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ + +} + +weapondata_ironsight_t weapon_socommk23_akimbo = +{ + WEAPONDATA_TYPEID_IRONSIGHT, + "Ak. SOCOM-MK23", //want "Akimbo SOCOM-MK23" but it takes up a bit too much space + "models/v_mk23_Akimbo.mdl", + "models/p_mk23_Akimbo.mdl", + "models/p_mk23_Akimbo_sil.mdl", + "models/w_mk23.mdl", + "sprites/weapons/mk23_Akimbo.spr", + weapon_socommk23_akimbo_onPrimaryAttackRelease, + weapon_socommk23_akimbo_onSecondaryAttackRelease, + weapon_socommk23_akimbo_onThink, + weapon_socommk23_akimbo_onColdCock, + weaponseq_socommk23_akimbo::idle, + weaponseq_socommk23_akimbo::draw, + 31.0f / 40.0f, + 0.19f, //fire delay + 15.0f, //dmg + TRUE, + BITS_WEAPONOPT_SILENCER | BITS_WEAPONOPT_LASERSIGHT | BITS_WEAPONOPT_FLASHLIGHT | BITS_WEAPONOPT_AKIMBO, + BITS_WEAPONOPT_AKIMBO, + 1400, //for use if bought straight-off Akimbo, not upgraded. + 20, + BUYCATEGORY_HANDGUNS, + 5, + {0.030000, 2.200000, 0.000000}, + // IDEA: for now, let akimbo weapons be able to redirect back to the singular version + // in this space. If negative, this is an akimbo weapon referring to the singular version. + -WEAPON_ID::SOCOMMK23, + BITS_FIREMODE_AKIMBO_SEMI_AUTO | BITS_FIREMODE_AKIMBO_FREE_SEMI, + BITS_FIREMODE_AKIMBO_SEMI_AUTO, + AMMO_ID::_45ACP, + 12, //clip + 4096, //range + weaponseq_socommk23_akimbo::reload, + 76.0f / 30.0f, + 1, + -1, + 2, + -1, + { + weaponseq_socommk23_akimbo::change, + 21.0f/60.0f, + weaponseq_socommk23_akimbo::rechange, + 21.0f/60.0f, + weaponseq_socommk23_akimbo::idleb, + weaponseq_socommk23_akimbo::reloadb, + 76.0f/30.0f, + {0.030000, 2.200000, 0.000000} + } +}; + + + +void +w_socommk23_akimbo_precache(void) +{ + weapon_precache(ary_weaponData[WEAPON_ID::SOCOMMK23_AKIMBO]); +#ifdef SERVER + // assume the singular variant has handled sounds. +#else + +#endif +} + +void +w_socommk23_akimbo_updateammo(player pl) +{ +} + +string +w_socommk23_akimbo_wmodel(void) +{ + return (*ary_weaponData[WEAPON_ID::SOCOMMK23_AKIMBO]).sWorldModelPath; +} + +string +w_socommk23_akimbo_pmodel(void) +{ + // Do we have the silencer? + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ + return (*ary_weaponData[WEAPON_ID::SOCOMMK23_AKIMBO]).sPlayerModelPath; + } else { + return (*ary_weaponData[WEAPON_ID::SOCOMMK23_AKIMBO]).sPlayerSilencerModelPath; + } +} + +string +w_socommk23_akimbo_deathmsg(void) +{ + return ""; +} + +void +w_socommk23_akimbo_draw(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::SOCOMMK23_AKIMBO], arg_thisWeapon); +} + +void +w_socommk23_akimbo_holster(void) +{ +} + + + +var int leftCount = 0; +var int rightCount = 0; + +// General attack method to be called by primary or secondary fire as needed. +// The firemode used determines whether only pressing primary fire works (alternate b/w +// the Akimbo weapons with each shot), or primary & secondary control the left/right +// Akimbo weapons consistently. +// Putting it here avoids duplicating a bunch of code. +// Also, "attackTypeUsed" is whether primary (FALSE) or secondary (TRUE) lead to this point. +BOOLEAN weapon_socommk23_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, int attackTypeUsed){ + //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + + //special case + int finalAkimboChoice = BITS_AKIMBOCHOICE_NONE; //default + + // NOTE! weapon_akimbo_semiAttackChoice already handles telling to skip firing if + // pl.recentAttackHadAmmo == FALSE or finalAkimboChoice is 0 or -1, no need + // to keep track of w_attack_next per variant. + // Also, + //TODO - CRITICAL! + // Muzzle flashes and shell ejections for akimbo pending! + + // because I am not copy/pasting this monstrosity 5 times. + finalAkimboChoice = weapon_akimbo_semiAttackChoice(pl, ary_weaponData[WEAPON_ID::SOCOMMK23_AKIMBO], arg_thisWeapon, attackTypeUsed); + +#ifdef CLIENT + SAVE_STATE(pl.nextAkimboAttackPreference); +#endif + + if(finalAkimboChoice == -1){ + //pl.akimboFirePrev = 0; + return FALSE; + } + + + /* + // DEBUG + if(finalAkimboChoice > 0){ + finalAkimboChoice = BITS_AKIMBOCHOICE_BOTH; + } + */ + if(pl.recentAttackHadAmmo == FALSE){ + if((finalAkimboChoice & BITS_AKIMBOCHOICE_LEFT)){ + PLAY_CLICK_SOUND_LEFT + } + if((finalAkimboChoice & BITS_AKIMBOCHOICE_RIGHT)){ + PLAY_CLICK_SOUND_RIGHT + } + return FALSE; + } + + + // ?? Is this even possible? + if(finalAkimboChoice == 0){ + //pl.akimboFirePrev = 0; + return FALSE; + } + + + // DEBUG!!! + if((finalAkimboChoice & BITS_AKIMBOCHOICE_LEFT)){ + leftCount++; + } + if((finalAkimboChoice & BITS_AKIMBOCHOICE_RIGHT)){ + rightCount++; + } + printfline("COUNTS! %i %i", leftCount, rightCount); + + // Use me for things the recent firing round already did to avoid redundancy. + // That is, if left-click was pressed a fraction of a second ago and then right-click + // to force leading here to play the dual-fire anim, no need to do the muzzle flash, + // shell ejection and traceattack call for the left weapon. + // Viewmodel anims (the whole point) and fire delays are OK to set based off the + // sudden dual-fire request though. + int effectiveAkimboChoice = finalAkimboChoice & ~pl.akimboTest; //finalAkimboChoice;//BITS_AKIMBOCHOICE_NONE & ~pl.akimboTest + + weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::SOCOMMK23_AKIMBO], arg_thisWeapon, effectiveAkimboChoice); + + + if(effectiveAkimboChoice & BITS_AKIMBOCHOICE_LEFT){ + if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ + SoundPitched_Send(pl, SNDP_SOCOMMK23_FIRE); + } else { + SoundPitched_Send(pl, SNDP_SOCOMMK23_FIRE_SIL); + } + } + if(effectiveAkimboChoice & BITS_AKIMBOCHOICE_RIGHT){ + if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ + SoundPitched_Send(pl, SNDP_SOCOMMK23_FIRE); + } else { + SoundPitched_Send(pl, SNDP_SOCOMMK23_FIRE_SIL); + } + } + + + if(pl.akimboTest == 0 && !(finalAkimboChoice == BITS_AKIMBOCHOICE_BOTH)){ + // Not both fire types chosen + // Firing the opposite way within this time will let the dual animation play. + pl.akimboDualFireToleranceTime = 0.06f; //3.0f; //0.07f; + + if(finalAkimboChoice == BITS_AKIMBOCHOICE_LEFT){ + //printfline("VM: LEFT"); + if(!arg_thisWeapon.iIronSight){ + if ( random() <= 0.5 ) { + TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socommk23_akimbo::shoot_left1, (31.0f/40.0f), 2 ); + } else { + TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socommk23_akimbo::shoot_left2, (31.0f/40.0f), 2 ); + } + }else{ + if ( random() <= 0.5 ) { + TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socommk23_akimbo::shoot_leftb1, (31.0f/40.0f), 2 ); + } else { + TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socommk23_akimbo::shoot_leftb2, (31.0f/40.0f), 2 ); + } + } + + weapon_base_setLeftAttackDelay(pl, (*ary_weaponData[pl.activeweapon]).fAttackDelay); + + if(arg_thisWeapon.iFireModeAkimbo == BITS_FIREMODE_AKIMBO_SEMI_AUTO){ + // in semi fire, set the opposite delay a little too. + weapon_base_setRightAttackDelay_AtLeast(pl, (*ary_weaponData[pl.activeweapon]).fAttackDelay * 0.5); + }else if(arg_thisWeapon.iFireModeAkimbo == BITS_FIREMODE_AKIMBO_FREE_SEMI){ + weapon_base_setRightAttackDelay_AtLeast(pl, (*ary_weaponData[pl.activeweapon]).fAttackDelay * 0.3); + } + }else if(finalAkimboChoice == BITS_AKIMBOCHOICE_RIGHT){ + //printfline("VM: RIGHT"); + if(!arg_thisWeapon.iIronSight){ + if ( random() <= 0.5 ) { + TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socommk23_akimbo::shoot_right1, (31.0f/40.0f), 2 ); + } else { + TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socommk23_akimbo::shoot_right2, (31.0f/40.0f), 2 ); + } + }else{ + if ( random() <= 0.5 ) { + TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socommk23_akimbo::shoot_rightb1, (31.0f/40.0f), 2 ); + } else { + TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socommk23_akimbo::shoot_rightb2, (31.0f/40.0f), 2 ); + } + } + + weapon_base_setRightAttackDelay(pl, (*ary_weaponData[pl.activeweapon]).fAttackDelay); + + if(arg_thisWeapon.iFireModeAkimbo == BITS_FIREMODE_AKIMBO_SEMI_AUTO){ + weapon_base_setLeftAttackDelay_AtLeast(pl, (*ary_weaponData[pl.activeweapon]).fAttackDelay * 0.5); + }else if(arg_thisWeapon.iFireModeAkimbo == BITS_FIREMODE_AKIMBO_FREE_SEMI){ + weapon_base_setLeftAttackDelay_AtLeast(pl, (*ary_weaponData[pl.activeweapon]).fAttackDelay * 0.3); + } + } + }else{ + //printfline("VM: BOTH"); + + // dual fire'd? Don't use it for doing this again. + pl.akimboDualFireToleranceTime = 0; + + // both fire types? + if(!arg_thisWeapon.iIronSight){ + if(arg_thisWeapon.iClipLeft > 0){ + TS_Weapons_ViewAnimation_EndIdle_custom( weaponseq_socommk23_akimbo::shoot_linked, (31.0f/40.0f), 2); + }else{ + //that is... insanely situational. + TS_Weapons_ViewAnimation( weaponseq_socommk23_akimbo::shoot_linked_last, 31.0f/40.0f); + } + }else{ + // not ironsight eh? WE DONT HAVE A LINKED ANIM FOR THAT. + // but hey, original TS had this issue too at least, it just did no anim here. + // Or force idle, whatever. + TS_Weapons_ViewAnimation( weaponseq_socommk23_akimbo::idleb, 1.5f ); + } + + weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[pl.activeweapon]).fAttackDelay * 1); + } + + return TRUE; +}//END OF weapon_socommk23_akimbo_attack + + +void +w_socommk23_akimbo_primary(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + + // reset + pl.akimboTest = 0; + + // in addition to the primary input, which lead to '_primary' being called at all. + if(input_buttons & INPUT_BUTTON3){ + if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_BOTH, &weapon_socommk23_akimbo_attack)){ + // nothing unusual here. + pl.akimboTest = 0; + weapon_socommk23_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_BOTH); + }else{ + } + }else{ + if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT, &weapon_socommk23_akimbo_attack)){ + weapon_socommk23_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); + pl.akimboFirePrev = BITS_AKIMBOCHOICE_LEFT; + } + + } + +} + + +void +w_socommk23_akimbo_secondary(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + + // reset + pl.akimboTest = 0; + + // NOTE - holding primary is impossible, would've called _primary above if so. + // Only secondary could possibly be held (and, is). + if(arg_thisWeapon.iFireModeAkimbo == BITS_FIREMODE_AKIMBO_SEMI_AUTO){ + // since secondary fire does nothing in semi-auto, we let it do ironsight stuff here + weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::SOCOMMK23_AKIMBO], arg_thisWeapon); + + }else{ + // fires the right weapon always + + //weapon_socommk23_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT); + //return; + + if(!weapon_akimbo_semiAttackDualHack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT, &weapon_socommk23_akimbo_attack)){ + weapon_socommk23_akimbo_attack(pl, arg_thisWeapon, BITS_AKIMBOCHOICE_RIGHT); + pl.akimboFirePrev = BITS_AKIMBOCHOICE_RIGHT; + } + } + +} + + +void +w_socommk23_akimbo_reload(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + weapon_ironsight_Reload(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::SOCOMMK23_AKIMBO], arg_thisWeapon); + + leftCount = 0; + rightCount = 0; +} + +float +w_socommk23_akimbo_aimanim(void) +{ + return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND; +} + +void +w_socommk23_akimbo_hud(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SOCOMMK23_AKIMBO], arg_thisWeapon); +} + +void +w_socommk23_akimbo_hudpic(int selected, vector pos, float a) +{ + // +} + + +weapon_t w_socommk23_akimbo = +{ + + .name = "socommk23", + .id = 0, // not using this + .slot = 2, // ? + .slot_pos = 0, // not using this + .weight = 0, // not using this + .draw = w_socommk23_akimbo_draw, + .holster = w_socommk23_akimbo_holster, + .primary = w_socommk23_akimbo_primary, + .secondary = w_socommk23_akimbo_secondary, + .reload = w_socommk23_akimbo_reload, + .release = NULL, + .crosshair = w_socommk23_akimbo_hud, + .precache = w_socommk23_akimbo_precache, + .pickup = NULL, + .updateammo = w_socommk23_akimbo_updateammo, + .wmodel = w_socommk23_akimbo_wmodel, + .pmodel = w_socommk23_akimbo_pmodel, + .deathmsg = w_socommk23_akimbo_deathmsg, + .aimanim = w_socommk23_akimbo_aimanim, + .hudpic = NULL + +}; + diff --git a/src/shared/weapons/weapon_spas12.qc b/src/shared/weapons/weapon_spas12.qc index 9759e42..d24fbdd 100644 --- a/src/shared/weapons/weapon_spas12.qc +++ b/src/shared/weapons/weapon_spas12.qc @@ -1,5 +1,4 @@ - enum weaponseq_spas12{ idle, idle2, @@ -13,38 +12,20 @@ enum weaponseq_spas12{ pump2 }; - -BOOLEAN weapon_SPAS12_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; +void weapon_spas12_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_SPAS12_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_spas12_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_SPAS12_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_spas12_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_shotgun_onThink_reloadLogic(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SPAS12], arg_thisWeapon); } -BOOLEAN weapon_SPAS12_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} - -void weapon_SPAS12_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_SPAS12_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_SPAS12_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_shotgun_onThink_reloadLogic(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::SPAS12], arg_thisWeapon); -} -void weapon_SPAS12_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_SPAS12_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_SPAS12_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_spas12_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ } - -weapondata_gun_t weapon_SPAS12 = +weapondata_gun_t weapon_spas12 = { WEAPONDATA_TYPEID_GUN, "SPAS-12", @@ -53,16 +34,10 @@ weapondata_gun_t weapon_SPAS12 = "", "models/w_spas12.mdl", "sprites/weapons/spas12.spr", - weapon_SPAS12_onPrimaryAttack, - weapon_SPAS12_onPrimaryAttackRelease, - weapon_SPAS12_onSecondaryAttack, - weapon_SPAS12_onSecondaryAttackRelease, - weapon_SPAS12_onEquip, - weapon_SPAS12_onUnEquip, - weapon_SPAS12_onThink, - weapon_SPAS12_onDrawHUD, - weapon_SPAS12_onReload, - weapon_SPAS12_onColdCock, + weapon_spas12_onPrimaryAttackRelease, + weapon_spas12_onSecondaryAttackRelease, + weapon_spas12_onThink, + weapon_spas12_onColdCock, weaponseq_spas12::idle, weaponseq_spas12::draw, 31.0f / 30.0f, @@ -93,32 +68,35 @@ weapondata_gun_t weapon_SPAS12 = -1 }; - - +weapondata_shotgun_extra_t weapon_spas12_shotgunExtra = +{ + weaponseq_spas12::reload1, + // cut the time a little + 18.0f/30.0f, //31.0f/30.0f, + weaponseq_spas12::reload2, + 21.0f/40.0f, + 9.0f/40.0f, + weaponseq_spas12::reload3, + 31.0f/30.0f +}; void w_spas12_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::SPAS12]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + precache_sound("weapons/spas12/spas12-fire.wav"); + precache_sound("weapons/spas12/spas12-pump.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_spas12_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string @@ -147,16 +125,7 @@ w_spas12_draw(void) player pl = (player)self; weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //shotgun reload settings: shared - pl.shotgunReload1_seq = weaponseq_spas12::reload1; - // cut the time a little - pl.shotgunReload1_Duration = 18.0f/30.0f; //31.0f/30.0f; - pl.shotgunReload2_seq = weaponseq_spas12::reload2; - pl.shotgunReload2_Duration = 21.0f/40.0f; - pl.shotgunReload3_seq = weaponseq_spas12::reload3; - pl.shotgunReload3_Duration = 31.0f/30.0f; - - pl.shotgunReload2_ammoLoadDelay = 9.0f/40.0f; + pl.iShotgunExtraDataID = SHOTGUN_EXTRA_ID::SPAS12; weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::SPAS12], arg_thisWeapon); } @@ -196,8 +165,9 @@ w_spas12_primary(void) // pump instead! pl.shotgunWaitingForPump = FALSE; + //SoundPitched_Channel_Send(pl, SNDP_SPAS12_PUMP, CHAN_AUTO); TS_Weapons_PlaySoundChannelDirect(pl, "weapons/spas12/spas12-pump.wav", CHAN_AUTO); - + // these pumps eject shells #ifdef CLIENT View_AddEvent(w_ejectshell_pistol, 0.0f); @@ -223,7 +193,7 @@ w_spas12_primary(void) return; } - TS_Weapons_PlaySoundDirect(pl, "weapons/spas12/spas12-fire.wav"); + SoundPitched_Send(pl, SNDP_SPAS12_FIRE); if(arg_thisWeapon.iFireMode == BITS_FIREMODE_PUMP){ TS_Weapons_ViewAnimation(weaponseq_spas12::shootpump, (31.0f/35.0f) ); @@ -275,8 +245,6 @@ w_spas12_reload(void) weapon_shotgun_reload(pl, ary_weaponData[WEAPON_ID::SPAS12], arg_thisWeapon); } - -// ??? float w_spas12_aimanim(void) { @@ -292,8 +260,6 @@ w_spas12_hud(void) } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_spas12_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_steyr_aug.qc b/src/shared/weapons/weapon_steyr_aug.qc deleted file mode 100644 index 9d9256f..0000000 --- a/src/shared/weapons/weapon_steyr_aug.qc +++ /dev/null @@ -1,293 +0,0 @@ - -enum weaponseq_steyr_aug{ - idle, - draw, - shoot, - reload -}; - - - -BOOLEAN weapon_STEYR_AUG_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; -} -BOOLEAN weapon_STEYR_AUG_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_STEYR_AUG_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_STEYR_AUG_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} - -void weapon_STEYR_AUG_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_STEYR_AUG_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_STEYR_AUG_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::STEYR_AUG], arg_thisWeapon); -} -void weapon_STEYR_AUG_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_STEYR_AUG_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_STEYR_AUG_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ - -} - - - -weapondata_gun_t weapon_STEYR_AUG = -{ - WEAPONDATA_TYPEID_GUN, - "STEYR-AUG", - "models/v_aug.mdl", - "models/p_aug.mdl", - "models/p_aug_sil.mdl", - "models/w_aug.mdl", - "sprites/weapons/aug.spr", - weapon_STEYR_AUG_onPrimaryAttack, - weapon_STEYR_AUG_onPrimaryAttackRelease, - weapon_STEYR_AUG_onSecondaryAttack, - weapon_STEYR_AUG_onSecondaryAttackRelease, - weapon_STEYR_AUG_onEquip, - weapon_STEYR_AUG_onUnEquip, - weapon_STEYR_AUG_onThink, - weapon_STEYR_AUG_onDrawHUD, - weapon_STEYR_AUG_onReload, - weapon_STEYR_AUG_onColdCock, - weaponseq_steyr_aug::idle, - weaponseq_steyr_aug::draw, - 31.0f / 30.0f, - 0.0625f, //fire delay. - 7.0f, //dmg - TRUE, - BITS_WEAPONOPT_SILENCER | BITS_WEAPONOPT_LASERSIGHT | BITS_WEAPONOPT_SCOPE, - BITS_WEAPONOPT_SCOPE, - 5000, - 40, - BUYCATEGORY_RIFLES, - 4, - {0.005000, 1.000000, 0.015000}, - WEAPON_AKIMBO_UPGRADE_ID::NONE, - BITS_FIREMODE_FULL | BITS_FIREMODE_SEMI, - BITS_FIREMODE_FULL, - AMMO_ID::_5p56Nato, - 30, //clip - 4096, //range - weaponseq_steyr_aug::reload, - 74.0f / 30.0f, - 1, - -1, - -1, - -1 -}; - - - - - -void -w_steyr_aug_precache(void) -{ -#ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); -#else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); -#endif -} - -// I guess? I don't know if we really benefit from doing this. -void -w_steyr_aug_updateammo(player pl) -{ - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); -} - -string -w_steyr_aug_wmodel(void) -{ - return (*ary_weaponData[WEAPON_ID::STEYR_AUG]).sWorldModelPath; -} - -string -w_steyr_aug_pmodel(void) -{ - // Do we have the silencer? - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - return (*ary_weaponData[WEAPON_ID::STEYR_AUG]).sPlayerModelPath; - } else { - return (*ary_weaponData[WEAPON_ID::STEYR_AUG]).sPlayerSilencerModelPath; - } -} - -string -w_steyr_aug_deathmsg(void) -{ - return ""; -} - -void -w_steyr_aug_draw(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::STEYR_AUG], arg_thisWeapon); -} - -void -w_steyr_aug_holster(void) -{ -} - -void -w_steyr_aug_primary(void) -{ - float randomChoice; - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - - if (pl.w_attack_next > 0.0) { - return; - } - - if(arg_thisWeapon.iFireMode == BITS_FIREMODE_SEMI){ - INPUT_PRIMARY_TAP_GATE - } - - if (!arg_thisWeapon.iClipLeft || WEAPON_UNDERWATER_CHECK) { - PLAY_CLICK_SOUND - return; - } - - if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - TS_Weapons_PlaySoundDirect(pl, "weapons/aug/aug-fire.wav"); - } else { - TS_Weapons_PlaySoundDirect(pl, "weapons/aug/aug-fire-sil.wav"); - } - - TS_Weapons_ViewAnimation(weaponseq_steyr_aug::shoot, 31.0f/30.0f); - -#ifdef CLIENT - View_ShowMuzzleflash(MUZZLE_SMALL); - View_AddEvent(w_ejectshell_pistol, 0.0f); -#endif - - weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::STEYR_AUG], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); - - weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[arg_thisWeapon.weaponID]).fAttackDelay); - - if (self.flags & FL_CROUCHING){ - Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.2f); - }else{ - Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.2f); - } - -} - -void -w_steyr_aug_secondary(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - - if(pl.w_attack_next > 0){ - return; - } - - INPUT_SECONDARY_TAP_GATE - - if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){ - // toggle through the zoom. - - switch(pl.currentZoomChoice){ - case -1:{ - //pl.viewzoom = 40/80; - pl.setZoom(0.5f); - pl.currentZoomChoice++; - break;} - case 0:{ - //pl.viewzoom = 0; - pl.setZoom(1.00f); - pl.currentZoomChoice = -1; - break;} - - }//END OF switch - - } - -} - - -void -w_steyr_aug_reload(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - - weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::STEYR_AUG], arg_thisWeapon); -} - - -// ??? -float -w_steyr_aug_aimanim(void) -{ - return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND; -} - -void -w_steyr_aug_hud(void) -{ - player pl = (player)self; - - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::STEYR_AUG], arg_thisWeapon); - -} - -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted -void -w_steyr_aug_hudpic(int selected, vector pos, float a) -{ - // -} - -weapon_t w_steyr_aug = -{ - - .name = "steyr_aug", - .id = 0, // not using this - .slot = 2, // ? - .slot_pos = 0, // not using this - .weight = 0, // not using this - .draw = w_steyr_aug_draw, - .holster = w_steyr_aug_holster, - .primary = w_steyr_aug_primary, - .secondary = w_steyr_aug_secondary, - .reload = w_steyr_aug_reload, - .release = NULL, - .crosshair = w_steyr_aug_hud, - .precache = w_steyr_aug_precache, - .pickup = NULL, - .updateammo = w_steyr_aug_updateammo, - .wmodel = w_steyr_aug_wmodel, - .pmodel = w_steyr_aug_pmodel, - .deathmsg = w_steyr_aug_deathmsg, - .aimanim = w_steyr_aug_aimanim, - .hudpic = NULL - -}; - diff --git a/src/shared/weapons/weapon_steyr_tmp.qc b/src/shared/weapons/weapon_steyr_tmp.qc deleted file mode 100644 index 1f6406d..0000000 --- a/src/shared/weapons/weapon_steyr_tmp.qc +++ /dev/null @@ -1,309 +0,0 @@ - -enum weaponseq_steyr_tmp{ - idle, - reload, - draw, - shoot, - shoot2, - change, - rechange, - idle2, - shootb, - shootb2, - reloadb -}; - - - -BOOLEAN weapon_STEYR_TMP_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; -} -BOOLEAN weapon_STEYR_TMP_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_STEYR_TMP_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_STEYR_TMP_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} - -void weapon_STEYR_TMP_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_STEYR_TMP_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_STEYR_TMP_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::STEYR_TMP], arg_thisWeapon); -} -void weapon_STEYR_TMP_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_STEYR_TMP_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_STEYR_TMP_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ - -} - - -weapondata_ironsight_t weapon_STEYR_TMP = -{ - WEAPONDATA_TYPEID_IRONSIGHT, - "STEYR-TMP", - "models/v_tmp.mdl", - "models/p_tmp.mdl", - "models/p_tmp_sil.mdl", - "models/w_tmp.mdl", - "sprites/weapons/tmp.spr", - weapon_STEYR_TMP_onPrimaryAttack, - weapon_STEYR_TMP_onPrimaryAttackRelease, - weapon_STEYR_TMP_onSecondaryAttack, - weapon_STEYR_TMP_onSecondaryAttackRelease, - weapon_STEYR_TMP_onEquip, - weapon_STEYR_TMP_onUnEquip, - weapon_STEYR_TMP_onThink, - weapon_STEYR_TMP_onDrawHUD, - weapon_STEYR_TMP_onReload, - weapon_STEYR_TMP_onColdCock, - weaponseq_steyr_tmp::idle, - weaponseq_steyr_tmp::draw, - 31.0f / 35.0f, - 0.0625f, //fire delay. - 7.0f, //dmg - TRUE, - BITS_WEAPONOPT_SILENCER | BITS_WEAPONOPT_LASERSIGHT, - BITS_WEAPONOPT_NONE, - 1600, - 20, - BUYCATEGORY_SMGS, - 3, - {0.015000, 1.200000, 0.010000}, - WEAPON_AKIMBO_UPGRADE_ID::NONE, - BITS_FIREMODE_FULL | BITS_FIREMODE_SEMI, - BITS_FIREMODE_FULL, - AMMO_ID::_9x19mm, - 30, //clip - 4096, //range - weaponseq_steyr_tmp::reload, - 61.0f / 35.0f, - 1, - -1, - -1, - -1, - { - weaponseq_steyr_tmp::change, - 21.0f/40.0f, - weaponseq_steyr_tmp::rechange, - 21.0f/40.0f, - weaponseq_steyr_tmp::idle2, - weaponseq_steyr_tmp::reloadb, - 73.0f/35.0f, - {0.015000, 1.200000, 0.010000} - } -}; - - - - - - -void -w_steyr_tmp_precache(void) -{ -#ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); -#else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); -#endif -} - -// I guess? I don't know if we really benefit from doing this. -void -w_steyr_tmp_updateammo(player pl) -{ - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); -} - -string -w_steyr_tmp_wmodel(void) -{ - return (*ary_weaponData[WEAPON_ID::STEYR_TMP]).sWorldModelPath; -} - -string -w_steyr_tmp_pmodel(void) -{ - // Do we have the silencer? - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - return (*ary_weaponData[WEAPON_ID::STEYR_TMP]).sPlayerModelPath; - } else { - return (*ary_weaponData[WEAPON_ID::STEYR_TMP]).sPlayerSilencerModelPath; - } -} - -string -w_steyr_tmp_deathmsg(void) -{ - return ""; -} - -void -w_steyr_tmp_draw(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - - weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::STEYR_TMP], arg_thisWeapon); -} - -void -w_steyr_tmp_holster(void) -{ -} - -void -w_steyr_tmp_primary(void) -{ - float randomChoice; - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - - if (pl.w_attack_next > 0.0) { - return; - } - - if(arg_thisWeapon.iFireMode == BITS_FIREMODE_SEMI){ - INPUT_PRIMARY_TAP_GATE - } - - if (!arg_thisWeapon.iClipLeft || WEAPON_UNDERWATER_CHECK) { - PLAY_CLICK_SOUND - return; - } - - - if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - TS_Weapons_PlaySoundDirect(pl, "weapons/tmp/fire.wav"); - } else { - TS_Weapons_PlaySoundDirect(pl, "weapons/tmp/fire-sil.wav"); - } - - if(!arg_thisWeapon.iIronSight){ - randomChoice = random(); - if(randomChoice < 1/2){ - TS_Weapons_ViewAnimation(weaponseq_steyr_tmp::shoot, 31.0f/30.0f); - }else{ - TS_Weapons_ViewAnimation(weaponseq_steyr_tmp::shoot2, 31.0f/30.0f); - } - }else{ - randomChoice = random(); - if(randomChoice < 1/2){ - TS_Weapons_ViewAnimation(weaponseq_steyr_tmp::shootb, 31.0f/30.0f); - }else{ - TS_Weapons_ViewAnimation(weaponseq_steyr_tmp::shootb2, 31.0f/30.0f); - } - } - -#ifdef CLIENT - View_ShowMuzzleflash(MUZZLE_SMALL); - View_AddEvent(w_ejectshell_pistol, 0.0f); -#endif - - weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::STEYR_TMP], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); - - weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[arg_thisWeapon.weaponID]).fAttackDelay); - - if (self.flags & FL_CROUCHING){ - Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.2f); - }else{ - Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.2f); - } - -} - -void -w_steyr_tmp_secondary(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - - if(pl.w_attack_next > 0){ - return; - } - - INPUT_SECONDARY_TAP_GATE - - weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::STEYR_TMP], arg_thisWeapon); - -} - - -void -w_steyr_tmp_reload(void) -{ - player pl = (player)self; - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - - weapon_ironsight_Reload(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::STEYR_TMP], arg_thisWeapon); -} - - -// ??? -float -w_steyr_tmp_aimanim(void) -{ - return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND; -} - -void -w_steyr_tmp_hud(void) -{ - player pl = (player)self; - - weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::STEYR_TMP], arg_thisWeapon); - -} - -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted -void -w_steyr_tmp_hudpic(int selected, vector pos, float a) -{ - // -} - -weapon_t w_steyr_tmp = -{ - - .name = "steyr_tmp", - .id = 0, // not using this - .slot = 2, // ? - .slot_pos = 0, // not using this - .weight = 0, // not using this - .draw = w_steyr_tmp_draw, - .holster = w_steyr_tmp_holster, - .primary = w_steyr_tmp_primary, - .secondary = w_steyr_tmp_secondary, - .reload = w_steyr_tmp_reload, - .release = NULL, - .crosshair = w_steyr_tmp_hud, - .precache = w_steyr_tmp_precache, - .pickup = NULL, - .updateammo = w_steyr_tmp_updateammo, - .wmodel = w_steyr_tmp_wmodel, - .pmodel = w_steyr_tmp_pmodel, - .deathmsg = w_steyr_tmp_deathmsg, - .aimanim = w_steyr_tmp_aimanim, - .hudpic = NULL - -}; - - diff --git a/src/shared/weapons/weapon_steyraug.qc b/src/shared/weapons/weapon_steyraug.qc new file mode 100644 index 0000000..c9a925c --- /dev/null +++ b/src/shared/weapons/weapon_steyraug.qc @@ -0,0 +1,259 @@ + +enum weaponseq_steyraug{ + idle, + draw, + shoot, + reload +}; + +void weapon_steyraug_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + +} +void weapon_steyraug_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + +} +void weapon_steyraug_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::STEYRAUG], arg_thisWeapon); +} +void weapon_steyraug_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ + +} + +weapondata_gun_t weapon_steyraug = +{ + WEAPONDATA_TYPEID_GUN, + "STEYR-AUG", + "models/v_aug.mdl", + "models/p_aug.mdl", + "models/p_aug_sil.mdl", + "models/w_aug.mdl", + "sprites/weapons/aug.spr", + weapon_steyraug_onPrimaryAttackRelease, + weapon_steyraug_onSecondaryAttackRelease, + weapon_steyraug_onThink, + weapon_steyraug_onColdCock, + weaponseq_steyraug::idle, + weaponseq_steyraug::draw, + 31.0f / 30.0f, + 0.0625f, //fire delay. + 7.0f, //dmg + TRUE, + BITS_WEAPONOPT_SILENCER | BITS_WEAPONOPT_LASERSIGHT | BITS_WEAPONOPT_SCOPE, + BITS_WEAPONOPT_SCOPE, + 5000, + 40, + BUYCATEGORY_RIFLES, + 4, + {0.005000, 1.000000, 0.015000}, + WEAPON_AKIMBO_UPGRADE_ID::NONE, + BITS_FIREMODE_FULL | BITS_FIREMODE_SEMI, + BITS_FIREMODE_FULL, + AMMO_ID::_5P56NATO, + 30, //clip + 4096, //range + weaponseq_steyraug::reload, + 74.0f / 30.0f, + 1, + -1, + -1, + -1 +}; + + + +void +w_steyraug_precache(void) +{ + weapon_precache(ary_weaponData[WEAPON_ID::STEYRAUG]); +#ifdef SERVER + precache_sound("weapons/aug/aug-fire-sil.wav"); + precache_sound("weapons/aug/aug-fire.wav"); + //precache_sound("weapons/aug/boltpull.wav"); + //precache_sound("weapons/aug/boltslap.wav"); + //precache_sound("weapons/aug/clipin.wav"); + //precache_sound("weapons/aug/clipout.wav"); +#else + +#endif +} + +void +w_steyraug_updateammo(player pl) +{ +} + +string +w_steyraug_wmodel(void) +{ + return (*ary_weaponData[WEAPON_ID::STEYRAUG]).sWorldModelPath; +} + +string +w_steyraug_pmodel(void) +{ + // Do we have the silencer? + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ + return (*ary_weaponData[WEAPON_ID::STEYRAUG]).sPlayerModelPath; + } else { + return (*ary_weaponData[WEAPON_ID::STEYRAUG]).sPlayerSilencerModelPath; + } +} + +string +w_steyraug_deathmsg(void) +{ + return ""; +} + +void +w_steyraug_draw(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::STEYRAUG], arg_thisWeapon); +} + +void +w_steyraug_holster(void) +{ +} + +void +w_steyraug_primary(void) +{ + float randomChoice; + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + + if (pl.w_attack_next > 0.0) { + return; + } + + if(arg_thisWeapon.iFireMode == BITS_FIREMODE_SEMI){ + INPUT_PRIMARY_TAP_GATE + } + + if (!arg_thisWeapon.iClipLeft || WEAPON_UNDERWATER_CHECK) { + PLAY_CLICK_SOUND + return; + } + + if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ + SoundPitched_Send(pl, SNDP_STEYRAUG_FIRE); + } else { + SoundPitched_Send(pl, SNDP_STEYRAUG_FIRE_SIL); + } + + TS_Weapons_ViewAnimation(weaponseq_steyraug::shoot, 31.0f/30.0f); + +#ifdef CLIENT + View_ShowMuzzleflash(MUZZLE_SMALL); + View_AddEvent(w_ejectshell_pistol, 0.0f); +#endif + + weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::STEYRAUG], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); + + weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[arg_thisWeapon.weaponID]).fAttackDelay); + + if (self.flags & FL_CROUCHING){ + Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.2f); + }else{ + Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.2f); + } + +} + +void +w_steyraug_secondary(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + + if(pl.w_attack_next > 0){ + return; + } + + INPUT_SECONDARY_TAP_GATE + + if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){ + // toggle through the zoom. + + switch(pl.currentZoomChoice){ + case -1:{ + //pl.viewzoom = 40/80; + pl.setZoom(0.5f); + pl.currentZoomChoice++; + break;} + case 0:{ + //pl.viewzoom = 0; + pl.setZoom(1.00f); + pl.currentZoomChoice = -1; + break;} + + }//END OF switch + + } + +} + + +void +w_steyraug_reload(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + + weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::STEYRAUG], arg_thisWeapon); +} + +float +w_steyraug_aimanim(void) +{ + return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND; +} + +void +w_steyraug_hud(void) +{ + player pl = (player)self; + + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::STEYRAUG], arg_thisWeapon); + +} + +void +w_steyraug_hudpic(int selected, vector pos, float a) +{ + // +} + +weapon_t w_steyraug = +{ + + .name = "steyraug", + .id = 0, // not using this + .slot = 2, // ? + .slot_pos = 0, // not using this + .weight = 0, // not using this + .draw = w_steyraug_draw, + .holster = w_steyraug_holster, + .primary = w_steyraug_primary, + .secondary = w_steyraug_secondary, + .reload = w_steyraug_reload, + .release = NULL, + .crosshair = w_steyraug_hud, + .precache = w_steyraug_precache, + .pickup = NULL, + .updateammo = w_steyraug_updateammo, + .wmodel = w_steyraug_wmodel, + .pmodel = w_steyraug_pmodel, + .deathmsg = w_steyraug_deathmsg, + .aimanim = w_steyraug_aimanim, + .hudpic = NULL + +}; + diff --git a/src/shared/weapons/weapon_steyrtmp.qc b/src/shared/weapons/weapon_steyrtmp.qc new file mode 100644 index 0000000..13e298a --- /dev/null +++ b/src/shared/weapons/weapon_steyrtmp.qc @@ -0,0 +1,274 @@ + +enum weaponseq_steyrtmp{ + idle, + reload, + draw, + shoot, + shoot2, + change, + rechange, + idle2, + shootb, + shootb2, + reloadb +}; + +void weapon_steyrtmp_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + +} +void weapon_steyrtmp_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + +} +void weapon_steyrtmp_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::STEYRTMP], arg_thisWeapon); +} +void weapon_steyrtmp_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ + +} + +weapondata_ironsight_t weapon_steyrtmp = +{ + WEAPONDATA_TYPEID_IRONSIGHT, + "STEYR-TMP", + "models/v_tmp.mdl", + "models/p_tmp.mdl", + "models/p_tmp_sil.mdl", + "models/w_tmp.mdl", + "sprites/weapons/tmp.spr", + weapon_steyrtmp_onPrimaryAttackRelease, + weapon_steyrtmp_onSecondaryAttackRelease, + weapon_steyrtmp_onThink, + weapon_steyrtmp_onColdCock, + weaponseq_steyrtmp::idle, + weaponseq_steyrtmp::draw, + 31.0f / 35.0f, + 0.0625f, //fire delay. + 7.0f, //dmg + TRUE, + BITS_WEAPONOPT_SILENCER | BITS_WEAPONOPT_LASERSIGHT, + BITS_WEAPONOPT_NONE, + 1600, + 20, + BUYCATEGORY_SMGS, + 3, + {0.015000, 1.200000, 0.010000}, + WEAPON_AKIMBO_UPGRADE_ID::NONE, + BITS_FIREMODE_FULL | BITS_FIREMODE_SEMI, + BITS_FIREMODE_FULL, + AMMO_ID::_9X19MM, + 30, //clip + 4096, //range + weaponseq_steyrtmp::reload, + 61.0f / 35.0f, + 1, + -1, + -1, + -1, + { + weaponseq_steyrtmp::change, + 21.0f/40.0f, + weaponseq_steyrtmp::rechange, + 21.0f/40.0f, + weaponseq_steyrtmp::idle2, + weaponseq_steyrtmp::reloadb, + 73.0f/35.0f, + {0.015000, 1.200000, 0.010000} + } +}; + + + +void +w_steyrtmp_precache(void) +{ + weapon_precache(ary_weaponData[WEAPON_ID::STEYRTMP]); +#ifdef SERVER + //precache_sound("weapons/tmp/clipin.wav"); + //precache_sound("weapons/tmp/clipout.wav"); + precache_sound("weapons/tmp/fire-sil.wav"); + precache_sound("weapons/tmp/fire.wav"); + //precache_sound("weapons/tmp/slideback.wav"); +#else + +#endif +} + +void +w_steyrtmp_updateammo(player pl) +{ +} + +string +w_steyrtmp_wmodel(void) +{ + return (*ary_weaponData[WEAPON_ID::STEYRTMP]).sWorldModelPath; +} + +string +w_steyrtmp_pmodel(void) +{ + // Do we have the silencer? + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ + return (*ary_weaponData[WEAPON_ID::STEYRTMP]).sPlayerModelPath; + } else { + return (*ary_weaponData[WEAPON_ID::STEYRTMP]).sPlayerSilencerModelPath; + } +} + +string +w_steyrtmp_deathmsg(void) +{ + return ""; +} + +void +w_steyrtmp_draw(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + + weapon_base_onEquip(pl, ary_weaponData[WEAPON_ID::STEYRTMP], arg_thisWeapon); +} + +void +w_steyrtmp_holster(void) +{ +} + +void +w_steyrtmp_primary(void) +{ + float randomChoice; + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + + if (pl.w_attack_next > 0.0) { + return; + } + + if(arg_thisWeapon.iFireMode == BITS_FIREMODE_SEMI){ + INPUT_PRIMARY_TAP_GATE + } + + if (!arg_thisWeapon.iClipLeft || WEAPON_UNDERWATER_CHECK) { + PLAY_CLICK_SOUND + return; + } + + + if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ + SoundPitched_Send(pl, SNDP_STEYRTMP_FIRE); + } else { + SoundPitched_Send(pl, SNDP_STEYRTMP_FIRE_SIL); + } + + if(!arg_thisWeapon.iIronSight){ + randomChoice = random(); + if(randomChoice < 1/2){ + TS_Weapons_ViewAnimation(weaponseq_steyrtmp::shoot, 31.0f/30.0f); + }else{ + TS_Weapons_ViewAnimation(weaponseq_steyrtmp::shoot2, 31.0f/30.0f); + } + }else{ + randomChoice = random(); + if(randomChoice < 1/2){ + TS_Weapons_ViewAnimation(weaponseq_steyrtmp::shootb, 31.0f/30.0f); + }else{ + TS_Weapons_ViewAnimation(weaponseq_steyrtmp::shootb2, 31.0f/30.0f); + } + } + +#ifdef CLIENT + View_ShowMuzzleflash(MUZZLE_SMALL); + View_AddEvent(w_ejectshell_pistol, 0.0f); +#endif + + weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::STEYRTMP], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT); + + weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[arg_thisWeapon.weaponID]).fAttackDelay); + + if (self.flags & FL_CROUCHING){ + Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.2f); + }else{ + Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.2f); + } + +} + +void +w_steyrtmp_secondary(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + + if(pl.w_attack_next > 0){ + return; + } + + INPUT_SECONDARY_TAP_GATE + + weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::STEYRTMP], arg_thisWeapon); + +} + + +void +w_steyrtmp_reload(void) +{ + player pl = (player)self; + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + + weapon_ironsight_Reload(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::STEYRTMP], arg_thisWeapon); +} + +float +w_steyrtmp_aimanim(void) +{ + return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND; +} + +void +w_steyrtmp_hud(void) +{ + player pl = (player)self; + + weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; + weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::STEYRTMP], arg_thisWeapon); + +} + +void +w_steyrtmp_hudpic(int selected, vector pos, float a) +{ + // +} + +weapon_t w_steyrtmp = +{ + + .name = "steyrtmp", + .id = 0, // not using this + .slot = 2, // ? + .slot_pos = 0, // not using this + .weight = 0, // not using this + .draw = w_steyrtmp_draw, + .holster = w_steyrtmp_holster, + .primary = w_steyrtmp_primary, + .secondary = w_steyrtmp_secondary, + .reload = w_steyrtmp_reload, + .release = NULL, + .crosshair = w_steyrtmp_hud, + .precache = w_steyrtmp_precache, + .pickup = NULL, + .updateammo = w_steyrtmp_updateammo, + .wmodel = w_steyrtmp_wmodel, + .pmodel = w_steyrtmp_pmodel, + .deathmsg = w_steyrtmp_deathmsg, + .aimanim = w_steyrtmp_aimanim, + .hudpic = NULL + +}; + + diff --git a/src/shared/weapons/weapon_ump.qc b/src/shared/weapons/weapon_ump.qc index 6df05de..5dbdf6d 100644 --- a/src/shared/weapons/weapon_ump.qc +++ b/src/shared/weapons/weapon_ump.qc @@ -8,40 +8,20 @@ enum weaponseq_ump{ reload }; - - -BOOLEAN weapon_UMP_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; +void weapon_ump_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_UMP_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_ump_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + } -BOOLEAN weapon_UMP_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; +void weapon_ump_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::UMP], arg_thisWeapon); } -BOOLEAN weapon_UMP_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} - -void weapon_UMP_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_UMP_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_UMP_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::UMP], arg_thisWeapon); -} -void weapon_UMP_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_UMP_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_UMP_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ +void weapon_ump_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ } - - -weapondata_gun_t weapon_UMP = +weapondata_gun_t weapon_ump = { WEAPONDATA_TYPEID_GUN, "UMP", @@ -50,16 +30,10 @@ weapondata_gun_t weapon_UMP = "models/p_ump_sil.mdl", "models/w_ump.mdl", "sprites/weapons/ump.spr", - weapon_UMP_onPrimaryAttack, - weapon_UMP_onPrimaryAttackRelease, - weapon_UMP_onSecondaryAttack, - weapon_UMP_onSecondaryAttackRelease, - weapon_UMP_onEquip, - weapon_UMP_onUnEquip, - weapon_UMP_onThink, - weapon_UMP_onDrawHUD, - weapon_UMP_onReload, - weapon_UMP_onColdCock, + weapon_ump_onPrimaryAttackRelease, + weapon_ump_onSecondaryAttackRelease, + weapon_ump_onThink, + weapon_ump_onColdCock, weaponseq_ump::idle, weaponseq_ump::draw, 26.0f / 35.0f, @@ -76,7 +50,7 @@ weapondata_gun_t weapon_UMP = WEAPON_AKIMBO_UPGRADE_ID::NONE, BITS_FIREMODE_FULL | BITS_FIREMODE_SEMI, BITS_FIREMODE_FULL, - AMMO_ID::_45Acp, + AMMO_ID::_45ACP, 25, //clip 4096, //range weaponseq_ump::reload, @@ -87,30 +61,29 @@ weapondata_gun_t weapon_UMP = 4 }; - - + void w_ump_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::UMP]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + //precache_sound("weapons/ump/boltpull.wav"); + //precache_sound("weapons/ump/boltslap.wav"); + //precache_sound("weapons/ump/clipin.wav"); + //precache_sound("weapons/ump/clipout.wav"); + //precache_sound("weapons/ump/clipslap.wav"); + //precache_sound("weapons/ump/slideback.wav"); + precache_sound("weapons/ump/ump-fire-sil.wav"); + precache_sound("weapons/ump/ump-fire.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_ump_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string @@ -173,9 +146,9 @@ w_ump_primary(void) } if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ - TS_Weapons_PlaySoundDirect(pl, "weapons/ump/ump-fire.wav"); + SoundPitched_Send(pl, SNDP_UMP_FIRE); } else { - TS_Weapons_PlaySoundDirect(pl, "weapons/ump/ump-fire-sil.wav"); + SoundPitched_Send(pl, SNDP_UMP_FIRE_SIL); } randomChoice = random(); @@ -246,8 +219,6 @@ w_ump_reload(void) weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::UMP], arg_thisWeapon); } - -// ??? float w_ump_aimanim(void) { @@ -264,8 +235,6 @@ w_ump_hud(void) } -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_ump_hudpic(int selected, vector pos, float a) { diff --git a/src/shared/weapons/weapon_usas12.qc b/src/shared/weapons/weapon_usas12.qc index c8854bb..9a2348b 100644 --- a/src/shared/weapons/weapon_usas12.qc +++ b/src/shared/weapons/weapon_usas12.qc @@ -6,38 +6,19 @@ enum weaponseq_usas12{ shootsemi }; - -BOOLEAN weapon_USAS12_onPrimaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return TRUE; -} -BOOLEAN weapon_USAS12_onPrimaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_USAS12_onSecondaryAttack(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} -BOOLEAN weapon_USAS12_onSecondaryAttackRelease(player localPlayer, weapondynamic_t arg_thisWeapon, BOOLEAN hasAmmo){ - return FALSE; -} - -void weapon_USAS12_onEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -BOOLEAN weapon_USAS12_onUnEquip(player localPlayer, weapondynamic_t arg_thisWeapon){ - return FALSE; -} -void weapon_USAS12_onThink(player localPlayer, weapondynamic_t arg_thisWeapon){ - weapon_gun_onThink(localPlayer, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::USAS12], arg_thisWeapon); -} -void weapon_USAS12_onDrawHUD(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_USAS12_onReload(player localPlayer, weapondynamic_t arg_thisWeapon){ -} -void weapon_USAS12_onColdCock(player localPlayer, weapondynamic_t arg_thisWeapon){ -} - - +void weapon_usas12_onPrimaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ -weapondata_gun_t weapon_USAS12 = +} +void weapon_usas12_onSecondaryAttackRelease(player pl, weapondynamic_t arg_thisWeapon){ + +} +void weapon_usas12_onThink(player pl, weapondynamic_t arg_thisWeapon){ + weapon_gun_onThink(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::USAS12], arg_thisWeapon); +} +void weapon_usas12_onColdCock(player pl, weapondynamic_t arg_thisWeapon){ +} + +weapondata_gun_t weapon_usas12 = { WEAPONDATA_TYPEID_GUN, "USAS-12", @@ -46,16 +27,10 @@ weapondata_gun_t weapon_USAS12 = "", "models/w_usas.mdl", "sprites/weapons/usas12.spr", - weapon_USAS12_onPrimaryAttack, - weapon_USAS12_onPrimaryAttackRelease, - weapon_USAS12_onSecondaryAttack, - weapon_USAS12_onSecondaryAttackRelease, - weapon_USAS12_onEquip, - weapon_USAS12_onUnEquip, - weapon_USAS12_onThink, - weapon_USAS12_onDrawHUD, - weapon_USAS12_onReload, - weapon_USAS12_onColdCock, + weapon_usas12_onPrimaryAttackRelease, + weapon_usas12_onSecondaryAttackRelease, + weapon_usas12_onThink, + weapon_usas12_onColdCock, weaponseq_usas12::idle, weaponseq_usas12::draw, 31.0f / 30.0f, @@ -85,28 +60,23 @@ weapondata_gun_t weapon_USAS12 = - void w_usas12_precache(void) { + weapon_precache(ary_weaponData[WEAPON_ID::USAS12]); #ifdef SERVER - //Sound_Precache("weapon_glock.fire"); - //precache_model("models/w_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); + //precache_sound("weapons/usas/clipin.wav"); + //precache_sound("weapons/usas/clipout.wav"); + //precache_sound("weapons/usas/slideback.wav"); + precache_sound("weapons/usas/usas-fire.wav"); #else - //precache_model("models/v_9mmhandgun.mdl"); - //precache_model("models/p_9mmhandgun.mdl"); - //precache_model("models/shell.mdl"); - //Sound_Precache("modelevent_shell.land"); + #endif } -// I guess? I don't know if we really benefit from doing this. void w_usas12_updateammo(player pl) { - //weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; - //Weapons_UpdateAmmo(pl, arg_thisWeapon.iClipLeft, pl.ary_ammoTotal[AMMO_ID::_9x19mm], -1); } string @@ -161,7 +131,7 @@ w_usas12_primary(void) return; } - TS_Weapons_PlaySoundDirect(pl, "weapons/usas/usas-fire.wav"); + SoundPitched_Send(pl, SNDP_USAS12_FIRE); TS_Weapons_ViewAnimation(weaponseq_usas12::shootsemi, 31.0f/35.0f); @@ -183,7 +153,6 @@ w_usas12_primary(void) } - void w_usas12_secondary(void) { @@ -198,16 +167,12 @@ w_usas12_reload(void) weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::USAS12], arg_thisWeapon); } - - -// ??? float w_usas12_aimanim(void) { return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND; } - void w_usas12_hud(void) { @@ -216,18 +181,12 @@ w_usas12_hud(void) weapon_gun_onDrawHUD(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::USAS12], arg_thisWeapon); } - - -// NOPE! Handled by the buysidemenu, could make this give the instructions for drawing the button -// with the icon if really wanted void w_usas12_hudpic(int selected, vector pos, float a) { // } - - weapon_t w_usas12 = {