summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 23a883f)
raw | patch | inline | side by side (parent: 23a883f)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sat, 29 Jan 2022 11:36:31 +0000 (14:36 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sat, 29 Jan 2022 11:36:31 +0000 (14:36 +0300) |
15 files changed:
diff --git a/src/game/Doom2DF.lpr b/src/game/Doom2DF.lpr
index c576b7ce994358cd3d696320a37dfd2dd6fd41e9..dc4d79c504668d79d9390852d02425f4f1825cf5 100644 (file)
--- a/src/game/Doom2DF.lpr
+++ b/src/game/Doom2DF.lpr
{$IFDEF ENABLE_GFX}
g_gfx in 'g_gfx.pas',
{$ENDIF}
+ {$IFDEF ENABLE_GIBS}
+ g_gibs in 'g_gibs.pas',
+ {$ENDIF}
g_items in 'g_items.pas',
g_map in 'g_map.pas',
g_monsters in 'g_monsters.pas',
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index aa06ac00c412c9a13c36afdac7d8dedb5920f8db..9a8fd1188eb6c3269a040c4253d8000cac2082d4 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
{$IFDEF ENABLE_GFX}
g_gfx,
{$ENDIF}
+ {$IFDEF ENABLE_GIBS}
+ g_gibs,
+ {$ENDIF}
g_textures, e_input, g_game, g_player, g_items,
SysUtils, g_basic, g_options, Math, e_res,
g_language, g_net, g_netmsg, e_log, conbuf;
WriteLn(f, 'g_max_particles ', g_GFX_GetMax());
{$ENDIF}
WriteLn(f, 'g_max_shells ', g_Shells_GetMax());
- WriteLn(f, 'g_max_gibs ', g_Gibs_GetMax());
+ {$IFDEF ENABLE_GIBS}
+ WriteLn(f, 'g_max_gibs ', g_Gibs_GetMax());
+ {$ENDIF}
WriteLn(f, 'g_max_corpses ', g_Corpses_GetMax());
WriteLn(f, 'sv_intertime ', gDefInterTime);
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 512f5bf174648cecdfd9d19da857cdf68b2062a2..019fdc48445c2c861b49055aff9302419817fc90 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
{$IFDEF ENABLE_GFX}
g_gfx,
{$ENDIF}
+ {$IFDEF ENABLE_GIBS}
+ g_gibs,
+ {$ENDIF}
{$IFNDEF HEADLESS}
r_render, g_system,
{$ENDIF}
g_GFX_Update;
{$ENDIF}
g_Player_UpdateAll();
+ {$IFDEF ENABLE_GIBS}
+ g_Gibs_Update;
+ {$ENDIF}
g_Player_UpdatePhysicalObjects();
// server: send newly spawned monsters unconditionally
begin
if Length(p) = 2 then
begin
- a := Max(0, StrToInt(p[1]));
- g_Gibs_SetMax(a)
+ {$IFDEF ENABLE_GIBS}
+ a := Max(0, StrToInt(p[1]));
+ g_Gibs_SetMax(a)
+ {$ENDIF}
end
else if Length(p) = 1 then
begin
- e_LogWritefln('%s', [g_Gibs_GetMax()])
+ {$IFDEF ENABLE_GIBS}
+ e_LogWritefln('%s', [g_Gibs_GetMax()])
+ {$ELSE}
+ e_LogWritefln('%s', [0])
+ {$ENDIF}
end
else
begin
diff --git a/src/game/g_gibs.pas b/src/game/g_gibs.pas
--- /dev/null
+++ b/src/game/g_gibs.pas
@@ -0,0 +1,246 @@
+(* Copyright (C) Doom 2D: Forever Developers
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3 of the License ONLY.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *)
+{$INCLUDE ../shared/a_modes.inc}
+unit g_gibs;
+
+interface
+
+ uses g_phys, g_base;
+
+ const
+ DefaultGibsCount = 32;
+ DefaultGibsMax = 150;
+
+ type
+ PGib = ^TGib;
+ TGib = record
+ alive: Boolean;
+ RAngle: Integer;
+ Color: TRGB;
+ Obj: TObj;
+ ModelID: Integer;
+ GibID: Integer;
+
+ procedure getMapBox (out x, y, w, h: Integer); inline;
+ procedure moveBy (dx, dy: Integer); inline;
+ procedure positionChanged; inline; //WARNING! call this after entity position was changed, or coldet will not w>
+ end;
+
+ var
+ gGibsCount: Integer = DefaultGibsCount; // !!! make it private
+ gGibs: Array of TGib;
+
+ procedure g_Gibs_SetMax (Count: Word);
+ function g_Gibs_GetMax (): Word;
+
+ procedure g_Gibs_Create (fX, fY, mid: Integer; fColor: TRGB);
+ procedure g_Gibs_Update;
+
+implementation
+
+ uses
+ {$IFDEF ENABLE_GFX}
+ g_gfx,
+ {$ENDIF}
+ {$IFNDEF HEADLESS}
+ r_render,
+ {$ENDIF}
+ g_playermodel, g_options, g_game
+ ;
+
+ type
+ TGibsArray = Array of Integer;
+
+ var
+ CurrentGib: Integer = 0;
+ MaxGibs: Word = DefaultGibsMax;
+
+ procedure TGib.getMapBox (out x, y, w, h: Integer); inline;
+ begin
+ x := Obj.X + Obj.Rect.X;
+ y := Obj.Y + Obj.Rect.Y;
+ w := Obj.Rect.Width;
+ h := Obj.Rect.Height;
+ end;
+
+ procedure TGib.moveBy (dx, dy: Integer); inline;
+ begin
+ if (dx <> 0) or (dy <> 0) then
+ begin
+ Obj.X += dx;
+ Obj.Y += dy;
+ positionChanged;
+ end;
+ end;
+
+ procedure TGib.positionChanged (); inline;
+ begin
+ end;
+
+ procedure g_Gibs_SetMax (Count: Word);
+ begin
+ MaxGibs := Count;
+ SetLength(gGibs, Count);
+ if CurrentGib >= Count then
+ CurrentGib := 0;
+ end;
+
+ function g_Gibs_GetMax (): Word;
+ begin
+ Result := MaxGibs;
+ end;
+
+ function g_Gibs_Get (ModelID: Integer; var Gibs: TGibsArray): Boolean;
+ var i, b: Integer; c: Boolean;
+ begin
+ Gibs := nil;
+ Result := False;
+ if (PlayerModelsArray = nil) or (gGibsCount = 0) then
+ Exit;
+
+ c := False;
+ SetLength(Gibs, gGibsCount);
+ for i := 0 to High(Gibs) do
+ begin
+ if c and (PlayerModelsArray[ModelID].GibsCount = 1) then
+ begin
+ SetLength(Gibs, i);
+ Break;
+ end;
+
+ repeat
+ b := Random(PlayerModelsArray[ModelID].GibsCount);
+ until not ((PlayerModelsArray[ModelID].GibsOnce = b + 1) and c);
+
+ Gibs[i] := b;
+
+ c := PlayerModelsArray[ModelID].GibsOnce = b + 1;
+ end;
+ Result := True;
+ end;
+
+ procedure g_Gibs_Create (fX, fY, mid: Integer; fColor: TRGB);
+ var
+ a: Integer;
+ GibsArray: TGibsArray;
+ {$IFDEF ENABLE_GFX}
+ Blood: TModelBlood;
+ {$ENDIF}
+ begin
+ if mid = -1 then
+ Exit;
+ if (gGibs = nil) or (Length(gGibs) = 0) then
+ Exit;
+ if not g_Gibs_Get(mid, GibsArray) then
+ Exit;
+
+ {$IFDEF ENABLE_GFX}
+ Blood := PlayerModelsArray[mid].Blood;
+ {$ENDIF}
+
+ for a := 0 to High(GibsArray) do
+ begin
+ with gGibs[CurrentGib] do
+ begin
+ ModelID := mid;
+ GibID := GibsArray[a];
+ Color := fColor;
+ alive := True;
+ g_Obj_Init(@Obj);
+ {$IFNDEF HEADLESS}
+ Obj.Rect := r_Render_GetGibRect(ModelID, GibID);
+ {$ELSE}
+ Obj.Rect.X := 16;
+ Obj.Rect.Y := 16;
+ Obj.Rect.Width := 16;
+ Obj.Rect.Height := 16;
+ {$ENDIF}
+ Obj.X := fX - Obj.Rect.X - (Obj.Rect.Width div 2);
+ Obj.Y := fY - Obj.Rect.Y - (Obj.Rect.Height div 2);
+ g_Obj_PushA(@Obj, 25 + Random(10), Random(361));
+ positionChanged; // this updates spatial accelerators
+ RAngle := Random(360);
+ {$IFDEF ENABLE_GFX}
+ if gBloodCount > 0 then
+ begin
+ g_GFX_Blood(
+ fX,
+ fY,
+ 16 * gBloodCount + Random(5 * gBloodCount),
+ -16 + Random(33),
+ -16 + Random(33),
+ Random(48),
+ Random(48),
+ Blood.R,
+ Blood.G,
+ Blood.B,
+ Blood.Kind
+ );
+ end;
+ {$ENDIF}
+ if CurrentGib >= High(gGibs) then
+ CurrentGib := 0
+ else
+ Inc(CurrentGib);
+ end;
+ end;
+ end;
+
+ procedure g_Gibs_Update;
+ var i: Integer; vel: TPoint2i; mr: Word;
+ begin
+ if gGibs = nil then
+ Exit;
+ for i := 0 to High(gGibs) do
+ if gGibs[i].alive then
+ with gGibs[i] do
+ begin
+ Obj.oldX := Obj.X;
+ Obj.oldY := Obj.Y;
+
+ vel := Obj.Vel;
+ mr := g_Obj_Move(@Obj, True, False, True);
+ positionChanged(); // this updates spatial accelerators
+
+ if WordBool(mr and MOVE_FALLOUT) then
+ begin
+ alive := False;
+ Continue;
+ end;
+
+ // Отлетает от удара о стену/потолок/пол:
+ if WordBool(mr and MOVE_HITWALL) then
+ Obj.Vel.X := -(vel.X div 2);
+ if WordBool(mr and (MOVE_HITCEIL or MOVE_HITLAND)) then
+ Obj.Vel.Y := -(vel.Y div 2);
+
+ if (Obj.Vel.X >= 0) then
+ begin // Clockwise
+ RAngle := RAngle + Abs(Obj.Vel.X)*6 + Abs(Obj.Vel.Y);
+ if RAngle >= 360 then
+ RAngle := RAngle mod 360;
+ end else begin // Counter-clockwise
+ RAngle := RAngle - Abs(Obj.Vel.X)*6 - Abs(Obj.Vel.Y);
+ if RAngle < 0 then
+ RAngle := (360 - (Abs(RAngle) mod 360)) mod 360;
+ end;
+
+ // Сопротивление воздуха для куска трупа:
+ if gTime mod (GAME_TICK*3) = 0 then
+ Obj.Vel.X := z_dec(Obj.Vel.X, 1);
+ end;
+ end;
+
+end.
diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas
index 6daf00cdf864e399b541cfa8a4599b1ffac82b0d..62bf314d33aefda6882165516203bb10862fdf48 100644 (file)
--- a/src/game/g_menu.pas
+++ b/src/game/g_menu.pas
{$IFDEF ENABLE_GFX}
g_gfx,
{$ENDIF}
+ {$IFDEF ENABLE_GIBS}
+ g_gibs,
+ {$ENDIF}
g_gui, r_textures, r_graphics, g_game, g_map,
g_base, g_basic, g_console, g_sound, g_player, g_options, g_weapons,
e_log, SysUtils, CONFIG, g_playermodel, DateUtils,
g_GFX_SetMax(TGUIScroll(menu.GetControl('scParticlesCount')).Value*1000);
{$ENDIF}
g_Shells_SetMax(TGUIScroll(menu.GetControl('scShellsMax')).Value*30);
- g_Gibs_SetMax(TGUIScroll(menu.GetControl('scGibsMax')).Value*25);
+ {$IFDEF ENABLE_GIBS}
+ g_Gibs_SetMax(TGUIScroll(menu.GetControl('scGibsMax')).Value*25);
+ {$ENDIF}
g_Corpses_SetMax(TGUIScroll(menu.GetControl('scCorpsesMax')).Value*5);
- case TGUISwitch(menu.GetControl('swGibsCount')).ItemIndex of
- 0: gGibsCount := 0;
- 1: gGibsCount := 8;
- 2: gGibsCount := 16;
- 3: gGibsCount := 32;
- else gGibsCount := 48;
- end;
+ {$IFDEF ENABLE_GIBS}
+ case TGUISwitch(menu.GetControl('swGibsCount')).ItemIndex of
+ 0: gGibsCount := 0;
+ 1: gGibsCount := 8;
+ 2: gGibsCount := 16;
+ 3: gGibsCount := 32;
+ else gGibsCount := 48;
+ end;
+ {$ENDIF}
gBloodCount := TGUISwitch(menu.GetControl('swBloodCount')).ItemIndex;
gFlash := TGUISwitch(menu.GetControl('swScreenFlash')).ItemIndex;
TGUIScroll(menu.GetControl('scParticlesCount')).Value := g_GFX_GetMax() div 1000;
{$ENDIF}
TGUIScroll(menu.GetControl('scShellsMax')).Value := g_Shells_GetMax() div 30;
- TGUIScroll(menu.GetControl('scGibsMax')).Value := g_Gibs_GetMax() div 25;
+ {$IFDEF ENABLE_GIBS}
+ TGUIScroll(menu.GetControl('scGibsMax')).Value := g_Gibs_GetMax() div 25;
+ {$ENDIF}
TGUIScroll(menu.GetControl('scCorpsesMax')).Value := g_Corpses_GetMax() div 5;
TGUISwitch(menu.GetControl('swBloodCount')).ItemIndex := gBloodCount;
with TGUISwitch(menu.GetControl('swGibsType')) do
if gAdvGibs then ItemIndex := 1 else ItemIndex := 0;
- with TGUISwitch(menu.GetControl('swGibsCount')) do
- case gGibsCount of
- 0: ItemIndex := 0;
- 8: ItemIndex := 1;
- 16: ItemIndex := 2;
- 32: ItemIndex := 3;
- else ItemIndex := 4;
+ {$IFDEF ENABLE_GIBS}
+ with TGUISwitch(menu.GetControl('swGibsCount')) do
+ begin
+ case gGibsCount of
+ 0: ItemIndex := 0;
+ 8: ItemIndex := 1;
+ 16: ItemIndex := 2;
+ 32: ItemIndex := 3;
+ else ItemIndex := 4;
+ end;
end;
+ {$ENDIF}
with TGUISwitch(menu.GetControl('swBackGround')) do
if gDrawBackGround then ItemIndex := 0 else ItemIndex := 1;
index e3374e496ebcf7001c9094dc5476720411ab7884..78ae1a409ab05f1c629a6fb5d3cbdd9d63b79a3e 100644 (file)
--- a/src/game/g_monsters.pas
+++ b/src/game/g_monsters.pas
{$IFDEF ENABLE_GFX}
g_gfx,
{$ENDIF}
+ {$IFDEF ENABLE_GIBS}
+ g_gibs,
+ {$ENDIF}
e_log, g_sound, g_player, g_game,
g_weapons, g_triggers, g_items, g_options,
g_console, g_map, Math, wadreader,
end
else // "Наземные" монстры
begin
- // Возможно, пинаем куски:
- if (FObj.Vel.X <> 0) and (gGibs <> nil) then
- begin
- b := Abs(FObj.Vel.X);
- if b > 1 then b := b * (Random(8 div b) + 1);
- for a := 0 to High(gGibs) do
+ {$IFDEF ENABLE_GIBS}
+ // Возможно, пинаем куски:
+ if (FObj.Vel.X <> 0) and (gGibs <> nil) then
begin
- if gGibs[a].alive and
- g_Obj_Collide(FObj.X+FObj.Rect.X, FObj.Y+FObj.Rect.Y+FObj.Rect.Height-4,
- FObj.Rect.Width, 8, @gGibs[a].Obj) and (Random(3) = 0) then
+ b := Abs(FObj.Vel.X);
+ if b > 1 then b := b * (Random(8 div b) + 1);
+ for a := 0 to High(gGibs) do
begin
- // Пинаем куски
- if FObj.Vel.X < 0 then
- begin
- g_Obj_PushA(@gGibs[a].Obj, b, Random(61)+120); // налево
- end
- else
+ if gGibs[a].alive and
+ g_Obj_Collide(FObj.X+FObj.Rect.X, FObj.Y+FObj.Rect.Y+FObj.Rect.Height-4,
+ FObj.Rect.Width, 8, @gGibs[a].Obj) and (Random(3) = 0) then
begin
- g_Obj_PushA(@gGibs[a].Obj, b, Random(61)); // направо
+ // Пинаем куски
+ if FObj.Vel.X < 0 then
+ begin
+ g_Obj_PushA(@gGibs[a].Obj, b, Random(61)+120); // налево
+ end
+ else
+ begin
+ g_Obj_PushA(@gGibs[a].Obj, b, Random(61)); // направо
+ end;
end;
end;
end;
- end;
+ {$ENDIF}
// Боссы могут пинать трупы:
if (FMonsterType in [MONSTER_CYBER, MONSTER_SPIDER, MONSTER_ROBO]) and
(FObj.Vel.X <> 0) and (gCorpses <> nil) then
end
else // "Наземные" монстры
begin
- // Возможно, пинаем куски:
- if (FObj.Vel.X <> 0) and (gGibs <> nil) then
- begin
- b := Abs(FObj.Vel.X);
- if b > 1 then b := b * (Random(8 div b) + 1);
- for a := 0 to High(gGibs) do
+ {$IFDEF ENBALE_GIBS}
+ // Возможно, пинаем куски:
+ if (FObj.Vel.X <> 0) and (gGibs <> nil) then
begin
- if gGibs[a].alive and
- g_Obj_Collide(FObj.X+FObj.Rect.X, FObj.Y+FObj.Rect.Y+FObj.Rect.Height-4,
- FObj.Rect.Width, 8, @gGibs[a].Obj) and (Random(3) = 0) then
+ b := Abs(FObj.Vel.X);
+ if b > 1 then b := b * (Random(8 div b) + 1);
+ for a := 0 to High(gGibs) do
begin
- // Пинаем куски
- if FObj.Vel.X < 0 then
- begin
- g_Obj_PushA(@gGibs[a].Obj, b, Random(61)+120); // налево
- end
- else
+ if gGibs[a].alive and
+ g_Obj_Collide(FObj.X+FObj.Rect.X, FObj.Y+FObj.Rect.Y+FObj.Rect.Height-4,
+ FObj.Rect.Width, 8, @gGibs[a].Obj) and (Random(3) = 0) then
begin
- g_Obj_PushA(@gGibs[a].Obj, b, Random(61)); // направо
+ // Пинаем куски
+ if FObj.Vel.X < 0 then
+ begin
+ g_Obj_PushA(@gGibs[a].Obj, b, Random(61)+120); // налево
+ end
+ else
+ begin
+ g_Obj_PushA(@gGibs[a].Obj, b, Random(61)); // направо
+ end;
+ positionChanged(); // this updates spatial accelerators
end;
- positionChanged(); // this updates spatial accelerators
end;
end;
- end;
+ {$ENDIF}
// Боссы могут пинать трупы:
if (FMonsterType in [MONSTER_CYBER, MONSTER_SPIDER, MONSTER_ROBO]) and
(FObj.Vel.X <> 0) and (gCorpses <> nil) then
diff --git a/src/game/g_options.pas b/src/game/g_options.pas
index e825938b09beaf404853489cb01ae55497b560a7..706b9021a75b924c8a581fbc914b5d1e74b023d9 100644 (file)
--- a/src/game/g_options.pas
+++ b/src/game/g_options.pas
gAdvCorpses: Boolean;
gAdvBlood: Boolean;
gAdvGibs: Boolean;
- gGibsCount: Integer;
gBloodCount: Integer;
gFlash: Integer;
gDrawBackGround: Boolean;
{$IFDEF ENABLE_GFX}
g_gfx,
{$ENDIF}
+ {$IFDEF ENABLE_GIBS}
+ g_gibs,
+ {$ENDIF}
e_log, e_input, g_console, g_sound, g_player, Math,
g_map, g_net, g_netmaster, SysUtils, CONFIG, g_game,
g_items, wadreader, envvars;
g_GFX_SetMax(2000);
{$ENDIF}
g_Shells_SetMax(300);
- g_Gibs_SetMax(150);
g_Corpses_SetMax(20);
- gGibsCount := 32;
+ {$IFDEF ENABLE_GIBS}
+ g_Gibs_SetMax(DefaultGibsMax);
+ gGibsCount := DefaultGibsCount;
+ {$ENDIF}
gBloodCount := 4;
gAdvBlood := True;
gAdvCorpses := True;
{$ENDIF}
(* Game *)
- conRegVar('g_gibs_count', @gGibsCount, '', '');
+ {$IFDEF ENABLE_GIBS}
+ conRegVar('g_gibs_count', @gGibsCount, '', '');
+ {$ENDIF}
conRegVar('g_blood_count', @gBloodCount, '', '');
conRegVar('g_adv_blood', @gAdvBlood, '', '');
conRegVar('g_adv_corpses', @gAdvCorpses, '', '');
diff --git a/src/game/g_panel.pas b/src/game/g_panel.pas
index ee8e17dbb9b435f622117f0c69fced8a0fc29f94..f9b7371f213c2f8b4b380e02ec61bd7b03b6672f 100644 (file)
--- a/src/game/g_panel.pas
+++ b/src/game/g_panel.pas
{$IFDEF ENABLE_GFX}
g_gfx,
{$ENDIF}
+ {$IFDEF ENABLE_GIBS}
+ g_gibs,
+ {$ENDIF}
g_basic, g_map, g_game, g_weapons, g_triggers,
g_console, g_language, g_monsters, g_player, g_grid, e_log, geom, utils, xstreams
;
px, py, pw, ph, pdx, pdy: Integer;
squash: Boolean;
plr: TPlayer;
- gib: PGib;
+ {$IFDEF ENABLE_GIBS}
+ gib: PGib;
+ {$ENDIF}
cor: TCorpse;
mon: TMonster;
mpfrid: LongWord;
if not g_Game_IsClient and squash then plr.Damage(15000, 0, 0, 0, HIT_TRAP);
end;
- // process gibs
- for f := 0 to High(gGibs) do
- begin
- gib := @gGibs[f];
- if not gib.alive then continue;
- gib.getMapBox(px, py, pw, ph);
- if not g_Collide(px, py, pw, ph, cx0, cy0, cw, ch) then continue;
- if tryMPlatMove(px, py, pw, ph, pdx, pdy, squash, @ontop) then
+ {$IFDEF ENABLE_GIBS}
+ // process gibs
+ for f := 0 to High(gGibs) do
begin
- // set new position
- gib.moveBy(pdx, pdy); // this will call `positionChanged()` for us
+ gib := @gGibs[f];
+ if not gib.alive then continue;
+ gib.getMapBox(px, py, pw, ph);
+ if not g_Collide(px, py, pw, ph, cx0, cy0, cw, ch) then continue;
+ if tryMPlatMove(px, py, pw, ph, pdx, pdy, squash, @ontop) then
+ begin
+ // set new position
+ gib.moveBy(pdx, pdy); // this will call `positionChanged()` for us
+ end;
end;
- end;
+ {$ENDIF}
// move and push corpses
for f := 0 to High(gCorpses) do
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index db438329dd146c0de2d43eb20ec662bc99002c09..68bee9a40a786e8f1f3470eb74f072bcd6d38427 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
procedure LoadState (st: TStream); override;
end;
- PGib = ^TGib;
- TGib = record
- alive: Boolean;
- RAngle: Integer;
- Color: TRGB;
- Obj: TObj;
-
- ModelID: Integer;
- GibID: Integer;
-
- procedure getMapBox (out x, y, w, h: Integer); inline;
- procedure moveBy (dx, dy: Integer); inline;
-
- procedure positionChanged (); inline; //WARNING! call this after entity position was changed, or coldet will not work right!
- end;
-
-
PShell = ^TShell;
TShell = record
alive: Boolean;
var
gPlayers: Array of TPlayer;
gCorpses: Array of TCorpse;
- gGibs: Array of TGib;
gShells: Array of TShell;
gTeamStat: TTeamStat;
gFly: Boolean = False;
function Lerp(X, Y, Factor: Integer): Integer;
-procedure g_Gibs_SetMax(Count: Word);
-function g_Gibs_GetMax(): Word;
procedure g_Corpses_SetMax(Count: Word);
function g_Corpses_GetMax(): Word;
procedure g_Shells_SetMax(Count: Word);
function g_Player_GetStats(): TPlayerStatArray;
function g_Player_ValidName(Name: String): Boolean;
function g_Player_CreateCorpse(Player: TPlayer): Integer;
-procedure g_Player_CreateGibs (fX, fY, mid: Integer; fColor: TRGB);
procedure g_Player_CreateShell(fX, fY, dX, dY: Integer; T: Byte);
procedure g_Player_UpdatePhysicalObjects();
procedure g_Player_RemoveAllCorpses();
{$IFDEF ENABLE_GFX}
g_gfx,
{$ENDIF}
+ {$IFDEF ENABLE_GIBS}
+ g_gibs,
+ {$ENDIF}
e_log, g_map, g_items, g_console, Math,
g_options, g_triggers, g_game, g_grid, e_res,
wadreader, g_monsters, CONFIG, g_language,
BOTLIST_FILENAME = 'botlist.txt';
var
- MaxGibs: Word = 150;
MaxCorpses: Word = 20;
MaxShells: Word = 300;
- CurrentGib: Integer = 0;
CurrentShell: Integer = 0;
BotNames: Array of String;
BotList: Array of TBotProfile;
Result := g_Player_Get(UID1).FTeam = g_Player_Get(UID2).FTeam;
end;
-procedure g_Gibs_SetMax(Count: Word);
-begin
- MaxGibs := Count;
- SetLength(gGibs, Count);
-
- if CurrentGib >= Count then
- CurrentGib := 0;
-end;
-
-function g_Gibs_GetMax(): Word;
-begin
- Result := MaxGibs;
-end;
-
procedure g_Shells_SetMax(Count: Word);
begin
MaxShells := Count;
with Player do
begin
- if (FHealth >= -50) or (gGibsCount = 0) then
+{$IFDEF ENABLE_GIBS}
+ if (FHealth < -50) and (gGibsCount > 0) then
+ begin
+ g_Gibs_Create(FObj.X + PLAYER_RECT_CX, FObj.Y + PLAYER_RECT_CY, FModel.id, FModel.Color);
+ end
+ else
+{$ENDIF}
begin
if (gCorpses = nil) or (Length(gCorpses) = 0) then
Exit;
Result := find_id;
end
- else
- g_Player_CreateGibs(FObj.X + PLAYER_RECT_CX, FObj.Y + PLAYER_RECT_CY, FModel.id, FModel.Color);
end;
end;
end;
end;
-procedure g_Player_CreateGibs (fX, fY, mid: Integer; fColor: TRGB);
-var
- a: Integer;
- GibsArray: TGibsArray;
- {$IFDEF ENABLE_GFX}
- Blood: TModelBlood;
- {$ENDIF}
-begin
- if mid = -1 then
- Exit;
- if (gGibs = nil) or (Length(gGibs) = 0) then
- Exit;
- if not g_PlayerModel_GetGibs(mid, GibsArray) then
- Exit;
-
- {$IFDEF ENABLE_GFX}
- Blood := PlayerModelsArray[mid].Blood;
- {$ENDIF}
-
- for a := 0 to High(GibsArray) do
- with gGibs[CurrentGib] do
- begin
- ModelID := mid;
- GibID := GibsArray[a];
- Color := fColor;
- alive := True;
- g_Obj_Init(@Obj);
- {$IFNDEF HEADLESS}
- Obj.Rect := r_Render_GetGibRect(ModelID, GibID);
- {$ELSE}
- Obj.Rect.X := 16;
- Obj.Rect.Y := 16;
- Obj.Rect.Width := 16;
- Obj.Rect.Height := 16;
- {$ENDIF}
- Obj.X := fX - Obj.Rect.X - (Obj.Rect.Width div 2);
- Obj.Y := fY - Obj.Rect.Y - (Obj.Rect.Height div 2);
- g_Obj_PushA(@Obj, 25 + Random(10), Random(361));
- positionChanged(); // this updates spatial accelerators
- RAngle := Random(360);
-
- {$IFDEF ENABLE_GFX}
- if gBloodCount > 0 then
- begin
- g_GFX_Blood(
- fX,
- fY,
- 16 * gBloodCount + Random(5 * gBloodCount),
- -16 + Random(33),
- -16 + Random(33),
- Random(48),
- Random(48),
- Blood.R,
- Blood.G,
- Blood.B,
- Blood.Kind
- );
- end;
- {$ENDIF}
-
- if CurrentGib >= High(gGibs) then
- CurrentGib := 0
- else
- Inc(CurrentGib);
- end;
-end;
-
procedure g_Player_UpdatePhysicalObjects();
var
i: Integer;
end;
begin
-// Куски мяса:
- if gGibs <> nil then
- for i := 0 to High(gGibs) do
- if gGibs[i].alive then
- with gGibs[i] do
- begin
- Obj.oldX := Obj.X;
- Obj.oldY := Obj.Y;
-
- vel := Obj.Vel;
- mr := g_Obj_Move(@Obj, True, False, True);
- positionChanged(); // this updates spatial accelerators
-
- if WordBool(mr and MOVE_FALLOUT) then
- begin
- alive := False;
- Continue;
- end;
-
- // Отлетает от удара о стену/потолок/пол:
- if WordBool(mr and MOVE_HITWALL) then
- Obj.Vel.X := -(vel.X div 2);
- if WordBool(mr and (MOVE_HITCEIL or MOVE_HITLAND)) then
- Obj.Vel.Y := -(vel.Y div 2);
-
- if (Obj.Vel.X >= 0) then
- begin // Clockwise
- RAngle := RAngle + Abs(Obj.Vel.X)*6 + Abs(Obj.Vel.Y);
- if RAngle >= 360 then
- RAngle := RAngle mod 360;
- end else begin // Counter-clockwise
- RAngle := RAngle - Abs(Obj.Vel.X)*6 - Abs(Obj.Vel.Y);
- if RAngle < 0 then
- RAngle := (360 - (Abs(RAngle) mod 360)) mod 360;
- end;
-
- // Сопротивление воздуха для куска трупа:
- if gTime mod (GAME_TICK*3) = 0 then
- Obj.Vel.X := z_dec(Obj.Vel.X, 1);
- end;
-
// Трупы:
if gCorpses <> nil then
for i := 0 to High(gCorpses) do
end;
end;
-
-procedure TGib.getMapBox (out x, y, w, h: Integer); inline;
-begin
- x := Obj.X+Obj.Rect.X;
- y := Obj.Y+Obj.Rect.Y;
- w := Obj.Rect.Width;
- h := Obj.Rect.Height;
-end;
-
-procedure TGib.moveBy (dx, dy: Integer); inline;
-begin
- if (dx <> 0) or (dy <> 0) then
- begin
- Obj.X += dx;
- Obj.Y += dy;
- positionChanged();
- end;
-end;
-
-
procedure TShell.getMapBox (out x, y, w, h: Integer); inline;
begin
x := Obj.X;
end;
end;
-
-procedure TGib.positionChanged (); inline; begin end;
procedure TShell.positionChanged (); inline; begin end;
procedure g_Player_RemoveAllCorpses();
-var
- i: Integer;
+ var i: Integer;
+ {$IFDEF ENABLE_GIBS}
+ var maxgibs: Integer;
+ {$ENDIF}
begin
- gGibs := nil;
+ {$IFDEF ENABLE_GIBS}
+ maxgibs := g_Gibs_GetMax();
+ g_Gibs_SetMax(0);
+ g_Gibs_SetMax(maxgibs);
+ {$ENDIF}
gShells := nil;
- SetLength(gGibs, MaxGibs);
- SetLength(gShells, MaxGibs);
- CurrentGib := 0;
+ SetLength(gShells, MaxShells);
CurrentShell := 0;
if gCorpses <> nil then
end;
procedure TPlayer.Run(Direction: TDirection);
-var
- a, b: Integer;
+ {$IFDEF ENABLE_GIBS}
+ var a, b: Integer;
+ {$ENDIF}
begin
if MAX_RUNVEL > 8 then
FlySmoke();
if FObj.Vel.X < MAX_RUNVEL then
FObj.Vel.X := FObj.Vel.X + (MAX_RUNVEL shr 3);
-// Возможно, пинаем куски:
- if (FObj.Vel.X <> 0) and (gGibs <> nil) then
- begin
- b := Abs(FObj.Vel.X);
- if b > 1 then b := b * (Random(8 div b) + 1);
- for a := 0 to High(gGibs) do
+ {$IFDEF ENABLE_GIBS}
+ // Возможно, пинаем куски:
+ if (FObj.Vel.X <> 0) and (gGibs <> nil) then
begin
- if gGibs[a].alive and
- g_Obj_Collide(FObj.X+FObj.Rect.X, FObj.Y+FObj.Rect.Y+FObj.Rect.Height-4,
- FObj.Rect.Width, 8, @gGibs[a].Obj) and (Random(3) = 0) then
+ b := Abs(FObj.Vel.X);
+ if b > 1 then b := b * (Random(8 div b) + 1);
+ for a := 0 to High(gGibs) do
begin
- // Пинаем куски
- if FObj.Vel.X < 0 then
- begin
- g_Obj_PushA(@gGibs[a].Obj, b, Random(61)+120) // налево
- end
- else
+ if gGibs[a].alive and
+ g_Obj_Collide(FObj.X+FObj.Rect.X, FObj.Y+FObj.Rect.Y+FObj.Rect.Height-4,
+ FObj.Rect.Width, 8, @gGibs[a].Obj) and (Random(3) = 0) then
begin
- g_Obj_PushA(@gGibs[a].Obj, b, Random(61)); // направо
+ // Пинаем куски
+ if FObj.Vel.X < 0 then
+ begin
+ g_Obj_PushA(@gGibs[a].Obj, b, Random(61)+120) // налево
+ end
+ else
+ begin
+ g_Obj_PushA(@gGibs[a].Obj, b, Random(61)); // направо
+ end;
+ gGibs[a].positionChanged(); // this updates spatial accelerators
end;
- gGibs[a].positionChanged(); // this updates spatial accelerators
end;
end;
- end;
+ {$ENDIF}
SetAction(A_WALK);
end;
FDamage := FDamage + Value;
+{$IFDEF ENABLE_GIBS}
if FDamage > 150 then
begin
if FModel <> nil then
begin
FState := CORPSE_STATE_REMOVEME;
- g_Player_CreateGibs(
+ g_Gibs_Create(
FObj.X + FObj.Rect.X + (FObj.Rect.Width div 2),
FObj.Y + FObj.Rect.Y + (FObj.Rect.Height div 2),
FModel.id,
end
end
else
- begin
- FObj.Vel.X := FObj.Vel.X + vx;
- FObj.Vel.Y := FObj.Vel.Y + vy;
- {$IFDEF ENABLE_GFX}
- Blood := FModel.GetBlood();
- g_GFX_Blood(FObj.X+PLAYER_CORPSERECT.X+(PLAYER_CORPSERECT.Width div 2),
- FObj.Y+PLAYER_CORPSERECT.Y+(PLAYER_CORPSERECT.Height div 2),
- Value, vx, vy, 16, (PLAYER_CORPSERECT.Height*2) div 3,
- Blood.R, Blood.G, Blood.B, Blood.Kind);
- {$ENDIF}
- end;
+{$ENDIF}
+ begin
+ FObj.Vel.X := FObj.Vel.X + vx;
+ FObj.Vel.Y := FObj.Vel.Y + vy;
+ {$IFDEF ENABLE_GFX}
+ Blood := FModel.GetBlood();
+ g_GFX_Blood(FObj.X+PLAYER_CORPSERECT.X+(PLAYER_CORPSERECT.Width div 2),
+ FObj.Y+PLAYER_CORPSERECT.Y+(PLAYER_CORPSERECT.Height div 2),
+ Value, vx, vy, 16, (PLAYER_CORPSERECT.Height*2) div 3,
+ Blood.R, Blood.G, Blood.B, Blood.Kind);
+ {$ENDIF}
+ end;
end;
procedure TCorpse.Update();
index 34dbdfdbe02be7ea1dc9a4056f684f3a3b92e5cd..c2c7d4eb8557e2aadf0a8eee1c032b245baabcdd 100644 (file)
TModelSoundArray = Array of TModelSound;
- TGibsArray = Array of Integer;
-
TPlayerModel = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF}
private
FDirection: TDirection;
function g_PlayerModel_Load(FileName: String): Boolean;
function g_PlayerModel_GetNames(): SSArray;
function g_PlayerModel_Get(ModelName: String): TPlayerModel;
-function g_PlayerModel_GetGibs (ModelID: Integer; var Gibs: TGibsArray): Boolean;
function g_PlayerModel_GetIndex (ModelName: String): Integer;
{$IFDEF ENABLE_GFX}
// =======================
FileName: String;
Anim: TModelTextures;
- GibsCount: Integer;
- GibsResource:String;
- GibsMask: String;
- GibsOnce: Integer;
+ {$IFDEF ENABLE_GIBS}
+ GibsCount: Integer;
+ GibsResource:String;
+ GibsMask: String;
+ GibsOnce: Integer;
+ {$ENDIF}
end;
var
SlopSound := Min(Max(config.ReadInt('Sound', 'slop', 0), 0), 2);
- GibsCount := config.ReadInt('Gibs', 'count', 0);
- GibsResource := config.ReadStr('Gibs', 'resource', 'GIBS');
- GibsMask := config.ReadStr('Gibs', 'mask', 'GIBSMASK');
- GibsOnce := config.ReadInt('Gibs', 'once', -1);
+ {$IFDEF ENABLE_GIBS}
+ GibsCount := config.ReadInt('Gibs', 'count', 0);
+ GibsResource := config.ReadStr('Gibs', 'resource', 'GIBS');
+ GibsMask := config.ReadStr('Gibs', 'mask', 'GIBSMASK');
+ GibsOnce := config.ReadInt('Gibs', 'once', -1);
+ {$ENDIF}
ok := True;
for aa := WP_FIRST + 1 to WP_LAST do
end;
end;
- function g_PlayerModel_GetGibs (ModelID: Integer; var Gibs: TGibsArray): Boolean;
- var i, b: Integer; c: Boolean;
- begin
- Gibs := nil;
- Result := False;
- if (PlayerModelsArray = nil) or (gGibsCount = 0) then
- Exit;
-
- c := False;
- SetLength(Gibs, gGibsCount);
- for i := 0 to High(Gibs) do
- begin
- if c and (PlayerModelsArray[ModelID].GibsCount = 1) then
- begin
- SetLength(Gibs, i);
- Break;
- end;
-
- repeat
- b := Random(PlayerModelsArray[ModelID].GibsCount);
- until not ((PlayerModelsArray[ModelID].GibsOnce = b + 1) and c);
-
- Gibs[i] := b;
-
- c := PlayerModelsArray[ModelID].GibsOnce = b + 1;
- end;
- Result := True;
- end;
-
function g_PlayerModel_GetNames(): SSArray;
var
i: DWORD;
diff --git a/src/game/g_weapons.pas b/src/game/g_weapons.pas
index b8c35a8a77a73d29cf762e6ce9d2e2e7e80a6f8e..0353a85a5809c7a9496770d8651ed676655f6326 100644 (file)
--- a/src/game/g_weapons.pas
+++ b/src/game/g_weapons.pas
{$IFDEF ENABLE_GFX}
g_gfx,
{$ENDIF}
+ {$IFDEF ENABLE_GIBS}
+ g_gibs,
+ {$ENDIF}
Math, g_map, g_player, g_sound, g_panel,
g_console, g_options, g_game,
g_triggers, MAPDEF, e_log, g_monsters, g_saveload,
end;
end;
-var
- i, h, dx, dy, m, mm: Integer;
- _angle: SmallInt;
+ var i, h, dx, dy, m, mm: Integer;
+ {$IFDEF ENABLE_GIBS}
+ var _angle: SmallInt;
+ {$ENDIF}
begin
result := false;
end;
end;
- h := High(gGibs);
-
- if gAdvGibs and (h <> -1) then
- for i := 0 to h do
- if gGibs[i].alive then
- with gGibs[i] do
- begin
- dx := Obj.X+Obj.Rect.X+(Obj.Rect.Width div 2)-X;
- dy := Obj.Y+Obj.Rect.Y+(Obj.Rect.Height div 2)-Y;
-
- if dx > 1000 then dx := 1000;
- if dy > 1000 then dy := 1000;
-
- if dx*dx+dy*dy < r then
+ {$IFDEF ENABLE_GIBS}
+ h := High(gGibs);
+ if gAdvGibs and (h <> -1) then
+ for i := 0 to h do
+ if gGibs[i].alive then
+ with gGibs[i] do
begin
- m := PointToRect(X, Y, Obj.X+Obj.Rect.X, Obj.Y+Obj.Rect.Y,
- Obj.Rect.Width, Obj.Rect.Height);
- _angle := GetAngle(Obj.X+Obj.Rect.X+(Obj.Rect.Width div 2),
- Obj.Y+Obj.Rect.Y+(Obj.Rect.Height div 2), X, Y);
-
- g_Obj_PushA(@Obj, Round(15*(rad-m)/rad), _angle);
- positionChanged(); // this updates spatial accelerators
+ dx := Obj.X+Obj.Rect.X+(Obj.Rect.Width div 2)-X;
+ dy := Obj.Y+Obj.Rect.Y+(Obj.Rect.Height div 2)-Y;
+ if dx > 1000 then dx := 1000;
+ if dy > 1000 then dy := 1000;
+ if dx*dx+dy*dy < r then
+ begin
+ m := PointToRect(X, Y, Obj.X+Obj.Rect.X, Obj.Y+Obj.Rect.Y,
+ Obj.Rect.Width, Obj.Rect.Height);
+ _angle := GetAngle(Obj.X+Obj.Rect.X+(Obj.Rect.Width div 2),
+ Obj.Y+Obj.Rect.Y+(Obj.Rect.Height div 2), X, Y);
+ g_Obj_PushA(@Obj, Round(15*(rad-m)/rad), _angle);
+ positionChanged(); // this updates spatial accelerators
+ end;
end;
- end;
+ {$ENDIF}
end;
procedure g_Weapon_Init();
index f838360e4156efb0634ff3d112cb150dcab9a5c7..3a64ad534e7236e1eefcc9524d7ea8f1586e9591 100644 (file)
drawOther('weapons', @r_Weapon_Draw);
drawOther('shells', @r_Player_DrawShells);
drawOther('drawall', @r_Player_DrawAll);
- drawOther('gibs', @r_PlayerModel_DrawGibs);
+ {$IFDEF ENABLE_GIBS}
+ drawOther('gibs', @r_PlayerModel_DrawGibs);
+ {$ENDIF}
drawOther('corpses', @r_Player_DrawCorpses);
drawPanelType('*wall', PANEL_WALL, g_rlayer_wall);
drawOther('monsters', @r_Monsters_Draw);
index e9877305a0da1fbae544c81ff6762330ce3c2243..cc10d127d89fb67e0a73a1e191771e8328b3e842 100644 (file)
procedure r_PlayerModel_Free;
procedure r_PlayerModel_Update;
procedure r_PlayerModel_Draw (pm: TPlayerModel; X, Y: Integer; Alpha: Byte = 0);
- procedure r_PlayerModel_DrawGibs;
- function r_PlayerModel_GetGibRect (m, id: Integer): TRectWH;
+ {$IFDEF ENABLE_GIBS}
+ procedure r_PlayerModel_DrawGibs;
+ function r_PlayerModel_GetGibRect (m, id: Integer): TRectWH;
+ {$ENDIF}
implementation
uses
+ {$IFDEF ENABLE_GIBS}
+ g_gibs,
+ {$ENDIF}
SysUtils, Classes, Math,
MAPDEF, utils, e_log, wadreader,
ImagingTypes, Imaging, ImagingUtility,
base: DWORD;
mask: DWORD;
end;
- Gibs: Array of record
- base: DWORD;
- mask: DWORD;
- rect: TRectWH;
- end;
+ {$IFDEF ENABLE_GIBS}
+ Gibs: Array of record
+ base: DWORD;
+ mask: DWORD;
+ rect: TRectWH;
+ end;
+ {$ENDIF}
end;
RedFlagFrames: DWORD;
BlueFlagFrames: DWORD;
FlagAnimState: TAnimationState;
+{$IFDEF ENABLE_GIBS}
function r_PlayerModel_GetGibRect (m, id: Integer): TRectWH;
begin
Result := Models[m].Gibs[id].rect
end;
+{$ENDIF}
procedure r_PlayerModel_Initialize;
begin
end;
procedure r_PlayerModel_Load;
- var
- ID1, ID2: DWORD;
- i, a, b: Integer;
- prefix, aname: String;
- base, mask: Pointer;
- baseLen, maskLen: Integer;
+ {$IFDEF ENABLE_GIBS}
+ var base, mask: Pointer; baseLen, maskLen: Integer;
+ {$ENDIF}
+ var ID1, ID2: DWORD; i, a, b: Integer; prefix, aname: String;
begin
g_Frames_CreateWAD(@RedFlagFrames, 'FRAMES_FLAG_RED', GameWAD + ':TEXTURES\FLAGRED', 64, 64, 5, False);
g_Frames_CreateWAD(@BlueFlagFrames, 'FRAMES_FLAG_BLUE', GameWAD + ':TEXTURES\FLAGBLUE', 64, 64, 5, False);
end
end
end;
- SetLength(Models[i].Gibs, PlayerModelsArray[i].GibsCount);
- if PlayerModelsArray[i].GibsCount > 0 then
- begin
- r_PlayerModel_LoadResource(prefix + PlayerModelsArray[i].GibsResource, base, baseLen);
- r_PlayerModel_LoadResource(prefix + PlayerModelsArray[i].GibsMask, mask, maskLen);
- if (base <> nil) and (mask <> nil) then
+ {$IFDEF ENABLE_GIBS}
+ SetLength(Models[i].Gibs, PlayerModelsArray[i].GibsCount);
+ if PlayerModelsArray[i].GibsCount > 0 then
begin
- for a := 0 to PlayerModelsArray[i].GibsCount - 1 do
+ r_PlayerModel_LoadResource(prefix + PlayerModelsArray[i].GibsResource, base, baseLen);
+ r_PlayerModel_LoadResource(prefix + PlayerModelsArray[i].GibsMask, mask, maskLen);
+ if (base <> nil) and (mask <> nil) then
begin
- if e_CreateTextureMemEx(base, baseLen, Models[i].Gibs[a].base, a * 32, 0, 32, 32) and
- e_CreateTextureMemEx(mask, maskLen, Models[i].Gibs[a].mask, a * 32, 0, 32, 32) then
+ for a := 0 to PlayerModelsArray[i].GibsCount - 1 do
begin
- Models[i].Gibs[a].rect := g_PlayerModel_CalcGibSize(base, baseLen, a * 32, 0, 32, 32);
- with Models[i].Gibs[a].Rect do
- if Height > 3 then
- Height := Height - 1 - Random(2); // ???
+ if e_CreateTextureMemEx(base, baseLen, Models[i].Gibs[a].base, a * 32, 0, 32, 32) and
+ e_CreateTextureMemEx(mask, maskLen, Models[i].Gibs[a].mask, a * 32, 0, 32, 32) then
+ begin
+ Models[i].Gibs[a].rect := g_PlayerModel_CalcGibSize(base, baseLen, a * 32, 0, 32, 32);
+ with Models[i].Gibs[a].Rect do
+ if Height > 3 then
+ Height := Height - 1 - Random(2); // ???
+ end
end
- end
- end;
- FreeMem(mask);
- FreeMem(base);
- end
+ end;
+ FreeMem(mask);
+ FreeMem(base);
+ end
+ {$ENDIF}
end
end
end;
e_Colors.B := 255;
end;
+{$IFDEF ENABLE_GIBS}
procedure r_PlayerModel_DrawGibs;
var i, fX, fY, m, id: Integer; a: TDFPoint; pobj: ^TObj;
begin
end
end
end;
+{$ENDIF}
end.
index b49c5a96b868f4c5b077a03017eda3dc7b577eab..253ff7de93177bb0bab72d0665fe21a4e951ba23 100644 (file)
function r_Render_WriteScreenShot (filename: String): Boolean;
- function r_Render_GetGibRect (m, id: Integer): TRectWH;
+ {$IFDEF ENABLE_GIBS}
+ function r_Render_GetGibRect (m, id: Integer): TRectWH;
+ {$ENDIF}
{$IFDEF ENABLE_GFX}
procedure r_Render_QueueEffect (AnimType, X, Y: Integer);
end
end;
+{$IFDEF ENABLE_GIBS}
function r_Render_GetGibRect (m, id: Integer): TRectWH;
begin
Result := r_PlayerModel_GetGibRect(m, id)
end;
+{$ENDIF}
{$IFDEF ENABLE_GFX}
procedure r_Render_QueueEffect (AnimType, X, Y: Integer);
diff --git a/src/shared/a_modes.inc b/src/shared/a_modes.inc
index ae6ded6acfc7eb1d00c1924427fd920fa5c1a64f..494c574eab69d50a6adb65baeb4658d232ca47a6 100644 (file)
--- a/src/shared/a_modes.inc
+++ b/src/shared/a_modes.inc
{$UNDEF ENABLE_GFX}
{$DEFINE DISABLE_GFX}
{$ENDIF}
+ {$IFDEF ENABLE_GIBS}
+ {$WARNING Gibs in headless mode has no sense. Disabled.}
+ {$UNDEF ENABLE_GIBS}
+ {$DEFINE DISABLE_GIBS}
+ {$ENDIF}
{$ENDIF}
{$IF DEFINED(ENABLE_MENU) AND DEFINED(DISABLE_MENU)}
{$ENDIF}
{$ENDIF}
+{$IF DEFINED(ENABLE_GIBS) AND DEFINED(DISABLE_GIBS)}
+ {$ERROR Select ENABLE_GIBS or DISABLE_GIBS}
+{$ELSEIF NOT DEFINED(ENABLE_GIBS) AND NOT DEFINED(DISABLE_GIBS)}
+ // default ENABLE/DISABLE gibs
+ {$IFDEF HEADLESS}
+ {$DEFINE DISABLE_GIBS}
+ {$ELSE}
+ {$DEFINE ENABLE_GIBS}
+ {$ENDIF}
+{$ENDIF}
+
{$IF DEFINED(USE_SYSSTUB)}
{$IF DEFINED(USE_SDL) OR DEFINED(USE_SDL2)}
{$ERROR Only one system driver must be selected!}