Skip to content

Commit

Permalink
Fix a bug when finding unused secret sectors with a cheat.
Browse files Browse the repository at this point in the history
  • Loading branch information
JadingTsunami committed Apr 16, 2024
1 parent 307bcc0 commit fb5f139
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
14 changes: 10 additions & 4 deletions prboom2/src/c_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1024,11 +1024,17 @@ static void C_automapfindsecret(char* cmd)
i = ((current_secret_sector + 1) % numsectors);
initial = i;
do {
if (P_IsSecret(&sectors[i])) {
x = sectors[i].lines[0]->v1->x;
y = sectors[i].lines[0]->v1->y;
if (&sectors[i] && P_IsSecret(&sectors[i])) {
if(sectors[i].lines &&
sectors[i].lines[0] &&
sectors[i].lines[0]->v1) {
x = sectors[i].lines[0]->v1->x;
y = sectors[i].lines[0]->v1->y;
AM_SetCenterPosition(&x, &y);
} else {
doom_printf("Warning: Next secret is unreachable.");
}
current_secret_sector = i;
AM_SetCenterPosition(&x, &y);
break;
}
i = ((i+1) % numsectors);
Expand Down
1 change: 1 addition & 0 deletions prboom2/src/p_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,7 @@ static void P_LoadSectors (int lump)
ss->tag = LittleShort(ms->tag);
ss->thinglist = NULL;
ss->touching_thinglist = NULL; // phares 3/14/98
ss->lines = NULL;

ss->nextsec = -1; //jff 2/26/98 add fields to support locking out
ss->prevsec = -1; // stair retriggering until build completes
Expand Down

0 comments on commit fb5f139

Please sign in to comment.