Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f5a9901

Browse filesBrowse files
committed
Special levels: mkmap roomno cleanup and room removal after map
mkmap creates mines-style full-level maps, so it should wipe out all the room numbers in the level away. Also, it uses temporary rooms for making sure the map is fully joined together; those temporary rooms were left on the map, but should've been cleared away. When putting down map-parts on the level, don't remove the room data which would be under that map; the map may have holes in them (using the "x" map char), so a room may still exist there. I don't think it matters if there is any room data which doesn't have any room numbers referring to it in the level. (Usually the special levels use map right after level_init anyway, so there wouldn't be any rooms in the level)
1 parent 7100534 commit f5a9901
Copy full SHA for f5a9901

File tree

Expand file treeCollapse file tree

2 files changed

+20
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+20
-3
lines changed
Open diff view settings
Collapse file

‎src/mkmap.c‎

Copy file name to clipboardExpand all lines: src/mkmap.c
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ static schar get_map(int, int, schar);
1414
static void pass_one(schar, schar);
1515
static void pass_two(schar, schar);
1616
static void pass_three(schar, schar);
17+
static void join_map_cleanup(void);
1718
static void join_map(schar, schar);
1819
static void finish_map(schar, schar, boolean, boolean, boolean);
1920
static void remove_room(unsigned);
@@ -26,6 +27,7 @@ init_map(schar bg_typ)
2627

2728
for (i = 1; i < COLNO; i++)
2829
for (j = 0; j < ROWNO; j++) {
30+
levl[i][j].roomno = NO_ROOM;
2931
levl[i][j].typ = bg_typ;
3032
levl[i][j].lit = FALSE;
3133
}
@@ -240,6 +242,19 @@ flood_fill_rm(
240242
g.max_ry = sy;
241243
}
242244

245+
/* join_map uses temporary rooms; clean up after it */
246+
static void
247+
join_map_cleanup(void)
248+
{
249+
coordxy x, y;
250+
251+
for (x = 1; x < COLNO; x++)
252+
for (y = 0; y < ROWNO; y++)
253+
levl[x][y].roomno = NO_ROOM;
254+
g.nroom = g.nsubroom = 0;
255+
g.rooms[g.nroom].hx = g.subrooms[g.nsubroom].hx = -1;
256+
}
257+
243258
static void
244259
join_map(schar bg_typ, schar fg_typ)
245260
{
@@ -311,6 +326,7 @@ join_map(schar bg_typ, schar fg_typ)
311326
}
312327
croom2++; /* always increment the next room */
313328
}
329+
join_map_cleanup();
314330
}
315331

316332
static void
@@ -349,6 +365,10 @@ finish_map(
349365
}
350366

351367
/*
368+
* TODO: If we really want to remove rooms after a map is plopped down
369+
* in a special level, this needs to be rewritten - the maps may have
370+
* holes in them ("x" mapchar), leaving parts of rooms still on the map.
371+
*
352372
* When level processed by join_map is overlaid by a MAP, some rooms may no
353373
* longer be valid. All rooms in the region lx <= x < hx, ly <= y < hy are
354374
* removed. Rooms partially in the region are truncated. This function
Collapse file

‎src/sp_lev.c‎

Copy file name to clipboardExpand all lines: src/sp_lev.c
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6649,9 +6649,6 @@ TODO: g.coder->croom needs to be updated
66496649
else if (splev_init_present && levl[x][y].typ == ICE)
66506650
levl[x][y].icedpool = icedpools ? ICED_POOL : ICED_MOAT;
66516651
}
6652-
if (g.coder->lvl_is_joined && !g.in_mk_themerooms)
6653-
remove_rooms(g.xstart, g.ystart,
6654-
g.xstart + g.xsize, g.ystart + g.ysize);
66556652
}
66566653

66576654
skipmap:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.