Skip to content

Commit f1ce5db

Browse files
committed
wip on collecting items
1 parent 836ccd2 commit f1ce5db

8 files changed

Lines changed: 483 additions & 25 deletions

File tree

TODO

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ todo
55
----
66
chests need to contain items
77
staff of fire in water damage when fully submerged
8-
wands
98

109
essential features
1110
------------------

src/game.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,6 +1083,7 @@ void Game::state_change(GameStateType new_state, const std::string &why)
10831083
case STATE_SAVE_MENU : [[fallthrough]];
10841084
case STATE_QUIT_MENU : [[fallthrough]];
10851085
case STATE_INVENTORY_MENU : [[fallthrough]];
1086+
case STATE_COLLECT_MENU : [[fallthrough]];
10861087
case STATE_ITEM_MENU : wid_actionbar_fini(g); break;
10871088
case STATE_GENERATING : [[fallthrough]];
10881089
case STATE_GENERATED : [[fallthrough]];
@@ -1128,6 +1129,7 @@ void Game::state_change(GameStateType new_state, const std::string &why)
11281129
case STATE_KEYBOARD_MENU : [[fallthrough]];
11291130
case STATE_MAIN_MENU : [[fallthrough]];
11301131
case STATE_INVENTORY_MENU : [[fallthrough]];
1132+
case STATE_COLLECT_MENU : [[fallthrough]];
11311133
case STATE_ITEM_MENU :
11321134
(void) wid_leftbar_init(g);
11331135
(void) wid_rightbar_init(g);
@@ -1155,6 +1157,7 @@ void Game::state_change(GameStateType new_state, const std::string &why)
11551157
case STATE_SAVE_MENU : [[fallthrough]];
11561158
case STATE_QUIT_MENU : [[fallthrough]];
11571159
case STATE_INVENTORY_MENU : [[fallthrough]];
1160+
case STATE_COLLECT_MENU : [[fallthrough]];
11581161
case STATE_ITEM_MENU : [[fallthrough]];
11591162
case STATE_GENERATING : [[fallthrough]];
11601163
case STATE_GENERATED : [[fallthrough]];
@@ -1197,6 +1200,7 @@ void Game::handle_game_request_to_remake_ui()
11971200
case STATE_THE_END_MENU : [[fallthrough]];
11981201
case STATE_PLAYING : [[fallthrough]];
11991202
case STATE_LEVEL_SELECT_MENU : [[fallthrough]];
1203+
case STATE_COLLECT_MENU : [[fallthrough]];
12001204
case STATE_INVENTORY_MENU :
12011205
if (v != nullptr) {
12021206
(void) wid_leftbar_init(g);
@@ -1255,6 +1259,7 @@ void Game::tick()
12551259
case STATE_SAVE_MENU : [[fallthrough]];
12561260
case STATE_QUIT_MENU : [[fallthrough]];
12571261
case STATE_INVENTORY_MENU : [[fallthrough]];
1262+
case STATE_COLLECT_MENU : [[fallthrough]];
12581263
case STATE_ITEM_MENU : [[fallthrough]];
12591264
case STATE_GENERATING : [[fallthrough]];
12601265
case STATE_GENERATED : [[fallthrough]];
@@ -1382,10 +1387,11 @@ void Game::display()
13821387
//
13831388
// Needed else we can't see the level select things
13841389
//
1385-
case STATE_INVENTORY_MENU :
1386-
case STATE_ITEM_MENU :
1387-
case STATE_PLAYING :
1388-
case STATE_DEAD_MENU :
1390+
case STATE_INVENTORY_MENU : [[fallthrough]];
1391+
case STATE_COLLECT_MENU : [[fallthrough]];
1392+
case STATE_ITEM_MENU : [[fallthrough]];
1393+
case STATE_PLAYING : [[fallthrough]];
1394+
case STATE_DEAD_MENU : [[fallthrough]];
13891395
case STATE_THE_END_MENU :
13901396
level_mouse_position_get(g, v, l);
13911397
level_display(g, v, l);

src/level_populate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ static auto level_populate_biome_dungeon(Gamep g, Levelsp v, Levelp l, class Lev
273273
break;
274274
default :
275275
if (! g_opt_do_level_gen) {
276-
CROAK("unexpected map char '%c'", lp.c);
276+
CROAK("unexpected map char in level populate '%c'", lp.c);
277277
}
278278
}
279279

src/levels_test.cpp

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,25 @@ void levels_test(Gamep g)
3232
/* line */ (const char *) "xxxxxxxxxxx",
3333
/* end */ nullptr);
3434

