Last big push for moving globals to instance_globals.
This commit is contained in:
@@ -621,6 +621,23 @@ struct musable {
|
|||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct h2o_ctx {
|
||||||
|
int dkn_boom, unk_boom; /* track dknown, !dknown separately */
|
||||||
|
boolean ctx_valid;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct launchplace {
|
||||||
|
struct obj *obj;
|
||||||
|
xchar x, y;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct repo { /* repossession context */
|
||||||
|
struct monst *shopkeeper;
|
||||||
|
coord location;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* instance_globals holds engine state that does not need to be
|
/* instance_globals holds engine state that does not need to be
|
||||||
* persisted upon game exit. The initialization state is well defined
|
* persisted upon game exit. The initialization state is well defined
|
||||||
* an set in decl.c during early early engine initialization.
|
* an set in decl.c during early early engine initialization.
|
||||||
@@ -629,6 +646,7 @@ struct musable {
|
|||||||
|
|
||||||
#define BSIZE 20
|
#define BSIZE 20
|
||||||
#define WIZKIT_MAX 128
|
#define WIZKIT_MAX 128
|
||||||
|
#define CVT_BUF_SIZE 64
|
||||||
|
|
||||||
struct instance_globals {
|
struct instance_globals {
|
||||||
|
|
||||||
@@ -859,6 +877,14 @@ struct instance_globals {
|
|||||||
and use_container(). Also used by menu_loot() and container_gone(). */
|
and use_container(). Also used by menu_loot() and container_gone(). */
|
||||||
struct obj *current_container;
|
struct obj *current_container;
|
||||||
boolean abort_looting;
|
boolean abort_looting;
|
||||||
|
/* Value set by query_objlist() for n_or_more(). */
|
||||||
|
long val_for_n_or_more;
|
||||||
|
/* list of valid menu classes for query_objlist() and allow_category callback
|
||||||
|
(with room for all object classes, 'u'npaid, BUCX, and terminator) */
|
||||||
|
char valid_menu_classes[MAXOCLASSES + 1 + 4 + 1];
|
||||||
|
boolean class_filter;
|
||||||
|
boolean bucx_filter;
|
||||||
|
boolean shop_filter;
|
||||||
|
|
||||||
/* pline.c */
|
/* pline.c */
|
||||||
unsigned pline_flags;
|
unsigned pline_flags;
|
||||||
@@ -867,6 +893,9 @@ struct instance_globals {
|
|||||||
unsigned saved_pline_index; /* slot in saved_plines[] to use next */
|
unsigned saved_pline_index; /* slot in saved_plines[] to use next */
|
||||||
char *saved_plines[DUMPLOG_MSG_COUNT];
|
char *saved_plines[DUMPLOG_MSG_COUNT];
|
||||||
#endif
|
#endif
|
||||||
|
/* work buffer for You(), &c and verbalize() */
|
||||||
|
char *you_buf;
|
||||||
|
int you_buf_siz;
|
||||||
|
|
||||||
/* polyself.c */
|
/* polyself.c */
|
||||||
int sex_change_ok; /* controls whether taking on new form or becoming new
|
int sex_change_ok; /* controls whether taking on new form or becoming new
|
||||||
@@ -884,6 +913,12 @@ struct instance_globals {
|
|||||||
int p_trouble;
|
int p_trouble;
|
||||||
int p_type; /* (-1)-3: (-1)=really naughty, 3=really good */
|
int p_type; /* (-1)-3: (-1)=really naughty, 3=really good */
|
||||||
|
|
||||||
|
/* questpgr.c */
|
||||||
|
char cvt_buf[CVT_BUF_SIZE];
|
||||||
|
struct qtlists qt_list;
|
||||||
|
struct dlb_handle *msg_file;
|
||||||
|
/* used by ldrname() and neminame(), then copied into cvt_buf */
|
||||||
|
char nambuf[CVT_BUF_SIZE];
|
||||||
|
|
||||||
/* read.c */
|
/* read.c */
|
||||||
boolean known;
|
boolean known;
|
||||||
@@ -914,14 +949,60 @@ struct instance_globals {
|
|||||||
unsigned ustuck_id; /* need to preserve during save */
|
unsigned ustuck_id; /* need to preserve during save */
|
||||||
unsigned usteed_id; /* need to preserve during save */
|
unsigned usteed_id; /* need to preserve during save */
|
||||||
|
|
||||||
|
/* shk.c */
|
||||||
|
/* auto-response flag for/from "sell foo?" 'a' => 'y', 'q' => 'n' */
|
||||||
|
char sell_response;
|
||||||
|
int sell_how;
|
||||||
|
/* can't just use sell_response='y' for auto_credit because the 'a' response
|
||||||
|
shouldn't carry over from ordinary selling to credit selling */
|
||||||
|
boolean auto_credit;
|
||||||
|
struct repo repo;
|
||||||
|
|
||||||
/* sp_lev.c */
|
/* sp_lev.c */
|
||||||
char *lev_message;
|
char *lev_message;
|
||||||
lev_region *lregions;
|
lev_region *lregions;
|
||||||
int num_lregions;
|
int num_lregions;
|
||||||
|
/* positions touched by level elements explicitly defined in the des-file */
|
||||||
|
char SpLev_Map[COLNO][ROWNO];
|
||||||
|
xchar xstart, ystart;
|
||||||
|
char xsize, ysize;
|
||||||
|
boolean splev_init_present;
|
||||||
|
boolean icedpools;
|
||||||
|
int mines_prize_count;
|
||||||
|
int soko_prize_count; /* achievements */
|
||||||
|
struct obj *container_obj[MAX_CONTAINMENT];
|
||||||
|
int container_idx;
|
||||||
|
struct monst *invent_carrying_monster;
|
||||||
|
aligntyp ralign[3];
|
||||||
|
|
||||||
|
/* spells.c */
|
||||||
|
int spl_sortmode; /* index into spl_sortchoices[] */
|
||||||
|
int *spl_orderindx; /* array of spl_book[] indices */
|
||||||
|
|
||||||
|
/* timeout.c */
|
||||||
|
/* ordered timer list */
|
||||||
|
struct fe *timer_base; /* "active" */
|
||||||
|
unsigned long timer_id;
|
||||||
|
|
||||||
|
/* topten.c */
|
||||||
|
winid toptenwin;
|
||||||
|
|
||||||
|
|
||||||
/* trap.c */
|
/* trap.c */
|
||||||
int force_mintrap; /* mintrap() should take a flags argument, but for time
|
int force_mintrap; /* mintrap() should take a flags argument, but for time
|
||||||
being we use this */
|
being we use this */
|
||||||
|
/* context for water_damage(), managed by water_damage_chain();
|
||||||
|
when more than one stack of potions of acid explode while processing
|
||||||
|
a chain of objects, use alternate phrasing after the first message */
|
||||||
|
struct h2o_ctx acid_ctx;
|
||||||
|
/*
|
||||||
|
* The following are used to track launched objects to
|
||||||
|
* prevent them from vanishing if you are killed. They
|
||||||
|
* will reappear at the launchplace in bones files.
|
||||||
|
*/
|
||||||
|
struct launchplace launchplace;
|
||||||
|
|
||||||
|
|
||||||
/* u_init.c */
|
/* u_init.c */
|
||||||
short nocreate;
|
short nocreate;
|
||||||
short nocreate2;
|
short nocreate2;
|
||||||
@@ -930,8 +1011,13 @@ struct instance_globals {
|
|||||||
/* uhitm.c */
|
/* uhitm.c */
|
||||||
boolean override_confirmation; /* Used to flag attacks caused by
|
boolean override_confirmation; /* Used to flag attacks caused by
|
||||||
Stormbringer's maliciousness. */
|
Stormbringer's maliciousness. */
|
||||||
|
|
||||||
/* weapon.c */
|
/* weapon.c */
|
||||||
struct obj *propellor;
|
struct obj *propellor;
|
||||||
|
|
||||||
|
/* windows.c */
|
||||||
|
struct win_choices *last_winchoice;
|
||||||
|
|
||||||
/* zap.c */
|
/* zap.c */
|
||||||
int poly_zapped;
|
int poly_zapped;
|
||||||
boolean obj_zapped;
|
boolean obj_zapped;
|
||||||
|
|||||||
@@ -167,6 +167,9 @@ typedef struct strbuf {
|
|||||||
char buf[256];
|
char buf[256];
|
||||||
} strbuf_t;
|
} strbuf_t;
|
||||||
|
|
||||||
|
/* max. layers of object containment from sp_lev.h */
|
||||||
|
#define MAX_CONTAINMENT 10
|
||||||
|
|
||||||
/* str_or_len from sp_lev.h */
|
/* str_or_len from sp_lev.h */
|
||||||
typedef union str_or_len {
|
typedef union str_or_len {
|
||||||
char *str;
|
char *str;
|
||||||
@@ -198,6 +201,7 @@ typedef struct {
|
|||||||
#include "context.h"
|
#include "context.h"
|
||||||
#include "rm.h"
|
#include "rm.h"
|
||||||
#include "botl.h"
|
#include "botl.h"
|
||||||
|
#include "qtext.h"
|
||||||
|
|
||||||
/* Symbol offsets */
|
/* Symbol offsets */
|
||||||
#define SYM_OFF_P (0)
|
#define SYM_OFF_P (0)
|
||||||
|
|||||||
@@ -42,9 +42,6 @@ enum lvlinit_types {
|
|||||||
LVLINIT_ROGUE
|
LVLINIT_ROGUE
|
||||||
};
|
};
|
||||||
|
|
||||||
/* max. layers of object containment */
|
|
||||||
#define MAX_CONTAINMENT 10
|
|
||||||
|
|
||||||
/* max. # of random registers */
|
/* max. # of random registers */
|
||||||
#define MAX_REGISTERS 10
|
#define MAX_REGISTERS 10
|
||||||
|
|
||||||
|
|||||||
+48
@@ -512,6 +512,11 @@ const struct instance_globals g_init = {
|
|||||||
0, /* oldcap */
|
0, /* oldcap */
|
||||||
UNDEFINED_PTR, /* current_container */
|
UNDEFINED_PTR, /* current_container */
|
||||||
UNDEFINED_VALUE, /* abort_looting */
|
UNDEFINED_VALUE, /* abort_looting */
|
||||||
|
UNDEFINED_VALUE, /* val_for_n_or_more */
|
||||||
|
UNDEFINED_VALUES, /* valid_menu_classes */
|
||||||
|
UNDEFINED_VALUE, /* class_filter */
|
||||||
|
UNDEFINED_VALUE, /* bucx_filter */
|
||||||
|
UNDEFINED_VALUE, /* shop_filter */
|
||||||
|
|
||||||
/* pline.c */
|
/* pline.c */
|
||||||
0, /* pline_flags */
|
0, /* pline_flags */
|
||||||
@@ -520,6 +525,8 @@ const struct instance_globals g_init = {
|
|||||||
0, /* saved_pline_index */
|
0, /* saved_pline_index */
|
||||||
UNDEFINED_VALUES,
|
UNDEFINED_VALUES,
|
||||||
#endif
|
#endif
|
||||||
|
NULL, /* you_buf */
|
||||||
|
0, /* you_buf_siz */
|
||||||
|
|
||||||
/* polyself.c */
|
/* polyself.c */
|
||||||
0, /* sex_change_ok */
|
0, /* sex_change_ok */
|
||||||
@@ -534,6 +541,12 @@ const struct instance_globals g_init = {
|
|||||||
UNDEFINED_VALUE, /* p_trouble */
|
UNDEFINED_VALUE, /* p_trouble */
|
||||||
UNDEFINED_VALUE, /* p_type */
|
UNDEFINED_VALUE, /* p_type */
|
||||||
|
|
||||||
|
/* questpgr.c */
|
||||||
|
UNDEFINED_VALUES, /* cvt_buf */
|
||||||
|
UNDEFINED_VALUES, /* qt_list */
|
||||||
|
UNDEFINED_PTR, /* msg_file */
|
||||||
|
UNDEFINED_VALUES, /* nambuf */
|
||||||
|
|
||||||
/* read.c */
|
/* read.c */
|
||||||
UNDEFINED_VALUE, /* known */
|
UNDEFINED_VALUE, /* known */
|
||||||
|
|
||||||
@@ -560,13 +573,45 @@ const struct instance_globals g_init = {
|
|||||||
0, /* ustuck_id */
|
0, /* ustuck_id */
|
||||||
0, /* usteed_id */
|
0, /* usteed_id */
|
||||||
|
|
||||||
|
/* shk.c */
|
||||||
|
'a', /* sell_response */
|
||||||
|
SELL_NORMAL, /* sell_how */
|
||||||
|
FALSE, /* auto_credit */
|
||||||
|
UNDEFINED_VALUES, /* repo */
|
||||||
|
|
||||||
/* sp_lev.c */
|
/* sp_lev.c */
|
||||||
NULL, /* lev_message */
|
NULL, /* lev_message */
|
||||||
NULL, /* lregions */
|
NULL, /* lregions */
|
||||||
0, /* num_lregions */
|
0, /* num_lregions */
|
||||||
|
UNDEFINED_VALUES, /* SplLev_Map */
|
||||||
|
UNDEFINED_VALUE, /* xstart */
|
||||||
|
UNDEFINED_VALUE, /* ystart */
|
||||||
|
UNDEFINED_VALUE, /* xsize */
|
||||||
|
UNDEFINED_VALUE, /* ysize */
|
||||||
|
FALSE, /* splev_init_present */
|
||||||
|
FALSE, /* icedpools */
|
||||||
|
0, /* mines_prize_count */
|
||||||
|
0, /* soki_prize_count */
|
||||||
|
{ UNDEFINED_PTR }, /* container_obj */
|
||||||
|
0, /* container_idx */
|
||||||
|
NULL, /* invent_carrying_monster */
|
||||||
|
{ AM_CHAOTIC, AM_NEUTRAL, AM_LAWFUL }, /* ralign */
|
||||||
|
|
||||||
|
/* spells.c */
|
||||||
|
0, /* spl_sortmode */
|
||||||
|
NULL, /* spl_orderindx */
|
||||||
|
|
||||||
|
/* timeout.c */
|
||||||
|
UNDEFINED_PTR, /* timer_base */
|
||||||
|
1, /* timer_id */
|
||||||
|
|
||||||
|
/* topten.c */
|
||||||
|
WIN_ERR, /* topten */
|
||||||
|
|
||||||
/* trap.c */
|
/* trap.c */
|
||||||
0, /* force_mintrap */
|
0, /* force_mintrap */
|
||||||
|
{ 0, 0, FALSE },
|
||||||
|
UNDEFINED_VALUES,
|
||||||
|
|
||||||
/* u_init.c */
|
/* u_init.c */
|
||||||
STRANGE_OBJECT, /* nocreate */
|
STRANGE_OBJECT, /* nocreate */
|
||||||
@@ -580,6 +625,9 @@ const struct instance_globals g_init = {
|
|||||||
/* weapon.c */
|
/* weapon.c */
|
||||||
UNDEFINED_PTR, /* propellor */
|
UNDEFINED_PTR, /* propellor */
|
||||||
|
|
||||||
|
/* windows.c */
|
||||||
|
NULL, /* last_winchoice */
|
||||||
|
|
||||||
/* zap.c */
|
/* zap.c */
|
||||||
UNDEFINED_VALUE, /* poly_zap */
|
UNDEFINED_VALUE, /* poly_zap */
|
||||||
UNDEFINED_VALUE, /* obj_zapped */
|
UNDEFINED_VALUE, /* obj_zapped */
|
||||||
|
|||||||
+1
-1
@@ -1910,7 +1910,7 @@ domenucontrols(VOID_ARGS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* data for dohelp() */
|
/* data for dohelp() */
|
||||||
static struct {
|
static const struct {
|
||||||
void NDECL((*f));
|
void NDECL((*f));
|
||||||
const char *text;
|
const char *text;
|
||||||
} help_menu_items[] = {
|
} help_menu_items[] = {
|
||||||
|
|||||||
+20
-27
@@ -310,9 +310,6 @@ boolean picked_some;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Value set by query_objlist() for n_or_more(). */
|
|
||||||
static long val_for_n_or_more;
|
|
||||||
|
|
||||||
/* query_objlist callback: return TRUE if obj's count is >= reference value */
|
/* query_objlist callback: return TRUE if obj's count is >= reference value */
|
||||||
STATIC_OVL boolean
|
STATIC_OVL boolean
|
||||||
n_or_more(obj)
|
n_or_more(obj)
|
||||||
@@ -320,20 +317,16 @@ struct obj *obj;
|
|||||||
{
|
{
|
||||||
if (obj == uchain)
|
if (obj == uchain)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return (boolean) (obj->quan >= val_for_n_or_more);
|
return (boolean) (obj->quan >= g.val_for_n_or_more);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* list of valid menu classes for query_objlist() and allow_category callback
|
|
||||||
(with room for all object classes, 'u'npaid, BUCX, and terminator) */
|
|
||||||
static char valid_menu_classes[MAXOCLASSES + 1 + 4 + 1];
|
|
||||||
static boolean class_filter, bucx_filter, shop_filter;
|
|
||||||
|
|
||||||
/* check valid_menu_classes[] for an entry; also used by askchain() */
|
/* check valid_menu_classes[] for an entry; also used by askchain() */
|
||||||
boolean
|
boolean
|
||||||
menu_class_present(c)
|
menu_class_present(c)
|
||||||
int c;
|
int c;
|
||||||
{
|
{
|
||||||
return (c && index(valid_menu_classes, c)) ? TRUE : FALSE;
|
return (c && index(g.valid_menu_classes, c)) ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -344,26 +337,26 @@ int c;
|
|||||||
|
|
||||||
if (c == 0) { /* reset */
|
if (c == 0) { /* reset */
|
||||||
vmc_count = 0;
|
vmc_count = 0;
|
||||||
class_filter = bucx_filter = shop_filter = FALSE;
|
g.class_filter = g.bucx_filter = g.shop_filter = FALSE;
|
||||||
} else if (!menu_class_present(c)) {
|
} else if (!menu_class_present(c)) {
|
||||||
valid_menu_classes[vmc_count++] = (char) c;
|
g.valid_menu_classes[vmc_count++] = (char) c;
|
||||||
/* categorize the new class */
|
/* categorize the new class */
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'B':
|
case 'B':
|
||||||
case 'U':
|
case 'U':
|
||||||
case 'C': /*FALLTHRU*/
|
case 'C': /*FALLTHRU*/
|
||||||
case 'X':
|
case 'X':
|
||||||
bucx_filter = TRUE;
|
g.bucx_filter = TRUE;
|
||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
shop_filter = TRUE;
|
g.shop_filter = TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
class_filter = TRUE;
|
g.class_filter = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
valid_menu_classes[vmc_count] = '\0';
|
g.valid_menu_classes[vmc_count] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* query_objlist callback: return TRUE if not uchain */
|
/* query_objlist callback: return TRUE if not uchain */
|
||||||
@@ -394,12 +387,12 @@ struct obj *obj;
|
|||||||
* coins are either unknown or uncursed based on an option setting.
|
* coins are either unknown or uncursed based on an option setting.
|
||||||
*/
|
*/
|
||||||
if (obj->oclass == COIN_CLASS)
|
if (obj->oclass == COIN_CLASS)
|
||||||
return class_filter
|
return g.class_filter
|
||||||
? (index(valid_menu_classes, COIN_CLASS) ? TRUE : FALSE)
|
? (index(g.valid_menu_classes, COIN_CLASS) ? TRUE : FALSE)
|
||||||
: shop_filter /* coins are never unpaid, but check anyway */
|
: g.shop_filter /* coins are never unpaid, but check anyway */
|
||||||
? (obj->unpaid ? TRUE : FALSE)
|
? (obj->unpaid ? TRUE : FALSE)
|
||||||
: bucx_filter
|
: g.bucx_filter
|
||||||
? (index(valid_menu_classes, iflags.goldX ? 'X' : 'U')
|
? (index(g.valid_menu_classes, iflags.goldX ? 'X' : 'U')
|
||||||
? TRUE : FALSE)
|
? TRUE : FALSE)
|
||||||
: TRUE; /* catchall: no filters specified, so accept */
|
: TRUE; /* catchall: no filters specified, so accept */
|
||||||
|
|
||||||
@@ -424,21 +417,21 @@ struct obj *obj;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* if class is expected but obj's class is not in the list, reject */
|
/* if class is expected but obj's class is not in the list, reject */
|
||||||
if (class_filter && !index(valid_menu_classes, obj->oclass))
|
if (g.class_filter && !index(g.valid_menu_classes, obj->oclass))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
/* if unpaid is expected and obj isn't unpaid, reject (treat a container
|
/* if unpaid is expected and obj isn't unpaid, reject (treat a container
|
||||||
holding any unpaid object as unpaid even if isn't unpaid itself) */
|
holding any unpaid object as unpaid even if isn't unpaid itself) */
|
||||||
if (shop_filter && !obj->unpaid
|
if (g.shop_filter && !obj->unpaid
|
||||||
&& !(Has_contents(obj) && count_unpaid(obj->cobj) > 0))
|
&& !(Has_contents(obj) && count_unpaid(obj->cobj) > 0))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
/* check for particular bless/curse state */
|
/* check for particular bless/curse state */
|
||||||
if (bucx_filter) {
|
if (g.bucx_filter) {
|
||||||
/* first categorize this object's bless/curse state */
|
/* first categorize this object's bless/curse state */
|
||||||
char bucx = !obj->bknown ? 'X'
|
char bucx = !obj->bknown ? 'X'
|
||||||
: obj->blessed ? 'B' : obj->cursed ? 'C' : 'U';
|
: obj->blessed ? 'B' : obj->cursed ? 'C' : 'U';
|
||||||
|
|
||||||
/* if its category is not in the list, reject */
|
/* if its category is not in the list, reject */
|
||||||
if (!index(valid_menu_classes, bucx))
|
if (!index(g.valid_menu_classes, bucx))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
/* obj didn't fail any of the filter checks, so accept */
|
/* obj didn't fail any of the filter checks, so accept */
|
||||||
@@ -452,8 +445,8 @@ allow_cat_no_uchain(obj)
|
|||||||
struct obj *obj;
|
struct obj *obj;
|
||||||
{
|
{
|
||||||
if (obj != uchain
|
if (obj != uchain
|
||||||
&& ((index(valid_menu_classes, 'u') && obj->unpaid)
|
&& ((index(g.valid_menu_classes, 'u') && obj->unpaid)
|
||||||
|| index(valid_menu_classes, obj->oclass)))
|
|| index(g.valid_menu_classes, obj->oclass)))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -569,7 +562,7 @@ int what; /* should be a long */
|
|||||||
char qbuf[QBUFSZ];
|
char qbuf[QBUFSZ];
|
||||||
|
|
||||||
Sprintf(qbuf, "Pick %d of what?", count);
|
Sprintf(qbuf, "Pick %d of what?", count);
|
||||||
val_for_n_or_more = count; /* set up callback selector */
|
g.val_for_n_or_more = count; /* set up callback selector */
|
||||||
n = query_objlist(qbuf, objchain_p, traverse_how,
|
n = query_objlist(qbuf, objchain_p, traverse_how,
|
||||||
&pick_list, PICK_ONE, n_or_more);
|
&pick_list, PICK_ONE, n_or_more);
|
||||||
/* correct counts, if any given */
|
/* correct counts, if any given */
|
||||||
|
|||||||
+9
-13
@@ -219,29 +219,25 @@ VA_DECL(const char *, line)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* work buffer for You(), &c and verbalize() */
|
|
||||||
static char *you_buf = 0;
|
|
||||||
static int you_buf_siz = 0;
|
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
You_buf(siz)
|
You_buf(siz)
|
||||||
int siz;
|
int siz;
|
||||||
{
|
{
|
||||||
if (siz > you_buf_siz) {
|
if (siz > g.you_buf_siz) {
|
||||||
if (you_buf)
|
if (g.you_buf)
|
||||||
free((genericptr_t) you_buf);
|
free((genericptr_t) g.you_buf);
|
||||||
you_buf_siz = siz + 10;
|
g.you_buf_siz = siz + 10;
|
||||||
you_buf = (char *) alloc((unsigned) you_buf_siz);
|
g.you_buf = (char *) alloc((unsigned) g.you_buf_siz);
|
||||||
}
|
}
|
||||||
return you_buf;
|
return g.you_buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
free_youbuf()
|
free_youbuf()
|
||||||
{
|
{
|
||||||
if (you_buf)
|
if (g.you_buf)
|
||||||
free((genericptr_t) you_buf), you_buf = (char *) 0;
|
free((genericptr_t) g.you_buf), g.you_buf = (char *) 0;
|
||||||
you_buf_siz = 0;
|
g.you_buf_siz = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* `prefix' must be a string literal, not a pointer */
|
/* `prefix' must be a string literal, not a pointer */
|
||||||
|
|||||||
+50
-56
@@ -31,12 +31,6 @@ STATIC_DCL void FDECL(deliver_by_pline, (struct qtmsg *));
|
|||||||
STATIC_DCL void FDECL(deliver_by_window, (struct qtmsg *, int));
|
STATIC_DCL void FDECL(deliver_by_window, (struct qtmsg *, int));
|
||||||
STATIC_DCL boolean FDECL(skip_pager, (BOOLEAN_P));
|
STATIC_DCL boolean FDECL(skip_pager, (BOOLEAN_P));
|
||||||
|
|
||||||
static char cvt_buf[64];
|
|
||||||
static struct qtlists qt_list;
|
|
||||||
static dlb *msg_file;
|
|
||||||
/* used by ldrname() and neminame(), then copied into cvt_buf */
|
|
||||||
static char nambuf[sizeof cvt_buf];
|
|
||||||
|
|
||||||
/* dump the character msg list to check appearance;
|
/* dump the character msg list to check appearance;
|
||||||
build with DEBUG enabled and use DEBUGFILES=questpgr.c
|
build with DEBUG enabled and use DEBUGFILES=questpgr.c
|
||||||
in sysconf file or environment */
|
in sysconf file or environment */
|
||||||
@@ -49,8 +43,8 @@ dump_qtlist()
|
|||||||
if (!explicitdebug(__FILE__))
|
if (!explicitdebug(__FILE__))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (msg = qt_list.chrole; msg->msgnum > 0; msg++) {
|
for (msg = g.qt_list.chrole; msg->msgnum > 0; msg++) {
|
||||||
(void) dlb_fseek(msg_file, msg->offset, SEEK_SET);
|
(void) dlb_fseek(g.msg_file, msg->offset, SEEK_SET);
|
||||||
deliver_by_window(msg, NHW_MAP);
|
deliver_by_window(msg, NHW_MAP);
|
||||||
}
|
}
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
@@ -78,8 +72,8 @@ long hdr_offset;
|
|||||||
struct qtmsg *msg_list;
|
struct qtmsg *msg_list;
|
||||||
int n_msgs;
|
int n_msgs;
|
||||||
|
|
||||||
(void) dlb_fseek(msg_file, hdr_offset, SEEK_SET);
|
(void) dlb_fseek(g.msg_file, hdr_offset, SEEK_SET);
|
||||||
Fread(&n_msgs, sizeof(int), 1, msg_file);
|
Fread(&n_msgs, sizeof(int), 1, g.msg_file);
|
||||||
msg_list = (struct qtmsg *) alloc((unsigned) (n_msgs + 1)
|
msg_list = (struct qtmsg *) alloc((unsigned) (n_msgs + 1)
|
||||||
* sizeof (struct qtmsg));
|
* sizeof (struct qtmsg));
|
||||||
|
|
||||||
@@ -87,7 +81,7 @@ long hdr_offset;
|
|||||||
* Load up the list.
|
* Load up the list.
|
||||||
*/
|
*/
|
||||||
Fread((genericptr_t) msg_list, n_msgs * sizeof (struct qtmsg), 1,
|
Fread((genericptr_t) msg_list, n_msgs * sizeof (struct qtmsg), 1,
|
||||||
msg_file);
|
g.msg_file);
|
||||||
|
|
||||||
msg_list[n_msgs].msgnum = -1;
|
msg_list[n_msgs].msgnum = -1;
|
||||||
return msg_list;
|
return msg_list;
|
||||||
@@ -100,8 +94,8 @@ load_qtlist()
|
|||||||
char qt_classes[N_HDR][LEN_HDR];
|
char qt_classes[N_HDR][LEN_HDR];
|
||||||
long qt_offsets[N_HDR];
|
long qt_offsets[N_HDR];
|
||||||
|
|
||||||
msg_file = dlb_fopen(QTEXT_FILE, RDBMODE);
|
g.msg_file = dlb_fopen(QTEXT_FILE, RDBMODE);
|
||||||
if (!msg_file)
|
if (!g.msg_file)
|
||||||
panic("CANNOT OPEN QUEST TEXT FILE %s.", QTEXT_FILE);
|
panic("CANNOT OPEN QUEST TEXT FILE %s.", QTEXT_FILE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -109,29 +103,29 @@ load_qtlist()
|
|||||||
* each header.
|
* each header.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Fread(&n_classes, sizeof (int), 1, msg_file);
|
Fread(&n_classes, sizeof (int), 1, g.msg_file);
|
||||||
Fread(&qt_classes[0][0], sizeof (char) * LEN_HDR, n_classes, msg_file);
|
Fread(&qt_classes[0][0], sizeof (char) * LEN_HDR, n_classes, g.msg_file);
|
||||||
Fread(qt_offsets, sizeof (long), n_classes, msg_file);
|
Fread(qt_offsets, sizeof (long), n_classes, g.msg_file);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now construct the message lists for quick reference later
|
* Now construct the message lists for quick reference later
|
||||||
* on when we are actually paging the messages out.
|
* on when we are actually paging the messages out.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
qt_list.common = qt_list.chrole = (struct qtmsg *) 0;
|
g.qt_list.common = g.qt_list.chrole = (struct qtmsg *) 0;
|
||||||
|
|
||||||
for (i = 0; i < n_classes; i++) {
|
for (i = 0; i < n_classes; i++) {
|
||||||
if (!strncmp(COMMON_ID, qt_classes[i], LEN_HDR))
|
if (!strncmp(COMMON_ID, qt_classes[i], LEN_HDR))
|
||||||
qt_list.common = construct_qtlist(qt_offsets[i]);
|
g.qt_list.common = construct_qtlist(qt_offsets[i]);
|
||||||
else if (!strncmp(urole.filecode, qt_classes[i], LEN_HDR))
|
else if (!strncmp(urole.filecode, qt_classes[i], LEN_HDR))
|
||||||
qt_list.chrole = construct_qtlist(qt_offsets[i]);
|
g.qt_list.chrole = construct_qtlist(qt_offsets[i]);
|
||||||
#if 0 /* UNUSED but available */
|
#if 0 /* UNUSED but available */
|
||||||
else if (!strncmp(urace.filecode, qt_classes[i], LEN_HDR))
|
else if (!strncmp(urace.filecode, qt_classes[i], LEN_HDR))
|
||||||
qt_list.chrace = construct_qtlist(qt_offsets[i]);
|
g.qt_list.chrace = construct_qtlist(qt_offsets[i]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!qt_list.common || !qt_list.chrole)
|
if (!g.qt_list.common || !g.qt_list.chrole)
|
||||||
impossible("load_qtlist: cannot load quest text.");
|
impossible("load_qtlist: cannot load quest text.");
|
||||||
dump_qtlist();
|
dump_qtlist();
|
||||||
return; /* no ***DON'T*** close the msg_file */
|
return; /* no ***DON'T*** close the msg_file */
|
||||||
@@ -141,12 +135,12 @@ load_qtlist()
|
|||||||
void
|
void
|
||||||
unload_qtlist()
|
unload_qtlist()
|
||||||
{
|
{
|
||||||
if (msg_file)
|
if (g.msg_file)
|
||||||
(void) dlb_fclose(msg_file), msg_file = 0;
|
(void) dlb_fclose(g.msg_file), g.msg_file = 0;
|
||||||
if (qt_list.common)
|
if (g.qt_list.common)
|
||||||
free((genericptr_t) qt_list.common), qt_list.common = 0;
|
free((genericptr_t) g.qt_list.common), g.qt_list.common = 0;
|
||||||
if (qt_list.chrole)
|
if (g.qt_list.chrole)
|
||||||
free((genericptr_t) qt_list.chrole), qt_list.chrole = 0;
|
free((genericptr_t) g.qt_list.chrole), g.qt_list.chrole = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,9 +169,9 @@ ldrname()
|
|||||||
{
|
{
|
||||||
int i = urole.ldrnum;
|
int i = urole.ldrnum;
|
||||||
|
|
||||||
Sprintf(nambuf, "%s%s", type_is_pname(&mons[i]) ? "" : "the ",
|
Sprintf(g.nambuf, "%s%s", type_is_pname(&mons[i]) ? "" : "the ",
|
||||||
mons[i].mname);
|
mons[i].mname);
|
||||||
return nambuf;
|
return g.nambuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return your intermediate target string */
|
/* return your intermediate target string */
|
||||||
@@ -252,9 +246,9 @@ neminame()
|
|||||||
{
|
{
|
||||||
int i = urole.neminum;
|
int i = urole.neminum;
|
||||||
|
|
||||||
Sprintf(nambuf, "%s%s", type_is_pname(&mons[i]) ? "" : "the ",
|
Sprintf(g.nambuf, "%s%s", type_is_pname(&mons[i]) ? "" : "the ",
|
||||||
mons[i].mname);
|
mons[i].mname);
|
||||||
return nambuf;
|
return g.nambuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC_OVL const char *
|
STATIC_OVL const char *
|
||||||
@@ -289,8 +283,8 @@ char who, /* 'd' => deity, 'l' => leader, 'n' => nemesis, 'o' => artifact */
|
|||||||
* which genders[] doesn't handle; cvt_buf[] already contains name.
|
* which genders[] doesn't handle; cvt_buf[] already contains name.
|
||||||
*/
|
*/
|
||||||
if (who == 'o'
|
if (who == 'o'
|
||||||
&& (strstri(cvt_buf, "Eyes ")
|
&& (strstri(g.cvt_buf, "Eyes ")
|
||||||
|| strcmpi(cvt_buf, makesingular(cvt_buf)))) {
|
|| strcmpi(g.cvt_buf, makesingular(g.cvt_buf)))) {
|
||||||
pnoun = (lwhich == 'h') ? "they"
|
pnoun = (lwhich == 'h') ? "they"
|
||||||
: (lwhich == 'i') ? "them"
|
: (lwhich == 'i') ? "them"
|
||||||
: (lwhich == 'j') ? "their" : "?";
|
: (lwhich == 'j') ? "their" : "?";
|
||||||
@@ -303,10 +297,10 @@ char who, /* 'd' => deity, 'l' => leader, 'n' => nemesis, 'o' => artifact */
|
|||||||
: (lwhich == 'i') ? genders[godgend].him
|
: (lwhich == 'i') ? genders[godgend].him
|
||||||
: (lwhich == 'j') ? genders[godgend].his : "?";
|
: (lwhich == 'j') ? genders[godgend].his : "?";
|
||||||
}
|
}
|
||||||
Strcpy(cvt_buf, pnoun);
|
Strcpy(g.cvt_buf, pnoun);
|
||||||
/* capitalize for H,I,J */
|
/* capitalize for H,I,J */
|
||||||
if (lwhich != which)
|
if (lwhich != which)
|
||||||
cvt_buf[0] = highc(cvt_buf[0]);
|
g.cvt_buf[0] = highc(g.cvt_buf[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,7 +407,7 @@ char c;
|
|||||||
str = "";
|
str = "";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Strcpy(cvt_buf, str);
|
Strcpy(g.cvt_buf, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC_OVL void
|
STATIC_OVL void
|
||||||
@@ -438,17 +432,17 @@ char *in_line, *out_line;
|
|||||||
switch (*(++c)) {
|
switch (*(++c)) {
|
||||||
/* insert "a"/"an" prefix */
|
/* insert "a"/"an" prefix */
|
||||||
case 'A':
|
case 'A':
|
||||||
Strcat(cc, An(cvt_buf));
|
Strcat(cc, An(g.cvt_buf));
|
||||||
cc += strlen(cc);
|
cc += strlen(cc);
|
||||||
continue; /* for */
|
continue; /* for */
|
||||||
case 'a':
|
case 'a':
|
||||||
Strcat(cc, an(cvt_buf));
|
Strcat(cc, an(g.cvt_buf));
|
||||||
cc += strlen(cc);
|
cc += strlen(cc);
|
||||||
continue; /* for */
|
continue; /* for */
|
||||||
|
|
||||||
/* capitalize */
|
/* capitalize */
|
||||||
case 'C':
|
case 'C':
|
||||||
cvt_buf[0] = highc(cvt_buf[0]);
|
g.cvt_buf[0] = highc(g.cvt_buf[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* replace name with pronoun;
|
/* replace name with pronoun;
|
||||||
@@ -467,24 +461,24 @@ char *in_line, *out_line;
|
|||||||
|
|
||||||
/* pluralize */
|
/* pluralize */
|
||||||
case 'P':
|
case 'P':
|
||||||
cvt_buf[0] = highc(cvt_buf[0]);
|
g.cvt_buf[0] = highc(g.cvt_buf[0]);
|
||||||
/*FALLTHRU*/
|
/*FALLTHRU*/
|
||||||
case 'p':
|
case 'p':
|
||||||
Strcpy(cvt_buf, makeplural(cvt_buf));
|
Strcpy(g.cvt_buf, makeplural(g.cvt_buf));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* append possessive suffix */
|
/* append possessive suffix */
|
||||||
case 'S':
|
case 'S':
|
||||||
cvt_buf[0] = highc(cvt_buf[0]);
|
g.cvt_buf[0] = highc(g.cvt_buf[0]);
|
||||||
/*FALLTHRU*/
|
/*FALLTHRU*/
|
||||||
case 's':
|
case 's':
|
||||||
Strcpy(cvt_buf, s_suffix(cvt_buf));
|
Strcpy(g.cvt_buf, s_suffix(g.cvt_buf));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* strip any "the" prefix */
|
/* strip any "the" prefix */
|
||||||
case 't':
|
case 't':
|
||||||
if (!strncmpi(cvt_buf, "the ", 4)) {
|
if (!strncmpi(g.cvt_buf, "the ", 4)) {
|
||||||
Strcat(cc, &cvt_buf[4]);
|
Strcat(cc, &g.cvt_buf[4]);
|
||||||
cc += strlen(cc);
|
cc += strlen(cc);
|
||||||
continue; /* for */
|
continue; /* for */
|
||||||
}
|
}
|
||||||
@@ -494,8 +488,8 @@ char *in_line, *out_line;
|
|||||||
--c; /* undo switch increment */
|
--c; /* undo switch increment */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Strcat(cc, cvt_buf);
|
Strcat(cc, g.cvt_buf);
|
||||||
cc += strlen(cvt_buf);
|
cc += strlen(g.cvt_buf);
|
||||||
break;
|
break;
|
||||||
} /* else fall through */
|
} /* else fall through */
|
||||||
|
|
||||||
@@ -519,7 +513,7 @@ struct qtmsg *qt_msg;
|
|||||||
|
|
||||||
*in_line = '\0';
|
*in_line = '\0';
|
||||||
for (size = 0; size < qt_msg->size; size += (long) strlen(in_line)) {
|
for (size = 0; size < qt_msg->size; size += (long) strlen(in_line)) {
|
||||||
(void) dlb_fgets(in_line, sizeof in_line, msg_file);
|
(void) dlb_fgets(in_line, sizeof in_line, g.msg_file);
|
||||||
convert_line(in_line, out_line);
|
convert_line(in_line, out_line);
|
||||||
pline("%s", out_line);
|
pline("%s", out_line);
|
||||||
}
|
}
|
||||||
@@ -549,7 +543,7 @@ int how;
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
for (size = 0; size < qt_msg->size; size += (long) strlen(in_line)) {
|
for (size = 0; size < qt_msg->size; size += (long) strlen(in_line)) {
|
||||||
(void) dlb_fgets(in_line, sizeof in_line, msg_file);
|
(void) dlb_fgets(in_line, sizeof in_line, g.msg_file);
|
||||||
convert_line(in_line, out_line);
|
convert_line(in_line, out_line);
|
||||||
putstr(datawin, 0, out_line);
|
putstr(datawin, 0, out_line);
|
||||||
}
|
}
|
||||||
@@ -560,7 +554,7 @@ int how;
|
|||||||
but have a one-line summary which is put there for ^P recall */
|
but have a one-line summary which is put there for ^P recall */
|
||||||
*out_line = '\0';
|
*out_line = '\0';
|
||||||
if (qt_msg->summary_size) {
|
if (qt_msg->summary_size) {
|
||||||
(void) dlb_fgets(in_line, sizeof in_line, msg_file);
|
(void) dlb_fgets(in_line, sizeof in_line, g.msg_file);
|
||||||
convert_line(in_line, out_line);
|
convert_line(in_line, out_line);
|
||||||
#ifdef BETA
|
#ifdef BETA
|
||||||
} else if (qt_msg->delivery == 'c') { /* skip for 'qtdump' of 'p' */
|
} else if (qt_msg->delivery == 'c') { /* skip for 'qtdump' of 'p' */
|
||||||
@@ -582,7 +576,7 @@ boolean common;
|
|||||||
/* WIZKIT: suppress plot feedback if starting with quest artifact */
|
/* WIZKIT: suppress plot feedback if starting with quest artifact */
|
||||||
if (program_state.wizkit_wishing)
|
if (program_state.wizkit_wishing)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (!(common ? qt_list.common : qt_list.chrole)) {
|
if (!(common ? g.qt_list.common : g.qt_list.chrole)) {
|
||||||
panic("%s: no %s quest text data available",
|
panic("%s: no %s quest text data available",
|
||||||
common ? "com_pager" : "qt_pager",
|
common ? "com_pager" : "qt_pager",
|
||||||
common ? "common" : "role-specific");
|
common ? "common" : "role-specific");
|
||||||
@@ -601,12 +595,12 @@ int msgnum;
|
|||||||
if (skip_pager(TRUE))
|
if (skip_pager(TRUE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(qt_msg = msg_in(qt_list.common, msgnum))) {
|
if (!(qt_msg = msg_in(g.qt_list.common, msgnum))) {
|
||||||
impossible("com_pager: message %d not found.", msgnum);
|
impossible("com_pager: message %d not found.", msgnum);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) dlb_fseek(msg_file, qt_msg->offset, SEEK_SET);
|
(void) dlb_fseek(g.msg_file, qt_msg->offset, SEEK_SET);
|
||||||
if (qt_msg->delivery == 'p')
|
if (qt_msg->delivery == 'p')
|
||||||
deliver_by_pline(qt_msg);
|
deliver_by_pline(qt_msg);
|
||||||
else if (msgnum == 1)
|
else if (msgnum == 1)
|
||||||
@@ -625,7 +619,7 @@ int msgnum;
|
|||||||
if (skip_pager(FALSE))
|
if (skip_pager(FALSE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
qt_msg = msg_in(qt_list.chrole, msgnum);
|
qt_msg = msg_in(g.qt_list.chrole, msgnum);
|
||||||
if (!qt_msg) {
|
if (!qt_msg) {
|
||||||
/* some roles have an alternate message for return to the goal
|
/* some roles have an alternate message for return to the goal
|
||||||
level when the quest artifact is absent (handled by caller)
|
level when the quest artifact is absent (handled by caller)
|
||||||
@@ -634,14 +628,14 @@ int msgnum;
|
|||||||
present which might not be true for wizard mode but we don't
|
present which might not be true for wizard mode but we don't
|
||||||
worry about quest message references in that situation */
|
worry about quest message references in that situation */
|
||||||
if (msgnum == QT_ALTGOAL)
|
if (msgnum == QT_ALTGOAL)
|
||||||
qt_msg = msg_in(qt_list.chrole, QT_NEXTGOAL);
|
qt_msg = msg_in(g.qt_list.chrole, QT_NEXTGOAL);
|
||||||
}
|
}
|
||||||
if (!qt_msg) {
|
if (!qt_msg) {
|
||||||
impossible("qt_pager: message %d not found.", msgnum);
|
impossible("qt_pager: message %d not found.", msgnum);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) dlb_fseek(msg_file, qt_msg->offset, SEEK_SET);
|
(void) dlb_fseek(g.msg_file, qt_msg->offset, SEEK_SET);
|
||||||
if (qt_msg->delivery == 'p' && strcmp(windowprocs.name, "X11"))
|
if (qt_msg->delivery == 'p' && strcmp(windowprocs.name, "X11"))
|
||||||
deliver_by_pline(qt_msg);
|
deliver_by_pline(qt_msg);
|
||||||
else
|
else
|
||||||
|
|||||||
+1
-1
@@ -45,7 +45,7 @@ NhRegion *FDECL(create_force_field, (XCHAR_P,XCHAR_P,int,long));
|
|||||||
|
|
||||||
STATIC_DCL void FDECL(reset_region_mids, (NhRegion *));
|
STATIC_DCL void FDECL(reset_region_mids, (NhRegion *));
|
||||||
|
|
||||||
static callback_proc callbacks[] = {
|
static const callback_proc callbacks[] = {
|
||||||
#define INSIDE_GAS_CLOUD 0
|
#define INSIDE_GAS_CLOUD 0
|
||||||
inside_gas_cloud,
|
inside_gas_cloud,
|
||||||
#define EXPIRE_GAS_CLOUD 1
|
#define EXPIRE_GAS_CLOUD 1
|
||||||
|
|||||||
@@ -1666,11 +1666,6 @@ boolean itemize;
|
|||||||
return buy;
|
return buy;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct repo { /* repossession context */
|
|
||||||
struct monst *shopkeeper;
|
|
||||||
coord location;
|
|
||||||
} repo;
|
|
||||||
|
|
||||||
/* routine called after dying (or quitting) */
|
/* routine called after dying (or quitting) */
|
||||||
boolean
|
boolean
|
||||||
paybill(croaked)
|
paybill(croaked)
|
||||||
@@ -1692,8 +1687,8 @@ int croaked; /* -1: escaped dungeon; 0: quit; 1: died */
|
|||||||
which has been shut inside a statue] */
|
which has been shut inside a statue] */
|
||||||
|
|
||||||
/* this is where inventory will end up if any shk takes it */
|
/* this is where inventory will end up if any shk takes it */
|
||||||
repo.location.x = repo.location.y = 0;
|
g.repo.location.x = g.repo.location.y = 0;
|
||||||
repo.shopkeeper = 0;
|
g.repo.shopkeeper = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scan all shopkeepers on the level, to prioritize them:
|
* Scan all shopkeepers on the level, to prioritize them:
|
||||||
@@ -1882,17 +1877,17 @@ struct monst *shkp;
|
|||||||
oy = u.uy;
|
oy = u.uy;
|
||||||
}
|
}
|
||||||
/* finish_paybill will deposit invent here */
|
/* finish_paybill will deposit invent here */
|
||||||
repo.location.x = ox;
|
g.repo.location.x = ox;
|
||||||
repo.location.y = oy;
|
g.repo.location.y = oy;
|
||||||
repo.shopkeeper = shkp;
|
g.repo.shopkeeper = shkp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* called at game exit, after inventory disclosure but before making bones */
|
/* called at game exit, after inventory disclosure but before making bones */
|
||||||
void
|
void
|
||||||
finish_paybill()
|
finish_paybill()
|
||||||
{
|
{
|
||||||
struct monst *shkp = repo.shopkeeper;
|
struct monst *shkp = g.repo.shopkeeper;
|
||||||
int ox = repo.location.x, oy = repo.location.y;
|
int ox = g.repo.location.x, oy = g.repo.location.y;
|
||||||
|
|
||||||
#if 0 /* don't bother */
|
#if 0 /* don't bother */
|
||||||
if (ox == 0 && oy == 0)
|
if (ox == 0 && oy == 0)
|
||||||
@@ -2861,13 +2856,6 @@ boolean peaceful, silent;
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* auto-response flag for/from "sell foo?" 'a' => 'y', 'q' => 'n' */
|
|
||||||
static char sell_response = 'a';
|
|
||||||
static int sell_how = SELL_NORMAL;
|
|
||||||
/* can't just use sell_response='y' for auto_credit because the 'a' response
|
|
||||||
shouldn't carry over from ordinary selling to credit selling */
|
|
||||||
static boolean auto_credit = FALSE;
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sellobj_state(deliberate)
|
sellobj_state(deliberate)
|
||||||
int deliberate;
|
int deliberate;
|
||||||
@@ -2878,9 +2866,9 @@ int deliberate;
|
|||||||
This retains the old pre-query risk that slippery fingers while in
|
This retains the old pre-query risk that slippery fingers while in
|
||||||
shops entailed: you drop it, you've lost it.
|
shops entailed: you drop it, you've lost it.
|
||||||
*/
|
*/
|
||||||
sell_response = (deliberate != SELL_NORMAL) ? '\0' : 'a';
|
g.sell_response = (deliberate != SELL_NORMAL) ? '\0' : 'a';
|
||||||
sell_how = deliberate;
|
g.sell_how = deliberate;
|
||||||
auto_credit = FALSE;
|
g.auto_credit = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -2922,7 +2910,7 @@ xchar x, y;
|
|||||||
|
|
||||||
/* get one case out of the way: nothing to sell, and no gold */
|
/* get one case out of the way: nothing to sell, and no gold */
|
||||||
if (!(isgold || cgold)
|
if (!(isgold || cgold)
|
||||||
&& ((offer + gltmp) == 0L || sell_how == SELL_DONTSELL)) {
|
&& ((offer + gltmp) == 0L || g.sell_how == SELL_DONTSELL)) {
|
||||||
boolean unpaid = is_unpaid(obj);
|
boolean unpaid = is_unpaid(obj);
|
||||||
|
|
||||||
if (container) {
|
if (container) {
|
||||||
@@ -2934,7 +2922,7 @@ xchar x, y;
|
|||||||
} else
|
} else
|
||||||
obj->no_charge = 1;
|
obj->no_charge = 1;
|
||||||
|
|
||||||
if (!unpaid && (sell_how != SELL_DONTSELL)
|
if (!unpaid && (g.sell_how != SELL_DONTSELL)
|
||||||
&& !special_stock(obj, shkp, FALSE))
|
&& !special_stock(obj, shkp, FALSE))
|
||||||
pline("%s seems uninterested.", Shknam(shkp));
|
pline("%s seems uninterested.", Shknam(shkp));
|
||||||
return;
|
return;
|
||||||
@@ -2998,7 +2986,7 @@ xchar x, y;
|
|||||||
currency(eshkp->credit));
|
currency(eshkp->credit));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!offer || sell_how == SELL_DONTSELL) {
|
if (!offer || g.sell_how == SELL_DONTSELL) {
|
||||||
if (!isgold) {
|
if (!isgold) {
|
||||||
if (container)
|
if (container)
|
||||||
dropped_container(obj, shkp, FALSE);
|
dropped_container(obj, shkp, FALSE);
|
||||||
@@ -3028,9 +3016,9 @@ xchar x, y;
|
|||||||
char c, qbuf[BUFSZ];
|
char c, qbuf[BUFSZ];
|
||||||
long tmpcr = ((offer * 9L) / 10L) + (offer <= 1L);
|
long tmpcr = ((offer * 9L) / 10L) + (offer <= 1L);
|
||||||
|
|
||||||
if (sell_how == SELL_NORMAL || auto_credit) {
|
if (g.sell_how == SELL_NORMAL || g.auto_credit) {
|
||||||
c = sell_response = 'y';
|
c = g.sell_response = 'y';
|
||||||
} else if (sell_response != 'n') {
|
} else if (g.sell_response != 'n') {
|
||||||
pline("%s cannot pay you at present.", Shknam(shkp));
|
pline("%s cannot pay you at present.", Shknam(shkp));
|
||||||
Sprintf(qbuf, "Will you accept %ld %s in credit for ", tmpcr,
|
Sprintf(qbuf, "Will you accept %ld %s in credit for ", tmpcr,
|
||||||
currency(tmpcr));
|
currency(tmpcr));
|
||||||
@@ -3038,7 +3026,7 @@ xchar x, y;
|
|||||||
(obj->quan == 1L) ? "that" : "those"));
|
(obj->quan == 1L) ? "that" : "those"));
|
||||||
if (c == 'a') {
|
if (c == 'a') {
|
||||||
c = 'y';
|
c = 'y';
|
||||||
auto_credit = TRUE;
|
g.auto_credit = TRUE;
|
||||||
}
|
}
|
||||||
} else /* previously specified "quit" */
|
} else /* previously specified "quit" */
|
||||||
c = 'n';
|
c = 'n';
|
||||||
@@ -3046,7 +3034,7 @@ xchar x, y;
|
|||||||
if (c == 'y') {
|
if (c == 'y') {
|
||||||
shk_names_obj(
|
shk_names_obj(
|
||||||
shkp, obj,
|
shkp, obj,
|
||||||
(sell_how != SELL_NORMAL)
|
(g.sell_how != SELL_NORMAL)
|
||||||
? "traded %s for %ld zorkmid%s in %scredit."
|
? "traded %s for %ld zorkmid%s in %scredit."
|
||||||
: "relinquish %s and acquire %ld zorkmid%s in %scredit.",
|
: "relinquish %s and acquire %ld zorkmid%s in %scredit.",
|
||||||
tmpcr, (eshkp->credit > 0L) ? "additional " : "");
|
tmpcr, (eshkp->credit > 0L) ? "additional " : "");
|
||||||
@@ -3054,7 +3042,7 @@ xchar x, y;
|
|||||||
subfrombill(obj, shkp);
|
subfrombill(obj, shkp);
|
||||||
} else {
|
} else {
|
||||||
if (c == 'q')
|
if (c == 'q')
|
||||||
sell_response = 'n';
|
g.sell_response = 'n';
|
||||||
if (container)
|
if (container)
|
||||||
dropped_container(obj, shkp, FALSE);
|
dropped_container(obj, shkp, FALSE);
|
||||||
if (!obj->unpaid)
|
if (!obj->unpaid)
|
||||||
@@ -3067,7 +3055,7 @@ xchar x, y;
|
|||||||
|
|
||||||
if (short_funds)
|
if (short_funds)
|
||||||
offer = shkmoney;
|
offer = shkmoney;
|
||||||
if (!sell_response) {
|
if (!g.sell_response) {
|
||||||
long yourc = 0L, shksc;
|
long yourc = 0L, shksc;
|
||||||
|
|
||||||
if (container) {
|
if (container) {
|
||||||
@@ -3120,9 +3108,9 @@ xchar x, y;
|
|||||||
} else
|
} else
|
||||||
qbuf[0] = '\0'; /* just to pacify lint */
|
qbuf[0] = '\0'; /* just to pacify lint */
|
||||||
|
|
||||||
switch (sell_response ? sell_response : ynaq(qbuf)) {
|
switch (g.sell_response ? g.sell_response : ynaq(qbuf)) {
|
||||||
case 'q':
|
case 'q':
|
||||||
sell_response = 'n';
|
g.sell_response = 'n';
|
||||||
/*FALLTHRU*/
|
/*FALLTHRU*/
|
||||||
case 'n':
|
case 'n':
|
||||||
if (container)
|
if (container)
|
||||||
@@ -3132,7 +3120,7 @@ xchar x, y;
|
|||||||
subfrombill(obj, shkp);
|
subfrombill(obj, shkp);
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
sell_response = 'y';
|
g.sell_response = 'y';
|
||||||
/*FALLTHRU*/
|
/*FALLTHRU*/
|
||||||
case 'y':
|
case 'y':
|
||||||
if (container)
|
if (container)
|
||||||
@@ -3142,7 +3130,7 @@ xchar x, y;
|
|||||||
subfrombill(obj, shkp);
|
subfrombill(obj, shkp);
|
||||||
pay(-offer, shkp);
|
pay(-offer, shkp);
|
||||||
shk_names_obj(shkp, obj,
|
shk_names_obj(shkp, obj,
|
||||||
(sell_how != SELL_NORMAL)
|
(g.sell_how != SELL_NORMAL)
|
||||||
? ((!ltmp && cltmp && only_partially_your_contents)
|
? ((!ltmp && cltmp && only_partially_your_contents)
|
||||||
? "sold some items inside %s for %ld gold piece%s.%s"
|
? "sold some items inside %s for %ld gold piece%s.%s"
|
||||||
: "sold %s for %ld gold piece%s.%s")
|
: "sold %s for %ld gold piece%s.%s")
|
||||||
|
|||||||
+120
-135
@@ -189,21 +189,6 @@ STATIC_DCL boolean FDECL(sp_level_coder, (sp_lev *));
|
|||||||
|
|
||||||
extern struct engr *head_engr;
|
extern struct engr *head_engr;
|
||||||
|
|
||||||
/* positions touched by level elements explicitly defined in the des-file */
|
|
||||||
static char SpLev_Map[COLNO][ROWNO];
|
|
||||||
|
|
||||||
static aligntyp ralign[3] = { AM_CHAOTIC, AM_NEUTRAL, AM_LAWFUL };
|
|
||||||
static NEARDATA xchar xstart, ystart;
|
|
||||||
static NEARDATA char xsize, ysize;
|
|
||||||
|
|
||||||
static boolean splev_init_present = FALSE;
|
|
||||||
static boolean icedpools = FALSE;
|
|
||||||
static int mines_prize_count = 0, soko_prize_count = 0; /* achievements */
|
|
||||||
|
|
||||||
static struct obj *container_obj[MAX_CONTAINMENT];
|
|
||||||
static int container_idx = 0;
|
|
||||||
static struct monst *invent_carrying_monster = NULL;
|
|
||||||
|
|
||||||
#define SPLEV_STACK_RESERVE 128
|
#define SPLEV_STACK_RESERVE 128
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -213,7 +198,7 @@ solidify_map()
|
|||||||
|
|
||||||
for (x = 0; x < COLNO; x++)
|
for (x = 0; x < COLNO; x++)
|
||||||
for (y = 0; y < ROWNO; y++)
|
for (y = 0; y < ROWNO; y++)
|
||||||
if (IS_STWALL(levl[x][y].typ) && !SpLev_Map[x][y])
|
if (IS_STWALL(levl[x][y].typ) && !g.SpLev_Map[x][y])
|
||||||
levl[x][y].wall_info |= (W_NONDIGGABLE | W_NONPASSWALL);
|
levl[x][y].wall_info |= (W_NONDIGGABLE | W_NONPASSWALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -656,13 +641,13 @@ shuffle_alignments()
|
|||||||
|
|
||||||
/* shuffle 3 alignments */
|
/* shuffle 3 alignments */
|
||||||
i = rn2(3);
|
i = rn2(3);
|
||||||
atmp = ralign[2];
|
atmp = g.ralign[2];
|
||||||
ralign[2] = ralign[i];
|
g.ralign[2] = g.ralign[i];
|
||||||
ralign[i] = atmp;
|
g.ralign[i] = atmp;
|
||||||
if (rn2(2)) {
|
if (rn2(2)) {
|
||||||
atmp = ralign[1];
|
atmp = g.ralign[1];
|
||||||
ralign[1] = ralign[0];
|
g.ralign[1] = g.ralign[0];
|
||||||
ralign[0] = atmp;
|
g.ralign[0] = atmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -705,7 +690,7 @@ remove_boundary_syms()
|
|||||||
if (has_bounds) {
|
if (has_bounds) {
|
||||||
for (x = 0; x < x_maze_max; x++)
|
for (x = 0; x < x_maze_max; x++)
|
||||||
for (y = 0; y < y_maze_max; y++)
|
for (y = 0; y < y_maze_max; y++)
|
||||||
if ((levl[x][y].typ == CROSSWALL) && SpLev_Map[x][y])
|
if ((levl[x][y].typ == CROSSWALL) && g.SpLev_Map[x][y])
|
||||||
levl[x][y].typ = ROOM;
|
levl[x][y].typ = ROOM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -873,10 +858,10 @@ struct mkroom *croom;
|
|||||||
sx = croom->hx - mx + 1;
|
sx = croom->hx - mx + 1;
|
||||||
sy = croom->hy - my + 1;
|
sy = croom->hy - my + 1;
|
||||||
} else {
|
} else {
|
||||||
mx = xstart;
|
mx = g.xstart;
|
||||||
my = ystart;
|
my = g.ystart;
|
||||||
sx = xsize;
|
sx = g.xsize;
|
||||||
sy = ysize;
|
sy = g.ysize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*x >= 0) { /* normal locations */
|
if (*x >= 0) { /* normal locations */
|
||||||
@@ -1598,7 +1583,7 @@ struct mkroom *croom;
|
|||||||
? Align2amask(noncoalignment(u.ualignbase[A_ORIGINAL]))
|
? Align2amask(noncoalignment(u.ualignbase[A_ORIGINAL]))
|
||||||
: (m->align <= -(MAX_REGISTERS + 1))
|
: (m->align <= -(MAX_REGISTERS + 1))
|
||||||
? induced_align(80)
|
? induced_align(80)
|
||||||
: (m->align < 0 ? ralign[-m->align - 1] : m->align);
|
: (m->align < 0 ? g.ralign[-m->align - 1] : m->align);
|
||||||
|
|
||||||
if (!class)
|
if (!class)
|
||||||
pm = (struct permonst *) 0;
|
pm = (struct permonst *) 0;
|
||||||
@@ -1822,7 +1807,7 @@ struct mkroom *croom;
|
|||||||
|
|
||||||
if (m->has_invent) {
|
if (m->has_invent) {
|
||||||
discard_minvent(mtmp);
|
discard_minvent(mtmp);
|
||||||
invent_carrying_monster = mtmp;
|
g.invent_carrying_monster = mtmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1933,8 +1918,8 @@ struct mkroom *croom;
|
|||||||
|
|
||||||
/* contents */
|
/* contents */
|
||||||
if (o->containment & SP_OBJ_CONTENT) {
|
if (o->containment & SP_OBJ_CONTENT) {
|
||||||
if (!container_idx) {
|
if (!g.container_idx) {
|
||||||
if (!invent_carrying_monster) {
|
if (!g.invent_carrying_monster) {
|
||||||
/*impossible("create_object: no container");*/
|
/*impossible("create_object: no container");*/
|
||||||
/* don't complain, the monster may be gone legally
|
/* don't complain, the monster may be gone legally
|
||||||
(eg. unique demon already generated)
|
(eg. unique demon already generated)
|
||||||
@@ -1948,25 +1933,25 @@ struct mkroom *croom;
|
|||||||
struct obj *objcheck = otmp;
|
struct obj *objcheck = otmp;
|
||||||
int inuse = -1;
|
int inuse = -1;
|
||||||
|
|
||||||
for (ci = 0; ci < container_idx; ci++)
|
for (ci = 0; ci < g.container_idx; ci++)
|
||||||
if (container_obj[ci] == objcheck)
|
if (g.container_obj[ci] == objcheck)
|
||||||
inuse = ci;
|
inuse = ci;
|
||||||
remove_object(otmp);
|
remove_object(otmp);
|
||||||
if (mpickobj(invent_carrying_monster, otmp)) {
|
if (mpickobj(g.invent_carrying_monster, otmp)) {
|
||||||
if (inuse > -1) {
|
if (inuse > -1) {
|
||||||
impossible(
|
impossible(
|
||||||
"container given to monster was merged or deallocated.");
|
"container given to monster was merged or deallocated.");
|
||||||
for (ci = inuse; ci < container_idx - 1; ci++)
|
for (ci = inuse; ci < g.container_idx - 1; ci++)
|
||||||
container_obj[ci] = container_obj[ci + 1];
|
g.container_obj[ci] = g.container_obj[ci + 1];
|
||||||
container_obj[container_idx] = NULL;
|
g.container_obj[g.container_idx] = NULL;
|
||||||
container_idx--;
|
g.container_idx--;
|
||||||
}
|
}
|
||||||
/* we lost track of it. */
|
/* we lost track of it. */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
struct obj *cobj = container_obj[container_idx - 1];
|
struct obj *cobj = g.container_obj[g.container_idx - 1];
|
||||||
|
|
||||||
remove_object(otmp);
|
remove_object(otmp);
|
||||||
if (cobj) {
|
if (cobj) {
|
||||||
@@ -1982,9 +1967,9 @@ struct mkroom *croom;
|
|||||||
/* container */
|
/* container */
|
||||||
if (o->containment & SP_OBJ_CONTAINER) {
|
if (o->containment & SP_OBJ_CONTAINER) {
|
||||||
delete_contents(otmp);
|
delete_contents(otmp);
|
||||||
if (container_idx < MAX_CONTAINMENT) {
|
if (g.container_idx < MAX_CONTAINMENT) {
|
||||||
container_obj[container_idx] = otmp;
|
g.container_obj[g.container_idx] = otmp;
|
||||||
container_idx++;
|
g.container_idx++;
|
||||||
} else
|
} else
|
||||||
impossible("create_object: too deeply nested containers.");
|
impossible("create_object: too deeply nested containers.");
|
||||||
}
|
}
|
||||||
@@ -2039,17 +2024,17 @@ struct mkroom *croom;
|
|||||||
if (Is_mineend_level(&u.uz)) {
|
if (Is_mineend_level(&u.uz)) {
|
||||||
if (otmp->otyp == iflags.mines_prize_type) {
|
if (otmp->otyp == iflags.mines_prize_type) {
|
||||||
otmp->record_achieve_special = MINES_PRIZE;
|
otmp->record_achieve_special = MINES_PRIZE;
|
||||||
if (++mines_prize_count > 1)
|
if (++g.mines_prize_count > 1)
|
||||||
impossible(prize_warning, "mines end");
|
impossible(prize_warning, "mines end");
|
||||||
}
|
}
|
||||||
} else if (Is_sokoend_level(&u.uz)) {
|
} else if (Is_sokoend_level(&u.uz)) {
|
||||||
if (otmp->otyp == iflags.soko_prize_type1) {
|
if (otmp->otyp == iflags.soko_prize_type1) {
|
||||||
otmp->record_achieve_special = SOKO_PRIZE1;
|
otmp->record_achieve_special = SOKO_PRIZE1;
|
||||||
if (++soko_prize_count > 1)
|
if (++g.soko_prize_count > 1)
|
||||||
impossible(prize_warning, "sokoban end");
|
impossible(prize_warning, "sokoban end");
|
||||||
} else if (otmp->otyp == iflags.soko_prize_type2) {
|
} else if (otmp->otyp == iflags.soko_prize_type2) {
|
||||||
otmp->record_achieve_special = SOKO_PRIZE2;
|
otmp->record_achieve_special = SOKO_PRIZE2;
|
||||||
if (++soko_prize_count > 1)
|
if (++g.soko_prize_count > 1)
|
||||||
impossible(prize_warning, "sokoban end");
|
impossible(prize_warning, "sokoban end");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2065,8 +2050,8 @@ struct mkroom *croom;
|
|||||||
boolean dealloced;
|
boolean dealloced;
|
||||||
|
|
||||||
(void) bury_an_obj(otmp, &dealloced);
|
(void) bury_an_obj(otmp, &dealloced);
|
||||||
if (dealloced && container_idx) {
|
if (dealloced && g.container_idx) {
|
||||||
container_obj[container_idx - 1] = NULL;
|
g.container_obj[g.container_idx - 1] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2114,7 +2099,7 @@ struct mkroom *croom;
|
|||||||
? Align2amask(noncoalignment(u.ualignbase[A_ORIGINAL]))
|
? Align2amask(noncoalignment(u.ualignbase[A_ORIGINAL]))
|
||||||
: (a->align == -(MAX_REGISTERS + 1))
|
: (a->align == -(MAX_REGISTERS + 1))
|
||||||
? induced_align(80)
|
? induced_align(80)
|
||||||
: (a->align < 0 ? ralign[-a->align - 1] : a->align);
|
: (a->align < 0 ? g.ralign[-a->align - 1] : a->align);
|
||||||
|
|
||||||
levl[x][y].typ = ALTAR;
|
levl[x][y].typ = ALTAR;
|
||||||
levl[x][y].altarmask = amask;
|
levl[x][y].altarmask = amask;
|
||||||
@@ -2608,7 +2593,7 @@ int humidity;
|
|||||||
y = rn1(y_maze_max - 3, 3);
|
y = rn1(y_maze_max - 3, 3);
|
||||||
if (--tryct < 0)
|
if (--tryct < 0)
|
||||||
break; /* give up */
|
break; /* give up */
|
||||||
} while (!(x % 2) || !(y % 2) || SpLev_Map[x][y]
|
} while (!(x % 2) || !(y % 2) || g.SpLev_Map[x][y]
|
||||||
|| !is_ok_location((schar) x, (schar) y, humidity));
|
|| !is_ok_location((schar) x, (schar) y, humidity));
|
||||||
|
|
||||||
m->x = (xchar) x, m->y = (xchar) y;
|
m->x = (xchar) x, m->y = (xchar) y;
|
||||||
@@ -2633,7 +2618,7 @@ fill_empty_maze()
|
|||||||
|
|
||||||
for (x = 2; x < x_maze_max; x++)
|
for (x = 2; x < x_maze_max; x++)
|
||||||
for (y = 0; y < y_maze_max; y++)
|
for (y = 0; y < y_maze_max; y++)
|
||||||
if (SpLev_Map[x][y])
|
if (g.SpLev_Map[x][y])
|
||||||
mapcount--;
|
mapcount--;
|
||||||
|
|
||||||
if ((mapcount > (int) (mapcountmax / 10))) {
|
if ((mapcount > (int) (mapcountmax / 10))) {
|
||||||
@@ -2796,7 +2781,7 @@ lev_init *linit;
|
|||||||
linit->lit = rn2(2);
|
linit->lit = rn2(2);
|
||||||
if (linit->filling > -1)
|
if (linit->filling > -1)
|
||||||
lvlfill_solid(linit->filling, 0);
|
lvlfill_solid(linit->filling, 0);
|
||||||
linit->icedpools = icedpools;
|
linit->icedpools = g.icedpools;
|
||||||
mkmap(linit);
|
mkmap(linit);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2929,9 +2914,9 @@ void
|
|||||||
spo_end_moninvent(coder)
|
spo_end_moninvent(coder)
|
||||||
struct sp_coder *coder UNUSED;
|
struct sp_coder *coder UNUSED;
|
||||||
{
|
{
|
||||||
if (invent_carrying_monster)
|
if (g.invent_carrying_monster)
|
||||||
m_dowear(invent_carrying_monster, TRUE);
|
m_dowear(g.invent_carrying_monster, TRUE);
|
||||||
invent_carrying_monster = NULL;
|
g.invent_carrying_monster = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*ARGUSED*/
|
/*ARGUSED*/
|
||||||
@@ -2939,9 +2924,9 @@ void
|
|||||||
spo_pop_container(coder)
|
spo_pop_container(coder)
|
||||||
struct sp_coder *coder UNUSED;
|
struct sp_coder *coder UNUSED;
|
||||||
{
|
{
|
||||||
if (container_idx > 0) {
|
if (g.container_idx > 0) {
|
||||||
container_idx--;
|
g.container_idx--;
|
||||||
container_obj[container_idx] = NULL;
|
g.container_obj[g.container_idx] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3303,7 +3288,7 @@ struct sp_coder *coder;
|
|||||||
if (lflags & GRAVEYARD)
|
if (lflags & GRAVEYARD)
|
||||||
level.flags.graveyard = 1;
|
level.flags.graveyard = 1;
|
||||||
if (lflags & ICEDPOOLS)
|
if (lflags & ICEDPOOLS)
|
||||||
icedpools = TRUE;
|
g.icedpools = TRUE;
|
||||||
if (lflags & SOLIDIFY)
|
if (lflags & SOLIDIFY)
|
||||||
coder->solidify = TRUE;
|
coder->solidify = TRUE;
|
||||||
if (lflags & CORRMAZE)
|
if (lflags & CORRMAZE)
|
||||||
@@ -3328,7 +3313,7 @@ struct sp_coder *coder;
|
|||||||
|| !OV_pop_i(filling) || !OV_pop_i(init_style))
|
|| !OV_pop_i(filling) || !OV_pop_i(init_style))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
splev_init_present = TRUE;
|
g.splev_init_present = TRUE;
|
||||||
|
|
||||||
init_lev.init_style = OV_i(init_style);
|
init_lev.init_style = OV_i(init_style);
|
||||||
init_lev.fg = OV_i(fg);
|
init_lev.fg = OV_i(fg);
|
||||||
@@ -3465,11 +3450,11 @@ struct sp_coder *coder;
|
|||||||
room,
|
room,
|
||||||
and there's no MAP.
|
and there's no MAP.
|
||||||
*/
|
*/
|
||||||
if (xsize <= 1 && ysize <= 1) {
|
if (g.xsize <= 1 && g.ysize <= 1) {
|
||||||
xstart = 1;
|
g.xstart = 1;
|
||||||
ystart = 0;
|
g.ystart = 0;
|
||||||
xsize = COLNO - 1;
|
g.xsize = COLNO - 1;
|
||||||
ysize = ROWNO;
|
g.ysize = ROWNO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3490,7 +3475,7 @@ struct sp_coder *coder;
|
|||||||
if ((badtrap = t_at(x, y)) != 0)
|
if ((badtrap = t_at(x, y)) != 0)
|
||||||
deltrap(badtrap);
|
deltrap(badtrap);
|
||||||
mkstairs(x, y, (char) OV_i(up), coder->croom);
|
mkstairs(x, y, (char) OV_i(up), coder->croom);
|
||||||
SpLev_Map[x][y] = 1;
|
g.SpLev_Map[x][y] = 1;
|
||||||
|
|
||||||
opvar_free(scoord);
|
opvar_free(scoord);
|
||||||
opvar_free(up);
|
opvar_free(up);
|
||||||
@@ -3510,7 +3495,7 @@ struct sp_coder *coder;
|
|||||||
get_location_coord(&x, &y, DRY, coder->croom, OV_i(lcoord));
|
get_location_coord(&x, &y, DRY, coder->croom, OV_i(lcoord));
|
||||||
|
|
||||||
levl[x][y].typ = LADDER;
|
levl[x][y].typ = LADDER;
|
||||||
SpLev_Map[x][y] = 1;
|
g.SpLev_Map[x][y] = 1;
|
||||||
if (OV_i(up)) {
|
if (OV_i(up)) {
|
||||||
xupladder = x;
|
xupladder = x;
|
||||||
yupladder = y;
|
yupladder = y;
|
||||||
@@ -4294,7 +4279,7 @@ genericptr_t arg;
|
|||||||
}
|
}
|
||||||
set_door_orientation(x, y); /* set/clear levl[x][y].horizontal */
|
set_door_orientation(x, y); /* set/clear levl[x][y].horizontal */
|
||||||
levl[x][y].doormask = typ;
|
levl[x][y].doormask = typ;
|
||||||
SpLev_Map[x][y] = 1;
|
g.SpLev_Map[x][y] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -4710,7 +4695,7 @@ struct sp_coder *coder;
|
|||||||
get_location_coord(&x, &y, DRY | WET | HOT, coder->croom, OV_i(dcoord));
|
get_location_coord(&x, &y, DRY | WET | HOT, coder->croom, OV_i(dcoord));
|
||||||
if (!create_drawbridge(x, y, OV_i(dir), OV_i(db_open)))
|
if (!create_drawbridge(x, y, OV_i(dir), OV_i(db_open)))
|
||||||
impossible("Cannot create drawbridge.");
|
impossible("Cannot create drawbridge.");
|
||||||
SpLev_Map[x][y] = 1;
|
g.SpLev_Map[x][y] = 1;
|
||||||
|
|
||||||
opvar_free(dcoord);
|
opvar_free(dcoord);
|
||||||
opvar_free(db_open);
|
opvar_free(db_open);
|
||||||
@@ -4876,10 +4861,10 @@ struct sp_coder *coder;
|
|||||||
dy1 = (xchar) SP_REGION_Y1(OV_i(r));
|
dy1 = (xchar) SP_REGION_Y1(OV_i(r));
|
||||||
dx2 = (xchar) SP_REGION_X2(OV_i(r));
|
dx2 = (xchar) SP_REGION_X2(OV_i(r));
|
||||||
dy2 = (xchar) SP_REGION_Y2(OV_i(r));
|
dy2 = (xchar) SP_REGION_Y2(OV_i(r));
|
||||||
wallify_map(dx1 < 0 ? (xstart - 1) : dx1,
|
wallify_map(dx1 < 0 ? (g.xstart - 1) : dx1,
|
||||||
dy1 < 0 ? (ystart - 1) : dy1,
|
dy1 < 0 ? (g.ystart - 1) : dy1,
|
||||||
dx2 < 0 ? (xstart + xsize + 1) : dx2,
|
dx2 < 0 ? (g.xstart + g.xsize + 1) : dx2,
|
||||||
dy2 < 0 ? (ystart + ysize + 1) : dy2);
|
dy2 < 0 ? (g.ystart + g.ysize + 1) : dy2);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (!OV_pop_typ(r, SPOVAR_SEL))
|
if (!OV_pop_typ(r, SPOVAR_SEL))
|
||||||
@@ -4914,15 +4899,15 @@ struct sp_coder *coder;
|
|||||||
tmpmazepart.halign = upc.x;
|
tmpmazepart.halign = upc.x;
|
||||||
tmpmazepart.valign = upc.y;
|
tmpmazepart.valign = upc.y;
|
||||||
|
|
||||||
tmpxsize = xsize;
|
tmpxsize = g.xsize;
|
||||||
tmpysize = ysize;
|
tmpysize = g.ysize;
|
||||||
tmpxstart = xstart;
|
tmpxstart = g.xstart;
|
||||||
tmpystart = ystart;
|
tmpystart = g.ystart;
|
||||||
|
|
||||||
halign = tmpmazepart.halign;
|
halign = tmpmazepart.halign;
|
||||||
valign = tmpmazepart.valign;
|
valign = tmpmazepart.valign;
|
||||||
xsize = tmpmazepart.xsize;
|
g.xsize = tmpmazepart.xsize;
|
||||||
ysize = tmpmazepart.ysize;
|
g.ysize = tmpmazepart.ysize;
|
||||||
switch (tmpmazepart.zaligntyp) {
|
switch (tmpmazepart.zaligntyp) {
|
||||||
default:
|
default:
|
||||||
case 0:
|
case 0:
|
||||||
@@ -4930,73 +4915,73 @@ struct sp_coder *coder;
|
|||||||
case 1:
|
case 1:
|
||||||
switch ((int) halign) {
|
switch ((int) halign) {
|
||||||
case LEFT:
|
case LEFT:
|
||||||
xstart = splev_init_present ? 1 : 3;
|
g.xstart = g.splev_init_present ? 1 : 3;
|
||||||
break;
|
break;
|
||||||
case H_LEFT:
|
case H_LEFT:
|
||||||
xstart = 2 + ((x_maze_max - 2 - xsize) / 4);
|
g.xstart = 2 + ((x_maze_max - 2 - g.xsize) / 4);
|
||||||
break;
|
break;
|
||||||
case CENTER:
|
case CENTER:
|
||||||
xstart = 2 + ((x_maze_max - 2 - xsize) / 2);
|
g.xstart = 2 + ((x_maze_max - 2 - g.xsize) / 2);
|
||||||
break;
|
break;
|
||||||
case H_RIGHT:
|
case H_RIGHT:
|
||||||
xstart = 2 + ((x_maze_max - 2 - xsize) * 3 / 4);
|
g.xstart = 2 + ((x_maze_max - 2 - g.xsize) * 3 / 4);
|
||||||
break;
|
break;
|
||||||
case RIGHT:
|
case RIGHT:
|
||||||
xstart = x_maze_max - xsize - 1;
|
g.xstart = x_maze_max - g.xsize - 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch ((int) valign) {
|
switch ((int) valign) {
|
||||||
case TOP:
|
case TOP:
|
||||||
ystart = 3;
|
g.ystart = 3;
|
||||||
break;
|
break;
|
||||||
case CENTER:
|
case CENTER:
|
||||||
ystart = 2 + ((y_maze_max - 2 - ysize) / 2);
|
g.ystart = 2 + ((y_maze_max - 2 - g.ysize) / 2);
|
||||||
break;
|
break;
|
||||||
case BOTTOM:
|
case BOTTOM:
|
||||||
ystart = y_maze_max - ysize - 1;
|
g.ystart = y_maze_max - g.ysize - 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!(xstart % 2))
|
if (!(g.xstart % 2))
|
||||||
xstart++;
|
g.xstart++;
|
||||||
if (!(ystart % 2))
|
if (!(g.ystart % 2))
|
||||||
ystart++;
|
g.ystart++;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (!coder->croom) {
|
if (!coder->croom) {
|
||||||
xstart = 1;
|
g.xstart = 1;
|
||||||
ystart = 0;
|
g.ystart = 0;
|
||||||
xsize = COLNO - 1 - tmpmazepart.xsize;
|
g.xsize = COLNO - 1 - tmpmazepart.xsize;
|
||||||
ysize = ROWNO - tmpmazepart.ysize;
|
g.ysize = ROWNO - tmpmazepart.ysize;
|
||||||
}
|
}
|
||||||
get_location_coord(&halign, &valign, ANY_LOC, coder->croom,
|
get_location_coord(&halign, &valign, ANY_LOC, coder->croom,
|
||||||
OV_i(mpa));
|
OV_i(mpa));
|
||||||
xsize = tmpmazepart.xsize;
|
g.xsize = tmpmazepart.xsize;
|
||||||
ysize = tmpmazepart.ysize;
|
g.ysize = tmpmazepart.ysize;
|
||||||
xstart = halign;
|
g.xstart = halign;
|
||||||
ystart = valign;
|
g.ystart = valign;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ystart < 0 || ystart + ysize > ROWNO) {
|
if (g.ystart < 0 || g.ystart + g.ysize > ROWNO) {
|
||||||
/* try to move the start a bit */
|
/* try to move the start a bit */
|
||||||
ystart += (ystart > 0) ? -2 : 2;
|
g.ystart += (g.ystart > 0) ? -2 : 2;
|
||||||
if (ysize == ROWNO)
|
if (g.ysize == ROWNO)
|
||||||
ystart = 0;
|
g.ystart = 0;
|
||||||
if (ystart < 0 || ystart + ysize > ROWNO)
|
if (g.ystart < 0 || g.ystart + g.ysize > ROWNO)
|
||||||
panic("reading special level with ysize too large");
|
panic("reading special level with g.ysize too large");
|
||||||
}
|
}
|
||||||
if (xsize <= 1 && ysize <= 1) {
|
if (g.xsize <= 1 && g.ysize <= 1) {
|
||||||
xstart = 1;
|
g.xstart = 1;
|
||||||
ystart = 0;
|
g.ystart = 0;
|
||||||
xsize = COLNO - 1;
|
g.xsize = COLNO - 1;
|
||||||
ysize = ROWNO;
|
g.ysize = ROWNO;
|
||||||
} else {
|
} else {
|
||||||
xchar x, y, mptyp;
|
xchar x, y, mptyp;
|
||||||
|
|
||||||
/* Load the map */
|
/* Load the map */
|
||||||
for (y = ystart; y < ystart + ysize; y++)
|
for (y = g.ystart; y < g.ystart + g.ysize; y++)
|
||||||
for (x = xstart; x < xstart + xsize; x++) {
|
for (x = g.xstart; x < g.xstart + g.xsize; x++) {
|
||||||
mptyp = (mpmap->vardata.str[(y - ystart) * xsize
|
mptyp = (mpmap->vardata.str[(y - g.ystart) * g.xsize
|
||||||
+ (x - xstart)] - 1);
|
+ (x - g.xstart)] - 1);
|
||||||
if (mptyp >= MAX_TYPE)
|
if (mptyp >= MAX_TYPE)
|
||||||
continue;
|
continue;
|
||||||
levl[x][y].typ = mptyp;
|
levl[x][y].typ = mptyp;
|
||||||
@@ -5006,7 +4991,7 @@ struct sp_coder *coder;
|
|||||||
levl[x][y].horizontal = 0;
|
levl[x][y].horizontal = 0;
|
||||||
levl[x][y].roomno = 0;
|
levl[x][y].roomno = 0;
|
||||||
levl[x][y].edge = 0;
|
levl[x][y].edge = 0;
|
||||||
SpLev_Map[x][y] = 1;
|
g.SpLev_Map[x][y] = 1;
|
||||||
/*
|
/*
|
||||||
* Set secret doors to closed (why not trapped too?). Set
|
* Set secret doors to closed (why not trapped too?). Set
|
||||||
* the horizontal bit.
|
* the horizontal bit.
|
||||||
@@ -5019,7 +5004,7 @@ struct sp_coder *coder;
|
|||||||
* (secret) door, then it is horizontal. This does
|
* (secret) door, then it is horizontal. This does
|
||||||
* not allow (secret) doors to be corners of rooms.
|
* not allow (secret) doors to be corners of rooms.
|
||||||
*/
|
*/
|
||||||
if (x != xstart && (IS_WALL(levl[x - 1][y].typ)
|
if (x != g.xstart && (IS_WALL(levl[x - 1][y].typ)
|
||||||
|| levl[x - 1][y].horizontal))
|
|| levl[x - 1][y].horizontal))
|
||||||
levl[x][y].horizontal = 1;
|
levl[x][y].horizontal = 1;
|
||||||
} else if (levl[x][y].typ == HWALL
|
} else if (levl[x][y].typ == HWALL
|
||||||
@@ -5027,17 +5012,17 @@ struct sp_coder *coder;
|
|||||||
levl[x][y].horizontal = 1;
|
levl[x][y].horizontal = 1;
|
||||||
else if (levl[x][y].typ == LAVAPOOL)
|
else if (levl[x][y].typ == LAVAPOOL)
|
||||||
levl[x][y].lit = 1;
|
levl[x][y].lit = 1;
|
||||||
else if (splev_init_present && levl[x][y].typ == ICE)
|
else if (g.splev_init_present && levl[x][y].typ == ICE)
|
||||||
levl[x][y].icedpool = icedpools ? ICED_POOL : ICED_MOAT;
|
levl[x][y].icedpool = g.icedpools ? ICED_POOL : ICED_MOAT;
|
||||||
}
|
}
|
||||||
if (coder->lvl_is_joined)
|
if (coder->lvl_is_joined)
|
||||||
remove_rooms(xstart, ystart, xstart + xsize, ystart + ysize);
|
remove_rooms(g.xstart, g.ystart, g.xstart + g.xsize, g.ystart + g.ysize);
|
||||||
}
|
}
|
||||||
if (!OV_i(mpkeepr)) {
|
if (!OV_i(mpkeepr)) {
|
||||||
xstart = tmpxstart;
|
g.xstart = tmpxstart;
|
||||||
ystart = tmpystart;
|
g.ystart = tmpystart;
|
||||||
xsize = tmpxsize;
|
g.xsize = tmpxsize;
|
||||||
ysize = tmpysize;
|
g.ysize = tmpysize;
|
||||||
}
|
}
|
||||||
|
|
||||||
opvar_free(mpxs);
|
opvar_free(mpxs);
|
||||||
@@ -5316,12 +5301,12 @@ sp_lev *lvl;
|
|||||||
coder->exit_script = FALSE;
|
coder->exit_script = FALSE;
|
||||||
coder->lvl_is_joined = 0;
|
coder->lvl_is_joined = 0;
|
||||||
|
|
||||||
splev_init_present = FALSE;
|
g.splev_init_present = FALSE;
|
||||||
icedpools = FALSE;
|
g.icedpools = FALSE;
|
||||||
/* achievement tracking; static init would suffice except we need to
|
/* achievement tracking; static init would suffice except we need to
|
||||||
reset if #wizmakemap is used to recreate mines' end or sokoban end;
|
reset if #wizmakemap is used to recreate mines' end or sokoban end;
|
||||||
once either level is created, these values can be forgotten */
|
once either level is created, these values can be forgotten */
|
||||||
mines_prize_count = soko_prize_count = 0;
|
g.mines_prize_count = g.soko_prize_count = 0;
|
||||||
|
|
||||||
if (wizard) {
|
if (wizard) {
|
||||||
char *met = nh_getenv("SPCODER_MAX_RUNTIME");
|
char *met = nh_getenv("SPCODER_MAX_RUNTIME");
|
||||||
@@ -5338,19 +5323,19 @@ sp_lev *lvl;
|
|||||||
shuffle_alignments();
|
shuffle_alignments();
|
||||||
|
|
||||||
for (tmpi = 0; tmpi < MAX_CONTAINMENT; tmpi++)
|
for (tmpi = 0; tmpi < MAX_CONTAINMENT; tmpi++)
|
||||||
container_obj[tmpi] = NULL;
|
g.container_obj[tmpi] = NULL;
|
||||||
container_idx = 0;
|
g.container_idx = 0;
|
||||||
|
|
||||||
invent_carrying_monster = NULL;
|
g.invent_carrying_monster = NULL;
|
||||||
|
|
||||||
(void) memset((genericptr_t) &SpLev_Map[0][0], 0, sizeof SpLev_Map);
|
(void) memset((genericptr_t) &g.SpLev_Map[0][0], 0, sizeof g.SpLev_Map);
|
||||||
|
|
||||||
level.flags.is_maze_lev = 0;
|
level.flags.is_maze_lev = 0;
|
||||||
|
|
||||||
xstart = 1;
|
g.xstart = 1;
|
||||||
ystart = 0;
|
g.ystart = 0;
|
||||||
xsize = COLNO - 1;
|
g.xsize = COLNO - 1;
|
||||||
ysize = ROWNO;
|
g.ysize = ROWNO;
|
||||||
|
|
||||||
while (coder->frame->n_opcode < lvl->n_opcodes && !coder->exit_script) {
|
while (coder->frame->n_opcode < lvl->n_opcodes && !coder->exit_script) {
|
||||||
coder->opcode = lvl->opcodes[coder->frame->n_opcode].opcode;
|
coder->opcode = lvl->opcodes[coder->frame->n_opcode].opcode;
|
||||||
@@ -5911,8 +5896,8 @@ sp_lev *lvl;
|
|||||||
if (!OV_pop_typ(pt, SPOVAR_SEL))
|
if (!OV_pop_typ(pt, SPOVAR_SEL))
|
||||||
panic("no selection for rndcoord");
|
panic("no selection for rndcoord");
|
||||||
if (selection_rndcoord(pt, &x, &y, FALSE)) {
|
if (selection_rndcoord(pt, &x, &y, FALSE)) {
|
||||||
x -= xstart;
|
x -= g.xstart;
|
||||||
y -= ystart;
|
y -= g.ystart;
|
||||||
}
|
}
|
||||||
splev_stack_push(coder->stack, opvar_new_coord(x, y));
|
splev_stack_push(coder->stack, opvar_new_coord(x, y));
|
||||||
opvar_free(pt);
|
opvar_free(pt);
|
||||||
|
|||||||
+20
-22
@@ -1377,8 +1377,6 @@ static const char *spl_sortchoices[NUM_SPELL_SORTBY] = {
|
|||||||
/* a menu choice rather than a sort choice */
|
/* a menu choice rather than a sort choice */
|
||||||
"reassign casting letters to retain current order",
|
"reassign casting letters to retain current order",
|
||||||
};
|
};
|
||||||
static int spl_sortmode = 0; /* index into spl_sortchoices[] */
|
|
||||||
static int *spl_orderindx = 0; /* array of spl_book[] indices */
|
|
||||||
|
|
||||||
/* qsort callback routine */
|
/* qsort callback routine */
|
||||||
STATIC_PTR int CFDECLSPEC
|
STATIC_PTR int CFDECLSPEC
|
||||||
@@ -1399,7 +1397,7 @@ const genericptr vptr2;
|
|||||||
levl1 = objects[otyp1].oc_level, levl2 = objects[otyp2].oc_level,
|
levl1 = objects[otyp1].oc_level, levl2 = objects[otyp2].oc_level,
|
||||||
skil1 = objects[otyp1].oc_skill, skil2 = objects[otyp2].oc_skill;
|
skil1 = objects[otyp1].oc_skill, skil2 = objects[otyp2].oc_skill;
|
||||||
|
|
||||||
switch (spl_sortmode) {
|
switch (g.spl_sortmode) {
|
||||||
case SORTBY_LETTER:
|
case SORTBY_LETTER:
|
||||||
return indx1 - indx2;
|
return indx1 - indx2;
|
||||||
case SORTBY_ALPHA:
|
case SORTBY_ALPHA:
|
||||||
@@ -1450,40 +1448,40 @@ sortspells()
|
|||||||
int n;
|
int n;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (spl_sortmode == SORTBY_CURRENT)
|
if (g.spl_sortmode == SORTBY_CURRENT)
|
||||||
return;
|
return;
|
||||||
for (n = 0; n < MAXSPELL && spellid(n) != NO_SPELL; ++n)
|
for (n = 0; n < MAXSPELL && spellid(n) != NO_SPELL; ++n)
|
||||||
continue;
|
continue;
|
||||||
if (n < 2)
|
if (n < 2)
|
||||||
return; /* not enough entries to need sorting */
|
return; /* not enough entries to need sorting */
|
||||||
|
|
||||||
if (!spl_orderindx) {
|
if (!g.spl_orderindx) {
|
||||||
/* we haven't done any sorting yet; list is in casting order */
|
/* we haven't done any sorting yet; list is in casting order */
|
||||||
if (spl_sortmode == SORTBY_LETTER /* default */
|
if (g.spl_sortmode == SORTBY_LETTER /* default */
|
||||||
|| spl_sortmode == SORTRETAINORDER)
|
|| g.spl_sortmode == SORTRETAINORDER)
|
||||||
return;
|
return;
|
||||||
/* allocate enough for full spellbook rather than just N spells */
|
/* allocate enough for full spellbook rather than just N spells */
|
||||||
spl_orderindx = (int *) alloc(MAXSPELL * sizeof(int));
|
g.spl_orderindx = (int *) alloc(MAXSPELL * sizeof(int));
|
||||||
for (i = 0; i < MAXSPELL; i++)
|
for (i = 0; i < MAXSPELL; i++)
|
||||||
spl_orderindx[i] = i;
|
g.spl_orderindx[i] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spl_sortmode == SORTRETAINORDER) {
|
if (g.spl_sortmode == SORTRETAINORDER) {
|
||||||
struct spell tmp_book[MAXSPELL];
|
struct spell tmp_book[MAXSPELL];
|
||||||
|
|
||||||
/* sort spl_book[] rather than spl_orderindx[];
|
/* sort spl_book[] rather than spl_orderindx[];
|
||||||
this also updates the index to reflect the new ordering (we
|
this also updates the index to reflect the new ordering (we
|
||||||
could just free it since that ordering becomes the default) */
|
could just free it since that ordering becomes the default) */
|
||||||
for (i = 0; i < MAXSPELL; i++)
|
for (i = 0; i < MAXSPELL; i++)
|
||||||
tmp_book[i] = spl_book[spl_orderindx[i]];
|
tmp_book[i] = spl_book[g.spl_orderindx[i]];
|
||||||
for (i = 0; i < MAXSPELL; i++)
|
for (i = 0; i < MAXSPELL; i++)
|
||||||
spl_book[i] = tmp_book[i], spl_orderindx[i] = i;
|
spl_book[i] = tmp_book[i], g.spl_orderindx[i] = i;
|
||||||
spl_sortmode = SORTBY_LETTER; /* reset */
|
g.spl_sortmode = SORTBY_LETTER; /* reset */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* usual case, sort the index rather than the spells themselves */
|
/* usual case, sort the index rather than the spells themselves */
|
||||||
qsort((genericptr_t) spl_orderindx, n, sizeof *spl_orderindx, spell_cmp);
|
qsort((genericptr_t) g.spl_orderindx, n, sizeof *g.spl_orderindx, spell_cmp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1513,7 +1511,7 @@ spellsortmenu()
|
|||||||
}
|
}
|
||||||
any.a_int = i + 1;
|
any.a_int = i + 1;
|
||||||
add_menu(tmpwin, NO_GLYPH, &any, let, 0, ATR_NONE, spl_sortchoices[i],
|
add_menu(tmpwin, NO_GLYPH, &any, let, 0, ATR_NONE, spl_sortchoices[i],
|
||||||
(i == spl_sortmode) ? MENU_SELECTED : MENU_UNSELECTED);
|
(i == g.spl_sortmode) ? MENU_SELECTED : MENU_UNSELECTED);
|
||||||
}
|
}
|
||||||
end_menu(tmpwin, "View known spells list sorted");
|
end_menu(tmpwin, "View known spells list sorted");
|
||||||
|
|
||||||
@@ -1522,10 +1520,10 @@ spellsortmenu()
|
|||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
choice = selected[0].item.a_int - 1;
|
choice = selected[0].item.a_int - 1;
|
||||||
/* skip preselected entry if we have more than one item chosen */
|
/* skip preselected entry if we have more than one item chosen */
|
||||||
if (n > 1 && choice == spl_sortmode)
|
if (n > 1 && choice == g.spl_sortmode)
|
||||||
choice = selected[1].item.a_int - 1;
|
choice = selected[1].item.a_int - 1;
|
||||||
free((genericptr_t) selected);
|
free((genericptr_t) selected);
|
||||||
spl_sortmode = choice;
|
g.spl_sortmode = choice;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -1559,11 +1557,11 @@ dovspell()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (spl_orderindx) {
|
if (g.spl_orderindx) {
|
||||||
free((genericptr_t) spl_orderindx);
|
free((genericptr_t) g.spl_orderindx);
|
||||||
spl_orderindx = 0;
|
g.spl_orderindx = 0;
|
||||||
}
|
}
|
||||||
spl_sortmode = SORTBY_LETTER; /* 0 */
|
g.spl_sortmode = SORTBY_LETTER; /* 0 */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1602,7 +1600,7 @@ int *spell_no;
|
|||||||
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, buf,
|
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, buf,
|
||||||
MENU_UNSELECTED);
|
MENU_UNSELECTED);
|
||||||
for (i = 0; i < MAXSPELL && spellid(i) != NO_SPELL; i++) {
|
for (i = 0; i < MAXSPELL && spellid(i) != NO_SPELL; i++) {
|
||||||
splnum = !spl_orderindx ? i : spl_orderindx[i];
|
splnum = !g.spl_orderindx ? i : g.spl_orderindx[i];
|
||||||
Sprintf(buf, fmt, spellname(splnum), spellev(splnum),
|
Sprintf(buf, fmt, spellname(splnum), spellev(splnum),
|
||||||
spelltypemnemonic(spell_skilltype(spellid(splnum))),
|
spelltypemnemonic(spell_skilltype(spellid(splnum))),
|
||||||
100 - percent_success(splnum),
|
100 - percent_success(splnum),
|
||||||
|
|||||||
+24
-28
@@ -1659,10 +1659,6 @@ STATIC_DCL boolean FDECL(mon_is_local, (struct monst *));
|
|||||||
STATIC_DCL boolean FDECL(timer_is_local, (timer_element *));
|
STATIC_DCL boolean FDECL(timer_is_local, (timer_element *));
|
||||||
STATIC_DCL int FDECL(maybe_write_timer, (int, int, BOOLEAN_P));
|
STATIC_DCL int FDECL(maybe_write_timer, (int, int, BOOLEAN_P));
|
||||||
|
|
||||||
/* ordered timer list */
|
|
||||||
static timer_element *timer_base; /* "active" */
|
|
||||||
static unsigned long timer_id = 1;
|
|
||||||
|
|
||||||
/* If defined, then include names when printing out the timer queue */
|
/* If defined, then include names when printing out the timer queue */
|
||||||
#define VERBOSE_TIMER
|
#define VERBOSE_TIMER
|
||||||
|
|
||||||
@@ -1757,7 +1753,7 @@ wiz_timeout_queue()
|
|||||||
putstr(win, 0, "");
|
putstr(win, 0, "");
|
||||||
putstr(win, 0, "Active timeout queue:");
|
putstr(win, 0, "Active timeout queue:");
|
||||||
putstr(win, 0, "");
|
putstr(win, 0, "");
|
||||||
print_queue(win, timer_base);
|
print_queue(win, g.timer_base);
|
||||||
|
|
||||||
/* Timed properies:
|
/* Timed properies:
|
||||||
* check every one; the majority can't obtain temporary timeouts in
|
* check every one; the majority can't obtain temporary timeouts in
|
||||||
@@ -1811,7 +1807,7 @@ timer_sanity_check()
|
|||||||
timer_element *curr;
|
timer_element *curr;
|
||||||
|
|
||||||
/* this should be much more complete */
|
/* this should be much more complete */
|
||||||
for (curr = timer_base; curr; curr = curr->next)
|
for (curr = g.timer_base; curr; curr = curr->next)
|
||||||
if (curr->kind == TIMER_OBJECT) {
|
if (curr->kind == TIMER_OBJECT) {
|
||||||
struct obj *obj = curr->arg.a_obj;
|
struct obj *obj = curr->arg.a_obj;
|
||||||
|
|
||||||
@@ -1836,9 +1832,9 @@ run_timers()
|
|||||||
* any time. The list is ordered, we are done when the first element
|
* any time. The list is ordered, we are done when the first element
|
||||||
* is in the future.
|
* is in the future.
|
||||||
*/
|
*/
|
||||||
while (timer_base && timer_base->timeout <= monstermoves) {
|
while (g.timer_base && g.timer_base->timeout <= monstermoves) {
|
||||||
curr = timer_base;
|
curr = g.timer_base;
|
||||||
timer_base = curr->next;
|
g.timer_base = curr->next;
|
||||||
|
|
||||||
if (curr->kind == TIMER_OBJECT)
|
if (curr->kind == TIMER_OBJECT)
|
||||||
(curr->arg.a_obj)->timed--;
|
(curr->arg.a_obj)->timed--;
|
||||||
@@ -1865,7 +1861,7 @@ anything *arg;
|
|||||||
gnu = (timer_element *) alloc(sizeof(timer_element));
|
gnu = (timer_element *) alloc(sizeof(timer_element));
|
||||||
(void) memset((genericptr_t)gnu, 0, sizeof(timer_element));
|
(void) memset((genericptr_t)gnu, 0, sizeof(timer_element));
|
||||||
gnu->next = 0;
|
gnu->next = 0;
|
||||||
gnu->tid = timer_id++;
|
gnu->tid = g.timer_id++;
|
||||||
gnu->timeout = monstermoves + when;
|
gnu->timeout = monstermoves + when;
|
||||||
gnu->kind = kind;
|
gnu->kind = kind;
|
||||||
gnu->needs_fixup = 0;
|
gnu->needs_fixup = 0;
|
||||||
@@ -1892,7 +1888,7 @@ anything *arg;
|
|||||||
timer_element *doomed;
|
timer_element *doomed;
|
||||||
long timeout;
|
long timeout;
|
||||||
|
|
||||||
doomed = remove_timer(&timer_base, func_index, arg);
|
doomed = remove_timer(&g.timer_base, func_index, arg);
|
||||||
|
|
||||||
if (doomed) {
|
if (doomed) {
|
||||||
timeout = doomed->timeout;
|
timeout = doomed->timeout;
|
||||||
@@ -1916,7 +1912,7 @@ anything *arg;
|
|||||||
{
|
{
|
||||||
timer_element *curr;
|
timer_element *curr;
|
||||||
|
|
||||||
for (curr = timer_base; curr; curr = curr->next) {
|
for (curr = g.timer_base; curr; curr = curr->next) {
|
||||||
if (curr->func_index == type && curr->arg.a_void == arg->a_void)
|
if (curr->func_index == type && curr->arg.a_void == arg->a_void)
|
||||||
return curr->timeout;
|
return curr->timeout;
|
||||||
}
|
}
|
||||||
@@ -1933,7 +1929,7 @@ struct obj *src, *dest;
|
|||||||
int count;
|
int count;
|
||||||
timer_element *curr;
|
timer_element *curr;
|
||||||
|
|
||||||
for (count = 0, curr = timer_base; curr; curr = curr->next)
|
for (count = 0, curr = g.timer_base; curr; curr = curr->next)
|
||||||
if (curr->kind == TIMER_OBJECT && curr->arg.a_obj == src) {
|
if (curr->kind == TIMER_OBJECT && curr->arg.a_obj == src) {
|
||||||
curr->arg.a_obj = dest;
|
curr->arg.a_obj = dest;
|
||||||
dest->timed++;
|
dest->timed++;
|
||||||
@@ -1953,7 +1949,7 @@ struct obj *src, *dest;
|
|||||||
{
|
{
|
||||||
timer_element *curr, *next_timer = 0;
|
timer_element *curr, *next_timer = 0;
|
||||||
|
|
||||||
for (curr = timer_base; curr; curr = next_timer) {
|
for (curr = g.timer_base; curr; curr = next_timer) {
|
||||||
next_timer = curr->next; /* things may be inserted */
|
next_timer = curr->next; /* things may be inserted */
|
||||||
if (curr->kind == TIMER_OBJECT && curr->arg.a_obj == src) {
|
if (curr->kind == TIMER_OBJECT && curr->arg.a_obj == src) {
|
||||||
(void) start_timer(curr->timeout - monstermoves, TIMER_OBJECT,
|
(void) start_timer(curr->timeout - monstermoves, TIMER_OBJECT,
|
||||||
@@ -1972,13 +1968,13 @@ struct obj *obj;
|
|||||||
{
|
{
|
||||||
timer_element *curr, *prev, *next_timer = 0;
|
timer_element *curr, *prev, *next_timer = 0;
|
||||||
|
|
||||||
for (prev = 0, curr = timer_base; curr; curr = next_timer) {
|
for (prev = 0, curr = g.timer_base; curr; curr = next_timer) {
|
||||||
next_timer = curr->next;
|
next_timer = curr->next;
|
||||||
if (curr->kind == TIMER_OBJECT && curr->arg.a_obj == obj) {
|
if (curr->kind == TIMER_OBJECT && curr->arg.a_obj == obj) {
|
||||||
if (prev)
|
if (prev)
|
||||||
prev->next = curr->next;
|
prev->next = curr->next;
|
||||||
else
|
else
|
||||||
timer_base = curr->next;
|
g.timer_base = curr->next;
|
||||||
if (timeout_funcs[curr->func_index].cleanup)
|
if (timeout_funcs[curr->func_index].cleanup)
|
||||||
(*timeout_funcs[curr->func_index].cleanup)(&curr->arg,
|
(*timeout_funcs[curr->func_index].cleanup)(&curr->arg,
|
||||||
curr->timeout);
|
curr->timeout);
|
||||||
@@ -2015,14 +2011,14 @@ short func_index;
|
|||||||
timer_element *curr, *prev, *next_timer = 0;
|
timer_element *curr, *prev, *next_timer = 0;
|
||||||
long where = (((long) x << 16) | ((long) y));
|
long where = (((long) x << 16) | ((long) y));
|
||||||
|
|
||||||
for (prev = 0, curr = timer_base; curr; curr = next_timer) {
|
for (prev = 0, curr = g.timer_base; curr; curr = next_timer) {
|
||||||
next_timer = curr->next;
|
next_timer = curr->next;
|
||||||
if (curr->kind == TIMER_LEVEL && curr->func_index == func_index
|
if (curr->kind == TIMER_LEVEL && curr->func_index == func_index
|
||||||
&& curr->arg.a_long == where) {
|
&& curr->arg.a_long == where) {
|
||||||
if (prev)
|
if (prev)
|
||||||
prev->next = curr->next;
|
prev->next = curr->next;
|
||||||
else
|
else
|
||||||
timer_base = curr->next;
|
g.timer_base = curr->next;
|
||||||
if (timeout_funcs[curr->func_index].cleanup)
|
if (timeout_funcs[curr->func_index].cleanup)
|
||||||
(*timeout_funcs[curr->func_index].cleanup)(&curr->arg,
|
(*timeout_funcs[curr->func_index].cleanup)(&curr->arg,
|
||||||
curr->timeout);
|
curr->timeout);
|
||||||
@@ -2045,7 +2041,7 @@ short func_index;
|
|||||||
timer_element *curr;
|
timer_element *curr;
|
||||||
long where = (((long) x << 16) | ((long) y));
|
long where = (((long) x << 16) | ((long) y));
|
||||||
|
|
||||||
for (curr = timer_base; curr; curr = curr->next) {
|
for (curr = g.timer_base; curr; curr = curr->next) {
|
||||||
if (curr->kind == TIMER_LEVEL && curr->func_index == func_index
|
if (curr->kind == TIMER_LEVEL && curr->func_index == func_index
|
||||||
&& curr->arg.a_long == where)
|
&& curr->arg.a_long == where)
|
||||||
return curr->timeout;
|
return curr->timeout;
|
||||||
@@ -2069,7 +2065,7 @@ timer_element *gnu;
|
|||||||
{
|
{
|
||||||
timer_element *curr, *prev;
|
timer_element *curr, *prev;
|
||||||
|
|
||||||
for (prev = 0, curr = timer_base; curr; prev = curr, curr = curr->next)
|
for (prev = 0, curr = g.timer_base; curr; prev = curr, curr = curr->next)
|
||||||
if (curr->timeout >= gnu->timeout)
|
if (curr->timeout >= gnu->timeout)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -2077,7 +2073,7 @@ timer_element *gnu;
|
|||||||
if (prev)
|
if (prev)
|
||||||
prev->next = gnu;
|
prev->next = gnu;
|
||||||
else
|
else
|
||||||
timer_base = gnu;
|
g.timer_base = gnu;
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC_OVL timer_element *
|
STATIC_OVL timer_element *
|
||||||
@@ -2231,7 +2227,7 @@ boolean write_it;
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
timer_element *curr;
|
timer_element *curr;
|
||||||
|
|
||||||
for (curr = timer_base; curr; curr = curr->next) {
|
for (curr = g.timer_base; curr; curr = curr->next) {
|
||||||
if (range == RANGE_GLOBAL) {
|
if (range == RANGE_GLOBAL) {
|
||||||
/* global timers */
|
/* global timers */
|
||||||
|
|
||||||
@@ -2277,7 +2273,7 @@ int fd, mode, range;
|
|||||||
|
|
||||||
if (perform_bwrite(mode)) {
|
if (perform_bwrite(mode)) {
|
||||||
if (range == RANGE_GLOBAL)
|
if (range == RANGE_GLOBAL)
|
||||||
bwrite(fd, (genericptr_t) &timer_id, sizeof(timer_id));
|
bwrite(fd, (genericptr_t) &g.timer_id, sizeof(g.timer_id));
|
||||||
|
|
||||||
count = maybe_write_timer(fd, range, FALSE);
|
count = maybe_write_timer(fd, range, FALSE);
|
||||||
bwrite(fd, (genericptr_t) &count, sizeof count);
|
bwrite(fd, (genericptr_t) &count, sizeof count);
|
||||||
@@ -2285,14 +2281,14 @@ int fd, mode, range;
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (release_data(mode)) {
|
if (release_data(mode)) {
|
||||||
for (prev = 0, curr = timer_base; curr; curr = next_timer) {
|
for (prev = 0, curr = g.timer_base; curr; curr = next_timer) {
|
||||||
next_timer = curr->next; /* in case curr is removed */
|
next_timer = curr->next; /* in case curr is removed */
|
||||||
|
|
||||||
if (!(!!(range == RANGE_LEVEL) ^ !!timer_is_local(curr))) {
|
if (!(!!(range == RANGE_LEVEL) ^ !!timer_is_local(curr))) {
|
||||||
if (prev)
|
if (prev)
|
||||||
prev->next = curr->next;
|
prev->next = curr->next;
|
||||||
else
|
else
|
||||||
timer_base = curr->next;
|
g.timer_base = curr->next;
|
||||||
free((genericptr_t) curr);
|
free((genericptr_t) curr);
|
||||||
/* prev stays the same */
|
/* prev stays the same */
|
||||||
} else {
|
} else {
|
||||||
@@ -2316,7 +2312,7 @@ long adjust; /* how much to adjust timeout */
|
|||||||
timer_element *curr;
|
timer_element *curr;
|
||||||
|
|
||||||
if (range == RANGE_GLOBAL)
|
if (range == RANGE_GLOBAL)
|
||||||
mread(fd, (genericptr_t) &timer_id, sizeof timer_id);
|
mread(fd, (genericptr_t) &g.timer_id, sizeof g.timer_id);
|
||||||
|
|
||||||
/* restore elements */
|
/* restore elements */
|
||||||
mread(fd, (genericptr_t) &count, sizeof count);
|
mread(fd, (genericptr_t) &count, sizeof count);
|
||||||
@@ -2340,7 +2336,7 @@ long *count, *size;
|
|||||||
|
|
||||||
Sprintf(hdrbuf, hdrfmt, (long) sizeof (timer_element));
|
Sprintf(hdrbuf, hdrfmt, (long) sizeof (timer_element));
|
||||||
*count = *size = 0L;
|
*count = *size = 0L;
|
||||||
for (te = timer_base; te; te = te->next) {
|
for (te = g.timer_base; te; te = te->next) {
|
||||||
++*count;
|
++*count;
|
||||||
*size += (long) sizeof *te;
|
*size += (long) sizeof *te;
|
||||||
}
|
}
|
||||||
@@ -2354,7 +2350,7 @@ boolean ghostly;
|
|||||||
timer_element *curr;
|
timer_element *curr;
|
||||||
unsigned nid;
|
unsigned nid;
|
||||||
|
|
||||||
for (curr = timer_base; curr; curr = curr->next) {
|
for (curr = g.timer_base; curr; curr = curr->next) {
|
||||||
if (curr->needs_fixup) {
|
if (curr->needs_fixup) {
|
||||||
if (curr->kind == TIMER_OBJECT) {
|
if (curr->kind == TIMER_OBJECT) {
|
||||||
if (ghostly) {
|
if (ghostly) {
|
||||||
|
|||||||
+8
-10
@@ -82,8 +82,6 @@ STATIC_DCL void FDECL(nsb_mung_line, (char *));
|
|||||||
STATIC_DCL void FDECL(nsb_unmung_line, (char *));
|
STATIC_DCL void FDECL(nsb_unmung_line, (char *));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static winid toptenwin = WIN_ERR;
|
|
||||||
|
|
||||||
/* "killed by",&c ["an"] 'killer.name' */
|
/* "killed by",&c ["an"] 'killer.name' */
|
||||||
void
|
void
|
||||||
formatkiller(buf, siz, how, incl_helpless)
|
formatkiller(buf, siz, how, incl_helpless)
|
||||||
@@ -161,20 +159,20 @@ STATIC_OVL void
|
|||||||
topten_print(x)
|
topten_print(x)
|
||||||
const char *x;
|
const char *x;
|
||||||
{
|
{
|
||||||
if (toptenwin == WIN_ERR)
|
if (g.toptenwin == WIN_ERR)
|
||||||
raw_print(x);
|
raw_print(x);
|
||||||
else
|
else
|
||||||
putstr(toptenwin, ATR_NONE, x);
|
putstr(g.toptenwin, ATR_NONE, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC_OVL void
|
STATIC_OVL void
|
||||||
topten_print_bold(x)
|
topten_print_bold(x)
|
||||||
const char *x;
|
const char *x;
|
||||||
{
|
{
|
||||||
if (toptenwin == WIN_ERR)
|
if (g.toptenwin == WIN_ERR)
|
||||||
raw_print_bold(x);
|
raw_print_bold(x);
|
||||||
else
|
else
|
||||||
putstr(toptenwin, ATR_BOLD, x);
|
putstr(g.toptenwin, ATR_BOLD, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -517,7 +515,7 @@ time_t when;
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (iflags.toptenwin) {
|
if (iflags.toptenwin) {
|
||||||
toptenwin = create_nhwindow(NHW_TEXT);
|
g.toptenwin = create_nhwindow(NHW_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(UNIX) || defined(VMS) || defined(__EMX__)
|
#if defined(UNIX) || defined(VMS) || defined(__EMX__)
|
||||||
@@ -769,13 +767,13 @@ time_t when;
|
|||||||
|
|
||||||
showwin:
|
showwin:
|
||||||
if (iflags.toptenwin && !done_stopprint)
|
if (iflags.toptenwin && !done_stopprint)
|
||||||
display_nhwindow(toptenwin, 1);
|
display_nhwindow(g.toptenwin, 1);
|
||||||
destroywin:
|
destroywin:
|
||||||
if (!t0_used)
|
if (!t0_used)
|
||||||
dealloc_ttentry(t0);
|
dealloc_ttentry(t0);
|
||||||
if (iflags.toptenwin) {
|
if (iflags.toptenwin) {
|
||||||
destroy_nhwindow(toptenwin);
|
destroy_nhwindow(g.toptenwin);
|
||||||
toptenwin = WIN_ERR;
|
g.toptenwin = WIN_ERR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+20
-38
@@ -1681,36 +1681,26 @@ struct trap *trap;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* The following are used to track launched objects to
|
|
||||||
* prevent them from vanishing if you are killed. They
|
|
||||||
* will reappear at the launchplace in bones files.
|
|
||||||
*/
|
|
||||||
static struct {
|
|
||||||
struct obj *obj;
|
|
||||||
xchar x, y;
|
|
||||||
} launchplace;
|
|
||||||
|
|
||||||
STATIC_OVL void
|
STATIC_OVL void
|
||||||
launch_drop_spot(obj, x, y)
|
launch_drop_spot(obj, x, y)
|
||||||
struct obj *obj;
|
struct obj *obj;
|
||||||
xchar x, y;
|
xchar x, y;
|
||||||
{
|
{
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
launchplace.obj = (struct obj *) 0;
|
g.launchplace.obj = (struct obj *) 0;
|
||||||
launchplace.x = 0;
|
g.launchplace.x = 0;
|
||||||
launchplace.y = 0;
|
g.launchplace.y = 0;
|
||||||
} else {
|
} else {
|
||||||
launchplace.obj = obj;
|
g.launchplace.obj = obj;
|
||||||
launchplace.x = x;
|
g.launchplace.x = x;
|
||||||
launchplace.y = y;
|
g.launchplace.y = y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
launch_in_progress()
|
launch_in_progress()
|
||||||
{
|
{
|
||||||
if (launchplace.obj)
|
if (g.launchplace.obj)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -1718,9 +1708,9 @@ launch_in_progress()
|
|||||||
void
|
void
|
||||||
force_launch_placement()
|
force_launch_placement()
|
||||||
{
|
{
|
||||||
if (launchplace.obj) {
|
if (g.launchplace.obj) {
|
||||||
launchplace.obj->otrapped = 0;
|
g.launchplace.obj->otrapped = 0;
|
||||||
place_object(launchplace.obj, launchplace.x, launchplace.y);
|
place_object(g.launchplace.obj, g.launchplace.x, g.launchplace.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3467,14 +3457,6 @@ struct obj *obj;
|
|||||||
erode_obj(obj, (char *) 0, ERODE_CORRODE, EF_GREASE | EF_VERBOSE);
|
erode_obj(obj, (char *) 0, ERODE_CORRODE, EF_GREASE | EF_VERBOSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* context for water_damage(), managed by water_damage_chain();
|
|
||||||
when more than one stack of potions of acid explode while processing
|
|
||||||
a chain of objects, use alternate phrasing after the first message */
|
|
||||||
static struct h2o_ctx {
|
|
||||||
int dkn_boom, unk_boom; /* track dknown, !dknown separately */
|
|
||||||
boolean ctx_valid;
|
|
||||||
} acid_ctx = { 0, 0, FALSE };
|
|
||||||
|
|
||||||
/* Get an object wet and damage it appropriately.
|
/* Get an object wet and damage it appropriately.
|
||||||
* "ostr", if present, is used instead of the object name in some
|
* "ostr", if present, is used instead of the object name in some
|
||||||
* messages.
|
* messages.
|
||||||
@@ -3573,9 +3555,9 @@ boolean force;
|
|||||||
|
|
||||||
if (Blind && !carried(obj))
|
if (Blind && !carried(obj))
|
||||||
obj->dknown = 0;
|
obj->dknown = 0;
|
||||||
if (acid_ctx.ctx_valid)
|
if (g.acid_ctx.ctx_valid)
|
||||||
exploded = ((obj->dknown ? acid_ctx.dkn_boom
|
exploded = ((obj->dknown ? g.acid_ctx.dkn_boom
|
||||||
: acid_ctx.unk_boom) > 0);
|
: g.acid_ctx.unk_boom) > 0);
|
||||||
/* First message is
|
/* First message is
|
||||||
* "a [potion|<color> potion|potion of acid] explodes"
|
* "a [potion|<color> potion|potion of acid] explodes"
|
||||||
* depending on obj->dknown (potion has been seen) and
|
* depending on obj->dknown (potion has been seen) and
|
||||||
@@ -3591,11 +3573,11 @@ boolean force;
|
|||||||
!exploded ? (one ? "A" : "Some")
|
!exploded ? (one ? "A" : "Some")
|
||||||
: (one ? "Another" : "More"),
|
: (one ? "Another" : "More"),
|
||||||
bufp, vtense(bufp, "explode"));
|
bufp, vtense(bufp, "explode"));
|
||||||
if (acid_ctx.ctx_valid) {
|
if (g.acid_ctx.ctx_valid) {
|
||||||
if (obj->dknown)
|
if (obj->dknown)
|
||||||
acid_ctx.dkn_boom++;
|
g.acid_ctx.dkn_boom++;
|
||||||
else
|
else
|
||||||
acid_ctx.unk_boom++;
|
g.acid_ctx.unk_boom++;
|
||||||
}
|
}
|
||||||
setnotworn(obj);
|
setnotworn(obj);
|
||||||
delobj(obj);
|
delobj(obj);
|
||||||
@@ -3637,8 +3619,8 @@ boolean here;
|
|||||||
|
|
||||||
/* initialize acid context: so far, neither seen (dknown) potions of
|
/* initialize acid context: so far, neither seen (dknown) potions of
|
||||||
acid nor unseen have exploded during this water damage sequence */
|
acid nor unseen have exploded during this water damage sequence */
|
||||||
acid_ctx.dkn_boom = acid_ctx.unk_boom = 0;
|
g.acid_ctx.dkn_boom = g.acid_ctx.unk_boom = 0;
|
||||||
acid_ctx.ctx_valid = TRUE;
|
g.acid_ctx.ctx_valid = TRUE;
|
||||||
|
|
||||||
for (; obj; obj = otmp) {
|
for (; obj; obj = otmp) {
|
||||||
otmp = here ? obj->nexthere : obj->nobj;
|
otmp = here ? obj->nexthere : obj->nobj;
|
||||||
@@ -3646,8 +3628,8 @@ boolean here;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* reset acid context */
|
/* reset acid context */
|
||||||
acid_ctx.dkn_boom = acid_ctx.unk_boom = 0;
|
g.acid_ctx.dkn_boom = g.acid_ctx.unk_boom = 0;
|
||||||
acid_ctx.ctx_valid = FALSE;
|
g.acid_ctx.ctx_valid = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
+4
-6
@@ -185,8 +185,6 @@ wl_addtail(struct winlink *wl)
|
|||||||
}
|
}
|
||||||
#endif /* WINCHAIN */
|
#endif /* WINCHAIN */
|
||||||
|
|
||||||
static struct win_choices *last_winchoice = 0;
|
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
genl_can_suspend_no(VOID_ARGS)
|
genl_can_suspend_no(VOID_ARGS)
|
||||||
{
|
{
|
||||||
@@ -253,11 +251,11 @@ const char *s;
|
|||||||
if (!strcmpi(s, winchoices[i].procs->name)) {
|
if (!strcmpi(s, winchoices[i].procs->name)) {
|
||||||
windowprocs = *winchoices[i].procs;
|
windowprocs = *winchoices[i].procs;
|
||||||
|
|
||||||
if (last_winchoice && last_winchoice->ini_routine)
|
if (g.last_winchoice && g.last_winchoice->ini_routine)
|
||||||
(*last_winchoice->ini_routine)(WININIT_UNDO);
|
(*g.last_winchoice->ini_routine)(WININIT_UNDO);
|
||||||
if (winchoices[i].ini_routine)
|
if (winchoices[i].ini_routine)
|
||||||
(*winchoices[i].ini_routine)(WININIT);
|
(*winchoices[i].ini_routine)(WININIT);
|
||||||
last_winchoice = &winchoices[i];
|
g.last_winchoice = &winchoices[i];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -374,7 +372,7 @@ commit_windowchain()
|
|||||||
p->nextlink->linkdata);
|
p->nextlink->linkdata);
|
||||||
} else {
|
} else {
|
||||||
(void) (*p->wincp->chain_routine)(WINCHAIN_INIT, n, p->linkdata,
|
(void) (*p->wincp->chain_routine)(WINCHAIN_INIT, n, p->linkdata,
|
||||||
last_winchoice->procs, 0);
|
g.last_winchoice->procs, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -123,9 +123,9 @@ static char sccsid[] = "@(#)random.c 5.5 (Berkeley) 7/6/88";
|
|||||||
|
|
||||||
#define MAX_TYPES 5 /* max number of types above */
|
#define MAX_TYPES 5 /* max number of types above */
|
||||||
|
|
||||||
static int degrees[MAX_TYPES] = { DEG_0, DEG_1, DEG_2, DEG_3, DEG_4 };
|
static const int degrees[MAX_TYPES] = { DEG_0, DEG_1, DEG_2, DEG_3, DEG_4 };
|
||||||
|
|
||||||
static int seps[MAX_TYPES] = { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 };
|
static const int seps[MAX_TYPES] = { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initially, everything is set up as if from :
|
* Initially, everything is set up as if from :
|
||||||
|
|||||||
Reference in New Issue
Block a user