Crossfire Client, Branch  R11627
mapdata.h
Go to the documentation of this file.
00001 /* $Id: mapdata.h 6673 2007-06-18 18:24:11Z ryo_saeba $ */
00002 /*
00003     Crossfire client, a client program for the crossfire program.
00004 
00005     Copyright (C) 2005 Mark Wedel & Crossfire Development Team
00006 
00007     This program is free software; you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation; either version 2 of the License, or
00010     (at your option) any later version.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program; if not, write to the Free Software
00019     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020 
00021     The author can be reached via e-mail to crossfire-devel@real-time.com
00022 */
00023 
00024 #ifndef MAP_H
00025 #define MAP_H
00026 
00027 #include "client-types.h"
00028 
00029 
00032 #define MAXLAYERS 10
00033 
00037 #define MAX_VIEW 64
00038 
00039 /* Map1 only used 3 layers.  Trying to use 10 seems to cause
00040  * problems for that code.
00041  */
00042 #define MAP1_LAYERS 3
00043 
00044 struct MapCellLayer {
00045     sint16 face;
00046     sint8 size_x;
00047     sint8 size_y;
00048 
00049     /* Link into animation information.
00050      * animation is provided to us from the server in the map2 command.
00051      * animation_speed is also provided.
00052      * animation_left is how many ticks until animation changes - generated
00053      *  by client.
00054      * animation_phase is current phase.
00055      */
00056     sint16  animation;
00057     uint8   animation_speed;
00058     uint8   animation_left;
00059     uint8   animation_phase;
00060 };
00061 
00075 struct MapCell
00076 {
00077     struct MapCellLayer heads[MAXLAYERS];
00078     struct MapCellLayer tails[MAXLAYERS];
00079     uint16 smooth[MAXLAYERS];
00080     uint8 darkness;         /* darkness: 0=fully illuminated, 255=pitch blank */
00081     uint8 need_update:1;    /* set if tile should be redrawn */
00082     uint8 have_darkness:1;  /* set if darkness information was set */
00083     uint8 need_resmooth:1;  /* same has need update but for smoothing only */
00084     uint8 cleared:1;        /* If set, this is a fog cell. */
00085 };
00086 
00087 struct Map
00088 {
00089     /* Store size of map so we know if map_size has changed
00090      * since the last time we allocated this;
00091      */
00092     int x;
00093     int y;
00094 
00095     struct MapCell **cells;
00096 };
00097 
00098 
00099 extern struct Map the_map;
00100 
00101 
00106 void mapdata_init(void);
00107 
00111 void mapdata_reset(void);
00112 
00117 void mapdata_set_size(int viewx, int viewy);
00118 
00123 void mapdata_scroll(int dx, int dy);
00124 
00129 void mapdata_newmap(void);
00130 
00135 int mapdata_is_inside(int x, int y);
00136 
00141 sint16 mapdata_face(int x, int y, int layer);
00142 
00155 sint16 mapdata_bigface(int x, int y, int layer, int *ww, int *hh);
00156 
00157 #endif