muzzleflash + shell eject, network friendly, per-weapon zoom cleanup

This commit is contained in:
Christopher Dawalt 2021-08-12 06:13:30 -04:00
parent 34ffbd54dc
commit 931d7c72f8
38 changed files with 308 additions and 354 deletions

View File

@ -13,7 +13,6 @@ string sMOTDString[25];
string sMapString[35];
var string sMOTD_total;
var string sMapString_total;
// Keep in synch with the ary_UI_Screen array of ui.qc

View File

@ -143,13 +143,10 @@ UI_ChangeScreen(UI_SCREEN arg_NewScreenID)
void
UI_Init(void)
{
string sTemp;
int iMOTDLength;
int i;
int s;
filestream fmMapDescr;
// First load the MESSAGE OF THE DAY from the sever
//sMOTD_total = serverkey("motd_total");
@ -169,43 +166,8 @@ UI_Init(void)
// NOPE! Let this be handled elsewhere in case of a different color choice!
//sMOTD_total = strcat("^xFA0", sMOTD_total);
// Now load the MAP DESCRIPTION
// TAGGG
// Do we have any use for this though? Check original TS, the "Select Team"
// screen does (press enter to close or after closing the MoTD, probably)
sMapString_total = "";
//printfline("MAPNAME READS: %s", mapname);
// TODO! If the mapname ends in .bsp, remove that portion, that causes
// the appended ".txt" to work wrongly, "mymap.bsp.txt" instead of "mymap.txt"
fmMapDescr = fopen( sprintf( "maps/%s.txt", mapname ), FILE_READ );
if ( fmMapDescr != -1 ) {
for (i = 0; i < 35; i++ ) {
sTemp = fgets( fmMapDescr );
if not ( sTemp ) {
break;
}
sMapString[ i ] = sTemp;
/*
if (sMapString[ i ] == "/" ) {
sMapString_total = strcat(sMOTD_total, "\n" );
}else{
sMapString_total = strcat(sMapString_total, sprintf("%s\n", sMapString[ i ]) );
}
*/
sMapString_total = strcat(sMapString_total, sprintf("%s\n", sMapString[ i ]) );
}
fclose( fmMapDescr );
}
//printfline("MAP DESCRIPTOR?");
//printfline("%s", sMapString_total);
// someVar = loadMapDescription();
loadMapDescription();
gFun_UI_EventGrabber_Initialize();

View File

@ -95,4 +95,4 @@ void Gfx_TextLineWrap( vector vPos, vector vSize, float fAlignFlags, string sTex
void Gfx_RotScalePic( string sImage, vector arg_vDrawPos, vector arg_vDrawPivot, vector vSize, float flAngle, vector vScale, vector vRGB, float flOpac );
void Gfx_ScalePicPreserveBounds(string sImage, vector arg_vDrawPos, vector vSize, vector vScale, vector vInset, vector vRGB, float flOpac);
string Colors_RGB8_to_HEX(vector color);
string loadMapDescription(void);

View File

@ -214,3 +214,63 @@ Colors_RGB8_to_HEX(vector color)
}
return out;
}
// Load the map description
// Do we have any use for this though? Check original TS, the "Select Team"
// screen does (press enter to close or after closing the MoTD, probably)
string
loadMapDescription(void)
{
int i;
filestream fmMapDescr;
string sTemp;
string sMapString_total = "";
// If the mapname ends in .bsp, remove that portion, that causes
// the appended ".txt" to work wrongly, "mymap.bsp.txt" instead of "mymap.txt".
// This check for ending in ".bsp" adjusts for that if so
string mapname_filtered = mapname;
float mapname_len = strlen(mapname);
// name is at least 5 characters (...X.bsp)
if(mapname_len >= 5){
string lastChars = substring(mapname, mapname_len - 4, 4);
if(lastChars == ".bsp"){
// change _filtered!
mapname_filtered = substring(mapname, 0, mapname_len - 4);
}
}
//printfline("loadMapDescription: mapname:%s mapname_filtered: %s", mapname, mapname_filtered);
fmMapDescr = fopen( sprintf( "maps/%s.txt", mapname_filtered ), FILE_READ );
if ( fmMapDescr != -1 ) {
for (i = 0; i < 35; i++ ) {
sTemp = fgets( fmMapDescr );
if not ( sTemp ) {
break;
}
sMapString[ i ] = sTemp;
/*
if (sMapString[ i ] == "/" ) {
sMapString_total = strcat(sMOTD_total, "\n" );
}else{
sMapString_total = strcat(sMapString_total, sprintf("%s\n", sMapString[ i ]) );
}
*/
sMapString_total = strcat(sMapString_total, sprintf("%s\n", sMapString[ i ]) );
}
fclose( fmMapDescr );
}else{
// No mapname.txt? Could set sMapString_total to "No description found."
}
//printfline("map descriptor: %s", sMapString_total);
return sMapString_total;
}//loadMapDescription

