|
|
@ -17,7 +17,7 @@ NEARDATA const struct c_color_names c_color_names = {
|
|
|
|
"black", "amber", "golden", "light blue", "red", "green",
|
|
|
|
"black", "amber", "golden", "light blue", "red", "green",
|
|
|
|
"silver", "blue", "purple", "white", "orange"
|
|
|
|
"silver", "blue", "purple", "white", "orange"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const char *c_obj_colors[] = {
|
|
|
|
const char *c_obj_colors[] = { //这里定义了一些物品的颜色
|
|
|
|
"black", /* CLR_BLACK */
|
|
|
|
"black", /* CLR_BLACK */
|
|
|
|
"red", /* CLR_RED */
|
|
|
|
"red", /* CLR_RED */
|
|
|
|
"green", /* CLR_GREEN */
|
|
|
|
"green", /* CLR_GREEN */
|
|
|
@ -36,8 +36,8 @@ const char *c_obj_colors[] = {
|
|
|
|
"white", /* CLR_WHITE */
|
|
|
|
"white", /* CLR_WHITE */
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const struct c_common_strings c_common_strings =
|
|
|
|
const struct c_common_strings c_common_strings = //结构体变量中包含了一些常见的字符串,用于文本输出
|
|
|
|
{ "Nothing happens.",
|
|
|
|
{ "Nothing happens.", //在游戏中提供反馈、描述情况,进行交互
|
|
|
|
"That's enough tries!",
|
|
|
|
"That's enough tries!",
|
|
|
|
"That is a silly thing to %s.",
|
|
|
|
"That is a silly thing to %s.",
|
|
|
|
"shudder for a moment.",
|
|
|
|
"shudder for a moment.",
|
|
|
@ -50,33 +50,34 @@ const struct c_common_strings c_common_strings =
|
|
|
|
{ "mon", "you" }
|
|
|
|
{ "mon", "you" }
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const struct savefile_info default_sfinfo = {
|
|
|
|
const struct savefile_info default_sfinfo = { //定义了保存文件的默认信息
|
|
|
|
#ifdef NHSTDC
|
|
|
|
#ifdef NHSTDC //用于保存文件格式的标志位
|
|
|
|
0x00000000UL
|
|
|
|
0x00000000UL
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
0x00000000L
|
|
|
|
0x00000000L
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#if defined(COMPRESS) || defined(ZLIB_COMP)
|
|
|
|
#if defined(COMPRESS) || defined(ZLIB_COMP) //用于外部压缩标志位
|
|
|
|
| SFI1_EXTERNALCOMP
|
|
|
|
| SFI1_EXTERNALCOMP
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#if defined(ZEROCOMP)
|
|
|
|
#if defined(ZEROCOMP)
|
|
|
|
| SFI1_ZEROCOMP
|
|
|
|
| SFI1_ZEROCOMP //零压缩标志位
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#if defined(RLECOMP)
|
|
|
|
#if defined(RLECOMP)
|
|
|
|
| SFI1_RLECOMP
|
|
|
|
| SFI1_RLECOMP //RLE压缩标志
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
,
|
|
|
|
,
|
|
|
|
#ifdef NHSTDC
|
|
|
|
#ifdef NHSTDC
|
|
|
|
0x00000000UL, 0x00000000UL
|
|
|
|
0x00000000UL, 0x00000000UL //保留字段
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
0x00000000L, 0x00000000L
|
|
|
|
0x00000000L, 0x00000000L
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const char disclosure_options[] = "iavgco";
|
|
|
|
const char disclosure_options[] = "iavgco"; //是一个字符数组,包含了几个选项。这些选项用于控制信息的披露程度。
|
|
|
|
char emptystr[] = {0}; /* non-const */
|
|
|
|
char emptystr[] = {0}; /* non-const */ //是一个字符数组,用于表示空字符串。它是非常量数组,可以被修改。
|
|
|
|
|
|
|
|
|
|
|
|
NEARDATA struct flag flags; /* extern declaration is in flag.h, not decl.h */
|
|
|
|
NEARDATA struct flag flags; /* extern declaration is in flag.h, not decl.h */
|
|
|
|
|
|
|
|
//是一个结构体变量,用于存储游戏中的标志位。该变量在flag.h中有外部声明。
|
|
|
|
|
|
|
|
|
|
|
|
/* Global windowing data, defined here for multi-window-system support */
|
|
|
|
/* Global windowing data, defined here for multi-window-system support */
|
|
|
|
#ifdef WIN32
|
|
|
|
#ifdef WIN32
|
|
|
@ -84,25 +85,28 @@ boolean fqn_prefix_locked[PREFIX_COUNT] = { FALSE, FALSE, FALSE,
|
|
|
|
FALSE, FALSE, FALSE,
|
|
|
|
FALSE, FALSE, FALSE,
|
|
|
|
FALSE, FALSE, FALSE,
|
|
|
|
FALSE, FALSE, FALSE,
|
|
|
|
FALSE };
|
|
|
|
FALSE };
|
|
|
|
|
|
|
|
//是一个布尔数组,用于表示文件名前缀是否被锁定。在这段代码中,它被初始化为全为FALSE。
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#ifdef PREFIXES_IN_USE
|
|
|
|
#ifdef PREFIXES_IN_USE
|
|
|
|
const char *fqn_prefix_names[PREFIX_COUNT] = {
|
|
|
|
const char *fqn_prefix_names[PREFIX_COUNT] = {
|
|
|
|
"hackdir", "leveldir", "savedir", "bonesdir", "datadir",
|
|
|
|
"hackdir", "leveldir", "savedir", "bonesdir", "datadir",
|
|
|
|
"scoredir", "lockdir", "sysconfdir", "configdir", "troubledir"
|
|
|
|
"scoredir", "lockdir", "sysconfdir", "configdir", "troubledir"
|
|
|
|
};
|
|
|
|
};//是一个字符串指针数组,包含了一些文件名前缀的名称。这些名称用于指定不同类型文件的存储路径。
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* x/y/z deltas for the 10 movement directions (8 compass pts, 2 down/up) */
|
|
|
|
/* x/y/z deltas for the 10 movement directions (8 compass pts, 2 down/up) */
|
|
|
|
const schar xdir[N_DIRS_Z] = { -1, -1, 0, 1, 1, 1, 0, -1, 0, 0 };
|
|
|
|
const schar xdir[N_DIRS_Z] = { -1, -1, 0, 1, 1, 1, 0, -1, 0, 0 };
|
|
|
|
const schar ydir[N_DIRS_Z] = { 0, -1, -1, -1, 0, 1, 1, 1, 0, 0 };
|
|
|
|
const schar ydir[N_DIRS_Z] = { 0, -1, -1, -1, 0, 1, 1, 1, 0, 0 };
|
|
|
|
const schar zdir[N_DIRS_Z] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, -1 };
|
|
|
|
const schar zdir[N_DIRS_Z] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, -1 };
|
|
|
|
|
|
|
|
//是三个有符号字符数组,分别表示十个移动方向(包括八个主要方向和上下方向)的x、y和z轴的增量。
|
|
|
|
/* redordered directions, cardinals first */
|
|
|
|
/* redordered directions, cardinals first */
|
|
|
|
const schar dirs_ord[N_DIRS] =
|
|
|
|
const schar dirs_ord[N_DIRS] =
|
|
|
|
{ DIR_W, DIR_N, DIR_E, DIR_S, DIR_NW, DIR_NE, DIR_SE, DIR_SW };
|
|
|
|
{ DIR_W, DIR_N, DIR_E, DIR_S, DIR_NW, DIR_NE, DIR_SE, DIR_SW };
|
|
|
|
|
|
|
|
//是一个有符号字符数组,表示经过重新排序的移动方向。首先是四个基本方向,然后是四个对角线方向。
|
|
|
|
|
|
|
|
|
|
|
|
NEARDATA boolean has_strong_rngseed = FALSE;
|
|
|
|
NEARDATA boolean has_strong_rngseed = FALSE; //是一个布尔变量,用于表示是否具有强随机种子。
|
|
|
|
struct engr *head_engr;
|
|
|
|
struct engr *head_engr;
|
|
|
|
NEARDATA struct instance_flags iflags;
|
|
|
|
NEARDATA struct instance_flags iflags; //是一个结构体变量,用于存储游戏实例的标志位。
|
|
|
|
/* NOTE: the order of these words exactly corresponds to the
|
|
|
|
/* NOTE: the order of these words exactly corresponds to the
|
|
|
|
order of oc_material values #define'd in objclass.h. */
|
|
|
|
order of oc_material values #define'd in objclass.h. */
|
|
|
|
const char *materialnm[] = { "mysterious", "liquid", "wax", "organic",
|
|
|
|
const char *materialnm[] = { "mysterious", "liquid", "wax", "organic",
|
|
|
@ -111,29 +115,35 @@ const char *materialnm[] = { "mysterious", "liquid", "wax", "organic",
|
|
|
|
"metal", "copper", "silver", "gold",
|
|
|
|
"metal", "copper", "silver", "gold",
|
|
|
|
"platinum", "mithril", "plastic", "glass",
|
|
|
|
"platinum", "mithril", "plastic", "glass",
|
|
|
|
"gemstone", "stone" };
|
|
|
|
"gemstone", "stone" };
|
|
|
|
const char quitchars[] = " \r\n\033";
|
|
|
|
//是一个字符串指针数组,包含了一些物品材质的名称。这些名称与objclass.h中定义的oc_material值的顺序完全对应。
|
|
|
|
NEARDATA struct savefile_info sfcap, sfrestinfo, sfsaveinfo;
|
|
|
|
|
|
|
|
const int shield_static[SHIELD_COUNT] = {
|
|
|
|
const char quitchars[] = " \r\n\033";//是一个包含一些表示退出字符的字符串,包括空格、回车、换行和转义字符。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NEARDATA struct savefile_info sfcap, sfrestinfo, sfsaveinfo; //结构体变量,用于保存文件的信息。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const int shield_static[SHIELD_COUNT] = {//是一个整型数组,包含了一些盾牌的静态符号。
|
|
|
|
S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4, /* 7 per row */
|
|
|
|
S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4, /* 7 per row */
|
|
|
|
S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,
|
|
|
|
S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,
|
|
|
|
S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,
|
|
|
|
S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
NEARDATA struct you u;
|
|
|
|
NEARDATA struct you u;//结构体变量,用于表示玩家角色的状态和属性。
|
|
|
|
NEARDATA time_t ubirthday;
|
|
|
|
NEARDATA time_t ubirthday; //是一个time_t类型的变量,表示玩家角色的出生时间。
|
|
|
|
NEARDATA struct u_realtime urealtime;
|
|
|
|
NEARDATA struct u_realtime urealtime; //用于表示游戏时间的实时信息。
|
|
|
|
NEARDATA struct obj *uwep, *uarm, *uswapwep,
|
|
|
|
NEARDATA struct obj *uwep, *uarm, *uswapwep, //结构体的指针变量,用于表示玩家角色的装备和物品。
|
|
|
|
*uquiver, /* quiver */
|
|
|
|
*uquiver, /* quiver */
|
|
|
|
*uarmu, /* under-wear, so to speak */
|
|
|
|
*uarmu, /* under-wear, so to speak */
|
|
|
|
*uskin, /* dragon armor, if a dragon */
|
|
|
|
*uskin, /* dragon armor, if a dragon */
|
|
|
|
*uarmc, *uarmh, *uarms, *uarmg,*uarmf, *uamul,
|
|
|
|
*uarmc, *uarmh, *uarms, *uarmg,*uarmf, *uamul,
|
|
|
|
*uright, *uleft, *ublindf, *uchain, *uball;
|
|
|
|
*uright, *uleft, *ublindf, *uchain, *uball;
|
|
|
|
const char vowels[] = "aeiouAEIOU";
|
|
|
|
const char vowels[] = "aeiouAEIOU"; //是一个包含元音字母的字符串,包括小写和大写的元音字母。
|
|
|
|
NEARDATA winid WIN_MESSAGE, WIN_STATUS, WIN_MAP, WIN_INVEN;
|
|
|
|
NEARDATA winid WIN_MESSAGE, WIN_STATUS, WIN_MAP, WIN_INVEN;//是窗口标识符(winid类型)变量,用于表示游戏中的不同窗口。
|
|
|
|
const char ynchars[] = "yn";
|
|
|
|
const char ynchars[] = "yn"; //是包含一些表示"yes"和"no"的字符的字符串。
|
|
|
|
const char ynqchars[] = "ynq";
|
|
|
|
const char ynqchars[] = "ynq";
|
|
|
|
const char ynaqchars[] = "ynaq";
|
|
|
|
const char ynaqchars[] = "ynaq";
|
|
|
|
const char ynNaqchars[] = "yn#aq";
|
|
|
|
const char ynNaqchars[] = "yn#aq";
|
|
|
|
NEARDATA long yn_number = 0L;
|
|
|
|
NEARDATA long yn_number = 0L;
|
|
|
|
|
|
|
|
//这些变量的定义用于实现游戏的逻辑和界面显示等功能。
|
|
|
|
|
|
|
|
//其中包括随机数种子、文本输出、文件操作、游戏状态、时间管理、玩家角色属性、装备和物品等。
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef PANICTRACE
|
|
|
|
#ifdef PANICTRACE
|
|
|
|
const char *ARGV0;
|
|
|
|
const char *ARGV0;
|
|
|
|