Atrinik Client  4.0
effects.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 EFFECTS_H
31 #define EFFECTS_H
32 
38 #define WIND_BLOW_NONE 0
39 
40 #define WIND_BLOW_LEFT 1
41 
42 #define WIND_BLOW_RIGHT 2
43 
44 #define WIND_BLOW_RANDOM 3
45 
48 typedef struct effect_struct {
51 
53  char name[MAX_BUF];
54 
59  double wind_chance;
60 
65  double sprite_chance;
66 
69 
72 
75 
78 
80  long wind;
81 
84  uint8_t wind_blow_dir;
85 
90  uint32_t delay;
91 
93  uint32_t delay_ticks;
94 
97 
100  double wind_mod;
101 
104 
106  char sound_effect[MAX_BUF];
107 
110 
116 
119 } effect_struct;
120 
122 typedef struct effect_sprite {
125 
128 
130  int x;
131 
133  int y;
134 
136  uint32_t delay_ticks;
137 
139  uint32_t created_tick;
140 
143 } effect_sprite;
144 
146 typedef struct effect_sprite_def {
149 
151  int id;
152 
154  char *name;
155 
160  double weight;
161 
163  double weight_mod;
164 
170  int chance;
171 
173  uint32_t delay;
174 
176  uint8_t wind;
177 
182  double wiggle;
183 
188  double wind_mod;
189 
191  int x;
192 
194  int y;
195 
197  int xpos;
198 
200  int ypos;
201 
204  uint8_t reverse;
205 
210  double y_rndm;
211 
213  double x_mod;
214 
216  double y_mod;
217 
222  uint8_t x_check_mod;
223 
228  uint8_t y_check_mod;
229 
234  uint8_t kill_side_left;
235 
241 
246  uint16_t zoom;
247 
251  uint8_t warp_sides;
252 
254  uint32_t ttl;
255 
260  char sound_file[MAX_BUF];
261 
263  uint8_t sound_volume;
265 
267 typedef struct effect_overlay_col {
269  int16_t val;
270 
272  double mod[5];
273 
275  uint8_t rndm_min;
276 
278  uint8_t rndm_max;
280 
284 typedef struct effect_overlay {
288 
290 #define EFFECT_SCALE_ADJUST(i, overlay) \
291  (i) = (overlay)->col[idx].val == -1 ? vals[idx] : (overlay)->col[idx].val; \
292  (i) += (int) (((double) vals[0] * (overlay)->col[idx].mod[0] + (double) vals[1] * (overlay)->col[idx].mod[1] + (double) vals[2] * (overlay)->col[idx].mod[2] + (double) vals[3] * (overlay)->col[idx].mod[3]) * (overlay)->col[idx].mod[4]); \
293  \
294  if ((overlay)->col[idx].rndm_max != 0) \
295  { \
296  (i) += rndm((overlay)->col[idx].rndm_min, (overlay)->col[idx].rndm_max); \
297  } \
298  \
299  (i) = MAX(0, MIN(255, (i))); \
300  idx++;
301 
302 #endif
struct effect_sprite * sprites
Definition: effects.h:68
uint8_t rndm_max
Definition: effects.h:278
uint8_t rndm_min
Definition: effects.h:275
struct effect_sprite * next
Definition: effects.h:124
char name[MAX_BUF]
Definition: effects.h:53
int sprites_per_move
Definition: effects.h:103
double wind_mod
Definition: effects.h:100
double sprite_chance
Definition: effects.h:65
struct effect_sprite_def * sprite_defs
Definition: effects.h:74
uint8_t y_check_mod
Definition: effects.h:228
double weight_mod
Definition: effects.h:163
double wind_mod
Definition: effects.h:188
uint8_t wind
Definition: effects.h:176
uint8_t kill_side_right
Definition: effects.h:240
struct effect_sprite * prev
Definition: effects.h:127
int chance_total
Definition: effects.h:77
struct effect_sprite_def * def
Definition: effects.h:142
struct effect_overlay * overlay
Definition: effects.h:118
struct effect_sprite_def * next
Definition: effects.h:148
struct effect_struct effect_struct
uint8_t reverse
Definition: effects.h:204
int sound_volume
Definition: effects.h:109
struct effect_sprite_def effect_sprite_def
struct effect_struct * next
Definition: effects.h:50
uint32_t delay
Definition: effects.h:90
uint32_t ttl
Definition: effects.h:254
char sound_file[MAX_BUF]
Definition: effects.h:260
uint8_t warp_sides
Definition: effects.h:251
uint32_t delay_ticks
Definition: effects.h:93
uint16_t zoom
Definition: effects.h:246
double mod[5]
Definition: effects.h:272
int max_sprites
Definition: effects.h:96
struct effect_sprite effect_sprite
uint32_t delay_ticks
Definition: effects.h:136
struct effect_sprite * sprites_end
Definition: effects.h:71
uint8_t wind_blow_dir
Definition: effects.h:84
uint32_t delay
Definition: effects.h:173
uint32_t created_tick
Definition: effects.h:139
struct effect_overlay_col effect_overlay_col
struct effect_overlay effect_overlay
long wind
Definition: effects.h:80
char sound_effect[MAX_BUF]
Definition: effects.h:106
uint8_t sound_volume
Definition: effects.h:263
uint8_t x_check_mod
Definition: effects.h:222
int sound_channel
Definition: effects.h:115
effect_overlay_col col[4]
Definition: effects.h:286
double wind_chance
Definition: effects.h:59
uint8_t kill_side_left
Definition: effects.h:234