forked from cvet/fonline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathItemHex.h
114 lines (94 loc) · 2.76 KB
/
ItemHex.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#ifndef __ITEM_HEX__
#define __ITEM_HEX__
#include "Defines.h"
#include "Item.h"
#include "SpriteManager.h"
struct AnyFrames;
class ItemHex: public Item
{
private:
ItemHex( uint id, ProtoItem* proto );
void AfterConstruction();
public:
ItemHex( uint id, ProtoItem* proto, Properties& props );
ItemHex( uint id, ProtoItem* proto, UCharVecVec* props_data );
ItemHex( uint id, ProtoItem* proto, UCharVecVec* props_data, int hx, int hy, int* hex_scr_x, int* hex_scr_y );
public:
uint SprId;
short ScrX, ScrY;
int* HexScrX, * HexScrY;
uchar Alpha;
AnyFrames* Anim;
bool SprDrawValid;
Sprite* SprDraw, * SprTemp;
Effect* DrawEffect;
private:
int curSpr, begSpr, endSpr;
uint animBegSpr, animEndSpr;
uint animTick;
uchar maxAlpha;
bool isAnimated;
uint animNextTick;
public:
bool IsAnimated() { return isAnimated; }
bool IsDrawContour() { return /*IsFocused && */ !IsAnyScenery() && !GetIsNoHighlight() && !GetIsBadItem(); }
bool IsTransparent() { return maxAlpha < 0xFF; }
bool IsFullyTransparent() { return maxAlpha == 0; }
void RefreshAnim();
void RestoreAlpha() { Alpha = maxAlpha; }
void RefreshAlpha() { maxAlpha = ( IsColorize() ? GetAlpha() : 0xFF ); }
void SetSprite( Sprite* spr );
int GetEggType();
// Finish
private:
bool finishing;
uint finishingTime;
public:
void Finish();
bool IsFinishing() { return finishing; }
bool IsFinish() { return ( finishing && Timer::GameTick() > finishingTime ); }
void StopFinishing();
// Process
public:
void Process();
// Effect
private:
bool isEffect;
float effSx, effSy;
int effStartX, effStartY;
float effCurX, effCurY;
uint effDist;
uint effLastTick;
int effDir;
public:
float EffOffsX, EffOffsY;
bool IsDynamicEffect() { return isEffect && ( effSx || effSy ); }
void SetEffect( float sx, float sy, uint dist, int dir );
UShortPair GetEffectStep();
// Fade
private:
bool fading;
uint fadingTick;
bool fadeUp;
void SetFade( bool fade_up );
public:
void SkipFade();
// Animation
public:
void StartAnimate();
void StopAnimate();
void SetAnimFromEnd();
void SetAnimFromStart();
void SetAnim( uint beg, uint end );
void SetSprStart();
void SetSprEnd();
void SetSpr( uint num_spr );
void SetAnimOffs();
void SetStayAnim();
void SetShowAnim();
void SetHideAnim();
public: // Move some specific types to end
UShortPairVec EffSteps;
};
typedef vector< ItemHex* > ItemHexVec;
#endif // __ITEM_HEX__