WIZKIT overflow tweak (trunk only)
Redo the $WIZKIT overflow handling from a few days ago. Instead of having two migration codes which both mean "with the hero", combine them and add a mask flag to control scattering at the destination to be able to get the alternate behavior.
This commit is contained in:
@@ -141,9 +141,9 @@ typedef struct branch {
|
||||
#define MIGR_LADDER_DOWN 6
|
||||
#define MIGR_SSTAIRS 7 /* dungeon branch */
|
||||
#define MIGR_PORTAL 8 /* magic portal */
|
||||
#define MIGR_NEAR_PLAYER 9 /* mon: followers; obj: trap door */
|
||||
#define MIGR_AT_HERO 10 /* wizkit overflow */
|
||||
#define MIGR_WITH_HERO 9 /* mon: followers; obj: trap door */
|
||||
#define MIGR_NOBREAK 1024 /* bitmask: don't break on delivery */
|
||||
#define MIGR_NOSCATTER 2048 /* don't scatter on delivery */
|
||||
|
||||
/* level information (saved via ledger number) */
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ boolean with_you;
|
||||
break;
|
||||
case MIGR_EXACT_XY: wander = 0;
|
||||
break;
|
||||
case MIGR_NEAR_PLAYER: xlocale = u.ux, ylocale = u.uy;
|
||||
case MIGR_WITH_HERO: xlocale = u.ux, ylocale = u.uy;
|
||||
break;
|
||||
case MIGR_STAIRS_UP: xlocale = xupstair, ylocale = yupstair;
|
||||
break;
|
||||
|
||||
21
src/dokick.c
21
src/dokick.c
@@ -1207,7 +1207,7 @@ xchar dlev; /* if !0 send to dlev near player */
|
||||
/* send objects next to player falling through trap door.
|
||||
* checked in obj_delivery().
|
||||
*/
|
||||
toloc = MIGR_NEAR_PLAYER;
|
||||
toloc = MIGR_WITH_HERO;
|
||||
cc.y = dlev;
|
||||
}
|
||||
|
||||
@@ -1429,32 +1429,31 @@ boolean near_hero;
|
||||
{
|
||||
register struct obj *otmp, *otmp2;
|
||||
register int nx, ny;
|
||||
long where;
|
||||
boolean nobreak, noscatter = FALSE;
|
||||
int where;
|
||||
boolean nobreak, noscatter;
|
||||
|
||||
for (otmp = migrating_objs; otmp; otmp = otmp2) {
|
||||
otmp2 = otmp->nobj;
|
||||
if (otmp->ox != u.uz.dnum || otmp->oy != u.uz.dlevel) continue;
|
||||
|
||||
where = otmp->owornmask; /* destination code */
|
||||
where = (int)(otmp->owornmask & 0x7fffL); /* destination code */
|
||||
nobreak = (where & MIGR_NOBREAK) != 0;
|
||||
where &= ~MIGR_NOBREAK;
|
||||
noscatter = (where & MIGR_WITH_HERO) != 0;
|
||||
where &= ~(MIGR_NOBREAK | MIGR_NOSCATTER);
|
||||
|
||||
if ((!near_hero && where == MIGR_NEAR_PLAYER) ||
|
||||
(near_hero && where != MIGR_NEAR_PLAYER)) continue;
|
||||
if (!near_hero ^ (where == MIGR_WITH_HERO)) continue;
|
||||
|
||||
obj_extract_self(otmp);
|
||||
otmp->owornmask = 0L;
|
||||
|
||||
switch ((int)where) {
|
||||
switch (where) {
|
||||
case MIGR_STAIRS_UP: nx = xupstair, ny = yupstair;
|
||||
break;
|
||||
case MIGR_LADDER_UP: nx = xupladder, ny = yupladder;
|
||||
break;
|
||||
case MIGR_SSTAIRS: nx = sstairs.sx, ny = sstairs.sy;
|
||||
break;
|
||||
case MIGR_AT_HERO: noscatter = TRUE; /*FALLTHRU*/
|
||||
case MIGR_NEAR_PLAYER: nx = u.ux, ny = u.uy;
|
||||
case MIGR_WITH_HERO: nx = u.ux, ny = u.uy;
|
||||
break;
|
||||
default:
|
||||
case MIGR_RANDOM: nx = ny = 0;
|
||||
@@ -1463,7 +1462,7 @@ boolean near_hero;
|
||||
if (nx > 0) {
|
||||
place_object(otmp, nx, ny);
|
||||
if (!nobreak && !IS_SOFT(levl[nx][ny].typ)) {
|
||||
if (where == MIGR_NEAR_PLAYER) {
|
||||
if (where == MIGR_WITH_HERO) {
|
||||
if (breaks(otmp, nx, ny)) continue;
|
||||
} else if (breaktest(otmp)) {
|
||||
/* assume it broke before player arrived, no messages */
|
||||
|
||||
@@ -2428,7 +2428,7 @@ struct obj *obj;
|
||||
add_to_migration(obj);
|
||||
obj->ox = 0; /* index of main dungeon */
|
||||
obj->oy = 1; /* starting level number */
|
||||
obj->owornmask = (long)(MIGR_AT_HERO|MIGR_NOBREAK);
|
||||
obj->owornmask = (long)(MIGR_WITH_HERO | MIGR_NOBREAK|MIGR_NOSCATTER);
|
||||
} else {
|
||||
(void)addinv(obj);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user