summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f9982f4)
raw | patch | inline | side by side (parent: f9982f4)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 18 Jan 2022 20:11:14 +0000 (23:11 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 18 Jan 2022 20:11:14 +0000 (23:11 +0300) |
12 files changed:
index 3301dd4c61263cdd719bb977c4bf813637f42f86..b6e68b511a3fe8c3ed8ed613081c4a0393494c77 100644 (file)
--- a/src/game/g_monsters.pas
+++ b/src/game/g_monsters.pas
anim := (vilefire <> nil);
utils.writeBool(st, anim);
// Если есть - сохраняем:
- if anim then vilefire.SaveState(st);
+ if anim then vilefire.SaveState(st, 0, False);
// Анимации
for i := ANIM_SLEEP to ANIM_PAIN do
begin
anim := (FAnim[i, TDirection.D_LEFT] <> nil);
utils.writeBool(st, anim);
// Если есть - сохраняем
- if anim then FAnim[i, TDirection.D_LEFT].SaveState(st);
+ if anim then FAnim[i, TDirection.D_LEFT].SaveState(st, 0, False);
// Есть ли правая анимация
anim := (FAnim[i, TDirection.D_RIGHT] <> nil);
utils.writeBool(st, anim);
// Если есть - сохраняем
- if anim then FAnim[i, TDirection.D_RIGHT].SaveState(st);
+ if anim then FAnim[i, TDirection.D_RIGHT].SaveState(st, 0, False);
end;
end;
procedure TMonster.LoadState (st: TStream);
var
i: Integer;
- b: Byte;
- anim: Boolean;
+ b, alpha: Byte;
+ anim, blending: Boolean;
begin
assert(st <> nil);
if anim then
begin
Assert(vilefire <> nil, 'TMonster.LoadState: no vilefire anim');
- vilefire.LoadState(st);
+ vilefire.LoadState(st, alpha, blending);
end;
// Анимации
for i := ANIM_SLEEP to ANIM_PAIN do
if anim then
begin
Assert(FAnim[i, TDirection.D_LEFT] <> nil, 'TMonster.LoadState: no '+IntToStr(i)+'_left anim');
- FAnim[i, TDirection.D_LEFT].LoadState(st);
+ FAnim[i, TDirection.D_LEFT].LoadState(st, alpha, blending);
end;
// Есть ли правая анимация
anim := utils.readBool(st);
if anim then
begin
Assert(FAnim[i, TDirection.D_RIGHT] <> nil, 'TMonster.LoadState: no '+IntToStr(i)+'_right anim');
- FAnim[i, TDirection.D_RIGHT].LoadState(st);
+ FAnim[i, TDirection.D_RIGHT].LoadState(st, alpha, blending);
end;
end;
end;
diff --git a/src/game/g_panel.pas b/src/game/g_panel.pas
index b1c8994b9b13ab561788151c8437565de4ad3c6b..87bbb476ea2ed2be218abb30f6988877e58cba39 100644 (file)
--- a/src/game/g_panel.pas
+++ b/src/game/g_panel.pas
if FTextureIDs[i].Anim then
begin // Àíèìèðîâàííàÿ òåêñòóðà
FTextureIDs[i].AnTex := TAnimationState.Create(True, Textures[AddTextures[i].Texture].Speed, Textures[AddTextures[i].Texture].FramesCount);
- FTextureIDs[i].AnTex.Blending := ByteBool(PanelRec.Flags and PANEL_FLAG_BLENDING);
- FTextureIDs[i].AnTex.Alpha := PanelRec.Alpha;
end
end;
end;
utils.writeBool(st, anim);
// Åñëè äà - ñîõðàíÿåì àíèìàöèþ
- if anim then FTextureIDs[FCurTexture].AnTex.SaveState(st);
+ if anim then FTextureIDs[FCurTexture].AnTex.SaveState(st, FAlpha, FBlending);
// moving platform state
utils.writeInt(st, Integer(mMovingSpeed.X));
(FTextureIDs[FCurTexture].Anim) and
(FTextureIDs[FCurTexture].AnTex <> nil),
'TPanel.LoadState: No animation object');
- FTextureIDs[FCurTexture].AnTex.LoadState(st);
+ FTextureIDs[FCurTexture].AnTex.LoadState(st, FAlpha, FBlending);
end;
// moving platform state
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 39848acaefdc2055d3fc784bfb19b84cd180958b..7d25ca5f126a47e57b4d9a147c4469636d61fa65 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
// animation
anim := (FModel <> nil);
utils.writeBool(st, anim);
- if anim then FModel.AnimState.SaveState(st);
+ if anim then FModel.AnimState.SaveState(st, 0, False);
// animation for mask (same as animation, compat with older saves)
anim := (FModel <> nil);
utils.writeBool(st, anim);
- if anim then FModel.AnimState.SaveState(st);
+ if anim then FModel.AnimState.SaveState(st, 0, False);
end;
procedure TCorpse.LoadState (st: TStream);
- var anim: Boolean; r, g, b: Byte; stub: TAnimationState;
+ var anim, blending: Boolean; r, g, b, alpha: Byte; stub: TAnimationState;
begin
assert(st <> nil);
anim := utils.readBool(st);
if anim then
begin
- stub.LoadState(st);
+ stub.LoadState(st, alpha, blending);
FModel.AnimState.CurrentFrame := Min(stub.CurrentFrame, FModel.AnimState.Length);
end
else
end;
// animation for mask (same as animation, compat with older saves)
anim := utils.readBool(st);
- if anim then stub.LoadState(st);
+ if anim then stub.LoadState(st, alpha, blending);
stub.Free;
end;
index 8190ea3df814d0b7300d2a6f85fe579681497825..dcfbd1a045f2179aee421ad6b6c25ffeb96cf680 100644 (file)
--- a/src/game/g_textures.pas
+++ b/src/game/g_textures.pas
TAnimationState = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF}
private
- mAlpha: Byte;
- mBlending: Boolean;
mCounter: Byte; // Ñ÷åò÷èê îæèäàíèÿ ìåæäó êàäðàìè
mSpeed: Byte; // Âðåìÿ îæèäàíèÿ ìåæäó êàäðàìè
mCurrentFrame: Integer; // Òåêóùèé êàäð (íà÷èíàÿ ñ 0)
procedure disable ();
procedure revert (r: Boolean);
- procedure saveState (st: TStream);
- procedure loadState (st: TStream);
+ procedure saveState (st: TStream; mAlpha: Byte; mBlending: Boolean);
+ procedure loadState (st: TStream; out mAlpha: Byte; out mBlending: Boolean);
function totalFrames (): Integer; inline;
property currentFrame: Integer read mCurrentFrame write mCurrentFrame;
property currentCounter: Byte read mCounter write mCounter;
property counter: Byte read mCounter;
- property blending: Boolean read mBlending write mBlending;
- property alpha: Byte read mAlpha write mAlpha;
property length: Integer read mLength;
end;
mSpeed := aspeed;
mEnabled := true;
mCurrentFrame := 0;
- mAlpha := 0;
mPlayed := false;
end;
result := mLength
end;
-procedure TAnimationState.saveState (st: TStream);
+procedure TAnimationState.saveState (st: TStream; mAlpha: Byte; mBlending: Boolean);
begin
if (st = nil) then exit;
end;
-procedure TAnimationState.loadState (st: TStream);
+procedure TAnimationState.loadState (st: TStream; out mAlpha: Byte; out mBlending: Boolean);
begin
if (st = nil) then exit;
index 74c2ebbdcddc236df3d1a84048675cea617adba9..f50ce92b382b21cb5868c22fb12d96f88226205b 100644 (file)
uses g_base, g_textures, MAPDEF, Imaging; // TMirrorType, TAnimationState, TDFPoint, TDynImageDataArray
- procedure r_AnimationState_Draw (TID: DWORD; t: TAnimationState; x, y: Integer; mirror: TMirrorType);
- procedure r_AnimationState_DrawEx (FID: DWORD; t: TAnimationState; x, y: Integer; mirror: TMirrorType; rpoint: TDFPoint; angle: SmallInt);
+ procedure r_AnimationState_Draw (FID: DWORD; t: TAnimationState; x, y: Integer; alpha: Byte; mirror: TMirrorType; blending: Boolean);
+ procedure r_AnimationState_DrawEx (FID: DWORD; t: TAnimationState; x, y: Integer; alpha: Byte; mirror: TMirrorType; blending: Boolean; rpoint: TDFPoint; angle: SmallInt);
function g_CreateFramesImg (ia: TDynImageDataArray; ID: PDWORD; const Name: AnsiString; BackAnimation: Boolean = false): Boolean;
g_language, g_game
;
- procedure r_AnimationState_Draw (TID: DWORD; t: TAnimationState; x, y: Integer; mirror: TMirrorType);
+ procedure r_AnimationState_Draw (FID: DWORD; t: TAnimationState; x, y: Integer; alpha: Byte; mirror: TMirrorType; blending: Boolean);
begin
if t.enabled then
- e_DrawAdv(framesArray[TID].TexturesID[t.currentFrame], x, y, t.alpha, true, t.blending, 0, nil, mirror)
+ e_DrawAdv(framesArray[FID].TexturesID[t.currentFrame], x, y, alpha, true, blending, 0, nil, mirror)
end;
- procedure r_AnimationState_DrawEx (FID: DWORD; t: TAnimationState; x, y: Integer; mirror: TMirrorType; rpoint: TDFPoint; angle: SmallInt);
+ procedure r_AnimationState_DrawEx (FID: DWORD; t: TAnimationState; x, y: Integer; alpha: Byte; mirror: TMirrorType; blending: Boolean; rpoint: TDFPoint; angle: SmallInt);
begin
if t.enabled then
- e_DrawAdv(framesArray[FID].TexturesID[t.currentFrame], x, y, t.alpha, true, t.blending, angle, @rpoint, mirror)
+ e_DrawAdv(framesArray[FID].TexturesID[t.currentFrame], x, y, alpha, true, blending, angle, @rpoint, mirror)
end;
function allocFrameSlot (): LongWord;
index 5ec00178c0d905258d602e97c2889366cf6f24a9..79b3c2b62adf1cb753eb97af83b948eecc104ec8 100644 (file)
type
TOnceAnim = record
AnimType: Byte;
+ Alpha: Byte;
x, y: Integer;
oldX, oldY: Integer;
Animation: TAnimationState;
end;
procedure r_GFX_OnceAnim (AnimType, x, y: Integer);
- var find_id: DWORD; a: TAnimationState;
+ var find_id: DWORD; a: TAnimationState; alpha: Byte;
begin
if not gpart_dbg_enabled then exit;
find_id := FindOnceAnim();
+ alpha := 0;
case AnimType of
R_GFX_NONE: a := nil;
R_GFX_TELEPORT: a := TAnimationState.Create(false, 6, 10); // !!! speed can be 3
begin
AnimType := R_GFX_SMOKE;
a := TAnimationState.Create(false, 3, 10);
- a.alpha := 150;
+ alpha := 150;
end;
R_GFX_EXPLODE_SKELFIRE: a := TAnimationState.Create(false, 8, 3);
R_GFX_EXPLODE_PLASMA: a := TAnimationState.Create(false, 3, 4);
assert(false)
end;
OnceAnims[find_id].AnimType := AnimType;
+ OnceAnims[find_id].Alpha := alpha;
OnceAnims[find_id].Animation := a;
-// OnceAnims[find_id].Animation.Blending := Anim.Blending;
-// OnceAnims[find_id].Animation.alpha := Anim.alpha;
OnceAnims[find_id].x := x;
OnceAnims[find_id].y := y;
end;
begin
fx := nlerp(oldx, x, gLerpFactor);
fy := nlerp(oldy, y, gLerpFactor);
- r_AnimationState_Draw(gfxFrames[AnimType], Animation, x, y, TMirrorType.None);
+ r_AnimationState_Draw(gfxFrames[AnimType], Animation, x, y, Alpha, TMirrorType.None, False);
end;
end;
end;
index f42cb1fdfceefaaaf4dcb52656cac31abc01a1f3..a36feece8045ce386679174a99194c52353c335b 100644 (file)
end
else if itemFrames[it.ItemType] <> 0 then
begin
- r_AnimationState_Draw(itemFrames[it.ItemType], Animation, fX, fY, TMirrorType.None)
+ r_AnimationState_Draw(itemFrames[it.ItemType], Animation, fX, fY, 0, TMirrorType.None, False)
end;
if g_debug_Frames then
index b3efdc30be82fd2df53e77538f05631c83c185fb..35445c35fe00b08ecc51ec8ecbada997370e29ed 100644 (file)
else
Mirror := TMirrorType.None;
dx := IfThen(f.Direction = TDirection.D_LEFT, -1, +1);
- r_AnimationState_Draw(FlagFrames[i], FlagAnim, f.Obj.X + dx, f.Obj.Y + 1, Mirror);
+ r_AnimationState_Draw(FlagFrames[i], FlagAnim, f.Obj.X + dx, f.Obj.Y + 1, 0, Mirror, False);
if g_debug_Frames then
e_DrawQuad(f.Obj.X + f.Obj.Rect.X, f.Obj.Y + f.Obj.Rect.Y, f.Obj.X + f.Obj.Rect.X + f.Obj.Rect.Width - 1, f.Obj.Y + f.Obj.Rect.Y + f.Obj.Rect.Height - 1, 0, 255, 0)
end
h := RenTextures[Texture].Height;
for xx := 0 to p.Width div w - 1 do
for yy := 0 to p.Height div h - 1 do
- r_AnimationState_Draw(FramesID, p.TextureIDs[p.FCurTexture].AnTex, p.X + xx * w, p.Y + yy * h, TMirrorType.None);
+ r_AnimationState_Draw(FramesID, p.TextureIDs[p.FCurTexture].AnTex, p.X + xx * w, p.Y + yy * h, p.Alpha, TMirrorType.None, p.Blending);
end
end
else
index 8acec37b1d446cdece210df2958015afb23d5bae..7b1fcc4b0a147dda4b2ff37ddd9de3b36202d078 100644 (file)
if MonsterType = MONSTER_VILE then
if MonsterState = MONSTATE_SHOOT then
if GetPos(MonsterTargetUID, @o) then
- r_AnimationState_Draw(VileFire, VileFireAnim, o.X + o.Rect.X + (o.Rect.Width div 2) - 32, o.Y + o.Rect.Y + o.Rect.Height - 128, TMirrorType.None);
+ r_AnimationState_Draw(VileFire, VileFireAnim, o.X + o.Rect.X + (o.Rect.Width div 2) - 32, o.Y + o.Rect.Y + o.Rect.Height - 128, 0, TMirrorType.None, False);
// Не в области рисования не ресуем:
//FIXME!
dy := MONSTER_ANIMTABLE[MonsterType].AnimDeltaRight[MonsterAnim].Y;
end;
- r_AnimationState_Draw(monFrames[MonsterType, MonsterAnim, GameDirection], DirAnim[MonsterAnim, GameDirection], fX + dx, fY + dy, m);
+ r_AnimationState_Draw(monFrames[MonsterType, MonsterAnim, GameDirection], DirAnim[MonsterAnim, GameDirection], fX + dx, fY + dy, 0, m, False);
end;
if g_debug_Frames then
index 6d87a18ce5afe35df3f83b35c699966a1a9e5011..2a962f7aab91f3b8bf17504a81bf2febcca783aa 100644 (file)
if p.FKeys[KEY_DOWN].Pressed then ID := PunchFrames[R_BERSERK in p.FRulez, 2]
else if p.FKeys[KEY_UP].Pressed then ID := PunchFrames[R_BERSERK in p.FRulez, 1]
else ID := PunchFrames[R_BERSERK in p.FRulez, 0];
- r_AnimationState_Draw(ID, p.PunchAnim, fX + IfThen(p.Direction = TDirection.D_LEFT, 15 - p.Obj.Rect.X, p.Obj.Rect.X - 15), fY + fSlope + p.Obj.Rect.Y - 11, Mirror);
+ r_AnimationState_Draw(ID, p.PunchAnim, fX + IfThen(p.Direction = TDirection.D_LEFT, 15 - p.Obj.Rect.X, p.Obj.Rect.X - 15), fY + fSlope + p.Obj.Rect.Y - 11, 0, Mirror, False);
end;
if (p.FMegaRulez[MR_INVUL] > gTime) and ((gPlayerDrawn <> p) or (p.SpawnInvul >= gTime)) then
index c4fe391680359245ceb2fa49000a899ed6e60774..e9877305a0da1fbae544c81ff6762330ce3c2243 100644 (file)
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,
+ 0,
Mirror,
+ False,
p,
IfThen(pm.Direction = TDirection.D_RIGHT, fa, -fa)
);
// Модель:
if (pm.Direction = TDirection.D_LEFT) and (Models[pm.id].Frames[TDirection.D_LEFT, pm.CurrentAnimation].base <> 0) then
begin
- pm.AnimState.Alpha := Alpha; // !!!
FramesID := Models[pm.id].Frames[TDirection.D_LEFT, pm.CurrentAnimation].base;
- r_AnimationState_Draw(FramesID, pm.AnimState, X, Y, TMirrorType.None);
+ r_AnimationState_Draw(FramesID, pm.AnimState, X, Y, Alpha, TMirrorType.None, False);
end
else
begin
- pm.AnimState.Alpha := Alpha; // !!!
FramesID := Models[pm.id].Frames[TDirection.D_RIGHT, pm.CurrentAnimation].base;
- r_AnimationState_Draw(FramesID, pm.AnimState, X, Y, Mirror);
+ r_AnimationState_Draw(FramesID, pm.AnimState, X, Y, Alpha, Mirror, False);
end;
// Маска модели:
if (pm.Direction = TDirection.D_LEFT) and (Models[pm.id].Frames[TDirection.D_LEFT, pm.CurrentAnimation].mask <> 0) then
begin
- pm.AnimState.Alpha := Alpha; // !!!
FramesID := Models[pm.id].Frames[TDirection.D_LEFT, pm.CurrentAnimation].mask;
- r_AnimationState_Draw(FramesID, pm.AnimState, X, Y, TMirrorType.None);
+ r_AnimationState_Draw(FramesID, pm.AnimState, X, Y, Alpha, TMirrorType.None, False);
end
else
begin
- pm.AnimState.Alpha := Alpha; // !!!
FramesID := Models[pm.id].Frames[TDirection.D_RIGHT, pm.CurrentAnimation].mask;
- r_AnimationState_Draw(FramesID, pm.AnimState, X, Y, Mirror);
+ r_AnimationState_Draw(FramesID, pm.AnimState, X, Y, Alpha, Mirror, False);
end;
e_Colors.R := 255;
index 648ff507201165d6cdcd9ad20b5017dbd61b7b6b..fb5e612f1c63e144ce5d9ed0f2ca33edca16ff51 100644 (file)
if Animation <> nil then
begin
if Shots[i].ShotType in [WEAPON_BARON_FIRE, WEAPON_MANCUB_FIRE, WEAPON_SKEL_FIRE] then
- r_AnimationState_DrawEx(ShotFrames[Shots[i].ShotType], Animation, fX, fY, TMirrorType.None, p, a)
+ r_AnimationState_DrawEx(ShotFrames[Shots[i].ShotType], Animation, fX, fY, 0, TMirrorType.None, False, p, a)
else
- r_AnimationState_Draw(ShotFrames[Shots[i].ShotType], Animation, fX, fY, TMirrorType.None);
+ r_AnimationState_Draw(ShotFrames[Shots[i].ShotType], Animation, fX, fY, 0, TMirrorType.None, False);
end
else if ShotTexture[Shots[i].ShotType] <> 0 then
begin