From 5cb6d6a6b0531aada9712c5e37c59cd930c527c4 Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Fri, 5 Apr 2013 11:12:57 +0200 Subject: [PATCH] Add f)lirt command. All it does right now is shoot a tilde. --- Makefile | 290 +++++++++++++++++++++++++++--------------------------- command.c | 25 +---- init.c | 2 +- romance.c | 33 +++++++ 4 files changed, 184 insertions(+), 166 deletions(-) create mode 100644 romance.c diff --git a/Makefile b/Makefile index d34d01a..27bca98 100644 --- a/Makefile +++ b/Makefile @@ -1,145 +1,145 @@ -# -# Makefile for rogue -# %W% (Berkeley) %G% -# -# Rogue: Exploring the Dungeons of Doom -# Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman -# All rights reserved. -# -# See the file LICENSE.TXT for full copyright and licensing information. -# - -DISTNAME=rogue3.6.3 -PROGRAM=rogue36 - -O=o - -HDRS= rogue.h machdep.h - -OBJS1 = vers.$(O) armor.$(O) chase.$(O) command.$(O) daemon.$(O) daemons.$(O) \ - fight.$(O) init.$(O) io.$(O) list.$(O) main.$(O) mdport.$(O) \ - misc.$(O) monsters.$(O) move.$(O) newlevel.$(O) options.$(O) -OBJS2 = pack.$(O) passages.$(O) potions.$(O) rings.$(O) rip.$(O) rooms.$(O) \ - save.$(O) scrolls.$(O) state.$(O) sticks.$(O) things.$(O) \ - weapons.$(O) wizard.$(O) xcrypt.$(O) -OBJS = $(OBJS1) $(OBJS2) - -CFILES= vers.c armor.c chase.c command.c daemon.c daemons.c fight.c \ - init.c io.c list.c main.c mdport.c misc.c monsters.c move.c newlevel.c \ - options.c pack.c passages.c potions.c rings.c rip.c rooms.c \ - save.c scrolls.c state.c sticks.c things.c weapons.c wizard.c xcrypt.c - - -MISC_C= -DOCSRC= rogue.6 rogue.r -DOCS = $(PROGRAM).doc $(PROGRAM).cat $(PROGRAM).html readme36.html -MISC = Makefile $(MISC_C) LICENSE.TXT $(PROGRAM).sln $(PROGRAM).vcproj $(DOCS)\ - $(DOCSRC) - -CC = gcc -ROPTS = -COPTS = -g -CFLAGS= $(COPTS) $(ROPTS) -LIBS = -lcurses -RM = rm -f -LD = $(CC) -LDOUT = -o - -.SUFFIXES: .obj - -.c.obj: - $(CC) $(CFLAGS) /c $*.c - -$(PROGRAM)$(EXE): $(HDRS) $(OBJS) - $(LD) $(LDFLAGS) $(OBJS) $(LIBS) $(LDOUT)$@ - -clean: - $(RM) $(OBJS1) - $(RM) $(OBJS2) - $(RM) core $(PROGRAM) $(PROGRAM).exe $(DISTNAME).tar $(DISTNAME).tar.gz - $(RM) $(DISTNAME).zip - -dist.src: - make clean - tar cf $(DISTNAME)-src.tar $(CFILES) $(HDRS) $(MISC) $(DOCS) - gzip -f $(DISTNAME)-src.tar - -dist.irix: - @$(MAKE) clean - @$(MAKE) CC=cc CFLAGS="-woff 1116 -O3" $(PROGRAM) -# tbl rogue.r | nroff -ms | colcrt - > $(PROGRAM).doc -# nroff -man rogue.6 | colcrt - > $(PROGRAM).cat - tar cf $(DISTNAME)-irix.tar $(PROGRAM) LICENSE.TXT $(DOCS) - gzip -f $(DISTNAME)-irix.tar - -dist.aix: - @$(MAKE) clean - @$(MAKE) CC=xlc CFLAGS="-qmaxmem=16768 -O3 -qstrict" $(PROGRAM) -# tbl rogue.r | nroff -ms | colcrt - > $(ROGUE).doc -# nroff -man rogue.6 | colcrt - > $(ROGUE).cat - tar cf $(DISTNAME)-aix.tar $(PROGRAM) LICENSE.TXT $(DOCS) - gzip -f $(DISTNAME)-aix.tar - -dist.linux: - @$(MAKE) clean - @$(MAKE) $(PROGRAM) -# groff -P-c -t -ms -Tascii rogue.r | sed -e 's/.\x08//g' > $(PROGRAM).doc -# groff -man rogue.6 | sed -e 's/.\x08//g' > $(PROGRAM).cat - tar cf $(DISTNAME)-linux.tar $(PROGRAM) LICENSE.TXT $(DOCS) - gzip -f $(DISTNAME)-linux.tar - -dist.interix: - @$(MAKE) clean - @$(MAKE) COPTS="-ansi" $(PROGRAM) -# groff -P-b -P-u -t -ms -Tascii rogue.r > $(PROGRAM).doc -# groff -P-b -P-u -man -Tascii rogue.6 > $(PROGRAM).cat - tar cf $(DISTNAME)-interix.tar $(PROGRAM) LICENSE.TXT $(DOCS) - gzip -f $(DISTNAME)-interix.tar - -dist.cygwin: - @$(MAKE) --no-print-directory clean - @$(MAKE) COPTS="-I/usr/include/ncurses" --no-print-directory $(PROGRAM) -# groff -P-c -t -ms -Tascii rogue.r | sed -e 's/.\x08//g' > $(PROGRAM).doc -# groff -P-c -man -Tascii rogue.6 | sed -e 's/.\x08//g' > $(PROGRAM).cat - tar cf $(DISTNAME)-cygwin.tar $(PROGRAM).exe LICENSE.TXT $(DOCS) - gzip -f $(DISTNAME)-cygwin.tar - -# -# Use MINGW32-MAKE to build this target -# -dist.mingw32: - @$(MAKE) --no-print-directory RM="cmd /c del" clean - @$(MAKE) --no-print-directory COPTS="-I../pdcurses" LIBS="../pdcurses/pdcurses.a" $(PROGRAM) - cmd /c del $(DISTNAME)-mingw32.zip - zip $(DISTNAME)-mingw32.zip $(PROGRAM).exe LICENSE.TXT $(DOCS) - -# -# Seperate doc targets for DJGPP prevent strange SIGSEGV in groff -# in that environment. -# -doc.djgpp: - groff -t -ms -Tascii rogue.r | sed -e 's/.\x08//g' > $(PROGRAM).doc - -cat.djgpp: - groff -man -Tascii rogue.6 | sed -e 's/.\x08//g' > $(PROGRAM).cat - -dist.djgpp: - @$(MAKE) --no-print-directory clean - @$(MAKE) --no-print-directory LDFLAGS="-L$(DJDIR)/LIB" \ - LIBS="-lpdcur" $(PROGRAM) -# @$(MAKE) --no-print-directory doc.djgpp -# @$(MAKE) --no-print-directory cat.djgpp - rm -f $(DISTNAME)-djgpp.zip - zip $(DISTNAME)-djgpp.zip $(PROGRAM) LICENSE.TXT $(DOCS) - -# -# Use NMAKE to build this target -# -dist.win32: - @$(MAKE) /NOLOGO O="obj" RM="-del" clean - @$(MAKE) /NOLOGO O="obj" CC="@CL" LD="link" LDOUT="/OUT:" EXE=".exe"\ - LIBS="/NODEFAULTLIB:LIBC ..\pdcurses\pdcurses.lib shell32.lib user32.lib Advapi32.lib" \ - COPTS="-nologo -D_CRT_SECURE_NO_DEPRECATE -I..\pdcurses \ - -Ox -wd4033 -wd4716" $(PROGRAM).exe - -del $(DISTNAME)-win32.zip - zip $(DISTNAME)-win32.zip $(PROGRAM).exe LICENSE.TXT $(DOCS) +# +# Makefile for rogue +# %W% (Berkeley) %G% +# +# Rogue: Exploring the Dungeons of Doom +# Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman +# All rights reserved. +# +# See the file LICENSE.TXT for full copyright and licensing information. +# + +DISTNAME=rogue3.6.3 +PROGRAM=rogue36 + +O=o + +HDRS= rogue.h machdep.h + +OBJS1 = vers.$(O) armor.$(O) chase.$(O) command.$(O) daemon.$(O) daemons.$(O) \ + fight.$(O) init.$(O) io.$(O) list.$(O) main.$(O) mdport.$(O) \ + misc.$(O) monsters.$(O) move.$(O) newlevel.$(O) options.$(O) +OBJS2 = pack.$(O) passages.$(O) potions.$(O) rings.$(O) rip.$(O) romance.$(O) \ + rooms.$(O) save.$(O) scrolls.$(O) state.$(O) sticks.$(O) things.$(O) \ + weapons.$(O) wizard.$(O) xcrypt.$(O) +OBJS = $(OBJS1) $(OBJS2) + +CFILES= vers.c armor.c chase.c command.c daemon.c daemons.c fight.c \ + init.c io.c list.c main.c mdport.c misc.c monsters.c move.c newlevel.c \ + options.c pack.c passages.c potions.c rings.c rip.c rooms.c \ + save.c scrolls.c state.c sticks.c things.c weapons.c wizard.c xcrypt.c + + +MISC_C= +DOCSRC= rogue.6 rogue.r +DOCS = $(PROGRAM).doc $(PROGRAM).cat $(PROGRAM).html readme36.html +MISC = Makefile $(MISC_C) LICENSE.TXT $(PROGRAM).sln $(PROGRAM).vcproj $(DOCS)\ + $(DOCSRC) + +CC = gcc +ROPTS = +COPTS = -g +CFLAGS= $(COPTS) $(ROPTS) +LIBS = -lcurses +RM = rm -f +LD = $(CC) +LDOUT = -o + +.SUFFIXES: .obj + +.c.obj: + $(CC) $(CFLAGS) /c $*.c + +$(PROGRAM)$(EXE): $(HDRS) $(OBJS) + $(LD) $(LDFLAGS) $(OBJS) $(LIBS) $(LDOUT)$@ + +clean: + $(RM) $(OBJS1) + $(RM) $(OBJS2) + $(RM) core $(PROGRAM) $(PROGRAM).exe $(DISTNAME).tar $(DISTNAME).tar.gz + $(RM) $(DISTNAME).zip + +dist.src: + make clean + tar cf $(DISTNAME)-src.tar $(CFILES) $(HDRS) $(MISC) $(DOCS) + gzip -f $(DISTNAME)-src.tar + +dist.irix: + @$(MAKE) clean + @$(MAKE) CC=cc CFLAGS="-woff 1116 -O3" $(PROGRAM) +# tbl rogue.r | nroff -ms | colcrt - > $(PROGRAM).doc +# nroff -man rogue.6 | colcrt - > $(PROGRAM).cat + tar cf $(DISTNAME)-irix.tar $(PROGRAM) LICENSE.TXT $(DOCS) + gzip -f $(DISTNAME)-irix.tar + +dist.aix: + @$(MAKE) clean + @$(MAKE) CC=xlc CFLAGS="-qmaxmem=16768 -O3 -qstrict" $(PROGRAM) +# tbl rogue.r | nroff -ms | colcrt - > $(ROGUE).doc +# nroff -man rogue.6 | colcrt - > $(ROGUE).cat + tar cf $(DISTNAME)-aix.tar $(PROGRAM) LICENSE.TXT $(DOCS) + gzip -f $(DISTNAME)-aix.tar + +dist.linux: + @$(MAKE) clean + @$(MAKE) $(PROGRAM) +# groff -P-c -t -ms -Tascii rogue.r | sed -e 's/.\x08//g' > $(PROGRAM).doc +# groff -man rogue.6 | sed -e 's/.\x08//g' > $(PROGRAM).cat + tar cf $(DISTNAME)-linux.tar $(PROGRAM) LICENSE.TXT $(DOCS) + gzip -f $(DISTNAME)-linux.tar + +dist.interix: + @$(MAKE) clean + @$(MAKE) COPTS="-ansi" $(PROGRAM) +# groff -P-b -P-u -t -ms -Tascii rogue.r > $(PROGRAM).doc +# groff -P-b -P-u -man -Tascii rogue.6 > $(PROGRAM).cat + tar cf $(DISTNAME)-interix.tar $(PROGRAM) LICENSE.TXT $(DOCS) + gzip -f $(DISTNAME)-interix.tar + +dist.cygwin: + @$(MAKE) --no-print-directory clean + @$(MAKE) COPTS="-I/usr/include/ncurses" --no-print-directory $(PROGRAM) +# groff -P-c -t -ms -Tascii rogue.r | sed -e 's/.\x08//g' > $(PROGRAM).doc +# groff -P-c -man -Tascii rogue.6 | sed -e 's/.\x08//g' > $(PROGRAM).cat + tar cf $(DISTNAME)-cygwin.tar $(PROGRAM).exe LICENSE.TXT $(DOCS) + gzip -f $(DISTNAME)-cygwin.tar + +# +# Use MINGW32-MAKE to build this target +# +dist.mingw32: + @$(MAKE) --no-print-directory RM="cmd /c del" clean + @$(MAKE) --no-print-directory COPTS="-I../pdcurses" LIBS="../pdcurses/pdcurses.a" $(PROGRAM) + cmd /c del $(DISTNAME)-mingw32.zip + zip $(DISTNAME)-mingw32.zip $(PROGRAM).exe LICENSE.TXT $(DOCS) + +# +# Seperate doc targets for DJGPP prevent strange SIGSEGV in groff +# in that environment. +# +doc.djgpp: + groff -t -ms -Tascii rogue.r | sed -e 's/.\x08//g' > $(PROGRAM).doc + +cat.djgpp: + groff -man -Tascii rogue.6 | sed -e 's/.\x08//g' > $(PROGRAM).cat + +dist.djgpp: + @$(MAKE) --no-print-directory clean + @$(MAKE) --no-print-directory LDFLAGS="-L$(DJDIR)/LIB" \ + LIBS="-lpdcur" $(PROGRAM) +# @$(MAKE) --no-print-directory doc.djgpp +# @$(MAKE) --no-print-directory cat.djgpp + rm -f $(DISTNAME)-djgpp.zip + zip $(DISTNAME)-djgpp.zip $(PROGRAM) LICENSE.TXT $(DOCS) + +# +# Use NMAKE to build this target +# +dist.win32: + @$(MAKE) /NOLOGO O="obj" RM="-del" clean + @$(MAKE) /NOLOGO O="obj" CC="@CL" LD="link" LDOUT="/OUT:" EXE=".exe"\ + LIBS="/NODEFAULTLIB:LIBC ..\pdcurses\pdcurses.lib shell32.lib user32.lib Advapi32.lib" \ + COPTS="-nologo -D_CRT_SECURE_NO_DEPRECATE -I..\pdcurses \ + -Ox -wd4033 -wd4716" $(PROGRAM).exe + -del $(DISTNAME)-win32.zip + zip $(DISTNAME)-win32.zip $(PROGRAM).exe LICENSE.TXT $(DOCS) diff --git a/command.c b/command.c index 6b8033b..c85020a 100644 --- a/command.c +++ b/command.c @@ -101,26 +101,6 @@ command() count = 0; } } - switch (ch) - { - case 'f': - if (!on(player, ISBLIND)) - { - door_stop = TRUE; - firstmove = TRUE; - } - if (count && !newcount) - ch = direction; - else - ch = readchar(cw); - switch (ch) - { - case 'h': case 'j': case 'k': case 'l': - case 'y': case 'u': case 'b': case 'n': - ch = toupper(ch); - } - direction = ch; - } newcount = FALSE; /* * execute a command @@ -165,6 +145,11 @@ command() when 'R' : ring_off(); when 'o' : option(); when 'c' : call(); + when 'f': + if (!get_dir()) + after = FALSE; + else + flirt(delta.y, delta.x); when '>' : after = FALSE; d_level(); when '<' : after = FALSE; u_level(); when '?' : after = FALSE; help(); diff --git a/init.c b/init.c index 031ff3e..c75f5e7 100644 --- a/init.c +++ b/init.c @@ -559,7 +559,7 @@ struct h_list helpstr[] = { 'B', " run down & left", 'N', " run down & right", 't', " throw something", - 'f', " forward until find something", + 'f', " flirt with someone", 'p', " zap a wand in a direction", 'z', " zap a wand or staff", '>', " go down a staircase", diff --git a/romance.c b/romance.c new file mode 100644 index 0000000..70a06a1 --- /dev/null +++ b/romance.c @@ -0,0 +1,33 @@ +/* + * Functions for dealing with problems of the heart + * + * @(#)romance.c 3.2 (Berkeley) 6/15/81 + * + * Rogue: Exploring the Dungeons of Doom + * Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman + * All rights reserved. + * + * See the file LICENSE.TXT for full copyright and licensing information. + */ + +#include "curses.h" +#include +#include +#include "rogue.h" + +/* + * flirt: + * Make eyes in the given direction + */ + +flirt(ydelta, xdelta) +int ydelta, xdelta; +{ + register struct linked_list *item, *nitem; + struct object obj; + + obj.o_pos = hero; + obj.o_type = '~'; + do_motion(&obj, ydelta, xdelta); + mvwaddch(cw, hero.y, hero.x, PLAYER); +} -- 2.30.2