summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7f57e4b)
raw | patch | inline | side by side (parent: 7f57e4b)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sun, 16 Jan 2022 17:05:24 +0000 (20:05 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sun, 16 Jan 2022 17:05:24 +0000 (20:05 +0300) |
diff --git a/src/game/Doom2DF.lpr b/src/game/Doom2DF.lpr
index 71e8d71caff2fd725d3572df45ea646eab81b81a..1f7a19c87747133c9296084bd00821495bbbf72a 100644 (file)
--- a/src/game/Doom2DF.lpr
+++ b/src/game/Doom2DF.lpr
if (NetMode = NET_SERVER) then g_Net_Host_Update()
else if (NetMode = NET_CLIENT) then g_Net_Client_Update();
// think
+ r_Render_Update;
g_Game_Update();
// server: send any accumulated outgoing data to clients
if NetMode = NET_SERVER then g_Net_Flush();
index 8ffb589787109f0a7ccf680e619b87c4dea97ea4..51dd6c0deecf8cb6215a419f96e04aef8e3af02e 100644 (file)
FSlopSound: Byte;
FCurrentWeapon: Byte;
FFlag: Byte;
- FFlagPoint: TDFPoint;
- FFlagAngle: SmallInt;
- FFlagAnim: TAnimation; // !!! TAnimationState
FFire: Boolean;
FFireCounter: Byte;
FID: Integer;
public
property Color: TRGB read FColor write FColor;
-
property AnimState: TAnimationState read FAnimState;
property CurrentAnimation: Byte read FCurrentAnimation;
-
property CurrentWeapon: Byte read FCurrentWeapon;
-
property Flag: Byte read FFlag;
- property FlagAnim: TAnimation read FFlagAnim;
- property FlagAngle: SmallInt read FFlagAngle;
- property FlagPoint: TDFPoint read FFlagPoint;
-
property ID: Integer read FID;
end;
Result.FPainSounds := PainSounds;
Result.FDieSounds := DieSounds;
Result.FSlopSound := SlopSound;
-
- Result.FFlagPoint := FlagPoint;
- Result.FFlagAngle := FlagAngle;
Result.FID := a;
-
Result.ChangeAnimation(A_STAND, True);
-
Break;
end;
end;
FFireCounter := 0
end;
-procedure TPlayerModel.SetFlag(Flag: Byte);
-var
- tid: DWORD;
-begin
- FFlag := Flag;
-
- FFlagAnim.Free();
- FFlagAnim := nil;
-
- case Flag of
- FLAG_RED: g_Frames_Get(tid, 'FRAMES_FLAG_RED');
- FLAG_BLUE: g_Frames_Get(tid, 'FRAMES_FLAG_BLUE');
- else Exit;
+ procedure TPlayerModel.SetFlag (Flag: Byte);
+ begin
+ FFlag := Flag
end;
- FFlagAnim := TAnimation.Create(tid, True, 8);
-end;
-
- procedure TPlayerModel.SetWeapon(Weapon: Byte);
+ procedure TPlayerModel.SetWeapon (Weapon: Byte);
begin
- FCurrentWeapon := Weapon;
+ FCurrentWeapon := Weapon
end;
function TPlayerModel.GetBlood (): TModelBlood;
begin
if FAnimState <> nil then
FAnimState.Update;
- if FFlagAnim <> nil then
- FFlagAnim.Update;
if FFireCounter > 0 then
Dec(FFireCounter)
else
index 1602f23e0d2b346d9c4f10e77665ca249486657d..b90ed0514249c89a076237d89b6016c38bef7740 100644 (file)
uses g_playermodel; // TPlayerModel
+ procedure r_PlayerModel_Initialize;
+ procedure r_PlayerModel_Finalize;
procedure r_PlayerModel_Load;
procedure r_PlayerModel_Free;
+ procedure r_PlayerModel_Update;
procedure r_PlayerModel_Draw (pm: TPlayerModel; X, Y: Integer; Alpha: Byte = 0);
implementation
MAPDEF, utils,
ImagingTypes, Imaging, ImagingUtility,
r_graphics, g_options, r_animations, r_textures,
- g_base, g_basic, g_map, g_weapons
+ g_base, g_basic, g_map, g_weapons, g_textures
;
const
mask: DWORD;
end;
end;
+ RedFlagFrames: DWORD;
+ BlueFlagFrames: DWORD;
+ FlagAnimState: TAnimationState;
+
+ procedure r_PlayerModel_Initialize;
+ begin
+ FlagAnimState := TAnimationState.Create(True, 8, 5);
+ end;
+
+ procedure r_PlayerModel_Finalize;
+ begin
+ FlagAnimState.Free;
+ FlagAnimState := nil;
+ end;
procedure ExtAnimFromBaseAnim(MName: String; AIdx: Integer);
const
procedure r_PlayerModel_Load;
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);
for a := WP_FIRST + 1 to WP_LAST do
begin
g_Texture_CreateWAD(WeaponID[a][W_POS_NORMAL][W_ACT_NORMAL], GameWAD+':WEAPONS\'+UpperCase(WeapNames[a]));
procedure r_PlayerModel_Free;
var i, a, b, c: Integer;
begin
+ e_DeleteTexture(RedFlagFrames);
+ e_DeleteTexture(BlueFlagFrames);
if PlayerModelsArray = nil then Exit;
for i := 0 to High(PlayerModelsArray) do
begin
e_DeleteTexture(WeaponID[a][b][c])
end;
+ procedure r_PlayerModel_Update;
+ begin
+ FlagAnimState.Update
+ end;
+
procedure r_PlayerModel_Draw (pm: TPlayerModel; X, Y: Integer; Alpha: Byte = 0);
var
Mirror: TMirrorType;
pos, act: Byte;
- p: TDFPoint;
+ fp, p: TDFPoint;
FramesID: DWORD;
+ fa: Integer;
begin
// Флаги:
if pm.Direction = TDirection.D_LEFT then
else
Mirror := TMirrorType.Horizontal;
- if (pm.Flag <> FLAG_NONE) and (pm.FlagAnim <> nil) and (not (pm.CurrentAnimation in [A_DIE1, A_DIE2])) then
+ FramesID := 0;
+ case pm.Flag of
+ FLAG_RED: FramesID := RedFlagFrames;
+ FLAG_BLUE: FramesID := BlueFlagFrames;
+ end;
+ if (FramesID <> 0) and (not (pm.CurrentAnimation in [A_DIE1, A_DIE2])) then
begin
+ fp := PlayerModelsArray[pm.id].FlagPoint;
+ fa := PlayerModelsArray[pm.id].FlagAngle;
p.X := IfThen(pm.Direction = TDirection.D_LEFT, FLAG_BASEPOINT.X, 64 - FLAG_BASEPOINT.X);
p.Y := FLAG_BASEPOINT.Y;
-
- r_Animation_DrawEx(pm.FlagAnim, X+IfThen(pm.Direction = TDirection.D_LEFT, pm.FlagPoint.X-1, 2*FLAG_BASEPOINT.X-pm.FlagPoint.X+1)-FLAG_BASEPOINT.X,
- Y+pm.FlagPoint.Y-FLAG_BASEPOINT.Y+1, Mirror, p,
- IfThen(pm.Direction = TDirection.D_RIGHT, pm.FlagAngle, -pm.FlagAngle));
+ r_AnimationState_DrawEx(
+ FramesID,
+ FlagAnimState,
+ X + IfThen(pm.Direction = TDirection.D_LEFT, fp.X - 1, 2 * FLAG_BASEPOINT.X - fp.X + 1) - FLAG_BASEPOINT.X,
+ Y + fp.Y - FLAG_BASEPOINT.Y + 1,
+ Mirror,
+ p,
+ IfThen(pm.Direction = TDirection.D_RIGHT, fa, -fa)
+ );
end;
// Оружие:
index 5deccdbdfd29a40c7983a34bfc26226b53356dcd..b26d0ecbea851752387b952675dc49f0e074789a 100644 (file)
procedure r_Render_Initialize;
procedure r_Render_Finalize;
+
procedure r_Render_Resize (w, h: Integer);
procedure r_Render_Load;
procedure r_Render_Free;
+ procedure r_Render_Update;
+
procedure r_Render_Apply;
implementation
LoadGL;
r_Window_Initialize;
r_Console_Init;
+ r_PlayerModel_Initialize;
end;
procedure r_Render_Finalize;
begin
+ r_PlayerModel_Finalize;
FreeGL;
e_ReleaseEngine
end;
+ procedure r_Render_Update;
+ begin
+ r_PlayerModel_Update;
+ end;
+
procedure r_Render_Resize (w, h: Integer);
begin
LoadGL;