View File

@ -337,9 +337,7 @@ void View_HandleZoom(void){
void
View_ShowMuzzleflash(int index)
{
// View_SetMuzzleflash
pSeat->m_eMuzzleflash.modelindex = (float)index;
// Event_ProcessModel: force it.
pSeat->m_eMuzzleflash.alpha = 1.0f;
pSeat->m_eMuzzleflash.scale = 0.25;

View File

@ -63,11 +63,11 @@ enum SHELLEJECT_ID{
// ammo type. Still using those first in weapons involving those
_22,
_9MM,
_GENERIC,
GENERIC,
_SHOTGUN, // red
_SHOTGUN_BLUE,
_SHOTGUN_GOLD,
SHOTGUN, // red
SHOTGUN_BLUE,
SHOTGUN_GOLD,
LAST_ID
};

View File

@ -22,10 +22,10 @@ DECLARE_SHELLEJECTDATA(_56, "models/56_shell.mdl", "modelevent_shell.land")
DECLARE_SHELLEJECTDATA(_556, "models/556_shell.mdl", "modelevent_shell.land")
DECLARE_SHELLEJECTDATA(_22, "models/22_shell.mdl", "modelevent_shell.land")
DECLARE_SHELLEJECTDATA(_9MM, "models/9mm_shell.mdl", "modelevent_shell.land")
DECLARE_SHELLEJECTDATA(_GENERIC, "models/shell.mdl", "modelevent_shell.land")
DECLARE_SHELLEJECTDATA(_SHOTGUN, "models/shotgun_shell.mdl", "modelevent_shotgunshell.land")
DECLARE_SHELLEJECTDATA(_SHOTGUN_BLUE, "models/shotgun_shell_blue.mdl", "modelevent_shotgunshell.land")
DECLARE_SHELLEJECTDATA(_SHOTGUN_GOLD, "models/shotgun_shell_gold.mdl", "modelevent_shotgunshell.land")
DECLARE_SHELLEJECTDATA(GENERIC, "models/shell.mdl", "modelevent_shell.land")
DECLARE_SHELLEJECTDATA(SHOTGUN, "models/shotgun_shell.mdl", "modelevent_shotgunshell.land")
DECLARE_SHELLEJECTDATA(SHOTGUN_BLUE, "models/shotgun_shell_blue.mdl", "modelevent_shotgunshell.land")
DECLARE_SHELLEJECTDATA(SHOTGUN_GOLD, "models/shotgun_shell_gold.mdl", "modelevent_shotgunshell.land")
DECLARE_MUZZLEFLASHDATA(NONE, "")
@ -110,12 +110,11 @@ void setupAmmoData(void){
ASSIGN_SHELLEJECTDATA(_556)
ASSIGN_SHELLEJECTDATA(_22)
ASSIGN_SHELLEJECTDATA(_9MM)
ASSIGN_SHELLEJECTDATA(_GENERIC)
ASSIGN_SHELLEJECTDATA(_SHOTGUN)
ASSIGN_SHELLEJECTDATA(_SHOTGUN_BLUE)
ASSIGN_SHELLEJECTDATA(_SHOTGUN_GOLD)
ASSIGN_SHELLEJECTDATA(GENERIC)
ASSIGN_SHELLEJECTDATA(SHOTGUN)
ASSIGN_SHELLEJECTDATA(SHOTGUN_BLUE)
ASSIGN_SHELLEJECTDATA(SHOTGUN_GOLD)
printfline("ASSIGNMENT HAPPENED");
ASSIGN_MUZZLEFLASHDATA(NONE)
ASSIGN_MUZZLEFLASHDATA(SMALL)
ASSIGN_MUZZLEFLASHDATA(RIFLE)

View File

@ -150,6 +150,8 @@ class player:base_player
// equipped. Not that it could ever change while not equipped anyway.
int prev_forceBodygroup1Submodel;
// same as below for muzzleflash.
int iMuzzleFlashType;
// During a shell-eject event, what member of aryShellEjectData do I use for the model
// and hitsound script file to use? Set on setting the event
int iShellEjectType;

View File

@ -850,8 +850,9 @@ 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_ShowMuzzleFlash(int arg_muzzleFlashTypeID);
void weapon_ShowMuzzleFlash(int arg_muzzleFlashType);
void weapon_EjectShell(int arg_shellEjectType);
void weapon_ClientEffects(int arg_muzzleFlashType, int arg_shellEjectType);
void weapon_precache(weapondata_basic_t* basePRef);
@ -952,11 +953,9 @@ int getAmmoTypeOfWeapon(int arg_weaponID);
#ifdef CLIENT
void viewEv_playShotgunInsertShellSound(void);
// dummy
void w_ejectshell_pistol(void){};
void viewEv_weapon_ShowMuzzleFlash(void);
void viewEv_weapon_EjectShell(void);
void viewEv_weapon_ClientEffects(void)
void copyWeaponConfig(weaponconfig_weapon_t* arg_dest, weaponconfig_weapon_t* arg_src);
void copyConfig(weaponconfig_data_t* arg_dest, weaponconfig_data_t* arg_src);

View File

@ -1827,13 +1827,16 @@ weapon_melee_onDrawHUD(player pl, weapondata_melee_t* basePRef, weapondynamic_t
void
weapon_ShowMuzzleFlash(int arg_muzzleFlashTypeID){
weapon_ShowMuzzleFlash(int arg_muzzleFlashType){
#ifdef CLIENT
if(arg_muzzleFlashTypeID != MUZZLEFLASH_ID::NONE){
muzzleflashdata_t* tempRef = ary_muzzleFlashData[arg_muzzleFlashTypeID];
View_ShowMuzzleflash((*tempRef).iSpritePrecacheID);
if(arg_muzzleFlashType != MUZZLEFLASH_ID::NONE){
// not yet!
//muzzleflashdata_t* tempRef = ary_muzzleFlashData[arg_muzzleFlashType];
//View_ShowMuzzleflash((*tempRef).iSpritePrecacheID);
player pl = (player)self;
pl.iMuzzleFlashType = arg_muzzleFlashType;
View_AddEvent(viewEv_weapon_ShowMuzzleFlash, 0.0f);
}
#else
// anything for other players to see, or will this be per animation in clientside rendering
@ -1851,19 +1854,34 @@ weapon_EjectShell(int arg_shellEjectType)
{
#ifdef CLIENT
player pl = (player)self;
pl.iShellEjectType = arg_shellEjectType;
View_AddEvent(viewEv_weapon_EjectShell, 0.0f);
if(arg_shellEjectType != SHELLEJECT_ID::NONE){
pl.iShellEjectType = arg_shellEjectType;
View_AddEvent(viewEv_weapon_EjectShell, 0.0f);
}
#else
// anything for the playermodel? Also only do that for all players except the
// localplayer if using a viewmodel.
// ...and already this is sounding more like a job for predraw, which does handle
// players rendering players other than themselves. And yes, still clientside.
// anything for the playermodel?
#endif
}
// Both weapon_ShowMuzzleFlash and weapon_EjectShell in one call for scheduling
// one event that calls both, otherwise, only either can happen (one event allowed;
// any more and they just overwrite each other on being set)
void weapon_ClientEffects(int arg_muzzleFlashType, int arg_shellEjectType){
#ifdef CLIENT
player pl = (player)self;
pl.iMuzzleFlashType = arg_muzzleFlashType;
pl.iShellEjectType = arg_shellEjectType;
View_AddEvent(viewEv_weapon_ClientEffects, 0.0f);
#else
// ?
#endif
}
// Precache models and the HUD icon given in FreeTS weapondata.
// Weapon sounds and anything else not in the struct shuold be precached
// Weapon sounds and anything else not in the struct should be precached
// in the weapon's own precache method or globally (precache.qc) if reused
// between different weapons like shell models/sounds.
void
@ -2245,7 +2263,25 @@ viewEv_weapon_EjectShell(void)
// Although that might've been needed earlier unless this event-thing works fine for being
// a playermodel too. Players other than the local one being rendered and needing to drop
// shells, that sounds like a whole other story
CTSShellEject::generateForViewmodel(pl.iShellEjectType);
if(pl.iShellEjectType != SHELLEJECT_ID::NONE){
CTSShellEject::generateForViewmodel(pl.iShellEjectType);
}
}
void
viewEv_weapon_ShowMuzzleFlash(void){
player pl = (player)pSeat->m_ePlayer;
if(pl.iMuzzleFlashType != MUZZLEFLASH_ID::NONE){
muzzleflashdata_t* tempRef = ary_muzzleFlashData[pl.iMuzzleFlashType];
View_ShowMuzzleflash((*tempRef).iSpritePrecacheID);
}
}
void
viewEv_weapon_ClientEffects(void){
viewEv_weapon_EjectShell();
viewEv_weapon_ShowMuzzleFlash();
}

View File

@ -158,10 +158,7 @@ w_ak47_primary(void)
TS_Weapons_ViewAnimation(weaponseq_ak47::shoot2, 31.0f/30.0f);
}
#ifdef CLIENT
weapon_ShowMuzzleFlash(MUZZLEFLASH_ID::RIFLE);
weapon_EjectShell(SHELLEJECT_ID::_56);
#endif
weapon_ClientEffects(MUZZLEFLASH_ID::RIFLE, SHELLEJECT_ID::_56);
weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::AK47], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT);
@ -195,13 +192,12 @@ w_ak47_secondary(void)
pl.setZoom(1.00f);
break;}
case 1:{
pl.setZoom(0.4f);
pl.setZoom(0.40f);
break;}
case 2:{
pl.setZoom(0.1625f);
break;}
}//END OF switch
}
}else{
// no scope? we use ironsights then.
weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::AK47], arg_thisWeapon);

