From 8c29795ebbbf3640b30ba838042ddc68342742bf Mon Sep 17 00:00:00 2001 From: Chris Dawalt Date: Fri, 27 Aug 2021 06:05:50 -0400 Subject: [PATCH] Tiny bugfix. Crash on vid_reset while unspawned, sneak restored in default.cfg --- src/client/cmds.qc | 7 ++++--- src/client/init.qc | 2 +- src/client/view.qc | 5 +++++ src/shared/event_custom.qc | 2 ++ src/shared/input.qc | 5 +++++ zpak001.pk3dir/default.cfg | 4 +++- 6 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/client/cmds.qc b/src/client/cmds.qc index d8d57e4..34d091c 100644 --- a/src/client/cmds.qc +++ b/src/client/cmds.qc @@ -23,10 +23,11 @@ ClientGame_ConsoleCommand(void) switch(argv(0)) { - case "+speed": + // Can't be exactly "speed". No idea why. + case "+speedcustom": pSeatLocal->m_iInputSpeed = TRUE; break; - case "-speed": + case "-speedcustom": pSeatLocal->m_iInputSpeed = FALSE; break; @@ -43,7 +44,7 @@ ClientGame_ConsoleCommand(void) case "useitems": TS_playerUseItems(); //pSeatLocal->m_bUseItemsFreshPress = TRUE; - //pSeatLocal->m_bUseItems = TRUE; + pSeatLocal->m_bUseItems = TRUE; break; case "usepowerup": TS_playerUsePowerup(); diff --git a/src/client/init.qc b/src/client/init.qc index 1f8512f..5d2697c 100644 --- a/src/client/init.qc +++ b/src/client/init.qc @@ -211,7 +211,7 @@ ClientGame_RendererRestart(string rstr) // TODO - if this becomes a lot of lines, go to a method // "pSeatLocal_RendererRestart" instead - if(pl != NULL){ + if(pl != NULL && pl.iState == PLAYER_STATE::SPAWNED){ pl.prev_iForceBodygroup1Submodel = 0; TS_View_SetViewModelFromStats(); } diff --git a/src/client/view.qc b/src/client/view.qc index 0e9b406..47c6ef6 100644 --- a/src/client/view.qc +++ b/src/client/view.qc @@ -85,6 +85,11 @@ TS_View_SetViewModelFromStats(void) weapondata_basic_t* basicP; weapondynamic_t dynaRef; + if(pl.inventoryEquippedIndex == -1){ + // what. + return; + } + //printfline("TS_View_SetViewModelFromStats: I happen? activeweap:%d", pl.activeweapon); basicP = pl.getEquippedWeaponData(); diff --git a/src/shared/event_custom.qc b/src/shared/event_custom.qc index 2222d1c..fb42de0 100644 --- a/src/shared/event_custom.qc +++ b/src/shared/event_custom.qc @@ -622,6 +622,7 @@ TS_playerUseItems(void){ if(pl.inventoryEquippedIndex == -1){ return; } + //_TS_playerUseItems(); @@ -633,6 +634,7 @@ TS_playerUseItems(void){ // SHOULD NOT HAPPEN, should call the CSEv_ version instead #endif + } diff --git a/src/shared/input.qc b/src/shared/input.qc index 70dee5b..31ab7c3 100644 --- a/src/shared/input.qc +++ b/src/shared/input.qc @@ -366,6 +366,11 @@ void processInputs(void){ //printfline("!!! SECO !!! (%d %d)", ((input_buttons & INPUT_BUTTON0)!=0), ((input_buttons & INPUT_BUTTON3)!=0)); Weapons_Secondary(); + // TEST! + //if(!(pl.gflags & GF_SEMI_SECONDARY_TOGGLED)){ + // TS_playerUseItems(); + //} + pl.gflags |= GF_SEMI_SECONDARY_TOGGLED; return; } diff --git a/zpak001.pk3dir/default.cfg b/zpak001.pk3dir/default.cfg index 21ffca1..567dfdf 100644 --- a/zpak001.pk3dir/default.cfg +++ b/zpak001.pk3dir/default.cfg @@ -8,7 +8,9 @@ bind "a" "+moveleft" bind "d" "+moveright" bind "SPACE" "+jump" bind "CTRL" "+duck" -bind "SHIFT" "+speed" +// And yes, this does have to be called "speedcustom" and not "speed". +// I have no clue. +bind "SHIFT" "+speedcustom" bind "0" "slot10" bind "1" "slot1" bind "2" "slot2"