|
|
|
|
@ -545,7 +545,7 @@ void FreePlayerGFX(int pnum)
|
|
|
|
|
plr[pnum]._pGFXLoad = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void NewPlrAnim(int pnum, BYTE *Peq, int numFrames, int Delay, int width, AnimationDistributionFlags flags /*= AnimationDistributionFlags::None*/, int numSkippedFrames /*= 0*/, int distributeFramesBeforeFrame /*= 0*/) |
|
|
|
|
void NewPlrAnim(int pnum, BYTE *Peq, int numFrames, int Delay, int width, AnimationDistributionParams params /*= AnimationDistributionParams::None*/, int numSkippedFrames /*= 0*/, int distributeFramesBeforeFrame /*= 0*/) |
|
|
|
|
{ |
|
|
|
|
if ((DWORD)pnum >= MAX_PLRS) { |
|
|
|
|
app_fatal("NewPlrAnim: illegal player %d", pnum); |
|
|
|
|
@ -562,7 +562,7 @@ void NewPlrAnim(int pnum, BYTE *Peq, int numFrames, int Delay, int width, Animat
|
|
|
|
|
plr[pnum]._pAnimRelevantAnimationFramesForDistributing = 0; |
|
|
|
|
plr[pnum]._pAnimGameTickModifier = 0.0f; |
|
|
|
|
|
|
|
|
|
if (numSkippedFrames != 0 || flags != AnimationDistributionFlags::None) { |
|
|
|
|
if (numSkippedFrames != 0 || params != AnimationDistributionParams::None) { |
|
|
|
|
// Animation Frames that will be adjusted for the skipped Frames/GameTicks
|
|
|
|
|
int relevantAnimationFramesForDistributing = numFrames; |
|
|
|
|
if (distributeFramesBeforeFrame != 0) { |
|
|
|
|
@ -582,7 +582,7 @@ void NewPlrAnim(int pnum, BYTE *Peq, int numFrames, int Delay, int width, Animat
|
|
|
|
|
// How many GameTicks will the Animation be really shown (skipped Frames and GameTicks removed)
|
|
|
|
|
int relevantAnimationGameTicksWithSkipping = relevantAnimationGameTicksForDistribution - (numSkippedFrames * gameTicksPerFrame); |
|
|
|
|
|
|
|
|
|
if ((flags & AnimationDistributionFlags::ProcessAnimationPending) == AnimationDistributionFlags::ProcessAnimationPending) { |
|
|
|
|
if (params == AnimationDistributionParams::ProcessAnimationPending) { |
|
|
|
|
// If ProcessAnimation will be called after NewPlrAnim (in same GameTick as NewPlrAnim), we increment the Animation-Counter.
|
|
|
|
|
// If no delay is specified, this will result in complete skipped frame (see ProcessPlayerAnimation).
|
|
|
|
|
// But if we have a delay specified, this would only result in a reduced time the first frame is shown (one skipped delay).
|
|
|
|
|
@ -594,7 +594,7 @@ void NewPlrAnim(int pnum, BYTE *Peq, int numFrames, int Delay, int width, Animat
|
|
|
|
|
plr[pnum]._pAnimGameTicksSinceSequenceStarted = -1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ((flags & AnimationDistributionFlags::SkipsDelayOfLastFrame) == AnimationDistributionFlags::SkipsDelayOfLastFrame) { |
|
|
|
|
if (params == AnimationDistributionParams::SkipsDelayOfLastFrame) { |
|
|
|
|
// The logic for player/monster/... (not ProcessAnimation) only checks the frame not the delay.
|
|
|
|
|
// That means if a delay is specified, the last-frame is shown less then the other frames
|
|
|
|
|
// Example:
|
|
|
|
|
@ -1593,7 +1593,7 @@ void StartAttack(int pnum, direction d)
|
|
|
|
|
skippedAnimationFrames += 2; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
NewPlrAnim(pnum, plr[pnum]._pAAnim[d], plr[pnum]._pAFrames, 0, plr[pnum]._pAWidth, AnimationDistributionFlags::ProcessAnimationPending, skippedAnimationFrames, plr[pnum]._pAFNum); |
|
|
|
|
NewPlrAnim(pnum, plr[pnum]._pAAnim[d], plr[pnum]._pAFrames, 0, plr[pnum]._pAWidth, AnimationDistributionParams::ProcessAnimationPending, skippedAnimationFrames, plr[pnum]._pAFNum); |
|
|
|
|
plr[pnum]._pmode = PM_ATTACK; |
|
|
|
|
FixPlayerLocation(pnum, d); |
|
|
|
|
SetPlayerOld(pnum); |
|
|
|
|
@ -1621,7 +1621,7 @@ void StartRangeAttack(int pnum, direction d, int cx, int cy)
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
NewPlrAnim(pnum, plr[pnum]._pAAnim[d], plr[pnum]._pAFrames, 0, plr[pnum]._pAWidth, AnimationDistributionFlags::ProcessAnimationPending, skippedAnimationFrames, plr[pnum]._pAFNum); |
|
|
|
|
NewPlrAnim(pnum, plr[pnum]._pAAnim[d], plr[pnum]._pAFrames, 0, plr[pnum]._pAWidth, AnimationDistributionParams::ProcessAnimationPending, skippedAnimationFrames, plr[pnum]._pAFNum); |
|
|
|
|
|
|
|
|
|
plr[pnum]._pmode = PM_RATTACK; |
|
|
|
|
FixPlayerLocation(pnum, d); |
|
|
|
|
@ -1652,7 +1652,7 @@ void StartPlrBlock(int pnum, direction dir)
|
|
|
|
|
skippedAnimationFrames = (plr[pnum]._pBFrames - 2); // ISPL_FASTBLOCK means we cancel the animation if frame 2 was shown
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
NewPlrAnim(pnum, plr[pnum]._pBAnim[dir], plr[pnum]._pBFrames, 2, plr[pnum]._pBWidth, AnimationDistributionFlags::SkipsDelayOfLastFrame, skippedAnimationFrames); |
|
|
|
|
NewPlrAnim(pnum, plr[pnum]._pBAnim[dir], plr[pnum]._pBFrames, 2, plr[pnum]._pBWidth, AnimationDistributionParams::SkipsDelayOfLastFrame, skippedAnimationFrames); |
|
|
|
|
|
|
|
|
|
plr[pnum]._pmode = PM_BLOCK; |
|
|
|
|
FixPlayerLocation(pnum, dir); |
|
|
|
|
@ -1675,19 +1675,19 @@ void StartSpell(int pnum, direction d, int cx, int cy)
|
|
|
|
|
if ((plr[pnum]._pGFXLoad & PFILE_FIRE) == 0) { |
|
|
|
|
LoadPlrGFX(pnum, PFILE_FIRE); |
|
|
|
|
} |
|
|
|
|
NewPlrAnim(pnum, plr[pnum]._pFAnim[d], plr[pnum]._pSFrames, 0, plr[pnum]._pSWidth, AnimationDistributionFlags::ProcessAnimationPending); |
|
|
|
|
NewPlrAnim(pnum, plr[pnum]._pFAnim[d], plr[pnum]._pSFrames, 0, plr[pnum]._pSWidth, AnimationDistributionParams::ProcessAnimationPending); |
|
|
|
|
break; |
|
|
|
|
case STYPE_LIGHTNING: |
|
|
|
|
if ((plr[pnum]._pGFXLoad & PFILE_LIGHTNING) == 0) { |
|
|
|
|
LoadPlrGFX(pnum, PFILE_LIGHTNING); |
|
|
|
|
} |
|
|
|
|
NewPlrAnim(pnum, plr[pnum]._pLAnim[d], plr[pnum]._pSFrames, 0, plr[pnum]._pSWidth, AnimationDistributionFlags::ProcessAnimationPending); |
|
|
|
|
NewPlrAnim(pnum, plr[pnum]._pLAnim[d], plr[pnum]._pSFrames, 0, plr[pnum]._pSWidth, AnimationDistributionParams::ProcessAnimationPending); |
|
|
|
|
break; |
|
|
|
|
case STYPE_MAGIC: |
|
|
|
|
if ((plr[pnum]._pGFXLoad & PFILE_MAGIC) == 0) { |
|
|
|
|
LoadPlrGFX(pnum, PFILE_MAGIC); |
|
|
|
|
} |
|
|
|
|
NewPlrAnim(pnum, plr[pnum]._pTAnim[d], plr[pnum]._pSFrames, 0, plr[pnum]._pSWidth, AnimationDistributionFlags::ProcessAnimationPending); |
|
|
|
|
NewPlrAnim(pnum, plr[pnum]._pTAnim[d], plr[pnum]._pSFrames, 0, plr[pnum]._pSWidth, AnimationDistributionParams::ProcessAnimationPending); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -1799,7 +1799,7 @@ void StartPlrHit(int pnum, int dam, bool forcehit)
|
|
|
|
|
skippedAnimationFrames = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
NewPlrAnim(pnum, plr[pnum]._pHAnim[pd], plr[pnum]._pHFrames, 0, plr[pnum]._pHWidth, AnimationDistributionFlags::None, skippedAnimationFrames); |
|
|
|
|
NewPlrAnim(pnum, plr[pnum]._pHAnim[pd], plr[pnum]._pHFrames, 0, plr[pnum]._pHWidth, AnimationDistributionParams::None, skippedAnimationFrames); |
|
|
|
|
|
|
|
|
|
plr[pnum]._pmode = PM_GOTHIT; |
|
|
|
|
FixPlayerLocation(pnum, pd); |
|
|
|
|
|