Compare commits

..

1 Commits

Author SHA1 Message Date
kongju 076a5a8b4f final
2 years ago

@ -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,34 +50,33 @@ 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 //RLE压缩标志 | SFI1_RLECOMP
#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
@ -85,28 +84,25 @@ 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",
@ -115,35 +111,29 @@ 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" };
//是一个字符串指针数组包含了一些物品材质的名称。这些名称与objclass.h中定义的oc_material值的顺序完全对应。 const char quitchars[] = " \r\n\033";
NEARDATA struct savefile_info sfcap, sfrestinfo, sfsaveinfo;
const char quitchars[] = " \r\n\033";//是一个包含一些表示退出字符的字符串,包括空格、回车、换行和转义字符。 const int shield_static[SHIELD_COUNT] = {
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; //是一个time_t类型的变量表示玩家角色的出生时间。 NEARDATA time_t ubirthday;
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;//是窗口标识符winid类型变量用于表示游戏中的不同窗口。 NEARDATA winid WIN_MESSAGE, WIN_STATUS, WIN_MAP, WIN_INVEN;
const char ynchars[] = "yn"; //是包含一些表示"yes"和"no"的字符的字符串。 const char ynchars[] = "yn";
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;

@ -6,7 +6,71 @@
/* /*
* Contains code for picking objects up, and container use. * Contains code for picking objects up, and container use.
*/ */
/*simple_look(struct obj *, boolean):用于简单地查看物体的函数。
query_classes(char *, boolean *, boolean *, const char *, struct obj *, boolean, int *)
fatal_corpse_mistake(struct obj *, boolean)
describe_decor(void)
check_here(boolean)
n_or_more(struct obj *)
all_but_uchain(struct obj *)
autopick(struct obj *, int, menu_item **)
count_categories(struct obj *, int)
delta_cwt(struct obj *, struct obj *)
carry_count(struct obj *, struct obj *, long, boolean, int *, int *)
lift_object(struct obj *, struct obj *, long *, boolean)
mbag_explodes(struct obj *, int)
is_boh_item_gone(void)
do_boh_explosion(struct obj *, boolean)
boh_loss(struct obj *, boolean)
in_container(struct obj *)
out_container(struct obj *)
mbag_item_gone(boolean, struct obj *, boolean)
stash_ok(struct obj *)
explain_container_prompt(boolean)
traditional_loot(boolean)
menu_loot(int, boolean)
tip_ok(struct obj *)
tipcontainer_gettarget(struct obj *, boolean *)
tipcontainer_checks(struct obj *, struct obj *, boolean)
in_or_out_menu(const char *, struct obj *, boolean, boolean, boolean, boolean)
able_to_loot(coordxy, coordxy, boolean)
reverse_loot(void)
mon_beside(coordxy, coordxy)
do_loot_cont(struct obj **, int, int)
doloot_core(void)
tipcontainer(struct obj *)*/
#include "hack.h" #include "hack.h"
#define CONTAINED_SYM '>' /* from invent.c */ #define CONTAINED_SYM '>' /* from invent.c */

@ -2,7 +2,21 @@
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2018. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
/*putmesg 函数:将消息输出到消息窗口,并且根据消息的紧急程度以及是否需要记录历史消息做相应的处理。
pline
dumplogmsg dumplogfreemessages
YouYourYou_feel "You feel""Your sword"
verbalize
impossible
raw_printf
*/
#include "hack.h" #include "hack.h"
#define BIGBUFSZ (5 * BUFSZ) /* big enough to format a 4*BUFSZ string (from #define BIGBUFSZ (5 * BUFSZ) /* big enough to format a 4*BUFSZ string (from

@ -18,7 +18,23 @@
* *
* polymon (called directly) usually golem petrification * polymon (called directly) usually golem petrification
*/ */
/*check_strangling 函数:用于检查角色是否处于被勒死状态,并采取相应的行动。
polyman
dropp
break_armor 穿
drop_weapon
armor_to_dragon 穿
newman
polysense
no_longer_petrify_resistant */
#include "hack.h" #include "hack.h"
static void check_strangling(boolean); static void check_strangling(boolean);

@ -2,7 +2,73 @@
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
/*itimeout 函数:用于处理角色的定时器,返回一个计时器的剩余时间。
itimeout_incr
ghost_from_bottle
drink_ok
peffect_restore_ability
peffect_hallucination 使
peffect_water 使
peffect_booze 使
peffect_enlightenment 使
peffect_invisibility 使
peffect_see_invisible 使
peffect_paralysis 使
peffect_sleeping 使
peffect_monster_detection 使
peffect_object_detection 使
peffect_sickness 使
peffect_confusion 使
peffect_gain_ability 使
peffect_speed 使
peffect_blindness 使
peffect_gain_level 使
peffect_healing
peffect_extra_healing
peffect_full_healing
peffect_levitation 使
peffect_gain_energy 使
peffect_oil
peffect_acid 使
peffect_polymorph
H2Opotion_dip
mixtype
dip_ok
hold_potion
potion_dip */
#include "hack.h" #include "hack.h"
static long itimeout(long); static long itimeout(long);

