Atrinik Client 2.5
include/effects.h
Go to the documentation of this file.
00001 /************************************************************************
00002 *            Atrinik, a Multiplayer Online Role Playing Game            *
00003 *                                                                       *
00004 *    Copyright (C) 2009-2011 Alex Tokar and Atrinik Development Team    *
00005 *                                                                       *
00006 * Fork from Daimonin (Massive Multiplayer Online Role Playing Game)     *
00007 * and Crossfire (Multiplayer game for X-windows).                       *
00008 *                                                                       *
00009 * This program is free software; you can redistribute it and/or modify  *
00010 * it under the terms of the GNU General Public License as published by  *
00011 * the Free Software Foundation; either version 2 of the License, or     *
00012 * (at your option) any later version.                                   *
00013 *                                                                       *
00014 * This program is distributed in the hope that it will be useful,       *
00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00017 * GNU General Public License for more details.                          *
00018 *                                                                       *
00019 * You should have received a copy of the GNU General Public License     *
00020 * along with this program; if not, write to the Free Software           *
00021 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.             *
00022 *                                                                       *
00023 * The author can be reached at admin@atrinik.org                        *
00024 ************************************************************************/
00025 
00030 #ifndef EFFECTS_H
00031 #define EFFECT_H
00032 
00038 #define WIND_BLOW_NONE 0
00039 
00040 #define WIND_BLOW_LEFT 1
00041 
00042 #define WIND_BLOW_RIGHT 2
00043 
00044 #define WIND_BLOW_RANDOM 3
00045 
00048 typedef struct effect_struct
00049 {
00051     struct effect_struct *next;
00052 
00054     char name[MAX_BUF];
00055 
00059     double wind_chance;
00060 
00064     double sprite_chance;
00065 
00067     struct effect_sprite *sprites;
00068 
00070     struct effect_sprite *sprites_end;
00071 
00073     struct effect_sprite_def *sprite_defs;
00074 
00076     int chance_total;
00077 
00079     long wind;
00080 
00082     uint8 wind_blow_dir;
00083 
00087     uint32 delay;
00088 
00090     uint32 delay_ticks;
00091 
00093     int max_sprites;
00094 
00096     double wind_mod;
00097 
00099     int sprites_per_move;
00100 
00102     struct effect_overlay *overlay;
00103 } effect_struct;
00104 
00106 typedef struct effect_sprite
00107 {
00109     struct effect_sprite *next;
00110 
00112     struct effect_sprite *prev;
00113 
00115     int x;
00116 
00118     int y;
00119 
00121     uint32 delay_ticks;
00122 
00124     uint32 created_tick;
00125 
00127     struct effect_sprite_def *def;
00128 } effect_sprite;
00129 
00131 typedef struct effect_sprite_def
00132 {
00134     struct effect_sprite_def *next;
00135 
00137     int id;
00138 
00140     char *name;
00141 
00145     double weight;
00146 
00148     double weight_mod;
00149 
00154     int chance;
00155 
00157     uint32 delay;
00158 
00160     uint8 wind;
00161 
00165     double wiggle;
00166 
00170     double wind_mod;
00171 
00173     int x;
00174 
00176     int y;
00177 
00179     int xpos;
00180 
00182     int ypos;
00183 
00185     uint8 reverse;
00186 
00190     double y_rndm;
00191 
00193     double x_mod;
00194 
00196     double y_mod;
00197 
00201     uint8 x_check_mod;
00202 
00206     uint8 y_check_mod;
00207 
00211     uint8 kill_side_left;
00212 
00216     uint8 kill_side_right;
00217 
00221     uint16 zoom;
00222 
00225     uint8 warp_sides;
00226 
00228     uint32 ttl;
00229 
00233     char sound_file[MAX_BUF];
00234 
00236     uint8 sound_volume;
00237 } effect_sprite_def;
00238 
00240 typedef struct effect_overlay_col
00241 {
00243     sint16 val;
00244 
00246     double mod[5];
00247 
00249     uint8 rndm_min;
00250 
00252     uint8 rndm_max;
00253 } effect_overlay_col;
00254 
00257 typedef struct effect_overlay
00258 {
00260     effect_overlay_col col[4];
00261 } effect_overlay;
00262 
00264 #define EFFECT_SCALE_ADJUST(i, overlay) \
00265     (i) = (overlay)->col[idx].val == -1 ? vals[idx] : (overlay)->col[idx].val; \
00266     (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]); \
00267     \
00268     if ((overlay)->col[idx].rndm_max != 0) \
00269     { \
00270         (i) += rndm((overlay)->col[idx].rndm_min, (overlay)->col[idx].rndm_max); \
00271     } \
00272     \
00273     (i) = MAX(0, MIN(255, (i))); \
00274     idx++;
00275 
00276 #endif