diff --git a/src/client/cmds.qc b/src/client/cmds.qc index 34d091c..0068e0a 100644 --- a/src/client/cmds.qc +++ b/src/client/cmds.qc @@ -41,11 +41,33 @@ ClientGame_ConsoleCommand(void) TS_playerChangeFiremode(); //pSeatLocal->m_bFireModeFreshPress = TRUE; break; - case "useitems": - TS_playerUseItems(); + +#if USE_ITEMS_PREDICTION_TEST == 0 + //case "useitems" + // TS_playerUseItems(); + // break; + case "+useitems": + pl = (player)pSeat->m_ePlayer; + if( !(pl.gflags & GF_UNUSED3)){ + TS_playerUseItems(); + } + pl.gflags |= GF_UNUSED3; + break; + case "-useitems": + pl = (player)pSeat->m_ePlayer; + pl.gflags &= ~GF_UNUSED3; + break; +#else + case "+useitems": + //TS_playerUseItems(); //pSeatLocal->m_bUseItemsFreshPress = TRUE; pSeatLocal->m_bUseItems = TRUE; break; + case "-useitems": + pSeatLocal->m_bUseItems = FALSE; + break; +#endif + case "usepowerup": TS_playerUsePowerup(); break; diff --git a/src/client/init.qc b/src/client/init.qc index 5d2697c..8c2bc47 100644 --- a/src/client/init.qc +++ b/src/client/init.qc @@ -78,7 +78,10 @@ ClientGame_Init(float apilevel, string enginename, float engineversion) registercommand("getangle"); registercommand("firemode"); - registercommand("useitems"); + + registercommand("+useitems"); + registercommand("-useitems"); + registercommand("usepowerup"); registercommand("+alt1"); registercommand("-alt1"); diff --git a/src/client/progs.src b/src/client/progs.src index 58b2052..5697064 100644 --- a/src/client/progs.src +++ b/src/client/progs.src @@ -1,5 +1,14 @@ -#pragma target fte -#pragma progs_dat "../../csprogs.dat" + +// SHARED CONFIG SETTING - set this consistently between client/server progs! +// If 0, nothing special. +// If 1, Makes some changes to enable prediction for useitems. +// Spams the turn-on click noise though. +// Doubt this is worth further support as I don't know how to support this for +// more than one extra feature, the INPUT_BUTTON# list is exhausted after this. +#define USE_ITEMS_PREDICTION_TEST 0 + + +/////////////////////////////////////////////////////////////////////////////// //---WARNINGS DISABLED--- #pragma warning disable Q302 /*uninitialised locals*/ @@ -8,8 +17,10 @@ // No idea how to make warnings disabled only per file, in there // would affect all files included in the compile after anyway #pragma warning disable F314 /*implicit cast*/ -///////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +#pragma target fte +#pragma progs_dat "../../csprogs.dat" #define CSQC #define CLIENT diff --git a/src/server/progs.src b/src/server/progs.src index a4cd72a..f746993 100644 --- a/src/server/progs.src +++ b/src/server/progs.src @@ -1,12 +1,23 @@ -#pragma target fte -#pragma progs_dat "../../progs.dat" + +// SHARED CONFIG SETTING - set this consistently between client/server progs! +// If 0, nothing special. +// If 1, Makes some changes to enable prediction for useitems. +// Spams the turn-on click noise though. +// Doubt this is worth further support as I don't know how to support this for +// more than one extra feature, the INPUT_BUTTON# list is exhausted after this. +#define USE_ITEMS_PREDICTION_TEST 0 + + +/////////////////////////////////////////////////////////////////////////////// //---WARNINGS DISABLED--- // As of now, the only warnings left are for the server/gamerules.qc unused globals // like sRule_TeamNames. #pragma warning disable Q302 /*uninitialised locals*/ -///////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +#pragma target fte +#pragma progs_dat "../../progs.dat" #define QWSSQC #define SERVER diff --git a/src/shared/defs.h b/src/shared/defs.h index 2b31a3f..ee6ca05 100644 --- a/src/shared/defs.h +++ b/src/shared/defs.h @@ -16,7 +16,8 @@ enum TS_Team{ // Uhh. Please work? -#define INPUT_BUTTON9 0x00000100 +// nope. it does not. +//#define INPUT_BUTTON9 0x00000100 #ifdef SERVER diff --git a/src/shared/event_custom.qc b/src/shared/event_custom.qc index fb42de0..f1725d3 100644 --- a/src/shared/event_custom.qc +++ b/src/shared/event_custom.qc @@ -623,8 +623,8 @@ TS_playerUseItems(void){ return; } - //_TS_playerUseItems(); +#if USE_ITEMS_PREDICTION_TEST == 0 #ifdef CLIENT sendevent("TS_playerUseItems", ""); @@ -634,6 +634,13 @@ TS_playerUseItems(void){ // SHOULD NOT HAPPEN, should call the CSEv_ version instead #endif + +#else + // always do this then + _TS_playerUseItems(); +#endif + + } diff --git a/src/shared/input.qc b/src/shared/input.qc index 4874b32..287c4d6 100644 --- a/src/shared/input.qc +++ b/src/shared/input.qc @@ -335,14 +335,22 @@ Game_Input(void) - - if(input_buttons & INPUT_BUTTON9){ +#if USE_ITEMS_PREDICTION_TEST == 1 + //INPUT_BUTTON2 reserved for jump... + //INPUT_BUTTON6 + //INPUT_BUTTON7 (used for sneaking currently) + if(input_buttons & INPUT_BUTTON6){ //printfline("IM here what"); - //TS_playerUseItems(); + + if( !(pl.gflags & GF_UNUSED3)){ + TS_playerUseItems(); + } + pl.gflags |= GF_UNUSED3; + }else{ + pl.gflags &= ~GF_UNUSED3; + } - - - +#endif @@ -502,7 +510,6 @@ void ClientGame_Input_Frame(void){ // unless there is some other way that I'm missing. if (pSeatLocal->m_iInputSpeed == TRUE) { - //input_buttons |= INPUT_BUTTON9; input_buttons |= INPUT_BUTTON7; //self.flags |= FL_SNEAK; }else{ @@ -510,10 +517,15 @@ void ClientGame_Input_Frame(void){ } //printfline("input_buttons: %d", (INPUT_BUTTON7 & input_buttons) ); + +#if USE_ITEMS_PREDICTION_TEST == 1 if(pSeatLocal->m_bUseItems){ - pSeatLocal->m_bUseItems = FALSE; - input_buttons |= INPUT_BUTTON9; + //pSeatLocal->m_bUseItems = FALSE; + input_buttons |= INPUT_BUTTON6; } +#endif + + } diff --git a/src/shared/player.qc b/src/shared/player.qc index 86ba95a..16e3569 100644 --- a/src/shared/player.qc +++ b/src/shared/player.qc @@ -1892,6 +1892,8 @@ player::preThinkShared(void){ + //TAGGG - any use for input_angles here? Shared, predicted? + // TODO: make this view kickback properly predicted #ifdef CLIENT //printfline("So what is my view ang?? %.2f %.2f", view_angles[0], view_angles[1]); diff --git a/src/shared/weapons.qc b/src/shared/weapons.qc index b5a689b..ab91920 100644 --- a/src/shared/weapons.qc +++ b/src/shared/weapons.qc @@ -11,15 +11,11 @@ - weapon_t w_null = {}; // Populate each slot with a member of the enum early on in runtime instead. weapon_t g_weapons[WEAPON_ID::LAST_ID]; -// Not needed here anymore? -//var int g_weapon_weights[g_weapons.lengdth]; - void weaponconfig_data_init(weaponconfig_data_t* arg_this) @@ -322,7 +318,12 @@ weapon_base_onAttack_multi(player pl, weapondata_basic_t* basePRef, weapondynami { weapondata_gun_t baseRef = *((weapondata_gun_t*)basePRef); + + //TAGGG - shared random test float randoAngFactor = randomInRange_f(0, 1); + //float randoAngFactor = 0.5; + + //float finalAng = (40 + randoAngFactor*( (90-40)*2 ) ) *(M_PI/180); @@ -332,7 +333,7 @@ weapon_base_onAttack_multi(player pl, weapondata_basic_t* basePRef, weapondynami float kickbackToApply = pl.fAccuracyKickback; if(baseAcc < 0.001){ - //minimum enforced, per notes in wepon_official.txt + // minimum enforced, per notes in weapons_official.txt baseAcc = 0.001; } @@ -387,15 +388,17 @@ weapon_base_onAttack_multi(player pl, weapondata_basic_t* basePRef, weapondynami //////////////////////////////////////////////////////////////////////////////////////////////// - //TAGGG - TODO! The last parameter of TraceAttack_FireBullets should use the Weapon ID, - // like "WEAPON_ID::Glock18". Consider sending that as a parameter to be available here + //TAGGG - TODO! Re-picking the angle to kickback per hit may make more sense than varrying the intensity + // of the exact same direction for both shots, just a thought if(attackTypeUsed & BITS_AKIMBOCHOICE_LEFT){ //left #ifdef SERVER TraceAttack_FireBullets(shellCount, (pl.origin + pl.view_ofs), baseRef.fAttackDamage, [acc, acc], (int)pl.activeweapon); #endif arg_thisWeapon.iClipLeft -= 1; + //TAGGG - shared random test toGo = [-sin(finalAng), cos(finalAng), 0] * baseRef.firestats.fViewKickback * randomInRange_f(miner, maxer); + //toGo = [-sin(finalAng), cos(finalAng), 0] * baseRef.firestats.fViewKickback * 0.7; pl.vViewAngleOffsetTarget += toGo; } if(attackTypeUsed & BITS_AKIMBOCHOICE_RIGHT){ @@ -405,7 +408,9 @@ weapon_base_onAttack_multi(player pl, weapondata_basic_t* basePRef, weapondynami TraceAttack_FireBullets(shellCount, (pl.origin + pl.view_ofs), baseRef.fAttackDamage, [acc, acc], (int)pl.activeweapon); #endif arg_thisWeapon.iClipAkimboLeft -= 1; + //TAGGG - shared random test toGo = [-sin(finalAng), cos(finalAng), 0] * baseRef.firestats.fViewKickback * randomInRange_f(miner, maxer); + //toGo = [-sin(finalAng), cos(finalAng), 0] * baseRef.firestats.fViewKickback * 0.7; pl.vViewAngleOffsetTarget += toGo; } @@ -940,7 +945,7 @@ weapon_akimbo_semiAttackChoice( int finalAkimboChoice = BITS_AKIMBOCHOICE_NONE; weapondata_basic_t baseRef = *basePRef; - //printfline("PRE - EVERYBODY GET DOWN x - next:%d", pl.nextAkimboAttackPreference); + //printfline("PRE - weapon_akimbo_semiAttackChoice x - next:%d", pl.nextAkimboAttackPreference); /* if(pl.akimboTest != 0){ @@ -948,6 +953,7 @@ weapon_akimbo_semiAttackChoice( } */ + //if(pl.akimboTest == 0) if(attackTypeUsed & BITS_AKIMBOCHOICE_LEFT){ // only allow it if this is a fresh button press @@ -1119,7 +1125,7 @@ weapon_akimbo_semiAttackChoice( } - //printfline("EVERYBODY GET DOWN %i - next:%d", finalAkimboChoice, pl.nextAkimboAttackPreference); + //printfline("POST - weapon_akimbo_semiAttackChoice %i - next:%d", finalAkimboChoice, pl.nextAkimboAttackPreference); return finalAkimboChoice; }// weapon_akimbo_semiAttackChoice @@ -2345,6 +2351,10 @@ viewEv_weapon_EjectShell(void) */ } + +var int testCount1 = 0; +var int testCount2 = 0; + void viewEv_weapon_ShowMuzzleFlash(void) { @@ -2352,6 +2362,14 @@ viewEv_weapon_ShowMuzzleFlash(void) if(pl.iMuzzleFlashType != MUZZLEFLASH_ID::NONE){ muzzleflashdata_t* tempRef = ary_muzzleFlashData[pl.iMuzzleFlashType]; TS_View_ShowMuzzleflash(tempRef->iSpritePrecacheID, pl.iMuzzleFlashAkimboChoice); + + if(pl.iMuzzleFlashAkimboChoice==BITS_AKIMBOCHOICE_LEFT){ + testCount1++; + }else if(pl.iMuzzleFlashAkimboChoice==BITS_AKIMBOCHOICE_RIGHT){ + testCount2++; + } + printf("Hello? %i %i\n", testCount1, testCount2); + } } diff --git a/src/shared/weapons/weapon_akimbocolts.qc b/src/shared/weapons/weapon_akimbocolts.qc index f147454..c7e84cc 100644 --- a/src/shared/weapons/weapon_akimbocolts.qc +++ b/src/shared/weapons/weapon_akimbocolts.qc @@ -253,6 +253,12 @@ void weapon_akimbocolts_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[pl.activeweapon]).fAttackDelay * 1); } + if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ + weapon_ClientEffectsAkimbo(MUZZLEFLASH_ID::SMALL, SHELLEJECT_ID::GENERIC, finalAkimboChoice); + } else { + weapon_EjectShellAkimbo(SHELLEJECT_ID::GENERIC, finalAkimboChoice); + } + }// weapon_akimbocolts_akimbo_attack @@ -278,8 +284,6 @@ w_akimbocolts_reload(void) weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::AKIMBOCOLTS], arg_thisWeapon); - leftCount = 0; - rightCount = 0; } float diff --git a/src/shared/weapons/weapon_beretta_akimbo.qc b/src/shared/weapons/weapon_beretta_akimbo.qc index 1eeb9ca..1a4e20f 100644 --- a/src/shared/weapons/weapon_beretta_akimbo.qc +++ b/src/shared/weapons/weapon_beretta_akimbo.qc @@ -310,6 +310,12 @@ void weapon_beretta_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, int weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[pl.activeweapon]).fAttackDelay * 1); } + if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ + weapon_ClientEffectsAkimbo(MUZZLEFLASH_ID::SMALL, SHELLEJECT_ID::_9MM, finalAkimboChoice); + } else { + weapon_EjectShellAkimbo(SHELLEJECT_ID::_9MM, finalAkimboChoice); + } + }// weapon_beretta_akimbo_attack @@ -333,8 +339,6 @@ w_beretta_akimbo_reload(void) weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::BERETTA_AKIMBO], arg_thisWeapon); - leftCount = 0; - rightCount = 0; } float diff --git a/src/shared/weapons/weapon_fiveseven_akimbo.qc b/src/shared/weapons/weapon_fiveseven_akimbo.qc index 3fa49d9..818c329 100644 --- a/src/shared/weapons/weapon_fiveseven_akimbo.qc +++ b/src/shared/weapons/weapon_fiveseven_akimbo.qc @@ -253,6 +253,12 @@ void weapon_fiveseven_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, i weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[pl.activeweapon]).fAttackDelay * 1); } + if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ + weapon_ClientEffectsAkimbo(MUZZLEFLASH_ID::SMALL, SHELLEJECT_ID::_56, finalAkimboChoice); + } else { + weapon_EjectShellAkimbo(SHELLEJECT_ID::_56, finalAkimboChoice); + } + }// weapon_fiveseven_akimbo_attack @@ -276,8 +282,6 @@ w_fiveseven_akimbo_reload(void) weapondynamic_t arg_thisWeapon = pl.ary_myWeapons[pl.inventoryEquippedIndex]; weapon_gun_Reload(pl, (weapondata_gun_t*)ary_weaponData[WEAPON_ID::FIVESEVEN_AKIMBO], arg_thisWeapon); - leftCount = 0; - rightCount = 0; } float diff --git a/src/shared/weapons/weapon_miniuzi_akimbo.qc b/src/shared/weapons/weapon_miniuzi_akimbo.qc index e5b4135..13aac4d 100644 --- a/src/shared/weapons/weapon_miniuzi_akimbo.qc +++ b/src/shared/weapons/weapon_miniuzi_akimbo.qc @@ -263,6 +263,12 @@ void weapon_miniuzi_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, int weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[pl.activeweapon]).fAttackDelay * 1); } + if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ + weapon_ClientEffectsAkimbo(MUZZLEFLASH_ID::SMALL, SHELLEJECT_ID::_9MM, finalAkimboChoice); + } else { + weapon_EjectShellAkimbo(SHELLEJECT_ID::_9MM, finalAkimboChoice); + } + }// weapon_miniuzi_akimbo_attack diff --git a/src/shared/weapons/weapon_skorpion_akimbo.qc b/src/shared/weapons/weapon_skorpion_akimbo.qc index d6a656a..4362a53 100644 --- a/src/shared/weapons/weapon_skorpion_akimbo.qc +++ b/src/shared/weapons/weapon_skorpion_akimbo.qc @@ -222,6 +222,12 @@ void weapon_skorpion_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, in weapon_base_setWholeAttackDelay(pl, (*ary_weaponData[pl.activeweapon]).fAttackDelay * 1); } + if(!(arg_thisWeapon.iBitsUpgrade & BITS_WEAPONOPT_SILENCER) ){ + weapon_ClientEffectsAkimbo(MUZZLEFLASH_ID::SMALL, SHELLEJECT_ID::GENERIC, finalAkimboChoice); + } else { + weapon_EjectShellAkimbo(SHELLEJECT_ID::GENERIC, finalAkimboChoice); + } + }// weapon_skorpion_akimbo_attack diff --git a/src/shared/weapons/weapon_socommk23_akimbo.qc b/src/shared/weapons/weapon_socommk23_akimbo.qc index 1834db7..80ad630 100644 --- a/src/shared/weapons/weapon_socommk23_akimbo.qc +++ b/src/shared/weapons/weapon_socommk23_akimbo.qc @@ -50,7 +50,11 @@ weapondata_ironsight_t weapon_socommk23_akimbo = weaponseq_socommk23_akimbo::idle, weaponseq_socommk23_akimbo::draw, 31.0f / 40.0f, + 0.19f, //fire delay + //0.03f, + //0.15f, + 15.0f, //dmg TRUE, BITS_WEAPONOPT_SILENCER | BITS_WEAPONOPT_LASERSIGHT | BITS_WEAPONOPT_FLASHLIGHT | BITS_WEAPONOPT_AKIMBO, @@ -143,9 +147,10 @@ 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 @@ -195,6 +200,7 @@ void weapon_socommk23_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, i return; } + /* // DEBUG!!! if((finalAkimboChoice & BITS_AKIMBOCHOICE_LEFT)){ leftCount++; @@ -203,6 +209,7 @@ void weapon_socommk23_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, i 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 @@ -319,7 +326,6 @@ void weapon_socommk23_akimbo_attack(player pl, weapondynamic_t arg_thisWeapon, i weapon_EjectShellAkimbo(SHELLEJECT_ID::GENERIC, finalAkimboChoice); } - }// weapon_socommk23_akimbo_attack @@ -344,8 +350,8 @@ w_socommk23_akimbo_reload(void) 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; + //leftCount = 0; + //rightCount = 0; } float diff --git a/zpak001.pk3dir/default.cfg b/zpak001.pk3dir/default.cfg index 567dfdf..c9f36ea 100644 --- a/zpak001.pk3dir/default.cfg +++ b/zpak001.pk3dir/default.cfg @@ -44,7 +44,7 @@ bind "f2" "vote no" bind "m" "chooseteam" bind "b" "buy" bind "f" "firemode" -bind "n" "useitems" +bind "n" "+useitems" // stunt-related (TODO) bind "MOUSE3" "+alt1" // coldcock (some gun's melee)