View File

@ -149,10 +149,7 @@ w_barrettm82_primary(void)
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_ClientEffects(MUZZLEFLASH_ID::RIFLE, SHELLEJECT_ID::_56);
weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::BARRETTM82], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT);
@ -182,24 +179,18 @@ w_barrettm82_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 3;
switch(pl.iZoomLevel){
case -1:{
//pl.viewzoom = 32/80;
pl.setZoom(0.4f);
pl.iZoomLevel++;
break;}
case 0:{
//pl.viewzoom = 8/80;
pl.setZoom(0.10f);
pl.iZoomLevel++;
pl.setZoom(1.00f);
break;}
case 1:{
//pl.viewzoom = 0;
pl.setZoom(1.00f);
pl.iZoomLevel = -1;
pl.setZoom(0.40f);
break;}
}//END OF switch
case 2:{
pl.setZoom(0.10f);
break;}
}
}
}

View File

@ -169,9 +169,7 @@ w_benellim3_primary(void)
TS_Weapons_PlaySoundChannelDirect(pl, "weapons/m3/m3-pump.wav", CHAN_AUTO);
// these pumps eject shells
#ifdef CLIENT
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
weapon_EjectShell(SHELLEJECT_ID::SHOTGUN_BLUE);
// float randomChoice = random();
// why the cast to float here? No idea
@ -200,18 +198,12 @@ w_benellim3_primary(void)
if(arg_thisWeapon.iFireMode == BITS_FIREMODE_PUMP){
TS_Weapons_ViewAnimation(weaponseq_benellim3::shootpump, (31.0f/35.0f) );
// no shell! Pumping does that here.
// no shell! Pumping does that.
pl.shotgunWaitingForPump = TRUE;
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
// no shell, that comes in the pump soon after.
#endif
weapon_ShowMuzzleFlash(MUZZLEFLASH_ID::WEIRD);
}else{
TS_Weapons_ViewAnimation(weaponseq_benellim3::shootsemi, (31.0f/35.0f) );
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
weapon_ClientEffects(MUZZLEFLASH_ID::WEIRD, SHELLEJECT_ID::SHOTGUN_BLUE);
}
weapon_base_onAttack_multi(pl, ary_weaponData[WEAPON_ID::BENELLIM3], arg_thisWeapon, 8, BITS_AKIMBOCHOICE_LEFT);
@ -254,19 +246,15 @@ w_benellim3_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case -1:{
//pl.viewzoom = 40/80;
pl.setZoom(0.5f);
pl.iZoomLevel++;
break;}
case 0:{
pl.setZoom(1.00f);
pl.iZoomLevel = -1;
break;}
}//END OF switch
case 1:{
pl.setZoom(0.5f);
break;}
}
}else{
// no ironsight for this
}

