Compare commits

..

10 Commits

@ -146,12 +146,12 @@ NEARDATA long yn_number = 0L;
//其中包括随机数种子、文本输出、文件操作、游戏状态、时间管理、玩家角色属性、装备和物品等。 //其中包括随机数种子、文本输出、文件操作、游戏状态、时间管理、玩家角色属性、装备和物品等。
#ifdef PANICTRACE #ifdef PANICTRACE
const char *ARGV0; const char *ARGV0; //是一个指向const char类型的指针变量在宏定义PANICTRACE被定义时生效。
#endif #endif
#define IVMAGIC 0xdeadbeef #define IVMAGIC 0xdeadbeef //是一个整型常量,表示一个特定的魔数。
const struct Role urole_init_data = { const struct Role urole_init_data = { //是一个struct Role结构体变量用于初始化玩家角色的初始数据。其中包括角色名称、属性、初始位置等信息。
{ "Undefined", 0 }, { "Undefined", 0 },
{ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },
@ -177,7 +177,7 @@ const struct Role urole_init_data = {
}; };
const struct Race urace_init_data = { const struct Race urace_init_data = {
"something", "something", //是一个struct Race结构体变量用于初始化玩家种族的初始数据。其中包括种族名称、属性、初始位置等信息。
"undefined", "undefined",
"something", "something",
"Xxx", "Xxx",
@ -198,7 +198,8 @@ const struct Race urace_init_data = {
}; };
const struct instance_globals_a g_init_a = { const struct instance_globals_a g_init_a = { //是一个struct instance_globals_a结构体变量用于初始化一些全局变量。
//每个注释后面的注释表示该变量在代码中的使用位置。
/* artifact.c */ /* artifact.c */
/* decl.c */ /* decl.c */
UNDEFINED_PTR, /* afternmv */ UNDEFINED_PTR, /* afternmv */
@ -226,7 +227,8 @@ const struct instance_globals_a g_init_a = {
IVMAGIC /* a_magic to validate that structure layout has been preserved */ IVMAGIC /* a_magic to validate that structure layout has been preserved */
}; };
const struct instance_globals_b g_init_b = { const struct instance_globals_b g_init_b = {//是一个struct instance_globals_b结构体变量用于初始化另一些全局变量。
//每个注释后面的注释表示该变量在代码中的使用位置。
/* botl.c */ /* botl.c */
{ { { NULL, NULL, 0L, FALSE, FALSE, 0, 0U, { 0 }, { 0 }, NULL, 0, 0, 0 { { { NULL, NULL, 0L, FALSE, FALSE, 0, 0U, { 0 }, { 0 }, NULL, 0, 0, 0
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
@ -496,26 +498,26 @@ const struct instance_globals_l g_init_l = {
0U, /* last_hider */ 0U, /* last_hider */
/* nhlan.c */ /* nhlan.c */
#ifdef MAX_LAN_USERNAME #ifdef MAX_LAN_USERNAME
UNDEFINED_VALUES, /* lusername */ UNDEFINED_VALUES, /* lusername */ //是一个全局变量用于存储本地区域网络的用户名。如果定义了MAX_LAN_USERNAME宏则将其初始化为UNDEFINED_VALUES否则将其初始化为未定义的值。注释后面的注释表示该变量在代码中的使用位置。
MAX_LAN_USERNAME, /* lusername_size */ MAX_LAN_USERNAME, /* lusername_size */ //是一个全局变量,用于存储本地区域网络用户名的大小。
#endif /* MAX_LAN_USERNAME */ #endif /* MAX_LAN_USERNAME */
/* nhlua.c */ /* nhlua.c */
UNDEFINED_VALUE, /* luacore */ UNDEFINED_VALUE, /* luacore */ //是一个全局变量用于存储Lua脚本的核心。将其初始化为未定义的值。
DUMMY, /* lua_warnbuf[] */ DUMMY, /* lua_warnbuf[] */ //是一个数组用于存储Lua警告信息的缓冲区。
/* options.c */ /* options.c */
FALSE, /* loot_reset_justpicked */ FALSE, /* loot_reset_justpicked */ //是一个全局变量用于表示是否刚刚拾取了战利品并需要重置。将其初始化为FALSE。
/* save.c */ /* save.c */
(struct obj *) 0, /* looseball */ (struct obj *) 0, /* looseball */ //是全局变量,用于表示游戏中的松散物品
(struct obj *) 0, /* loosechain */ (struct obj *) 0, /* loosechain */
/* sp_lev.c */ /* sp_lev.c */
NULL, /* lev_message */ NULL, /* lev_message */ //是一个全局变量,用于存储地图生成时的消息。
UNDEFINED_PTR, /* lregions */ UNDEFINED_PTR, /* lregions */ //一个全局变量,用于存储地图生成时的区域信息
/* trap.c */ /* trap.c */
{ UNDEFINED_PTR, 0, 0 }, /* launchplace */ { UNDEFINED_PTR, 0, 0 }, /* launchplace */ //是一个结构体变量,用于表示陷阱的发射位置。
/* windows.c */ /* windows.c */
UNDEFINED_PTR, /* last_winchoice */ UNDEFINED_PTR, /* last_winchoice */ //是一个全局变量,用于存储上次选择的窗口选项。
/* new */ /* new */
DUMMY, /* lua_ver[LUA_VER_BUFSIZ] */ DUMMY, /* lua_ver[LUA_VER_BUFSIZ] */ //是一个字符数组用于存储Lua版本信息。
DUMMY, /* lua_copyright[LUA_COPYRIGHT_BUFSIZ] */ DUMMY, /* lua_copyright[LUA_COPYRIGHT_BUFSIZ] */
TRUE, /* havestate*/ TRUE, /* havestate*/
IVMAGIC /* l_magic to validate that structure layout has been preserved */ IVMAGIC /* l_magic to validate that structure layout has been preserved */
@ -958,8 +960,11 @@ const struct const_globals cg = {
}; };
#define ZERO(x) memset(&x, 0, sizeof(x)) #define ZERO(x) memset(&x, 0, sizeof(x))
//是一个宏定义用于将变量x的内存空间清零。使用memset函数将x的内存空间的值设置为0大小为sizeof(x)。
#define MAGICCHECK(xx) \ #define MAGICCHECK(xx) \
//是一个宏定义用于检查结构体变量xx的魔术值和状态。
//如果xx的magic字段不等于IVMAGIC预定义的魔术值则输出错误信息并退出程序。如果xx的havestate字段不等于TRUE则输出错误信息并退出程序。
do { \ do { \
if ((xx).magic != IVMAGIC) { \ if ((xx).magic != IVMAGIC) { \
raw_printf( \ raw_printf( \

Loading…
Cancel
Save