diff --git a/1998/banks/Makefile b/1998/banks/Makefile index 3ac988ffc..c5cb5bfdd 100644 --- a/1998/banks/Makefile +++ b/1998/banks/Makefile @@ -40,7 +40,7 @@ include ../../var.mk # CSILENCE= -Wno-empty-body -Wno-error -Wno-implicit-function-declaration \ -Wno-unsequenced -Wno-incompatible-pointer-types \ - -Wno-bitwise-instead-of-logical -Wno-strict-prototypes + -Wno-bitwise-instead-of-logical -Wno-strict-prototypes -Wno-implicit-int # Common C compiler warning flags # @@ -117,8 +117,8 @@ OBJ= ${PROG}.o DATA= bb.sc horizon.sc mountains.sc pittsburgh.sc pyramids.sc river.sc TARGET= ${PROG} # -ALT_OBJ= -ALT_TARGET= +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt ################# @@ -141,6 +141,11 @@ ${PROG}: ${PROG}.c alt: data ${ALT_TARGET} @${TRUE} +${PROG}.alt: ${PROG}.c + ${CC} ${CFLAGS} -UIT -UDT -DIT=XK_f -DDT=XK_d -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ + -DCS=XK_Return -Ddt=0.02 $< -o $@ ${LDFLAGS} + + # data files # data: ${DATA} diff --git a/1998/banks/README.md b/1998/banks/README.md index d6b3c9242..b2934e52c 100644 --- a/1998/banks/README.md +++ b/1998/banks/README.md @@ -4,6 +4,11 @@ make all ``` +For those who do not have a Page Up or Page Down key, see [alternate +code](#alternate-code) below. The same method may be used if you wish to +redefine other keys but the alt build sets a default for those without page up +and page down. + ## To use: @@ -11,6 +16,86 @@ make all cat horizon.sc pittsburgh.sc | ./banks ``` +See the author's remarks in [scenery](#scenery) for more details on the scenery +files. + + +## Try: + +For a fun time after running the above command, hold down the up arrow and left +arrow for about 10 seconds and see what happens. Or, if you wish to really use +it in a non-silly way, see the author's remarks for the real controls. Perhaps +you can regain control? + + +## Alternate code: + +If you do not have access to a page up or page down key, for instance you're +using a Mac, you can use the alt code (though it actually uses the same code) +that will redefine the keys to increase throttle and decrease throttle. This +same method can be used with the original code but this is sets up a default for +the missing keys of Macs. + +The keys were somewhat arbitrarily selected but it was decided to make them on +the left side of the keyboard as one might have a harder time using the arrows +at the same time as typing on the right side. + + +### Alternate build: + +As the Makefile allows you to configure the keys to use you may redefine the +keys. This can be done for both versions but if you don't have certain keys it's +even more important. In the main program increasing throttle is by page up and +decreasing throttle is page down. In the alt build it is `f` and `d` +respectively as these are letters on the left side of the keyboard which is +easier to use if one is using the right side for movement. + +To use the default changes: + +```sh +make alt +``` + +If however you wish to change these, see the header file [keysym.h](keysym.h) +for the definitions of other characters that you might wish to use. The name of +the macro in the header file is what you need to set the macros in the Makefile +to, depending on what controls you wish to redefine. + +For instance if you want to use 'u' to increase throttle and 'd' to decrease +throttle you would do: + +```sh +make clobber CDEFINE="-UIT -UDT -DIT=XK_u -DDT=XK_d -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \ + -DCS=XK_Return" alt +``` + +because in the header file you can see that `XK_u` corresponds to `u` and `XK_d` +corresponds to `d`: + +```c +#define XK_d 0x0064 /* U+0064 LATIN SMALL LETTER D */ +#define XK_u 0x0075 /* U+0075 LATIN SMALL LETTER U */ +``` + +Note that you must specify all keys and other `-D` macros if you redefine any of +them. + +The upper case letters would be `XK_U` and `XK_D` and you can search the header +file for 'LATIN CAPITAL D', for example. + +See [alternate build instructions](#alternate-build-instructions) for the proper +macro names. You may do the above for the entry itself as well, of course, if +you do not like the defaults selected. + +Note that the [keysym.h](keysym.h) file is not complete from X11; it's just the +more likely candidates (and some that are probably unlikely :-) ). + + +### Alternate use: + +Use `banks.alt` as you would `banks` but for use the different keys as +configured at compilation. + ## Judges' remarks: @@ -20,7 +105,7 @@ tight, well, we can just point them at this one. This program really pushes the envelope! The provided Makefile should work; you will need an X-ish system, and -a `select()` system call. More on building in the author remarks. +a `select(2)` system call. More on building in the author remarks. Carl Banks linked to (on his old website) an interesting article about this entry, a flight simulator in just 1536 bytes, which can be found at @@ -37,7 +122,7 @@ Use the keyboard to fly the airplane. The arrow keys represent the control stick. Press the Up Arrow key to push the stick forward. Press the left arrow key to move the stick left, and so on. Press Enter to re-center the stick. Use Page Up and Page -Down increase and decrease the throttle, respectively. (The +Down to increase and decrease the throttle, respectively. (The rudder is automatically coordinated with the turn rate, so rudder pedals are not represented.) @@ -57,7 +142,7 @@ single-engine propeller driven airplane. * The airplane is modeled as a six degree-of-freedom rigid body, accurately reflecting its dynamics (for normal flight conditions, at least). -* Fly through a virtual 3-D world, while sitting at your X console. +* Fly through a virtual 3D world, while sitting at your X console. * Loadable scenery files. @@ -138,7 +223,7 @@ You can simulate flying through a cloud bank as well: You will usually want at least a horizon, though. The format of scenery files is simple, by the way. They're just -a list of 3-D coordinates, and the simulator simply draws line +a list of 3D coordinates, and the simulator simply draws line segments from point to point as listed in the scenery file. `0 0 0` is used to end a series of consecutive line segments. Note that in the coordinate system used, _the third coordinate @@ -147,6 +232,7 @@ positive altitudes_. I'm sure you'll be making your own scenery files very soon!!! + ### Alternate Build Instructions Several options must be passed to the compiler to make the build diff --git a/1998/banks/keysym.h b/1998/banks/keysym.h new file mode 100644 index 000000000..51acc0f22 --- /dev/null +++ b/1998/banks/keysym.h @@ -0,0 +1,97 @@ +#define XK_space 0x0020 /* U+0020 SPACE */ +#define XK_exclam 0x0021 /* U+0021 EXCLAMATION MARK */ +#define XK_quotedbl 0x0022 /* U+0022 QUOTATION MARK */ +#define XK_numbersign 0x0023 /* U+0023 NUMBER SIGN */ +#define XK_dollar 0x0024 /* U+0024 DOLLAR SIGN */ +#define XK_percent 0x0025 /* U+0025 PERCENT SIGN */ +#define XK_ampersand 0x0026 /* U+0026 AMPERSAND */ +#define XK_apostrophe 0x0027 /* U+0027 APOSTROPHE */ +#define XK_quoteright 0x0027 /* deprecated */ +#define XK_parenleft 0x0028 /* U+0028 LEFT PARENTHESIS */ +#define XK_parenright 0x0029 /* U+0029 RIGHT PARENTHESIS */ +#define XK_asterisk 0x002a /* U+002A ASTERISK */ +#define XK_plus 0x002b /* U+002B PLUS SIGN */ +#define XK_comma 0x002c /* U+002C COMMA */ +#define XK_minus 0x002d /* U+002D HYPHEN-MINUS */ +#define XK_period 0x002e /* U+002E FULL STOP */ +#define XK_slash 0x002f /* U+002F SOLIDUS */ +#define XK_0 0x0030 /* U+0030 DIGIT ZERO */ +#define XK_1 0x0031 /* U+0031 DIGIT ONE */ +#define XK_2 0x0032 /* U+0032 DIGIT TWO */ +#define XK_3 0x0033 /* U+0033 DIGIT THREE */ +#define XK_4 0x0034 /* U+0034 DIGIT FOUR */ +#define XK_5 0x0035 /* U+0035 DIGIT FIVE */ +#define XK_6 0x0036 /* U+0036 DIGIT SIX */ +#define XK_7 0x0037 /* U+0037 DIGIT SEVEN */ +#define XK_8 0x0038 /* U+0038 DIGIT EIGHT */ +#define XK_9 0x0039 /* U+0039 DIGIT NINE */ +#define XK_colon 0x003a /* U+003A COLON */ +#define XK_semicolon 0x003b /* U+003B SEMICOLON */ +#define XK_less 0x003c /* U+003C LESS-THAN SIGN */ +#define XK_equal 0x003d /* U+003D EQUALS SIGN */ +#define XK_greater 0x003e /* U+003E GREATER-THAN SIGN */ +#define XK_question 0x003f /* U+003F QUESTION MARK */ +#define XK_at 0x0040 /* U+0040 COMMERCIAL AT */ +#define XK_A 0x0041 /* U+0041 LATIN CAPITAL LETTER A */ +#define XK_B 0x0042 /* U+0042 LATIN CAPITAL LETTER B */ +#define XK_C 0x0043 /* U+0043 LATIN CAPITAL LETTER C */ +#define XK_D 0x0044 /* U+0044 LATIN CAPITAL LETTER D */ +#define XK_E 0x0045 /* U+0045 LATIN CAPITAL LETTER E */ +#define XK_F 0x0046 /* U+0046 LATIN CAPITAL LETTER F */ +#define XK_G 0x0047 /* U+0047 LATIN CAPITAL LETTER G */ +#define XK_H 0x0048 /* U+0048 LATIN CAPITAL LETTER H */ +#define XK_I 0x0049 /* U+0049 LATIN CAPITAL LETTER I */ +#define XK_J 0x004a /* U+004A LATIN CAPITAL LETTER J */ +#define XK_K 0x004b /* U+004B LATIN CAPITAL LETTER K */ +#define XK_L 0x004c /* U+004C LATIN CAPITAL LETTER L */ +#define XK_M 0x004d /* U+004D LATIN CAPITAL LETTER M */ +#define XK_N 0x004e /* U+004E LATIN CAPITAL LETTER N */ +#define XK_O 0x004f /* U+004F LATIN CAPITAL LETTER O */ +#define XK_P 0x0050 /* U+0050 LATIN CAPITAL LETTER P */ +#define XK_Q 0x0051 /* U+0051 LATIN CAPITAL LETTER Q */ +#define XK_R 0x0052 /* U+0052 LATIN CAPITAL LETTER R */ +#define XK_S 0x0053 /* U+0053 LATIN CAPITAL LETTER S */ +#define XK_T 0x0054 /* U+0054 LATIN CAPITAL LETTER T */ +#define XK_U 0x0055 /* U+0055 LATIN CAPITAL LETTER U */ +#define XK_V 0x0056 /* U+0056 LATIN CAPITAL LETTER V */ +#define XK_W 0x0057 /* U+0057 LATIN CAPITAL LETTER W */ +#define XK_X 0x0058 /* U+0058 LATIN CAPITAL LETTER X */ +#define XK_Y 0x0059 /* U+0059 LATIN CAPITAL LETTER Y */ +#define XK_Z 0x005a /* U+005A LATIN CAPITAL LETTER Z */ +#define XK_bracketleft 0x005b /* U+005B LEFT SQUARE BRACKET */ +#define XK_backslash 0x005c /* U+005C REVERSE SOLIDUS */ +#define XK_bracketright 0x005d /* U+005D RIGHT SQUARE BRACKET */ +#define XK_asciicircum 0x005e /* U+005E CIRCUMFLEX ACCENT */ +#define XK_underscore 0x005f /* U+005F LOW LINE */ +#define XK_grave 0x0060 /* U+0060 GRAVE ACCENT */ +#define XK_quoteleft 0x0060 /* deprecated */ +#define XK_a 0x0061 /* U+0061 LATIN SMALL LETTER A */ +#define XK_b 0x0062 /* U+0062 LATIN SMALL LETTER B */ +#define XK_c 0x0063 /* U+0063 LATIN SMALL LETTER C */ +#define XK_d 0x0064 /* U+0064 LATIN SMALL LETTER D */ +#define XK_e 0x0065 /* U+0065 LATIN SMALL LETTER E */ +#define XK_f 0x0066 /* U+0066 LATIN SMALL LETTER F */ +#define XK_g 0x0067 /* U+0067 LATIN SMALL LETTER G */ +#define XK_h 0x0068 /* U+0068 LATIN SMALL LETTER H */ +#define XK_i 0x0069 /* U+0069 LATIN SMALL LETTER I */ +#define XK_j 0x006a /* U+006A LATIN SMALL LETTER J */ +#define XK_k 0x006b /* U+006B LATIN SMALL LETTER K */ +#define XK_l 0x006c /* U+006C LATIN SMALL LETTER L */ +#define XK_m 0x006d /* U+006D LATIN SMALL LETTER M */ +#define XK_n 0x006e /* U+006E LATIN SMALL LETTER N */ +#define XK_o 0x006f /* U+006F LATIN SMALL LETTER O */ +#define XK_p 0x0070 /* U+0070 LATIN SMALL LETTER P */ +#define XK_q 0x0071 /* U+0071 LATIN SMALL LETTER Q */ +#define XK_r 0x0072 /* U+0072 LATIN SMALL LETTER R */ +#define XK_s 0x0073 /* U+0073 LATIN SMALL LETTER S */ +#define XK_t 0x0074 /* U+0074 LATIN SMALL LETTER T */ +#define XK_u 0x0075 /* U+0075 LATIN SMALL LETTER U */ +#define XK_v 0x0076 /* U+0076 LATIN SMALL LETTER V */ +#define XK_w 0x0077 /* U+0077 LATIN SMALL LETTER W */ +#define XK_x 0x0078 /* U+0078 LATIN SMALL LETTER X */ +#define XK_y 0x0079 /* U+0079 LATIN SMALL LETTER Y */ +#define XK_z 0x007a /* U+007A LATIN SMALL LETTER Z */ +#define XK_braceleft 0x007b /* U+007B LEFT CURLY BRACKET */ +#define XK_bar 0x007c /* U+007C VERTICAL LINE */ +#define XK_braceright 0x007d /* U+007D RIGHT CURLY BRACKET */ +#define XK_asciitilde 0x007e /* U+007E TILDE */ diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index ccd4aa2ce..9c67391f9 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -2027,6 +2027,16 @@ Also, to fix any potential problem with displaying in GitHub the scripts provided by the author, Cody added '.sh'. +## [1998/banks](1998/banks/banks.c) ([README.md](1998/banks/README.md])) + +Cody set up the Makefile to have an alt build (using the same code) for those +who do not have a page up or page down key and added the +[keysym.h](1998/banks/keysym.h) header file as a reference for other keys one +can use if they wish to modify the controls. One can certainly do this even if +they do have page up and page down but this gives a default for those who don't +have them like with Macs. + + ## [1998/chaos](1998/chaos/chaos.c) ([README.md](1998/chaos/README.md])) Cody added a call to `endwin()` to restore terminal sanity (echo etc.) when