These are the changes to the original source archive (2.7.9v3). You don't need to apply them if you can get the latest archive, which will have them applied already. *** ../old/src/main-emx.c Fri Jan 19 06:48:50 1996 --- main-emx.c Thu Jan 25 17:00:36 1996 *************** *** 4,16 **** /* Author: ekraemer@pluto.camelot.de (Ekkehard Kraemer) */ - /* XXX XXX XXX */ - /* Warning: This file is NOT ready for Angband 2.7.9v2 */ - /* Verify the new "Pipe" code and FIX THE KEYPRESS CODE */ - /* Note especially the use of proper "Term_xtra" calls */ - /* XXX XXX XXX */ - - #ifdef __EMX__ /* --- 4,9 ---- *************** *** 38,44 **** * - run 'dmake -B -r -f makefile.emx clean' * * ! * I used EMX 0.9a, but every EMX compiler since 0.8g or so should work * fine. EMX is available at ftp-os2.cdrom.com ("Hobbes"), as is dmake. * * dmake: ftp://ftp-os2.cdrom.com/all/program/dmake38X.zip --- 31,37 ---- * - run 'dmake -B -r -f makefile.emx clean' * * ! * I use EMX 0.9b, but every EMX compiler since 0.8g or so should work * fine. EMX is available at ftp-os2.cdrom.com ("Hobbes"), as is dmake. * * dmake: ftp://ftp-os2.cdrom.com/all/program/dmake38X.zip *************** *** 65,78 **** * 25.12.95 EK 2.7.9 Added 'install' target * non-beta Updated installation hints * Uploaded binary to export.andrew.cmu.edu */ #include #include #include #include #include - #define INCL_DOS /* A bit of overkill for the pipe code... */ #include #include "angband.h" --- 58,76 ---- * 25.12.95 EK 2.7.9 Added 'install' target * non-beta Updated installation hints * Uploaded binary to export.andrew.cmu.edu + * + * 25.01.96 EK 2.7.9 Updated for 2.7.9v3 + * v3 Removed (improved) keyboard hack + * Introduced pref-emx.prf + * Phew... Makefile.emx grows! (patches, export) */ + #include #include #include #include #include #include #include #include "angband.h" *************** *** 106,112 **** /* * Prototypes! */ - static errr Term_xtra_emx(int n, int v); static errr Term_curs_emx(int x, int y); static errr Term_wipe_emx(int x, int y, int n); static errr Term_text_emx(int x, int y, int n, unsigned char a, cptr s); --- 104,109 ---- *************** *** 114,124 **** static void Term_nuke_emx(term *t); /* - * Hack - */ - static errr CheckEvents(int returnImmediately) - - /* * Current cursor "size" */ static int curs_start=0; --- 111,116 ---- *************** *** 160,214 **** /* - * Do a special thing (beep, flush, etc) - */ - static errr Term_xtra_emx(int n, int v) - { - int i; - - switch (n) - { - - #ifndef __EMX__CLIENT__ - - case TERM_XTRA_INVIS: - v_hidecursor(); - return (0); - - case TERM_XTRA_BEVIS: - v_ctype(curs_start,curs_end); - return (0); - - case TERM_XTRA_NOISE: - putchar(7); - return (0); - - case TERM_XTRA_FLUSH: - while (!CheckEvents(TRUE)); - return 0; - - case TERM_XTRA_EVENT: - - /* Process an event */ - return (CheckEvents(!v)); - - /* Success */ - return (0); - - #endif - - case TERM_XTRA_CLEAR: - for (i = 0; i < 24; i++) { - v_gotoxy(0,i); - v_putn(' ',80); - } - return (0); - } - - return (1); - } - - /* * Display a cursor, on top of a given attr/char */ static errr Term_curs_emx(int x, int y) --- 152,157 ---- *************** *** 251,256 **** --- 194,218 ---- v_init(); v_getctype(&curs_start,&curs_end); v_clear(); + + signal(SIGHUP,SIG_IGN); + signal(SIGINT,SIG_IGN); + signal(SIGQUIT,SIG_IGN); + /* signal(SIGILL,SIG_IGN); */ + /* signal(SIGTRAP,SIG_IGN); */ + /* signal(SIGABRT,SIG_IGN); */ + /* signal(SIGEMT,SIG_IGN); */ + /* signal(SIGFPE,SIG_IGN); */ + /* signal(SIGBUS,SIG_IGN); */ + /* signal(SIGSEGV,SIG_IGN); */ + /* signal(SIGSYS,SIG_IGN); */ + signal(SIGPIPE,SIG_IGN); + signal(SIGALRM,SIG_IGN); + /* signal(SIGTERM,SIG_IGN); */ + signal(SIGUSR1,SIG_IGN); + signal(SIGUSR2,SIG_IGN); + signal(SIGCHLD,SIG_IGN); + signal(SIGBREAK,SIG_IGN); } /* *************** *** 328,386 **** */ static errr CheckEvents(int returnImmediately) { ! int k = 0, ke = 0, ka = 0; ! ! /* Keyboard polling is BAD for multitasking systems */ ! if (returnImmediately) ! { ! /* Check for a keypress (no waiting) */ ! k = _read_kbd(0,0,0); ! /* Nothing ready */ ! if (k < 0) return (1); ! } ! /* Wait for a keypress */ ! else ! { ! /* Wait for a keypress */ ! k = _read_kbd(0,1,0); ! } /* Get an extended scan code */ if (!k) ke = _read_kbd(0,1,0); ! ! /* Mega-Hack -- Convert Arrow keys into directions */ ! switch (ke) ! { ! case K_LEFT: ka = '4'; break; ! case K_RIGHT: ka = '6'; break; ! case K_UP: ka = '8'; break; ! case K_DOWN: ka = '2'; break; ! case K_HOME: ka = '7'; break; ! case K_PAGEUP: ka = '9'; break; ! case K_PAGEDOWN: ka = '3'; break; ! case K_END: ka = '1'; break; ! case K_CENTER: ka = '5'; break; ! } ! ! ! /* Special arrow keys */ ! if (ka) ! { ! /* Hack -- Keypad key introducer */ ! Term_keypress(30); ! ! /* Send the "numerical direction" */ ! Term_keypress(ka); ! ! /* Success */ ! return (0); ! } ! ! ! /* Hack -- normal keypresses */ if (k) { /* Enqueue the key */ --- 290,307 ---- */ static errr CheckEvents(int returnImmediately) { ! int k = 0, ke = 0; ! /* Get key */ ! k=_read_kbd(0,returnImmediately?0:1,0); ! /* Nothing ready */ ! if (k < 0) return (1); /* Get an extended scan code */ if (!k) ke = _read_kbd(0,1,0); ! /* Normal keypresses */ if (k) { /* Enqueue the key */ *************** *** 390,399 **** return (0); } - /* Hack -- introduce a macro sequence */ Term_keypress(31); /* Hack -- send the key sequence */ Term_keypress('0' + (ke % 1000) / 100); Term_keypress('0' + (ke % 100) / 10); --- 311,321 ---- return (0); } /* Hack -- introduce a macro sequence */ Term_keypress(31); + /* XXX We're not able to extract shift/ctrl/alt key information here. */ + /* Hack -- send the key sequence */ Term_keypress('0' + (ke % 1000) / 100); Term_keypress('0' + (ke % 100) / 10); *************** *** 402,412 **** /* Hack -- end the macro sequence */ Term_keypress(13); - /* Success */ return (0); } static errr Term_xtra_pipe_emx(int n, int v) { --- 324,372 ---- /* Hack -- end the macro sequence */ Term_keypress(13); /* Success */ return (0); } + /* + * Do a special thing (beep, flush, etc) + */ + static errr Term_xtra_emx(int n, int v) + { + switch (n) + { + + case TERM_XTRA_INVIS: + v_hidecursor(); + return (0); + + case TERM_XTRA_BEVIS: + v_ctype(curs_start,curs_end); + return (0); + + case TERM_XTRA_NOISE: + putchar(7); + return (0); + + case TERM_XTRA_FLUSH: + while (!CheckEvents(TRUE)); + return 0; + + case TERM_XTRA_EVENT: + + /* Process an event */ + return (CheckEvents(!v)); + + /* Success */ + return (0); + + case TERM_XTRA_CLEAR: + v_clear(); + return (0); + } + + return (1); + } static errr Term_xtra_pipe_emx(int n, int v) { *************** *** 432,439 **** if (!tp->out) return -1; fputc(PIP_XTRA,tp->out); ! fwrite(&x,sizeof(n),1,tp->out); ! fwrite(&y,sizeof(v),1,tp->out); fflush(tp->out); return (0); --- 392,399 ---- if (!tp->out) return -1; fputc(PIP_XTRA,tp->out); ! fwrite(&n,sizeof(n),1,tp->out); ! fwrite(&v,sizeof(v),1,tp->out); fflush(tp->out); return (0); *************** *** 600,608 **** int main(int argc, char **argv) { int c, end = 0, lines = 25; ! int x, y, w, h, z, n, v; ! FILE *in; char a; char buf[160]; HPIPE pipe; --- 560,568 ---- int main(int argc, char **argv) { int c, end = 0, lines = 25; ! int x, y, h, n, v; ! FILE *in=NULL; char a; char buf[160]; HPIPE pipe; *************** *** 623,658 **** sprintf(buf,"\\pipe\\angband\\%s",argv[1]); ! rc=DosCreateNPipe((PSZ)buf, /* Create pipe */ ! &pipe, ! NP_ACCESS_INBOUND, ! NP_WAIT|NP_TYPE_BYTE|NP_READMODE_BYTE|1, ! 1, /* Output buffer (no output, ! anyway) */ ! 1, /* Input buffer */ ! -1); ! ! if (rc) /* Pipe not created */ { ! printf("DosCreateNPipe: rc=%ld, pipe=%ld\n",(long)rc,(long)pipe); ! abort(); ! } ! do ! { ! rc=DosConnectNPipe(pipe); /* Wait for angband to connect */ ! if (!rc) break; ! _sleep2(100); /* Sleep for 0.1s */ ! } while (_read_kbd(0,0,0)==-1); /* Until key pressed */ ! ! if (rc) exit(1); ! ! h=_imphandle(pipe); /* Register handle with EMX ! library */ ! setmode(h,O_BINARY); /* Make it binary */ ! in=fdopen(h,"rb"); /* Register handle with stdio */ ! if (!in) exit(1); printf("Connected.\n"); --- 583,624 ---- sprintf(buf,"\\pipe\\angband\\%s",argv[1]); ! do { ! rc=DosCreateNPipe((PSZ)buf, /* Create pipe */ ! &pipe, ! NP_ACCESS_INBOUND, ! NP_WAIT|NP_TYPE_BYTE|NP_READMODE_BYTE|1, ! 1, /* No output buffer */ ! 1, /* No input buffer */ ! -1); ! if (rc) /* Pipe not created */ ! { ! printf("DosCreateNPipe: rc=%ld, pipe=%ld\n",(long)rc,(long)pipe); ! break; ! } ! ! do ! { ! rc=DosConnectNPipe(pipe); /* Wait for angband to connect */ ! if (!rc) break; ! _sleep2(500); /* Sleep for 0.5s */ ! } while (_read_kbd(0,0,0)==-1); /* Until key pressed */ ! if (rc) break; ! ! h=_imphandle(pipe); /* Register handle with io */ ! setmode(h,O_BINARY); /* Make it binary */ ! in=fdopen(h,"rb"); /* Register handle with stdio */ ! ! } while (0); /* We don't need no stinking exception handling */ ! ! if (!in) ! { ! printf("Sorry, the pipe connection to Angband could not be established.\n"); ! exit(1); ! } printf("Connected.\n"); *************** *** 671,677 **** if (!fread(&n,sizeof(x),1,in) || !fread(&v,sizeof(y),1,in)) abort(); ! Term_xtra_emx(n,v); break; case PIP_CURS: --- 637,655 ---- if (!fread(&n,sizeof(x),1,in) || !fread(&v,sizeof(y),1,in)) abort(); ! ! /* This hack prevents another hack */ ! switch (n) ! { ! case TERM_XTRA_CLEAR: ! v_clear(); ! break; ! ! default: ! printf("Sorry, angband.exe and aclient.exe don't fit together.\n"); ! exit(1); ! } ! break; case PIP_CURS: *************** *** 719,721 **** --- 697,705 ---- #endif /* __EMX__ */ + /* + * Local Variables: + * comment-column: 45 + * End: + * + */ *** ../old/src/config.h Fri Jan 19 06:48:46 1996 --- config.h Thu Jan 25 16:55:54 1996 *************** *** 173,189 **** /* * OPTION: Hack -- Compile in support for "Cyborg" mode */ ! /* #define ALLOW_BORG */ /* * OPTION: Hack -- Compile in support for "Wizard Commands" */ ! /* #define ALLOW_WIZARD */ /* * OPTION: Hack -- Compile in support for "Spoiler Generation" */ ! /* #define ALLOW_SPOILERS */ /* --- 173,189 ---- /* * OPTION: Hack -- Compile in support for "Cyborg" mode */ ! #define ALLOW_BORG /* * OPTION: Hack -- Compile in support for "Wizard Commands" */ ! #define ALLOW_WIZARD /* * OPTION: Hack -- Compile in support for "Spoiler Generation" */ ! #define ALLOW_SPOILERS /* *************** *** 219,225 **** * prints pretty "titles" such as "Ranger Lord" after the race and * class, and on the tombstone, and in the "description" files. */ ! /* #define ALLOW_TITLES */ /* --- 219,225 ---- * prints pretty "titles" such as "Ranger Lord" after the race and * class, and on the tombstone, and in the "description" files. */ ! #define ALLOW_TITLES /* *************** *** 381,386 **** --- 381,396 ---- /* Use something */ # define USE_ITSYBITSY + + #endif + + /* + * OPTION: Hack -- EMX stuff + */ + #ifdef USE_EMX + + /* Do not handle signals */ + # undef HANDLE_SIGNALS #endif *** ../old/src/Makefile.emx Fri Jan 19 06:48:52 1996 --- Makefile.emx Thu Jan 25 19:32:16 1996 *************** *** 6,57 **** # Since "dmake" does not demand "hard" tab stops as delimiters, # don't bother to add them. # ! # Note: Use 'dmake -B -r -f makefile.emx install' to install the executables ! # plus the batch file used for multiple windows in the parent directory. # ! # Note: use 'dmake -B -r -f makefile.emx clean' to remove temporary files. OBJS = \ ! main.o main-emx.o wizard.o wiz-spo.o \ ! borg.o borg-ben.o borg-ext.o borg-map.o borg-obj.o borg-aux.o \ ! signals.o util.o io.o init.o save.o save-old.o files.o \ ! generate.o birth.o melee.o dungeon.o store.o \ ! effects.o cmd1.o cmd2.o cmd3.o cmd4.o cmd5.o cmd6.o \ ! misc.o monster.o mon-desc.o object.o obj-desc.o \ ! spells1.o spells2.o cave.o tables.o variable.o \ ! term.o z-util.o z-virt.o z-form.o CC = gcc ! CFLAGS = -MMD -O2 -DUSE_EMX -g -Wall LIBS = -lvideo .c.o: ! $(CC) $(CFLAGS) -c $*.c ! default: angband.exe aclient.exe dependencies install: ..\angband.exe ..\aclient.exe ..\startwnd.cmd - emxbind -s ..\angband.exe - emxbind -s ..\aclient.exe clean: + del *.d ! + del dependencies ! dependencies .IGNORE: $(OBJS) ! + echo. > dependencies ! + for %a in (*.d) type %a >> dependencies ..\angband.exe: angband.exe + copy angband.exe .. ..\aclient.exe: aclient.exe + copy aclient.exe .. EC=+@ echo ECF=>> ..\startwnd.cmd ! ..\startwnd.cmd: makefile.emx $(EC) @echo off > ..\startwnd.cmd $(EC) REM This file starts up Angband and up to three other views. The $(ECF) $(EC) REM optional number behind the name sets the number of lines for $(ECF) --- 6,135 ---- # Since "dmake" does not demand "hard" tab stops as delimiters, # don't bother to add them. # ! # Use 'dmake -B -r -f makefile.emx install' to install the executables ! # and the batch file used for multiple windows in the parent directory. # ! # Use 'dmake -B -r -f makefile.emx clean' to remove temporary files. ! # ! # Advanced targets (used only by developers): ! # ! # 'patches': If the original sources are located in "..\old\src", ! # then a file "..\patches.txt" will be created which contains ! # all changed files (diff -c). Needs 4OS2. ! # ! # 'export': The file "..\exp\$(EXPORT)" is created so that it ! # can directly be uploaded as an official distribution archive. ! # + VERSION = 2.7.9v3 + EXPORT = angband-$(VERSION).os2.zip + OBJS = \ ! birth.o borg-aux.o borg-ben.o borg-ext.o borg-map.o borg-obj.o borg.o \ ! cave.o cmd1.o cmd2.o cmd3.o cmd4.o cmd5.o cmd6.o dungeon.o effects.o \ ! files.o generate.o init.o io.o main-emx.o main.o melee.o misc.o mon-desc.o \ ! monster.o obj-desc.o object.o save-old.o save.o signals.o spells1.o \ ! spells2.o store.o tables.o term.o util.o variable.o wiz-spo.o wizard.o \ ! z-form.o z-util.o z-virt.o ! ! .KEEP_STATE: CC = gcc ! CFLAGS = -MMD -O3 -DUSE_EMX -g -Zcrtdll LIBS = -lvideo + # Comment this out if you don't have nice installed + #NICE = nice -i -n -30 .c.o: ! $(NICE) $(CC) $(CFLAGS) -c $*.c ! ################################################################################### + default: all depends :-) + install: ..\angband.exe ..\aclient.exe ..\startwnd.cmd clean: + del *.d ! + del depends ! ! patches: ..\patches.txt ..\exp\patches.uue ! export: ..\exp\$(EXPORT) + #################################################################################### + ### You don't have to change anything below. ################################### + #################################################################################### + + all .PHONY: angband.exe aclient.exe + +@echo. + +@echo Now type + +@echo. + +@echo '$(MAKECMD) $(MFLAGS) $(MAKEFILE) install' + +@echo. + +@echo to install Angband in the parent directory, and/or + +@echo. + +@echo '$(MAKECMD) $(MFLAGS) $(MAKEFILE) clean' + +@echo. + +@echo to remove a bunch of temporary files used during compilation! + +@echo You may want to remove the src subdirectory, now that you have + +@echo working executables. + +@echo. + + ..\exp\$(EXPORT) .PHONY .IGNORE: install patches + # Needs 4OS2! + +@ (md ..\exp ^ \ + md ..\exp\tmpdir ^ \ + cd ..\exp\tmpdir ^ \ + copy ... ^ \ + md lib ^ \ + copy ...\lib\ lib\ /s ^ \ + zip -m -r $(EXPORT) * ^ \ + move $(EXPORT) .. ^ \ + cd .. ^ \ + del tmpdir /xsqy ) >& nul + + PATCHFILES = *.c + PATCHFILES += *.h + PATCHFILES += makefile* + PATCHFILES += ..\lib\user\pref-emx.prf + + ..\patches.txt .PHONY .IGNORE: + # Needs 4OS2! + +@ echo These are the changes to the original source > ..\patches.txt ^ \ + echo archive ($(VERSION)). You don't need to apply them >> ..\patches.txt ^ \ + echo if you can get the latest archive, which will >> ..\patches.txt ^ \ + echo have them applied already. >> ..\patches.txt ^ \ + echo. >> ..\patches.txt ^ \ + except (*~) for %a in ($(PATCHFILES)) \ + do (diff -c ..\old\src\%a %a >> ..\patches.txt) + + ..\exp\patches.uue: ..\patches.txt + # Needs 4OS2! + +@ md ..\exp >& nul ^ \ + cd ..\exp ^ \ + copy ..\patches.txt patches-$(VERSION).os2 ^ \ + gzip -f patches-$(VERSION).os2 ^ \ + uuencode patches-$(VERSION).os2.gz >& nul ^ \ + del patches-$(VERSION).os2.gz ^ \ + move patches-$(VERSION).os2.gz.uue patches.uue + + depends .IGNORE: $(OBJS) + + echo. > depends + + for %a in (*.d) type %a >> depends + ..\angband.exe: angband.exe + copy angband.exe .. + emxbind -s ..\angband.exe ..\aclient.exe: aclient.exe + copy aclient.exe .. + emxbind -s ..\aclient.exe EC=+@ echo ECF=>> ..\startwnd.cmd ! ..\startwnd.cmd: $(EC) @echo off > ..\startwnd.cmd $(EC) REM This file starts up Angband and up to three other views. The $(ECF) $(EC) REM optional number behind the name sets the number of lines for $(ECF) *************** *** 78,81 **** aclient.exe: main-emx.c $(CC) $(CFLAGS) -D__EMX__ -D__EMX__CLIENT__ -o aclient.exe main-emx.c $(LIBS) ! .INCLUDE .IGNORE: dependencies --- 156,167 ---- aclient.exe: main-emx.c $(CC) $(CFLAGS) -D__EMX__ -D__EMX__CLIENT__ -o aclient.exe main-emx.c $(LIBS) ! # Forgive me :) ! ":-)": ! +@echo. ! ! main-emx.o: ! $(NICE) $(CC) $(CFLAGS) -Wall -c $*.c ! ! .INCLUDE .IGNORE: depends ! *** ../old/src/../lib/user/pref-emx.prf Thu Jan 25 18:43:00 1996 --- ../lib/user/pref-emx.prf Thu Jan 25 15:48:02 1996 *************** *** 0 **** --- 1,159 ---- + # File: pref-emx.prf + + # + # This file is used by Angband (when it was compiled using "main-emx.c") + # to specify various "user preferences". This file specifies some visual + # attr/char remappings, which allow the use of some of OS/2's built in + # pseudo-graphic pictures for walls and such. This file defines some basic + # macros, which allow the use of the "keypad", alone, and with the shift or + # control modifier keys. All "special" keys are translated by "main-emx.c" + # into special "macro triggers" of the encoded form "^_SSS\r", where the + # two digit decimal scan code of the keypress is stored in "SSS", see + # "main-emx.c" for info. + # + + + + ### Terrain Features ### + + + # + # Floors (white / centered dot) + # + + F:1:1/-7 + + # + # Invis traps (white / centered dot) + # + + F:2:1/-7 + + + # + # Magma (slate / special solid block) + # + + F:50:2/-80 + F:52:2/-80 + + + # + # Quartz (light slate / special solid block) + # + + F:51:9/-80 + F:53:9/-80 + + + # + # Secret door (white / solid block) + # + + F:48:1/-79 + + # + # Granite walls (white / solid block) + # + + F:56:1/-79 + F:57:1/-79 + F:58:1/-79 + F:59:1/-79 + + # + # Permanent rock (white / solid block) + # + + F:60:1/-79 + F:61:1/-79 + F:62:1/-79 + F:63:1/-79 + + + + ### Basic Macros ### + + + # + # Keypad (7,8,9,-,4,5,6,+,1,2,3,0,.) + # + + A:7 + P:^_071\r + + A:8 + P:^_072\r + + A:9 + P:^_073\r + + A:- + P:^_074\r + + A:4 + P:^_075\r + + A:5 + P:^_076\r + + A:6 + P:^_077\r + + A:+ + P:^_078\r + + A:1 + P:^_079\r + + A:2 + P:^_080\r + + A:3 + P:^_081\r + + A:0 + P:^_082\r + + A:. + P:^_083\r + + + # + # Shift-Keypad-8, for example, is exactly '8', so these cannot be used for macros + # + + # + # Control + Keypad (1,2,3,4,5,6,7,8,9) + # + # Run, Run, Run, Run, Run, Run, Run, Run, RUN! + # + + A:\e\e\\.1 + C:^_117\r + + A:\e\e\\.2 + C:^_145\r + + A:\e\e\\.3 + C:^_118\r + + A:\e\e\\.4 + C:^_115\r + + A:\e\e\\.5 + C:^_143\r + + A:\e\e\\.6 + C:^_116\r + + A:\e\e\\.7 + C:^_119\r + + A:\e\e\\.8 + C:^_141\r + + A:\e\e\\.9 + C:^_132\r + +