Skip to content

Commit

Permalink
player map visible again
Browse files Browse the repository at this point in the history
  • Loading branch information
goblinhack committed Feb 6, 2025
1 parent f3f36ea commit 54406a1
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 63 deletions.
3 changes: 2 additions & 1 deletion src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,8 @@ void Game::create_levels(void)

auto v = levels_create(g);
game_levels_set(g, v);
game_level_set(g, v, 0, 0);
auto l = game_level_set(g, v, 0, 0);
level_scroll_warp_to_player(g, v, l);
}
void game_create_levels(Gamep g) { g->create_levels(); }

Expand Down
8 changes: 4 additions & 4 deletions src/gfx_12x12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ void gfx_init_12x12(void)
"",
"",
// ##############################################################################
"player1.idle.0",
"player2.idle.0",
"player3.idle.0",
"player4.idle.0",
"player.idle.0",
"",
"",
"",
"",
"",
"",
Expand Down
2 changes: 1 addition & 1 deletion src/gfx_16x16.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void gfx_init_16x16(void)
"",
"",
// ##############################################################################
"player1.idle.0",
"player.idle.0",
"player2.idle.0",
"player3.idle.0",
"player4.idle.0",
Expand Down
29 changes: 7 additions & 22 deletions src/level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,11 @@ void level_map_set(Gamep g, Levelsp v, Levelp l, const char *in)
DIE("bad map size, expected %d, got %d", (int) strlen(in), (int) expected_len);
}

auto tp_wall = tp_random(is_wall);
auto tp_door = tp_find_mand("door");
auto tp_floor = tp_find_mand("floor");
auto tp_exit = tp_find_mand("exit");
auto tp_player1 = tp_find_mand("player1");
auto tp_player2 = tp_find_mand("player2");
auto tp_player3 = tp_find_mand("player3");
auto tp_player4 = tp_find_mand("player4");
auto tp_wall = tp_random(is_wall);
auto tp_door = tp_find_mand("door");
auto tp_floor = tp_find_mand("floor");
auto tp_exit = tp_find_mand("exit");
auto tp_player = tp_find_mand("player");

