0
|
1 |
#ifndef GFX_H
|
|
2 |
#define GFX_H
|
|
3 |
|
|
4 |
|
|
5 |
typedef struct ColorList {
|
|
6 |
byte unk0, unk1, unk2;
|
|
7 |
byte window_color_1a, window_color_1b;
|
|
8 |
byte window_color_bga, window_color_bgb;
|
|
9 |
byte window_color_2;
|
|
10 |
} ColorList;
|
|
11 |
|
|
12 |
struct DrawPixelInfo {
|
|
13 |
byte *dst_ptr;
|
|
14 |
int left, top, width, height;
|
|
15 |
int pitch;
|
|
16 |
uint16 zoom;
|
|
17 |
};
|
|
18 |
|
|
19 |
|
|
20 |
typedef struct SpriteHdr {
|
|
21 |
byte info;
|
|
22 |
byte height;
|
|
23 |
uint16 width;
|
|
24 |
int16 x_offs, y_offs;
|
|
25 |
} SpriteHdr;
|
|
26 |
assert_compile(sizeof(SpriteHdr) == 8);
|
|
27 |
|
|
28 |
typedef struct CursorVars {
|
|
29 |
Point pos, size, offs, delta;
|
|
30 |
Point draw_pos, draw_size;
|
|
31 |
uint32 sprite;
|
|
32 |
|
|
33 |
int wheel; // mouse wheel movement
|
|
34 |
const uint16 *animate_list, *animate_cur;
|
|
35 |
uint animate_timeout;
|
|
36 |
|
|
37 |
bool visible;
|
|
38 |
bool dirty;
|
|
39 |
bool fix_at;
|
|
40 |
} CursorVars;
|
|
41 |
|
|
42 |
|
|
43 |
void RedrawScreenRect(int left, int top, int right, int bottom);
|
|
44 |
void GfxScroll(int left, int top, int width, int height, int xo, int yo);
|
|
45 |
int DrawStringCentered(int x, int y, uint16 str, byte color);
|
|
46 |
int DrawString(int x, int y, uint16 str, byte color);
|
|
47 |
void DrawStringCenterUnderline(int x, int y, uint16 str, byte color);
|
|
48 |
int DoDrawString(const byte *string, int x, int y, byte color);
|
|
49 |
void DrawStringRightAligned(int x, int y, uint16 str, byte color);
|
|
50 |
void GfxFillRect(int left, int top, int right, int bottom, int color);
|
|
51 |
void GfxDrawLine(int left, int top, int right, int bottom, int color);
|
|
52 |
void DrawFrameRect(int left, int top, int right, int bottom, int color, int flags);
|
|
53 |
|
|
54 |
int GetStringWidth(const byte *str);
|
|
55 |
void LoadStringWidthTable();
|
|
56 |
void DrawStringMultiCenter(int x, int y, uint16 str, int maxw);
|
|
57 |
void DrawStringMultiLine(int x, int y, uint16 str, int maxw);
|
|
58 |
void DrawDirtyBlocks();
|
|
59 |
void SetDirtyBlocks(int left, int top, int right, int bottom);
|
|
60 |
void MarkWholeScreenDirty();
|
|
61 |
|
|
62 |
void GfxInitPalettes();
|
|
63 |
|
|
64 |
bool FillDrawPixelInfo(DrawPixelInfo *n, DrawPixelInfo *o, int left, int top, int width, int height);
|
|
65 |
|
|
66 |
/* window.c */
|
|
67 |
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom);
|
|
68 |
|
|
69 |
/* spritecache.c */
|
|
70 |
byte *GetSpritePtr(uint sprite);
|
|
71 |
void GfxInitSpriteMem(byte *ptr, uint32 size);
|
|
72 |
void GfxLoadSprites();
|
|
73 |
|
|
74 |
void SetMouseCursor(uint cursor);
|
|
75 |
void SetAnimatedMouseCursor(const uint16 *table);
|
|
76 |
void CursorTick();
|
|
77 |
void DrawMouseCursor();
|
|
78 |
void ScreenSizeChanged();
|
|
79 |
void UndrawMouseCursor();
|
|
80 |
bool ChangeResInGame(int w, int h);
|
|
81 |
|
|
82 |
typedef struct {
|
|
83 |
int xoffs, yoffs;
|
|
84 |
int xsize, ysize;
|
|
85 |
} SpriteDimension;
|
|
86 |
|
|
87 |
const SpriteDimension *GetSpriteDimension(uint sprite);
|
|
88 |
|
|
89 |
/* gfx.c */
|
|
90 |
VARDEF int _stringwidth_base;
|
|
91 |
VARDEF byte _stringwidth_table[0x2A0];
|
|
92 |
|
|
93 |
VARDEF DrawPixelInfo _screen;
|
|
94 |
VARDEF DrawPixelInfo *_cur_dpi;
|
|
95 |
VARDEF ColorList _color_list[16];
|
|
96 |
VARDEF CursorVars _cursor;
|
|
97 |
|
|
98 |
VARDEF int _pal_first_dirty;
|
|
99 |
VARDEF int _pal_last_dirty;
|
|
100 |
|
|
101 |
/* spritecache.c */
|
|
102 |
//enum { NUM_SPRITES = 0x1320 };
|
|
103 |
//enum { NUM_SPRITES = 0x1500 };
|
|
104 |
enum { NUM_SPRITES = 0x3500 }; // 1500 + space for custom GRF sets
|
|
105 |
|
|
106 |
/* tables.h */
|
|
107 |
extern byte _palettes[4][256 * 3];
|
|
108 |
VARDEF byte _cur_palette[768];
|
|
109 |
|
|
110 |
#endif
|