Skip to content

Commit

Permalink
Fixed secret door not working when freshly placed (#3816)
Browse files Browse the repository at this point in the history
  • Loading branch information
Loobinex authored Jan 11, 2025
1 parent ae6c210 commit ab5571b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/main_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ static void init_level(void)
init_seeds();
// Load the actual level files
TbBool script_preloaded = preload_script(get_selected_level_number());
init_navigation();
if (!load_map_file(get_selected_level_number()))
{
// TODO: whine about missing file to screen
Expand All @@ -202,7 +203,6 @@ static void init_level(void)
}
}

init_navigation();
snprintf(game.campaign_fname, sizeof(game.campaign_fname), "%s", campaign.fname);
light_set_lights_on(1);
{
Expand Down
8 changes: 3 additions & 5 deletions src/thing_doors.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,13 @@ struct Thing *create_door(struct Coord3d *pos, ThingModel tngmodel, unsigned cha
{
doortng->clipbox_size_xy = 3*COORD_PER_STL;
}

add_thing_to_its_class_list(doortng);
place_thing_in_mapwho(doortng);
check_if_enemy_can_see_placement_of_hidden_door(doortng);
place_animating_slab_type_on_map(doorst->slbkind[orient], 0, doortng->mappos.x.stl.num, doortng->mappos.y.stl.num, plyr_idx);
ceiling_partially_recompute_heights(pos->x.stl.num - 1, pos->y.stl.num - 1, pos->x.stl.num + 2, pos->y.stl.num + 2);
//update_navigation_triangulation(stl_x-1, stl_y-1, stl_x+2,stl_y+2);
if ( game.neutral_player_num != plyr_idx )
++game.dungeon[plyr_idx].total_doors;
update_navigation_triangulation(pos->x.stl.num - 1, pos->y.stl.num - 1, pos->x.stl.num + 2, pos->y.stl.num + 2);
++game.dungeon[plyr_idx].total_doors;
return doortng;
}

Expand Down Expand Up @@ -450,7 +448,7 @@ static void check_if_enemy_can_see_placement_of_hidden_door(struct Thing *doortn
TbBool door_is_hidden_to_player(struct Thing *doortng,PlayerNumber plyr_idx)
{
struct DoorConfigStats* doorst = get_door_model_stats(doortng->model);
if((plyr_idx != doortng->owner) && (doorst->model_flags & DoMF_Secret))
if((plyr_idx != doortng->owner) && flag_is_set(doorst->model_flags,DoMF_Secret))
{
return !flag_is_set(doortng->door.revealed,to_flag(plyr_idx));
}
Expand Down

0 comments on commit ab5571b

Please sign in to comment.