View File

@ -167,12 +167,11 @@ w_beretta_primary(void)
TS_Weapons_ViewAnimation(weaponseq_beretta::shootempty, 31.0f/35.0f);
}
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){
weapon_ClientEffects(MUZZLEFLASH_ID::SMALL, SHELLEJECT_ID::_9MM);
} else {
weapon_EjectShell(SHELLEJECT_ID::_9MM);
}
weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::BERETTA], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT);

View File

@ -150,10 +150,9 @@ w_contenderg2_primary(void)
TS_Weapons_ViewAnimation(weaponseq_contenderg2::shoot2, 31.0f/30.0f);
}
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
// guessing a shell-eject doesn't happen, could be wrong.
//weapon_ClientEffects(MUZZLEFLASH_ID::RIFLE, SHELLEJECT_ID::_56);
weapon_ShowMuzzleFlash(MUZZLEFLASH_ID::RIFLE);
weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::CONTENDERG2], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT);
@ -181,21 +180,15 @@ w_contenderg2_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case -1:{
//pl.viewzoom = 26/80;
pl.setZoom(0.325f);
pl.iZoomLevel++;
break;}
case 0:{
//pl.viewzoom = 0;
pl.setZoom(1.00f);
pl.iZoomLevel = -1;
break;}
}//END OF switch
case 1:{
pl.setZoom(0.325f);
break;}
}
}
}

