summaryrefslogtreecommitdiff
path: root/apps/plugins/xrick/maps.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/xrick/maps.h')
-rw-r--r--apps/plugins/xrick/maps.h159
1 files changed, 159 insertions, 0 deletions
diff --git a/apps/plugins/xrick/maps.h b/apps/plugins/xrick/maps.h
new file mode 100644
index 0000000000..716c6589ad
--- /dev/null
+++ b/apps/plugins/xrick/maps.h
@@ -0,0 +1,159 @@
1/*
2 * xrick/maps.h
3 *
4 * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net).
5 * Copyright (C) 2008-2014 Pierluigi Vicinanza.
6 * All rights reserved.
7 *
8 * The use and distribution terms for this software are contained in the file
9 * named README, which can be found in the root of this distribution. By
10 * using this software in any fashion, you are agreeing to be bound by the
11 * terms of this license.
12 *
13 * You must not remove this notice, or any other, from this software.
14 */
15
16#ifndef _MAPS_H
17#define _MAPS_H
18
19#include "xrick/system/basic_types.h"
20#include "xrick/system/system.h"
21#ifdef ENABLE_SOUND
22#include "xrick/data/sounds.h"
23#endif
24
25#include <stddef.h> /* size_t */
26
27/*
28 * map row definitions, for three zones : hidden top, screen, hidden bottom
29 * the three zones compose map_map, which contains the definition of the
30 * current portion of the submap.
31 */
32#define MAP_ROW_HTTOP 0x00
33#define MAP_ROW_HTBOT 0x07
34#define MAP_ROW_SCRTOP 0x08
35#define MAP_ROW_SCRBOT 0x1F
36#define MAP_ROW_HBTOP 0x20
37#define MAP_ROW_HBBOT 0x27
38
39extern U8 map_map[0x2c][0x20];
40
41/*
42 * main maps
43 */
44typedef struct {
45 U16 x, y; /* initial position for rick */
46 U16 row; /* initial map_map top row within the submap */
47 U16 submap; /* initial submap */
48#ifdef ENABLE_SOUND
49 sound_t * tune; /* map tune */
50#endif
51} map_t;
52
53extern size_t map_nbr_maps;
54extern map_t *map_maps;
55
56/*
57 * sub maps
58 */
59typedef struct {
60 U16 page; /* tiles page */
61 U16 bnum; /* first block number */
62 U16 connect; /* first connection */
63 U16 mark; /* first entity mark */
64} submap_t;
65
66extern size_t map_nbr_submaps;
67extern submap_t *map_submaps;
68
69/*
70 * connections
71 */
72typedef struct {
73 U8 dir;
74 U8 rowout;
75 U8 submap;
76 U8 rowin;
77} connect_t;
78
79extern size_t map_nbr_connect;
80extern connect_t *map_connect;
81
82/*
83 * blocks - one block is 4 by 4 tiles.
84 */
85typedef U8 block_t[0x10];
86
87extern size_t map_nbr_blocks;
88extern block_t *map_blocks;
89
90/*
91 * flags for map_marks[].ent ("yes" when set)
92 *
93 * MAP_MARK_NACT: this mark is not active anymore.
94 */
95#define MAP_MARK_NACT (0x80)
96
97/*
98 * mark structure
99 */
100typedef struct {
101 U8 row;
102 U8 ent;
103 U8 flags;
104 U8 xy; /* bits XXXX XYYY (from b03) with X->x, Y->y */
105 U8 lt; /* bits XXXX XNNN (from b04) with X->trig_x, NNN->lat & trig_y */
106} mark_t;
107
108extern size_t map_nbr_marks;
109extern mark_t *map_marks;
110
111/*
112 * block numbers, i.e. array of rows of 8 blocks
113 */
114extern size_t map_nbr_bnums;
115extern U8 *map_bnums;
116
117/*
118 * flags for map_eflg[map_map[row][col]] ("yes" when set)
119 *
120 * MAP_EFLG_VERT: vertical move only (usually on top of _CLIMB).
121 * MAP_EFLG_SOLID: solid block, can't go through.
122 * MAP_EFLG_SPAD: super pad. can't go through, but sends entities to the sky.
123 * MAP_EFLG_WAYUP: solid block, can't go through except when going up.
124 * MAP_EFLG_FGND: foreground (hides entities).
125 * MAP_EFLG_LETHAL: lethal (kill entities).
126 * MAP_EFLG_CLIMB: entities can climb here.
127 * MAP_EFLG_01:
128 */
129#define MAP_EFLG_VERT (0x80)
130#define MAP_EFLG_SOLID (0x40)
131#define MAP_EFLG_SPAD (0x20)
132#define MAP_EFLG_WAYUP (0x10)
133#define MAP_EFLG_FGND (0x08)
134#define MAP_EFLG_LETHAL (0x04)
135#define MAP_EFLG_CLIMB (0x02)
136#define MAP_EFLG_01 (0x01)
137
138extern size_t map_nbr_eflgc;
139extern U8 *map_eflg_c; /* compressed */
140extern U8 map_eflg[0x100]; /* current */
141
142/*
143 * map_map top row within the submap
144 */
145extern U8 map_frow;
146
147/*
148 * tiles offset
149 */
150extern U8 map_tilesBank;
151
152extern void map_expand(void);
153extern void map_init(void);
154extern bool map_chain(void);
155extern void map_resetMarks(void);
156
157#endif /* ndef _MAPS_H */
158
159/* eof */