equal
deleted
inserted
replaced
35 bool _right_button_clicked; |
35 bool _right_button_clicked; |
36 DrawPixelInfo _screen; |
36 DrawPixelInfo _screen; |
37 bool _exit_game; |
37 bool _exit_game; |
38 bool _networking; ///< are we in networking mode? |
38 bool _networking; ///< are we in networking mode? |
39 byte _game_mode; |
39 byte _game_mode; |
40 byte _pause; |
40 byte _pause_game; |
41 int _pal_first_dirty; |
41 int _pal_first_dirty; |
42 int _pal_last_dirty; |
42 int _pal_last_dirty; |
43 |
43 |
44 Colour _cur_palette[256]; |
44 Colour _cur_palette[256]; |
45 byte _stringwidth_table[FS_END][224]; |
45 byte _stringwidth_table[FS_END][224]; |
46 |
46 |
47 typedef enum BlitterModes { |
47 enum BlitterMode { |
48 BM_NORMAL, |
48 BM_NORMAL, |
49 BM_COLOUR_REMAP, |
49 BM_COLOUR_REMAP, |
50 BM_TRANSPARENT, |
50 BM_TRANSPARENT, |
51 } BlitterMode; |
51 }; |
52 |
52 |
53 static void GfxMainBlitter(const Sprite *sprite, int x, int y, BlitterMode mode); |
53 static void GfxMainBlitter(const Sprite *sprite, int x, int y, BlitterMode mode); |
54 |
54 |
55 FontSize _cur_fontsize; |
55 FontSize _cur_fontsize; |
56 static FontSize _last_fontsize; |
56 static FontSize _last_fontsize; |
716 } else { |
716 } else { |
717 GfxMainBlitter(GetSprite(GB(img, 0, SPRITE_WIDTH)), x, y, BM_NORMAL); |
717 GfxMainBlitter(GetSprite(GB(img, 0, SPRITE_WIDTH)), x, y, BM_NORMAL); |
718 } |
718 } |
719 } |
719 } |
720 |
720 |
721 typedef struct BlitterParams { |
721 struct BlitterParams { |
722 int start_x, start_y; |
722 int start_x, start_y; |
723 const byte *sprite; |
723 const byte *sprite; |
724 Pixel *dst; |
724 Pixel *dst; |
725 BlitterMode mode; |
725 BlitterMode mode; |
726 int width, height; |
726 int width, height; |
727 int width_org; |
727 int width_org; |
728 int pitch; |
728 int pitch; |
729 } BlitterParams; |
729 }; |
730 |
730 |
731 static void GfxBlitTileZoomIn(BlitterParams *bp) |
731 static void GfxBlitTileZoomIn(BlitterParams *bp) |
732 { |
732 { |
733 const byte *src_o = bp->sprite; |
733 const byte *src_o = bp->sprite; |
734 const byte *src; |
734 const byte *src; |
1522 case 2: GfxBlitZoomOutUncomp(&bp); break; |
1522 case 2: GfxBlitZoomOutUncomp(&bp); break; |
1523 } |
1523 } |
1524 } |
1524 } |
1525 } |
1525 } |
1526 |
1526 |
1527 void DoPaletteAnimations(void); |
1527 void DoPaletteAnimations(); |
1528 |
1528 |
1529 void GfxInitPalettes(void) |
1529 void GfxInitPalettes() |
1530 { |
1530 { |
1531 memcpy(_cur_palette, _palettes[_use_dos_palette ? 1 : 0], sizeof(_cur_palette)); |
1531 memcpy(_cur_palette, _palettes[_use_dos_palette ? 1 : 0], sizeof(_cur_palette)); |
1532 |
1532 |
1533 _pal_first_dirty = 0; |
1533 _pal_first_dirty = 0; |
1534 _pal_last_dirty = 255; |
1534 _pal_last_dirty = 255; |
1536 } |
1536 } |
1537 |
1537 |
1538 #define EXTR(p, q) (((uint16)(_timer_counter * (p)) * (q)) >> 16) |
1538 #define EXTR(p, q) (((uint16)(_timer_counter * (p)) * (q)) >> 16) |
1539 #define EXTR2(p, q) (((uint16)(~_timer_counter * (p)) * (q)) >> 16) |
1539 #define EXTR2(p, q) (((uint16)(~_timer_counter * (p)) * (q)) >> 16) |
1540 |
1540 |
1541 void DoPaletteAnimations(void) |
1541 void DoPaletteAnimations() |
1542 { |
1542 { |
1543 const Colour *s; |
1543 const Colour *s; |
1544 Colour *d; |
1544 Colour *d; |
1545 /* Amount of colors to be rotated. |
1545 /* Amount of colors to be rotated. |
1546 * A few more for the DOS palette, because the water colors are |
1546 * A few more for the DOS palette, because the water colors are |
1647 if (_pal_last_dirty < 217 + c) _pal_last_dirty = 217 + c; |
1647 if (_pal_last_dirty < 217 + c) _pal_last_dirty = 217 + c; |
1648 } |
1648 } |
1649 } |
1649 } |
1650 |
1650 |
1651 |
1651 |
1652 void LoadStringWidthTable(void) |
1652 void LoadStringWidthTable() |
1653 { |
1653 { |
1654 uint i; |
1654 uint i; |
1655 |
1655 |
1656 /* Normal font */ |
1656 /* Normal font */ |
1657 for (i = 0; i != 224; i++) { |
1657 for (i = 0; i != 224; i++) { |
1676 |
1676 |
1677 return GetGlyphWidth(size, key); |
1677 return GetGlyphWidth(size, key); |
1678 } |
1678 } |
1679 |
1679 |
1680 |
1680 |
1681 void ScreenSizeChanged(void) |
1681 void ScreenSizeChanged() |
1682 { |
1682 { |
1683 /* check the dirty rect */ |
1683 /* check the dirty rect */ |
1684 if (_invalid_rect.right >= _screen.width) _invalid_rect.right = _screen.width; |
1684 if (_invalid_rect.right >= _screen.width) _invalid_rect.right = _screen.width; |
1685 if (_invalid_rect.bottom >= _screen.height) _invalid_rect.bottom = _screen.height; |
1685 if (_invalid_rect.bottom >= _screen.height) _invalid_rect.bottom = _screen.height; |
1686 |
1686 |
1687 /* screen size changed and the old bitmap is invalid now, so we don't want to undraw it */ |
1687 /* screen size changed and the old bitmap is invalid now, so we don't want to undraw it */ |
1688 _cursor.visible = false; |
1688 _cursor.visible = false; |
1689 } |
1689 } |
1690 |
1690 |
1691 void UndrawMouseCursor(void) |
1691 void UndrawMouseCursor() |
1692 { |
1692 { |
1693 if (_cursor.visible) { |
1693 if (_cursor.visible) { |
1694 _cursor.visible = false; |
1694 _cursor.visible = false; |
1695 memcpy_pitch( |
1695 memcpy_pitch( |
1696 _screen.dst_ptr + _cursor.draw_pos.x + _cursor.draw_pos.y * _screen.pitch, |
1696 _screen.dst_ptr + _cursor.draw_pos.x + _cursor.draw_pos.y * _screen.pitch, |
1699 |
1699 |
1700 _video_driver->make_dirty(_cursor.draw_pos.x, _cursor.draw_pos.y, _cursor.draw_size.x, _cursor.draw_size.y); |
1700 _video_driver->make_dirty(_cursor.draw_pos.x, _cursor.draw_pos.y, _cursor.draw_size.x, _cursor.draw_size.y); |
1701 } |
1701 } |
1702 } |
1702 } |
1703 |
1703 |
1704 void DrawMouseCursor(void) |
1704 void DrawMouseCursor() |
1705 { |
1705 { |
1706 int x; |
1706 int x; |
1707 int y; |
1707 int y; |
1708 int w; |
1708 int w; |
1709 int h; |
1709 int h; |
1792 DrawOverlappedWindowForAll(left, top, right, bottom); |
1792 DrawOverlappedWindowForAll(left, top, right, bottom); |
1793 |
1793 |
1794 _video_driver->make_dirty(left, top, right - left, bottom - top); |
1794 _video_driver->make_dirty(left, top, right - left, bottom - top); |
1795 } |
1795 } |
1796 |
1796 |
1797 void DrawDirtyBlocks(void) |
1797 void DrawDirtyBlocks() |
1798 { |
1798 { |
1799 byte *b = _dirty_blocks; |
1799 byte *b = _dirty_blocks; |
1800 const int w = ALIGN(_screen.width, 64); |
1800 const int w = ALIGN(_screen.width, 64); |
1801 const int h = ALIGN(_screen.height, 8); |
1801 const int h = ALIGN(_screen.height, 8); |
1802 int x; |
1802 int x; |
1914 |
1914 |
1915 b += DIRTY_BYTES_PER_LINE; |
1915 b += DIRTY_BYTES_PER_LINE; |
1916 } while (--height != 0); |
1916 } while (--height != 0); |
1917 } |
1917 } |
1918 |
1918 |
1919 void MarkWholeScreenDirty(void) |
1919 void MarkWholeScreenDirty() |
1920 { |
1920 { |
1921 SetDirtyBlocks(0, 0, _screen.width, _screen.height); |
1921 SetDirtyBlocks(0, 0, _screen.width, _screen.height); |
1922 } |
1922 } |
1923 |
1923 |
1924 /** Set up a clipping area for only drawing into a certain area. To do this, |
1924 /** Set up a clipping area for only drawing into a certain area. To do this, |
1993 cv->offs.y = p->y_offs; |
1993 cv->offs.y = p->y_offs; |
1994 |
1994 |
1995 cv->dirty = true; |
1995 cv->dirty = true; |
1996 } |
1996 } |
1997 |
1997 |
1998 static void SwitchAnimatedCursor(void) |
1998 static void SwitchAnimatedCursor() |
1999 { |
1999 { |
2000 const AnimCursor *cur = _cursor.animate_cur; |
2000 const AnimCursor *cur = _cursor.animate_cur; |
2001 |
2001 |
2002 if (cur == NULL || cur->sprite == AnimCursor::LAST) cur = _cursor.animate_list; |
2002 if (cur == NULL || cur->sprite == AnimCursor::LAST) cur = _cursor.animate_list; |
2003 |
2003 |
2005 |
2005 |
2006 _cursor.animate_timeout = cur->display_time; |
2006 _cursor.animate_timeout = cur->display_time; |
2007 _cursor.animate_cur = cur + 1; |
2007 _cursor.animate_cur = cur + 1; |
2008 } |
2008 } |
2009 |
2009 |
2010 void CursorTick(void) |
2010 void CursorTick() |
2011 { |
2011 { |
2012 if (_cursor.animate_timeout != 0 && --_cursor.animate_timeout == 0) |
2012 if (_cursor.animate_timeout != 0 && --_cursor.animate_timeout == 0) |
2013 SwitchAnimatedCursor(); |
2013 SwitchAnimatedCursor(); |
2014 } |
2014 } |
2015 |
2015 |