index e2db8d47acabb897be51d738f0ef854794355c55..34dbdfdbe02be7ea1dc9a4056f684f3a3b92e5cd 100644 (file)
interface
-uses
- MAPDEF, g_textures, g_base, g_basic, g_weapons, r_graphics, utils, g_gfx,
- ImagingTypes, Imaging, ImagingUtility;
+ uses MAPDEF, g_textures, g_base, g_basic, g_weapons, utils;
const
A_STAND = 0;
Back: Boolean;
end;
+{$IFDEF ENABLE_GFX}
TModelBlood = record
R, G, B, Kind: Byte;
end;
+{$ENDIF}
TModelSound = record
ID: DWORD;
function PlaySound(SoundType, Level: Byte; X, Y: Integer): Boolean;
procedure Update();
- function GetBlood (): TModelBlood;
+ {$IFDEF ENABLE_GFX}
+ function GetBlood (): TModelBlood;
+ {$ENDIF}
+
function GetName (): String;
published
procedure g_PlayerModel_FreeData();
function g_PlayerModel_Load(FileName: String): Boolean;
function g_PlayerModel_GetNames(): SSArray;
-function g_PlayerModel_GetBlood(ModelName: String): TModelBlood;
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}
+ function g_PlayerModel_GetBlood(ModelName: String): TModelBlood;
+{$ENDIF}
+
+procedure g_PlayerModel_LoadFake (ModelName, FileName: String);
+
(* --- private data --- *)
type
PainSounds: TModelSoundArray;
DieSounds: TModelSoundArray;
SlopSound: Byte;
- Blood: TModelBlood;
+ {$IFDEF ENABLE_GFX}
+ Blood: TModelBlood;
+ {$ENDIF}
// =======================
FileName: String;
Anim: TModelTextures;
implementation
-uses
- g_sound, g_console, SysUtils, g_player, CONFIG, r_textures, r_animations,
- e_sound, g_options, g_map, Math, e_log, wadreader;
+ uses
+ {$IFDEF ENABLE_GFX}
+ g_gfx,
+ {$ENDIF}
+ g_sound, g_console, SysUtils, g_player, CONFIG,
+ e_sound, g_options, g_map, Math, e_log, wadreader
+ ;
const
FLAG_DEFPOINT: TDFPoint = (X:32; Y:16);
end;
end;
-function g_PlayerModel_CalcGibSize (pData: Pointer; dataSize, x, y, w, h: Integer): TRectWH;
- var i, j: Integer; done: Boolean; img: TImageData;
-
- function IsVoid (i, j: Integer): Boolean;
- begin
- result := Byte((PByte(img.bits) + (y+j)*img.width*4 + (x+i)*4 + 3)^) = 0
- end;
-
-begin
- InitImage(img);
- assert(LoadImageFromMemory(pData, dataSize, img));
-
- (* trace x from right to left *)
- done := false; i := 0;
- while not done and (i < w) do
- begin
- j := 0;
- while (j < h) and IsVoid(i, j) do inc(j);
- done := (j < h) and (IsVoid(i, j) = false);
- result.x := i;
- inc(i);
- end;
-
- (* trace y from up to down *)
- done := false; j := 0;
- while not done and (j < h) do
- begin
- i := 0;
- while (i < w) and IsVoid(i, j) do inc(i);
- done := (i < w) and (IsVoid(i, j) = false);
- result.y := j;
- inc(j);
- end;
-
- (* trace x from right to left *)
- done := false; i := w - 1;
- while not done and (i >= 0) do
- begin
- j := 0;
- while (j < h) and IsVoid(i, j) do inc(j);
- done := (j < h) and (IsVoid(i, j) = false);
- result.width := i - result.x + 1;
- dec(i);
- end;
-
- (* trace y from down to up *)
- done := false; j := h - 1;
- while not done and (j >= 0) do
+ procedure g_PlayerModel_LoadFake (ModelName, FileName: String);
+ var id: Integer;
begin
- i := 0;
- while (i < w) and IsVoid(i, j) do inc(i);
- done := (i < w) and (IsVoid(i, j) = false);
- result.height := j - result.y + 1;
- dec(j);
+ SetLength(PlayerModelsArray, Length(PlayerModelsArray) + 1);
+ id := High(PlayerModelsArray);
+ PlayerModelsArray[id].Name := ModelName;
+ PlayerModelsArray[id].HaveWeapon := False;
+ PlayerModelsArray[id].FileName := FileName;
end;
- FreeImage(img);
-end;
-
function g_PlayerModel_Load(FileName: string): Boolean;
var
ID: DWORD;
PlayerModelsArray[ID].Author := config.ReadStr('Model', 'author', '');
PlayerModelsArray[ID].Description := config.ReadStr('Model', 'description', '');
PlayerModelsArray[ID].FileName := FileName;
- with PlayerModelsArray[ID] do
- begin
- Blood.R := MAX(0, MIN(255, config.ReadInt('Blood', 'R', 150)));
- Blood.G := MAX(0, MIN(255, config.ReadInt('Blood', 'G', 0)));
- Blood.B := MAX(0, MIN(255, config.ReadInt('Blood', 'B', 0)));
- case config.ReadStr('Blood', 'Kind', 'NORMAL') of
- 'NORMAL': Blood.Kind := BLOOD_NORMAL;
- 'SPARKS': Blood.Kind := BLOOD_CSPARKS;
- 'COMBINE': Blood.Kind := BLOOD_COMBINE;
- else
- Blood.Kind := BLOOD_NORMAL
- end
- end;
+
+ {$IFDEF ENABLE_GFX}
+ with PlayerModelsArray[ID] do
+ begin
+ Blood.R := MAX(0, MIN(255, config.ReadInt('Blood', 'R', 150)));
+ Blood.G := MAX(0, MIN(255, config.ReadInt('Blood', 'G', 0)));
+ Blood.B := MAX(0, MIN(255, config.ReadInt('Blood', 'B', 0)));
+ case config.ReadStr('Blood', 'Kind', 'NORMAL') of
+ 'NORMAL': Blood.Kind := BLOOD_NORMAL;
+ 'SPARKS': Blood.Kind := BLOOD_CSPARKS;
+ 'COMBINE': Blood.Kind := BLOOD_COMBINE;
+ else
+ Blood.Kind := BLOOD_NORMAL
+ end
+ end;
+ {$ENDIF}
for b := A_STAND to A_LAST do
begin
end;
end;
+{$IFDEF ENABLE_GFX}
function g_PlayerModel_GetBlood(ModelName: string): TModelBlood;
var
a: Integer;
Break;
end;
end;
+{$ENDIF}
procedure g_PlayerModel_FreeData();
var i, b: Integer;
procedure TPlayerModel.SetFire (Fire: Boolean);
begin
if Fire then
- FFireCounter := PlayerModelsArray[FID].ModelSpeed[A_ATTACK] * PlayerModelsArray[FID].Anim[TDirection.D_RIGHT, A_ATTACK].Frames
+ FFireCounter := PlayerModelsArray[FID].ModelSpeed[A_ATTACK] * PlayerModelsArray[FID].Anim[TDirection.D_RIGHT, A_ATTACK].Frames + 1
else
FFireCounter := 0
end;
FCurrentWeapon := Weapon
end;
+{$IFDEF ENABLE_GFX}
function TPlayerModel.GetBlood (): TModelBlood;
begin
Result := PlayerModelsArray[FID].Blood
end;
+{$ENDIF}
function TPlayerModel.GetName (): String;
begin