From c0c336500955a23e344651e5412c9d9d441ef4ee Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Wed, 28 Jun 2023 22:22:32 +0100 Subject: first pass of T2DLL --- src/T2DLL/T2Animation.h | 52 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 10 deletions(-) (limited to 'src/T2DLL/T2Animation.h') diff --git a/src/T2DLL/T2Animation.h b/src/T2DLL/T2Animation.h index 410a449..a7bd371 100644 --- a/src/T2DLL/T2Animation.h +++ b/src/T2DLL/T2Animation.h @@ -1,18 +1,50 @@ #pragma once #include "common.h" +#include "T2Sprite.h" -class T2Animation { +struct AnimationDef { + POINT position; + short pattern; +}; + +struct SpriteDef { + unsigned int resID; + short count; + short width; + short height; +}; + +class AFX_EXT_CLASS T2Animation { public: - void Rewind(); - int HasNextStep() const; - int SetFrame(int); - int GetFrame() const; - T2Animation(T2TowerDoc*, short, short, const SpriteDef*, const AnimationDef*, T2Sprite::ELayer); + T2Animation(T2TowerDoc* inDoc, short inNumOfFrame, short inNumOfSprite, const SpriteDef* inSpriteDef, const AnimationDef* inAnimationDef, T2Sprite::ELayer inLayer); ~T2Animation(); - int Start(POINT, int); - int Idle(); - void Play(POINT, int); - int Step(); + BOOL Start(POINT inPt, int inLen); + BOOL Idle(); + void Play(POINT inPt, int inLen); + BOOL Step(); + + void Rewind() { SetFrame(0); } + BOOL HasNextStep() const { + return (mFrame >= 0) && (mFrame < mNumOfFrame); + } + BOOL SetFrame(int inFrame) { + mFrame = inFrame; + return HasNextStep(); + } + int GetFrame() const { return mFrame; } + protected: void Draw(); + + T2TowerDoc *mDocument; + short mNumOfFrame; + short mNumOfSprite; + const AnimationDef *mAnimationDef; + int *mSpriteIndices; + T2ImageObj **mImageObjs; + T2BitImage **mImages; + POINT mPoint; + short mFrame; + int mInterval; + DWORD mTickCount; }; -- cgit v1.2.3