From 51fce0c702def28ce29efd0299c63536b42ebaeb Mon Sep 17 00:00:00 2001 From: Ketmar Dark Date: Thu, 7 Sep 2017 23:01:43 +0300 Subject: [PATCH] berserk autoswitch is cheat now --- src/game/g_game.pas | 8 ++++---- src/game/g_player.pas | 12 +++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/game/g_game.pas b/src/game/g_game.pas index 6a26b04..1d95bda 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -2750,17 +2750,17 @@ begin (* * light rendering: (INVALID!) * glStencilFunc(GL_EQUAL, 0, $ff); - * clear depth buffer - * renderAmbientQuad() * for each light: + * glClear(GL_STENCIL_BUFFER_BIT); * glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); * draw shadow volume into stencil buffer * glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); // modify color buffer * glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); // don't modify stencil buffer * turn off blending - * draw quad with light alpha + * draw color-less quad with light alpha (WARNING! don't touch color!) * glEnable(GL_BLEND); - * gl.glBlendFunc(GL_DST_ALPHA, GL_ONE); + * glBlendFunc(GL_DST_ALPHA, GL_ONE); + * draw all geometry up to and including walls (with alpha-testing, probably) -- this does lighting *) wassc := (glIsEnabled(GL_SCISSOR_TEST) <> 0); diff --git a/src/game/g_player.pas b/src/game/g_player.pas index 98535cc..fb96ef9 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -3638,6 +3638,16 @@ begin end; function TPlayer.PickItem(ItemType: Byte; arespawn: Boolean; var remove: Boolean): Boolean; + + function allowBerserkSwitching (): Boolean; + begin + if (FBFGFireCounter <> -1) then begin result := false; exit; end; + result := true; + if gBerserkAutoswitch then exit; + if not (gDebugMode or gCheats) then exit; + result := false; + end; + var a: Boolean; begin @@ -3980,7 +3990,7 @@ begin if not (R_BERSERK in FRulez) then begin Include(FRulez, R_BERSERK); - if gBerserkAutoswitch and (gDebugMode or gCheats) and (FBFGFireCounter = -1) then + if allowBerserkSwitching then begin FCurrWeap := WEAPON_KASTET; resetWeaponQueue(); -- 2.29.2