index 12072bb52944ea015b546f50fc605011be3b9cf1..02098004a6432c4d64385e6d6f208c1380e2a569 100644 (file)
--- a/src/game/g_textures.pas
+++ b/src/game/g_textures.pas
interface
uses
- e_graphics, BinEditor, ImagingTypes, Imaging, ImagingUtility;
+ e_graphics, MAPDEF, BinEditor, ImagingTypes, Imaging, ImagingUtility;
Type
TLevelTexture = record
constructor Create(FramesID: DWORD; Loop: Boolean; Speed: Byte);
destructor Destroy(); override;
procedure Draw(X, Y: Integer; Mirror: TMirrorType);
- procedure DrawEx(X, Y: Integer; Mirror: TMirrorType; RPoint: TPoint;
+ procedure DrawEx(X, Y: Integer; Mirror: TMirrorType; RPoint: TDFPoint;
Angle: SmallInt);
procedure Reset();
procedure Update();
FWidth, FHeight, FCount: Word; BackAnimation: Boolean = False): Boolean;
function g_Frames_CreateMemory(ID: PDWORD; Name: ShortString; pData: Pointer; dataSize: LongInt;
FWidth, FHeight, FCount: Word; BackAnimation: Boolean = False): Boolean;
+function g_Frames_Dup(NewName, OldName: ShortString): Boolean;
//function g_Frames_CreateRevert(ID: PDWORD; Name: ShortString; Frames: string): Boolean;
-function g_Frames_Get(var ID: DWORD; FramesName: ShortString): Boolean;
-function g_Frames_GetTexture(var ID: DWORD; FramesName: ShortString; Frame: Word): Boolean;
+function g_Frames_Get(out ID: DWORD; FramesName: ShortString): Boolean;
+function g_Frames_GetTexture(out ID: DWORD; FramesName: ShortString; Frame: Word): Boolean;
function g_Frames_Exists(FramesName: String): Boolean;
procedure g_Frames_DeleteByName(FramesName: ShortString);
procedure g_Frames_DeleteByID(ID: DWORD);
begin
Result := False;
+ // models without "advanced" animations asks for "nothing" like this; don't spam log
+ if (Length(Resource) > 0) and ((Resource[Length(Resource)] = '/') or (Resource[Length(Resource)] = '\')) then exit;
+
FileName := g_ExtractWadName(Resource);
WAD := TWADFile.Create();
Result := True;
end;}
+function g_Frames_Dup(NewName, OldName: ShortString): Boolean;
+var
+ find_id, b: DWORD;
+ a, c: Integer;
+begin
+ Result := False;
+
+ if not g_Frames_Get(b, OldName) then Exit;
+
+ find_id := FindFrame();
+
+ FramesArray[find_id].Name := LowerCase(NewName);
+ FramesArray[find_id].FrameWidth := FramesArray[b].FrameWidth;
+ FramesArray[find_id].FrameHeight := FramesArray[b].FrameHeight;
+
+ c := High(FramesArray[b].TexturesID);
+ SetLength(FramesArray[find_id].TexturesID, c+1);
+
+ for a := 0 to c do
+ FramesArray[find_id].TexturesID[a] := FramesArray[b].TexturesID[a];
+
+ Result := True;
+end;
+
procedure g_Frames_DeleteByName(FramesName: ShortString);
var
a: DWORD;
FramesArray := nil;
end;
-function g_Frames_Get(var ID: DWORD; FramesName: ShortString): Boolean;
+function g_Frames_Get(out ID: DWORD; FramesName: ShortString): Boolean;
var
a: DWORD;
begin
g_FatalError(Format(_lc[I_GAME_ERROR_FRAMES], [FramesName]));
end;
-function g_Frames_GetTexture(var ID: DWORD; FramesName: ShortString; Frame: Word): Boolean;
+function g_Frames_GetTexture(out ID: DWORD; FramesName: ShortString; Frame: Word): Boolean;
var
a: DWORD;
begin
FEnabled := True;
end;
-procedure TAnimation.DrawEx(X, Y: Integer; Mirror: TMirrorType; RPoint: TPoint;
+procedure TAnimation.DrawEx(X, Y: Integer; Mirror: TMirrorType; RPoint: TDFPoint;
Angle: SmallInt);
begin
if not FEnabled then