summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6cdd36d)
raw | patch | inline | side by side (parent: 6cdd36d)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sat, 29 Jan 2022 11:36:31 +0000 (14:36 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 9 Jun 2023 08:05:29 +0000 (11:05 +0300) |
16 files changed:
diff --git a/src/game/Doom2DF.lpr b/src/game/Doom2DF.lpr
index 89e400e4ca0998cd36729529faf082d524520455..32bff3807a4516af3e4489f1b3aee23109c2e42b 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 7937a19954768c0cb7029f5cfceaa91fd7296c2e..c726ac2481f298e387ba850c72415e58554f5b7f 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, g_weapons,
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, 'g_force_model ', g_Force_Model_Get());
WriteLn(f, 'g_force_model_name ', g_Forced_Model_GetName());
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 01b7d02e1e5499845e7ae9f1b6200183e454ef7c..ad1c9afb36bb8468c93369e414779da2de3e034b 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, StrToIntDef(p[1], 0));
- g_Gibs_SetMax(a)
+ {$IFDEF ENABLE_GIBS}
+ a := Max(0, StrToIntDef(p[1], 0));
+ 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_holmes.pas b/src/game/g_holmes.pas
index e21faf5d8ffac4227e00fc4654e2cfd381d9fd3c..948c3ff36a7e0f3158a4a2094106b9c9a7610b59 100644 (file)
--- a/src/game/g_holmes.pas
+++ b/src/game/g_holmes.pas
uses
{$INCLUDE ../nogl/noGLuses.inc}
+ {$IFDEF ENABLE_GIBS}
+ g_gibs,
+ {$ENDIF}
{rttiobj,} typinfo, e_res,
SysUtils, Classes, SDL2,
MAPDEF, g_options,
for f := 0 to High(gTriggers) do drawTrigger(gTriggers[f]);
end;
+{$IFDEF ENABLE_GIBS}
procedure drawGibsBoxes ();
var
f: Integer;
end;
end;
end;
+{$ENDIF}
var
mon: TMonster;
if showTraceBox then drawTraceBox();
- //drawGibsBoxes();
-
+ {$IFDEF ENABLE_GIBS}
+ // drawGibsBoxes();
+ {$ENDIF}
//pan := g_Map_traceToNearest(16, 608, 16, 8, (GridTagObstacle or GridTagLiquid), @ex, @ey);
(*
diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas
index d3064733ea5a81482c8a20b006701faf4a1a70a0..5c4f23285f7741d9bd374f675c5bbee486d805ae 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 213e264181188a5386926fecb922aadc4418f9d7..5369b9c9c6d4cbbc887539714cbc067c0c9553fa 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 ea41a27dd02dae512aa51a5804c41ccc6389b5b9..0358e4632ca2f4ce9915b4fa8fea12be7cc0da33 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 1d2c5d2c4020b18774a7894f4292f5d8e3dec0d0..fe1dd74c51d5f901dba986b047306d964918e069 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_items,
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;
flg: PFlag;
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 45e146140f4f17c7fb1ce3a54be460536741e792..11e20ede01852cf6982344fa0a2aa42cc1b092fa 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_Force_Model_Set(Mode: 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;
ForceModel: Word = 0;
ForcedModelName: String = STD_PLAYER_MODEL;
- 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 922f8dc66042557ad4d2ce360fc6091eef5e4b18..44cef05922d1b9b9303e8e4156271538b210faf4 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 05346f337d5c309c055e54366587e3ab1763726a..fad2a697ad70ddf2df21060d7e26589e622f7b0b 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 74bb0ab78f972e405cf649fd4cdcb682dd9fb3af..6c3729fb2a5596f69f23700ebaf1e47c5c3fb469 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 17f76e13193966988fd9c611d98ff85b021df897..03de73281ab91ff675adc24ad920af04cd587356 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!}