-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathchannel.h
162 lines (135 loc) · 3.48 KB
/
channel.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
struct kittyChannel;
struct amalCallBack;
#define API_AMAL_CALL_ARGS ( struct kittyChannel *self, void **code, unsigned int opt )
struct amalCallBack
{
void **code ;
void *(*cmd) (struct kittyChannel *self, struct amalCallBack *cb);
void *ret;
int last_reg;
int argStackCount;
int progStackCount;
amal::Flags Flags;
};
namespace channel_status
{
enum status
{
uninitialized = 0x01, // No amal program.
done = 0x02, // Amal program is done.
initialized = 0x04, // Have amal program
active = 0x08, // Amal program is running.
paused = 0x10, // Same as exit amal prgram at VBL
frozen = 0x20, // Stops the amal program, until its unfrozen.
wait = 0x40, // only Execute autotest
direct = 0x80, // exit autotest, early, and AMAL start ptr.
error = 0x100 // error (used by play command)
};
};
struct channelAPI
{
int (*getMax) ( void );
int (*getImage) (unsigned int object);
int (*getX) (unsigned int object);
int (*getY) (unsigned int object);
void (*setImage) (unsigned int object,int);
void (*setX) (unsigned int object,int);
void (*setY) (unsigned int object,int);
struct retroScreen *(*getScreen)( unsigned int object );
};
struct amalPlayContext
{
signed char *data;
int repeat;
int size;
signed char value;
};
class amalBankPlay
{
public:
unsigned short *offset_tab;
unsigned short *size_tab;
char *name_tab;
char *move_data;
int lx;
struct amalPlayContext cdx;
struct amalPlayContext cdy;
amalBankPlay(char *start);
};
class kittyChannel
{
public:
kittyChannel( int channel );
~kittyChannel();
unsigned short id;
unsigned short token;
unsigned short number;
struct stringData *amal_script;
char *amal_at;
struct stringData *anim_script;
char *anim_at;
int anim_loops;
// move x and move y
struct stringData *movex_script;
char *movex_at;
struct stringData *movey_script;
char *movey_at;
int deltax;
int deltay;
int anim_sleep;
int anim_sleep_to;
int move_sleep;
int move_sleep_to;
int count;
int count_to;
// amal move
int move_from_x;
int move_from_y;
int move_delta_x;
int move_delta_y;
int move_count;
int move_count_to;
struct channelAPI *objectAPI;
uint32_t animStatus;
uint32_t amalStatus;
uint32_t moveStatus;
int reg[10]; // local reg 0 to 9
int parenthses;
int *argStack;
struct amalBuf amalProg;
unsigned int argStackCount;
struct amalCallBack *progStack;
unsigned int progStackCount;
unsigned int loopCount;
unsigned int autotest_loopCount;
unsigned int last_reg;
void *(*pushBackFunction) (struct kittyChannel *self, struct amalCallBack *cb);
unsigned short next_arg;
unsigned short let;
struct amalBankPlay *amalPlayBank;
};
class ChannelTableClass
{
private:
struct kittyChannel **tab;
unsigned int allocated;
unsigned int used;
public:
ChannelTableClass()
{
used = 0;
allocated = 10;
tab = allocStruct(kittyChannel *,allocated);
}
~ChannelTableClass();
struct kittyChannel *newChannel( int channel );
struct kittyChannel *getChannel( int channel );
struct kittyChannel *item( int index );
struct kittyChannel *findChannelByItem(int token, int number);
unsigned int _size();
};
extern void setChannelAmal( struct kittyChannel *item, struct stringData *str);
extern void setChannelAnim( struct kittyChannel *item, struct stringData *str, bool enable);
extern void setChannelMoveX( struct kittyChannel *item, struct stringData *str);
extern void setChannelMoveY( struct kittyChannel *item, struct stringData *str);
extern void initChannel( struct kittyChannel *item, int channel );