From: keni Date: Thu, 13 May 2010 00:54:13 +0000 (+0000) Subject: Guidebook update and SEDUCE runtime switch X-Git-Tag: MOVE2GIT~299 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bd1a922dae954bb171349ee9ec6a1a47312031d2;p=nethack Guidebook update and SEDUCE runtime switch add SYSCF docs to the Guidebook because it's info needed in a binary distro Guidebook.tex - also add some missing italics to some "NetHack" occurances call nethack.org "official" Guidebook.txt - didn't regenerate cleanly so no diff add SEDUCE to SYSCF (only partly inspired by the recent email) --- diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index a1c17507e..43d1e1dc2 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -1650,7 +1650,8 @@ command allows you to view all options and change most of them. You can also set options automatically by placing them in the NETHACKOPTIONS environment variable or in a configuration file. Some versions of NetHack also have front-end programs that allow -you to set options before starting the game. +you to set options before starting the game or a global configuration +for system administrators. .hn 2 Using the NETHACKOPTIONS environment variable .pg @@ -2638,6 +2639,56 @@ This will assist in the interface to speech synthesizers. A lot of speech access programs use the number-pad to review the screen. If this is the case, disable the number_pad option and use the traditional Rogue-like commands. +.hn 2 +Global Configuration for System Administrators +.pg +If NetHack is compiled with the SYSCF option, a system administrator +should set up a global configuration; this is a file in the +same format as the traditional per-user configuration file (see above). +This file should be named sysconf and placed in the same directory as +the other NetHack support files. +The options recognized in this file are listed below. Any option not +set uses a compiled-in default (which may not be appropriate for your +system). +.pg +.lp +WIZARDS +A space-separated list of user names who are allowed to play in wizard +mode (the debugging mode, not the magic-using role). A value of a single +asterisk (*) allows anyone to start a game in wizard mode. +.lp +SHELLERS +A list of users who are allowed to use the shell escape command (!). The +syntax is the same as WIZARDS. +.lp +MAXPLAYERS +Limit the maximum number of games that can be running at the same time. +.lp +SUPPORT +A string explaining how to get local support (no default value). +.lp +RECOVER +A string explaining how to recover a game on this system (no default value). +.lp +SEDUCE +0 or 1 to disable or enable, respectively, the SEDUCE option (see the source +for details on this function). +.pg +The following options affect the score file: +.pg +.lp +PERSMAX +Maximum number of entries for one person. +.lp +ENTRYMAX +Maximum number of entries in the score file. +.lp +POINTSMIN +Minimum number of points to get an entry in the score file. +.lp +PERS_IS_UID +0 or 1 to use user names or numeric userids, respectively, to identify +unique people for the score file. .hn 1 Scoring .pg @@ -2881,7 +2932,7 @@ it for 3.3.1. \fBChristian ``Marvin'' Bressler\fP maintained 3.5 for the Atari after he resurrected it for 3.3.1. .pg -There is a NetHack web site maintained by \fBKen Lorber\fP at http://www.nethack.org/. +The official NetHack web site is maintained by \fBKen Lorber\fP at http://www.nethack.org/. .pg - - - - - - - - - - .pg diff --git a/include/config.h b/include/config.h index 9d39b4da8..1497e361b 100644 --- a/include/config.h +++ b/include/config.h @@ -161,6 +161,7 @@ * ENTRYMAX (max entries in the record file) * POINTSMIN (min points to get an entry) * PERS_IS_UID (0 or 1 - person is name or (numeric) userid) + * SEDUCE (0 or 1 - runtime disable/enable SEDUCE option) * * The following options select how the config space is stored: * SYSCF_FILE in the named file diff --git a/include/extern.h b/include/extern.h index cf50c0d03..0dd3580b3 100644 --- a/include/extern.h +++ b/include/extern.h @@ -2118,6 +2118,12 @@ E int FDECL(add_sound_mapping, (const char *)); E void FDECL(play_sound_for_message, (const char *)); #endif +/* ### sys.c ### */ + +#ifdef SYSCF +E void FDECL(sysopt_seduce_set,(int)); +#endif + /* ### sys/msdos/sound.c ### */ #ifdef MSDOS diff --git a/include/sys.h b/include/sys.h index 26cab6a50..a45478fc4 100644 --- a/include/sys.h +++ b/include/sys.h @@ -29,8 +29,15 @@ struct sysopt { int panictrace_glibc; # endif #endif + int seduce; }; E struct sysopt sysopt; +#ifdef SEDUCE +# define SYSOPT_SEDUCE sysopt.seduce +#else +# define SYSOPT_SEDUCE 0 +#endif + #endif /* SYS_H */ diff --git a/src/files.c b/src/files.c index c9d157927..394854c6c 100644 --- a/src/files.c +++ b/src/files.c @@ -2092,6 +2092,15 @@ int src; if(sysopt.recover) free(sysopt.recover); sysopt.recover = (char*)alloc(strlen(bufp)+1); Strcpy(sysopt.recover, bufp); + } else if ( match_varname(buf, "SEDUCE", 6)) { + int temp = !!atoi(bufp); /* XXX this could be tighter */ + /* allow anyone to turn it off, but only sysconf to turn it on*/ + if(src!=SET_IN_SYS && temp!=0){ + raw_printf("Illegal value in SEDUCE"); + return 0; + } + sysopt.seduce = temp; + sysopt_seduce_set(temp); } else if ( (src==SET_IN_SYS) && match_varname(buf, "MAXPLAYERS", 10)) { int temp = atoi(bufp); /* XXX to get more than 25, need to rewrite all lock code */ diff --git a/src/mhitu.c b/src/mhitu.c index 3055c624e..e5d6f84b9 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -1251,6 +1251,17 @@ dopois: if(!mtmp->mcan) stealgold(mtmp); break; +#ifdef SEDUCE + case AD_SSEX: + if(SYSOPT_SEDUCE){ + if(could_seduce(mtmp, &youmonst, mattk) == 1 + && !mtmp->mcan) + if (doseduce(mtmp)) + return 3; + break; + } + /* else FALLTHRU */ +#endif case AD_SITM: /* for now these are the same */ case AD_SEDU: if (is_animal(mtmp->data)) { @@ -1259,7 +1270,7 @@ dopois: /* Continue below */ } else if (dmgtype(youmonst.data, AD_SEDU) #ifdef SEDUCE - || dmgtype(youmonst.data, AD_SSEX) + || (SYSOPT_SEDUCE && dmgtype(youmonst.data, AD_SSEX)) #endif ) { pline("%s %s.", Monnam(mtmp), mtmp->minvent ? @@ -1300,14 +1311,7 @@ dopois: return 3; } break; -#ifdef SEDUCE - case AD_SSEX: - if(could_seduce(mtmp, &youmonst, mattk) == 1 - && !mtmp->mcan) - if (doseduce(mtmp)) - return 3; - break; -#endif + case AD_SAMU: hitmsg(mtmp, mattk); /* when the Wiz hits, 1/20 steals the amulet */ @@ -2196,7 +2200,7 @@ struct attack *mattk; if(agrinvis && !defperc #ifdef SEDUCE - && mattk && mattk->adtyp != AD_SSEX + && (!SYSOPT_SEDUCE || ( mattk && mattk->adtyp != AD_SSEX)) #endif ) return 0; @@ -2204,7 +2208,7 @@ struct attack *mattk; if(pagr->mlet != S_NYMPH && ((pagr != &mons[PM_INCUBUS] && pagr != &mons[PM_SUCCUBUS]) #ifdef SEDUCE - || (mattk && mattk->adtyp != AD_SSEX) + || (SYSOPT_SEDUCE && mattk && mattk->adtyp != AD_SSEX) #endif )) return 0; diff --git a/src/monst.c b/src/monst.c index 72eb609e5..5e1aeb4c6 100644 --- a/src/monst.c +++ b/src/monst.c @@ -2548,14 +2548,16 @@ struct permonst _mons2[] = { M3_INFRAVISIBLE|M3_INFRAVISION, CLR_BLUE), /* standard demons & devils */ -#ifdef SEDUCE -# define SEDUCTION_ATTACKS \ +#define SEDUCTION_ATTACKS_YES \ A(ATTK(AT_BITE, AD_SSEX, 0, 0), ATTK(AT_CLAW, AD_PHYS, 1, 3), \ ATTK(AT_CLAW, AD_PHYS, 1, 3), NO_ATTK, NO_ATTK, NO_ATTK) -#else -# define SEDUCTION_ATTACKS \ +#define SEDUCTION_ATTACKS_NO \ A(ATTK(AT_CLAW, AD_PHYS, 1, 3), ATTK(AT_CLAW, AD_PHYS, 1, 3), \ ATTK(AT_BITE, AD_DRLI, 2, 6), NO_ATTK, NO_ATTK, NO_ATTK) +#ifdef SEDUCE +# define SEDUCTION_ATTACKS SEDUCTION_ATTACKS_YES +#else +# define SEDUCTION_ATTACKS SEDUCTION_ATTACKS_NO #endif MON("succubus", S_DEMON, LVL(6, 12, 0, 70, -9), (G_NOCORPSE|1), @@ -3479,6 +3481,10 @@ monst_init() { return; } + +struct attack sa_yes[NATTK] = SEDUCTION_ATTACKS_YES; +struct attack sa_no[NATTK] = SEDUCTION_ATTACKS_NO; + #endif /*monst.c*/ diff --git a/src/sounds.c b/src/sounds.c index 54921d554..9dfba7fc0 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -779,17 +779,20 @@ register struct monst *mtmp; } break; case MS_SEDUCE: + { + int swval; #ifdef SEDUCE - if (ptr->mlet != S_NYMPH && + if (SYSOPT_SEDUCE) { + if (ptr->mlet != S_NYMPH && could_seduce(mtmp, &youmonst, (struct attack *)0) == 1) { (void) doseduce(mtmp); break; - } - switch ((poly_gender() != (int) mtmp->female) ? rn2(3) : 0) -#else - switch ((poly_gender() == 0) ? rn2(3) : 0) + } + swval = ((poly_gender() != (int) mtmp->female) ? rn2(3) : 0); + } else #endif - { + swval = ((poly_gender() == 0) ? rn2(3) : 0); + switch(swval){ case 2: verbl_msg = "Hello, sailor."; break; @@ -799,6 +802,7 @@ register struct monst *mtmp; default: pline_msg = "cajoles you."; } + } break; #ifdef KOPS case MS_ARREST: diff --git a/src/sys.c b/src/sys.c index 5dedfb71e..655cecfe6 100644 --- a/src/sys.c +++ b/src/sys.c @@ -47,5 +47,25 @@ sys_early_init(){ # endif # endif #endif + +#ifdef SEDUCE + sysopt.seduce = 1; /* if it's compiled in, default to on */ + sysopt_seduce_set(sysopt.seduce); +#endif } + +extern struct attack sa_yes[NATTK]; +extern struct attack sa_no[NATTK]; + +void +sysopt_seduce_set(val) + int val; +{ + struct attack *setval = val ? sa_yes : sa_no; + int x; + for(x=0; xdata, AD_SEDU) #ifdef SEDUCE - && !dmgtype(mtmp2->data, AD_SSEX) + && (!SYSOPT_SEDUCE || !dmgtype(mtmp2->data, AD_SSEX)) #endif ) mtmp2->mcan = 0; mtmp2->mcansee = 1; /* set like in makemon */ diff --git a/sys/unix/sysconf b/sys/unix/sysconf index f2181c77f..1f9da26ee 100644 --- a/sys/unix/sysconf +++ b/sys/unix/sysconf @@ -23,6 +23,9 @@ MAXPLAYERS=10 # If not null, displayed at the end of a panic-save sequence. #RECOVER=Run the recover program. +# Uncomment the next line to disable the SEDUCE option. +#SEDUCE=0 + # Record (high score) file options. # CAUTION: changing these after people have started playing games can # lead to lost high scores!