View File

@ -100,8 +100,6 @@ w_deserteagle_precache(void)
void
w_deserteagle_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
@ -193,10 +191,11 @@ w_deserteagle_primary(void)
}
}
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){
weapon_ClientEffects(MUZZLEFLASH_ID::SMALL, SHELLEJECT_ID::GENERIC);
} else {
weapon_EjectShell(SHELLEJECT_ID::GENERIC);
}
weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::DESERTEAGLE], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT);
@ -226,19 +225,15 @@ w_deserteagle_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case -1:{
//pl.viewzoom = 60/80;
pl.setZoom(0.75f);
pl.iZoomLevel++;
break;}
case 0:{
pl.setZoom(1.00f);
pl.iZoomLevel = -1;
break;}
}//END OF switch
case 1:{
pl.setZoom(0.75f);
break;}
}
}else{
// no scope? we use ironsights then.
weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::DESERTEAGLE], arg_thisWeapon);

View File

@ -157,11 +157,11 @@ w_fiveseven_primary(void)
TS_Weapons_ViewAnimation(weaponseq_fiveseven::shootlast, 31.0f/40.0f);
}
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){
weapon_ClientEffects(MUZZLEFLASH_ID::SMALL, SHELLEJECT_ID::_56);
} else {
weapon_EjectShell(SHELLEJECT_ID::_56);
}
weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::FIVESEVEN], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT);

View File

@ -176,9 +176,24 @@ w_glock18_primary(void)
// TODO.
// For now using lazy HL defaults for muzzle flashes, I'll leave
// TS's own muzzle flashes, whichever ones are even used, for another time
weapon_ShowMuzzleFlash(MUZZLEFLASH_ID::SMALL);
weapon_EjectShell(SHELLEJECT_ID::_9MM);
//weapon_ShowMuzzleFlash(MUZZLEFLASH_ID::SMALL);
//weapon_EjectShell(SHELLEJECT_ID::_9MM);
// Nope! Doing both in the same event for now, not sure if any other options
// to not have issues with packet delays.
// The old way in ShowMuzzleFlash didn't use the event system, so it being called
// every single frame until a server update (force packet delays) resets the muzzle
// flash to full until the ping-time is reached. It appears to stay solid the whole
// time. But doing two events at the same time is not an option because there is
// only one event at a time that can be stored, see Nuclide's src/cleint/view.qc,
// m_pEventCall. Being set before it is reached, exact same 0.0 time or not, overwrites
// the previous value so only the most recent call has any effect.
// One method, "weapon_ViewModelEffects" that accepts both will do, since NONE are also
// choices for any oddballs out there
if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){
weapon_ClientEffects(MUZZLEFLASH_ID::SMALL, SHELLEJECT_ID::_9MM);
} else {
weapon_EjectShell(SHELLEJECT_ID::_9MM);
}
weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::GLOCK18], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT);

View File

@ -156,11 +156,11 @@ w_glock20_primary(void)
TS_Weapons_ViewAnimation(weaponseq_glock20::shootempty, 31.0f/30.0f);
}
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){
weapon_ClientEffects(MUZZLEFLASH_ID::SMALL, SHELLEJECT_ID::GENERIC);
} else {
weapon_EjectShell(SHELLEJECT_ID::GENERIC);
}
weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::GLOCK20], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT);

View File