for (auto y = 0; y < MAP_HEIGHT; y++) {
for (auto x = 0; x < MAP_WIDTH; x++) {
Expand All @@ -323,21 +320,9 @@ void level_map_set(Gamep g, Levelsp v, Levelp l, const char *in)
break;
case CHARMAP_TREASURE : break;
case CHARMAP_MONST1 : break;
case CHARMAP_PLAYER1 :
case CHARMAP_PLAYER :
need_floor = true;
tp = tp_player1;
break;
case CHARMAP_PLAYER2 :
need_floor = true;
tp = tp_player2;
break;
case CHARMAP_PLAYER3 :
need_floor = true;
tp = tp_player3;
break;
case CHARMAP_PLAYER4 :
need_floor = true;
tp = tp_player4;
tp = tp_player;
break;
case CHARMAP_EXIT :
need_floor = true;
Expand Down
5 changes: 0 additions & 5 deletions src/level_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,11 @@ void level_display(Gamep g, Levelsp v, Levelp l)
//
game_visible_map_mouse_get(g, &visible_map_mouse_x, &visible_map_mouse_y);

fprintf(stderr, "ZZZ NEIL %s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
for (auto y = v->miny; y < v->maxy; y++) {
fprintf(stderr, "ZZZ NEIL %s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
FOR_ALL_Z_PRIO(z_prio)
{
fprintf(stderr, "ZZZ NEIL %s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
for (auto x = v->minx; x < v->maxx; x++) {
fprintf(stderr, "ZZZ NEIL %s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
for (auto slot = 0; slot < MAP_SLOTS; slot++) {
fprintf(stderr, "ZZZ NEIL %s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
level_display_slot(g, v, l, point(x, y), slot, z_prio);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/level_dungeon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ void level_dungeon_create_and_place(Gamep g, Levelsp v, Levelp l)
level_map_set(g, v, l,
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
"x..............................x"
"x..CC..1.....x.................x"
"x..CC..@.....x.................x"
"x..CC.......x..................x"
"x..........x...................x"
"x..x...........................x"
Expand Down
5 changes: 1 addition & 4 deletions src/my_charmap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ enum {
CHARMAP_EXIT = 'E',
CHARMAP_KEY = 'k',
CHARMAP_MONST1 = 'm',
CHARMAP_PLAYER1 = '1',
CHARMAP_PLAYER2 = '2',
CHARMAP_PLAYER3 = '3',
CHARMAP_PLAYER4 = '4',
CHARMAP_PLAYER = '@',
CHARMAP_TREASURE = '$',
CHARMAP_WALL = 'x',
// end sort marker1 }
Expand Down
5 changes: 3 additions & 2 deletions src/thing_move.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,9 @@ void thing_push(Gamep g, Levelsp v, Levelp l, Thingp t)
//
// Save where we were pushed so we can pop the same location
//
t->is_on_map = true;
t->last_pushed_at = p;
t->is_on_map = true;
t->last_pushed_at = p;
l->thing_id[ p.x ][ p.y ][ slot ] = t->id;

//
// Sort the map slots by z prio for display order.
Expand Down
32 changes: 15 additions & 17 deletions src/things/player/tp_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,24 @@

bool tp_load_player(void)
{
for (auto player = 1; player <= 4; player++) {
auto name = "player" + std::to_string(player);
auto tp = tp_load(name.c_str());
auto name = "player";
auto tp = tp_load(name);

// begin sort marker1 {
tp_flag_set(tp, is_animated_can_hflip, true);
tp_flag_set(tp, is_blit_on_ground, true);
tp_flag_set(tp, is_player, true);
tp_flag_set(tp, is_tickable, true);
tp_speed_set(tp, 100);
tp_z_prio_set(tp, MAP_Z_PRIO_INFRONT);
// end sort marker1 }
// begin sort marker1 {
tp_flag_set(tp, is_animated_can_hflip, true);
tp_flag_set(tp, is_blit_on_ground, true);
tp_flag_set(tp, is_player, true);
tp_flag_set(tp, is_tickable, true);
tp_speed_set(tp, 100);
tp_z_prio_set(tp, MAP_Z_PRIO_INFRONT);
// end sort marker1 }

auto delay = 100;
auto delay = 100;

for (auto frame = 0; frame < 1; frame++) {
auto tile = tile_find_mand(name + ".idle." + std::to_string(frame));
tile_delay_ms_set(tile, delay);
tp_tiles_push_back(tp, tile);
}
for (auto frame = 0; frame < 1; frame++) {
auto tile = tile_find_mand(name + std::string(".idle.") + std::to_string(frame));
tile_delay_ms_set(tile, delay);
tp_tiles_push_back(tp, tile);
}

return true;
Expand Down
5 changes: 1 addition & 4 deletions src/tp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ std::initializer_list< std::string > tps = {
// clang-format off
"", // ID 0 means unused
"wall1",
"player1",
"player2",
"player3",
"player4",
"player",
/* begin shell marker1 */
/* shell for i in $(find . -name "*.cpp" | xargs grep -h "tp_load(\"" | awk '{print $4}' | cut -d\" -f2) */
/* shell do */
Expand Down
2 changes: 1 addition & 1 deletion src/wid_leftbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static bool wid_leftbar_create_window(Gamep g)
y_at = 8;
{
TRACE_AND_INDENT();
auto w = wid_new_square_button(wid_leftbar, "player1");
auto w = wid_new_square_button(wid_leftbar, "player");
point tl(0, y_at);
point br(width - 1, y_at);
auto s = dynprintf("%04u %04u", 0, 100);
Expand Down
2 changes: 1 addition & 1 deletion src/wid_rightbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static bool wid_rightbar_create_window(Gamep g)
y_at = 8;
{
TRACE_AND_INDENT();
auto w = wid_new_square_button(wid_rightbar, "player1");
auto w = wid_new_square_button(wid_rightbar, "player");
point tl(0, y_at);
point br(width - 1, y_at);
auto s = dynprintf("%04u %04u", 0, 100);
Expand Down

0 comments on commit 54406a1

Please sign in to comment.