truelight@0: #ifndef GFX_H truelight@0: #define GFX_H truelight@0: truelight@0: truelight@0: typedef struct ColorList { truelight@0: byte unk0, unk1, unk2; truelight@0: byte window_color_1a, window_color_1b; truelight@0: byte window_color_bga, window_color_bgb; truelight@0: byte window_color_2; truelight@0: } ColorList; truelight@0: truelight@0: struct DrawPixelInfo { truelight@0: byte *dst_ptr; truelight@0: int left, top, width, height; truelight@0: int pitch; truelight@193: uint16 zoom; truelight@0: }; truelight@0: truelight@0: truelight@0: typedef struct SpriteHdr { truelight@0: byte info; truelight@0: byte height; truelight@0: uint16 width; truelight@0: int16 x_offs, y_offs; truelight@0: } SpriteHdr; truelight@0: assert_compile(sizeof(SpriteHdr) == 8); truelight@0: truelight@0: typedef struct CursorVars { truelight@0: Point pos, size, offs, delta; truelight@0: Point draw_pos, draw_size; truelight@0: uint32 sprite; truelight@0: truelight@0: int wheel; // mouse wheel movement truelight@0: const uint16 *animate_list, *animate_cur; truelight@0: uint animate_timeout; truelight@0: truelight@0: bool visible; truelight@0: bool dirty; truelight@0: bool fix_at; truelight@0: } CursorVars; truelight@0: truelight@0: truelight@0: void RedrawScreenRect(int left, int top, int right, int bottom); truelight@0: void GfxScroll(int left, int top, int width, int height, int xo, int yo); truelight@543: int DrawStringCentered(int x, int y, uint16 str, uint16 color); truelight@543: int DrawString(int x, int y, uint16 str, uint16 color); truelight@543: void DrawStringCenterUnderline(int x, int y, uint16 str, uint16 color); tron@1323: int DoDrawString(const char *string, int x, int y, uint16 color); truelight@543: void DrawStringRightAligned(int x, int y, uint16 str, uint16 color); truelight@193: void GfxFillRect(int left, int top, int right, int bottom, int color); truelight@193: void GfxDrawLine(int left, int top, int right, int bottom, int color); truelight@0: void DrawFrameRect(int left, int top, int right, int bottom, int color, int flags); truelight@543: uint16 GetDrawStringPlayerColor(byte player); truelight@0: tron@1323: int GetStringWidth(const char *str); tron@1093: void LoadStringWidthTable(void); truelight@0: void DrawStringMultiCenter(int x, int y, uint16 str, int maxw); truelight@0: void DrawStringMultiLine(int x, int y, uint16 str, int maxw); tron@1093: void DrawDirtyBlocks(void); truelight@0: void SetDirtyBlocks(int left, int top, int right, int bottom); tron@1093: void MarkWholeScreenDirty(void); truelight@0: tron@1093: void GfxInitPalettes(void); truelight@0: truelight@0: bool FillDrawPixelInfo(DrawPixelInfo *n, DrawPixelInfo *o, int left, int top, int width, int height); truelight@0: truelight@0: /* window.c */ truelight@0: void DrawOverlappedWindowForAll(int left, int top, int right, int bottom); truelight@0: truelight@0: /* spritecache.c */ truelight@0: byte *GetSpritePtr(uint sprite); truelight@0: void GfxInitSpriteMem(byte *ptr, uint32 size); tron@1093: void GfxLoadSprites(void); truelight@0: truelight@0: void SetMouseCursor(uint cursor); truelight@0: void SetAnimatedMouseCursor(const uint16 *table); tron@1093: void CursorTick(void); tron@1093: void DrawMouseCursor(void); tron@1093: void ScreenSizeChanged(void); tron@1093: void UndrawMouseCursor(void); truelight@0: bool ChangeResInGame(int w, int h); darkvater@298: void ToggleFullScreen(const bool full_screen); truelight@0: truelight@0: typedef struct { truelight@0: int xoffs, yoffs; truelight@0: int xsize, ysize; truelight@0: } SpriteDimension; truelight@0: truelight@0: const SpriteDimension *GetSpriteDimension(uint sprite); truelight@0: truelight@0: /* gfx.c */ truelight@0: VARDEF int _stringwidth_base; truelight@0: VARDEF byte _stringwidth_table[0x2A0]; truelight@0: truelight@0: VARDEF DrawPixelInfo _screen; truelight@0: VARDEF DrawPixelInfo *_cur_dpi; truelight@0: VARDEF ColorList _color_list[16]; truelight@0: VARDEF CursorVars _cursor; truelight@0: truelight@0: VARDEF int _pal_first_dirty; truelight@0: VARDEF int _pal_last_dirty; truelight@0: dominik@614: VARDEF bool _use_dos_palette; dominik@614: truelight@0: /* spritecache.c */ truelight@0: //enum { NUM_SPRITES = 0x1320 }; truelight@0: //enum { NUM_SPRITES = 0x1500 }; truelight@0: enum { NUM_SPRITES = 0x3500 }; // 1500 + space for custom GRF sets truelight@0: truelight@0: /* tables.h */ truelight@0: extern byte _palettes[4][256 * 3]; truelight@0: VARDEF byte _cur_palette[768]; truelight@0: dominik@657: dominik@657: typedef enum StringColorFlags { dominik@657: IS_PALETTE_COLOR = 0x100, // color value is already a real palette color index, not an index of a StringColor dominik@657: } StringColorFlags; dominik@657: truelight@0: #endif