This repository has been archived by the owner on May 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jm_tp.h
155 lines (124 loc) · 3.57 KB
/
jm_tp.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
// JM_TP.H
#ifndef _JM_TP_H_
#define _JM_TP_H_
#define PI_MAX_NUM_DISP_STRS 1 // num display str ptrs allocated for text presenter
#define TP_RETURN_CHAR '\r'
#define TP_CONTROL_CHAR '^'
#define TP_CURSOR_SAVES 8 // MAX different points to save
#define TP_CNVT_CODE(c1,c2) ((c1) | (c2 << 8))
#define TP_MAX_ANIMS 10
#define TP_MAX_PAGES 41
#define TP_MARGIN 1 // distance between xl/xh/yl/yh points and text
#define is_shadowed ((flags & fl_shadowtext) == fl_shadowtext)
#define TP_INIT_DISPLAY_STR(num,str_ptr) \
{ \
if ((num) < PI_MAX_NUM_DISP_STRS) \
piStringTable[(num)] = (str_ptr); \
else \
Quit ("String number exceeds max array size"); \
}
//
// global static flags
//
#define fl_center 0x0001
#define fl_uncachefont 0x0002
#define fl_boxshape 0x0004
#define fl_shadowtext 0x0008
#define fl_presenting 0x0010
#define fl_startofline 0x0020
#define fl_upreleased 0x0040
#define fl_dnreleased 0x0080
#define fl_pagemanager 0x0100
#define fl_hidecursor 0x0200
#define fl_shadowpic 0x0400
#define fl_clearscback 0x0800
//
// PresenterInfo structure flags
//
#define TPF_CACHED_SCRIPT 0x0001
#define TPF_CACHE_NO_GFX 0x0002
#define TPF_CONTINUE 0x0004
#define TPF_USE_CURRENT 0x0008
#define TPF_SHOW_CURSOR 0x0010
#define TPF_SCROLL_REGION 0x0020
#define TPF_SHOW_PAGES 0x0040
#define TPF_TERM_SOUND 0x0080
#define TPF_ABORTABLE 0x0100
typedef struct
{
uint16_t flags,gflags;
char *script[TP_MAX_PAGES];
void *scriptstart;
int16_t numpages,pagenum;
int16_t xl,yl,xh,yh;
byte fontnumber;
byte bgcolor,ltcolor,dkcolor,shcolor;
int16_t cur_x,cur_y;
int8_t print_delay;
byte highlight_color,fontcolor;
int16_t id_cache;
const char *infoline;
} PresenterInfo;
enum tpCacheTypes
{
ct_scaled,
ct_chunk,
ct_marks,
ct_music,
};
enum pisTypes
{
pis_pic,
pis_sprite,
pis_scaled,
pis_scwall,
};
typedef struct
{
int16_t shapenum;
byte shapetype;
} piShapeInfo;
enum piaTypes
{
pia_grabscript,
pia_shapetable,
};
enum pidTypes
{
pid_cycle,
pid_rebound,
};
typedef struct
{
int16_t baseshape;
int8_t frame,maxframes;
int16_t delay,maxdelay;
byte animtype;
byte dirtype;
int16_t x,y;
int8_t diradd;
} piAnimInfo;
extern piShapeInfo piShapeTable[];
extern piAnimInfo piAnimTable[];
extern piAnimInfo piAnimList[TP_MAX_ANIMS];
extern char *piStringTable[PI_MAX_NUM_DISP_STRS];
extern byte TPscan;
void TP_Presenter (PresenterInfo *pi);
void TP_WrapText (void);
void TP_HandleCodes (void);
int TP_DrawShape (int x, int y, int shapenum, int type);
unsigned TP_VALUE (const char *str, int num_nybbles);
int32_t TP_LoadScript (const char *filename, PresenterInfo *pi, int idcache);
void TP_FreeScript (PresenterInfo *pi, int idcache);
void TP_InitScript (PresenterInfo *pi);
void TP_AnimatePage (int numanims);
int TP_BoxAroundShape (int x1, int y1, int shapenum, int shapetype);
void TP_JumpCursor (void);
void TP_Print (const char *str, bool singlechar);
bool TP_SlowPrint (const char *str, int delay);
void TP_PurgeAllGfx (void);
void TP_CachePage (const char *script);
void TP_CacheIn (int type, int chunk);
int TP_LineCommented (const char *string);
void TP_PrintPageNumber (void);
#endif