35-
level_fixed_add(g, CHANCE_NORMAL, LEVEL_TYPE_TEST, "treasure", __FUNCTION__, __LINE__, no_overrides, 0,
36-
/* line */ (const char *) "xxxxxxxxxxx",
37-
/* line */ (const char *) "xxxxxxxxxxx",
38-
/* line */ (const char *) "xx.......xx",
39-
/* line */ (const char *) "xx...$$$$xx",
40-
/* line */ (const char *) "xx...$$$$xx",
41-
/* line */ (const char *) "xx.@.$$$$xx",
42-
/* line */ (const char *) "xx...$$$$xx",
43-
/* line */ (const char *) "xx...$$$$xx",
44-
/* line */ (const char *) "xx...$$$$xx",
45-
/* line */ (const char *) "xxxxxxxxxxx",
46-
/* line */ (const char *) "xxxxxxxxxxx",
47-
/* end */ nullptr);
35+
{
36+
Overrides overrides;
37+
38+
overrides[ 'c' ] = [](char /*c*/, bpoint /*p*/) -> Tpp { return tp_find_mand("chest"); };
39+
40+
level_fixed_add(g, CHANCE_NORMAL, LEVEL_TYPE_TEST, "treasure", __FUNCTION__, __LINE__, overrides, 0,
41+
/* line */ (const char *) "xxxxxxxxxxx",
42+
/* line */ (const char *) "xxxxxxxxxxx",
43+
/* line */ (const char *) "xx.......xx",
44+
/* line */ (const char *) "xx.......xx",
45+
/* line */ (const char *) "xx.......xx",
46+
/* line */ (const char *) "xx.@.c...xx",
47+
/* line */ (const char *) "xx.......xx",
48+
/* line */ (const char *) "xx.......xx",
49+
/* line */ (const char *) "xx.......xx",
50+
/* line */ (const char *) "xxxxxxxxxxx",
51+
/* line */ (const char *) "xxxxxxxxxxx",
52+
/* end */ nullptr);
53+
}
4854

4955
{
5056
Overrides overrides;
@@ -71,9 +77,26 @@ void levels_test(Gamep g)
7177

7278
level_fixed_add(g, CHANCE_NORMAL, LEVEL_TYPE_TEST, "test2", __FUNCTION__, __LINE__, overrides, 0,
7379
/* line */ (const char *) "XXXXXXX",
74-
/* line */ (const char *) "X.~~~.X",
7580
/* line */ (const char *) "X.===.X",
7681
/* line */ (const char *) "X.~~~.X",
82+
/* line */ (const char *) "X.~~~.X",
83+
/* line */ (const char *) "X.~~~.X",
84+
/* line */ (const char *) "X.~~~.X",
85+
/* line */ (const char *) "X.~~~.X",
86+
/* line */ (const char *) "X.~~~.X",
87+
/* line */ (const char *) "X.~~~.X",
88+
/* line */ (const char *) "X.~~~.X",
89+
/* line */ (const char *) "X.~~~.X",
90+
/* line */ (const char *) "X.~~~.X",
91+
/* line */ (const char *) "X.~~~.X",
92+
/* line */ (const char *) "X.~~~.X",
93+
/* line */ (const char *) "X.~~~.X",
94+
/* line */ (const char *) "X.~~~.X",
95+
/* line */ (const char *) "X.~~~.X",
96+
/* line */ (const char *) "X.~~~.X",
97+
/* line */ (const char *) "X.~~~.X",
98+
/* line */ (const char *) "X.~~~.X",
99+
/* line */ (const char *) "X.~~~.X",
77100
/* line */ (const char *) "X@~~~mX",
78101
/* line */ (const char *) "XXXXXXX",
79102
/* end */ nullptr);
@@ -87,10 +110,10 @@ void levels_test(Gamep g)
87110
level_fixed_add(g, CHANCE_NORMAL, LEVEL_TYPE_TEST, "test3", __FUNCTION__, __LINE__, overrides, 0,
88111
/* line */ (const char *) "XXXXXXXXXXXXXXX",
89112
/* line */ (const char *) "X.~~~.~~~.~~~.X",
90-
/* line */ (const char *) "X@===========mX",
91-
/* line */ (const char *) "X.~~~.~~~.~~~.X",
92-
/* line */ (const char *) "X.~~~.~~~.~~~.X",
113+
/* line */ (const char *) "X.===.~~~.===.X",
93114
/* line */ (const char *) "X.~~~.~~~.~~~.X",
115+
/* line */ (const char *) "X.~~~.===.~~~.X",
116+
/* line */ (const char *) "X@~~~.~~~.~~~mX",
94117
/* line */ (const char *) "XXXXXXXXXXXXXXX",
95118
/* end */ nullptr);
96119
}

