Mercurial > hg > early-roguelike
changeset 86:8757a0593e6e
srogue: add arrow-key support.
This is a first attempt which may not be completely portable.
| author | John "Elwin" Edwards |
|---|---|
| date | Sat, 10 Aug 2013 17:43:58 -0700 |
| parents | d852b8f088c5 |
| children | f871cb0539d3 |
| files | srogue/Makefile srogue/io.c srogue/main.c srogue/mdport.c |
| diffstat | 4 files changed, 660 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/srogue/Makefile Fri Aug 09 09:34:07 2013 -0700 +++ b/srogue/Makefile Sat Aug 10 17:43:58 2013 -0700 @@ -16,15 +16,15 @@ HDRS= bob.h cx.h ncx.h rdk.h rogue.h OBJS= vers.o armor.o chase.o command.o daemon.o daemons.o disply.o encumb.o \ - fight.o global.o init.o io.o list.o main.o misc.o monsters.o move.o \ - new_leve.o options.o pack.o passages.o potions.o pstats.o rings.o rip.o \ - rooms.o save.o scrolls.o state.o sticks.o things.o trader.o weapons.o \ - wizard.o xcrypt.o + fight.o global.o init.o io.o list.o main.o mdport.o misc.o monsters.o \ + move.o new_leve.o options.o pack.o passages.o potions.o pstats.o \ + rings.o rip.o rooms.o save.o scrolls.o state.o sticks.o things.o \ + trader.o weapons.o wizard.o xcrypt.o CFILES= vers.c armor.c chase.c command.c daemon.c daemons.c disply.c encumb.c \ - fight.c global.c init.c io.c list.c main.c misc.c monsters.c move.c \ - new_leve.c options.c pack.c passages.c potions.c pstats.c rings.c rip.c \ - rooms.c save.c scrolls.c state.c sticks.c things.c trader.c weapons.c \ - wizard.c xcrypt.c + fight.c global.c init.c io.c list.c main.c mdport.c misc.c monsters.c \ + move.c new_leve.c options.c pack.c passages.c potions.c pstats.c \ + rings.c rip.c rooms.c save.c scrolls.c state.c sticks.c things.c \ + trader.c weapons.c wizard.c xcrypt.c MISC= Makefile LICENSE.TXT rogue.nr
--- a/srogue/io.c Fri Aug 09 09:34:07 2013 -0700 +++ b/srogue/io.c Sat Aug 10 17:43:58 2013 -0700 @@ -20,6 +20,8 @@ #include "rogue.h" #include "rogue.ext" +int md_readchar(WINDOW *win); + /* * msg: * Display a message at the top of the screen. @@ -132,7 +134,7 @@ char c; fflush(stdout); - return( wgetch(cw) ); + return( md_readchar(cw) ); } char *hungstr[] = {
--- a/srogue/main.c Fri Aug 09 09:34:07 2013 -0700 +++ b/srogue/main.c Sat Aug 10 17:43:58 2013 -0700 @@ -235,6 +235,7 @@ cw = newwin(0, 0, 0, 0); mw = newwin(0, 0, 0, 0); hw = newwin(0, 0, 0, 0); + keypad(cw, 1); waswizard = wizard; /* Draw current level */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/srogue/mdport.c Sat Aug 10 17:43:58 2013 -0700 @@ -0,0 +1,648 @@ +/* + mdport.c - Machine Dependent Code + + Copyright (C) 2005-2008 Nicholas J. Kisseberth + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name(s) of the author(s) nor the names of other contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. +*/ + +/* This is a temporary stub version of rogue5's mdport.c. It is only to make + * md_readchar() available until srogue is ported to autoconf. Then the + * whole file should work. + */ + +#include <stdlib.h> +#include <string.h> + +#if defined(_WIN32) +#include <Windows.h> +#include <Lmcons.h> +#include <io.h> +#include <conio.h> +#pragma warning( disable: 4201 )
