Crossfire Client, Branches  R11627
mapdata.h
Go to the documentation of this file.
1 /* $Id: mapdata.h 6673 2007-06-18 18:24:11Z ryo_saeba $ */
2 /*
3  Crossfire client, a client program for the crossfire program.
4 
5  Copyright (C) 2005 Mark Wedel & Crossfire Development Team
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21  The author can be reached via e-mail to crossfire-devel@real-time.com
22 */
23 
24 #ifndef MAP_H
25 #define MAP_H
26 
27 #include "client-types.h"
28 
29 
32 #define MAXLAYERS 10
33 
37 #define MAX_VIEW 64
38 
39 /* Map1 only used 3 layers. Trying to use 10 seems to cause
40  * problems for that code.
41  */
42 #define MAP1_LAYERS 3
43 
44 struct MapCellLayer {
48 
49  /* Link into animation information.
50  * animation is provided to us from the server in the map2 command.
51  * animation_speed is also provided.
52  * animation_left is how many ticks until animation changes - generated
53  * by client.
54  * animation_phase is current phase.
55  */
60 };
61 
75 struct MapCell
76 {
80  uint8 darkness; /* darkness: 0=fully illuminated, 255=pitch blank */
81  uint8 need_update:1; /* set if tile should be redrawn */
82  uint8 have_darkness:1; /* set if darkness information was set */
83  uint8 need_resmooth:1; /* same has need update but for smoothing only */
84  uint8 cleared:1; /* If set, this is a fog cell. */
85 };
86 
87 struct Map
88 {
89  /* Store size of map so we know if map_size has changed
90  * since the last time we allocated this;
91  */
92  int x;
93  int y;
94 
95  struct MapCell **cells;
96 };
97 
98 
99 extern struct Map the_map;
100 
101 
106 void mapdata_init(void);
107 
111 void mapdata_reset(void);
112 
117 void mapdata_set_size(int viewx, int viewy);
118 
123 void mapdata_scroll(int dx, int dy);
124 
129 void mapdata_newmap(void);
130 
135 int mapdata_is_inside(int x, int y);
136 
141 sint16 mapdata_face(int x, int y, int layer);
142 
155 sint16 mapdata_bigface(int x, int y, int layer, int *ww, int *hh);
156 
157 #endif
signed short sint16
Definition: client-types.h:80
int y
Definition: mapdata.h:93
void mapdata_reset(void)
Definition: mapdata.c:572
uint8 animation_left
Definition: mapdata.h:58
struct MapCellLayer tails[MAXLAYERS]
Definition: mapdata.h:78
void mapdata_newmap(void)
Definition: mapdata.c:935
uint8 have_darkness
Definition: mapdata.h:82
uint8 need_update
Definition: mapdata.h:81
sint16 face
Definition: mapdata.h:45
void mapdata_scroll(int dx, int dy)
Definition: mapdata.c:859
sint8 size_x
Definition: mapdata.h:46
Definition: mapdata.h:87
uint8 darkness
Definition: mapdata.h:80
sint16 mapdata_bigface(int x, int y, int layer, int *ww, int *hh)
Definition: mapdata.c:966
void mapdata_init(void)
Definition: mapdata.c:514
uint8 cleared
Definition: mapdata.h:84
struct MapCell ** cells
Definition: mapdata.h:95
int x
Definition: mapdata.h:92
struct Map the_map
Definition: mapdata.c:121
unsigned short uint16
Definition: client-types.h:79
sint16 animation
Definition: mapdata.h:56
uint8 animation_speed
Definition: mapdata.h:57
void mapdata_set_size(int viewx, int viewy)
Definition: mapdata.c:577
uint8 need_resmooth
Definition: mapdata.h:83
#define MAXLAYERS
Definition: mapdata.h:32
uint16 smooth[MAXLAYERS]
Definition: mapdata.h:79
signed char sint8
Definition: client-types.h:82
sint16 mapdata_face(int x, int y, int layer)
Definition: mapdata.c:955
int mapdata_is_inside(int x, int y)
Definition: mapdata.c:587
unsigned char uint8
Definition: client-types.h:81
struct MapCellLayer heads[MAXLAYERS]
Definition: mapdata.h:77
sint8 size_y
Definition: mapdata.h:47
uint8 animation_phase
Definition: mapdata.h:59