~mjmendoza/quixie/trunk

« back to all changes in this revision

Viewing changes to inc/cls/kse_Entity.hpp

  • Committer: creek23
  • Date: 2014-05-27 17:02:50 UTC
  • Revision ID: svn-v4:5d579d6f-57a3-4165-9b1e-6dacaf8da75a:quixie:641
line-by-line C++ conversion attempt

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
const kseENTITY_MOVE = 1
 
2
const kseENTITY_NO_SPRITE = -1
 
3
 
 
4
enum kseDIRECTION {
 
5
        dNOT_SET = 0,
 
6
        dDOWN = 1,
 
7
        dLEFT = 2,
 
8
        dRIGHT = 3,
 
9
        dirUP = 4 //dUP conflicts with dup(licate)
 
10
};
 
11
 
 
12
struct typeEntityInstance {
 
13
    bool bUsed;
 
14
    string sName //alias (entity instance name); will be used for xxxLoop, xxxOnHit, xxxOnLoad, xxxOnUnload
 
15
    int iObstructValue  //when entity got obstructed, this will contain which area hit it.
 
16
    int iEntityIdx      //which is the parent entity
 
17
    bool IsAttachedToMap    //is instance attached to map?
 
18
};
 
19
 
 
20
struct typeEntity {
 
21
        bool bUsed;
 
22
        string sName;
 
23
        int iX;
 
24
        int iY;
 
25
        int iWidth;
 
26
        int iHeight;
 
27
        int iSpriteIndex                //holds the Image index which is the attached sprite fot this entity
 
28
        //int iSpriteHandlers[10000];   //holds the array of frames
 
29
        bool bHide;                        //should this entity be shown or not
 
30
//      POWER_TYPE Power;
 
31
//      long int Frame;
 
32
        bool bStatic; //if map is not moving player should not be animated walking
 
33
        kseDIRECTION iDirection;
 
34
        int iAnmt_UpCtr;                 //counts number of frames for MOVE-UP animation
 
35
        //int iAnmt_UpTiles[10000];       //holds series of sprite tiles for MOVE-UP animation
 
36
        int iAnmt_DownCtr;         //counts number of frames for MOVE-DOWN animation
 
37
        //int iAnmt_DownTiles[10000];   //holds series of sprite tiles for MOVE-DOWN animation
 
38
        int iAnmt_LeftCtr;         //counts number of frames for MOVE-LEFT animation
 
39
        //int iAnmt_LeftTiles[10000];   //holds series of sprite tiles for MOVE-LEFT animation
 
40
        int iAnmt_RightCtr;       //counts number of frames for MOVE-RIGHT animation
 
41
        //int iAnmt_RightTiles[10000];  //holds series of sprite tiles for MOVE-RIGHT animation
 
42
 
 
43
        int *iSpriteHandlers;  //holds the array of frames
 
44
        int iSpriteHandlerMax;    //  for ubound
 
45
        int *iAnmt_UpTiles;    //holds series of sprite tiles for MOVE-UP animation
 
46
        int iAnmt_UpTileMax;      //  for ubound
 
47
        int *iAnmt_DownTiles;  //holds series of sprite tiles for MOVE-DOWN animation
 
48
        int iAnmt_DownTileMax;    //  for ubound
 
49
        int *iAnmt_LeftTiles;  //holds series of sprite tiles for MOVE-LEFT animation
 
50
        int iAnmt_LeftTileMax;    //  for ubound
 
51
        int *iAnmt_RightTiles; //holds series of sprite tiles for MOVE-RIGHT animation
 
52
        int iAnmt_RightTileMax;   //  for ubound
 
53
 
 
54
        bool IsAttachedToMap;    //if attached to map
 
55
//      long int ID;
 
56
};
 
57
 
 
58
//struct typeEntitySprite {
 
59
//      bool bStatic;  'animate or halt
 
60
//      //int iDelay;   'how many times a frame will be showed; connected to animation
 
61
//      int iCtr;        'animation counter
 
62
//      int iIdx;        'would contain the index from an animation
 
63
//};
 
64
 
 
65
struct typeSpriteAnimation {
 
66
        bool bUsed;
 
67
        int iCtr;         //frame counter
 
68
        //int iTiles[10000];  //will hold series of tiles for animation
 
69
 
 
70
                        int *iTiles  //will hold series of tiles for animation
 
71
                        int iTileMax    //   for Ubound
 
72
};
 
73
 
 
74
extern vector<typeEntity> kseEntity;
 
75
extern vector<typeEntityInstance> kseEntityInstance;
 
76
//extern vector<typeEntitySprite> kseEntitySprites;
 
77
extern vector<typeSpriteAnimation> kseSpriteAnimation;
 
78
 
 
79
//extern int iEntityCtr;
 
80
//extern int iEntityInstanceCtr;
 
81
extern long int iEntitySpritesCtr;
 
82
extern long int iSpriteAnimationCtr;
 
83
 
 
84
//functions
 
85
int EntityAttachSprite(long int &iIndex);
 
86
int EntityDetachSprite(long int &iIndex);
 
87
int EntitySetX(long int &iIndex);
 
88
int EntitySetY(long int &iIndex);
 
89
int EntityGenerate(long int &iIndex);
 
90
int EntityNew(long int &iIndex);
 
91
int CreateNewEntity();
 
92
int EntityLoad(long int &iIndex);
 
93
void Engine_RunEntityScript(string flName, string fxName, string ksExt = ".ks");
 
94
int EntityUnload(long int &iIndex);
 
95
int EntitySetMoveUp(long int &iIndex);
 
96
int EntitySetMoveDown(long int &iIndex);
 
97
int EntitySetMoveLeft(long int &iIndex);
 
98
int EntitySetMoveRight(long int &iIndex);
 
99
void Engine_EntityChangeDirection(entity As Integer, kseDIRECTION dDir);
 
100
int Entity_SkipOpenParenthesisAfter(string sWhat, long int iIndex);
 
101
int Entity_SkipCommaAfter(string sWhat, long int iIndex);
 
102
int Entity_SkipCloseParenthesisAfter(string sWhat, long int iIndex);
 
103
//class
 
104
int SynEntity(long int &iIndex);