Compare commits

..

10 Commits

@ -12,7 +12,7 @@
#include <signal.h>
#endif
static void moveloop_preamble(boolean);
static void moveloop_preamble(boolean);
static void u_calc_moveamt(int);
static void maybe_do_tutorial(void);
#ifdef POSITIONBAR

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

@ -9,9 +9,9 @@
*/
#include "hack.h"
#include "artifact.h"
#include "artifact.h"
static boolean unconstrain_map(void);
static boolean unconstrain_map(void);
static void reconstrain_map(void);
static void map_redisplay(void);
static void browse_map(unsigned, const char *);

@ -3,7 +3,7 @@
/*-Copyright (c) Michael Allison, 2012. */
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
#include "hack.h"
static boolean rm_waslit(void);
static void mkcavepos(coordxy, coordxy, int, boolean, boolean);
@ -17,7 +17,7 @@ static boolean furniture_handled(coordxy, coordxy, boolean);
/* Indices returned by dig_typ() */
enum dig_types {
DIGTYP_UNDIGGABLE = 0,
DIGTYP_UNDIGGABLE = 0,
DIGTYP_ROCK,
DIGTYP_STATUE,
DIGTYP_BOULDER,

@ -19,7 +19,7 @@
* interface.
*
* The display system deals with an abstraction called a glyph. Anything
* that could possibly be displayed has a unique glyph identifier.
* that could possibly be displayed has a unique glyph identifier.
*
* What is seen on the screen is a combination of what the hero remembers
* and what the hero currently sees. Objects and dungeon features (walls

@ -26,7 +26,7 @@ typedef struct dlb_procs {
int (*dlb_fread_proc)(char *, int, int, DLB_P);
int (*dlb_fseek_proc)(DLB_P, long, int);
char *(*dlb_fgets_proc)(char *, int, DLB_P);
int (*dlb_fgetc_proc)(DLB_P);
int (*dlb_fgetc_proc)(DLB_P);
long (*dlb_ftell_proc)(DLB_P);
} dlb_procs_t;

@ -26,7 +26,7 @@ static void temperature_change_msg(schar);
/* the #drop command: drop one inventory item */
int
dodrop(void)
dodrop(void)
{
int result;

@ -28,7 +28,7 @@ static void do_oname(struct obj *);
static char *docall_xname(struct obj *);
static void namefloorobj(void);
extern const char what_is_an_unknown_object[]; /* from pager.c */
extern const char what_is_an_unknown_object[]; /* from pager.c */
#define NUMMBUF 5

@ -32,7 +32,7 @@ static int Shirt_on(void);
static void dragon_armor_handling(struct obj *, boolean, boolean);
static void Amulet_on(void);
static void learnring(struct obj *, boolean);
static void adjust_attrib(struct obj *, int, int);
static void adjust_attrib(struct obj *, int, int);
static void Ring_off_or_gone(struct obj *, boolean);
static int select_off(struct obj *);
static struct obj *do_takeoff(void);

@ -34,7 +34,7 @@ free_edog(struct monst *mtmp)
{
if (mtmp->mextra && EDOG(mtmp)) {
free((genericptr_t) EDOG(mtmp));
EDOG(mtmp) = (struct edog *) 0;
EDOG(mtmp) = (struct edog *) 0;
}
mtmp->mtame = 0;
}

@ -33,7 +33,7 @@ droppables(struct monst *mon)
* be considered a duplicate and get treated as a normal candidate
* for dropping.
*
* This could be 'auto', but then 'gcc -O2' warns that this function
* This could be 'auto', but then 'gcc -O2' warns that this function
* might return the address of a local variable. It's mistaken,
* &dummy is never returned. 'static' is simplest way to shut it up.
*/

@ -31,7 +31,7 @@ static const char kick_passes_thru[] = "kick passes harmlessly through";
static void
kickdmg(struct monst *mon, boolean clumsy)
{
int mdx, mdy;
int mdx, mdy;
int dmg = (ACURRSTR + ACURR(A_DEX) + ACURR(A_CON)) / 15;
int specialdmg, kick_skill = P_NONE;
boolean trapkilled = FALSE;

@ -30,7 +30,7 @@ static boolean mhurtle_step(genericptr_t, coordxy, coordxy);
&& ((o)->otyp == AKLYS \
|| ((o)->oartifact == ART_MJOLLNIR && Role_if(PM_VALKYRIE)))) \
|| (o)->otyp == BOOMERANG)
/* gt.thrownobj (decl.c) tracks an object until it lands */
int

Loading…
Cancel
Save