qwertz patch for SlashEM 0.0.7E6F3 adds option qwertz_layout to swap y/z
version 0.3 by Stanislav Traykov 20031218. Terms of use: NetHack GPL
(you need to #define QWERTZ in config.h to activate the patch)
CHANGES:
v. 0.3: fix cmdchar declaration (M-? commands work now)
v. 0.2: fix comments & remove global const
diff -Naur slashem-0.0.7E6F3/dat/help slashem-0.0.7E6F3-qwertz/dat/help
--- slashem-0.0.7E6F3/dat/help Sat Nov 13 08:58:52 2004
+++ slashem-0.0.7E6F3-qwertz/dat/help Fri Dec 17 22:35:40 2004
@@ -62,6 +62,8 @@
case means the Control key, not a caret)
> down m
: move without picking up objects
F: fight even if you don't sense a monster
+ With the qwertz_layout option, the y and z keys are swapped
+ (this requires option QWERTZ to be set at compile-time).
If the number_pad option is set, the number keys move instead.
Depending on the platform, Shift number (on the numberpad),
Meta number, or Alt number will invoke the YUHJKLBN commands.
@@ -151,10 +153,10 @@
x Switch weapon slots.
X List the spells you know (same as '+').
^X Show your attributes.
- ^Y polymorph (if possible)
- z Zap a wand.
- Z Cast a spell.
- ^Z Suspend the game.
+ ^Y polymorph (if possible) (^Z if qwertz_layout is set)
+ z Zap a wand. (y if qwertz_layout is set)
+ Z Cast a spell. (Y if qwertz_layout is set)
+ ^Z Suspend the game. (^Y if qwertz_layout is set)
: Look at what is here.
; Look at what is somewhere else.
, Pick up some things.
diff -Naur slashem-0.0.7E6F3/dat/hh slashem-0.0.7E6F3-qwertz/dat/hh
--- slashem-0.0.7E6F3/dat/hh Sat Nov 13 08:58:52 2004
+++ slashem-0.0.7E6F3-qwertz/dat/hh Fri Dec 17 22:32:55 2004
@@ -8,6 +8,8 @@
< up ^: considered interesting (the ^ in this
case means the Control key, not a caret)
> down m: move without picking up objects
+ With the qwertz_layout option, the y and z keys are swapped
+ (this requires option QWERTZ to be set at compile-time).
If the number_pad option is set, the number keys move instead.
Depending on the platform, Shift number (on the numberpad),
Meta number, or Alt number will invoke the YUHJKLBN commands.
@@ -21,6 +23,7 @@
S save save the game (to be continued later)
! sh escape to some SHELL (if allowed)
^Z suspend suspend the game (independent of your current suspend char)
+ (^Y if option qwertz_layout is set)
O options set options
/ whatis tell what a map symbol represents
\ known display list of what's been discovered
@@ -69,8 +72,8 @@
W wear put on some armor
x exchange swap weapon slots
X spells list the spells you know
-z zap zap a wand
-Z Zap cast a spell
+z zap zap a wand (y if option qwertz_layout is set)
+Z Zap cast a spell (Y if option qwertz_layout is set)
< up go up the stairs
> down go down the stairs
^ trap_id identify a previously found trap
diff -Naur slashem-0.0.7E6F3/dat/opthelp slashem-0.0.7E6F3-qwertz/dat/opthelp
--- slashem-0.0.7E6F3/dat/opthelp Sat Nov 13 08:58:52 2004
+++ slashem-0.0.7E6F3-qwertz/dat/opthelp Fri Dec 17 22:32:55 2004
@@ -92,6 +92,9 @@
Boolean options if KEEP_SAVE was set at compile time:
keep_savefile keep save file after restore [FALSE]
+Boolean option if QWERTZ was set at compile time:
+qwertz_layout swap the y and z keys [FALSE]
+
Boolean option if USE_TILES was set at compile time (MSDOS protected mode only):
preload_tiles control whether tiles get pre-loaded into RAM at the
start of the game. Doing so enhances performance
diff -Naur slashem-0.0.7E6F3/doc/Guidebook.mn slashem-0.0.7E6F3-qwertz/doc/Guidebook.mn
--- slashem-0.0.7E6F3/doc/Guidebook.mn Sat Nov 13 08:58:52 2004
+++ slashem-0.0.7E6F3-qwertz/doc/Guidebook.mn Fri Dec 17 22:32:55 2004
@@ -2172,6 +2172,9 @@
.lp pushweapon
Using the `w' (wield) command when already wielding
something pushes the old item into your alternate weapon slot (default off).
+.lp qwertz_layout
+If QWERTZ was set in config.h at compile-time this option can be used to swap
+the y and z keys. This is useful for some keyboard layouts.
.lp race
Selects your race (for example, ``race:human''). Default is random.
Cannot be set with the `O' command.
diff -Naur slashem-0.0.7E6F3/doc/Guidebook.tex slashem-0.0.7E6F3-qwertz/doc/Guidebook.tex
--- slashem-0.0.7E6F3/doc/Guidebook.tex Sat Nov 13 08:58:52 2004
+++ slashem-0.0.7E6F3-qwertz/doc/Guidebook.tex Fri Dec 17 22:32:55 2004
@@ -2972,6 +2972,11 @@
something pushes the old item into your alternate weapon slot (default off).
%.lp
+\item[\ib{qwertz\_layout}]
+If {\tt QWERTZ} was set in {\it config.h} at compile-time this option can be
+used to swap the y and z keys. This is useful for some keyboard layouts.
+%.Ip
+
\item[\ib{race}]
Selects your race (for example, ``{\tt race:human}''). Default is random.
Cannot be set with the `{\tt O}' command.
diff -Naur slashem-0.0.7E6F3/include/decl.h slashem-0.0.7E6F3-qwertz/include/decl.h
--- slashem-0.0.7E6F3/include/decl.h Sat Nov 13 08:58:52 2004
+++ slashem-0.0.7E6F3-qwertz/include/decl.h Fri Dec 17 22:32:55 2004
@@ -228,7 +228,12 @@
E const char nul[];
E char lock[];
+#ifdef QWERTZ
+E const char qykbd_dir[], qzkbd_dir[], ndir[];
+E char const *sdir;
+#else
E const char sdir[], ndir[];
+#endif
E const schar xdir[], ydir[], zdir[];
E NEARDATA schar tbx, tby; /* set in mthrowu.c */
diff -Naur slashem-0.0.7E6F3/include/flag.h slashem-0.0.7E6F3-qwertz/include/flag.h
--- slashem-0.0.7E6F3/include/flag.h Sat Nov 13 08:58:52 2004
+++ slashem-0.0.7E6F3-qwertz/include/flag.h Fri Dec 17 22:32:56 2004
@@ -193,6 +193,9 @@
uchar bouldersym; /* symbol for boulder display */
boolean travel1; /* first travel step */
coord travelcc; /* coordinates for travel_cache */
+#ifdef QWERTZ
+ boolean qwertz_layout; /* swap y/z for this key layout */
+#endif
#ifdef WIZARD
boolean sanity_check; /* run sanity checks */
boolean mon_polycontrol; /* debug: control monster polymorphs */
diff -Naur slashem-0.0.7E6F3/src/cmd.c slashem-0.0.7E6F3-qwertz/src/cmd.c
--- slashem-0.0.7E6F3/src/cmd.c Sat Nov 13 08:58:52 2004
+++ slashem-0.0.7E6F3-qwertz/src/cmd.c Fri Dec 17 22:32:56 2004
@@ -2799,9 +2799,18 @@
} else {
register const struct func_tab *tlist;
int res, NDECL((*func));
+#ifdef QWERTZ
+ unsigned char cmdchar = *cmd & 0xff;
+#endif
for (tlist = cmdlist; tlist->f_char; tlist++) {
- if ((*cmd & 0xff) != (tlist->f_char & 0xff)) continue;
+#ifdef QWERTZ
+ if (C(cmdchar) == C('y') && iflags.qwertz_layout == TRUE)
+ cmdchar += 'z' - 'y';
+ if (cmdchar != (tlist->f_char & 0xff)) continue;
+#else
+ if ((*cmd & 0xff) != (tlist->f_char & 0xff)) continue;
+#endif
if (u.uburied && !tlist->can_if_buried) {
You_cant("do that while you are buried!");
res = 0;
diff -Naur slashem-0.0.7E6F3/src/decl.c slashem-0.0.7E6F3-qwertz/src/decl.c
--- slashem-0.0.7E6F3/src/decl.c Sat Nov 13 08:58:52 2004
+++ slashem-0.0.7E6F3-qwertz/src/decl.c Fri Dec 17 22:32:56 2004
@@ -99,7 +99,13 @@
NEARDATA struct sinfo program_state;
/* 'rogue'-like direction commands (cmd.c) */
+#ifdef QWERTZ
+const char qykbd_dir[] = "hykulnjb><"; /* qwerty layout */
+const char qzkbd_dir[] = "hzkulnjb><"; /* qwertz layout */
+char const *sdir=qykbd_dir;
+#else
const char sdir[] = "hykulnjb><";
+#endif
const char ndir[] = "47896321><"; /* number pad mode */
const schar xdir[10] = { -1,-1, 0, 1, 1, 1, 0,-1, 0, 0 };
const schar ydir[10] = { 0,-1,-1,-1, 0, 1, 1, 1, 0, 0 };
diff -Naur slashem-0.0.7E6F3/src/options.c slashem-0.0.7E6F3-qwertz/src/options.c
--- slashem-0.0.7E6F3/src/options.c Sat Nov 13 08:58:52 2004
+++ slashem-0.0.7E6F3-qwertz/src/options.c Fri Dec 17 22:32:56 2004
@@ -181,6 +181,9 @@
{"prayconfirm", &flags.prayconfirm, TRUE, SET_IN_GAME},
{"preload_tiles", &iflags.wc_preload_tiles, TRUE, DISP_IN_GAME}, /*WC*/
{"pushweapon", &flags.pushweapon, FALSE, SET_IN_GAME},
+#ifdef QWERTZ
+ {"qwertz_layout", &iflags.qwertz_layout, FALSE, SET_IN_GAME},
+#endif
{"radar", (boolean *)0, FALSE, SET_IN_FILE}, /* OBSOLETE */
#if defined(MICRO) && !defined(AMIGA)
{"rawio", &iflags.rawio, FALSE, DISP_IN_GAME},
@@ -1374,6 +1377,18 @@
} else badoption(opts);
return;
}
+
+#ifdef QWERTZ
+ fullname = "qwertz_layout";
+ if (match_optname(opts, fullname, 6, FALSE)) {
+ if (negated)
+ sdir=qykbd_dir;
+ else
+ sdir=qzkbd_dir;
+ iflags.qwertz_layout=!negated;
+ return;
+ }
+#endif
fullname = "runmode";
if (match_optname(opts, fullname, 4, TRUE)) {