Complete disaster-recovery snapshot: engine/game source, game data assets, VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive. Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false, no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
96 lines
2.1 KiB
C++
96 lines
2.1 KiB
C++
//===========================================================================//
|
|
// File: SimpleChannelAnimator.hpp
|
|
// Project: MechWarrior 4
|
|
// Contents:
|
|
//
|
|
//---------------------------------------------------------------------------//
|
|
// Date Who Modification //
|
|
// -------- --- ---------------------------------------------------------- //
|
|
// 12/17/99 JSE Initial coding,
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1998, Fasa Interactive, Inc.
|
|
// All Rights reserved worldwide
|
|
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL
|
|
//===========================================================================//
|
|
|
|
#pragma once
|
|
|
|
namespace MechWarrior4 {
|
|
|
|
|
|
//##########################################################################
|
|
//######################### SimpleChannelAnimator ###############################
|
|
//##########################################################################
|
|
|
|
template <class T> class SimpleChannelAnimatorOf
|
|
{
|
|
public:
|
|
|
|
SimpleChannelAnimatorOf()
|
|
{
|
|
currentTime = 0.0f;
|
|
totalTime = 0.0f;
|
|
dirtyFlag = true;
|
|
};
|
|
|
|
~SimpleChannelAnimatorOf()
|
|
{};
|
|
|
|
|
|
void Init(T start_position, T end_position, Stuff::Scalar total_time)
|
|
{
|
|
currentTime = 0;
|
|
currentPosition = start_position;
|
|
startPosition = start_position;
|
|
endPosition = end_position;
|
|
totalTime = total_time;
|
|
dirtyFlag = true;
|
|
}
|
|
|
|
T GetCurrentValue()
|
|
{
|
|
if (dirtyFlag)
|
|
UpdatePosition();
|
|
|
|
return currentPosition;
|
|
}
|
|
|
|
void UpdateTime(Stuff::Scalar time_slice)
|
|
{
|
|
|
|
if (currentTime < totalTime)
|
|
{
|
|
currentTime += time_slice;
|
|
dirtyFlag = true;
|
|
}
|
|
}
|
|
|
|
bool AnimDone()
|
|
{
|
|
if (currentTime >= totalTime)
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
void UpdatePosition(void);
|
|
|
|
bool dirtyFlag;
|
|
|
|
Stuff::Scalar currentTime;
|
|
Stuff::Scalar totalTime;
|
|
|
|
T currentPosition;
|
|
T startPosition;
|
|
T endPosition;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|