src/viewport.cpp
changeset 6574 e1d1a12faaf7
parent 6573 7624f942237f
child 6718 5a8b295aa345
child 6919 339210ecccd3
child 9574 698395509d12
equal deleted inserted replaced
6573:7624f942237f 6574:e1d1a12faaf7
    45  *           /                 \                 *
    45  *           /                 \                 *
    46  *        /                       \              *
    46  *        /                       \              *
    47  *   X <                             > Y         *
    47  *   X <                             > Y         *
    48  */
    48  */
    49 
    49 
    50 typedef struct StringSpriteToDraw {
    50 struct StringSpriteToDraw {
    51 	uint16 string;
    51 	uint16 string;
    52 	uint16 color;
    52 	uint16 color;
    53 	struct StringSpriteToDraw *next;
    53 	StringSpriteToDraw *next;
    54 	int32 x;
    54 	int32 x;
    55 	int32 y;
    55 	int32 y;
    56 	uint32 params[2];
    56 	uint32 params[2];
    57 	uint16 width;
    57 	uint16 width;
    58 } StringSpriteToDraw;
    58 };
    59 
    59 
    60 typedef struct TileSpriteToDraw {
    60 struct TileSpriteToDraw {
    61 	SpriteID image;
    61 	SpriteID image;
    62 	SpriteID pal;
    62 	SpriteID pal;
    63 	struct TileSpriteToDraw *next;
    63 	TileSpriteToDraw *next;
    64 	int32 x;
    64 	int32 x;
    65 	int32 y;
    65 	int32 y;
    66 	byte z;
    66 	byte z;
    67 } TileSpriteToDraw;
    67 };
    68 
    68 
    69 typedef struct ChildScreenSpriteToDraw {
    69 struct ChildScreenSpriteToDraw {
    70 	SpriteID image;
    70 	SpriteID image;
    71 	SpriteID pal;
    71 	SpriteID pal;
    72 	int32 x;
    72 	int32 x;
    73 	int32 y;
    73 	int32 y;
    74 	struct ChildScreenSpriteToDraw *next;
    74 	ChildScreenSpriteToDraw *next;
    75 } ChildScreenSpriteToDraw;
    75 };
    76 
    76 
    77 typedef struct ParentSpriteToDraw {
    77 struct ParentSpriteToDraw {
    78 	SpriteID image;
    78 	SpriteID image;
    79 	SpriteID pal;
    79 	SpriteID pal;
    80 	int32 left;
    80 	int32 left;
    81 	int32 top;
    81 	int32 top;
    82 	int32 right;
    82 	int32 right;
    87 	int32 ymax;
    87 	int32 ymax;
    88 	ChildScreenSpriteToDraw *child;
    88 	ChildScreenSpriteToDraw *child;
    89 	byte unk16;
    89 	byte unk16;
    90 	byte zmin;
    90 	byte zmin;
    91 	byte zmax;
    91 	byte zmax;
    92 } ParentSpriteToDraw;
    92 };
    93 
    93 
    94 // Quick hack to know how much memory to reserve when allocating from the spritelist
    94 // Quick hack to know how much memory to reserve when allocating from the spritelist
    95 // to prevent a buffer overflow.
    95 // to prevent a buffer overflow.
    96 #define LARGEST_SPRITELIST_STRUCT ParentSpriteToDraw
    96 #define LARGEST_SPRITELIST_STRUCT ParentSpriteToDraw
    97 
    97 
    98 typedef struct ViewportDrawer {
    98 struct ViewportDrawer {
    99 	DrawPixelInfo dpi;
    99 	DrawPixelInfo dpi;
   100 
   100 
   101 	byte *spritelist_mem;
   101 	byte *spritelist_mem;
   102 	const byte *eof_spritelist_mem;
   102 	const byte *eof_spritelist_mem;
   103 
   103 
   110 	ParentSpriteToDraw * const *eof_parent_list;
   110 	ParentSpriteToDraw * const *eof_parent_list;
   111 
   111 
   112 	byte combine_sprites;
   112 	byte combine_sprites;
   113 
   113 
   114 	int offs_x, offs_y; // used when drawing ground sprites relative
   114 	int offs_x, offs_y; // used when drawing ground sprites relative
   115 } ViewportDrawer;
   115 };
   116 
   116 
   117 static ViewportDrawer *_cur_vd;
   117 static ViewportDrawer *_cur_vd;
   118 
   118 
   119 TileHighlightData _thd;
   119 TileHighlightData _thd;
   120 static TileInfo *_cur_ti;
   120 static TileInfo *_cur_ti;