1 /*
2 * sobjects.h
3 * Copyright (C) 2009-2020 Joachim de Groot <jdegroot@web.de>
4 *
5 * This program is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #ifndef __SOBJECTS_H_
20 #define __SOBJECTS_H_
21
22 /* forward declarations */
23 struct player;
24 struct map;
25
26 typedef enum sobject_type
27 {
28 LS_NONE,
29 LS_ALTAR,
30 LS_THRONE, /* throne with gems and king */
31 LS_THRONE2, /* throne with gems, without king */
32 LS_DEADTHRONE, /* throne without gems or king */
33 LS_STAIRSDOWN,
34 LS_STAIRSUP,
35 LS_ELEVATORDOWN, /* Enter the volcano */
36 LS_ELEVATORUP, /* leave the volcano */
37 LS_FOUNTAIN,
38 LS_DEADFOUNTAIN,
39 LS_STATUE,
40 LS_URN, /* golden urn - not implemented */
41 LS_MIRROR,
42 LS_OPENDOOR,
43 LS_CLOSEDDOOR,
44 LS_CAVERNS_ENTRY,
45 LS_CAVERNS_EXIT,
46 LS_HOME,
47 LS_DNDSTORE,
48 LS_TRADEPOST,
49 LS_LRS, /* Larn Revenue Service */
50 LS_SCHOOL,
51 LS_BANK,
52 LS_BANK2, /* branch office */
53 LS_MONASTERY,
54 LS_MAX
55 } sobject_t;
56
57 typedef struct _sobject_data
58 {
59 sobject_t sobject;
60 const char glyph;
61 int colour;
62 const char *description;
63 unsigned
64 passable: 1, /* can be passed */
65 transparent: 1; /* see-through */
66 } sobject_data;
67
68 extern const sobject_data sobjects[LS_MAX];
69
so_get_glyph(sobject_t s)70 static inline char so_get_glyph(sobject_t s)
71 {
72 return sobjects[s].glyph;
73 }
74
so_get_colour(sobject_t s)75 static inline int so_get_colour(sobject_t s)
76 {
77 return sobjects[s].colour;
78 }
79
so_get_desc(sobject_t s)80 static inline const char *so_get_desc(sobject_t s)
81 {
82 return sobjects[s].description;
83 }
84
so_is_passable(sobject_t s)85 static inline gboolean so_is_passable(sobject_t s)
86 {
87 return sobjects[s].passable;
88 }
89
so_is_transparent(sobject_t s)90 static inline gboolean so_is_transparent(sobject_t s)
91 {
92 return sobjects[s].transparent;
93 }
94
95 /* deal with stationary objects */
96 int player_altar_desecrate(struct player *p);
97 int player_altar_pray(struct player *p);
98 int player_building_enter(struct player *p);
99 int player_door_close(struct player *p);
100 int player_door_open(struct player *p, int dir);
101 int player_fountain_drink(struct player *p);
102 int player_fountain_wash(struct player *p);
103 int player_stairs_down(struct player *p);
104 int player_stairs_up(struct player *p);
105 int player_throne_pillage(struct player *p);
106 int player_throne_sit(struct player *p);
107 void sobject_destroy_at(struct player *p, struct map *dmap, position pos);
108
109 #endif
110