@ -1,7 +1,68 @@
/* NetHack 3.7 spell.c $NHDT-Date: 1646838390 2022/03/09 15:06:30 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.131 $ */ /* NetHack 3.7 spell.c $NHDT-Date: 1646838390 2022/03/09 15:06:30 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.131 $ */
/* Copyright (c) M. Stephenson 1988 */ /* Copyright (c) M. Stephenson 1988 */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
/*static int spell_let_to_idx(char)
static boolean cursed_book(struct obj * bp)
static boolean confused_book(struct obj *)
static void deadbook_pacify_undead(struct monst *)
使
static void deadbook(struct obj *)
static int learn(void)
static boolean rejectcasting(void)
static boolean getspell(int *)
static int QSORTCALLBACK spell_cmp(const genericptr, const genericptr)
static void sortspells(void)
static boolean spellsortmenu(void)
static boolean dospellmenu(const char *, int, int *)
static int percent_success(int)
static char *spellretention(int, char *)
static int throwspell(void)
static void cast_protection(void)
static void spell_backfire(int)
static boolean spelleffects_check(int, int *, int *)
static const char *spelltypemnemonic(int)
static boolean can_center_spell_location(coordxy, coordxy)
static boolean spell_aim_step(genericptr_t, coordxy, coordxy)
*/
#include "hack.h" #include "hack.h"
/* spellmenu arguments; 0 thru n-1 used as gs.spl_book[] index when swapping */ /* spellmenu arguments; 0 thru n-1 used as gs.spl_book[] index when swapping */

@ -2,7 +2,27 @@
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
/*stealgold函数用于让怪物从玩家身上偷取金币根据玩家是否拥有真金gold或者数量不同的金币来进行不同的处理。
thiefdead
unresponsive
unstolenarm
stealarm
remove_worn_item穿
somegold
findgold
equipname
stealamulet
maybe_absorb_item*/
#include "hack.h" #include "hack.h"
static int stealarm(void); static int stealarm(void);

@ -1,7 +1,27 @@
/* NetHack 3.7 steed.c $NHDT-Date: 1671838909 2022/12/23 23:41:49 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.108 $ */ /* NetHack 3.7 steed.c $NHDT-Date: 1671838909 2022/12/23 23:41:49 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.108 $ */
/* Copyright (c) Kevin Hugo, 1998-1999. */ /* Copyright (c) Kevin Hugo, 1998-1999. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
/*rider_cant_reach(void) - 当骑手无法到达某个位置时调用,用于通知玩家。
can_saddle(struct monst* mtmp) -
use_saddle(struct obj* otmp) -
put_saddle_on_mon(struct obj* saddle, struct monst* mtmp) -
can_ride(struct monst* mtmp) -
doride(void) -
mount_steed(struct monst *mtmp, boolean force) -
exercise_steed(void) -
kick_steed(void) -
landing_spot(coord *spot, int reason, int forceit) -
dismount_steed(int reason) - */
#include "hack.h" #include "hack.h"
/* Monsters that might be ridden */ /* Monsters that might be ridden */

@ -1,7 +1,25 @@
/* NetHack 3.7 symbols.c $NHDT-Date: 1661295669 2022/08/23 23:01:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.90 $ */ /* NetHack 3.7 symbols.c $NHDT-Date: 1661295669 2022/08/23 23:01:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.90 $ */
/* Copyright (c) NetHack Development Team 2020. */ /* Copyright (c) NetHack Development Team 2020. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
/*savedsym_add(const char *, const char *, int) - 添加保存的符号到缓存中,用于保存和恢复游戏中的特殊符号。
savedsym_find(const char *, int) -
purge_custom_entries(enum graphics_sets which_set) -
def_r_oc_syms[MAXOCLASSES] -
decgraphics_mode_callback - DECtty_start_screen()
ibmgraphics_mode_callback - IBMtty_start_screen()PC9800
ascgraphics_mode_callback - ASCtty_start_screen()PC9800
cursesgraphics_mode_callback - Cursestty_start_screen()
ibmgraphics_mode_callback - IBMtty_start_screen()TTYWIN32
utf8graphics_mode_callback - UTF-8tty_start_screen()unixttywindtty*/
#include "hack.h" #include "hack.h"
#include "tcap.h" #include "tcap.h"

Loading…
Cancel
Save