-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.h
175 lines (157 loc) · 5.53 KB
/
game.h
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
#ifndef GAME
#define GAME
#include <ncurses.h>
#include "dm_world.h"
#define KEY_RETURN 10
#define KEY_ESC 27
#define KEY_SPACE 32
#define KEY_TAB 9
#define KEY_a 97
#define KEY_b 98
#define KEY_c 99
#define KEY_d 100
#define KEY_e 101
#define KEY_f 102
#define KEY_g 103
#define KEY_h 104
#define KEY_i 105
#define KEY_j 106
#define KEY_k 107
#define KEY_l 108
#define KEY_m 109
#define KEY_n 110
#define KEY_o 111
#define KEY_p 112
#define KEY_q 113
#define KEY_r 114
#define KEY_s 115
#define KEY_t 116
#define KEY_u 117
#define KEY_v 118
#define KEY_w 119
#define KEY_x 120
#define KEY_y 121
#define KEY_z 122
#define KEY_0 48
#define KEY_1 49
#define KEY_2 50
#define KEY_3 51
#define KEY_4 52
#define KEY_5 53
#define KEY_6 54
#define KEY_7 55
#define KEY_8 56
#define KEY_9 57
enum GAME_STATE
{
GS_START,
GS_INTRO,
GS_TITLE,
GS_NEWGAME,
GS_EXIT
};
enum PLAY_STATE {
PS_START,
PS_PLAY_FIRST,
PS_PLAY,
PS_MENU,
PS_MAPCHANGE,
PS_GAMEOVER,
PS_WIN,
PS_END, // do not call exit directly
PS_EXIT,
};
enum USE_TYPE {
USE_NONE,
USE_ITEM,
USE_SPELL, // TBD
};
// UTILS
void skip_delay(double wait_s);
void escapedelay(bool on);
void on_term_resize(int dummy);
// GAME SETUP
bool g_setup();
void g_teardown();
void g_newgame();
int game_main();
// INTRO
void g_intro();
// TITLE
void g_title_onquit(char *label);
void g_title_onintro(char *label);
void g_title_onnewgame(char *label);
void g_title_onundefined(char *label);
void g_title();
// UI
void ui_clear_visible_mobs(bool full);
void ui_next_visible_mob();
void ui_box_color(WINDOW* win, int colorpair);
void ui_box(WINDOW* win);
void ui_box_title_color(WINDOW* win, int buffer_size, char *text, int colorpair);
void ui_box_title(WINDOW* win, int buffer_size, char *text);
void ui_clear(WINDOW *win, int row);
void ui_printchar(WINDOW *win, int row, int col, unsigned long ch);
void ui_print(WINDOW *win, int buffer_size, int row, int col, char *msg);
void ui_printf(WINDOW *win, int buffer_size, int row, int col, char *format, ...);
void ui_anchor_ur(WINDOW* win, int rows, int cols);
void ui_anchor_ul(WINDOW *win, int rows, int cols);
void ui_anchor_br(WINDOW *win, int rows, int cols);
void ui_anchor_bl(WINDOW *win, int rows, int cols, int yoff, int xoff);
void ui_anchor_center(WINDOW *win, int rows, int cols, int yoff, int xoff);
void ui_clear_win(WINDOW *win);
void ui_cursorinfo(char *msg);
void ui_positioninfo(char *msg);
void ui_modeinfo(char *msg);
void ui_log(char *msg);
void ui_logf(char *msg, ...);
void ui_vlogf(char *msg, va_list argptr);
void ui_meter(WINDOW *win, int row, int col, int size, char* label, int current, int max, int labelfg, int wfg, int wbg, bool deplete_left);
void ui_update_cmdpanel(struct wld_map *map);
void ui_update_cursorinfo(struct wld_map *map);
void ui_update_positioninfo(struct wld_map *map);
void ui_update_logpanel(struct wld_map *map);
void ui_update_mobpanel(struct wld_map *map);
void ui_update_inventorypanel(struct wld_map *map);
void ui_update_interruptpanel(struct wld_map *map, char* message);
void ui_update_usepanel(struct wld_map *map);
void ui_unset_use();
void ui_set_use_item(struct wld_item* item, int item_slot);
void ui_use_item_select(struct wld_mob* player, int item_slot);
// MAP EVENTS
void map_on_effect(struct wld_map *map, struct wld_vfx *effect);
void map_on_interrupt(struct wld_map *map, char *message);
void map_on_player_transition(struct wld_map *map, struct wld_mob *player, bool forward);
void map_on_cursormove(struct wld_map *map, int x, int y, int index);
void map_on_playermove(struct wld_map *map, struct wld_mob *player, int x, int y, int index);
void map_on_mob_heal(struct wld_map *map, struct wld_mob* mob, int amt, struct wld_item* item);
void map_on_mob_attack_player(struct wld_map *map, struct wld_mob* aggressor, struct wld_mob* player, int dmg, struct wld_item* item);
void map_on_mob_whiff_player(struct wld_map *map, struct wld_mob* aggressor, struct wld_mob* player, struct wld_item* item);
void map_on_mob_kill_player(struct wld_map *map, struct wld_mob* aggressor, struct wld_mob* player, struct wld_item* item);
void map_on_player_heal(struct wld_map *map, struct wld_mob* player, int amt, struct wld_item* item);
void map_on_player_attack_mob(struct wld_map *map, struct wld_mob* player, struct wld_mob* defender, int dmg, struct wld_item* item);
void map_on_player_whiff(struct wld_map *map, struct wld_mob* player, struct wld_item* item);
void map_on_player_whiff_mob(struct wld_map *map, struct wld_mob* player, struct wld_mob* defender, struct wld_item* item);
void map_on_player_kill_mob(struct wld_map *map, struct wld_mob* player, struct wld_mob* defender, struct wld_item* item);
void map_on_player_pickup_item(struct wld_map *map, struct wld_mob* player, struct wld_item* item);
void map_on_player_pickup_item_fail(struct wld_map *map, struct wld_mob* player, struct wld_item* item);
void map_on_player_drop_item(struct wld_map *map, struct wld_mob* player, struct wld_item* item);
void map_on_player_drop_item_fail(struct wld_map *map, struct wld_mob* player, struct wld_item* item);
// PLAY MODE
void ai_player_input(struct wld_mob* player);
void ps_on_mapchange();
void ps_build_world();
void ps_destroy_world();
void ps_layout_ui();
void ps_reset_ui();
void ps_build_ui();
void ps_destroy_ui();
void ps_play_draw_onvisible(struct wld_mob* mob, int x, int y, double radius);
void ps_draw_tile(int r, int c, unsigned long cha, int colorpair, unsigned long cha2, int cpair2, bool bold);
void ps_refresh_map_pad();
void ps_play_draw();
void ps_play_update();
// PLAY MENU
void ps_menu_draw();
void ps_menu_input();
#endif