@ -157,10 +157,11 @@ w_hkpdw_primary(void)
TS_Weapons_ViewAnimation(weaponseq_hkpdw::shoot3, 21.0f/30.0f);
}
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){
weapon_ClientEffects(MUZZLEFLASH_ID::RIFLE, SHELLEJECT_ID::_56);
} else {
weapon_EjectShell(SHELLEJECT_ID::_56);
}
weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::HKPDW], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT);
@ -188,21 +189,15 @@ w_hkpdw_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case -1:{
//pl.viewzoom = 40/80;
pl.setZoom(0.50f);
pl.iZoomLevel++;
break;}
case 0:{
//pl.viewzoom = 0;
pl.setZoom(1.00f);
pl.iZoomLevel = -1;
break;}
}//END OF switch
case 1:{
pl.setZoom(0.50f);
break;}
}
}
}

View File

@ -190,12 +190,7 @@ w_m16a4_primary(void)
}
}
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
weapon_ClientEffects(MUZZLEFLASH_ID::RIFLE, SHELLEJECT_ID::_56);
if(arg_thisWeapon.iFireMode == BITS_FIREMODE_BURST)
{
@ -240,25 +235,18 @@ w_m16a4_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 3;
switch(pl.iZoomLevel){
case -1:{
//pl.viewzoom = 32/80;
pl.setZoom(0.4f);
pl.iZoomLevel++;
break;}
case 0:{
//pl.viewzoom = 8/80;
pl.setZoom(0.10f);
pl.iZoomLevel++;
pl.setZoom(1.00f);
break;}
case 1:{
//pl.viewzoom = 0;
pl.setZoom(1.00f);
pl.iZoomLevel = -1;
pl.setZoom(0.40f);
break;}
}//END OF switch
case 2:{
pl.setZoom(0.10f);
break;}
}
}else{
// no scope? we use ironsights then.
weapon_ironsight_ToggleIronsight(pl , (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::M16A4], arg_thisWeapon);

View File

@ -214,10 +214,11 @@ w_m4a1_primary(void)
}
}
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){
weapon_ClientEffects(MUZZLEFLASH_ID::RIFLE, SHELLEJECT_ID::_56);
} else {
weapon_EjectShell(SHELLEJECT_ID::_56);
}
weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::M4A1], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT);
@ -245,21 +246,15 @@ w_m4a1_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case -1:{
//pl.viewzoom = 26/80;
pl.setZoom(0.325f);
pl.iZoomLevel++;
break;}
case 0:{
//pl.viewzoom = 0;
pl.setZoom(1.00f);
pl.iZoomLevel = -1;
break;}
}//END OF switch
case 1:{
pl.setZoom(0.325f);
break;}
}
}else{
// no scope? we use ironsights then.
weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::M4A1], arg_thisWeapon);

View File

@ -139,11 +139,7 @@ w_m60_primary(void)
TS_Weapons_ViewAnimation(weaponseq_m60::shoot2, 31.0f/33.0f);
}
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
weapon_ClientEffects(MUZZLEFLASH_ID::RIFLE, SHELLEJECT_ID::_56);
weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::M60], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT);

View File

@ -203,11 +203,11 @@ w_mac10_primary(void)
}
}
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){
weapon_ClientEffects(MUZZLEFLASH_ID::SMALL, SHELLEJECT_ID::GENERIC);
} else {
weapon_EjectShell(SHELLEJECT_ID::GENERIC);
}
weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::MAC10], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT);

View File

@ -195,10 +195,11 @@ w_miniuzi_primary(void)
}
}
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){
weapon_ClientEffects(MUZZLEFLASH_ID::SMALL, SHELLEJECT_ID::_9MM);
} else {
weapon_EjectShell(SHELLEJECT_ID::_9MM);
}
weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::MINIUZI], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT);

View File

@ -195,9 +195,7 @@ w_mossberg500_primary(void)
TS_Weapons_PlaySoundChannelDirect(pl, "weapons/m3/m3-pump.wav", CHAN_AUTO);
// these pumps eject shells
#ifdef CLIENT
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
weapon_EjectShell(SHELLEJECT_ID::SHOTGUN_GOLD);
if(!arg_thisWeapon.iIronSight){
TS_Weapons_ViewAnimation(weaponseq_mossberg500::pump, 31.0f/35.0f);
@ -232,13 +230,9 @@ w_mossberg500_primary(void)
TS_Weapons_ViewAnimation(weaponseq_mossberg500::shootb, 31.0f/35.0f);
}
// no shell! Pumping does that here.
// no shell! Pumping does that.
pl.shotgunWaitingForPump = TRUE;
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
// no shell, that comes in the pump soon after.
#endif
weapon_ShowMuzzleFlash(MUZZLEFLASH_ID::WEIRD);
//}
weapon_base_onAttack_multi(pl, ary_weaponData[WEAPON_ID::MOSSBERG500], arg_thisWeapon, 8, BITS_AKIMBOCHOICE_LEFT);

