Atrinik Client  4.0
sprite.h
Go to the documentation of this file.
1 /*************************************************************************
2  * Atrinik, a Multiplayer Online Role Playing Game *
3  * *
4  * Copyright (C) 2009-2014 Alex Tokar and Atrinik Development Team *
5  * *
6  * Fork from Crossfire (Multiplayer game for X-windows). *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the Free Software *
20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
21  * *
22  * The author can be reached at admin@atrinik.org *
23  ************************************************************************/
24 
30 #ifndef SPRITE_H
31 #define SPRITE_H
32 
33 #define SPRITE_CACHE_GC_MAX_TIME 100000
34 #define SPRITE_CACHE_GC_CHANCE 500
35 #define SPRITE_CACHE_GC_FREE_TIME 60 * 15
36 
40 #define SPRITE_GLOW_SIZE 2
41 
45 typedef struct sprite_effects {
46  uint32_t flags;
47  uint8_t dark_level;
48  uint8_t alpha;
49  uint32_t stretch;
50  int16_t zoom_x;
51  int16_t zoom_y;
52  int16_t rotate;
53  char glow[COLOR_BUF];
54  uint8_t glow_speed;
55  uint8_t glow_state;
57 
58 #define SPRITE_EFFECTS_NEED_RENDERING(_effects) \
59  ((_effects)->flags != 0 || (_effects)->alpha != 0 || \
60  (_effects)->stretch != 0 || ((_effects)->zoom_x != 0 && \
61  (_effects)->zoom_x != 100) || ((_effects)->zoom_y != 0 && \
62  (_effects)->zoom_y != 100) || (_effects)->rotate != 0 || \
63  (_effects)->glow[0] != '\0')
64 
70 #define SPRITE_FLAG_DARK 0
71 
72 #define SPRITE_FLAG_FOW 1
73 
74 #define SPRITE_FLAG_RED 2
75 
76 #define SPRITE_FLAG_GRAY 3
77 
78 #define SPRITE_FLAG_EFFECTS 4
79 
82 typedef struct sprite_struct {
84  int border_up;
85 
88 
91 
94 
96  SDL_Surface *bitmap;
98 
99 #define BORDER_CREATE_TOP(_surface, _x, _y, _w, _h, _color, _thickness) \
100  border_create_line((_surface), (_x), (_y), (_w), (_thickness), (_color))
101 #define BORDER_CREATE_BOTTOM(_surface, _x, _y, _w, _h, _color, _thickness)\
102  border_create_line((_surface), (_x), (_y) + (_h) - (_thickness), (_w), \
103  (_thickness), (_color))
104 #define BORDER_CREATE_LEFT(_surface, _x, _y, _w, _h, _color, _thickness) \
105  border_create_line((_surface), (_x), (_y), (_thickness), (_h), (_color))
106 #define BORDER_CREATE_RIGHT(_surface, _x, _y, _w, _h, _color, _thickness) \
107  border_create_line((_surface), (_x) + (_w) - (_thickness), (_y),\
108  (_thickness), (_h), (_color))
109 
110 #endif
uint8_t alpha
Alpha value.
Definition: sprite.h:48
SDL_Surface * bitmap
Definition: sprite.h:96
int16_t rotate
Rotate value.
Definition: sprite.h:52
int16_t zoom_x
Horizontal zoom.
Definition: sprite.h:50
uint32_t flags
Bit combination of Sprite drawing flags.
Definition: sprite.h:46
int border_left
Definition: sprite.h:90
int border_down
Definition: sprite.h:87
uint32_t stretch
Tile stretching value.
Definition: sprite.h:49
int border_right
Definition: sprite.h:93
int border_up
Definition: sprite.h:84
uint8_t dark_level
Dark level.
Definition: sprite.h:47
struct sprite_effects sprite_effects_t
struct sprite_struct sprite_struct
int16_t zoom_y
Vertical zoom.
Definition: sprite.h:51