src/my_game.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@
2020
list_macro(STATE_GENERATED, "GENERATED"), /* newline */ \
2121
list_macro(STATE_PLAYING, "PLAYING"), /* newline */ \
2222
list_macro(STATE_LEVEL_SELECT_MENU, "LEVEL-SELECT-MENU"), /* newline */ \
23-
list_macro(STATE_MOVE_WARNING_MENU, "MOVE-WARNING"), /* newline */ \
23+
list_macro(STATE_MOVE_WARNING_MENU, "MOVE-WARNING-MENU"), /* newline */ \
2424
list_macro(STATE_QUITTING, "QUITTING"), /* newline */ \
2525
list_macro(STATE_KEYBOARD_MENU, "KEYBOARD-MENU"), /* newline */ \
2626
list_macro(STATE_LOAD_MENU, "LOAD-MENU"), /* newline */ \
2727
list_macro(STATE_LOADED, "LOADED"), /* newline */ \
28-
list_macro(STATE_INVENTORY_MENU, "INVENTORY"), /* newline */ \
28+
list_macro(STATE_INVENTORY_MENU, "INVENTORY-MENU"), /* newline */ \
29+
list_macro(STATE_COLLECT_MENU, "COLLECT-MENU"), /* newline */ \
2930
list_macro(STATE_ITEM_MENU, "ITEM-MENU"), /* newline */ \
3031
list_macro(STATE_DEAD_MENU, "DEAD-MENU"), /* newline */ \
3132
list_macro(STATE_THE_END_MENU, "THE-END-MENU"), /* newline */ \

src/my_wids.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ void wid_intro_select(Gamep g);
3737
void wid_inventory_mouse_over_begin(Gamep g, Widp w, int relx, int rely, int wheelx, int wheely);
3838
void wid_inventory_mouse_over_end(Gamep g, Widp w);
3939
void wid_inventory_show(Gamep g, Levelsp v, Levelp l, Thingp player);
40+
void wid_collect_show(Gamep g, Levelsp v, Levelp l, Thingp player, std::vector< Thingp >);
4041
void wid_item_menu_select(Gamep g, Levelsp v, Thingp it, bool from_inventory);
4142
void wid_leftbar_fini(Gamep g);
4243
void wid_load_destroy(Gamep g);

src/thing_player.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ void thing_player_event_loop(Gamep g, Levelsp v, Levelp l)
267267
case STATE_SAVE_MENU : [[fallthrough]];
268268
case STATE_QUIT_MENU : [[fallthrough]];
269269
case STATE_INVENTORY_MENU : [[fallthrough]];
270+
case STATE_COLLECT_MENU : [[fallthrough]];
270271
case STATE_ITEM_MENU : [[fallthrough]];
271272
case STATE_GENERATING : [[fallthrough]];
272273
case STATE_GENERATED : [[fallthrough]];

0 commit comments

Comments
 (0)