View File

@ -187,10 +187,11 @@ w_mp5k_primary(void)
}
}
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){
weapon_ClientEffects(MUZZLEFLASH_ID::SMALL, SHELLEJECT_ID::_9MM);
} else {
weapon_EjectShell(SHELLEJECT_ID::_9MM);
}
if(arg_thisWeapon.iFireMode == BITS_FIREMODE_BURST)
{
@ -230,20 +231,15 @@ w_mp5k_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case -1:{
//pl.viewzoom = 32/80;
pl.setZoom(0.40f);
pl.iZoomLevel++;
break;}
case 0:{
//pl.viewzoom = 0;
pl.setZoom(1.00f);
pl.iZoomLevel = -1;
break;}
}//END OF switch
case 1:{
pl.setZoom(0.40f);
break;}
}
}else{
// no scope? we use ironsights then.
weapon_ironsight_ToggleIronsight(pl, (weapondata_ironsight_t*)ary_weaponData[WEAPON_ID::MP5K], arg_thisWeapon);

View File

@ -162,11 +162,8 @@ w_mp5sd_primary(void)
TS_Weapons_ViewAnimation(weaponseq_mp5sd::shoot3, 31.0f/30.0f);
}
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
weapon_EjectShell(SHELLEJECT_ID::_9MM);
if(arg_thisWeapon.iFireMode == BITS_FIREMODE_BURST)
{
weapon_gun_burstFire(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::MP5SD], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT, 3, 0.02, 0.18);
@ -205,19 +202,15 @@ w_mp5sd_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case -1:{
//pl.viewzoom = 32/80;
pl.setZoom(0.40f);
pl.iZoomLevel++;
break;}
case 0:{
//pl.viewzoom = 0;
pl.setZoom(1.00f);
pl.iZoomLevel = -1;
break;}
}//END OF switch
case 1:{
pl.setZoom(0.40f);
break;}
}
}
}

View File

@ -146,10 +146,8 @@ w_ragingbull_primary(void)
TS_Weapons_ViewAnimation(weaponseq_ragingbull::shoot2, 31.0f/30.0f);
}
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
// no shell eject
weapon_ShowMuzzleFlash(MUZZLEFLASH_ID::RIFLE);
weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::RAGINGBULL], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT);
@ -177,21 +175,15 @@ w_ragingbull_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case -1:{
//pl.viewzoom = 40/80;
pl.setZoom(0.5f);
pl.iZoomLevel++;
break;}
case 0:{
//pl.viewzoom = 0;
pl.setZoom(1.00f);
pl.iZoomLevel = -1;
break;}
}//END OF switch
case 1:{
pl.setZoom(0.50f);
break;}
}
}
}

View File

@ -150,10 +150,7 @@ w_rugermk1_primary(void)
TS_Weapons_ViewAnimation(weaponseq_rugermk1::shoot2, 31.0f/35.0f);
}
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
//View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
weapon_EjectShell(SHELLEJECT_ID::GENERIC);
weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::RUGERMK1], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT);

View File

@ -201,10 +201,8 @@ w_sawedoff_primary(void)
}
}
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
//View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
// no shell eject
weapon_ShowMuzzleFlash(MUZZLEFLASH_ID::SMALL);
weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::SAWEDOFF], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT);

View File

@ -146,10 +146,7 @@ w_skorpion_primary(void)
TS_Weapons_ViewAnimation(weaponseq_skorpion::fire3, 31.0f/30.0f);
}
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
weapon_ClientEffects(MUZZLEFLASH_ID::SMALL, SHELLEJECT_ID::GENERIC);
weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::SKORPION], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT);

View File

@ -182,11 +182,11 @@ w_socommk23_primary(void)
}
}
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){
weapon_ClientEffects(MUZZLEFLASH_ID::SMALL, SHELLEJECT_ID::GENERIC);
} else {
weapon_EjectShell(SHELLEJECT_ID::GENERIC);
}
weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::SOCOMMK23], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT);

