bubble/cloud save/restore overhaul
The air bubbles on the Plane of Water and the clouds on the Plane of Air were being saved and restored as part of the current level's state (which is the 'u' struct and invent and such) rather than with the current level itself. That was ok for normal play, but for wizard mode's ^V allowing you to return to a previously visited endgame level after moving to a different one it meant a new set of bubbles for Water and new set of clouds for Air. Even that was ok since it only applied to wizard mode, but using #wizmakemap to recreate Water or Air while you were on it added a new set of bubbles or clouds to the existing ones. If repeated, eventually there wouldn't be much water or air left. Instead of just adding a hack to #wizmakemap, change save/restore to keep the bubbles/clouds with the level rather than with the state. That wasn't trivial and now I know why the old odd arrangement was chosen. Saving hides u.uz by zeroing it out for levels that the hero isn't on and it is zero during restore so simple checks for whether a given level is water or air won't work. This also adds another non-file/non-debugpline() use of DEBUGFILES: DEBUGFILES=seethru nethack -D will make water and clouds be transparent instead of opaque. It also makes fumaroles and other light-blocking gas clouds be transparent which wasn't really intended, but avoiding it would be extra work that doesn't accomplish much. Increments EDITLEVEL for the third time this week....
This commit is contained in:
@@ -30,6 +30,7 @@ static void ghostfruit(struct obj *);
|
||||
static boolean restgamestate(NHFILE *, unsigned int *, unsigned int *);
|
||||
static void restlevelstate(unsigned int, unsigned int);
|
||||
static int restlevelfile(xchar);
|
||||
static void rest_bubbles(NHFILE *);
|
||||
static void restore_gamelog(NHFILE *);
|
||||
static void restore_msghistory(NHFILE *);
|
||||
static void reset_oattached_mids(boolean);
|
||||
@@ -683,7 +684,6 @@ restgamestate(NHFILE* nhfp, unsigned int* stuckid, unsigned int* steedid)
|
||||
g.ffruit = loadfruitchn(nhfp);
|
||||
|
||||
restnames(nhfp);
|
||||
restore_waterlevel(nhfp);
|
||||
restore_msghistory(nhfp);
|
||||
restore_gamelog(nhfp);
|
||||
/* must come after all mons & objs are restored */
|
||||
@@ -1127,6 +1127,7 @@ getlev(NHFILE* nhfp, int pid, xchar lev)
|
||||
}
|
||||
restdamage(nhfp);
|
||||
rest_regions(nhfp);
|
||||
rest_bubbles(nhfp); /* for water and air; empty marker on other levels */
|
||||
|
||||
if (ghostly) {
|
||||
stairway *stway = g.stairs;
|
||||
@@ -1217,6 +1218,23 @@ get_plname_from_file(NHFILE* nhfp, char *plbuf)
|
||||
return;
|
||||
}
|
||||
|
||||
/* restore Plane of Water's air bubbles and Plane of Air's clouds */
|
||||
static void
|
||||
rest_bubbles(NHFILE *nhfp)
|
||||
{
|
||||
xchar bbubbly;
|
||||
|
||||
/* whether or not the Plane of Water's air bubbles or Plane of Air's
|
||||
clouds are present is recorded during save so that we don't have to
|
||||
know what level is being restored */
|
||||
bbubbly = 0;
|
||||
if (nhfp->structlevel)
|
||||
mread(nhfp->fd, (genericptr_t) &bbubbly, sizeof bbubbly);
|
||||
|
||||
if (bbubbly)
|
||||
restore_waterlevel(nhfp);
|
||||
}
|
||||
|
||||
static void
|
||||
restore_gamelog(NHFILE* nhfp)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user