Unify all special level filling options
The existing system was a confusing mess of competing names (filled, needfill, prefilled, etc) that had varying semantics, with prefilled being the worst offender as it meant at least three different things in various contexts. This commit unifies everything in the code under "needfill", and everything in Lua under "filled", which defaults to 0 everywhere. This also removes the second argument to fill_special_room; that function now just checks the needfill of the room it's passed. As before, a filled == 2 value is used for a special room to indicate that the room should set the appropriate level flag, but shouldn't actually be stocked with anything (for instance, King Arthur's throne room); the difference is that this now comes directly from the lua script instead of being manipulated within sp_lev.c. The prefilled argument had one use case that is occasionally used in the level files: if the level designer had specified an ordinary region with prefilled = 1, it would become a room to control monster arrivals on a level -- monsters that arrive within the bounds of a room are supposed to stay there. However, not all of the places where the comments indicated this was being used were using it correctly; I tested this by letting a few monsters fall through the knox portal (they're supposed to be constrained to the entry room) and waiting a hundred turns, then going through the portal; they were not constrained to the room and had "wandered" through its walls. Instead of trying to maintain this special case, I have added an optional "arrival_room" boolean argument to des.region, which forces it to create a room for the purposes of constraining monster arrival. I have gone through and replaced occurrences of prefilled in lua files with the appropriate filled option (or arrival, as needed). In some cases, that resulted in questionable regions such as a filled ordinary area in a non-themeroom (I just dropped the filled=1), or an area which didn't do anything, not even lighting (which I deleted).
This commit is contained in:
committed by
Pasi Kallinen
parent
f57588cef1
commit
0fef8fce9f
@@ -2467,7 +2467,7 @@ E boolean FDECL(create_room, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P,
|
||||
XCHAR_P, XCHAR_P, XCHAR_P));
|
||||
E void FDECL(create_secret_door, (struct mkroom *, XCHAR_P));
|
||||
E boolean FDECL(dig_corridor, (coord *, coord *, BOOLEAN_P, SCHAR_P, SCHAR_P));
|
||||
E void FDECL(fill_special_room, (struct mkroom *, BOOLEAN_P));
|
||||
E void FDECL(fill_special_room, (struct mkroom *));
|
||||
E boolean FDECL(load_special, (const char *));
|
||||
E xchar FDECL(selection_getpoint, (int, int, struct selectionvar *));
|
||||
E struct selectionvar *NDECL(selection_new);
|
||||
|
||||
@@ -90,6 +90,14 @@ enum roomtype_types {
|
||||
#define ROOMOFFSET 3 /* (levl[x][y].roomno - ROOMOFFSET) gives g.rooms[] index,
|
||||
* for inside-squares and non-shared boundaries */
|
||||
|
||||
/* Values for needfill */
|
||||
#define FILL_NONE 0 /* do not fill this room with anything */
|
||||
#define FILL_NORMAL 1 /* fill the room normally (OROOM or THEMEROOM gets
|
||||
fill_ordinary_room; any other room type gets stocked
|
||||
with its usual monsters/objects/terrain) */
|
||||
#define FILL_LVFLAGS 2 /* special rooms only; set the room's rtype and level
|
||||
flags as appropriate, but do not put anything in it */
|
||||
|
||||
#define IS_ROOM_PTR(x) ((x) >= g.rooms && (x) < g.rooms + MAXNROFROOMS)
|
||||
#define IS_ROOM_INDEX(x) ((x) >= 0 && (x) < MAXNROFROOMS)
|
||||
#define IS_SUBROOM_PTR(x) ((x) >= g.subrooms && (x) < g.subrooms + MAXNROFROOMS)
|
||||
|
||||
@@ -185,7 +185,7 @@ typedef struct _room {
|
||||
Str_or_Len parent;
|
||||
xchar x, y, w, h;
|
||||
xchar xalign, yalign;
|
||||
xchar rtype, chance, rlit, filled, joined;
|
||||
xchar rtype, chance, rlit, needfill, joined;
|
||||
} room;
|
||||
|
||||
struct mapfragment {
|
||||
|
||||
Reference in New Issue
Block a user