summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tiles.h
blob: e2252641d0781d819da21daedd4b1bdeaf0266ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/*
 *  File:       tiles.h
 *  Created by: ennewalker on Sat Jan 5 01:33:53 2008 UTC
 *
 *  Modified for Crawl Reference by $Author: j-p-e-g $ on $Date: 2008-03-07 $
 */

#ifndef TILES_H
#define TILES_H

#ifdef USE_TILE

#include "tiledef-main.h"
#include "tiledef-dngn.h"
#include "tiledef-player.h"

#include "beam.h"

enum tag_version
{
    TILETAG_PRE_MCACHE = 71,
    TILETAG_CURRENT = 72
};

struct dolls_data
{
    dolls_data() { memset(parts, 0, sizeof(parts)); }

    int parts[TILEP_PART_MAX];
};

struct demon_data
{
    demon_data() { head = body = wings = 0; }

    int head;
    int body;
    int wings;
};

//*tile1.cc: get data from core part and drives tile drawing codes

//**convert in-game data to tile index
int tileidx(unsigned int object, int extra);
int tileidx_feature(int object, int gx, int gy);
int tileidx_player(int job);
void tileidx_unseen(unsigned int &fg, unsigned int &bg, int ch,
                    const coord_def& gc);
int tileidx_item(const item_def &item);
int tileidx_item_throw(const item_def &item, int dx, int dy);
int tileidx_bolt(const bolt &bolt);
int tileidx_zap(int colour);
int tile_idx_unseen_terrain(int x, int y, int what);
int tile_unseen_flag(const coord_def& gc);
int tileidx_monster(const monsters *mon, bool detected);

// Player tile related
void tilep_race_default(int race, int gender, int level, int *parts);
void tilep_job_default(int job, int gender, int *parts);
void tilep_calc_flags(const int parts[], int flag[]);

void tilep_part_to_str(int number, char *buf);
int  tilep_str_to_part(char *str);

void tilep_scan_parts(char *fbuf, int *parts);
void tilep_print_parts(char *fbuf, int *parts);

int tilep_equ_weapon(const item_def &item);
int tilep_equ_shield(const item_def &item);
int tilep_equ_armour(const item_def &item);
int tilep_equ_cloak(const item_def &item);
int tilep_equ_helm(const item_def &item);
int tilep_equ_gloves(const item_def &item);
int tilep_equ_boots(const item_def &item);

// Tile display related
void tile_draw_floor();
void tile_place_monster(int gx, int gy, int idx, bool foreground = true,
                        bool detected = false);
void tile_place_item(int x, int y, int idx);
void tile_place_item_bk(int gx, int gy, int idx);
void tile_place_item_marker(int x, int y, int idx);
void tile_place_cloud(int x, int y, int type, int decay);
void tile_place_ray(const coord_def& gc);
void tile_draw_rays(bool resetCount);
void tile_clear_buf();

void tile_finish_dngn(unsigned int *tileb, int cx, int cy);

// Tile Inventory display
void tile_draw_inv(int flag = -1);
// Multiple pickup
void tile_pick_menu();

int get_num_wall_flavors();
int get_num_floor_flavors();
int get_num_floor_special_flavors();
int get_wall_tile_idx();
int get_floor_tile_idx();
int get_floor_special_tile_idx();
void tile_init_flavor();

void tile_set_force_redraw_tiles(bool redraw);
void tile_set_force_redraw_inv(bool redraw);

/**************************************/
/* tile2.cc  image manipulation       */
/**************************************/
// init them all
void TileInit();

void TileResizeScreen(int x, int y);

// display tile cursor, returns old cursor value there
int TileDrawCursor(int x, int y, int flag);
// display bolts
void TileNewLevel(bool first_time);

// edit player tile
void TilePlayerEdit();

int item_unid_type(const item_def &item);

// load wall tiles
void TileLoadWall(bool wizard);

void TileDrawTitle();

int get_clean_map_idx(int tile_idx);

/* Flags for drawing routines */
enum tile_flags
{
    // Foreground flags
    TILE_FLAG_S_UNDER   = 0x00000800,
    TILE_FLAG_FLYING    = 0x00001000,
    TILE_FLAG_PET       = 0x00002000,
    TILE_FLAG_NEUTRAL   = 0x00004000,
    TILE_FLAG_STAB      = 0x00008000,
    TILE_FLAG_MAY_STAB  = 0x0000C000,
    TILE_FLAG_NET       = 0x00010000,
    TILE_FLAG_POISON    = 0x00020000,
    TILE_FLAG_ANIM_WEP  = 0x00040000,
    // MDAM has 5 possibilities, so uses 3 bits.
    TILE_FLAG_MDAM_MASK = 0x00380000,
    TILE_FLAG_MDAM_LIGHT= 0x00080000,
    TILE_FLAG_MDAM_MOD  = 0x00100000,
    TILE_FLAG_MDAM_HEAVY= 0x00180000,
    TILE_FLAG_MDAM_SEV  = 0x00200000,
    TILE_FLAG_MDAM_ADEAD= 0x00280000,

    // Background flags
    TILE_FLAG_RAY       = 0x00000800,
    TILE_FLAG_MM_UNSEEN = 0x00001000,
    TILE_FLAG_UNSEEN    = 0x00002000,
    TILE_FLAG_CURSOR1   = 0x00004000,
    TILE_FLAG_CURSOR2   = 0x00008000,
    TILE_FLAG_CURSOR3   = 0x0000C000,
    TILE_FLAG_CURSOR    = 0x0000C000,
    TILE_FLAG_BLOOD     = 0x00010000,
    TILE_FLAG_HALO      = 0x00020000,
    TILE_FLAG_NEW_STAIR = 0x00040000,
    TILE_FLAG_TRAV_EXCL = 0x00080000,
    TILE_FLAG_EXCL_CTR  = 0x00100000,
    TILE_FLAG_SANCTUARY = 0x00200000,
    TILE_FLAG_TUT_CURSOR= 0x00400000,

    // General
    TILE_FLAG_MASK      = 0x000007FF
};

enum
{
    TILEI_FLAG_SELECT = 0x0100,
    TILEI_FLAG_TRIED  = 0x0200,
    TILEI_FLAG_EQUIP  = 0x0400,
    TILEI_FLAG_FLOOR  = 0x0800,
    TILEI_FLAG_CURSE  = 0x1000,
    TILEI_FLAG_CURSOR = 0x2000
};

enum
{
    TILEP_GENDER_MALE = 0,
    TILEP_GENDER_FEMALE = 1,
    TILEP_SHOW_EQUIP = 0x1000
};

enum tile_player_flag_cut
{
    TILEP_FLAG_HIDE,
    TILEP_FLAG_NORMAL,
    TILEP_FLAG_CUT_CENTAUR,
    TILEP_FLAG_CUT_NAGA
};

// normal tile size in px
enum
{
    TILE_X = 32,
    TILE_Y = 32
};

#endif // USE_TILES
#endif