DEADSOFTWARE

center player when the game is scaled (lighting is not working correctly yet, tho)
[d2df-sdl.git] / src / game / g_player.pas
index 06ae6e50340317cda52f96b1b34228d50c48f18c..98535cc9ef2f36220f98ba05b4cbb0a401598cac 100644 (file)
@@ -471,7 +471,9 @@ type
 
     procedure positionChanged ();  inline; //WARNING! call this after entity position was changed, or coldet will not work right!
 
-    property    Obj: TObj read FObj;
+    function ObjPtr (): PObj; inline;
+
+    property    Obj: TObj read FObj; // copies object
     property    State: Byte read FState;
     property    Mess: Boolean read FMess;
   end;
@@ -3978,15 +3980,17 @@ begin
         if not (R_BERSERK in FRulez) then
         begin
           Include(FRulez, R_BERSERK);
-          if FBFGFireCounter = -1 then
+          if gBerserkAutoswitch and (gDebugMode or gCheats) and (FBFGFireCounter = -1) then
           begin
             FCurrWeap := WEAPON_KASTET;
             resetWeaponQueue();
             FModel.SetWeapon(WEAPON_KASTET);
           end;
           if gFlash <> 0 then
+          begin
             Inc(FPain, 100);
             if gFlash = 2 then Inc(FPickup, 5);
+          end;
           FBerserk := gTime+30000;
           Result := True;
           remove := True;
@@ -6159,6 +6163,8 @@ begin
   inherited;
 end;
 
+function TCorpse.ObjPtr (): PObj; inline; begin result := @FObj; end;
+
 procedure TCorpse.positionChanged (); inline; begin end;
 
 procedure TCorpse.moveBy (dx, dy: Integer); inline;
@@ -7608,4 +7614,7 @@ begin
   FDifficult := TDifficult(p^);
 end;
 
+
+begin
+  conRegVar('cheat_berserk_autoswitch', @gBerserkAutoswitch, 'autoswitch to fist when berserk pack taken', '',  true, true);
 end.