killer, level and rooms move to instance globals.
This commit is contained in:
64
src/mkroom.c
64
src/mkroom.c
@@ -152,11 +152,11 @@ mkshop()
|
||||
#ifndef MAC
|
||||
gottype:
|
||||
#endif
|
||||
for (sroom = &rooms[0];; sroom++) {
|
||||
for (sroom = &g.rooms[0];; sroom++) {
|
||||
if (sroom->hx < 0)
|
||||
return;
|
||||
if (sroom - rooms >= g.nroom) {
|
||||
pline("rooms not closed by -1?");
|
||||
if (sroom - g.rooms >= g.nroom) {
|
||||
pline("g.rooms not closed by -1?");
|
||||
return;
|
||||
}
|
||||
if (sroom->rtype != OROOM)
|
||||
@@ -210,9 +210,9 @@ register boolean strict;
|
||||
register struct mkroom *sroom;
|
||||
register int i = g.nroom;
|
||||
|
||||
for (sroom = &rooms[rn2(g.nroom)]; i--; sroom++) {
|
||||
if (sroom == &rooms[g.nroom])
|
||||
sroom = &rooms[0];
|
||||
for (sroom = &g.rooms[rn2(g.nroom)]; i--; sroom++) {
|
||||
if (sroom == &g.rooms[g.nroom])
|
||||
sroom = &g.rooms[0];
|
||||
if (sroom->hx < 0)
|
||||
return (struct mkroom *) 0;
|
||||
if (sroom->rtype != OROOM)
|
||||
@@ -267,13 +267,13 @@ struct mkroom *sroom;
|
||||
struct monst *mon;
|
||||
register int sx, sy, i;
|
||||
int sh, tx = 0, ty = 0, goldlim = 0, type = sroom->rtype;
|
||||
int rmno = (int) ((sroom - rooms) + ROOMOFFSET);
|
||||
int rmno = (int) ((sroom - g.rooms) + ROOMOFFSET);
|
||||
coord mm;
|
||||
|
||||
sh = sroom->fdoor;
|
||||
switch (type) {
|
||||
case COURT:
|
||||
if (level.flags.is_maze_lev) {
|
||||
if (g.level.flags.is_maze_lev) {
|
||||
for (tx = sroom->lx; tx <= sroom->hx; tx++)
|
||||
for (ty = sroom->ly; ty <= sroom->hy; ty++)
|
||||
if (IS_THRONE(levl[tx][ty].typ))
|
||||
@@ -412,23 +412,23 @@ struct mkroom *sroom;
|
||||
add_to_container(chest, gold);
|
||||
chest->owt = weight(chest);
|
||||
chest->spe = 2; /* so it can be found later */
|
||||
level.flags.has_court = 1;
|
||||
g.level.flags.has_court = 1;
|
||||
break;
|
||||
}
|
||||
case BARRACKS:
|
||||
level.flags.has_barracks = 1;
|
||||
g.level.flags.has_barracks = 1;
|
||||
break;
|
||||
case ZOO:
|
||||
level.flags.has_zoo = 1;
|
||||
g.level.flags.has_zoo = 1;
|
||||
break;
|
||||
case MORGUE:
|
||||
level.flags.has_morgue = 1;
|
||||
g.level.flags.has_morgue = 1;
|
||||
break;
|
||||
case SWAMP:
|
||||
level.flags.has_swamp = 1;
|
||||
g.level.flags.has_swamp = 1;
|
||||
break;
|
||||
case BEEHIVE:
|
||||
level.flags.has_beehive = 1;
|
||||
g.level.flags.has_beehive = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -453,7 +453,7 @@ int mm_flags;
|
||||
|| !revive(otmp, FALSE)))
|
||||
(void) makemon(mdat, cc.x, cc.y, mm_flags);
|
||||
}
|
||||
level.flags.graveyard = TRUE; /* reduced chance for undead corpse */
|
||||
g.level.flags.graveyard = TRUE; /* reduced chance for undead corpse */
|
||||
}
|
||||
|
||||
STATIC_OVL struct permonst *
|
||||
@@ -515,7 +515,7 @@ mkswamp() /* Michiel Huisjes & Fred de Wilde */
|
||||
register int sx, sy, i, eelct = 0;
|
||||
|
||||
for (i = 0; i < 5; i++) { /* turn up to 5 rooms swampy */
|
||||
sroom = &rooms[rn2(g.nroom)];
|
||||
sroom = &g.rooms[rn2(g.nroom)];
|
||||
if (sroom->hx < 0 || sroom->rtype != OROOM || has_upstairs(sroom)
|
||||
|| has_dnstairs(sroom))
|
||||
continue;
|
||||
@@ -542,7 +542,7 @@ mkswamp() /* Michiel Huisjes & Fred de Wilde */
|
||||
(void) makemon(mkclass(S_FUNGUS, 0), sx, sy,
|
||||
NO_MM_FLAGS);
|
||||
}
|
||||
level.flags.has_swamp = 1;
|
||||
g.level.flags.has_swamp = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -552,7 +552,7 @@ int roomno;
|
||||
{
|
||||
static coord buf;
|
||||
int delta;
|
||||
struct mkroom *troom = &rooms[roomno - ROOMOFFSET];
|
||||
struct mkroom *troom = &g.rooms[roomno - ROOMOFFSET];
|
||||
|
||||
/* if width and height are odd, placement will be the exact center;
|
||||
if either or both are even, center point is a hypothetical spot
|
||||
@@ -584,13 +584,13 @@ mktemple()
|
||||
* In temples, shrines are blessed altars
|
||||
* located in the center of the room
|
||||
*/
|
||||
shrine_spot = shrine_pos((int) ((sroom - rooms) + ROOMOFFSET));
|
||||
shrine_spot = shrine_pos((int) ((sroom - g.rooms) + ROOMOFFSET));
|
||||
lev = &levl[shrine_spot->x][shrine_spot->y];
|
||||
lev->typ = ALTAR;
|
||||
lev->altarmask = induced_align(80);
|
||||
priestini(&u.uz, sroom, shrine_spot->x, shrine_spot->y, FALSE);
|
||||
lev->altarmask |= AM_SHRINE;
|
||||
level.flags.has_temple = 1;
|
||||
g.level.flags.has_temple = 1;
|
||||
}
|
||||
|
||||
boolean
|
||||
@@ -665,7 +665,7 @@ coord *c;
|
||||
int i;
|
||||
|
||||
if (croom->irregular) {
|
||||
i = (int) ((croom - rooms) + ROOMOFFSET);
|
||||
i = (int) ((croom - g.rooms) + ROOMOFFSET);
|
||||
|
||||
while (try_cnt++ < 100) {
|
||||
c->x = somex(croom);
|
||||
@@ -719,12 +719,12 @@ schar type;
|
||||
{
|
||||
register struct mkroom *croom;
|
||||
|
||||
for (croom = &rooms[0]; croom->hx >= 0; croom++)
|
||||
for (croom = &g.rooms[0]; croom->hx >= 0; croom++)
|
||||
if ((type == ANY_TYPE && croom->rtype != OROOM)
|
||||
|| (type == ANY_SHOP && croom->rtype >= SHOPBASE)
|
||||
|| croom->rtype == type)
|
||||
return croom;
|
||||
for (croom = &subrooms[0]; croom->hx >= 0; croom++)
|
||||
for (croom = &g.subrooms[0]; croom->hx >= 0; croom++)
|
||||
if ((type == ANY_TYPE && croom->rtype != OROOM)
|
||||
|| (type == ANY_SHOP && croom->rtype >= SHOPBASE)
|
||||
|| croom->rtype == type)
|
||||
@@ -805,7 +805,7 @@ struct mkroom *r;
|
||||
/*
|
||||
* Well, I really should write only useful information instead
|
||||
* of writing the whole structure. That is I should not write
|
||||
* the subrooms pointers, but who cares ?
|
||||
* the g.subrooms pointers, but who cares ?
|
||||
*/
|
||||
bwrite(fd, (genericptr_t) r, sizeof (struct mkroom));
|
||||
for (i = 0; i < r->nsubrooms; i++)
|
||||
@@ -824,7 +824,7 @@ int fd;
|
||||
/* First, write the number of rooms */
|
||||
bwrite(fd, (genericptr_t) &g.nroom, sizeof(g.nroom));
|
||||
for (i = 0; i < g.nroom; i++)
|
||||
save_room(fd, &rooms[i]);
|
||||
save_room(fd, &g.rooms[i]);
|
||||
}
|
||||
|
||||
STATIC_OVL void
|
||||
@@ -836,9 +836,9 @@ struct mkroom *r;
|
||||
|
||||
mread(fd, (genericptr_t) r, sizeof(struct mkroom));
|
||||
for (i = 0; i < r->nsubrooms; i++) {
|
||||
r->sbrooms[i] = &subrooms[g.nsubroom];
|
||||
rest_room(fd, &subrooms[g.nsubroom]);
|
||||
subrooms[g.nsubroom++].resident = (struct monst *) 0;
|
||||
r->sbrooms[i] = &g.subrooms[g.nsubroom];
|
||||
rest_room(fd, &g.subrooms[g.nsubroom]);
|
||||
g.subrooms[g.nsubroom++].resident = (struct monst *) 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -855,11 +855,11 @@ int fd;
|
||||
mread(fd, (genericptr_t) &g.nroom, sizeof(g.nroom));
|
||||
g.nsubroom = 0;
|
||||
for (i = 0; i < g.nroom; i++) {
|
||||
rest_room(fd, &rooms[i]);
|
||||
rooms[i].resident = (struct monst *) 0;
|
||||
rest_room(fd, &g.rooms[i]);
|
||||
g.rooms[i].resident = (struct monst *) 0;
|
||||
}
|
||||
rooms[g.nroom].hx = -1; /* restore ending flags */
|
||||
subrooms[g.nsubroom].hx = -1;
|
||||
g.rooms[g.nroom].hx = -1; /* restore ending flags */
|
||||
g.subrooms[g.nsubroom].hx = -1;
|
||||
}
|
||||
|
||||
/* convert a display symbol for terrain into topology type;
|
||||
|
||||
Reference in New Issue
Block a user