View File

@ -169,9 +169,7 @@ w_spas12_primary(void)
TS_Weapons_PlaySoundChannelDirect(pl, "weapons/spas12/spas12-pump.wav", CHAN_AUTO);
// these pumps eject shells
#ifdef CLIENT
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
weapon_EjectShell(SHELLEJECT_ID::SHOTGUN);
int r = (float)input_sequence % 2;
if(r == 0){
@ -197,18 +195,12 @@ w_spas12_primary(void)
if(arg_thisWeapon.iFireMode == BITS_FIREMODE_PUMP){
TS_Weapons_ViewAnimation(weaponseq_spas12::shootpump, (31.0f/35.0f) );
// no shell! Pumping does that here.
// no shell! Pumping does that.
pl.shotgunWaitingForPump = TRUE;
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
// no shell, that comes in the pump soon after.
#endif
weapon_ShowMuzzleFlash(MUZZLEFLASH_ID::WEIRD);
}else{
TS_Weapons_ViewAnimation(weaponseq_spas12::shootsemi, (31.0f/35.0f) );
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
weapon_ClientEffects(MUZZLEFLASH_ID::WEIRD, SHELLEJECT_ID::SHOTGUN);
}
weapon_base_onAttack_multi(pl, ary_weaponData[WEAPON_ID::SPAS12], arg_thisWeapon, 8, BITS_AKIMBOCHOICE_LEFT);

View File

@ -146,13 +146,14 @@ w_steyraug_primary(void)
} 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
TS_Weapons_ViewAnimation(weaponseq_steyraug::shoot, 31.0f/30.0f);
if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){
weapon_ClientEffects(MUZZLEFLASH_ID::RIFLE, SHELLEJECT_ID::_56);
} else {
weapon_EjectShell(SHELLEJECT_ID::_56);
}
weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::STEYRAUG], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT);
@ -180,21 +181,15 @@ w_steyraug_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case -1:{
//pl.viewzoom = 40/80;
pl.setZoom(0.5f);
pl.iZoomLevel++;
break;}
case 0:{
//pl.viewzoom = 0;
pl.setZoom(1.00f);
pl.iZoomLevel = -1;
break;}
}//END OF switch
case 1:{
pl.setZoom(0.50f);
break;}
}
}
}

View File

@ -180,10 +180,11 @@ w_steyrtmp_primary(void)
}
}
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){
weapon_ClientEffects(MUZZLEFLASH_ID::SMALL, SHELLEJECT_ID::_9MM);
} else {
weapon_EjectShell(SHELLEJECT_ID::_9MM);
}
weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::STEYRTMP], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT);

View File

@ -160,10 +160,11 @@ w_ump_primary(void)
TS_Weapons_ViewAnimation(weaponseq_ump::shoot3, 19.0f/30.0f);
}
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){
weapon_ClientEffects(MUZZLEFLASH_ID::SMALL, SHELLEJECT_ID::GENERIC);
} else {
weapon_EjectShell(SHELLEJECT_ID::GENERIC);
}
weapon_base_onAttack(pl, ary_weaponData[WEAPON_ID::UMP], arg_thisWeapon, BITS_AKIMBOCHOICE_LEFT);
@ -191,20 +192,15 @@ w_ump_secondary(void)
if(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SCOPE){
// toggle through the zoom.
pl.iZoomLevel = (pl.iZoomLevel + 1) % 2;
switch(pl.iZoomLevel){
case -1:{
//pl.viewzoom = 40/80;
pl.setZoom(0.50f);
pl.iZoomLevel++;
break;}
case 0:{
//pl.viewzoom = 0;
pl.setZoom(1.00f);
pl.iZoomLevel = -1;
break;}
}//END OF switch
case 1:{
pl.setZoom(0.50f);
break;}
}
}
}

View File

@ -135,11 +135,7 @@ w_usas12_primary(void)
TS_Weapons_ViewAnimation(weaponseq_usas12::shootsemi, 31.0f/35.0f);
#ifdef CLIENT
View_ShowMuzzleflash(MUZZLE_SMALL);
View_AddEvent(w_ejectshell_pistol, 0.0f);
#endif
weapon_ClientEffects(MUZZLEFLASH_ID::WEIRD, SHELLEJECT_ID::SHOTGUN);
weapon_base_onAttack_multi(pl, ary_weaponData[WEAPON_ID::USAS12], arg_thisWeapon, 8, BITS_AKIMBOCHOICE_LEFT);