move unmaintained files into outdated folder

If an old port is resurrected to work with current version code, its files
can be relocated to the appropriate sys or win folder as required.

In the meantime, the burden of upkeep can be avoided for the stuff in the
outdated folder for now.
This commit is contained in:
nhmall
2020-05-10 11:24:51 -04:00
parent 6fcb3fc0c7
commit c6d09a58d6
193 changed files with 0 additions and 0 deletions

4
outdated/sys/wince/.gitattributes vendored Normal file
View File

@@ -0,0 +1,4 @@
*.ce NHSUBST
*.mak NHSUBST
*.bat NHSUBST
* NH_filestag=(file%s_for_Windows_CE_and_PocketPC_-_untested_for_3.7)

View File

@@ -0,0 +1,136 @@
Copyright (c) Alex Kompel, 2002
NetHack may be freely redistributed. See license for details.
========================================================================
Instructions for compiling and installing
NetHack 3.6 on a Windows CE or PocketPC system
========================================================================
Last revision: $NHDT-Date: 1432512799 2015/05/25 00:13:19 $
Credit for the porting of NetHack to Windows CE goes to Alex Kompel who
initially developed and contributed the port.
In order to build NetHack for Windows CE, you need *both* of the following:
o A copy of Microsoft Visual C V6.0 SP3 or later. Things may work with
an earlier version of the compiler, but the current code has not been
tested with an earlier version.
o Embedded Visual C++ 3.0 or later
FIRST STEP:
The first step in building NetHack for Windows CE is to execute
sys/wince/cesetup.bat.
From the command prompt:
cd sys\wince
cesetup
From a Windows explorer window:
double-click on cesetup.bat
A "wince" directory will be created off the top of the NetHack source
tree, and a Microsoft embedded C workspace file will be placed in the
top of the NetHack source tree.
------------
| BUILDING |
------------
Boostrapping the build process on Windows NT/2000/XP
1. With the Visual C++ 6.0 tools in your path,
Run "nmake /f bootstrp.mak" from the wince folder.
Compiling
2. Start the Embedded Visual C IDE. In the Embedded Visual C IDE
Menus, choose:
File | Open Workspace
3. Set up for the build.
o In the Visual C "Open Workspace" dialog box, navigate to the top
of your NetHack source directory tree.
In there, highlight "wince.vcw" and click on Open.
Once the workspace has been opened, you should see the following
list in the Visual C selection window:
+ nethack_hpc files
+ nethack_palm_pc files
+ nethack_pocket_pc files
+ nethack_smartphone files
o On the Embedded Visual C menus, choose:
Build | Set Active Platform
Select the platform that corresponds to your device:
Palm-size PC 2.11 - palm size PC running Windows CE version 2.11
Pocket PC - palm-size PC running Windows CE 3.0 and higher (PocketPC)
H/PC Pro 2.11 - handheld computers running Windows CE 2.11 anf higher
Smartphone 2002 - Microsoft SmartPhone device
o On the Visual C menus again, choose either:
Build | Set Active Configuration
where configuration is one of the following (make sure it matches the platform
you have selected):
nethack_hpc - Win32 (WCE MIPS) HPCRelease - H/PC Pro 2.11 MIPS processor release executable
nethack_hpc - Win32 (WCE x86em) HPCDebug - H/PC Pro 2.11 x86 emulation debug executable
nethack_hpc - Win32 (WCE ARM) HPCRelease - H/PC Pro 2.11 ARM processor release executable
nethack_hpc - Win32 (WCE SH3) HPCRelease - H/PC Pro 2.11 SH3 processor release executable
nethack_hpc - Win32 (WCE x86em) HPCRelease - H/PC Pro 2.11 x86 emulation release executable
nethack_hpc - Win32 (WCE SH4) HPCRelease - H/PC Pro 2.11 SH4 processor release executable
nethack_palm_pc - Win32 (WCE MIPS) PalmPCRelease - Palm-size PC 2.11 MIPS processor release executable
nethack_palm_pc - Win32 (WCE x86em) PalmPCDebug - Palm-size PC 2.11 x86 emulation debug executable
nethack_palm_pc - Win32 (WCE SH3) PalmPCRelease - Palm-size PC 2.11 SH3 processor release executable
nethack_palm_pc - Win32 (WCE x86em) PalmPCRelease - Palm-size PC 2.11 x86 emulation release executable
nethack_pocket_pc - Win32 (WCE MIPS) PocketPCRelease - Pocket PC MIPS processor release executable
nethack_pocket_pc - Win32 (WCE ARM) PocketPCRelease - Pocket PC ARM processor release executable
nethack_pocket_pc - Win32 (WCE x86em) PocketPCRelease - Pocket PC x86 emulation release executable
nethack_pocket_pc - Win32 (WCE x86em) PocketPCDebug - Pocket PC x86 emulation debug executable
nethack_pocket_pc - Win32 (WCE SH3) PocketPCRelease - Pocket PC SH3 processor release executable
nethack_smartphone - Win32 (WCE ARM) SPhoneRelease - Smartphone 2002 ARM processor release executable
nethack_smartphone - Win32 (WCE x86em) SPhoneDebug - Smartphone 2002 x86 emulation debug executable
Building
4. Start your build.
o On the Embedded Visual C menus once again, choose:
Build | Build nethackm.exe
This starts the build. It is likely that the IDE message window
where you are doing the compiling will be occupied for a while.
Notes:
o You may get a bunch of warnings regarding missing include files in the
beginning of the build process - ignore them. For some reason the tool
that produces these messages ignores preprocessor directives. The actual
build will go just fine.
o Sometimes the compiler chokes on do_wear.c Ignore that - let the build
finish. Then run it again - it will compile just fine. (Seems to be some
sort of bug in EVC++)
Transfer
5. Transfer the files and executables to your handheld by extracting the
files into some folder on the CE device - that should do it.
Notes
If you want to use IBMGraphics make sure that you have a proper
font installed on the device that supports OEM character set
(for example, Lucida Console)
PROBLEMS
If you discover a bug and wish to report it, or if you have comments
or suggestions we recommend using our "Contact Us" web page at:
http://www.nethack.org/common/contact.html
If you don't have access to the web, or you want to send us a patch
to the NetHack source code feel free to drop us a line c/o:
DevTeam (at) nethack.org
Happy NetHacking!

View File

@@ -0,0 +1,876 @@
# NetHack 3.6 bootstrp.mak $NHDT-Date: 1432512801 2015/05/25 00:13:21 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $
# Copyright (c) Michael Allison
#
# NetHack Windows CE bootstrap file for MS Visual C++ V6.x and
# above and MS NMAKE
#
# This will:
# - build makedefs
# -
#==============================================================================
# Do not delete the following 3 lines.
#
TARGETOS=BOTH
APPVER=4.0
!include <win32.mak>
#
# Source directories. Makedefs hardcodes these, don't change them.
#
INCL = ..\include # NetHack include files
DAT = ..\dat # NetHack data files
DOC = ..\doc # NetHack documentation files
UTIL = ..\util # Utility source
SRC = ..\src # Main source
SSYS = ..\sys\share # Shared system files
NTSYS = ..\sys\winnt # NT Win32 specific files
TTY = ..\win\tty # window port files (tty)
WIN32 = ..\win\win32 # window port files (WINCE)
WSHR = ..\win\share # Tile support files
SWINCE= ..\wince # wince files
WINCE = ..\wince # wince build area
OBJ = $(WINCE)\ceobj
DLB = $(DAT)\nhdat
#==========================================
# Setting up the compiler and linker
# macros. All builds include the base ones.
#==========================================
CFLAGSBASE = -c $(cflags) $(cvarsmt) -I$(INCL) -nologo $(cdebug) $(WINPINC) -DDLB
LFLAGSBASEC = $(linkdebug) /NODEFAULTLIB /INCREMENTAL:NO /RELEASE /NOLOGO -subsystem:console,4.0 $(conlibsmt)
LFLAGSBASEG = $(linkdebug) $(guiflags) $(guilibsmt) comctl32.lib
#==========================================
# Util builds
#==========================================
CFLAGSU = $(CFLAGSBASE) $(WINPFLAG)
LFLAGSU = $(LFLAGSBASEC)
LEVCFLAGS= -c -nologo -DWINVER=0x0400 -DWIN32 -D_WIN32 \
-D_MT -MT -I..\include -nologo -Z7 -Od -DDLB
#==========================================
#================ RULES ==================
#==========================================
.SUFFIXES: .exe .o .til .uu .c .y .l
#==========================================
# Rules for files in src
#==========================================
#.c{$(OBJ)}.o:
# $(cc) $(CFLAGSU) -Fo$@ $<
{$(SRC)}.c{$(OBJ)}.o:
$(CC) $(CFLAGSU) -Fo$@ $<
#==========================================
# Rules for files in sys\share
#==========================================
{$(SSYS)}.c{$(OBJ)}.o:
$(CC) $(CFLAGSU) -Fo$@ $<
#==========================================
# Rules for files in sys\winnt
#==========================================
{$(NTSYS)}.c{$(OBJ)}.o:
$(CC) $(CFLAGSU) -Fo$@ $<
{$(NTSYS)}.h{$(INCL)}.h:
copy $< $@
#==========================================
# Rules for files in util
#==========================================
{$(UTIL)}.c{$(OBJ)}.o:
$(CC) $(CFLAGSU) -Fo$@ $<
#==========================================
# Rules for files in win\share
#==========================================
{$(WSHR)}.c{$(OBJ)}.o:
$(CC) $(CFLAGSU) -Fo$@ $<
{$(WSHR)}.h{$(INCL)}.h:
copy $< $@
#{$(WSHR)}.txt{$(DAT)}.txt:
# copy $< $@
#==========================================
# Rules for files in win\tty
#==========================================
{$(TTY)}.c{$(OBJ)}.o:
$(CC) $(CFLAGSU) -Fo$@ $<
#==========================================
# Rules for files in win\win32
#==========================================
{$(WIN32)}.c{$(OBJ)}.o:
$(cc) $(CFLAGSU) -Fo$@ $<
#==========================================
# Rules for files in sys\wince
#==========================================
{$(SWINCE)}.c{$(OBJ)}.o:
$(cc) $(CFLAGSU) -Fo$@ $<
#==========================================
#================ MACROS ==================
#==========================================
#
# Shorten up the location for some files
#
O = $(OBJ)^\
U = $(UTIL)^\
#
# Utility Objects.
#
MAKESRC = $(U)makedefs.c
SPLEVSRC = $(U)lev_yacc.c $(U)lev_$(LEX).c $(U)lev_main.c $(U)panic.c
DGNCOMPSRC = $(U)dgn_yacc.c $(U)dgn_$(LEX).c $(U)dgn_main.c
MAKEOBJS = $(O)makedefs.o $(O)monst.o $(O)objects.o
SPLEVOBJS = $(O)lev_yacc.o $(O)lev_$(LEX).o $(O)lev_main.o \
$(O)alloc.o $(O)decl.o $(O)drawing.o \
$(O)monst.o $(O)objects.o $(O)panic.o
DGNCOMPOBJS = $(O)dgn_yacc.o $(O)dgn_$(LEX).o $(O)dgn_main.o \
$(O)alloc.o $(O)panic.o
TILEFILES = $(WSHR)\monsters.txt $(WSHR)\objects.txt $(WSHR)\other.txt
#
# These are not invoked during a normal game build in 3.5.0
#
TEXT_IO = $(O)tiletext.o $(O)tiletxt.o $(O)drawing.o \
$(O)decl.o $(O)monst.o $(O)objects.o
TEXT_IO32 = $(O)tilete32.o $(O)tiletx32.o $(O)drawing.o \
$(O)decl.o $(O)monst.o $(O)objects.o
GIFREADERS = $(O)gifread.o $(O)alloc.o $(O)panic.o
GIFREADERS32 = $(O)gifrd32.o $(O)alloc.o $(O)panic.o
PPMWRITERS = $(O)ppmwrite.o $(O)alloc.o $(O)panic.o
DLBOBJ = $(O)dlb.o
#==========================================
# Header file macros
#==========================================
CONFIG_H = $(INCL)\config.h $(INCL)\config1.h $(INCL)\tradstdc.h \
$(INCL)\global.h $(INCL)\coord.h $(INCL)\vmsconf.h \
$(INCL)\system.h $(INCL)\unixconf.h $(INCL)\os2conf.h \
$(INCL)\micro.h $(INCL)\pcconf.h $(INCL)\tosconf.h \
$(INCL)\amiconf.h $(INCL)\macconf.h $(INCL)\beconf.h \
$(INCL)\ntconf.h $(INCL)\wceconf.h
HACK_H = $(INCL)\hack.h $(CONFIG_H) $(INCL)\align.h \
$(INCL)\dungeon.h $(INCL)\monsym.h $(INCL)\mkroom.h \
$(INCL)\objclass.h $(INCL)\youprop.h $(INCL)\prop.h \
$(INCL)\permonst.h $(INCL)\mextra.h $(INCL)\monattk.h \
$(INCL)\monflag.h $(INCL)\mondata.h $(INCL)\pm.h \
$(INCL)\wintype.h $(INCL)\decl.h $(INCL)\quest.h \
$(INCL)\spell.h $(INCL)\color.h $(INCL)\obj.h \
$(INCL)\you.h $(INCL)\attrib.h $(INCL)\monst.h \
$(INCL)\skills.h $(INCL)\onames.h $(INCL)\timeout.h \
$(INCL)\trap.h $(INCL)\flag.h $(INCL)\rm.h \
$(INCL)\vision.h $(INCL)\display.h $(INCL)\engrave.h \
$(INCL)\rect.h $(INCL)\region.h $(INCL)\winprocs.h \
$(INCL)\wintty.h $(INCL)\trampoli.h
DGN_FILE_H = $(INCL)\dgn_file.h
LEV_COMP_H = $(INCL)\lev_comp.h
SP_LEV_H = $(INCL)\sp_lev.h
TILE_H = ..\win\share\tile.h
#==========================================
# Miscellaneous
#==========================================
DATABASE = $(DAT)\data.base
#==========================================
#=============== TARGETS ==================
#==========================================
#
# The default make target (so just typing 'nmake' is useful).
#
default : all
#
# Everything
#
all : $(INCL)\date.h $(INCL)\onames.h $(INCL)\pm.h \
$(SRC)\monstr.c $(SRC)\vis_tab.c $(U)lev_comp.exe $(INCL)\vis_tab.h \
$(U)dgn_comp.exe $(U)uudecode.exe \
$(DAT)\data $(DAT)\rumors $(DAT)\dungeon \
$(DAT)\oracles $(DAT)\quest.dat $(O)sp_lev.tag $(DLB) $(SRC)\tile.c \
$(SWINCE)\nethack.ico $(SWINCE)\tiles.bmp $(SWINCE)\mnsel.bmp \
$(SWINCE)\mnunsel.bmp $(SWINCE)\petmark.bmp $(SWINCE)\mnselcnt.bmp \
$(SWINCE)\keypad.bmp $(SWINCE)\menubar.bmp
@echo Done!
$(O)sp_lev.tag: $(DAT)\bigroom.des $(DAT)\castle.des \
$(DAT)\endgame.des $(DAT)\gehennom.des $(DAT)\knox.des \
$(DAT)\medusa.des $(DAT)\oracle.des $(DAT)\tower.des \
$(DAT)\yendor.des $(DAT)\arch.des $(DAT)\barb.des \
$(DAT)\caveman.des $(DAT)\healer.des $(DAT)\knight.des \
$(DAT)\monk.des $(DAT)\priest.des $(DAT)\ranger.des \
$(DAT)\rogue.des $(DAT)\samurai.des $(DAT)\sokoban.des \
$(DAT)\tourist.des $(DAT)\valkyrie.des $(DAT)\wizard.des
cd $(DAT)
$(U)lev_comp bigroom.des
$(U)lev_comp castle.des
$(U)lev_comp endgame.des
$(U)lev_comp gehennom.des
$(U)lev_comp knox.des
$(U)lev_comp mines.des
$(U)lev_comp medusa.des
$(U)lev_comp oracle.des
$(U)lev_comp sokoban.des
$(U)lev_comp tower.des
$(U)lev_comp yendor.des
$(U)lev_comp arch.des
$(U)lev_comp barb.des
$(U)lev_comp caveman.des
$(U)lev_comp healer.des
$(U)lev_comp knight.des
$(U)lev_comp monk.des
$(U)lev_comp priest.des
$(U)lev_comp ranger.des
$(U)lev_comp rogue.des
$(U)lev_comp samurai.des
$(U)lev_comp tourist.des
$(U)lev_comp valkyrie.des
$(U)lev_comp wizard.des
cd $(WINCE)
echo sp_levs done > $(O)sp_lev.tag
#$(NHRES): $(TILEBMP16) $(WINCE)\winhack.rc $(WINCE)\mnsel.bmp \
# $(WINCE)\mnselcnt.bmp $(WINCE)\mnunsel.bmp \
# $(WINCE)\petmark.bmp $(WINCE)\NetHack.ico $(WINCE)\rip.bmp \
# $(WINCE)\splash.bmp
# $(rc) -r -fo$@ -i$(WINCE) -dNDEBUG $(WINCE)\winhack.rc
#
# Utility Targets.
#
#==========================================
# Makedefs Stuff
#==========================================
$(U)makedefs.exe: $(MAKEOBJS)
$(link) $(LFLAGSU) -out:$@ $(MAKEOBJS)
$(O)makedefs.o: $(CONFIG_H) $(INCL)\monattk.h $(INCL)\monflag.h $(INCL)\objclass.h \
$(INCL)\monsym.h $(INCL)\patchlevel.h \
$(U)makedefs.c
if not exist $(OBJ)\*.* echo creating directory $(OBJ)
if not exist $(OBJ)\*.* mkdir $(OBJ)
$(CC) $(CFLAGSU) -Fo$@ $(U)makedefs.c
#
# date.h should be remade every time any of the source or include
# files is modified.
#
$(INCL)\date.h $(OPTIONS_FILE) : $(U)makedefs.exe
$(U)makedefs -v
$(INCL)\onames.h : $(U)makedefs.exe
$(U)makedefs -o
$(INCL)\pm.h : $(U)makedefs.exe
$(U)makedefs -p
#$(INCL)\trap.h : $(U)makedefs.exe
# $(U)makedefs -t
$(SRC)\monstr.c: $(U)makedefs.exe
$(U)makedefs -m
$(INCL)\vis_tab.h: $(U)makedefs.exe
$(U)makedefs -z
$(SRC)\vis_tab.c: $(U)makedefs.exe
$(U)makedefs -z
#==========================================
# uudecode utility and uuencoded targets
#==========================================
$(U)uudecode.exe: $(O)uudecode.o
$(link) $(LFLAGSU) -out:$@ $(O)uudecode.o
$(O)uudecode.o: $(SSYS)\uudecode.c
$(SWINCE)\NetHack.ico : $(U)uudecode.exe $(SWINCE)\nhico.uu
chdir $(SWINCE)
..\util\uudecode.exe nhico.uu
chdir $(WINCE)
$(SWINCE)\mnsel.bmp: $(U)uudecode.exe $(SWINCE)\mnsel.uu
chdir $(SWINCE)
..\util\uudecode.exe mnsel.uu
chdir $(WINCE)
$(SWINCE)\mnselcnt.bmp: $(U)uudecode.exe $(SWINCE)\mnselcnt.uu
chdir $(SWINCE)
..\util\uudecode.exe mnselcnt.uu
chdir $(WINCE)
$(SWINCE)\mnunsel.bmp: $(U)uudecode.exe $(SWINCE)\mnunsel.uu
chdir $(SWINCE)
..\util\uudecode.exe mnunsel.uu
chdir $(WINCE)
$(SWINCE)\petmark.bmp: $(U)uudecode.exe $(SWINCE)\petmark.uu
chdir $(SWINCE)
..\util\uudecode.exe petmark.uu
chdir $(WINCE)
$(SWINCE)\rip.bmp: $(U)uudecode.exe $(SWINCE)\rip.uu
chdir $(SWINCE)
..\util\uudecode.exe rip.uu
chdir $(WINCE)
$(SWINCE)\splash.bmp: $(U)uudecode.exe $(SWINCE)\splash.uu
chdir $(SWINCE)
..\util\uudecode.exe splash.uu
chdir $(WINCE)
$(SWINCE)\keypad.bmp: $(U)uudecode.exe $(SWINCE)\keypad.uu
chdir $(SWINCE)
..\util\uudecode.exe keypad.uu
chdir $(WINCE)
$(SWINCE)\menubar.bmp: $(U)uudecode.exe $(SWINCE)\menubar.uu
chdir $(SWINCE)
..\util\uudecode.exe menubar.uu
chdir $(WINCE)
#==========================================
# Level Compiler Stuff
#==========================================
$(U)lev_comp.exe: $(SPLEVOBJS)
echo Linking $@...
$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
$(SPLEVOBJS:^ =^
)
<<
$(O)lev_yacc.o: $(HACK_H) $(SP_LEV_H) $(INCL)\lev_comp.h $(U)lev_yacc.c
$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)lev_yacc.c
$(O)lev_$(LEX).o: $(HACK_H) $(INCL)\lev_comp.h $(SP_LEV_H) \
$(U)lev_$(LEX).c
$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)lev_$(LEX).c
$(O)lev_main.o: $(U)lev_main.c $(HACK_H) $(SP_LEV_H)
$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)lev_main.c
$(U)lev_yacc.c $(INCL)\lev_comp.h : $(U)lev_comp.y
@echo We will copy the prebuilt lev_yacc.c and
@echo lev_comp.h from $(SSYS) into $(UTIL) and use them.
@copy $(SSYS)\lev_yacc.c $(U)lev_yacc.c >nul
@copy $(SSYS)\lev_comp.h $(INCL)\lev_comp.h >nul
@echo /**/ >>$(U)lev_yacc.c
@echo /**/ >>$(INCL)\lev_comp.h
$(U)lev_$(LEX).c: $(U)lev_comp.l
@echo We will copy the prebuilt lev_lex.c
@echo from $(SSYS) into $(UTIL) and use it.
@copy $(SSYS)\lev_lex.c $@ >nul
@echo /**/ >>$@
#==========================================
# Dungeon Compiler Stuff
#==========================================
$(U)dgn_comp.exe: $(DGNCOMPOBJS)
@echo Linking $@...
$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
$(DGNCOMPOBJS:^ =^
)
<<
$(O)dgn_yacc.o: $(HACK_H) $(DGN_FILE_H) $(INCL)\dgn_comp.h $(U)dgn_yacc.c
$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)dgn_yacc.c
$(O)dgn_$(LEX).o: $(HACK_H) $(DGN_FILE_H) $(INCL)\dgn_comp.h \
$(U)dgn_$(LEX).c
$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)dgn_$(LEX).c
$(O)dgn_main.o: $(HACK_H) $(U)dgn_main.c
$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)dgn_main.c
$(U)dgn_yacc.c $(INCL)\dgn_comp.h : $(U)dgn_comp.y
@echo We will copy the prebuilt $(U)dgn_yacc.c and
@echo dgn_comp.h from $(SSYS) into $(UTIL) and use them.
@copy $(SSYS)\dgn_yacc.c $(U)dgn_yacc.c >nul
@copy $(SSYS)\dgn_comp.h $(INCL)\dgn_comp.h >nul
@echo /**/ >>$(U)dgn_yacc.c
@echo /**/ >>$(INCL)\dgn_comp.h
$(U)dgn_$(LEX).c: $(U)dgn_comp.l
@echo We will copy the prebuilt dgn_lex.c
@echo from $(SSYS) into $(UTIL) and use it.
@copy $(SSYS)\dgn_lex.c $@ >nul
@echo /**/ >>$@
#==========================================
# Create directory for holding object files
#==========================================
$(O)obj.tag:
if not exist $(OBJ)\*.* echo creating directory $(OBJ)
if not exist $(OBJ)\*.* mkdir $(OBJ)
echo directory created >$@
#==========================================
# Notify of any CL environment variables
# in effect since they change the compiler
# options.
#==========================================
envchk:
! IF "$(CL)"!=""
@echo Warning, the CL Environment variable is defined:
@echo CL=$(CL)
! ENDIF
@echo ----
@echo NOTE: This build will include tile support.
@echo ----
#==========================================
#=========== SECONDARY TARGETS ============
#==========================================
#===========================================
# Header files NOT distributed in ..\include
#===========================================
$(INCL)\win32api.h: $(NTSYS)\win32api.h
copy $(NTSYS)\win32api.h $@
#==========================================
# DLB utility and nhdat file creation
#==========================================
$(U)dlb_main.exe: $(DLBOBJ) $(O)dlb.o
$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
$(O)dlb_main.o
$(O)dlb.o
$(O)alloc.o
$(O)panic.o
<<
$(O)dlb.o: $(O)dlb_main.o $(O)alloc.o $(O)panic.o $(INCL)\dlb.h
$(CC) $(CFLAGSU) /Fo$@ $(SRC)\dlb.c
$(O)dlb_main.o: $(UTIL)\dlb_main.c $(INCL)\config.h $(INCL)\dlb.h
$(CC) $(CFLAGSU) /Fo$@ $(UTIL)\dlb_main.c
#$(DAT)\porthelp: $(NTSYS)\porthelp
# copy $(NTSYS)\porthelp $@ >nul
$(DAT)\nhdat: $(U)dlb_main.exe $(DAT)\data $(DAT)\oracles $(OPTIONS_FILE) \
$(DAT)\quest.dat $(DAT)\rumors $(DAT)\help $(DAT)\hh $(DAT)\cmdhelp \
$(DAT)\history $(DAT)\opthelp $(DAT)\wizhelp $(DAT)\dungeon \
$(DAT)\license $(O)sp_lev.tag
cd $(DAT)
echo data >dlb.lst
echo oracles >>dlb.lst
if exist options echo options >>dlb.lst
if exist ttyoptions echo ttyoptions >>dlb.lst
if exist guioptions echo guioptions >>dlb.lst
if exist porthelp echo porthelp >>dlb.lst
echo quest.dat >>dlb.lst
echo rumors >>dlb.lst
echo help >>dlb.lst
echo hh >>dlb.lst
echo cmdhelp >>dlb.lst
echo history >>dlb.lst
echo opthelp >>dlb.lst
echo wizhelp >>dlb.lst
echo dungeon >>dlb.lst
echo license >>dlb.lst
for %%N in (*.lev) do echo %%N >>dlb.lst
$(U)dlb_main cIf dlb.lst nhdat
cd $(WINCE)
#==========================================
# Tile Mapping
#==========================================
$(SRC)\tile.c: $(U)tilemap.exe
echo A new $@ has been created
$(U)tilemap
$(U)tilemap.exe: $(O)tilemap.o
$(link) $(LFLAGSU) -out:$@ $(O)tilemap.o
$(O)tilemap.o: $(WSHR)\tilemap.c $(HACK_H)
$(CC) $(CFLAGSU) -Fo$@ $(WSHR)\tilemap.c
$(O)tiletx32.o: $(WSHR)\tilemap.c $(HACK_H)
$(CC) $(CFLAGSU) /DTILETEXT /DTILE_X=32 /DTILE_Y=32 -Fo$@ $(WSHR)\tilemap.c
$(O)tiletxt.o: $(WSHR)\tilemap.c $(HACK_H)
$(CC) $(CFLAGSU) /DTILETEXT -Fo$@ $(WSHR)\tilemap.c
$(O)gifread.o: $(WSHR)\gifread.c $(CONFIG_H) $(TILE_H)
$(CC) $(CFLAGSU) -I$(WSHR) -Fo$@ $(WSHR)\gifread.c
$(O)gifrd32.o: $(WSHR)\gifread.c $(CONFIG_H) $(TILE_H)
$(CC) $(CFLAGSU) -I$(WSHR) /DTILE_X=32 /DTILE_Y=32 -Fo$@ $(WSHR)\gifread.c
$(O)ppmwrite.o: $(WSHR)\ppmwrite.c $(CONFIG_H) $(TILE_H)
$(CC) $(CFLAGSU) -I$(WSHR) -Fo$@ $(WSHR)\ppmwrite.c
$(O)tiletext.o: $(WSHR)\tiletext.c $(CONFIG_H) $(TILE_H)
$(CC) $(CFLAGSU) -I$(WSHR) -Fo$@ $(WSHR)\tiletext.c
$(O)tilete32.o: $(WSHR)\tiletext.c $(CONFIG_H) $(TILE_H)
$(CC) $(CFLAGSU) -I$(WSHR) /DTILE_X=32 /DTILE_Y=32 -Fo$@ $(WSHR)\tiletext.c
$(SWINCE)\tiles.bmp: $(U)tile2bmp.exe $(TILEFILES)
echo Creating 16x16 binary tile files (this may take some time)
$(U)tile2bmp $@
#$(TILEBMP32): $(TILEUTIL32) $(TILEFILES32)
# echo Creating 32x32 binary tile files (this may take some time)
# $(U)til2bm32 $(TILEBMP32)
$(U)tile2bmp.exe: $(O)tile2bmp.o $(TEXT_IO)
@echo Linking $@...
$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
$(O)tile2bmp.o
$(TEXT_IO:^ =^
)
<<
$(U)til2bm32.exe: $(O)til2bm32.o $(TEXT_IO32)
@echo Linking $@...
$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
$(O)til2bm32.o
$(TEXT_IO32:^ =^
)
<<
$(O)tile2bmp.o: $(WSHR)\tile2bmp.c $(HACK_H) $(TILE_H) $(INCL)\win32api.h
$(CC) $(CFLAGSU) -I$(WSHR) /DPACKED_FILE /Fo$@ $(WSHR)\tile2bmp.c
$(O)til2bm32.o: $(WSHR)\tile2bmp.c $(HACK_H) $(TILE_H) $(INCL)\win32api.h
$(CC) $(CFLAGSU) -I$(WSHR) /DPACKED_FILE /DTILE_X=32 /DTILE_Y=32 /Fo$@ $(WSHR)\tile2bmp.c
#===================================================================
# OTHER DEPENDENCIES
#===================================================================
#
# dat dependencies
#
$(DAT)\data: $(UTIL)\makedefs.exe
$(U)makedefs -d
$(DAT)\rumors: $(UTIL)\makedefs.exe $(DAT)\rumors.tru $(DAT)\rumors.fal
$(U)makedefs -r
$(DAT)\quest.dat: $(UTIL)\makedefs.exe $(DAT)\quest.txt
$(U)makedefs -q
$(DAT)\oracles: $(UTIL)\makedefs.exe $(DAT)\oracles.txt
$(U)makedefs -h
$(DAT)\dungeon: $(UTIL)\makedefs.exe $(DAT)\dungeon.def
$(U)makedefs -e
cd $(DAT)
$(U)dgn_comp dungeon.pdf
cd $(WINCE)
#
# NT dependencies
#
#
#$(O)nttty.o: $(HACK_H) $(TILE_H) $(INCL)\win32api.h $(NTSYS)\nttty.c
# $(CC) $(CFLAGSU) -I$(WSHR) -Fo$@ $(NTSYS)\nttty.c
#$(O)winnt.o: $(HACK_H) $(INCL)\win32api.h $(NTSYS)\winnt.c
# $(CC) $(CFLAGSU) -Fo$@ $(NTSYS)\winnt.c
#$(O)ntsound.o: $(HACK_H) $(NTSYS)\ntsound.c
# $(CC) $(CFLAGSU) -Fo$@ $(NTSYS)\ntsound.c
#
# util dependencies
#
$(O)panic.o: $(U)panic.c $(CONFIG_H)
$(CC) $(CFLAGSU) -Fo$@ $(U)panic.c
#
# The rest are stolen from sys/unix/Makefile.src,
# with slashes changed to back-slashes
# and -c (which is included in CFLAGSU) substituted
# with -Fo$@ , but otherwise untouched. That
# means that there is some irrelevant stuff
# in here, but maintenance should be easier.
#
$(O)tos.o: ..\sys\atari\tos.c $(HACK_H) $(INCL)\tcap.h
$(CC) $(CFLAGSU) -Fo$@ ..\sys\atari\tos.c
$(O)pcmain.o: ..\sys\share\pcmain.c $(HACK_H) $(INCL)\dlb.h \
$(INCL)\win32api.h
$(CC) $(CFLAGSU) -Fo$@ ..\sys\share\pcmain.c
$(O)pcsys.o: ..\sys\share\pcsys.c $(HACK_H)
$(CC) $(CFLAGSU) -Fo$@ ..\sys\share\pcsys.c
$(O)pctty.o: ..\sys\share\pctty.c $(HACK_H)
$(CC) $(CFLAGSU) -Fo$@ ..\sys\share\pctty.c
$(O)pcunix.o: ..\sys\share\pcunix.c $(HACK_H)
$(CC) $(CFLAGSU) -Fo$@ ..\sys\share\pcunix.c
$(O)random.o: ..\sys\share\random.c $(HACK_H)
$(CC) $(CFLAGSU) -Fo$@ ..\sys\share\random.c
$(O)ioctl.o: ..\sys\share\ioctl.c $(HACK_H) $(INCL)\tcap.h
$(CC) $(CFLAGSU) -Fo$@ ..\sys\share\ioctl.c
$(O)unixtty.o: ..\sys\share\unixtty.c $(HACK_H)
$(CC) $(CFLAGSU) -Fo$@ ..\sys\share\unixtty.c
$(O)unixmain.o: ..\sys\unix\unixmain.c $(HACK_H) $(INCL)\dlb.h
$(CC) $(CFLAGSU) -Fo$@ ..\sys\unix\unixmain.c
$(O)unixunix.o: ..\sys\unix\unixunix.c $(HACK_H)
$(CC) $(CFLAGSU) -Fo$@ ..\sys\unix\unixunix.c
$(O)bemain.o: ..\sys\be\bemain.c $(HACK_H) $(INCL)\dlb.h
$(CC) $(CFLAGSU) -Fo$@ ..\sys\be\bemain.c
$(O)getline.o: ..\win\tty\getline.c $(HACK_H) $(INCL)\func_tab.h
$(CC) $(CFLAGSU) -Fo$@ ..\win\tty\getline.c
$(O)termcap.o: ..\win\tty\termcap.c $(HACK_H) $(INCL)\tcap.h
$(CC) $(CFLAGSU) -Fo$@ ..\win\tty\termcap.c
$(O)topl.o: ..\win\tty\topl.c $(HACK_H) $(INCL)\tcap.h
$(CC) $(CFLAGSU) -Fo$@ ..\win\tty\topl.c
$(O)wintty.o: ..\win\tty\wintty.c $(HACK_H) $(INCL)\dlb.h \
$(INCL)\date.h $(INCL)\patchlevel.h $(INCL)\tcap.h
$(CC) $(CFLAGSU) -Fo$@ ..\win\tty\wintty.c
$(O)Window.o: ..\win\X11\Window.c $(INCL)\xwindowp.h $(INCL)\xwindow.h \
$(CONFIG_H)
$(CC) $(CFLAGSU) -Fo$@ ..\win\X11\Window.c
$(O)dialogs.o: ..\win\X11\dialogs.c $(CONFIG_H)
$(CC) $(CFLAGSU) -Fo$@ ..\win\X11\dialogs.c
$(O)winX.o: ..\win\X11\winX.c $(HACK_H) $(INCL)\winX.h $(INCL)\dlb.h \
$(INCL)\patchlevel.h ..\win\X11\nh72icon \
..\win\X11\nh56icon ..\win\X11\nh32icon
$(CC) $(CFLAGSU) -Fo$@ ..\win\X11\winX.c
$(O)winmap.o: ..\win\X11\winmap.c $(INCL)\xwindow.h $(HACK_H) $(INCL)\dlb.h \
$(INCL)\winX.h $(INCL)\tile2x11.h
$(CC) $(CFLAGSU) -Fo$@ ..\win\X11\winmap.c
$(O)winmenu.o: ..\win\X11\winmenu.c $(HACK_H) $(INCL)\winX.h
$(CC) $(CFLAGSU) -Fo$@ ..\win\X11\winmenu.c
$(O)winmesg.o: ..\win\X11\winmesg.c $(INCL)\xwindow.h $(HACK_H) $(INCL)\winX.h
$(CC) $(CFLAGSU) -Fo$@ ..\win\X11\winmesg.c
$(O)winmisc.o: ..\win\X11\winmisc.c $(HACK_H) $(INCL)\func_tab.h \
$(INCL)\winX.h
$(CC) $(CFLAGSU) -Fo$@ ..\win\X11\winmisc.c
$(O)winstat.o: ..\win\X11\winstat.c $(HACK_H) $(INCL)\winX.h
$(CC) $(CFLAGSU) -Fo$@ ..\win\X11\winstat.c
$(O)wintext.o: ..\win\X11\wintext.c $(HACK_H) $(INCL)\winX.h $(INCL)\xwindow.h
$(CC) $(CFLAGSU) -Fo$@ ..\win\X11\wintext.c
$(O)winval.o: ..\win\X11\winval.c $(HACK_H) $(INCL)\winX.h
$(CC) $(CFLAGSU) -Fo$@ ..\win\X11\winval.c
$(O)tile.o: $(SRC)\tile.c $(HACK_H)
$(O)gnaskstr.o: ..\win\gnome\gnaskstr.c ..\win\gnome\gnaskstr.h \
..\win\gnome\gnmain.h
$(CC) $(CFLAGSU) $(GNOMEINC) -c ..\win\gnome\gnaskstr.c
$(O)gnbind.o: ..\win\gnome\gnbind.c ..\win\gnome\gnbind.h ..\win\gnome\gnmain.h \
..\win\gnome\gnaskstr.h ..\win\gnome\gnyesno.h
$(CC) $(CFLAGSU) $(GNOMEINC) -c ..\win\gnome\gnbind.c
$(O)gnglyph.o: ..\win\gnome\gnglyph.c ..\win\gnome\gnglyph.h
$(CC) $(CFLAGSU) $(GNOMEINC) -c ..\win\gnome\gnglyph.c
$(O)gnmain.o: ..\win\gnome\gnmain.c ..\win\gnome\gnmain.h ..\win\gnome\gnsignal.h \
..\win\gnome\gnbind.h ..\win\gnome\gnopts.h $(HACK_H) \
$(INCL)\date.h
$(CC) $(CFLAGSU) $(GNOMEINC) -c ..\win\gnome\gnmain.c
$(O)gnmap.o: ..\win\gnome\gnmap.c ..\win\gnome\gnmap.h ..\win\gnome\gnglyph.h \
..\win\gnome\gnsignal.h $(HACK_H)
$(CC) $(CFLAGSU) $(GNOMEINC) -c ..\win\gnome\gnmap.c
$(O)gnmenu.o: ..\win\gnome\gnmenu.c ..\win\gnome\gnmenu.h ..\win\gnome\gnmain.h \
..\win\gnome\gnbind.h
$(CC) $(CFLAGSU) $(GNOMEINC) -c ..\win\gnome\gnmenu.c
$(O)gnmesg.o: ..\win\gnome\gnmesg.c ..\win\gnome\gnmesg.h ..\win\gnome\gnsignal.h
$(CC) $(CFLAGSU) $(GNOMEINC) -c ..\win\gnome\gnmesg.c
$(O)gnopts.o: ..\win\gnome\gnopts.c ..\win\gnome\gnopts.h ..\win\gnome\gnglyph.h \
..\win\gnome\gnmain.h ..\win\gnome\gnmap.h $(HACK_H)
$(CC) $(CFLAGSU) $(GNOMEINC) -c ..\win\gnome\gnopts.c
$(O)gnplayer.o: ..\win\gnome\gnplayer.c ..\win\gnome\gnplayer.h \
..\win\gnome\gnmain.h $(HACK_H)
$(CC) $(CFLAGSU) $(GNOMEINC) -c ..\win\gnome\gnplayer.c
$(O)gnsignal.o: ..\win\gnome\gnsignal.c ..\win\gnome\gnsignal.h \
..\win\gnome\gnmain.h
$(CC) $(CFLAGSU) $(GNOMEINC) -c ..\win\gnome\gnsignal.c
$(O)gnstatus.o: ..\win\gnome\gnstatus.c ..\win\gnome\gnstatus.h \
..\win\gnome\gnsignal.h ..\win\gnome\gn_xpms.h \
..\win\gnome\gnomeprv.h
$(CC) $(CFLAGSU) $(GNOMEINC) -c ..\win\gnome\gnstatus.c
$(O)gntext.o: ..\win\gnome\gntext.c ..\win\gnome\gntext.h ..\win\gnome\gnmain.h \
..\win\gnome\gn_rip.h
$(CC) $(CFLAGSU) $(GNOMEINC) -c ..\win\gnome\gntext.c
$(O)gnyesno.o: ..\win\gnome\gnyesno.c ..\win\gnome\gnbind.h ..\win\gnome\gnyesno.h
$(CC) $(CFLAGSU) $(GNOMEINC) -c ..\win\gnome\gnyesno.c
$(O)wingem.o: ..\win\gem\wingem.c $(HACK_H) $(INCL)\func_tab.h $(INCL)\dlb.h \
$(INCL)\patchlevel.h $(INCL)\wingem.h
$(CC) $(CFLAGSU) -Fo$@ ..\win\gem\wingem.c
$(O)wingem1.o: ..\win\gem\wingem1.c $(INCL)\gem_rsc.h $(INCL)\load_img.h \
$(INCL)\wintype.h $(INCL)\wingem.h
$(CC) $(CFLAGSU) -Fo$@ ..\win\gem\wingem1.c
$(O)load_img.o: ..\win\gem\load_img.c $(INCL)\load_img.h
$(CC) $(CFLAGSU) -Fo$@ ..\win\gem\load_img.c
$(O)tile.o: $(SRC)\tile.c $(HACK_H)
$(O)qt_win.o: ..\win\Qt\qt_win.cpp $(HACK_H) $(INCL)\func_tab.h \
$(INCL)\dlb.h $(INCL)\patchlevel.h $(INCL)\qt_win.h \
$(INCL)\qt_clust.h $(INCL)\qt_kde0.h \
$(INCL)\qt_xpms.h qt_win.moc qt_kde0.moc
$(CXX) $(CXXFLAGS) -c ..\win\Qt\qt_win.cpp
$(O)qt_clust.o: ..\win\Qt\qt_clust.cpp $(INCL)\qt_clust.h
$(CXX) $(CXXFLAGS) -c ..\win\Qt\qt_clust.cpp
$(O)monstr.o: $(SRC)\monstr.c $(CONFIG_H)
$(O)vis_tab.o: $(SRC)\vis_tab.c $(CONFIG_H) $(INCL)\vis_tab.h
$(O)allmain.o: $(SRC)\allmain.c $(HACK_H)
$(O)alloc.o: $(SRC)\alloc.c $(CONFIG_H)
$(O)apply.o: $(SRC)\apply.c $(HACK_H)
$(O)artifact.o: $(SRC)\artifact.c $(HACK_H) $(INCL)\artifact.h $(INCL)\artilist.h
$(O)attrib.o: $(SRC)\attrib.c $(HACK_H) $(INCL)\artifact.h
$(O)ball.o: $(SRC)\ball.c $(HACK_H)
$(O)bones.o: $(SRC)\bones.c $(HACK_H)
$(O)botl.o: $(SRC)\botl.c $(HACK_H)
$(O)cmd.o: $(SRC)\cmd.c $(HACK_H) $(INCL)\func_tab.h
$(O)dbridge.o: $(SRC)\dbridge.c $(HACK_H)
$(O)decl.o: $(SRC)\decl.c $(HACK_H)
$(O)detect.o: $(SRC)\detect.c $(HACK_H) $(INCL)\artifact.h
$(O)dig.o: $(SRC)\dig.c $(HACK_H)
$(O)display.o: $(SRC)\display.c $(HACK_H)
$(O)dlb.o: $(SRC)\dlb.c $(CONFIG_H) $(INCL)\dlb.h
$(O)do.o: $(SRC)\do.c $(HACK_H)
$(O)do_name.o: $(SRC)\do_name.c $(HACK_H)
$(O)do_wear.o: $(SRC)\do_wear.c $(HACK_H)
$(O)dog.o: $(SRC)\dog.c $(HACK_H)
$(O)dogmove.o: $(SRC)\dogmove.c $(HACK_H) $(INCL)\mfndpos.h
$(O)dokick.o: $(SRC)\dokick.c $(HACK_H)
$(O)dothrow.o: $(SRC)\dothrow.c $(HACK_H)
$(O)drawing.o: $(SRC)\drawing.c $(HACK_H) $(INCL)\tcap.h
$(O)dungeon.o: $(SRC)\dungeon.c $(HACK_H) $(INCL)\dgn_file.h $(INCL)\dlb.h
$(O)eat.o: $(SRC)\eat.c $(HACK_H)
$(O)end.o: $(SRC)\end.c $(HACK_H) $(INCL)\dlb.h
$(O)engrave.o: $(SRC)\engrave.c $(HACK_H)
$(O)exper.o: $(SRC)\exper.c $(HACK_H)
$(O)explode.o: $(SRC)\explode.c $(HACK_H)
$(O)extralev.o: $(SRC)\extralev.c $(HACK_H)
$(O)files.o: $(SRC)\files.c $(HACK_H) $(INCL)\dlb.h
$(O)fountain.o: $(SRC)\fountain.c $(HACK_H)
$(O)hack.o: $(SRC)\hack.c $(HACK_H)
$(O)hacklib.o: $(SRC)\hacklib.c $(HACK_H)
$(O)invent.o: $(SRC)\invent.c $(HACK_H) $(INCL)\artifact.h
$(O)light.o: $(SRC)\light.c $(HACK_H)
$(O)lock.o: $(SRC)\lock.c $(HACK_H)
$(O)mail.o: $(SRC)\mail.c $(HACK_H) $(INCL)\mail.h
$(O)makemon.o: $(SRC)\makemon.c $(HACK_H)
$(O)mapglyph.o: $(SRC)\mapglyph.c $(HACK_H)
$(O)mcastu.o: $(SRC)\mcastu.c $(HACK_H)
$(O)mhitm.o: $(SRC)\mhitm.c $(HACK_H) $(INCL)\artifact.h
$(O)mhitu.o: $(SRC)\mhitu.c $(HACK_H) $(INCL)\artifact.h
$(O)minion.o: $(SRC)\minion.c $(HACK_H)
$(O)mklev.o: $(SRC)\mklev.c $(HACK_H)
$(O)mkmap.o: $(SRC)\mkmap.c $(HACK_H) $(INCL)\sp_lev.h
$(O)mkmaze.o: $(SRC)\mkmaze.c $(HACK_H) $(INCL)\sp_lev.h
$(O)mkobj.o: $(SRC)\mkobj.c $(HACK_H) $(INCL)\artifact.h
$(O)mkroom.o: $(SRC)\mkroom.c $(HACK_H)
$(O)mon.o: $(SRC)\mon.c $(HACK_H) $(INCL)\mfndpos.h
$(O)mondata.o: $(SRC)\mondata.c $(HACK_H)
$(O)monmove.o: $(SRC)\monmove.c $(HACK_H) $(INCL)\mfndpos.h $(INCL)\artifact.h
$(O)monst.o: $(SRC)\monst.c $(CONFIG_H) $(INCL)\permonst.h $(INCL)\align.h \
$(INCL)\monattk.h $(INCL)\monflag.h $(INCL)\monsym.h \
$(INCL)\dungeon.h $(INCL)\color.h
$(O)mplayer.o: $(SRC)\mplayer.c $(HACK_H)
$(O)mthrowu.o: $(SRC)\mthrowu.c $(HACK_H)
$(O)muse.o: $(SRC)\muse.c $(HACK_H)
$(O)music.o: $(SRC)\music.c $(HACK_H) #interp.c
$(O)o_init.o: $(SRC)\o_init.c $(HACK_H)
$(O)objects.o: $(SRC)\objects.c $(CONFIG_H) $(INCL)\obj.h $(INCL)\objclass.h \
$(INCL)\prop.h $(INCL)\skills.h $(INCL)\color.h
$(O)objnam.o: $(SRC)\objnam.c $(HACK_H)
$(O)options.o: $(SRC)\options.c $(CONFIG_H) $(INCL)\objclass.h $(INCL)\flag.h \
$(HACK_H) $(INCL)\tcap.h
$(O)pager.o: $(SRC)\pager.c $(HACK_H) $(INCL)\dlb.h
$(O)pickup.o: $(SRC)\pickup.c $(HACK_H)
$(O)pline.o: $(SRC)\pline.c $(HACK_H)
$(O)polyself.o: $(SRC)\polyself.c $(HACK_H)
$(O)potion.o: $(SRC)\potion.c $(HACK_H)
$(O)pray.o: $(SRC)\pray.c $(HACK_H)
$(O)priest.o: $(SRC)\priest.c $(HACK_H) $(INCL)\mfndpos.h
$(O)quest.o: $(SRC)\quest.c $(HACK_H)
$(O)questpgr.o: $(SRC)\questpgr.c $(HACK_H) $(INCL)\dlb.h
$(O)read.o: $(SRC)\read.c $(HACK_H)
$(O)rect.o: $(SRC)\rect.c $(HACK_H)
$(O)region.o: $(SRC)\region.c $(HACK_H)
$(O)restore.o: $(SRC)\restore.c $(HACK_H) $(INCL)\tcap.h
$(O)rip.o: $(SRC)\rip.c $(HACK_H)
$(O)rnd.o: $(SRC)\rnd.c $(HACK_H)
$(O)role.o: $(SRC)\role.c $(HACK_H)
$(O)rumors.o: $(SRC)\rumors.c $(HACK_H) $(INCL)\dlb.h
$(O)save.o: $(SRC)\save.c $(HACK_H)
$(O)shk.o: $(SRC)\shk.c $(HACK_H)
$(O)shknam.o: $(SRC)\shknam.c $(HACK_H)
$(O)sit.o: $(SRC)\sit.c $(HACK_H) $(INCL)\artifact.h
$(O)sounds.o: $(SRC)\sounds.c $(HACK_H)
$(O)sp_lev.o: $(SRC)\sp_lev.c $(HACK_H) $(INCL)\dlb.h $(INCL)\sp_lev.h
$(O)spell.o: $(SRC)\spell.c $(HACK_H)
$(O)steal.o: $(SRC)\steal.c $(HACK_H)
$(O)steed.o: $(SRC)\steed.c $(HACK_H)
$(O)teleport.o: $(SRC)\teleport.c $(HACK_H)
$(O)timeout.o: $(SRC)\timeout.c $(HACK_H)
$(O)topten.o: $(SRC)\topten.c $(HACK_H) $(INCL)\dlb.h $(INCL)\patchlevel.h
$(O)track.o: $(SRC)\track.c $(HACK_H)
$(O)trap.o: $(SRC)\trap.c $(HACK_H)
$(O)u_init.o: $(SRC)\u_init.c $(HACK_H)
$(O)uhitm.o: $(SRC)\uhitm.c $(HACK_H)
$(O)vault.o: $(SRC)\vault.c $(HACK_H)
$(O)version.o: $(SRC)\version.c $(HACK_H) $(INCL)\date.h $(INCL)\patchlevel.h
$(O)vision.o: $(SRC)\vision.c $(HACK_H) $(INCL)\vis_tab.h
$(O)weapon.o: $(SRC)\weapon.c $(HACK_H)
$(O)were.o: $(SRC)\were.c $(HACK_H)
$(O)wield.o: $(SRC)\wield.c $(HACK_H)
$(O)windows.o: $(SRC)\windows.c $(HACK_H) $(INCL)\wingem.h $(INCL)\winGnome.h
$(O)wizard.o: $(SRC)\wizard.c $(HACK_H)
$(O)worm.o: $(SRC)\worm.c $(HACK_H)
$(O)worn.o: $(SRC)\worn.c $(HACK_H)
$(O)write.o: $(SRC)\write.c $(HACK_H)
$(O)zap.o: $(SRC)\zap.c $(HACK_H)
# end of file

View File

@@ -0,0 +1 @@
* NH_filestag=(header_file%s_for_Windows_CE_and_PocketPC_-_untested_for_3.7)

View File

@@ -0,0 +1,17 @@
/***
*assert.h - define the assert macro
*
****/
#undef assert
#ifdef NDEBUG
#define assert(exp) ((void) 0)
#else
#define assert(exp) \
(void)((exp) || (panic("%s at %s line %ld", #exp, __FILE__, __LINE__), 1))
#endif /* NDEBUG */

View File

@@ -0,0 +1,3 @@
/* empty file */
extern int errno;

View File

@@ -0,0 +1,67 @@
/***
*fcntl.h - file control options used by open()
*
*Purpose:
* This file defines constants for the file control options used
* by the _open() function.
* [System V]
*
* [Public]
*
****/
#ifndef _INC_FCNTL
#define _INC_FCNTL
#define _O_RDONLY 0x0000 /* open for reading only */
#define _O_WRONLY 0x0001 /* open for writing only */
#define _O_RDWR 0x0002 /* open for reading and writing */
#define _O_APPEND 0x0008 /* writes done at eof */
#define _O_CREAT 0x0100 /* create and open file */
#define _O_TRUNC 0x0200 /* open and truncate */
#define _O_EXCL 0x0400 /* open only if file doesn't already exist */
/* O_TEXT files have <cr><lf> sequences translated to <lf> on read()'s,
** and <lf> sequences translated to <cr><lf> on write()'s
*/
#define _O_TEXT 0x4000 /* file mode is text (translated) */
#define _O_BINARY 0x8000 /* file mode is binary (untranslated) */
/* macro to translate the C 2.0 name used to force binary mode for files */
#define _O_RAW _O_BINARY
/* Open handle inherit bit */
#define _O_NOINHERIT 0x0080 /* child process doesn't inherit file */
/* Temporary file bit - file is deleted when last handle is closed */
#define _O_TEMPORARY 0x0040 /* temporary file bit */
/* sequential/random access hints */
#define _O_SEQUENTIAL 0x0020 /* file access is primarily sequential */
#define _O_RANDOM 0x0010 /* file access is primarily random */
#if !__STDC__ || defined(_POSIX_)
/* Non-ANSI names for compatibility */
#define O_RDONLY _O_RDONLY
#define O_WRONLY _O_WRONLY
#define O_RDWR _O_RDWR
#define O_APPEND _O_APPEND
#define O_CREAT _O_CREAT
#define O_TRUNC _O_TRUNC
#define O_EXCL _O_EXCL
#define O_TEXT _O_TEXT
#define O_BINARY _O_BINARY
#define O_RAW _O_BINARY
#define O_TEMPORARY _O_TEMPORARY
#define O_NOINHERIT _O_NOINHERIT
#define O_SEQUENTIAL _O_SEQUENTIAL
#define O_RANDOM _O_RANDOM
#endif /* __STDC__ */
#endif /* _INC_FCNTL */

View File

@@ -0,0 +1 @@
* NH_filestag=(sys/stat.h_for_Windows_CE_and_PocketPC_-_untested_for_3.6.2)

View File

@@ -0,0 +1 @@
/* empty file */

906
outdated/sys/wince/celib.c Normal file
View File

@@ -0,0 +1,906 @@
/* NetHack 3.6 celib.c $NHDT-Date: 1432512803 2015/05/25 00:13:23 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#define NEED_VARARGS
#include "hack.h"
#include <fcntl.h>
// #include "wceconf.h"
static union {
time_t t_val;
struct time_pack {
unsigned int ss : 6;
unsigned int mm : 6;
unsigned int dd : 5;
unsigned int hh : 6;
unsigned int mo : 4;
unsigned int yr : 10;
unsigned int wd : 3;
} tm_val;
} _t_cnv;
#define IS_LEAP(yr) (((yr) % 4 == 0 || (yr) % 100 == 0) && !(yr) % 400 == 0)
static char _day_mo_leap[12] = { 31, 29, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31 };
static char _day_mo[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
struct tm *__cdecl localtime(const time_t *ptime)
{
static struct tm ptm;
int i;
if (!ptime)
return NULL;
_t_cnv.t_val = *ptime;
ptm.tm_sec = _t_cnv.tm_val.ss; /* seconds after the minute - [0,59] */
ptm.tm_min = _t_cnv.tm_val.mm; /* minutes after the hour - [0,59] */
ptm.tm_hour = _t_cnv.tm_val.hh; /* hours since midnight - [0,23] */
ptm.tm_mday = _t_cnv.tm_val.dd; /* day of the month - [1,31] */
ptm.tm_mon = _t_cnv.tm_val.mo - 1; /* months since January - [0,11] */
ptm.tm_year = _t_cnv.tm_val.yr; /* years since 1900 */
ptm.tm_wday = _t_cnv.tm_val.wd; /* days since Sunday - [0,6] */
ptm.tm_yday = _t_cnv.tm_val.dd; /* days since January 1 - [0,365] */
for (i = 0; i < ptm.tm_mon; i++)
ptm.tm_yday +=
IS_LEAP(_t_cnv.tm_val.yr + 1900) ? _day_mo_leap[i] : _day_mo[i];
ptm.tm_isdst = 0; /* daylight savings time flag - NOT IMPLEMENTED */
return &ptm;
}
time_t __cdecl time(time_t *timeptr)
{
SYSTEMTIME stm;
GetLocalTime(&stm);
_t_cnv.tm_val.yr = stm.wYear - 1900;
_t_cnv.tm_val.mo = stm.wMonth;
_t_cnv.tm_val.dd = stm.wDay;
_t_cnv.tm_val.hh = stm.wHour;
_t_cnv.tm_val.mm = stm.wMinute;
_t_cnv.tm_val.ss = stm.wSecond;
_t_cnv.tm_val.wd = stm.wDayOfWeek;
if (timeptr)
*timeptr = _t_cnv.t_val;
return _t_cnv.t_val;
}
time_t __cdecl mktime(struct tm *tb)
{
if (!tb)
return (time_t) -1;
_t_cnv.tm_val.yr = tb->tm_year;
_t_cnv.tm_val.mo = tb->tm_mon;
_t_cnv.tm_val.dd = tb->tm_mday;
_t_cnv.tm_val.hh = tb->tm_hour;
_t_cnv.tm_val.mm = tb->tm_min;
_t_cnv.tm_val.ss = tb->tm_sec;
_t_cnv.tm_val.wd = tb->tm_wday;
return _t_cnv.t_val;
}
/*------------------------------------------------------------------------------*/
/* __io.h__ */
/* Hack io.h function with stdio.h functions */
/* ASSUMPTION : int can hold FILE* */
static TCHAR _nh_cwd[MAX_PATH];
const int MAGIC_OFFSET = 5;
#define FILE_TABLE_SIZE 256
static HANDLE _nh_file_table[FILE_TABLE_SIZE];
static int file_pointer = -1;
static HANDLE
get_file_handle(int i)
{
i -= MAGIC_OFFSET;
if (i >= 0 && i < FILE_TABLE_SIZE)
return _nh_file_table[i];
else
return INVALID_HANDLE_VALUE;
}
static int
alloc_file_handle(HANDLE h)
{
int i;
if (file_pointer == -1) {
file_pointer = 0;
for (i = 0; i < FILE_TABLE_SIZE; i++)
_nh_file_table[i] = INVALID_HANDLE_VALUE;
}
i = (file_pointer + 1) % FILE_TABLE_SIZE;
while (_nh_file_table[i] != INVALID_HANDLE_VALUE) {
if (i == file_pointer) {
MessageBox(NULL, _T("Ran out of file handles."),
_T("Fatal Error"), MB_OK);
abort();
}
i = (i + 1) % FILE_TABLE_SIZE;
}
file_pointer = i;
_nh_file_table[file_pointer] = h;
return file_pointer + MAGIC_OFFSET;
}
int __cdecl close(int f)
{
int retval;
f -= MAGIC_OFFSET;
if (f < 0 || f >= FILE_TABLE_SIZE)
return -1;
retval = (CloseHandle(_nh_file_table[f]) ? 0 : -1);
_nh_file_table[f] = INVALID_HANDLE_VALUE;
return retval;
}
int __cdecl creat(const char *fname, int mode)
{
HANDLE f;
TCHAR wbuf[MAX_PATH + 1];
ZeroMemory(wbuf, sizeof(wbuf));
NH_A2W(fname, wbuf, MAX_PATH);
f = CreateFile(wbuf, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
if (f == INVALID_HANDLE_VALUE)
return -1;
else
return alloc_file_handle(f);
}
int __cdecl eof(int f)
{
DWORD fpos, fsize;
HANDLE p = get_file_handle(f);
if (f == -1)
return -1;
fpos = SetFilePointer(p, 0, NULL, FILE_CURRENT);
fsize = SetFilePointer(p, 0, NULL, FILE_END);
if (fpos == 0xFFFFFFFF || fsize == 0xFFFFFFFF)
return -1;
if (fpos == fsize)
return 1;
else {
SetFilePointer(p, fpos, NULL, FILE_BEGIN);
return 0;
}
}
long __cdecl lseek(int f, long offset, int origin)
{
HANDLE p = get_file_handle(f);
DWORD fpos;
switch (origin) {
case SEEK_SET:
fpos = SetFilePointer(p, offset, NULL, FILE_BEGIN);
break;
case SEEK_CUR:
fpos = SetFilePointer(p, offset, NULL, FILE_CURRENT);
break;
case SEEK_END:
fpos = SetFilePointer(p, offset, NULL, FILE_END);
break;
default:
fpos = 0xFFFFFFFF;
break;
}
if (fpos == 0xFFFFFFFF)
return -1;
else
return (long) fpos;
}
int __cdecl open(const char *filename, int oflag, ...)
{
TCHAR fname[MAX_PATH + 1];
TCHAR path[MAX_PATH + 1];
HANDLE f;
DWORD fileaccess;
DWORD filecreate;
/* O_TEXT is not supported */
/*
* decode the access flags
*/
switch (oflag & (_O_RDONLY | _O_WRONLY | _O_RDWR)) {
case _O_RDONLY: /* read access */
fileaccess = GENERIC_READ;
break;
case _O_WRONLY: /* write access */
fileaccess = GENERIC_READ | GENERIC_WRITE;
break;
case _O_RDWR: /* read and write access */
fileaccess = GENERIC_READ | GENERIC_WRITE;
break;
default: /* error, bad oflag */
return -1;
}
/*
* decode open/create method flags
*/
switch (oflag & (_O_CREAT | _O_EXCL | _O_TRUNC)) {
case 0:
case _O_EXCL: // ignore EXCL w/o CREAT
filecreate = OPEN_EXISTING;
break;
case _O_CREAT:
filecreate = OPEN_ALWAYS;
break;
case _O_CREAT | _O_EXCL:
case _O_CREAT | _O_TRUNC | _O_EXCL:
filecreate = CREATE_NEW;
break;
case _O_TRUNC:
case _O_TRUNC | _O_EXCL: // ignore EXCL w/o CREAT
filecreate = TRUNCATE_EXISTING;
break;
case _O_CREAT | _O_TRUNC:
filecreate = CREATE_ALWAYS;
break;
default:
return -1;
}
/* assemple the file name */
ZeroMemory(fname, sizeof(fname));
ZeroMemory(path, sizeof(path));
NH_A2W(filename, fname, MAX_PATH);
if (*filename != '\\' && *filename != '/') {
_tcscpy(path, _nh_cwd);
_tcsncat(path, _T("\\"), MAX_PATH - _tcslen(path));
}
_tcsncat(path, fname, MAX_PATH - _tcslen(path));
/*
* try to open/create the file
*/
if ((f = CreateFile(path, fileaccess, 0, NULL, filecreate,
FILE_ATTRIBUTE_NORMAL, NULL))
== INVALID_HANDLE_VALUE) {
return -1;
}
if (!(oflag & O_APPEND))
SetFilePointer(f, 0, NULL, FILE_BEGIN);
return alloc_file_handle(f);
}
int __cdecl read(int f, void *buffer, unsigned int count)
{
HANDLE p = get_file_handle(f);
DWORD bytes_read;
if (!ReadFile(p, buffer, count, &bytes_read, NULL))
return -1;
else
return (int) bytes_read;
}
int __cdecl unlink(const char *filename)
{
TCHAR wbuf[MAX_PATH + 1];
TCHAR fname[MAX_PATH + 1];
ZeroMemory(wbuf, sizeof(wbuf));
ZeroMemory(fname, sizeof(fname));
NH_A2W(filename, wbuf, MAX_PATH);
if (*filename != '\\' && *filename != '/') {
_tcscpy(fname, _nh_cwd);
_tcsncat(fname, _T("\\"), MAX_PATH - _tcslen(fname));
}
_tcsncat(fname, wbuf, MAX_PATH - _tcslen(fname));
return !DeleteFileW(fname);
}
int __cdecl write(int f, const void *buffer, unsigned int count)
{
HANDLE p = get_file_handle(f);
DWORD bytes_written;
if (!WriteFile(p, buffer, count, &bytes_written, NULL))
return -1;
else
return (int) bytes_written;
}
int __cdecl rename(const char *oldname, const char *newname)
{
WCHAR f1[MAX_PATH + 1];
WCHAR f2[MAX_PATH + 1];
ZeroMemory(f1, sizeof(f1));
ZeroMemory(f2, sizeof(f2));
MultiByteToWideChar(CP_ACP, 0, oldname, -1, f1, MAX_PATH);
MultiByteToWideChar(CP_ACP, 0, newname, -1, f2, MAX_PATH);
return !MoveFile(f1, f2);
}
int __cdecl access(const char *path, int mode)
{
DWORD attr;
WCHAR f[MAX_PATH + 1];
ZeroMemory(f, sizeof(f));
MultiByteToWideChar(CP_ACP, 0, path, -1, f, MAX_PATH);
attr = GetFileAttributes(f);
if (attr == (DWORD) -1)
return -1;
if ((attr & FILE_ATTRIBUTE_READONLY) && (mode & 2))
return -1;
else
return 0;
}
int
chdir(const char *dirname)
{
ZeroMemory(_nh_cwd, sizeof(_nh_cwd));
NH_A2W(dirname, _nh_cwd, MAX_PATH);
return 0;
}
char *
getcwd(char *buffer, int maxlen)
{
if (maxlen < (int) _tcslen(_nh_cwd))
return NULL;
else
return NH_W2A(_nh_cwd, buffer, maxlen);
}
/*------------------------------------------------------------------------------*/
/* __errno.h__ */
int errno;
/*------------------------------------------------------------------------------*/
/*
* Chdrive() changes the default drive.
*/
void
chdrive(char *str)
{
return;
}
/*
* This is used in nhlan.c to implement some of the LAN_FEATURES.
*/
char *
get_username(lan_username_size)
int *lan_username_size;
{
static char username_buffer[BUFSZ];
strcpy(username_buffer, "nhsave");
return username_buffer;
}
void
Delay(int ms)
{
(void) Sleep(ms);
}
void
more()
{
}
int
isatty(int f)
{
return 0;
}
#if defined(WIN_CE_PS2xx) || defined(WIN32_PLATFORM_HPCPRO)
int __cdecl isupper(int c)
{
char str[2];
WCHAR wstr[2];
str[0] = c;
str[1] = 0;
NH_A2W(str, wstr, 1);
return iswupper(wstr[0]);
}
int __cdecl isdigit(int c)
{
return ('0' <= c && c <= '9');
}
int __cdecl isxdigit(int c)
{
return (('0' <= c && c <= '9') || ('a' <= c && c <= 'f')
|| ('A' <= c && c <= 'F'));
}
int __cdecl isspace(int c)
{
char str[2];
WCHAR wstr[2];
str[0] = c;
str[1] = 0;
NH_A2W(str, wstr, 1);
return iswspace(wstr[0]);
}
int __cdecl isprint(int c)
{
char str[2];
WCHAR wstr[2];
str[0] = c;
str[1] = 0;
NH_A2W(str, wstr, 1);
return iswprint(wstr[0]);
}
char *__cdecl _strdup(const char *s)
{
char *p;
p = malloc(strlen(s) + 1);
return strcpy(p, s);
}
char *__cdecl strrchr(const char *s, int c)
{
WCHAR wstr[1024];
WCHAR *w;
w = wcsrchr(NH_A2W(s, wstr, 1024), c);
if (w)
return (char *) (s + (w - wstr));
else
return NULL;
}
int __cdecl _stricmp(const char *a, const char *b)
{
return strncmpi(a, b, 65535u);
}
#endif
#if defined(WIN_CE_PS2xx)
/* stdio.h functions are missing from PAlm Size PC SDK 1.2 (SH3 and MIPS) */
#pragma warning(disable : 4273)
FILE *__cdecl fopen(const char *filename, const char *mode)
{
int modeflag;
int whileflag;
int filedes;
/* First mode character must be 'r', 'w', or 'a'. */
switch (*mode) {
case 'r':
modeflag = _O_RDONLY;
break;
case 'w':
modeflag = _O_WRONLY | _O_CREAT | _O_TRUNC;
break;
case 'a':
modeflag = _O_WRONLY | _O_CREAT | _O_APPEND;
break;
default:
return NULL;
}
whileflag = 1;
while (*++mode && whileflag)
switch (*mode) {
case '+':
if (modeflag & _O_RDWR)
whileflag = 0;
else {
modeflag |= _O_RDWR;
modeflag &= ~(_O_RDONLY | _O_WRONLY);
}
break;
case 'b':
if (modeflag & (_O_TEXT | _O_BINARY))
whileflag = 0;
else
modeflag |= _O_BINARY;
break;
case 't': /* not supported */
whileflag = 0;
break;
default:
whileflag = 0;
break;
}
if ((filedes = open(filename, modeflag)) == -1)
return NULL;
return (FILE *) filedes;
}
int __cdecl fscanf(FILE *f, const char *format, ...)
{
/* Format spec: %[*] [width] [l] type ] */
int ch;
int sch;
int matched = 0;
int width = 65535;
int modifier = -1;
int skip_flag = 0;
int n_read = 0;
char buf[BUFSZ];
TCHAR wbuf[BUFSZ];
char *p;
va_list args;
#define RETURN_SCANF(i) \
{ \
va_end(args); \
return i; \
}
#define NEXT_CHAR(f) (n_read++, fgetc(f))
va_start(args, format);
ch = *format++;
sch = NEXT_CHAR(f);
while (ch && sch != EOF) {
if (isspace(ch)) {
while (ch && isspace(ch))
ch = *format++;
while (sch != EOF && isspace(sch))
sch = NEXT_CHAR(f);
format--;
goto next_spec;
}
/* read % */
if (ch != '%') {
if (sch != ch)
RETURN_SCANF(matched);
sch = NEXT_CHAR(f);
goto next_spec;
} else {
/* process '%%' */
ch = *format++;
if (ch == '%') {
if (sch != '%')
RETURN_SCANF(matched);
sch = NEXT_CHAR(f);
goto next_spec;
}
if (ch == '*') {
/* read skip flag - '*' */
skip_flag = 1;
ch = *format++;
}
/* get width */
if (isdigit(ch)) {
width = 0;
while (ch && isdigit(ch)) {
width = width * 10 + (ch - '0');
ch = *format++;
}
}
/* get modifier */
if (ch == 'l') {
modifier = 'l';
ch = *format++;
}
/* get type */
switch (ch) {
case 'c':
if (!skip_flag) {
*(va_arg(args, char *) ) = sch;
matched++;
}
sch = NEXT_CHAR(f);
goto next_spec;
case 'd':
p = buf;
/* skip space */
while (sch != EOF && isspace(sch))
sch = NEXT_CHAR(f);
while (sch != EOF && isdigit(sch) && --width >= 0) {
*p++ = sch;
sch = NEXT_CHAR(f);
}
*p = '\x0';
if (!skip_flag) {
matched++;
if (modifier == 'l') {
*(va_arg(args, long *) ) =
wcstol(NH_A2W(buf, wbuf, BUFSZ), NULL, 10);
} else {
*(va_arg(args, int *) ) =
wcstol(NH_A2W(buf, wbuf, BUFSZ), NULL, 10);
}
}
goto next_spec;
case 'x':
p = buf;
while (sch != EOF && isspace(sch))
sch = NEXT_CHAR(f);
while (sch != EOF && isxdigit(sch) && --width >= 0) {
*p++ = sch;
sch = NEXT_CHAR(f);
}
*p = '\x0';
if (!skip_flag) {
matched++;
if (modifier == 'l') {
*(va_arg(args, long *) ) =
wcstol(NH_A2W(buf, wbuf, BUFSZ), NULL, 16);
} else {
*(va_arg(args, int *) ) =
wcstol(NH_A2W(buf, wbuf, BUFSZ), NULL, 16);
}
}
goto next_spec;
case 'n':
*(va_arg(args, int *) ) = n_read;
matched++;
goto next_spec;
case 's':
if (skip_flag) {
while (sch != EOF && !isspace(sch) && --width >= 0) {
sch = NEXT_CHAR(f);
}
} else {
p = va_arg(args, char *);
while (sch != EOF && !isspace(sch) && --width >= 0) {
*p++ = sch;
sch = NEXT_CHAR(f);
}
*p = '\x0';
matched++;
}
goto next_spec;
case '[': {
char pattern[256];
int start, end;
int negate;
ZeroMemory(pattern, sizeof(pattern));
p = pattern;
/* try to parse '^' modifier */
ch = *format++;
if (ch == '^') {
negate = 1;
ch = *format++;
} else {
negate = 0;
}
if (ch == 0)
RETURN_SCANF(EOF);
for (; ch && ch != ']'; ch = *format++) {
/* try to parse range: a-z */
if (format[0] == '-' && format[1] && format[1] != ']') {
start = ch;
format++;
end = *format++;
while (start <= end) {
if (!strchr(pattern, (char) start))
*p++ = (char) start;
start++;
}
} else {
if (!strchr(pattern, (char) ch))
*p++ = (char) ch;
}
}
if (skip_flag) {
while (sch != EOF && strchr(pattern, sch)
&& --width >= 0) {
sch = NEXT_CHAR(f);
}
} else {
p = va_arg(args, char *);
if (negate)
while (sch != EOF && !strchr(pattern, sch)
&& --width >= 0) {
*p++ = sch;
sch = NEXT_CHAR(f);
}
else
while (sch != EOF && strchr(pattern, sch)
&& --width >= 0) {
*p++ = sch;
sch = NEXT_CHAR(f);
}
*p = '\x0';
matched++;
}
}
goto next_spec;
default:
RETURN_SCANF(EOF);
}
}
next_spec:
width = 65535;
modifier = -1;
skip_flag = 0;
ch = *format++;
}
fseek(f, -1, SEEK_CUR);
RETURN_SCANF(matched);
#undef RETURN_SCANF
#undef NEXT_CHAR
}
int __cdecl fprintf(FILE *f, const char *format, ...)
{
int retval;
va_list args;
if (!f || !format)
return 0;
va_start(args, format);
retval = vfprintf(f, format, args);
va_end(args);
return retval;
}
int __cdecl vfprintf(FILE *f, const char *format, va_list args)
{
char buf[4096];
int retval;
if (!f || !format)
return 0;
retval = vsprintf(buf, format, args);
write((int) f, buf, strlen(buf));
return retval;
}
int __cdecl fgetc(FILE *f)
{
char c;
int fh = (int) f;
if (!f)
return EOF;
if (read(fh, &c, 1) == 1)
return c;
else
return EOF;
}
char *__cdecl fgets(char *s, int size, FILE *f)
{
/* not the best performance but it will do for now...*/
char c;
if (!f || !s || size == 0)
return NULL;
while (--size > 0) {
if ((c = fgetc(f)) == EOF)
return NULL;
*s++ = c;
if (c == '\n')
break;
}
*s = '\x0';
return s;
}
int __cdecl printf(const char *format, ...)
{
int retval;
va_list args;
if (!format)
return 0;
va_start(args, format);
retval = vprintf(format, args);
va_end(args);
return retval;
}
int __cdecl vprintf(const char *format, va_list args)
{
char buf[4096];
int retval;
retval = vsprintf(buf, format, args);
puts(buf);
return retval;
}
// int __cdecl putchar(int);
int __cdecl puts(const char *s)
{
TCHAR wbuf[4096];
NH_A2W(s, wbuf, 4096);
MessageBox(NULL, wbuf, _T("stdout"), MB_OK);
return 0;
}
FILE *__cdecl _getstdfilex(int desc)
{
return NULL;
}
int __cdecl fclose(FILE *f)
{
if (!f)
return EOF;
return close((int) f) == -1 ? EOF : 0;
}
size_t __cdecl fread(void *p, size_t size, size_t count, FILE *f)
{
int read_bytes;
if (!f || !p || size == 0 || count == 0)
return 0;
read_bytes = read((int) f, p, size * count);
return read_bytes > 0 ? (read_bytes / size) : 0;
}
size_t __cdecl fwrite(const void *p, size_t size, size_t count, FILE *f)
{
int write_bytes;
if (!f || !p || size == 0 || count == 0)
return 0;
write_bytes = write((int) f, p, size * count);
return write_bytes > 0 ? write_bytes / size : 0;
}
int __cdecl fflush(FILE *f)
{
return 0;
}
int __cdecl feof(FILE *f)
{
return (f && eof((int) f) == 0) ? 0 : 1;
}
int __cdecl fseek(FILE *f, long offset, int from)
{
return (f && lseek((int) f, offset, from) >= 0) ? 0 : 1;
}
long __cdecl ftell(FILE *f)
{
return f ? lseek((int) f, 0, SEEK_CUR) : -1;
}
#endif

View File

@@ -0,0 +1,40 @@
@REM NetHack 3.6 cesetup.bat $NHDT-Date: 1432512801 2015/05/25 00:13:21 $ $NHDT-Branch: master $:$NHDT-Revision: 1.15 $ */
@REM Copyright (c) Alex Kompel, 2002
@REM NetHack may be freely redistributed. See license for details.
@REM Win32 nhsetup batch file, see Install.ce for details
@REM
@echo off
REM
REM Make sure directories necessary for build exist
REM
if NOT exist ..\..\wince\*.* mkdir ..\..\wince
REM
REM Get these files from the win\win32 port
REM
copy ..\..\win\win32\mnsel.uu ..\..\wince\mnsel.uu
copy ..\..\win\win32\mnselcnt.uu ..\..\wince\mnselcnt.uu
copy ..\..\win\win32\mnunsel.uu ..\..\wince\mnunsel.uu
copy ..\..\win\win32\petmark.uu ..\..\wince\petmark.uu
copy ..\..\sys\wince\menubar.uu ..\..\wince\menubar.uu
copy ..\..\sys\wince\keypad.uu ..\..\wince\keypad.uu
copy ..\..\sys\wince\nhico.uu ..\..\wince\nhico.uu
REM
REM Get these files from sys\wince
REM
copy bootstrp.mak ..\..\wince\bootstrp.mak
copy wince.vcw ..\..\wince.vcw
copy hpc.vcp ..\..\wince\wince_hpc.vcp
copy palmpc.vcp ..\..\wince\wince_palm_pc.vcp
copy pocketpc.vcp ..\..\wince\wince_pocket_pc.vcp
copy smartphn.vcp ..\..\wince\wince_smartphone.vcp
echo.
echo Proceed with the following steps:
echo.
echo cd ..\..\wince
echo nmake /f bootstrp.mak
echo.
echo Then start Embedded Visual C and open
echo the workspace wince.vcw (at the top of the NetHack tree)
echo to build. See Install.ce for details.
echo.

View File

@@ -0,0 +1,29 @@
/* NetHack 3.6 cesound.c $NHDT-Date: 1432512799 2015/05/25 00:13:19 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ */
/* Copyright (c) NetHack PC Development Team 1993 */
/* NetHack may be freely redistributed. See license for details. */
/* */
/*
* cesound.c - Windows CE NetHack sound support
*
*
*/
#include "hack.h"
#include <mmsystem.h>
#ifdef USER_SOUNDS
void
play_usersound(filename, volume)
const char *filename;
int volume;
{
TCHAR wbuf[MAX_PATH + 1];
/* pline("play_usersound: %s (%d).", filename, volume); */
ZeroMemory(wbuf, sizeof(wbuf));
(void) sndPlaySound(NH_A2W(filename, wbuf, MAX_PATH),
SND_ASYNC | SND_NODEFAULT);
}
#endif /*USER_SOUNDS*/
/* cesound.c */

View File

@@ -0,0 +1,84 @@
# $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$
# Copyright (c) 2007 by Michael Allison
# NetHack may be freely redistributed. See license for details.
#
# Sample config file for win32 NetHack
# A '#' at the beginning of a line means the rest of the line is a comment.
#
# Some options MUST be set in this file, other options can be toggled while
# playing. For a list of options available see the <opthelp.> file.
#
# To change the configuration, comment out the unwanted lines, and
# uncomment the configuration you want.
# *** OPTIONS ***
#
# Use the IBM character set rather than just plain ascii characters
# for tty window-port.
# OPTIONS=IBMGraphics
# *** Personal Preferences ***
# Some options to set personal preferences. Uncomment and change these to
# suit your personal preference. If several people are to use the same
# configuration, options like these should not be set.
#
#OPTIONS=name:Janet,role:Valkyrie,race:Human,gender:female,align:lawful
#OPTIONS=dogname:Fido,catname:Morris,fruit:guava
#OPTIONS=horsename:Silver
#OPTIONS=autopickup,pickup_types:$"=/!?+
#OPTIONS=packorder:")[%?+/=!(*0_`
#OPTIONS=scores:10 top/2 around/own
#OPTIONS=nolegacy,noverbose
#OPTIONS=menustyle:traditional
#
# General options. You might also set "silent" so as not to attract
# the boss's attention.
#
OPTIONS=time,noshowexp,number_pad,lit_corridor,rest_on_space
#
# If you want to get rid of "use #quit to quit..." use:
#OPTIONS=suppress_alert:3.3.1
#
# Set some options to control graphical window-port (these will
# be safely and silently ignored by the tty port)
#
# Map window settings
# possible map_mode options include: tiles|ascii4x6|ascii6x8|ascii8x8|ascii16x8|
# ascii7x12|ascii8x12|ascii16x12|ascii12x16|
# ascii10x18|fit_to_screen
OPTIONS=map_mode:tiles,scroll_margin:4
# Menu settings
# OPTIONS=font_menu:Arial
# Other
OPTIONS=hilite_pet,!toptenwin
OPTIONS=!splash_screen,player_selection:prompts
OPTIONS=vary_msgcount:3
OPTIONS=fullscreen,wraptext,softkeyboard
# Status/message window colors
# Possible color options include:
# six digit hexadecimal RGB color value ("#8F8F8F"), black, red, green, brown,
# blue, magenta, cyan, gray (or grey), orange, brightgreen, yellow, brightblue,
# brightmagenta, brightcyan, white, trueblack, purple, silver, maroon, fuchsia,
# lime, olive, navy, teal, aqua, activeborder, activecaption, appworkspace,
# background, btnface, btnshadow, btntext, captiontext, graytext, highlight,
# highlighttext, inactiveborder, inactivecaption, menu, menutext, scrollbar,
# window, windowframe, windowtext.
#OPTIONS=windowcolors:status windowtext/window message windowtext/window
OPTIONS=windowcolors:status white/#000000 message white/#000000 menu white/#000000 text white/#000000
#
#HACKDIR=c:\games\nethack
#
# Note: On Windows HACKDIR defaults to the location
# of the NetHack.exe or NetHackw.exe file.
# Setting HACKDIR above will override that.
#
# LEVELS and SAVE default to HACKDIR
#
#LEVELS=c:\games\nethack\bones
#SAVE=c:\games\nethack\bones

View File

@@ -0,0 +1,8 @@
begin 600 keypad.bmp
M0DV^`````````#X````H````<`````@````!``$``````(``````````````
M`````````````````/___P#__________________P``[__[____________
M_R0``.?_\_?C]__W__?_]^MU``#CP>/GU?/AX\/OY_O5=0``X>/#Q\'QX\'C
MS^?YZR4``/_W_^?5\^?_\^__^]5M``#____WX_?O__OW__?_)```________
*__________\``.?5
`
end

View File

@@ -0,0 +1,12 @@
begin 600 menubar.bmp
M0DUV`0```````'8````H````(````!`````!``0````````!````````````
M````````````````````@```@````("``(````"``(``@(```,#`P`"`@(``
M``#_``#_````__\`_P```/\`_P#__P``____`'=W=W=W=W=W=W=W=W=W=W=W
M=W=W=W=W=W=W=W=W=W=W=$1$1$1$1'=W=W=W=W=W=W1$_T1/]$1W=W=W=W=W
M=W=T1/_T__1$=W=W=W=W=W=W=/______]'=W=P<'!P=W=W3_______1W=W#P
M\/#P=W=T3__T__]$=W</#P\/#P=W=$3_1$_T1'=P\/#P\/#P=W1/__3__T1W
M=P\/#P\/!W=T_______T=W#P\/#P\/!W=/______]'=W!P<'!P<'=W1$__3_
M]$1W=W=W=W=W=W=T1/]$3_1$=W=W=W=W=W=W=$1$1$1$1'=W=W=W=W=W=W=W
.=W=W=W=W=W=W=W=W=W=$
`
end

View File

@@ -0,0 +1,13 @@
/* NetHack 3.6 mhaskyn.c $NHDT-Date: 1432512801 2015/05/25 00:13:21 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#include <assert.h>
#include "winMS.h"
#include "mhaskyn.h"
int
mswin_yes_no_dialog(const char *question, const char *choices, int def)
{
return '\032';
}

View File

@@ -0,0 +1,12 @@
/* NetHack 3.6 mhaskyn.h $NHDT-Date: 1432512800 2015/05/25 00:13:20 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#ifndef MSWINAskYesNO_h
#define MSWINAskYesNO_h
#include "winMS.h"
int mswin_yes_no_dialog(const char *question, const char *choices, int def);
#endif /* MSWINAskYesNO_h */

1532
outdated/sys/wince/mhcmd.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,27 @@
/* NetHack 3.6 mhcmd.h $NHDT-Date: 1524689383 2018/04/25 20:49:43 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.2 $ */
/* Copyright (c) 2002 by Michael Allison */
/* NetHack may be freely redistributed. See license for details. */
#ifndef MSWINCMDWindow_h
#define MSWINCMDWindow_h
#include "winMS.h"
#include "config.h"
#include "global.h"
HWND mswin_init_command_window();
/* if either sz->cx or sz->cy are already set this function will
no modify it. It will adjust them to the minimum size
required by the command window */
void mswin_command_window_size(HWND hwnd, LPSIZE sz);
#if defined(WIN_CE_SMARTPHONE)
/* special keypad input handling for SmartPhone */
BOOL NHSPhoneTranslateKbdMessage(WPARAM wParam, LPARAM lParam, BOOL keyDown);
void NHSPhoneSetKeypadFromString(const char *str);
void NHSPhoneSetKeypadDirection();
void NHSPhoneSetKeypadDefault();
#endif
#endif /* MSWINCMDWindow_h */

View File

@@ -0,0 +1,233 @@
/* NetHack 3.6 mhcolor.c $NHDT-Date: 1432512802 2015/05/25 00:13:22 $ $NHDT-Branch: master $:$NHDT-Revision: 1.7 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
/* color management and such */
#include "winMS.h"
#include "mhcolor.h"
#define TOTAL_BRUSHES 10
#define NHBRUSH_CODE(win, type) ((((win) &0xFF) << 8) | ((type) &0xFF))
struct t_brush_table {
int code;
HBRUSH brush;
COLORREF color;
};
static struct t_brush_table brush_table[TOTAL_BRUSHES];
static int max_brush = 0;
static struct t_brush_table default_brush_table[] = {
{ NHBRUSH_CODE(NHW_STATUS, MSWIN_COLOR_FG), NULL, RGB(0, 0, 0) },
{ NHBRUSH_CODE(NHW_MESSAGE, MSWIN_COLOR_FG), NULL, RGB(0, 0, 0) },
{ NHBRUSH_CODE(NHW_STATUS, MSWIN_COLOR_FG), NULL, RGB(0, 0, 0) },
{ NHBRUSH_CODE(NHW_TEXT, MSWIN_COLOR_FG), NULL, RGB(0, 0, 0) },
{ NHBRUSH_CODE(NHW_KEYPAD, MSWIN_COLOR_FG), NULL, RGB(0, 0, 0) },
{ NHBRUSH_CODE(NHW_MAP, MSWIN_COLOR_FG), NULL, RGB(96, 96, 96) },
{ NHBRUSH_CODE(NHW_MENU, MSWIN_COLOR_BG), NULL, RGB(255, 255, 255) },
{ NHBRUSH_CODE(NHW_MESSAGE, MSWIN_COLOR_BG), NULL, RGB(192, 192, 192) },
{ NHBRUSH_CODE(NHW_STATUS, MSWIN_COLOR_BG), NULL, RGB(192, 192, 192) },
{ NHBRUSH_CODE(NHW_TEXT, MSWIN_COLOR_BG), NULL, RGB(255, 255, 255) },
{ NHBRUSH_CODE(NHW_KEYPAD, MSWIN_COLOR_BG), NULL, RGB(255, 255, 255) },
{ NHBRUSH_CODE(NHW_MAP, MSWIN_COLOR_BG), NULL, RGB(192, 192, 192) },
{ -1, NULL, RGB(0, 0, 0) }
};
static void mswin_color_from_string(char *colorstring, HBRUSH *brushptr,
COLORREF *colorptr);
typedef struct ctv {
const char *colorstring;
COLORREF colorvalue;
} color_table_value;
/*
* The color list here is a combination of:
* NetHack colors. (See mhmap.c)
* HTML colors. (See http://www.w3.org/TR/REC-html40/types.html#h-6.5 )
*/
static color_table_value color_table[] = {
/* NetHack colors */
{ "black", RGB(0x55, 0x55, 0x55) },
{ "red", RGB(0xFF, 0x00, 0x00) },
{ "green", RGB(0x00, 0x80, 0x00) },
{ "brown", RGB(0xA5, 0x2A, 0x2A) },
{ "blue", RGB(0x00, 0x00, 0xFF) },
{ "magenta", RGB(0xFF, 0x00, 0xFF) },
{ "cyan", RGB(0x00, 0xFF, 0xFF) },
{ "orange", RGB(0xFF, 0xA5, 0x00) },
{ "brightgreen", RGB(0x00, 0xFF, 0x00) },
{ "yellow", RGB(0xFF, 0xFF, 0x00) },
{ "brightblue", RGB(0x00, 0xC0, 0xFF) },
{ "brightmagenta", RGB(0xFF, 0x80, 0xFF) },
{ "brightcyan", RGB(0x80, 0xFF, 0xFF) },
{ "white", RGB(0xFF, 0xFF, 0xFF) },
/* Remaining HTML colors */
{ "trueblack", RGB(0x00, 0x00, 0x00) },
{ "gray", RGB(0x80, 0x80, 0x80) },
{ "grey", RGB(0x80, 0x80, 0x80) },
{ "purple", RGB(0x80, 0x00, 0x80) },
{ "silver", RGB(0xC0, 0xC0, 0xC0) },
{ "maroon", RGB(0x80, 0x00, 0x00) },
{ "fuchsia", RGB(0xFF, 0x00, 0xFF) }, /* = NetHack magenta */
{ "lime", RGB(0x00, 0xFF, 0x00) }, /* = NetHack bright green */
{ "olive", RGB(0x80, 0x80, 0x00) },
{ "navy", RGB(0x00, 0x00, 0x80) },
{ "teal", RGB(0x00, 0x80, 0x80) },
{ "aqua", RGB(0x00, 0xFF, 0xFF) }, /* = NetHack cyan */
{ "", RGB(0x00, 0x00, 0x00) },
};
typedef struct ctbv {
char *colorstring;
int syscolorvalue;
} color_table_brush_value;
static color_table_brush_value color_table_brush[] = {
{ "activeborder", COLOR_ACTIVEBORDER },
{ "activecaption", COLOR_ACTIVECAPTION },
{ "appworkspace", COLOR_APPWORKSPACE },
{ "background", COLOR_BACKGROUND },
{ "btnface", COLOR_BTNFACE },
{ "btnshadow", COLOR_BTNSHADOW },
{ "btntext", COLOR_BTNTEXT },
{ "captiontext", COLOR_CAPTIONTEXT },
{ "graytext", COLOR_GRAYTEXT },
{ "greytext", COLOR_GRAYTEXT },
{ "highlight", COLOR_HIGHLIGHT },
{ "highlighttext", COLOR_HIGHLIGHTTEXT },
{ "inactiveborder", COLOR_INACTIVEBORDER },
{ "inactivecaption", COLOR_INACTIVECAPTION },
{ "menu", COLOR_MENU },
{ "menutext", COLOR_MENUTEXT },
{ "scrollbar", COLOR_SCROLLBAR },
{ "window", COLOR_WINDOW },
{ "windowframe", COLOR_WINDOWFRAME },
{ "windowtext", COLOR_WINDOWTEXT },
{ "", -1 },
};
void
mswin_init_color_table()
{
int i;
struct t_brush_table *p;
/* cleanup */
for (i = 0; i < max_brush; i++)
DeleteObject(brush_table[i].brush);
max_brush = 0;
/* initialize brush table */
#define BRUSHTABLE_ENTRY(opt, win, type) \
brush_table[max_brush].code = NHBRUSH_CODE((win), (type)); \
mswin_color_from_string((opt), &brush_table[max_brush].brush, \
&brush_table[max_brush].color); \
max_brush++;
BRUSHTABLE_ENTRY(iflags.wc_foregrnd_menu, NHW_MENU, MSWIN_COLOR_FG);
BRUSHTABLE_ENTRY(iflags.wc_foregrnd_message, NHW_MESSAGE, MSWIN_COLOR_FG);
BRUSHTABLE_ENTRY(iflags.wc_foregrnd_status, NHW_STATUS, MSWIN_COLOR_FG);
BRUSHTABLE_ENTRY(iflags.wc_foregrnd_text, NHW_TEXT, MSWIN_COLOR_FG);
BRUSHTABLE_ENTRY(iflags.wc_foregrnd_message, NHW_KEYPAD, MSWIN_COLOR_FG);
BRUSHTABLE_ENTRY(iflags.wc_backgrnd_menu, NHW_MENU, MSWIN_COLOR_BG);
BRUSHTABLE_ENTRY(iflags.wc_backgrnd_message, NHW_MESSAGE, MSWIN_COLOR_BG);
BRUSHTABLE_ENTRY(iflags.wc_backgrnd_status, NHW_STATUS, MSWIN_COLOR_BG);
BRUSHTABLE_ENTRY(iflags.wc_backgrnd_text, NHW_TEXT, MSWIN_COLOR_BG);
BRUSHTABLE_ENTRY(iflags.wc_backgrnd_message, NHW_KEYPAD, MSWIN_COLOR_BG);
#undef BRUSHTABLE_ENTRY
/* go through the values and fill in "blanks" (use default values) */
for (i = 0; i < max_brush; i++) {
if (!brush_table[i].brush) {
for (p = default_brush_table; p->code != -1; p++) {
if (p->code == brush_table[i].code) {
brush_table[i].brush = CreateSolidBrush(p->color);
brush_table[i].color = p->color;
}
}
}
}
}
HBRUSH
mswin_get_brush(int win_type, int color_index)
{
int i;
for (i = 0; i < max_brush; i++)
if (brush_table[i].code == NHBRUSH_CODE(win_type, color_index))
return brush_table[i].brush;
return NULL;
}
COLORREF
mswin_get_color(int win_type, int color_index)
{
int i;
for (i = 0; i < max_brush; i++)
if (brush_table[i].code == NHBRUSH_CODE(win_type, color_index))
return brush_table[i].color;
return RGB(0, 0, 0);
}
static void
mswin_color_from_string(char *colorstring, HBRUSH *brushptr,
COLORREF *colorptr)
{
color_table_value *ctv_ptr = color_table;
color_table_brush_value *ctbv_ptr = color_table_brush;
int red_value, blue_value, green_value;
static char *hexadecimals = "0123456789abcdef";
*brushptr = NULL;
*colorptr = RGB(0, 0, 0);
if (colorstring == NULL)
return;
if (*colorstring == '#') {
if (strlen(++colorstring) != 6)
return;
red_value =
index(hexadecimals, tolower(*colorstring++)) - hexadecimals;
red_value *= 16;
red_value +=
index(hexadecimals, tolower(*colorstring++)) - hexadecimals;
green_value =
index(hexadecimals, tolower(*colorstring++)) - hexadecimals;
green_value *= 16;
green_value +=
index(hexadecimals, tolower(*colorstring++)) - hexadecimals;
blue_value =
index(hexadecimals, tolower(*colorstring++)) - hexadecimals;
blue_value *= 16;
blue_value +=
index(hexadecimals, tolower(*colorstring++)) - hexadecimals;
*colorptr = RGB(red_value, blue_value, green_value);
} else {
while (*ctv_ptr->colorstring
&& _stricmp(ctv_ptr->colorstring, colorstring))
++ctv_ptr;
if (*ctv_ptr->colorstring) {
*colorptr = ctv_ptr->colorvalue;
} else {
while (*ctbv_ptr->colorstring
&& _stricmp(ctbv_ptr->colorstring, colorstring))
++ctbv_ptr;
if (*ctbv_ptr->colorstring) {
*brushptr = SYSCLR_TO_BRUSH(ctbv_ptr->syscolorvalue);
*colorptr = GetSysColor(ctbv_ptr->syscolorvalue);
}
}
}
if (max_brush > TOTAL_BRUSHES)
panic("Too many colors!");
*brushptr = CreateSolidBrush(*colorptr);
}

View File

@@ -0,0 +1,18 @@
/* NetHack 3.6 mhcolor.h $NHDT-Date: 1432512799 2015/05/25 00:13:19 $ $NHDT-Branch: master $:$NHDT-Revision: 1.6 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
/* color management functions */
#ifndef MSWINColor_h
#define MSWINColor_h
#define MSWIN_COLOR_BG 0
#define MSWIN_COLOR_FG 1
#define SYSCLR_TO_BRUSH(x) ((HBRUSH)((x) + 1))
extern void mswin_init_color_table();
extern HBRUSH mswin_get_brush(int win_type, int color_index);
extern COLORREF mswin_get_color(int win_type, int color_index);
#endif /* MSWINColor_h */

825
outdated/sys/wince/mhdlg.c Normal file
View File

@@ -0,0 +1,825 @@
/* NetHack 3.6 mhdlg.c $NHDT-Date: 1432512802 2015/05/25 00:13:22 $ $NHDT-Branch: master $:$NHDT-Revision: 1.18 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
/* various dialog boxes are defined here */
#include "winMS.h"
#include "hack.h"
#include "func_tab.h"
#include "mhdlg.h"
#include "mhmain.h"
#define CheckDlgButton(dlg, btn_id, st) \
SendDlgItemMessage((dlg), (btn_id), BM_SETCHECK, (WPARAM)(st), 0)
/*---------------------------------------------------------------*/
/* data for getlin dialog */
struct getlin_data {
const char *question;
char *result;
size_t result_size;
};
LRESULT CALLBACK GetlinDlgProc(HWND, UINT, WPARAM, LPARAM);
int
mswin_getlin_window(const char *question, char *result, size_t result_size)
{
int ret;
struct getlin_data data;
/* initilize dialog data */
ZeroMemory(&data, sizeof(data));
data.question = question;
data.result = result;
data.result_size = result_size;
/* create modal dialog window */
ret = DialogBoxParam(GetNHApp()->hApp, MAKEINTRESOURCE(IDD_GETLIN),
GetNHApp()->hMainWnd, GetlinDlgProc, (LPARAM) &data);
if (ret == -1)
panic("Cannot create getlin window");
return ret;
}
LRESULT CALLBACK
GetlinDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
struct getlin_data *data;
RECT main_rt, text_rt, dlg_rt, edit_rt;
SIZE dlg_sz;
TCHAR wbuf[BUFSZ];
HDC hdc;
HWND control;
HWND hwndMap;
#if defined(WIN_CE_POCKETPC)
SHInputDialog(hWnd, message, wParam);
#endif
switch (message) {
case WM_INITDIALOG:
data = (struct getlin_data *) lParam;
SetWindowText(hWnd, NH_A2W(data->question, wbuf, sizeof(wbuf)));
SetWindowLong(hWnd, GWL_USERDATA, lParam);
/* get title text width */
SetRect(&text_rt, 0, 0, 100, 50);
hdc = GetWindowDC(hWnd);
DrawText(hdc, wbuf, _tcslen(wbuf), &text_rt,
DT_CALCRECT | DT_SINGLELINE | DT_NOPREFIX | DT_LEFT
| DT_VCENTER);
ReleaseDC(hWnd, hdc);
/* center dialog in the main window */
GetWindowRect(hWnd, &dlg_rt);
hwndMap = mswin_hwnd_from_winid(WIN_MAP);
GetWindowRect(IsWindow(hwndMap) ? hwndMap : GetNHApp()->hMainWnd,
&main_rt);
dlg_sz.cx = max(
dlg_rt.right - dlg_rt.left,
min(text_rt.right - text_rt.left + GetSystemMetrics(SM_CXICON),
main_rt.right - main_rt.left));
dlg_sz.cy =
min(dlg_rt.bottom - dlg_rt.top, main_rt.bottom - main_rt.top);
dlg_rt.left = (main_rt.left + main_rt.right - dlg_sz.cx) / 2;
dlg_rt.right = dlg_rt.left + dlg_sz.cx;
dlg_rt.top = (main_rt.top + main_rt.bottom - dlg_sz.cy) / 2;
dlg_rt.bottom = dlg_rt.top + dlg_sz.cy;
MoveWindow(hWnd, (main_rt.left + main_rt.right - dlg_sz.cx) / 2,
(main_rt.top + main_rt.bottom - dlg_sz.cy) / 2, dlg_sz.cx,
dlg_sz.cy, TRUE);
/* change layout of controls */
GetClientRect(hWnd, &dlg_rt);
control = GetDlgItem(hWnd, IDC_GETLIN_EDIT);
GetWindowRect(control, &edit_rt);
MoveWindow(control, 0, 0, dlg_rt.right - dlg_rt.left,
edit_rt.bottom - edit_rt.top, TRUE);
control = GetDlgItem(hWnd, IDOK);
GetWindowRect(control, &text_rt);
MoveWindow(control, 0, edit_rt.bottom - edit_rt.top,
(dlg_rt.right - dlg_rt.left) / 2,
text_rt.bottom - text_rt.top, TRUE);
control = GetDlgItem(hWnd, IDCANCEL);
GetWindowRect(control, &text_rt);
MoveWindow(control, (dlg_rt.right - dlg_rt.left) / 2,
edit_rt.bottom - edit_rt.top,
(dlg_rt.right - dlg_rt.left) / 2,
text_rt.bottom - text_rt.top, TRUE);
#if defined(WIN_CE_SMARTPHONE)
NHSPhoneDialogSetup(hWnd, IDC_SPHONE_DIALOGBAR, TRUE, FALSE);
#endif
/* set focus to the edit control */
SetFocus(GetDlgItem(hWnd, IDC_GETLIN_EDIT));
/* tell windows that we've set the focus */
return FALSE;
break;
case WM_COMMAND: {
TCHAR wbuf[BUFSZ];
switch (LOWORD(wParam)) {
/* OK button was pressed */
case IDOK:
data = (struct getlin_data *) GetWindowLong(hWnd, GWL_USERDATA);
SendDlgItemMessage(hWnd, IDC_GETLIN_EDIT, WM_GETTEXT,
(WPARAM) sizeof(wbuf), (LPARAM) wbuf);
NH_W2A(wbuf, data->result, data->result_size);
/* Fall through. */
/* cancel button was pressed */
case IDCANCEL:
EndDialog(hWnd, wParam);
return TRUE;
}
} break;
#if defined(WIN_CE_SMARTPHONE)
case WM_HOTKEY:
if (VK_TBACK == HIWORD(lParam)) {
SHSendBackToFocusWindow(message, wParam, lParam);
}
break;
#endif
} /* end switch (message) */
return FALSE;
}
/*---------------------------------------------------------------*/
/* dialog data for the list of extended commands */
struct extcmd_data {
int *selection;
};
LRESULT CALLBACK ExtCmdDlgProc(HWND, UINT, WPARAM, LPARAM);
int
mswin_ext_cmd_window(int *selection)
{
int ret;
struct extcmd_data data;
/* init dialog data */
ZeroMemory(&data, sizeof(data));
*selection = -1;
data.selection = selection;
/* create modal dialog window */
ret = DialogBoxParam(GetNHApp()->hApp, MAKEINTRESOURCE(IDD_EXTCMD),
GetNHApp()->hMainWnd, ExtCmdDlgProc, (LPARAM) &data);
if (ret == -1)
panic("Cannot create extcmd window");
return ret;
}
LRESULT CALLBACK
ExtCmdDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
struct extcmd_data *data;
RECT main_rt, dlg_rt;
SIZE dlg_sz;
int i;
const char *ptr;
TCHAR wbuf[255];
switch (message) {
case WM_INITDIALOG:
data = (struct extcmd_data *) lParam;
SetWindowLong(hWnd, GWL_USERDATA, lParam);
/* center dialog in the main window */
GetWindowRect(GetNHApp()->hMainWnd, &main_rt);
GetWindowRect(hWnd, &dlg_rt);
dlg_sz.cx = dlg_rt.right - dlg_rt.left;
dlg_sz.cy = dlg_rt.bottom - dlg_rt.top;
dlg_rt.left = (main_rt.left + main_rt.right - dlg_sz.cx) / 2;
dlg_rt.right = dlg_rt.left + dlg_sz.cx;
dlg_rt.top = (main_rt.top + main_rt.bottom - dlg_sz.cy) / 2;
dlg_rt.bottom = dlg_rt.top + dlg_sz.cy;
MoveWindow(hWnd, (main_rt.left + main_rt.right - dlg_sz.cx) / 2,
(main_rt.top + main_rt.bottom - dlg_sz.cy) / 2, dlg_sz.cx,
dlg_sz.cy, TRUE);
/* fill combobox with extended commands */
for (i = 0; (ptr = extcmdlist[i].ef_txt); i++) {
SendDlgItemMessage(hWnd, IDC_EXTCMD_LIST, LB_ADDSTRING,
(WPARAM) 0,
(LPARAM) NH_A2W(ptr, wbuf, sizeof(wbuf)));
}
#if defined(WIN_CE_SMARTPHONE)
NHSPhoneDialogSetup(hWnd, IDC_SPHONE_DIALOGBAR, FALSE, FALSE);
GetClientRect(hWnd, &dlg_rt);
MoveWindow(GetDlgItem(hWnd, IDC_EXTCMD_LIST), dlg_rt.left, dlg_rt.top,
dlg_rt.right - dlg_rt.left, dlg_rt.bottom - dlg_rt.top,
TRUE);
#endif
/* set focus to the list control */
SetFocus(GetDlgItem(hWnd, IDC_EXTCMD_LIST));
/* tell windows we set the focus */
return FALSE;
break;
case WM_COMMAND:
data = (struct extcmd_data *) GetWindowLong(hWnd, GWL_USERDATA);
switch (LOWORD(wParam)) {
/* OK button ws clicked */
case IDOK:
*data->selection = SendDlgItemMessage(
hWnd, IDC_EXTCMD_LIST, LB_GETCURSEL, (WPARAM) 0, (LPARAM) 0);
if (*data->selection == LB_ERR)
*data->selection = -1;
/* Fall through. */
/* CANCEL button ws clicked */
case IDCANCEL:
EndDialog(hWnd, wParam);
return TRUE;
/* list control events */
case IDC_EXTCMD_LIST:
switch (HIWORD(wParam)) {
case LBN_DBLCLK:
/* double click within the list
wParam
The low-order word is the list box identifier.
The high-order word is the notification message.
lParam
Handle to the list box
*/
*data->selection = SendMessage((HWND) lParam, LB_GETCURSEL,
(WPARAM) 0, (LPARAM) 0);
if (*data->selection == LB_ERR)
*data->selection = -1;
EndDialog(hWnd, IDOK);
return TRUE;
}
break;
}
}
return FALSE;
}
/*---------------------------------------------------------------*/
/* player selector dialog data */
struct plsel_data {
int *selection;
};
BOOL CALLBACK PlayerSelectorDlgProc(HWND, UINT, WPARAM, LPARAM);
static void plselInitDialog(HWND hWnd);
static void plselAdjustLists(HWND hWnd, int changed_opt);
static int plselFinalSelection(HWND hWnd, int *selection);
int
mswin_player_selection_window(int *selection)
{
int ret;
struct plsel_data data;
/* init dialog data */
ZeroMemory(&data, sizeof(data));
data.selection = selection;
/* create modal dialog */
ret = DialogBoxParam(
GetNHApp()->hApp, MAKEINTRESOURCE(IDD_PLAYER_SELECTOR),
GetNHApp()->hMainWnd, PlayerSelectorDlgProc, (LPARAM) &data);
if (ret == -1)
panic("Cannot create getlin window");
return ret;
}
BOOL CALLBACK
PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
struct plsel_data *data;
RECT main_rt, dlg_rt;
SIZE dlg_sz;
switch (message) {
case WM_INITDIALOG:
data = (struct plsel_data *) lParam;
SetWindowLong(hWnd, GWL_USERDATA, lParam);
/* center dialog in the main window */
GetWindowRect(GetNHApp()->hMainWnd, &main_rt);
GetWindowRect(hWnd, &dlg_rt);
dlg_sz.cx = dlg_rt.right - dlg_rt.left;
dlg_sz.cy = dlg_rt.bottom - dlg_rt.top;
dlg_rt.left = (main_rt.left + main_rt.right - dlg_sz.cx) / 2;
dlg_rt.right = dlg_rt.left + dlg_sz.cx;
dlg_rt.top = (main_rt.top + main_rt.bottom - dlg_sz.cy) / 2;
dlg_rt.bottom = dlg_rt.top + dlg_sz.cy;
MoveWindow(hWnd, (main_rt.left + main_rt.right - dlg_sz.cx) / 2,
(main_rt.top + main_rt.bottom - dlg_sz.cy) / 2, dlg_sz.cx,
dlg_sz.cy, TRUE);
/* init dialog */
plselInitDialog(hWnd);
#if defined(WIN_CE_SMARTPHONE)
NHSPhoneDialogSetup(hWnd, IDC_SPHONE_DIALOGBAR, FALSE, FALSE);
#endif
/* set focus on the role checkbox (random) field */
SetFocus(GetDlgItem(hWnd, IDC_PLSEL_ROLE_RANDOM));
/* tell windows we set the focus */
return FALSE;
break;
case WM_COMMAND:
data = (struct plsel_data *) GetWindowLong(hWnd, GWL_USERDATA);
switch (LOWORD(wParam)) {
/* OK button was clicked */
case IDOK:
if (plselFinalSelection(hWnd, data->selection)) {
EndDialog(hWnd, wParam);
} else {
MessageBox(
hWnd, TEXT("Cannot match this role. Try something else."),
TEXT("STOP"), MB_OK);
}
return TRUE;
/* CANCEL button was clicked */
case IDCANCEL:
*data->selection = -1;
EndDialog(hWnd, wParam);
return TRUE;
/* following are events from dialog controls:
"random" checkboxes send BN_CLICKED messages;
role/race/... combo-boxes send CBN_SELENDOK
if something was selected;
*/
case IDC_PLSEL_ROLE_RANDOM:
if (HIWORD(wParam) == BN_CLICKED) {
/* enable corresponding list window if "random"
checkbox was "unchecked" */
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ROLE_LIST),
SendMessage((HWND) lParam, BM_GETCHECK, 0, 0)
== BST_UNCHECKED);
}
break;
case IDC_PLSEL_RACE_RANDOM:
if (HIWORD(wParam) == BN_CLICKED) {
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_RACE_LIST),
SendMessage((HWND) lParam, BM_GETCHECK, 0, 0)
== BST_UNCHECKED);
}
break;
case IDC_PLSEL_GENDER_RANDOM:
if (HIWORD(wParam) == BN_CLICKED) {
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_GENDER_LIST),
SendMessage((HWND) lParam, BM_GETCHECK, 0, 0)
== BST_UNCHECKED);
}
break;
case IDC_PLSEL_ALIGN_RANDOM:
if (HIWORD(wParam) == BN_CLICKED) {
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ALIGN_LIST),
SendMessage((HWND) lParam, BM_GETCHECK, 0, 0)
== BST_UNCHECKED);
}
break;
case IDC_PLSEL_ROLE_LIST:
if (HIWORD(wParam) == CBN_SELENDOK) {
/* filter out invalid options if
the selection was made */
plselAdjustLists(hWnd, LOWORD(wParam));
}
break;
case IDC_PLSEL_RACE_LIST:
if (HIWORD(wParam) == CBN_SELENDOK) {
plselAdjustLists(hWnd, LOWORD(wParam));
}
break;
case IDC_PLSEL_GENDER_LIST:
if (HIWORD(wParam) == CBN_SELENDOK) {
plselAdjustLists(hWnd, LOWORD(wParam));
}
break;
case IDC_PLSEL_ALIGN_LIST:
if (HIWORD(wParam) == CBN_SELENDOK) {
plselAdjustLists(hWnd, LOWORD(wParam));
}
break;
}
break;
}
return FALSE;
}
void
setComboBoxValue(HWND hWnd, int combo_box, int value)
{
int index_max = SendDlgItemMessage(hWnd, combo_box, CB_GETCOUNT, 0, 0);
int index;
int value_to_set = LB_ERR;
for (index = 0; index < index_max; index++) {
if (SendDlgItemMessage(hWnd, combo_box, CB_GETITEMDATA,
(WPARAM) index, 0) == value) {
value_to_set = index;
break;
}
}
SendDlgItemMessage(hWnd, combo_box, CB_SETCURSEL, (WPARAM) value_to_set,
0);
}
/* initialize player selector dialog */
void
plselInitDialog(HWND hWnd)
{
TCHAR wbuf[BUFSZ];
/* set player name */
SetDlgItemText(hWnd, IDC_PLSEL_NAME, NH_A2W(g.plname, wbuf, sizeof(wbuf)));
/* check flags for consistency */
if (flags.initrole >= 0) {
if (flags.initrace >= 0
&& !validrace(flags.initrole, flags.initrace)) {
flags.initrace = ROLE_NONE;
}
if (flags.initgend >= 0
&& !validgend(flags.initrole, flags.initrace, flags.initgend)) {
flags.initgend = ROLE_NONE;
}
if (flags.initalign >= 0
&& !validalign(flags.initrole, flags.initrace, flags.initalign)) {
flags.initalign = ROLE_NONE;
}
}
/* populate select boxes */
plselAdjustLists(hWnd, -1);
/* intialize roles list */
if (flags.initrole < 0
|| !ok_role(flags.initrole, ROLE_NONE, ROLE_NONE, ROLE_NONE)) {
CheckDlgButton(hWnd, IDC_PLSEL_ROLE_RANDOM, BST_CHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ROLE_LIST), FALSE);
} else {
CheckDlgButton(hWnd, IDC_PLSEL_ROLE_RANDOM, BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ROLE_LIST), TRUE);
setComboBoxValue(hWnd, IDC_PLSEL_ROLE_LIST, flags.initrole);
}
/* intialize races list */
if (flags.initrace < 0
|| !ok_race(flags.initrole, flags.initrace, ROLE_NONE, ROLE_NONE)) {
CheckDlgButton(hWnd, IDC_PLSEL_RACE_RANDOM, BST_CHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_RACE_LIST), FALSE);
} else {
CheckDlgButton(hWnd, IDC_PLSEL_RACE_RANDOM, BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_RACE_LIST), TRUE);
setComboBoxValue(hWnd, IDC_PLSEL_RACE_LIST, flags.initrace);
}
/* intialize genders list */
if (flags.initgend < 0
|| !ok_gend(flags.initrole, flags.initrace, flags.initgend,
ROLE_NONE)) {
CheckDlgButton(hWnd, IDC_PLSEL_GENDER_RANDOM, BST_CHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_GENDER_LIST), FALSE);
} else {
CheckDlgButton(hWnd, IDC_PLSEL_GENDER_RANDOM, BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_GENDER_LIST), TRUE);
setComboBoxValue(hWnd, IDC_PLSEL_GENDER_LIST, flags.initgend);
}
/* intialize alignments list */
if (flags.initalign < 0
|| !ok_align(flags.initrole, flags.initrace, flags.initgend,
flags.initalign)) {
CheckDlgButton(hWnd, IDC_PLSEL_ALIGN_RANDOM, BST_CHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ALIGN_LIST), FALSE);
} else {
CheckDlgButton(hWnd, IDC_PLSEL_ALIGN_RANDOM, BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ALIGN_LIST), TRUE);
setComboBoxValue(hWnd, IDC_PLSEL_ALIGN_LIST, flags.initalign);
}
}
/* adjust role/race/alignment/gender list - filter out
invalid combinations
changed_sel points to the list where selection occurred
(-1 if unknown)
*/
void
plselAdjustLists(HWND hWnd, int changed_sel)
{
HWND control_role, control_race, control_gender, control_align;
int initrole, initrace, initgend, initalign;
int i;
int ind;
int valid_opt;
TCHAR wbuf[255];
/* get control handles */
control_role = GetDlgItem(hWnd, IDC_PLSEL_ROLE_LIST);
control_race = GetDlgItem(hWnd, IDC_PLSEL_RACE_LIST);
control_gender = GetDlgItem(hWnd, IDC_PLSEL_GENDER_LIST);
control_align = GetDlgItem(hWnd, IDC_PLSEL_ALIGN_LIST);
/* get current selections */
ind = SendMessage(control_role, CB_GETCURSEL, 0, 0);
initrole = (ind == LB_ERR)
? flags.initrole
: SendMessage(control_role, CB_GETITEMDATA, ind, 0);
ind = SendMessage(control_race, CB_GETCURSEL, 0, 0);
initrace = (ind == LB_ERR)
? flags.initrace
: SendMessage(control_race, CB_GETITEMDATA, ind, 0);
ind = SendMessage(control_gender, CB_GETCURSEL, 0, 0);
initgend = (ind == LB_ERR)
? flags.initgend
: SendMessage(control_gender, CB_GETITEMDATA, ind, 0);
ind = SendMessage(control_align, CB_GETCURSEL, 0, 0);
initalign = (ind == LB_ERR)
? flags.initalign
: SendMessage(control_align, CB_GETITEMDATA, ind, 0);
/* intialize roles list */
if (changed_sel == -1) {
valid_opt = 0;
/* reset content and populate the list */
SendMessage(control_role, CB_RESETCONTENT, 0, 0);
for (i = 0; roles[i].name.m; i++) {
if (ok_role(i, initrace, initgend, initalign)) {
if (initgend >= 0 && flags.female && roles[i].name.f)
ind = SendMessage(
control_role, CB_ADDSTRING, (WPARAM) 0,
(LPARAM) NH_A2W(roles[i].name.f, wbuf, sizeof(wbuf)));
else
ind = SendMessage(
control_role, CB_ADDSTRING, (WPARAM) 0,
(LPARAM) NH_A2W(roles[i].name.m, wbuf, sizeof(wbuf)));
SendMessage(control_role, CB_SETITEMDATA, (WPARAM) ind,
(LPARAM) i);
if (i == initrole) {
SendMessage(control_role, CB_SETCURSEL, (WPARAM) ind,
(LPARAM) 0);
valid_opt = 1;
}
}
}
/* set selection to the previously selected role
if it is still valid */
if (!valid_opt) {
initrole = ROLE_NONE;
initrace = ROLE_NONE;
initgend = ROLE_NONE;
initalign = ROLE_NONE;
SendMessage(control_role, CB_SETCURSEL, (WPARAM) -1, (LPARAM) 0);
}
/* trigger change of the races list */
changed_sel = IDC_PLSEL_ROLE_LIST;
}
/* intialize races list */
if (changed_sel == IDC_PLSEL_ROLE_LIST) {
valid_opt = 0;
/* reset content and populate the list */
SendMessage(control_race, CB_RESETCONTENT, 0, 0);
for (i = 0; races[i].noun; i++)
if (ok_race(initrole, i, ROLE_NONE, ROLE_NONE)) {
ind = SendMessage(
control_race, CB_ADDSTRING, (WPARAM) 0,
(LPARAM) NH_A2W(races[i].noun, wbuf, sizeof(wbuf)));
SendMessage(control_race, CB_SETITEMDATA, (WPARAM) ind,
(LPARAM) i);
if (i == initrace) {
SendMessage(control_race, CB_SETCURSEL, (WPARAM) ind,
(LPARAM) 0);
valid_opt = 1;
}
}
/* set selection to the previously selected race
if it is still valid */
if (!valid_opt) {
initrace = ROLE_NONE;
initgend = ROLE_NONE;
initalign = ROLE_NONE;
SendMessage(control_race, CB_SETCURSEL, (WPARAM) -1, (LPARAM) 0);
}
/* trigger change of the genders list */
changed_sel = IDC_PLSEL_RACE_LIST;
}
/* intialize genders list */
if (changed_sel == IDC_PLSEL_RACE_LIST) {
valid_opt = 0;
/* reset content and populate the list */
SendMessage(control_gender, CB_RESETCONTENT, 0, 0);
for (i = 0; i < ROLE_GENDERS; i++)
if (ok_gend(initrole, initrace, i, ROLE_NONE)) {
ind = SendMessage(
control_gender, CB_ADDSTRING, (WPARAM) 0,
(LPARAM) NH_A2W(genders[i].adj, wbuf, sizeof(wbuf)));
SendMessage(control_gender, CB_SETITEMDATA, (WPARAM) ind,
(LPARAM) i);
if (i == initgend) {
SendMessage(control_gender, CB_SETCURSEL, (WPARAM) ind,
(LPARAM) 0);
valid_opt = 1;
}
}
/* set selection to the previously selected gender
if it is still valid */
if (!valid_opt) {
initgend = ROLE_NONE;
initalign = ROLE_NONE;
SendMessage(control_gender, CB_SETCURSEL, (WPARAM) -1,
(LPARAM) 0);
}
/* trigger change of the alignments list */
changed_sel = IDC_PLSEL_GENDER_LIST;
}
/* intialize alignments list */
if (changed_sel == IDC_PLSEL_GENDER_LIST) {
valid_opt = 0;
/* reset content and populate the list */
SendMessage(control_align, CB_RESETCONTENT, 0, 0);
for (i = 0; i < ROLE_ALIGNS; i++)
if (ok_align(initrole, initrace, initgend, i)) {
ind = SendMessage(
control_align, CB_ADDSTRING, (WPARAM) 0,
(LPARAM) NH_A2W(aligns[i].adj, wbuf, sizeof(wbuf)));
SendMessage(control_align, CB_SETITEMDATA, (WPARAM) ind,
(LPARAM) i);
if (i == initalign) {
SendMessage(control_align, CB_SETCURSEL, (WPARAM) ind,
(LPARAM) 0);
valid_opt = 1;
}
}
/* set selection to the previously selected alignment
if it is still valid */
if (!valid_opt) {
initalign = ROLE_NONE;
SendMessage(control_align, CB_SETCURSEL, (WPARAM) -1, (LPARAM) 0);
}
}
}
/* player made up his mind - get final selection here */
int
plselFinalSelection(HWND hWnd, int *selection)
{
int ind;
/* get current selections */
if (SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_RANDOM, BM_GETCHECK, 0, 0)
== BST_CHECKED) {
flags.initrole = ROLE_RANDOM;
} else {
ind =
SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_LIST, CB_GETCURSEL, 0, 0);
flags.initrole = (ind == LB_ERR)
? ROLE_RANDOM
: SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_LIST,
CB_GETITEMDATA, ind, 0);
}
if (SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_RANDOM, BM_GETCHECK, 0, 0)
== BST_CHECKED) {
flags.initrace = ROLE_RANDOM;
} else {
ind =
SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_LIST, CB_GETCURSEL, 0, 0);
flags.initrace = (ind == LB_ERR)
? ROLE_RANDOM
: SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_LIST,
CB_GETITEMDATA, ind, 0);
}
if (SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_RANDOM, BM_GETCHECK, 0, 0)
== BST_CHECKED) {
flags.initgend = ROLE_RANDOM;
} else {
ind = SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_LIST, CB_GETCURSEL, 0,
0);
flags.initgend = (ind == LB_ERR)
? ROLE_RANDOM
: SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_LIST,
CB_GETITEMDATA, ind, 0);
}
if (SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_RANDOM, BM_GETCHECK, 0, 0)
== BST_CHECKED) {
flags.initalign = ROLE_RANDOM;
} else {
ind = SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_LIST, CB_GETCURSEL, 0,
0);
flags.initalign = (ind == LB_ERR)
? ROLE_RANDOM
: SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_LIST,
CB_GETITEMDATA, ind, 0);
}
/* check the role */
if (flags.initrole == ROLE_RANDOM) {
flags.initrole = pick_role(flags.initrace, flags.initgend,
flags.initalign, PICK_RANDOM);
if (flags.initrole < 0) {
MessageBox(hWnd, TEXT("Incompatible role!"), TEXT("STOP"), MB_OK);
return FALSE;
}
}
/* Select a race, if necessary */
/* force compatibility with role */
if (flags.initrace == ROLE_RANDOM
|| !validrace(flags.initrole, flags.initrace)) {
/* pre-selected race not valid */
if (flags.initrace == ROLE_RANDOM) {
flags.initrace = pick_race(flags.initrole, flags.initgend,
flags.initalign, PICK_RANDOM);
}
if (flags.initrace < 0) {
MessageBox(hWnd, TEXT("Incompatible race!"), TEXT("STOP"), MB_OK);
return FALSE;
}
}
/* Select a gender, if necessary */
/* force compatibility with role/race, try for compatibility with
* pre-selected alignment */
if (flags.initgend < 0
|| !validgend(flags.initrole, flags.initrace, flags.initgend)) {
/* pre-selected gender not valid */
if (flags.initgend == ROLE_RANDOM) {
flags.initgend = pick_gend(flags.initrole, flags.initrace,
flags.initalign, PICK_RANDOM);
}
if (flags.initgend < 0) {
MessageBox(hWnd, TEXT("Incompatible gender!"), TEXT("STOP"),
MB_OK);
return FALSE;
}
}
/* Select an alignment, if necessary */
/* force compatibility with role/race/gender */
if (flags.initalign < 0
|| !validalign(flags.initrole, flags.initrace, flags.initalign)) {
/* pre-selected alignment not valid */
if (flags.initalign == ROLE_RANDOM) {
flags.initalign = pick_align(flags.initrole, flags.initrace,
flags.initgend, PICK_RANDOM);
} else {
MessageBox(hWnd, TEXT("Incompatible alignment!"), TEXT("STOP"),
MB_OK);
return FALSE;
}
}
return TRUE;
}

View File

@@ -0,0 +1,17 @@
/* NetHack 3.6 mhdlg.h $NHDT-Date: 1432512802 2015/05/25 00:13:22 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#ifndef MSWINDlgWindow_h
#define MSWINDlgWindow_h
#include "winMS.h"
#include "config.h"
#include "global.h"
int mswin_getlin_window(const char *question, char *result,
size_t result_size);
int mswin_ext_cmd_window(int *selection);
int mswin_player_selection_window(int *selection);
#endif /* MSWINDlgWindow_h */

195
outdated/sys/wince/mhfont.c Normal file
View File

@@ -0,0 +1,195 @@
/* NetHack 3.6 mhfont.c $NHDT-Date: 1432512800 2015/05/25 00:13:20 $ $NHDT-Branch: master $:$NHDT-Revision: 1.18 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
/* font management and such */
#include "mhfont.h"
#define MAXFONTS 64
/* font table - 64 fonts ought to be enough */
static struct font_table_entry {
int code;
HFONT hFont;
} font_table[MAXFONTS];
static int font_table_size = 0;
HFONT version_splash_font;
HFONT extrainfo_splash_font;
#define NHFONT_CODE(win, attr) (((attr & 0xFF) << 8) | (win_type & 0xFF))
static void __cdecl font_table_cleanup(void);
/* create font based on window type, charater attributes and
window device context */
HGDIOBJ
mswin_get_font(int win_type, int attr, HDC hdc, BOOL replace)
{
HFONT fnt = NULL;
LOGFONT lgfnt;
int font_size;
int font_index;
static BOOL once = FALSE;
if (!once) {
once = TRUE;
atexit(font_table_cleanup);
}
ZeroMemory(&lgfnt, sizeof(lgfnt));
/* try find font in the table */
for (font_index = 0; font_index < font_table_size; font_index++)
if (NHFONT_CODE(win_type, attr) == font_table[font_index].code)
break;
if (!replace && font_index < font_table_size)
return font_table[font_index].hFont;
switch (win_type) {
case NHW_STATUS:
lgfnt.lfHeight = -iflags.wc_fontsiz_status
* GetDeviceCaps(hdc, LOGPIXELSY)
/ 72; // height of font
lgfnt.lfWidth = 0; // average character width
lgfnt.lfEscapement = 0; // angle of escapement
lgfnt.lfOrientation = 0; // base-line orientation angle
lgfnt.lfWeight = FW_NORMAL; // font weight
lgfnt.lfItalic = FALSE; // italic attribute option
lgfnt.lfUnderline = FALSE; // underline attribute option
lgfnt.lfStrikeOut = FALSE; // strikeout attribute option
lgfnt.lfCharSet = mswin_charset(); // character set identifier
lgfnt.lfOutPrecision = OUT_DEFAULT_PRECIS; // output precision
lgfnt.lfClipPrecision = CLIP_DEFAULT_PRECIS; // clipping precision
lgfnt.lfQuality = DEFAULT_QUALITY; // output quality
if (iflags.wc_font_status && *iflags.wc_font_status) {
lgfnt.lfPitchAndFamily = DEFAULT_PITCH; // pitch and family
NH_A2W(iflags.wc_font_status, lgfnt.lfFaceName, LF_FACESIZE);
} else {
lgfnt.lfPitchAndFamily = FIXED_PITCH; // pitch and family
}
break;
case NHW_MENU:
lgfnt.lfHeight = -iflags.wc_fontsiz_menu
* GetDeviceCaps(hdc, LOGPIXELSY)
/ 72; // height of font
lgfnt.lfWidth = 0; // average character width
lgfnt.lfEscapement = 0; // angle of escapement
lgfnt.lfOrientation = 0; // base-line orientation angle
lgfnt.lfWeight = (attr == ATR_BOLD || attr == ATR_INVERSE)
? FW_BOLD
: FW_NORMAL; // font weight
lgfnt.lfItalic =
(attr == ATR_BLINK) ? TRUE : FALSE; // italic attribute option
lgfnt.lfUnderline =
(attr == ATR_ULINE) ? TRUE : FALSE; // underline attribute option
lgfnt.lfStrikeOut = FALSE; // strikeout attribute option
lgfnt.lfCharSet = mswin_charset(); // character set identifier
lgfnt.lfOutPrecision = OUT_DEFAULT_PRECIS; // output precision
lgfnt.lfClipPrecision = CLIP_DEFAULT_PRECIS; // clipping precision
lgfnt.lfQuality = DEFAULT_QUALITY; // output quality
if (iflags.wc_font_menu && *iflags.wc_font_menu) {
lgfnt.lfPitchAndFamily = DEFAULT_PITCH; // pitch and family
NH_A2W(iflags.wc_font_menu, lgfnt.lfFaceName, LF_FACESIZE);
} else {
lgfnt.lfPitchAndFamily = FIXED_PITCH; // pitch and family
}
break;
case NHW_MESSAGE:
font_size = (attr == ATR_INVERSE) ? iflags.wc_fontsiz_message + 1
: iflags.wc_fontsiz_message;
lgfnt.lfHeight = -font_size * GetDeviceCaps(hdc, LOGPIXELSY)
/ 72; // height of font
lgfnt.lfWidth = 0; // average character width
lgfnt.lfEscapement = 0; // angle of escapement
lgfnt.lfOrientation = 0; // base-line orientation angle
lgfnt.lfWeight = (attr == ATR_BOLD || attr == ATR_INVERSE)
? FW_BOLD
: FW_NORMAL; // font weight
lgfnt.lfItalic =
(attr == ATR_BLINK) ? TRUE : FALSE; // italic attribute option
lgfnt.lfUnderline =
(attr == ATR_ULINE) ? TRUE : FALSE; // underline attribute option
lgfnt.lfStrikeOut = FALSE; // strikeout attribute option
lgfnt.lfCharSet = mswin_charset(); // character set identifier
lgfnt.lfOutPrecision = OUT_DEFAULT_PRECIS; // output precision
lgfnt.lfClipPrecision = CLIP_DEFAULT_PRECIS; // clipping precision
lgfnt.lfQuality = DEFAULT_QUALITY; // output quality
if (iflags.wc_font_message && *iflags.wc_font_message) {
lgfnt.lfPitchAndFamily = DEFAULT_PITCH; // pitch and family
NH_A2W(iflags.wc_font_message, lgfnt.lfFaceName, LF_FACESIZE);
} else {
lgfnt.lfPitchAndFamily = VARIABLE_PITCH; // pitch and family
}
break;
case NHW_TEXT:
lgfnt.lfHeight = -iflags.wc_fontsiz_text
* GetDeviceCaps(hdc, LOGPIXELSY)
/ 72; // height of font
lgfnt.lfWidth = 0; // average character width
lgfnt.lfEscapement = 0; // angle of escapement
lgfnt.lfOrientation = 0; // base-line orientation angle
lgfnt.lfWeight = (attr == ATR_BOLD || attr == ATR_INVERSE)
? FW_BOLD
: FW_NORMAL; // font weight
lgfnt.lfItalic =
(attr == ATR_BLINK) ? TRUE : FALSE; // italic attribute option
lgfnt.lfUnderline =
(attr == ATR_ULINE) ? TRUE : FALSE; // underline attribute option
lgfnt.lfStrikeOut = FALSE; // strikeout attribute option
lgfnt.lfCharSet = mswin_charset(); // character set identifier
lgfnt.lfOutPrecision = OUT_DEFAULT_PRECIS; // output precision
lgfnt.lfClipPrecision = CLIP_DEFAULT_PRECIS; // clipping precision
lgfnt.lfQuality = DEFAULT_QUALITY; // output quality
if (iflags.wc_font_text && *iflags.wc_font_text) {
lgfnt.lfPitchAndFamily = DEFAULT_PITCH; // pitch and family
NH_A2W(iflags.wc_font_text, lgfnt.lfFaceName, LF_FACESIZE);
} else {
lgfnt.lfPitchAndFamily = FIXED_PITCH; // pitch and family
}
break;
}
fnt = CreateFontIndirect(&lgfnt);
/* add font to the table */
if (font_index == font_table_size) {
if (font_table_size >= MAXFONTS)
panic("font table overflow!");
font_table_size++;
} else {
DeleteObject(font_table[font_index].hFont);
}
font_table[font_index].code = NHFONT_CODE(win_type, attr);
font_table[font_index].hFont = fnt;
return fnt;
}
UINT
mswin_charset()
{
CHARSETINFO cis;
if (SYMHANDLING(H_IBM))
if (TranslateCharsetInfo((DWORD *) GetOEMCP(), &cis, TCI_SRCCODEPAGE))
return cis.ciCharset;
else
return OEM_CHARSET;
else if (TranslateCharsetInfo((DWORD *) GetACP(), &cis, TCI_SRCCODEPAGE))
return cis.ciCharset;
else
return ANSI_CHARSET;
}
void __cdecl font_table_cleanup(void)
{
int i;
for (i = 0; i < font_table_size; i++) {
DeleteObject(font_table[i].hFont);
}
font_table_size = 0;
}

View File

@@ -0,0 +1,15 @@
/* NetHack 3.6 mhfont.h $NHDT-Date: 1432512798 2015/05/25 00:13:18 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
/* font management functions */
#ifndef MSWINFont_h
#define MSWINFont_h
#include "winMS.h"
HGDIOBJ mswin_get_font(int win_type, int attr, HDC hdc, BOOL replace);
UINT mswin_charset();
#endif /* MSWINFont_h */

View File

@@ -0,0 +1,118 @@
/* NetHack 3.6 mhinput.c $NHDT-Date: 1432512798 2015/05/25 00:13:18 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#include <assert.h>
#include "winMS.h"
#include "mhinput.h"
/* nethack input queue functions */
#define NH_INPUT_BUFFER_SIZE 64
/* as it stands right now we need only one slot
since events are processed almost the same time as
they occur but I like large round numbers */
static MSNHEvent nhi_input_buffer[NH_INPUT_BUFFER_SIZE];
static int nhi_init_input = 0;
static int nhi_read_pos = 0;
static int nhi_write_pos = 0;
/* initialize input queue */
void
mswin_nh_input_init()
{
if (!nhi_init_input) {
nhi_init_input = 1;
ZeroMemory(nhi_input_buffer, sizeof(nhi_input_buffer));
nhi_read_pos = 0;
nhi_write_pos = 0;
}
}
/* check for input */
int
mswin_have_input()
{
return
#ifdef SAFERHANGUP
/* we always have input (ESC) if hangup was requested */
g.program_state.done_hup ||
#endif
(nhi_read_pos != nhi_write_pos);
}
/* add event to the queue */
void
mswin_input_push(PMSNHEvent event)
{
int new_write_pos;
if (!nhi_init_input)
mswin_nh_input_init();
new_write_pos = (nhi_write_pos + 1) % NH_INPUT_BUFFER_SIZE;
if (new_write_pos != nhi_read_pos) {
memcpy(nhi_input_buffer + nhi_write_pos, event, sizeof(*event));
nhi_write_pos = new_write_pos;
}
}
/* get event from the queue and delete it */
PMSNHEvent
mswin_input_pop()
{
PMSNHEvent retval;
#ifdef SAFERHANGUP
/* always return ESC when hangup was requested */
if (g.program_state.done_hup) {
static MSNHEvent hangup_event;
hangup_event.type = NHEVENT_CHAR;
hangup_event.kbd.ch = '\033';
return &hangup_event;
}
#endif
if (!nhi_init_input)
mswin_nh_input_init();
if (nhi_read_pos != nhi_write_pos) {
retval = &nhi_input_buffer[nhi_read_pos];
nhi_read_pos = (nhi_read_pos + 1) % NH_INPUT_BUFFER_SIZE;
} else {
retval = NULL;
}
return retval;
}
/* get event from the queue but leave it there */
PMSNHEvent
mswin_input_peek()
{
PMSNHEvent retval;
#ifdef SAFERHANGUP
/* always return ESC when hangup was requested */
if (g.program_state.done_hup) {
static MSNHEvent hangup_event;
hangup_event.type = NHEVENT_CHAR;
hangup_event.kbd.ch = '\033';
return &hangup_event;
}
#endif
if (!nhi_init_input)
mswin_nh_input_init();
if (nhi_read_pos != nhi_write_pos) {
retval = &nhi_input_buffer[nhi_read_pos];
} else {
retval = NULL;
}
return retval;
}

View File

@@ -0,0 +1,50 @@
/* NetHack 3.6 mhinput.h $NHDT-Date: 1432512801 2015/05/25 00:13:21 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#ifndef MSWINInput_h
#define MSWINInput_h
/* nethack input queue - store/extract input events */
#include "winMS.h"
#define NHEVENT_CHAR 1
#define NHEVENT_MOUSE 2
typedef struct mswin_event {
int type;
union {
struct {
int ch;
} kbd;
struct {
int mod;
int x, y;
} ms;
};
} MSNHEvent, *PMSNHEvent;
#define NHEVENT_KBD(c) \
{ \
MSNHEvent e; \
e.type = NHEVENT_CHAR; \
e.kbd.ch = (c); \
mswin_input_push(&e); \
}
#define NHEVENT_MS(_mod, _x, _y) \
{ \
MSNHEvent e; \
e.type = NHEVENT_MOUSE; \
e.ms.mod = (_mod); \
e.ms.x = (_x); \
e.ms.y = (_y); \
mswin_input_push(&e); \
}
void mswin_nh_input_init();
int mswin_have_input();
void mswin_input_push(PMSNHEvent event);
PMSNHEvent mswin_input_pop();
PMSNHEvent mswin_input_peek();
#endif /* MSWINInput_h */

1151
outdated/sys/wince/mhmain.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,17 @@
/* NetHack 3.6 mhmain.h $NHDT-Date: 1432512799 2015/05/25 00:13:19 $ $NHDT-Branch: master $:$NHDT-Revision: 1.15 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#ifndef MSWINMainWindow_h
#define MSWINMainWindow_h
/* this is a main appliation window */
#include "winMS.h"
extern TCHAR szMainWindowClass[];
HWND mswin_init_main_window();
void mswin_layout_main_window(HWND changed_child);
void mswin_select_map_mode(int map_mode);
#endif /* MSWINMainWindow_h */

968
outdated/sys/wince/mhmap.c Normal file
View File

@@ -0,0 +1,968 @@
/* NetHack 3.6 mhmap.c $NHDT-Date: 1432512799 2015/05/25 00:13:19 $ $NHDT-Branch: master $:$NHDT-Revision: 1.40 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#include "winMS.h"
#include "mhmap.h"
#include "mhmsg.h"
#include "mhinput.h"
#include "mhfont.h"
#include "patchlevel.h"
#define NHMAP_FONT_NAME TEXT("Terminal")
#define MAXWINDOWTEXT 255
extern short glyph2tile[];
/* map window data */
typedef struct mswin_nethack_map_window {
int map[COLNO][ROWNO]; /* glyph map */
int mapMode; /* current map mode */
boolean bAsciiMode; /* switch ASCII/tiled mode */
boolean bFitToScreenMode; /* switch Fit map to screen mode on/off */
int xPos, yPos; /* scroll position */
int xPageSize, yPageSize; /* scroll page size */
int xCur, yCur; /* position of the cursor */
int xScrTile, yScrTile; /* size of display tile */
POINT map_orig; /* map origin point */
HFONT hMapFont; /* font for ASCII mode */
int xLastMouseClick, yLastMouseClick; /* last mouse click */
} NHMapWindow, *PNHMapWindow;
static TCHAR szNHMapWindowClass[] = TEXT("MSNethackMapWndClass");
LRESULT CALLBACK MapWndProc(HWND, UINT, WPARAM, LPARAM);
static void register_map_window_class(void);
static void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
static void onMSNH_VScroll(HWND hWnd, WPARAM wParam, LPARAM lParam);
static void onMSNH_HScroll(HWND hWnd, WPARAM wParam, LPARAM lParam);
static void onPaint(HWND hWnd);
static void onCreate(HWND hWnd, WPARAM wParam, LPARAM lParam);
static void nhcoord2display(PNHMapWindow data, int x, int y, LPRECT lpOut);
#if (VERSION_MAJOR < 4) && (VERSION_MINOR < 4) && (PATCHLEVEL < 2)
static void nhglyph2charcolor(short glyph, uchar *ch, int *color);
#endif
static COLORREF nhcolor_to_RGB(int c);
HWND
mswin_init_map_window()
{
static int run_once = 0;
HWND ret;
DWORD styles;
if (!run_once) {
register_map_window_class();
run_once = 1;
}
styles = WS_CHILD | WS_CLIPSIBLINGS;
if (!GetNHApp()->bHideScrollBars)
styles |= WS_HSCROLL | WS_VSCROLL;
ret = CreateWindow(
szNHMapWindowClass, /* registered class name */
NULL, /* window name */
styles, /* window style */
0, /* horizontal position of window - set it later */
0, /* vertical position of window - set it later */
0, /* window width - set it later */
0, /* window height - set it later*/
GetNHApp()->hMainWnd, /* handle to parent or owner window */
NULL, /* menu handle or child identifier */
GetNHApp()->hApp, /* handle to application instance */
NULL); /* window-creation data */
if (!ret) {
panic("Cannot create map window");
}
return ret;
}
void
mswin_map_stretch(HWND hWnd, LPSIZE lpsz, BOOL redraw)
{
PNHMapWindow data;
RECT client_rt;
SCROLLINFO si;
SIZE wnd_size;
LOGFONT lgfnt;
/* check arguments */
if (!IsWindow(hWnd) || !lpsz || lpsz->cx <= 0 || lpsz->cy <= 0)
return;
/* calculate window size */
GetClientRect(hWnd, &client_rt);
wnd_size.cx = client_rt.right - client_rt.left;
wnd_size.cy = client_rt.bottom - client_rt.top;
/* set new screen tile size */
data = (PNHMapWindow) GetWindowLong(hWnd, GWL_USERDATA);
data->xScrTile =
max(1, (data->bFitToScreenMode ? wnd_size.cx : lpsz->cx) / COLNO);
data->yScrTile =
max(1, (data->bFitToScreenMode ? wnd_size.cy : lpsz->cy) / ROWNO);
/* set map origin point */
data->map_orig.x =
max(0, client_rt.left + (wnd_size.cx - data->xScrTile * COLNO) / 2);
data->map_orig.y =
max(0, client_rt.top + (wnd_size.cy - data->yScrTile * ROWNO) / 2);
data->map_orig.x -= data->map_orig.x % data->xScrTile;
data->map_orig.y -= data->map_orig.y % data->yScrTile;
/* adjust horizontal scroll bar */
if (data->bFitToScreenMode)
data->xPageSize = COLNO + 1; /* disable scroll bar */
else
data->xPageSize = wnd_size.cx / data->xScrTile;
if (data->xPageSize >= COLNO) {
data->xPos = 0;
GetNHApp()->bNoHScroll = TRUE;
} else {
GetNHApp()->bNoHScroll = FALSE;
data->xPos = max(
0, min(COLNO - data->xPageSize + 1, u.ux - data->xPageSize / 2));
}
if (!GetNHApp()->bHideScrollBars) {
si.cbSize = sizeof(si);
si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
si.nMin = 0;
si.nMax = COLNO;
si.nPage = data->xPageSize;
si.nPos = data->xPos;
SetScrollInfo(hWnd, SB_HORZ, &si, TRUE);
}
/* adjust vertical scroll bar */
if (data->bFitToScreenMode)
data->yPageSize = ROWNO + 1; /* disable scroll bar */
else
data->yPageSize = wnd_size.cy / data->yScrTile;
if (data->yPageSize >= ROWNO) {
data->yPos = 0;
GetNHApp()->bNoVScroll = TRUE;
} else {
GetNHApp()->bNoVScroll = FALSE;
data->yPos = max(
0, min(ROWNO - data->yPageSize + 1, u.uy - data->yPageSize / 2));
}
if (!GetNHApp()->bHideScrollBars) {
si.cbSize = sizeof(si);
si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
si.nMin = 0;
si.nMax = ROWNO;
si.nPage = data->yPageSize;
si.nPos = data->yPos;
SetScrollInfo(hWnd, SB_VERT, &si, TRUE);
}
/* create font */
if (data->hMapFont)
DeleteObject(data->hMapFont);
ZeroMemory(&lgfnt, sizeof(lgfnt));
lgfnt.lfHeight = -data->yScrTile; // height of font
lgfnt.lfWidth = -data->xScrTile; // average character width
lgfnt.lfEscapement = 0; // angle of escapement
lgfnt.lfOrientation = 0; // base-line orientation angle
lgfnt.lfWeight = FW_NORMAL; // font weight
lgfnt.lfItalic = FALSE; // italic attribute option
lgfnt.lfUnderline = FALSE; // underline attribute option
lgfnt.lfStrikeOut = FALSE; // strikeout attribute option
lgfnt.lfCharSet = mswin_charset(); // character set identifier
lgfnt.lfOutPrecision = OUT_DEFAULT_PRECIS; // output precision
lgfnt.lfClipPrecision = CLIP_DEFAULT_PRECIS; // clipping precision
lgfnt.lfQuality = DEFAULT_QUALITY; // output quality
if (iflags.wc_font_map && *iflags.wc_font_map) {
lgfnt.lfPitchAndFamily = DEFAULT_PITCH; // pitch and family
NH_A2W(iflags.wc_font_map, lgfnt.lfFaceName, LF_FACESIZE);
} else {
lgfnt.lfPitchAndFamily = FIXED_PITCH; // pitch and family
_tcsncpy(lgfnt.lfFaceName, NHMAP_FONT_NAME, LF_FACESIZE);
}
data->hMapFont = CreateFontIndirect(&lgfnt);
mswin_cliparound(data->xCur, data->yCur);
if (redraw)
InvalidateRect(hWnd, NULL, TRUE);
}
/* set map mode */
int
mswin_map_mode(HWND hWnd, int mode)
{
PNHMapWindow data;
int oldMode;
SIZE mapSize;
data = (PNHMapWindow) GetWindowLong(hWnd, GWL_USERDATA);
if (mode == data->mapMode)
return mode;
oldMode = data->mapMode;
data->mapMode = mode;
switch (data->mapMode) {
case MAP_MODE_ASCII4x6:
data->bAsciiMode = TRUE;
data->bFitToScreenMode = FALSE;
mapSize.cx = 4 * COLNO;
mapSize.cy = 6 * ROWNO;
break;
case MAP_MODE_ASCII6x8:
data->bAsciiMode = TRUE;
data->bFitToScreenMode = FALSE;
mapSize.cx = 6 * COLNO;
mapSize.cy = 8 * ROWNO;
break;
case MAP_MODE_ASCII8x8:
data->bAsciiMode = TRUE;
data->bFitToScreenMode = FALSE;
mapSize.cx = 8 * COLNO;
mapSize.cy = 8 * ROWNO;
break;
case MAP_MODE_ASCII16x8:
data->bAsciiMode = TRUE;
data->bFitToScreenMode = FALSE;
mapSize.cx = 16 * COLNO;
mapSize.cy = 8 * ROWNO;
break;
case MAP_MODE_ASCII7x12:
data->bAsciiMode = TRUE;
data->bFitToScreenMode = FALSE;
mapSize.cx = 7 * COLNO;
mapSize.cy = 12 * ROWNO;
break;
case MAP_MODE_ASCII8x12:
data->bAsciiMode = TRUE;
data->bFitToScreenMode = FALSE;
mapSize.cx = 8 * COLNO;
mapSize.cy = 12 * ROWNO;
break;
case MAP_MODE_ASCII16x12:
data->bAsciiMode = TRUE;
data->bFitToScreenMode = FALSE;
mapSize.cx = 16 * COLNO;
mapSize.cy = 12 * ROWNO;
break;
case MAP_MODE_ASCII12x16:
data->bAsciiMode = TRUE;
data->bFitToScreenMode = FALSE;
mapSize.cx = 12 * COLNO;
mapSize.cy = 16 * ROWNO;
break;
case MAP_MODE_ASCII10x18:
data->bAsciiMode = TRUE;
data->bFitToScreenMode = FALSE;
mapSize.cx = 10 * COLNO;
mapSize.cy = 18 * ROWNO;
break;
case MAP_MODE_ASCII_FIT_TO_SCREEN: {
RECT client_rt;
GetClientRect(hWnd, &client_rt);
mapSize.cx = client_rt.right - client_rt.left;
mapSize.cy = client_rt.bottom - client_rt.top;
data->bAsciiMode = TRUE;
data->bFitToScreenMode = TRUE;
} break;
case MAP_MODE_TILES_FIT_TO_SCREEN: {
RECT client_rt;
GetClientRect(hWnd, &client_rt);
mapSize.cx = client_rt.right - client_rt.left;
mapSize.cy = client_rt.bottom - client_rt.top;
data->bAsciiMode = FALSE;
data->bFitToScreenMode = TRUE;
} break;
case MAP_MODE_TILES:
default:
data->bAsciiMode = FALSE;
data->bFitToScreenMode = FALSE;
mapSize.cx = GetNHApp()->mapTile_X * COLNO;
mapSize.cy = GetNHApp()->mapTile_Y * ROWNO;
break;
}
mswin_map_stretch(hWnd, &mapSize, TRUE);
return oldMode;
}
/* retrieve cursor position */
void
mswin_map_get_cursor(HWND hWnd, int *x, int *y)
{
PNHMapWindow data;
data = (PNHMapWindow) GetWindowLong(hWnd, GWL_USERDATA);
if (!data)
panic("mswin_map_get_cursor: no window data");
if (x)
*x = data->xCur;
if (y)
*y = data->yCur;
}
/* register window class for map window */
void
register_map_window_class()
{
WNDCLASS wcex;
ZeroMemory(&wcex, sizeof(wcex));
/* window class */
wcex.style = CS_NOCLOSE | CS_DBLCLKS;
wcex.lpfnWndProc = (WNDPROC) MapWndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = GetNHApp()->hApp;
wcex.hIcon = NULL;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground =
CreateSolidBrush(RGB(0, 0, 0)); /* set backgroup here */
wcex.lpszMenuName = NULL;
wcex.lpszClassName = szNHMapWindowClass;
if (!RegisterClass(&wcex)) {
panic("cannot register Map window class");
}
}
/* map window procedure */
LRESULT CALLBACK
MapWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PNHMapWindow data;
int x, y;
data = (PNHMapWindow) GetWindowLong(hWnd, GWL_USERDATA);
switch (message) {
case WM_CREATE:
onCreate(hWnd, wParam, lParam);
break;
case WM_MSNH_COMMAND:
onMSNHCommand(hWnd, wParam, lParam);
break;
case WM_PAINT:
onPaint(hWnd);
break;
case WM_SETFOCUS:
/* transfer focus back to the main window */
SetFocus(GetNHApp()->hMainWnd);
break;
case WM_HSCROLL:
onMSNH_HScroll(hWnd, wParam, lParam);
break;
case WM_VSCROLL:
onMSNH_VScroll(hWnd, wParam, lParam);
break;
case WM_SIZE: {
SIZE size;
if (data->bFitToScreenMode) {
size.cx = LOWORD(lParam);
size.cy = HIWORD(lParam);
} else {
/* mapping factor is unchaged we just need to adjust scroll bars
*/
size.cx = data->xScrTile * COLNO;
size.cy = data->yScrTile * ROWNO;
}
mswin_map_stretch(hWnd, &size, TRUE);
} break;
case WM_LBUTTONDOWN:
x = max(0, min(COLNO, data->xPos
+ (LOWORD(lParam) - data->map_orig.x)
/ data->xScrTile));
y = max(0, min(ROWNO, data->yPos
+ (HIWORD(lParam) - data->map_orig.y)
/ data->yScrTile));
NHEVENT_MS(CLICK_1, x, y);
data->xLastMouseClick = x;
data->yLastMouseClick = y;
return 0;
case WM_LBUTTONDBLCLK:
x = max(0, min(COLNO, data->xPos
+ (LOWORD(lParam) - data->map_orig.x)
/ data->xScrTile));
y = max(0, min(ROWNO, data->yPos
+ (HIWORD(lParam) - data->map_orig.y)
/ data->yScrTile));
/* if map has scrolled since the last mouse click - ignore
* double-click message */
if (data->xLastMouseClick == x && data->yLastMouseClick == y) {
NHEVENT_MS(CLICK_1, x, y);
}
return 0;
case WM_DESTROY:
if (data->hMapFont)
DeleteObject(data->hMapFont);
free(data);
SetWindowLong(hWnd, GWL_USERDATA, (LONG) 0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
/* on WM_COMMAND */
void
onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
PNHMapWindow data;
RECT rt;
data = (PNHMapWindow) GetWindowLong(hWnd, GWL_USERDATA);
switch (wParam) {
case MSNH_MSG_PRINT_GLYPH: {
PMSNHMsgPrintGlyph msg_data = (PMSNHMsgPrintGlyph) lParam;
data->map[msg_data->x][msg_data->y] = msg_data->glyph;
/* invalidate the update area */
nhcoord2display(data, msg_data->x, msg_data->y, &rt);
InvalidateRect(hWnd, &rt, TRUE);
} break;
case MSNH_MSG_CLIPAROUND: {
PMSNHMsgClipAround msg_data = (PMSNHMsgClipAround) lParam;
int x, y;
BOOL scroll_x, scroll_y;
int mcam = iflags.wc_scroll_margin;
/* calculate if you should clip around */
scroll_x =
!GetNHApp()->bNoHScroll
&& (msg_data->x < (data->xPos + mcam)
|| msg_data->x > (data->xPos + data->xPageSize - mcam));
scroll_y =
!GetNHApp()->bNoVScroll
&& (msg_data->y < (data->yPos + mcam)
|| msg_data->y > (data->yPos + data->yPageSize - mcam));
mcam += iflags.wc_scroll_amount - 1;
/* get page size and center horizontally on x-position */
if (scroll_x) {
if (data->xPageSize <= 2 * mcam) {
x = max(0, min(COLNO, msg_data->x - data->xPageSize / 2));
} else if (msg_data->x < data->xPos + data->xPageSize / 2) {
x = max(0, min(COLNO, msg_data->x - mcam));
} else {
x = max(0, min(COLNO, msg_data->x - data->xPageSize + mcam));
}
SendMessage(hWnd, WM_HSCROLL, (WPARAM) MAKELONG(SB_THUMBTRACK, x),
(LPARAM) NULL);
}
/* get page size and center vertically on y-position */
if (scroll_y) {
if (data->yPageSize <= 2 * mcam) {
y = max(0, min(ROWNO, msg_data->y - data->yPageSize / 2));
} else if (msg_data->y < data->yPos + data->yPageSize / 2) {
y = max(0, min(ROWNO, msg_data->y - mcam));
} else {
y = max(0, min(ROWNO, msg_data->y - data->yPageSize + mcam));
}
SendMessage(hWnd, WM_VSCROLL, (WPARAM) MAKELONG(SB_THUMBTRACK, y),
(LPARAM) NULL);
}
} break;
case MSNH_MSG_CLEAR_WINDOW: {
int i, j;
for (i = 0; i < COLNO; i++)
for (j = 0; j < ROWNO; j++) {
data->map[i][j] = -1;
}
InvalidateRect(hWnd, NULL, TRUE);
} break;
case MSNH_MSG_CURSOR: {
PMSNHMsgCursor msg_data = (PMSNHMsgCursor) lParam;
HDC hdc;
RECT rt;
/* move focus rectangle at the cursor postion */
hdc = GetDC(hWnd);
nhcoord2display(data, data->xCur, data->yCur, &rt);
if (data->bAsciiMode) {
PatBlt(hdc, rt.left, rt.top, rt.right - rt.left,
rt.bottom - rt.top, DSTINVERT);
} else {
DrawFocusRect(hdc, &rt);
}
data->xCur = msg_data->x;
data->yCur = msg_data->y;
nhcoord2display(data, data->xCur, data->yCur, &rt);
if (data->bAsciiMode) {
PatBlt(hdc, rt.left, rt.top, rt.right - rt.left,
rt.bottom - rt.top, DSTINVERT);
} else {
DrawFocusRect(hdc, &rt);
}
ReleaseDC(hWnd, hdc);
} break;
}
}
/* on WM_CREATE */
void
onCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
PNHMapWindow data;
int i, j;
/* set window data */
data = (PNHMapWindow) malloc(sizeof(NHMapWindow));
if (!data)
panic("out of memory");
ZeroMemory(data, sizeof(NHMapWindow));
for (i = 0; i < COLNO; i++)
for (j = 0; j < ROWNO; j++) {
data->map[i][j] = -1;
}
data->bAsciiMode = FALSE;
data->xScrTile = GetNHApp()->mapTile_X;
data->yScrTile = GetNHApp()->mapTile_Y;
data->xLastMouseClick = data->yLastMouseClick = -1;
SetWindowLong(hWnd, GWL_USERDATA, (LONG) data);
}
/* on WM_PAINT */
void
onPaint(HWND hWnd)
{
PNHMapWindow data;
PAINTSTRUCT ps;
HDC hDC;
HDC tileDC;
HGDIOBJ saveBmp;
RECT paint_rt;
int i, j;
/* get window data */
data = (PNHMapWindow) GetWindowLong(hWnd, GWL_USERDATA);
hDC = BeginPaint(hWnd, &ps);
/* calculate paint rectangle */
if (!IsRectEmpty(&ps.rcPaint)) {
/* calculate paint rectangle */
paint_rt.left =
max(data->xPos
+ (ps.rcPaint.left - data->map_orig.x) / data->xScrTile,
0);
paint_rt.top = max(
data->yPos + (ps.rcPaint.top - data->map_orig.y) / data->yScrTile,
0);
paint_rt.right = min(
data->xPos
+ (ps.rcPaint.right - data->map_orig.x) / data->xScrTile + 1,
COLNO);
paint_rt.bottom = min(
data->yPos
+ (ps.rcPaint.bottom - data->map_orig.y) / data->yScrTile + 1,
ROWNO);
if (data->bAsciiMode || Is_rogue_level(&u.uz)) {
/* You enter a VERY primitive world! */
HGDIOBJ oldFont;
oldFont = SelectObject(hDC, data->hMapFont);
SetBkMode(hDC, TRANSPARENT);
/* draw the map */
for (i = paint_rt.left; i < paint_rt.right; i++)
for (j = paint_rt.top; j < paint_rt.bottom; j++)
if (data->map[i][j] >= 0) {
char ch;
TCHAR wch;
RECT glyph_rect;
int color;
unsigned special;
int mgch;
HBRUSH back_brush;
COLORREF OldFg;
nhcoord2display(data, i, j, &glyph_rect);
#if (VERSION_MAJOR < 4) && (VERSION_MINOR < 4) && (PATCHLEVEL < 2)
nhglyph2charcolor(data->map[i][j], &ch, &color);
OldFg = SetTextColor(hDC, nhcolor_to_RGB(color));
#else
/* rely on NetHack core helper routine */
(void) mapglyph(data->map[i][j], &mgch, &color,
&special, i, j, 0);
ch = (char) mgch;
if (((special & MG_PET) && iflags.hilite_pet)
|| ((special & MG_DETECT)
&& iflags.use_inverse)) {
back_brush =
CreateSolidBrush(nhcolor_to_RGB(CLR_GRAY));
FillRect(hDC, &glyph_rect, back_brush);
DeleteObject(back_brush);
switch (color) {
case CLR_GRAY:
case CLR_WHITE:
OldFg = SetTextColor(
hDC, nhcolor_to_RGB(CLR_BLACK));
break;
default:
OldFg =
SetTextColor(hDC, nhcolor_to_RGB(color));
}
} else {
OldFg = SetTextColor(hDC, nhcolor_to_RGB(color));
}
#endif
DrawText(hDC, NH_A2W(&ch, &wch, 1), 1, &glyph_rect,
DT_CENTER | DT_VCENTER | DT_NOPREFIX);
SetTextColor(hDC, OldFg);
}
SelectObject(hDC, oldFont);
} else {
/* prepare tiles DC for mapping */
tileDC = CreateCompatibleDC(hDC);
saveBmp = SelectObject(tileDC, GetNHApp()->bmpMapTiles);
/* draw the map */
for (i = paint_rt.left; i < paint_rt.right; i++)
for (j = paint_rt.top; j < paint_rt.bottom; j++)
if (data->map[i][j] >= 0) {
short ntile;
int t_x, t_y;
RECT glyph_rect;
ntile = glyph2tile[data->map[i][j]];
t_x = (ntile % GetNHApp()->mapTilesPerLine)
* GetNHApp()->mapTile_X;
t_y = (ntile / GetNHApp()->mapTilesPerLine)
* GetNHApp()->mapTile_Y;
nhcoord2display(data, i, j, &glyph_rect);
StretchBlt(hDC, glyph_rect.left, glyph_rect.top,
data->xScrTile, data->yScrTile, tileDC,
t_x, t_y, GetNHApp()->mapTile_X,
GetNHApp()->mapTile_Y, SRCCOPY);
if (glyph_is_pet(data->map[i][j])
&& iflags.wc_hilite_pet) {
/* apply pet mark transparently over
pet image */
HDC hdcPetMark;
HBITMAP bmPetMarkOld;
/* this is DC for petmark bitmap */
hdcPetMark = CreateCompatibleDC(hDC);
bmPetMarkOld = SelectObject(
hdcPetMark, GetNHApp()->bmpPetMark);
nhapply_image_transparent(
hDC, glyph_rect.left, glyph_rect.top,
data->xScrTile, data->yScrTile, hdcPetMark, 0,
0, TILE_X, TILE_Y, TILE_BK_COLOR);
SelectObject(hdcPetMark, bmPetMarkOld);
DeleteDC(hdcPetMark);
}
}
SelectObject(tileDC, saveBmp);
DeleteDC(tileDC);
}
/* draw focus rect */
nhcoord2display(data, data->xCur, data->yCur, &paint_rt);
if (data->bAsciiMode) {
PatBlt(hDC, paint_rt.left, paint_rt.top,
paint_rt.right - paint_rt.left,
paint_rt.bottom - paint_rt.top, DSTINVERT);
} else {
DrawFocusRect(hDC, &paint_rt);
}
}
EndPaint(hWnd, &ps);
}
/* on WM_VSCROLL */
void
onMSNH_VScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
PNHMapWindow data;
SCROLLINFO si;
int yNewPos;
int yDelta;
/* get window data */
data = (PNHMapWindow) GetWindowLong(hWnd, GWL_USERDATA);
switch (LOWORD(wParam)) {
/* User clicked shaft left of the scroll box. */
case SB_PAGEUP:
yNewPos = data->yPos - data->yPageSize;
break;
/* User clicked shaft right of the scroll box. */
case SB_PAGEDOWN:
yNewPos = data->yPos + data->yPageSize;
break;
/* User clicked the left arrow. */
case SB_LINEUP:
yNewPos = data->yPos - 1;
break;
/* User clicked the right arrow. */
case SB_LINEDOWN:
yNewPos = data->yPos + 1;
break;
/* User dragged the scroll box. */
case SB_THUMBTRACK:
yNewPos = HIWORD(wParam);
break;
default:
yNewPos = data->yPos;
}
yNewPos = max(0, min(ROWNO - data->yPageSize + 1, yNewPos));
if (yNewPos == data->yPos)
return;
yDelta = yNewPos - data->yPos;
data->yPos = yNewPos;
ScrollWindowEx(hWnd, 0, -data->yScrTile * yDelta, (CONST RECT *) NULL,
(CONST RECT *) NULL, (HRGN) NULL, (LPRECT) NULL,
SW_INVALIDATE | SW_ERASE);
if (!GetNHApp()->bHideScrollBars) {
si.cbSize = sizeof(si);
si.fMask = SIF_POS;
si.nPos = data->yPos;
SetScrollInfo(hWnd, SB_VERT, &si, TRUE);
}
}
/* on WM_HSCROLL */
void
onMSNH_HScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
PNHMapWindow data;
SCROLLINFO si;
int xNewPos;
int xDelta;
/* get window data */
data = (PNHMapWindow) GetWindowLong(hWnd, GWL_USERDATA);
switch (LOWORD(wParam)) {
/* User clicked shaft left of the scroll box. */
case SB_PAGEUP:
xNewPos = data->xPos - data->xPageSize;
break;
/* User clicked shaft right of the scroll box. */
case SB_PAGEDOWN:
xNewPos = data->xPos + data->xPageSize;
break;
/* User clicked the left arrow. */
case SB_LINEUP:
xNewPos = data->xPos - 1;
break;
/* User clicked the right arrow. */
case SB_LINEDOWN:
xNewPos = data->xPos + 1;
break;
/* User dragged the scroll box. */
case SB_THUMBTRACK:
xNewPos = HIWORD(wParam);
break;
default:
xNewPos = data->xPos;
}
xNewPos = max(0, min(COLNO - data->xPageSize + 1, xNewPos));
if (xNewPos == data->xPos)
return;
xDelta = xNewPos - data->xPos;
data->xPos = xNewPos;
ScrollWindowEx(hWnd, -data->xScrTile * xDelta, 0, (CONST RECT *) NULL,
(CONST RECT *) NULL, (HRGN) NULL, (LPRECT) NULL,
SW_INVALIDATE | SW_ERASE);
if (!GetNHApp()->bHideScrollBars) {
si.cbSize = sizeof(si);
si.fMask = SIF_POS;
si.nPos = data->xPos;
SetScrollInfo(hWnd, SB_HORZ, &si, TRUE);
}
}
/* map nethack map coordinates to the screen location */
void
nhcoord2display(PNHMapWindow data, int x, int y, LPRECT lpOut)
{
lpOut->left = (x - data->xPos) * data->xScrTile + data->map_orig.x;
lpOut->top = (y - data->yPos) * data->yScrTile + data->map_orig.y;
lpOut->right = lpOut->left + data->xScrTile;
lpOut->bottom = lpOut->top + data->yScrTile;
}
#if (VERSION_MAJOR < 4) && (VERSION_MINOR < 4) && (PATCHLEVEL < 2)
/* map glyph to character/color combination */
void
nhglyph2charcolor(short g, uchar *ch, int *color)
{
int offset;
#ifdef TEXTCOLOR
#define zap_color(n) *color = iflags.use_color ? zapcolors[n] : NO_COLOR
#define cmap_color(n) *color = iflags.use_color ? defsyms[n].color : NO_COLOR
#define obj_color(n) \
*color = iflags.use_color ? objects[n].oc_color : NO_COLOR
#define mon_color(n) *color = iflags.use_color ? mons[n].mcolor : NO_COLOR
#define pet_color(n) *color = iflags.use_color ? mons[n].mcolor : NO_COLOR
#define warn_color(n) \
*color = iflags.use_color ? def_warnsyms[n].color : NO_COLOR
#else /* no text color */
#define zap_color(n)
#define cmap_color(n)
#define obj_color(n)
#define mon_color(n)
#define pet_color(c)
#define warn_color(c)
*color = CLR_WHITE;
#endif
if ((offset = (g - GLYPH_WARNING_OFF)) >= 0) { /* a warning flash */
*ch = showsyms[offset + SYM_OFF_W];
warn_color(offset);
} else if ((offset = (g - GLYPH_SWALLOW_OFF)) >= 0) { /* swallow */
/* see swallow_to_glyph() in display.c */
*ch = (uchar) showsyms[(S_sw_tl + (offset & 0x7)) + SYM_OFF_P];
mon_color(offset >> 3);
} else if ((offset = (g - GLYPH_ZAP_OFF)) >= 0) { /* zap beam */
/* see zapdir_to_glyph() in display.c */
*ch = showsyms[(S_vbeam + (offset & 0x3)) + SYM_OFF_P];
zap_color((offset >> 2));
} else if ((offset = (g - GLYPH_CMAP_OFF)) >= 0) { /* cmap */
*ch = showsyms[offset + SYM_OFF_P];
cmap_color(offset);
} else if ((offset = (g - GLYPH_OBJ_OFF)) >= 0) { /* object */
*ch = showsyms[(int) objects[offset].oc_class + SYM_OFF_O];
obj_color(offset);
} else if ((offset = (g - GLYPH_BODY_OFF)) >= 0) { /* a corpse */
*ch = showsyms[(int) objects[CORPSE].oc_class + SYM_OFF_O];
mon_color(offset);
} else if ((offset = (g - GLYPH_PET_OFF)) >= 0) { /* a pet */
*ch = showsyms[(int) mons[offset].mlet + SYM_OFF_M];
pet_color(offset);
} else { /* a monster */
*ch = showsyms[(int) mons[g].mlet + SYM_OFF_M];
mon_color(g);
}
// end of wintty code
}
#endif
/* map nethack color to RGB */
COLORREF
nhcolor_to_RGB(int c)
{
switch (c) {
case CLR_BLACK:
return RGB(0x55, 0x55, 0x55);
case CLR_RED:
return RGB(0xFF, 0x00, 0x00);
case CLR_GREEN:
return RGB(0x00, 0x80, 0x00);
case CLR_BROWN:
return RGB(0xA5, 0x2A, 0x2A);
case CLR_BLUE:
return RGB(0x00, 0x00, 0xFF);
case CLR_MAGENTA:
return RGB(0xFF, 0x00, 0xFF);
case CLR_CYAN:
return RGB(0x00, 0xFF, 0xFF);
case CLR_GRAY:
return RGB(0xC0, 0xC0, 0xC0);
case NO_COLOR:
return RGB(0xFF, 0xFF, 0xFF);
case CLR_ORANGE:
return RGB(0xFF, 0xA5, 0x00);
case CLR_BRIGHT_GREEN:
return RGB(0x00, 0xFF, 0x00);
case CLR_YELLOW:
return RGB(0xFF, 0xFF, 0x00);
case CLR_BRIGHT_BLUE:
return RGB(0x00, 0xC0, 0xFF);
case CLR_BRIGHT_MAGENTA:
return RGB(0xFF, 0x80, 0xFF);
case CLR_BRIGHT_CYAN:
return RGB(0x80, 0xFF, 0xFF); /* something close to aquamarine */
case CLR_WHITE:
return RGB(0xFF, 0xFF, 0xFF);
default:
return RGB(0x00, 0x00, 0x00); /* black */
}
}
/* apply bitmap pointed by sourceDc transparently over
bitmap pointed by hDC */
void
nhapply_image_transparent(HDC hDC, int x, int y, int width, int height,
HDC sourceDC, int s_x, int s_y, int s_width,
int s_height, COLORREF cTransparent)
{
TransparentImage(hDC, x, y, width, height, sourceDC, s_x, s_y, s_width,
s_height, cTransparent);
}

View File

@@ -0,0 +1,22 @@
/* NetHack 3.6 mhmap.h $NHDT-Date: 1432512799 2015/05/25 00:13:19 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#ifndef MSWINMapWindow_h
#define MSWINMapWindow_h
#include "winMS.h"
#include "config.h"
#include "global.h"
HWND mswin_init_map_window(void);
void mswin_map_stretch(HWND hWnd, LPSIZE lpsz, BOOL redraw);
int mswin_map_mode(HWND hWnd, int mode);
void mswin_map_get_cursor(HWND hWnd, int *x, int *y);
#define ROGUE_LEVEL_MAP_MODE MAP_MODE_ASCII12x16
#define DEF_CLIPAROUND_MARGIN 5
#define DEF_CLIPAROUND_AMOUNT 1
#endif /* MSWINMapWindow_h */

1613
outdated/sys/wince/mhmenu.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,20 @@
/* NetHack may be freely redistributed. See license for details. */
/*
* $NHDT-Date: 1432512802 2015/05/25 00:13:22 $ $NHDT-Branch: master $:$NHDT-Revision: 1.5 $
*/
#ifndef MSWINMenuWindow_h
#define MSWINMenuWindow_h
#include "winMS.h"
#include "config.h"
#include "global.h"
#define MENU_TYPE_TEXT 1
#define MENU_TYPE_MENU 2
HWND mswin_init_menu_window(int type);
int mswin_menu_window_select_menu(HWND hwnd, int how, MENU_ITEM_P **);
void mswin_menu_window_size(HWND hwnd, LPSIZE sz);
#endif /* MSWINTextWindow_h */

View File

@@ -0,0 +1,61 @@
/* NetHack 3.6 mhmsg.h $NHDT-Date: 1432512800 2015/05/25 00:13:20 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#ifndef MHNethackMessages_H
#define MHNethackMessages_H
/* nethack messages */
#define WM_MSNH_COMMAND (WM_APP + 1)
#define MSNH_MSG_ADDWND 100
#define MSNH_MSG_PUTSTR 101
#define MSNH_MSG_PRINT_GLYPH 102
#define MSNH_MSG_CLEAR_WINDOW 103
#define MSNH_MSG_CLIPAROUND 104
#define MSNH_MSG_STARTMENU 105
#define MSNH_MSG_ADDMENU 106
#define MSNH_MSG_CURSOR 107
#define MSNH_MSG_ENDMENU 108
typedef struct mswin_nhmsg_add_wnd {
winid wid;
} MSNHMsgAddWnd, *PMSNHMsgAddWnd;
typedef struct mswin_nhmsg_putstr {
int attr;
const char *text;
boolean append;
} MSNHMsgPutstr, *PMSNHMsgPutstr;
typedef struct mswin_nhmsg_print_glyph {
XCHAR_P x;
XCHAR_P y;
int glyph;
} MSNHMsgPrintGlyph, *PMSNHMsgPrintGlyph;
typedef struct mswin_nhmsg_cliparound {
int x;
int y;
} MSNHMsgClipAround, *PMSNHMsgClipAround;
typedef struct mswin_nhmsg_add_menu {
int glyph;
const ANY_P *identifier;
CHAR_P accelerator;
CHAR_P group_accel;
int attr;
const char *str;
unsigned int itemflags;
} MSNHMsgAddMenu, *PMSNHMsgAddMenu;
typedef struct mswin_nhmsg_cursor {
int x;
int y;
} MSNHMsgCursor, *PMSNHMsgCursor;
typedef struct mswin_nhmsg_end_menu {
const char *text;
} MSNHMsgEndMenu, *PMSNHMsgEndMenu;
#endif

View File

@@ -0,0 +1,619 @@
/* NetHack 3.6 mhmsgwnd.c $NHDT-Date: 1432512802 2015/05/25 00:13:22 $ $NHDT-Branch: master $:$NHDT-Revision: 1.20 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#include "winMS.h"
#include "mhmsgwnd.h"
#include "mhmsg.h"
#include "mhcmd.h"
#include "mhfont.h"
#include "mhcolor.h"
#define MSG_WRAP_TEXT
#define MSG_VISIBLE_LINES max(iflags.wc_vary_msgcount, 2)
#define MAX_MSG_LINES 32
#define MSG_LINES (int) min(iflags.msg_history, MAX_MSG_LINES)
#define MAXWINDOWTEXT 200
struct window_line {
int attr;
char text[MAXWINDOWTEXT];
};
typedef struct mswin_nethack_message_window {
size_t max_text;
struct window_line window_text[MAX_MSG_LINES];
int xChar; /* horizontal scrolling unit */
int yChar; /* vertical scrolling unit */
int xUpper; /* average width of uppercase letters */
int xPos; /* current horizontal scrolling position */
int yPos; /* current vertical scrolling position */
int xMax; /* maximum horizontal scrolling position */
int yMax; /* maximum vertical scrolling position */
int xPage; /* page size of horizontal scroll bar */
int lines_last_turn; /* lines added during the last turn */
int dont_care; /* flag the user does not care if messages are lost */
} NHMessageWindow, *PNHMessageWindow;
static TCHAR szMessageWindowClass[] = TEXT("MSNHMessageWndClass");
LRESULT CALLBACK NHMessageWndProc(HWND, UINT, WPARAM, LPARAM);
static void register_message_window_class();
static void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
static void onMSNH_VScroll(HWND hWnd, WPARAM wParam, LPARAM lParam);
#ifndef MSG_WRAP_TEXT
static void onMSNH_HScroll(HWND hWnd, WPARAM wParam, LPARAM lParam);
#endif
static COLORREF setMsgTextColor(HDC hdc, int gray);
static void onPaint(HWND hWnd);
static void onCreate(HWND hWnd, WPARAM wParam, LPARAM lParam);
#ifdef USER_SOUNDS
extern void play_sound_for_message(const char *str);
#endif
HWND
mswin_init_message_window()
{
static int run_once = 0;
HWND ret;
DWORD style;
if (!run_once) {
register_message_window_class();
run_once = 1;
}
#ifdef MSG_WRAP_TEXT
style = WS_BORDER | WS_CHILD | WS_CLIPSIBLINGS | WS_VSCROLL;
#else
style = WS_BORDER | WS_CHILD | WS_CLIPSIBLINGS | WS_VSCROLL | WS_HSCROLL;
#endif
ret = CreateWindow(
szMessageWindowClass, /* registered class name */
NULL, /* window name */
style, /* window style */
0, /* horizontal position of window */
0, /* vertical position of window */
0, /* window width */
0, /* window height - set it later */
GetNHApp()->hMainWnd, /* handle to parent or owner window */
NULL, /* menu handle or child identifier */
GetNHApp()->hApp, /* handle to application instance */
NULL); /* window-creation data */
if (!ret)
panic("Cannot create message window");
return ret;
}
void
register_message_window_class()
{
WNDCLASS wcex;
ZeroMemory(&wcex, sizeof(wcex));
wcex.style = CS_NOCLOSE;
wcex.lpfnWndProc = (WNDPROC) NHMessageWndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = GetNHApp()->hApp;
wcex.hIcon = NULL;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = mswin_get_brush(NHW_MESSAGE, MSWIN_COLOR_BG);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = szMessageWindowClass;
RegisterClass(&wcex);
}
LRESULT CALLBACK
NHMessageWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_CREATE:
onCreate(hWnd, wParam, lParam);
break;
case WM_MSNH_COMMAND:
onMSNHCommand(hWnd, wParam, lParam);
break;
case WM_PAINT:
onPaint(hWnd);
break;
case WM_SETFOCUS:
SetFocus(GetNHApp()->hMainWnd);
break;
#ifndef MSG_WRAP_TEXT
case WM_HSCROLL:
onMSNH_HScroll(hWnd, wParam, lParam);
break;
#endif
case WM_VSCROLL:
onMSNH_VScroll(hWnd, wParam, lParam);
break;
case WM_DESTROY: {
PNHMessageWindow data;
data = (PNHMessageWindow) GetWindowLong(hWnd, GWL_USERDATA);
free(data);
SetWindowLong(hWnd, GWL_USERDATA, (LONG) 0);
} break;
case WM_SIZE: {
SCROLLINFO si;
int xNewSize;
int yNewSize;
PNHMessageWindow data;
data = (PNHMessageWindow) GetWindowLong(hWnd, GWL_USERDATA);
xNewSize = LOWORD(lParam);
yNewSize = HIWORD(lParam);
if (xNewSize > 0 || yNewSize > 0) {
#ifndef MSG_WRAP_TEXT
data->xPage = xNewSize / data->xChar;
data->xMax = max(0, (int) (1 + data->max_text - data->xPage));
data->xPos = min(data->xPos, data->xMax);
ZeroMemory(&si, sizeof(si));
si.cbSize = sizeof(si);
si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
si.nMin = 0;
si.nMax = data->max_text;
si.nPage = data->xPage;
si.nPos = data->xPos;
SetScrollInfo(hWnd, SB_HORZ, &si, TRUE);
#endif
data->yMax = MSG_LINES - 1;
data->yPos = min(data->yPos, data->yMax);
ZeroMemory(&si, sizeof(si));
si.cbSize = sizeof(si);
si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
si.nMin = MSG_VISIBLE_LINES;
si.nMax = data->yMax + MSG_VISIBLE_LINES - 1;
si.nPage = MSG_VISIBLE_LINES;
si.nPos = data->yPos;
SetScrollInfo(hWnd, SB_VERT, &si, TRUE);
}
} break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
void
onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
PNHMessageWindow data;
data = (PNHMessageWindow) GetWindowLong(hWnd, GWL_USERDATA);
switch (wParam) {
case MSNH_MSG_PUTSTR: {
PMSNHMsgPutstr msg_data = (PMSNHMsgPutstr) lParam;
SCROLLINFO si;
char *p;
if (msg_data->append) {
strncat(data->window_text[MSG_LINES - 1].text, msg_data->text,
MAXWINDOWTEXT
- strlen(data->window_text[MSG_LINES - 1].text));
} else {
/* check if the string is empty */
for (p = data->window_text[MSG_LINES - 1].text; *p && isspace(*p);
p++)
;
if (*p) {
/* last string is not empty - scroll up */
memmove(&data->window_text[0], &data->window_text[1],
(MSG_LINES - 1) * sizeof(data->window_text[0]));
}
/* append new text to the end of the array */
data->window_text[MSG_LINES - 1].attr = msg_data->attr;
strncpy(data->window_text[MSG_LINES - 1].text, msg_data->text,
MAXWINDOWTEXT);
}
/* reset V-scroll position to display new text */
data->yPos = data->yMax;
ZeroMemory(&si, sizeof(si));
si.cbSize = sizeof(si);
si.fMask = SIF_POS;
si.nPos = data->yPos;
SetScrollInfo(hWnd, SB_VERT, &si, TRUE);
/* deal with overflows */
data->lines_last_turn++;
if (!data->dont_care && data->lines_last_turn >= MSG_LINES - 2) {
char c;
BOOL done;
/* append "--More--" to the message window text (cannot call
putstr
here - infinite recursion) */
memmove(&data->window_text[0], &data->window_text[1],
(MSG_LINES - 1) * sizeof(data->window_text[0]));
data->window_text[MSG_LINES - 1].attr = ATR_NONE;
strncpy(data->window_text[MSG_LINES - 1].text, "--More--",
MAXWINDOWTEXT);
/* update window content */
InvalidateRect(hWnd, NULL, TRUE);
#if defined(WIN_CE_SMARTPHONE)
NHSPhoneSetKeypadFromString("\033- <>");
#endif
done = FALSE;
while (!done) {
int x, y, mod;
c = mswin_nh_poskey(&x, &y, &mod);
switch (c) {
/* ESC indicates that we can safely discard any further
* messages during this turn */
case '\033':
data->dont_care = 1;
done = TRUE;
break;
case '<':
SendMessage(hWnd, WM_VSCROLL, MAKEWPARAM(SB_LINEUP, 0),
(LPARAM) NULL);
break;
case '>':
SendMessage(hWnd, WM_VSCROLL, MAKEWPARAM(SB_LINEDOWN, 0),
(LPARAM) NULL);
break;
/* continue scrolling on any key */
default:
data->lines_last_turn = 0;
done = TRUE;
break;
}
}
#if defined(WIN_CE_SMARTPHONE)
NHSPhoneSetKeypadDefault();
#endif
/* remove "--More--" from the message window text */
data->window_text[MSG_LINES - 1].attr = ATR_NONE;
strncpy(data->window_text[MSG_LINES - 1].text, " ",
MAXWINDOWTEXT);
}
/* update window content */
InvalidateRect(hWnd, NULL, TRUE);
#ifdef USER_SOUNDS
play_sound_for_message(msg_data->text);
#endif
} break;
case MSNH_MSG_CLEAR_WINDOW:
data->lines_last_turn = 0;
data->dont_care = 0;
break;
}
}
void
onMSNH_VScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
PNHMessageWindow data;
SCROLLINFO si;
int yInc;
/* get window data */
data = (PNHMessageWindow) GetWindowLong(hWnd, GWL_USERDATA);
ZeroMemory(&si, sizeof(si));
si.cbSize = sizeof(si);
si.fMask = SIF_PAGE | SIF_POS;
GetScrollInfo(hWnd, SB_VERT, &si);
switch (LOWORD(wParam)) {
// User clicked the shaft above the scroll box.
case SB_PAGEUP:
yInc = -(int) si.nPage;
break;
// User clicked the shaft below the scroll box.
case SB_PAGEDOWN:
yInc = si.nPage;
break;
// User clicked the top arrow.
case SB_LINEUP:
yInc = -1;
break;
// User clicked the bottom arrow.
case SB_LINEDOWN:
yInc = 1;
break;
// User dragged the scroll box.
case SB_THUMBTRACK:
yInc = HIWORD(wParam) - data->yPos;
break;
default:
yInc = 0;
}
// If applying the vertical scrolling increment does not
// take the scrolling position out of the scrolling range,
// increment the scrolling position, adjust the position
// of the scroll box, and update the window. UpdateWindow
// sends the WM_PAINT message.
if (yInc = max(MSG_VISIBLE_LINES - data->yPos,
min(yInc, data->yMax - data->yPos))) {
data->yPos += yInc;
/* ScrollWindowEx(hWnd, 0, -data->yChar * yInc,
(CONST RECT *) NULL, (CONST RECT *) NULL,
(HRGN) NULL, (LPRECT) NULL, SW_INVALIDATE | SW_ERASE);
*/
InvalidateRect(hWnd, NULL, TRUE);
ZeroMemory(&si, sizeof(si));
si.cbSize = sizeof(si);
si.fMask = SIF_POS;
si.nPos = data->yPos;
SetScrollInfo(hWnd, SB_VERT, &si, TRUE);
UpdateWindow(hWnd);
}
}
#ifndef MSG_WRAP_TEXT
void
onMSNH_HScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
PNHMessageWindow data;
SCROLLINFO si;
int xInc;
/* get window data */
data = (PNHMessageWindow) GetWindowLong(hWnd, GWL_USERDATA);
ZeroMemory(&si, sizeof(si));
si.cbSize = sizeof(si);
si.fMask = SIF_PAGE;
GetScrollInfo(hWnd, SB_HORZ, &si);
switch (LOWORD(wParam)) {
// User clicked shaft left of the scroll box.
case SB_PAGEUP:
xInc = -(int) si.nPage;
break;
// User clicked shaft right of the scroll box.
case SB_PAGEDOWN:
xInc = si.nPage;
break;
// User clicked the left arrow.
case SB_LINEUP:
xInc = -1;
break;
// User clicked the right arrow.
case SB_LINEDOWN:
xInc = 1;
break;
// User dragged the scroll box.
case SB_THUMBTRACK:
xInc = HIWORD(wParam) - data->xPos;
break;
default:
xInc = 0;
}
// If applying the horizontal scrolling increment does not
// take the scrolling position out of the scrolling range,
// increment the scrolling position, adjust the position
// of the scroll box, and update the window.
if (xInc = max(-data->xPos, min(xInc, data->xMax - data->xPos))) {
data->xPos += xInc;
ScrollWindowEx(hWnd, -data->xChar * xInc, 0, (CONST RECT *) NULL,
(CONST RECT *) NULL, (HRGN) NULL, (LPRECT) NULL,
SW_INVALIDATE | SW_ERASE);
ZeroMemory(&si, sizeof(si));
si.cbSize = sizeof(si);
si.fMask = SIF_POS;
si.nPos = data->xPos;
SetScrollInfo(hWnd, SB_HORZ, &si, TRUE);
UpdateWindow(hWnd);
}
}
#endif // MSG_WRAP_TEXT
COLORREF
setMsgTextColor(HDC hdc, int gray)
{
COLORREF fg, color1, color2;
if (gray) {
color1 = mswin_get_color(NHW_MESSAGE, MSWIN_COLOR_BG);
color2 = mswin_get_color(NHW_MESSAGE, MSWIN_COLOR_FG);
/* Make a "gray" color by taking the average of the individual R,G,B
components of two colors. Thanks to Jonathan del Strother */
fg = RGB((GetRValue(color1) + GetRValue(color2)) / 2,
(GetGValue(color1) + GetGValue(color2)) / 2,
(GetBValue(color1) + GetBValue(color2)) / 2);
} else {
fg = mswin_get_color(NHW_MESSAGE, MSWIN_COLOR_FG);
}
return SetTextColor(hdc, fg);
}
void
onPaint(HWND hWnd)
{
PAINTSTRUCT ps;
HDC hdc;
PNHMessageWindow data;
RECT client_rt, draw_rt;
int FirstLine, LastLine;
int i, x, y;
HGDIOBJ oldFont;
TCHAR wbuf[MAXWINDOWTEXT + 2];
size_t wlen;
COLORREF OldBg, OldFg;
hdc = BeginPaint(hWnd, &ps);
OldBg = SetBkColor(hdc, mswin_get_color(NHW_MESSAGE, MSWIN_COLOR_BG));
OldFg = setMsgTextColor(hdc, 0);
data = (PNHMessageWindow) GetWindowLong(hWnd, GWL_USERDATA);
GetClientRect(hWnd, &client_rt);
if (!IsRectEmpty(&ps.rcPaint)) {
FirstLine = max(
0, data->yPos - (client_rt.bottom - ps.rcPaint.top) / data->yChar
+ 1);
LastLine =
min(MSG_LINES - 1,
data->yPos
- (client_rt.bottom - ps.rcPaint.bottom) / data->yChar);
y = min(ps.rcPaint.bottom, client_rt.bottom - 2);
for (i = LastLine; i >= FirstLine; i--) {
if (i == MSG_LINES - 1) {
x = data->xChar * (2 - data->xPos);
} else {
x = data->xChar * (4 - data->xPos);
}
if (strlen(data->window_text[i].text) > 0) {
/* convert to UNICODE */
NH_A2W(data->window_text[i].text, wbuf, sizeof(wbuf));
wlen = _tcslen(wbuf);
/* calculate text height */
draw_rt.left = x;
draw_rt.right = client_rt.right;
draw_rt.top = y - data->yChar;
draw_rt.bottom = y;
oldFont = SelectObject(
hdc,
mswin_get_font(NHW_MESSAGE, data->window_text[i].attr,
hdc, FALSE));
setMsgTextColor(hdc, i < (MSG_LINES - data->lines_last_turn));
#ifdef MSG_WRAP_TEXT
DrawText(hdc, wbuf, wlen, &draw_rt,
DT_NOPREFIX | DT_WORDBREAK | DT_CALCRECT);
draw_rt.top = y - (draw_rt.bottom - draw_rt.top);
draw_rt.bottom = y;
DrawText(hdc, wbuf, wlen, &draw_rt,
DT_NOPREFIX | DT_WORDBREAK);
#else
DrawText(hdc, wbuf, wlen, &draw_rt, DT_NOPREFIX);
#endif
SelectObject(hdc, oldFont);
y -= draw_rt.bottom - draw_rt.top;
} else {
y -= data->yChar;
}
}
}
SetTextColor(hdc, OldFg);
SetBkColor(hdc, OldBg);
EndPaint(hWnd, &ps);
}
void
onCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
TEXTMETRIC tm;
PNHMessageWindow data;
HGDIOBJ saveFont;
/* set window data */
data = (PNHMessageWindow) malloc(sizeof(NHMessageWindow));
if (!data)
panic("out of memory");
ZeroMemory(data, sizeof(NHMessageWindow));
data->max_text = MAXWINDOWTEXT;
SetWindowLong(hWnd, GWL_USERDATA, (LONG) data);
/* Get the handle to the client area's device context. */
hdc = GetDC(hWnd);
saveFont =
SelectObject(hdc, mswin_get_font(NHW_MESSAGE, ATR_NONE, hdc, FALSE));
/* Extract font dimensions from the text metrics. */
GetTextMetrics(hdc, &tm);
data->xChar = tm.tmAveCharWidth;
data->xUpper = (tm.tmPitchAndFamily & 1 ? 3 : 2) * data->xChar / 2;
data->yChar = tm.tmHeight + tm.tmExternalLeading;
data->xPage = 1;
/* Free the device context. */
SelectObject(hdc, saveFont);
ReleaseDC(hWnd, hdc);
/* create command pad (keyboard emulator) */
if (!GetNHApp()->hCmdWnd)
GetNHApp()->hCmdWnd = mswin_init_command_window();
}
void
mswin_message_window_size(HWND hWnd, LPSIZE sz)
{
PNHMessageWindow data;
RECT rt, client_rt;
GetWindowRect(hWnd, &rt);
sz->cx = rt.right - rt.left;
sz->cy = rt.bottom - rt.top;
data = (PNHMessageWindow) GetWindowLong(hWnd, GWL_USERDATA);
if (data) {
/* set size to accomodate MSG_VISIBLE_LINES, highligh rectangle and
horizontal scroll bar (difference between window rect and client
rect */
GetClientRect(hWnd, &client_rt);
sz->cy = sz->cy - (client_rt.bottom - client_rt.top)
+ data->yChar * MSG_VISIBLE_LINES + 4;
}
}

View File

@@ -0,0 +1,15 @@
/* NetHack 3.6 mhmsgwnd.h $NHDT-Date: 1432512798 2015/05/25 00:13:18 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#ifndef MSWINMessageWindow_h
#define MSWINMessageWindow_h
#include "winMS.h"
#include "config.h"
#include "global.h"
HWND mswin_init_message_window();
void mswin_message_window_size(HWND hWnd, LPSIZE sz);
#endif /* MSWINMessageWindow_h */

View File

@@ -0,0 +1,19 @@
/* NetHack 3.6 mhrip.c $NHDT-Date: 1432512801 2015/05/25 00:13:21 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#include "winMS.h"
#include "mhrip.h"
#include "mhtext.h"
HWND
mswin_init_RIP_window()
{
return mswin_init_text_window();
}
void
mswin_display_RIP_window(HWND hWnd)
{
mswin_display_text_window(hWnd);
}

View File

@@ -0,0 +1,15 @@
/* NetHack 3.6 mhrip.h $NHDT-Date: 1432512802 2015/05/25 00:13:22 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#ifndef MSWINRIPWindow_h
#define MSWINRIPWindow_h
#include "winMS.h"
#include "config.h"
#include "global.h"
HWND mswin_init_RIP_window();
void mswin_display_RIP_window(HWND hwnd);
#endif /* MSWINRIPWindow_h */

View File

@@ -0,0 +1,280 @@
/* NetHack 3.6 mhstatus.c $NHDT-Date: 1432512798 2015/05/25 00:13:18 $ $NHDT-Branch: master $:$NHDT-Revision: 1.17 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#include "winMS.h"
#include "mhstatus.h"
#include "mhmsg.h"
#include "mhfont.h"
#include "mhcolor.h"
#define MAXWINDOWTEXT 255
#define NHSTAT_LINES_2 2
#define NHSTAT_LINES_4 4
typedef struct mswin_nethack_status_window {
int nhstat_format;
char window_text[MAXWINDOWTEXT];
} NHStatusWindow, *PNHStatusWindow;
static TCHAR szStatusWindowClass[] = TEXT("MSNHStatusWndClass");
LRESULT CALLBACK StatusWndProc(HWND, UINT, WPARAM, LPARAM);
static void register_status_window_class(void);
static void FormatStatusString(char *text, int format);
HWND
mswin_init_status_window()
{
static int run_once = 0;
HWND ret;
NHStatusWindow *data;
if (!run_once) {
register_status_window_class();
run_once = 1;
}
ret = CreateWindow(szStatusWindowClass, NULL,
WS_CHILD | WS_DISABLED | WS_CLIPSIBLINGS,
0, /* x position */
0, /* y position */
0, /* x-size - we will set it later */
0, /* y-size - we will set it later */
GetNHApp()->hMainWnd, NULL, GetNHApp()->hApp, NULL);
if (!ret)
panic("Cannot create status window");
EnableWindow(ret, FALSE);
data = (PNHStatusWindow) malloc(sizeof(NHStatusWindow));
if (!data)
panic("out of memory");
ZeroMemory(data, sizeof(NHStatusWindow));
data->nhstat_format = NHSTAT_LINES_4;
SetWindowLong(ret, GWL_USERDATA, (LONG) data);
return ret;
}
void
register_status_window_class()
{
WNDCLASS wcex;
ZeroMemory(&wcex, sizeof(wcex));
wcex.style = CS_NOCLOSE;
wcex.lpfnWndProc = (WNDPROC) StatusWndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = GetNHApp()->hApp;
wcex.hIcon = NULL;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = mswin_get_brush(NHW_STATUS, MSWIN_COLOR_BG);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = szStatusWindowClass;
RegisterClass(&wcex);
}
LRESULT CALLBACK
StatusWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
RECT rt;
PAINTSTRUCT ps;
HDC hdc;
PNHStatusWindow data;
data = (PNHStatusWindow) GetWindowLong(hWnd, GWL_USERDATA);
switch (message) {
case WM_MSNH_COMMAND: {
switch (wParam) {
case MSNH_MSG_PUTSTR:
case MSNH_MSG_CLEAR_WINDOW:
ZeroMemory(data->window_text, sizeof(data->window_text));
FormatStatusString(data->window_text, data->nhstat_format);
break;
case MSNH_MSG_CURSOR: {
PMSNHMsgCursor msg_data = (PMSNHMsgCursor) lParam;
if (msg_data->y == 0) {
InvalidateRect(hWnd, NULL, TRUE);
}
} break;
}
} break;
case WM_PAINT: {
HGDIOBJ oldFont;
TCHAR wbuf[MAXWINDOWTEXT];
COLORREF OldBg, OldFg;
hdc = BeginPaint(hWnd, &ps);
GetClientRect(hWnd, &rt);
oldFont = SelectObject(
hdc, mswin_get_font(NHW_STATUS, ATR_NONE, hdc, FALSE));
OldBg = SetBkColor(hdc, mswin_get_color(NHW_STATUS, MSWIN_COLOR_BG));
OldFg =
SetTextColor(hdc, mswin_get_color(NHW_STATUS, MSWIN_COLOR_FG));
DrawText(hdc, NH_A2W(data->window_text, wbuf, MAXWINDOWTEXT),
strlen(data->window_text), &rt, DT_LEFT | DT_NOPREFIX);
SetTextColor(hdc, OldFg);
SetBkColor(hdc, OldBg);
SelectObject(hdc, oldFont);
EndPaint(hWnd, &ps);
} break;
case WM_DESTROY:
free(data);
SetWindowLong(hWnd, GWL_USERDATA, (LONG) 0);
break;
case WM_SETFOCUS:
SetFocus(GetNHApp()->hMainWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
void
mswin_status_window_size(HWND hWnd, LPSIZE sz)
{
TEXTMETRIC tm;
HGDIOBJ saveFont;
HDC hdc;
PNHStatusWindow data;
RECT rt;
GetWindowRect(hWnd, &rt);
sz->cx = rt.right - rt.left;
sz->cy = rt.bottom - rt.top;
data = (PNHStatusWindow) GetWindowLong(hWnd, GWL_USERDATA);
if (data) {
hdc = GetDC(hWnd);
saveFont = SelectObject(
hdc, mswin_get_font(NHW_STATUS, ATR_NONE, hdc, FALSE));
GetTextMetrics(hdc, &tm);
/* see if the status window can fit 80 characters per line */
if ((80 * tm.tmMaxCharWidth) >= sz->cx)
data->nhstat_format = NHSTAT_LINES_4;
else
data->nhstat_format = NHSTAT_LINES_2;
/* set height of the status box */
sz->cy = tm.tmHeight * data->nhstat_format;
SelectObject(hdc, saveFont);
ReleaseDC(hWnd, hdc);
}
}
extern const char *hu_stat[]; /* defined in eat.c */
extern const char *enc_stat[]; /* define in botl.c */
void
FormatStatusString(char *text, int format)
{
register char *nb;
int hp, hpmax;
int cap = near_capacity();
Strcpy(text, g.plname);
if ('a' <= text[0] && text[0] <= 'z')
text[0] += 'A' - 'a';
text[10] = 0;
Sprintf(nb = eos(text), " the ");
if (Upolyd) {
char mbot[BUFSZ];
int k = 0;
Strcpy(mbot, mons[u.umonnum].mname);
while (mbot[k] != 0) {
if ((k == 0 || (k > 0 && mbot[k - 1] == ' ')) && 'a' <= mbot[k]
&& mbot[k] <= 'z')
mbot[k] += 'A' - 'a';
k++;
}
Sprintf(nb = eos(nb), mbot);
} else
Sprintf(nb = eos(nb), rank_of(u.ulevel, Role_switch, flags.female));
if (format == NHSTAT_LINES_4)
Sprintf(nb = eos(nb), "\r\n");
if (ACURR(A_STR) > 18) {
if (ACURR(A_STR) > STR18(100))
Sprintf(nb = eos(nb), "St:%2d ", ACURR(A_STR) - 100);
else if (ACURR(A_STR) < STR18(100))
Sprintf(nb = eos(nb), "St:18/%02d ", ACURR(A_STR) - 18);
else
Sprintf(nb = eos(nb), "St:18/** ");
} else
Sprintf(nb = eos(nb), "St:%-1d ", ACURR(A_STR));
Sprintf(nb = eos(nb), "Dx:%-1d Co:%-1d In:%-1d Wi:%-1d Ch:%-1d",
ACURR(A_DEX), ACURR(A_CON), ACURR(A_INT), ACURR(A_WIS),
ACURR(A_CHA));
Sprintf(nb = eos(nb),
(u.ualign.type == A_CHAOTIC)
? " Chaotic"
: (u.ualign.type == A_NEUTRAL) ? " Neutral" : " Lawful");
#ifdef SCORE_ON_BOTL
if (flags.showscore)
Sprintf(nb = eos(nb), " S:%ld", botl_score());
#endif
if (format == NHSTAT_LINES_4 || format == NHSTAT_LINES_2)
strcat(text, "\r\n");
/* third line */
hp = Upolyd ? u.mh : u.uhp;
hpmax = Upolyd ? u.mhmax : u.uhpmax;
if (hp < 0)
hp = 0;
(void) describe_level(nb = eos(nb));
Sprintf(nb = eos(nb), "%c:%-2ld HP:%d(%d) Pw:%d(%d) AC:%-2d",
showsyms[COIN_CLASS + SYM_OFF_O], money_cnt(g.invent), hp, hpmax,
u.uen, u.uenmax, u.uac);
if (Upolyd)
Sprintf(nb = eos(nb), " HD:%d", mons[u.umonnum].mlevel);
else if (flags.showexp)
Sprintf(nb = eos(nb), " Xp:%u/%-1ld", u.ulevel, u.uexp);
else
Sprintf(nb = eos(nb), " Exp:%u", u.ulevel);
if (format == NHSTAT_LINES_4)
strcat(text, "\r\n");
else
strcat(text, " ");
/* forth line */
if (flags.time)
Sprintf(nb = eos(nb), "T:%ld ", g.moves);
if (strcmp(hu_stat[u.uhs], " ")) {
Strcat(text, hu_stat[u.uhs]);
Sprintf(nb = eos(nb), " ");
}
if (Confusion)
Sprintf(nb = eos(nb), "Conf");
if (Sick) {
if (u.usick_type & SICK_VOMITABLE)
Sprintf(nb = eos(nb), " FoodPois");
if (u.usick_type & SICK_NONVOMITABLE)
Sprintf(nb = eos(nb), " Ill");
}
if (Blind)
Sprintf(nb = eos(nb), " Blind");
if (Stunned)
Sprintf(nb = eos(nb), " Stun");
if (Hallucination)
Sprintf(nb = eos(nb), " Hallu");
if (Slimed)
Sprintf(nb = eos(nb), " Slime");
if (cap > UNENCUMBERED)
Sprintf(nb = eos(nb), " %s", enc_stat[cap]);
}

View File

@@ -0,0 +1,15 @@
/* NetHack 3.6 mhstatus.h $NHDT-Date: 1432512800 2015/05/25 00:13:20 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#ifndef MSWINStatusWindow_h
#define MSWINStatusWindow_h
#include "winMS.h"
#include "config.h"
#include "global.h"
HWND mswin_init_status_window();
void mswin_status_window_size(HWND hWnd, LPSIZE sz);
#endif /* MSWINStatusWindow_h */

305
outdated/sys/wince/mhtext.c Normal file
View File

@@ -0,0 +1,305 @@
/* NetHack 3.6 mhtext.c $NHDT-Date: 1432512802 2015/05/25 00:13:22 $ $NHDT-Branch: master $:$NHDT-Revision: 1.22 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#include "winMS.h"
#include "mhtext.h"
#include "mhmsg.h"
#include "mhfont.h"
#include "mhcolor.h"
#include "mhtxtbuf.h"
typedef struct mswin_nethack_text_window {
PNHTextBuffer window_text;
int done;
} NHTextWindow, *PNHTextWindow;
static WNDPROC editControlWndProc = NULL;
LRESULT CALLBACK TextWndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK NHTextControlWndProc(HWND, UINT, WPARAM, LPARAM);
static void onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam);
static void LayoutText(HWND hwnd);
static void ToggleWrapStatus(HWND hDlg, BOOL bWrap);
HWND
mswin_init_text_window()
{
HWND ret;
PNHTextWindow data;
ret = CreateDialog(GetNHApp()->hApp, MAKEINTRESOURCE(IDD_NHTEXT),
GetNHApp()->hMainWnd, TextWndProc);
if (!ret)
panic("Cannot create text window");
data = (PNHTextWindow) malloc(sizeof(NHTextWindow));
if (!data)
panic("out of memory");
ZeroMemory(data, sizeof(NHTextWindow));
data->window_text = mswin_init_text_buffer(
g.program_state.gameover ? FALSE : GetNHApp()->bWrapText);
SetWindowLong(ret, GWL_USERDATA, (LONG) data);
return ret;
}
void
mswin_display_text_window(HWND hWnd)
{
PNHTextWindow data;
data = (PNHTextWindow) GetWindowLong(hWnd, GWL_USERDATA);
if (data) {
ToggleWrapStatus(hWnd, mswin_get_text_wrap(data->window_text));
data->done = 0;
mswin_popup_display(hWnd, &data->done);
mswin_popup_destroy(hWnd);
}
}
LRESULT CALLBACK
TextWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND control;
HDC hdc;
PNHTextWindow data;
data = (PNHTextWindow) GetWindowLong(hWnd, GWL_USERDATA);
switch (message) {
case WM_INITDIALOG:
/* set text control font */
control = GetDlgItem(hWnd, IDC_TEXT_CONTROL);
if (!control) {
panic("cannot get text view window");
}
hdc = GetDC(control);
SendMessage(control, WM_SETFONT,
(WPARAM) mswin_get_font(NHW_TEXT, ATR_NONE, hdc, FALSE),
0);
ReleaseDC(control, hdc);
#if defined(WIN_CE_SMARTPHONE)
/* special initialization for SmartPhone dialogs */
NHSPhoneDialogSetup(hWnd, IDC_SPHONE_TEXTDIALOGBAR, FALSE,
GetNHApp()->bFullScreen);
#endif
/* subclass edit control */
editControlWndProc = (WNDPROC) GetWindowLong(control, GWL_WNDPROC);
SetWindowLong(control, GWL_WNDPROC, (LONG) NHTextControlWndProc);
SetFocus(control);
return FALSE;
case WM_MSNH_COMMAND:
onMSNHCommand(hWnd, wParam, lParam);
break;
case WM_SIZE:
LayoutText(hWnd);
return FALSE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
case IDCANCEL:
data->done = 1;
return TRUE;
case IDC_TEXT_TOGGLE_WRAP:
ToggleWrapStatus(hWnd, !mswin_get_text_wrap(data->window_text));
return TRUE;
}
break;
case WM_CTLCOLORBTN:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: { /* sent by edit control before it is drawn */
HDC hdcEdit = (HDC) wParam;
HWND hwndEdit = (HWND) lParam;
if (hwndEdit == GetDlgItem(hWnd, IDC_TEXT_CONTROL)) {
SetBkColor(hdcEdit, mswin_get_color(NHW_TEXT, MSWIN_COLOR_BG));
SetTextColor(hdcEdit, mswin_get_color(NHW_TEXT, MSWIN_COLOR_FG));
return (BOOL) mswin_get_brush(NHW_TEXT, MSWIN_COLOR_BG);
}
}
return FALSE;
case WM_DESTROY:
if (data) {
mswin_free_text_buffer(data->window_text);
free(data);
SetWindowLong(hWnd, GWL_USERDATA, (LONG) 0);
}
break;
}
return FALSE;
}
void
onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
PNHTextWindow data;
data = (PNHTextWindow) GetWindowLong(hWnd, GWL_USERDATA);
switch (wParam) {
case MSNH_MSG_PUTSTR: {
PMSNHMsgPutstr msg_data = (PMSNHMsgPutstr) lParam;
mswin_add_text(data->window_text, msg_data->attr, msg_data->text);
break;
}
}
}
void
ToggleWrapStatus(HWND hDlg, BOOL bWrap)
{
DWORD styles;
PNHTextWindow data;
HWND control;
TCHAR wbuf[BUFSZ];
data = (PNHTextWindow) GetWindowLong(hDlg, GWL_USERDATA);
control = GetDlgItem(hDlg, IDC_TEXT_CONTROL);
if (!control) {
panic("cannot get text view window");
}
/* set horizontal scrollbar status */
styles = GetWindowLong(control, GWL_STYLE);
if (styles) {
SetWindowLong(control, GWL_STYLE, (bWrap ? (styles & (~WS_HSCROLL))
: (styles | WS_HSCROLL)));
SetWindowPos(control, NULL, 0, 0, 0, 0,
SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE
| SWP_NOSIZE);
}
/* set text wrap mode */
mswin_set_text_wrap(data->window_text, bWrap);
mswin_render_text(data->window_text, control);
/* change button status */
ZeroMemory(wbuf, sizeof(wbuf));
if (!LoadString(GetNHApp()->hApp,
(bWrap ? IDS_TEXT_UNWRAP : IDS_TEXT_WRAP), wbuf, BUFSZ)) {
panic("cannot load text window strings");
}
#if defined(WIN_CE_SMARTPHONE)
{
TBBUTTONINFO tbbi;
ZeroMemory(&tbbi, sizeof(tbbi));
tbbi.cbSize = sizeof(tbbi);
tbbi.dwMask = TBIF_TEXT;
tbbi.pszText = wbuf;
if (!SendMessage(SHFindMenuBar(hDlg), TB_SETBUTTONINFO,
IDC_TEXT_TOGGLE_WRAP, (LPARAM) &tbbi)) {
error("Cannot update IDC_TEXT_TOGGLE_WRAP menu item.");
}
}
#else
SendDlgItemMessage(hDlg, IDC_TEXT_TOGGLE_WRAP, WM_SETTEXT, (WPARAM) 0,
(LPARAM) wbuf);
#endif
}
void
LayoutText(HWND hWnd)
{
HWND btn_ok, btn_wrap;
HWND text;
RECT clrt, rt;
POINT pt_elem, pt_ok, pt_wrap;
SIZE sz_elem, sz_ok, sz_wrap;
text = GetDlgItem(hWnd, IDC_TEXT_CONTROL);
btn_ok = GetDlgItem(hWnd, IDOK);
btn_wrap = GetDlgItem(hWnd, IDC_TEXT_TOGGLE_WRAP);
/* get window coordinates */
GetClientRect(hWnd, &clrt);
/* set window placements */
if (IsWindow(btn_ok)) {
GetWindowRect(btn_ok, &rt);
sz_ok.cx = (clrt.right - clrt.left) / 2;
sz_ok.cy = rt.bottom - rt.top;
pt_ok.x = clrt.left;
pt_ok.y = clrt.bottom - sz_ok.cy;
MoveWindow(btn_ok, pt_ok.x, pt_ok.y, sz_ok.cx, sz_ok.cy, TRUE);
sz_wrap.cx = (clrt.right - clrt.left) / 2;
sz_wrap.cy = rt.bottom - rt.top;
pt_wrap.x = clrt.left + sz_ok.cx;
pt_wrap.y = clrt.bottom - sz_ok.cy;
MoveWindow(btn_wrap, pt_wrap.x, pt_wrap.y, sz_wrap.cx, sz_wrap.cy,
TRUE);
pt_elem.x = clrt.left;
pt_elem.y = clrt.top;
sz_elem.cx = clrt.right - clrt.left;
sz_elem.cy = pt_ok.y;
MoveWindow(text, pt_elem.x, pt_elem.y, sz_elem.cx, sz_elem.cy, TRUE);
} else {
pt_elem.x = clrt.left;
pt_elem.y = clrt.top;
sz_elem.cx = clrt.right - clrt.left;
sz_elem.cy = clrt.bottom - clrt.top;
MoveWindow(text, pt_elem.x, pt_elem.y, sz_elem.cx, sz_elem.cy, TRUE);
}
}
/* Text control window proc - implements close on space and scrolling on
* arrows */
LRESULT CALLBACK
NHTextControlWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
/* tell Windows not to process arrow keys (we want them) */
case WM_GETDLGCODE:
return DLGC_WANTARROWS;
case WM_KEYDOWN:
switch (wParam) {
case VK_SPACE:
case VK_RETURN:
/* close on space */
PostMessage(GetParent(hWnd), WM_COMMAND, MAKELONG(IDOK, 0), 0);
return 0;
case VK_UP:
/* scoll up */
PostMessage(hWnd, WM_VSCROLL, MAKEWPARAM(SB_LINEUP, 0),
(LPARAM) NULL);
return 0;
case VK_DOWN:
/* scoll down */
PostMessage(hWnd, WM_VSCROLL, MAKEWPARAM(SB_LINEDOWN, 0),
(LPARAM) NULL);
return 0;
case VK_LEFT:
/* scoll left */
PostMessage(hWnd, WM_HSCROLL, MAKEWPARAM(SB_LINELEFT, 0),
(LPARAM) NULL);
return 0;
case VK_RIGHT:
/* scoll right */
PostMessage(hWnd, WM_HSCROLL, MAKEWPARAM(SB_LINERIGHT, 0),
(LPARAM) NULL);
return 0;
}
break; /* case WM_KEYDOWN: */
}
if (editControlWndProc)
return CallWindowProc(editControlWndProc, hWnd, message, wParam,
lParam);
else
return 0;
}

View File

@@ -0,0 +1,15 @@
/* NetHack 3.6 mhtext.h $NHDT-Date: 1432512799 2015/05/25 00:13:19 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#ifndef MSWINTextWindow_h
#define MSWINTextWindow_h
#include "winMS.h"
#include "config.h"
#include "global.h"
HWND mswin_init_text_window();
void mswin_display_text_window(HWND hwnd);
#endif /* MSWINTextWindow_h */

View File

@@ -0,0 +1,269 @@
/* NetHack 3.6 mhtxtbuf.c $NHDT-Date: 1432512803 2015/05/25 00:13:23 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */
/* Copyright (C) 2003 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#include "mhtxtbuf.h"
/* Collect Nethack text messages and render text into edit box.
Wrap text if necessary.
Recognize formatted lines as having more that 4 consecutive.
spaces inside the string.
Strip leading and trailing spaces.
Always break at the original line end (do not merge text that comes
from NetHack engine)
*/
/*----------------------------------------------------------------*/
#define NHTEXT_BUFFER_INCREMENT 10
/*----------------------------------------------------------------*/
struct text_buffer_line {
int attr;
short beg_padding;
short end_padding;
BOOL formatted;
char *text;
};
/*----------------------------------------------------------------*/
typedef struct mswin_nethack_text_buffer {
BOOL b_wrap_text;
int n_size;
int n_used;
struct text_buffer_line *text_buffer_line;
} NHTextBuffer, *PNHTextBuffer;
/*----------------------------------------------------------------*/
#define NHTextLine(pb, i) ((pb)->text_buffer_line[(i)])
static TCHAR *nh_append(TCHAR *s, int *size, const char *ap);
/*----------------------------------------------------------------*/
PNHTextBuffer
mswin_init_text_buffer(BOOL wrap_text)
{
PNHTextBuffer pb = (PNHTextBuffer) malloc(sizeof(NHTextBuffer));
if (!pb)
panic("Out of memory");
ZeroMemory(pb, sizeof(NHTextBuffer));
pb->b_wrap_text = wrap_text;
pb->n_size = 0;
pb->n_used = 0;
pb->text_buffer_line = NULL;
return pb;
}
/*----------------------------------------------------------------*/
void
mswin_free_text_buffer(PNHTextBuffer pb)
{
int i;
if (!pb)
return;
for (i = 0; i < pb->n_used; i++) {
free(pb->text_buffer_line[i].text);
}
free(pb->text_buffer_line);
free(pb);
}
/*----------------------------------------------------------------*/
void
mswin_add_text(PNHTextBuffer pb, int attr, const char *text)
{
char *p;
struct text_buffer_line *new_line;
/* grow buffer */
if (pb->n_used >= pb->n_size) {
pb->n_size += NHTEXT_BUFFER_INCREMENT;
pb->text_buffer_line = (struct text_buffer_line *) realloc(
pb->text_buffer_line,
pb->n_size * sizeof(struct text_buffer_line));
if (!pb->text_buffer_line)
panic("Memory allocation error");
}
/* analyze the new line of text */
new_line = &NHTextLine(pb, pb->n_used);
new_line->attr = attr;
new_line->beg_padding = 0;
new_line->text = strdup(text);
for (p = new_line->text; *p && isspace(*p); p++) {
new_line->beg_padding++;
}
if (*p) {
memmove(new_line->text, new_line->text + new_line->beg_padding,
strlen(new_line->text) - new_line->beg_padding + 1);
for (p = new_line->text + strlen(new_line->text);
p >= new_line->text && isspace(*p); p--) {
new_line->end_padding++;
*p = 0;
}
/* if there are 3 (or more) consecutive spaces inside the string
consider it formatted */
new_line->formatted = (strstr(new_line->text, " ") != NULL)
|| (new_line->beg_padding > 8);
} else {
new_line->end_padding = 0;
new_line->text[0] = 0;
new_line->formatted = FALSE;
}
pb->n_used++;
}
/*----------------------------------------------------------------*/
void
mswin_set_text_wrap(PNHTextBuffer pb, BOOL wrap_text)
{
pb->b_wrap_text = wrap_text;
}
/*----------------------------------------------------------------*/
BOOL
mswin_get_text_wrap(PNHTextBuffer pb)
{
return pb->b_wrap_text;
}
/*----------------------------------------------------------------*/
static TCHAR *
nh_append(TCHAR *s, int *size, const char *ap)
{
int tlen, tnewlen;
if (!(ap && *ap))
return s;
/* append the calculated line to the text buffer */
tlen = s ? _tcslen(s) : 0;
tnewlen = tlen + strlen(ap);
if (tnewlen >= *size) {
*size = max(tnewlen, *size + BUFSZ);
s = (TCHAR *) realloc(s, *size * sizeof(TCHAR));
if (!s)
panic("Out of memory");
ZeroMemory(s + tlen, (*size - tlen) * sizeof(TCHAR));
}
if (strcmp(ap, "\r\n") == 0) {
_tcscat(s, TEXT("\r\n"));
} else {
NH_A2W(ap, s + tlen, strlen(ap));
s[tnewlen] = 0;
}
return s;
}
/*----------------------------------------------------------------*/
void
mswin_render_text(PNHTextBuffer pb, HWND edit_control)
{
RECT rt_client; /* boundaries of the client area of the edit control */
SIZE size_text; /* size of the edit control */
RECT rt_text; /* calculated text rectangle for the visible line */
char buf[BUFSZ]; /* buffer for the visible line */
TCHAR tbuf[BUFSZ]; /* temp buffer for DrawText */
TCHAR *pText = NULL; /* resulting text (formatted) */
int pTextSize = 0; /* resulting text size */
char *p_cur = NULL; /* current position in the
NHTextBuffer->text_buffer_line->text */
char *p_buf_cur = NULL; /* current position in the visible line buffer */
int i;
HDC hdcEdit; /* device context for the edit control */
HFONT hFont, hOldFont; /* edit control font */
GetClientRect(edit_control, &rt_client);
size_text.cx = rt_client.right - rt_client.left;
size_text.cy = rt_client.bottom - rt_client.top;
size_text.cx -=
GetSystemMetrics(SM_CXVSCROLL); /* add a slight right margin - the
text looks better that way */
hdcEdit = GetDC(edit_control);
hFont = (HFONT) SendMessage(edit_control, WM_GETFONT, 0, 0);
if (hFont)
hOldFont = SelectObject(hdcEdit, hFont);
/* loop through each line (outer loop) and wrap it around (inner loop) */
ZeroMemory(buf, sizeof(buf));
p_buf_cur = buf;
for (i = 0; i < pb->n_used; i++) {
if (pb->b_wrap_text) {
p_cur = NHTextLine(pb, i).text;
/* insert an line break for the empty string */
if (!NHTextLine(pb, i).text[0]) {
pText = nh_append(pText, &pTextSize, "\r\n");
continue;
}
/* add margin to the "formatted" line of text */
if (NHTextLine(pb, i).formatted) {
strcpy(buf, " ");
p_buf_cur += 3;
}
/* scroll thourgh the current line of text and wrap it
so it fits to width of the edit control */
while (*p_cur) {
char *p_word_pos = p_buf_cur;
/* copy one word into the buffer */
while (*p_cur && isspace(*p_cur))
if (p_buf_cur != buf)
*p_buf_cur++ = *p_cur++;
else
p_cur++;
while (*p_cur && !isspace(*p_cur))
*p_buf_cur++ = *p_cur++;
/* check if it fits */
SetRect(&rt_text, 0, 0, size_text.cx, size_text.cy);
DrawText(hdcEdit, NH_A2W(buf, tbuf, p_buf_cur - buf),
p_buf_cur - buf, &rt_text,
DT_CALCRECT | DT_LEFT | DT_SINGLELINE | DT_NOCLIP);
if ((rt_text.right - rt_text.left) >= size_text.cx) {
/* Backtrack.
Only backtrack if the last word caused the overflow -
do not backtrack if the entire current line does not
fit the visible area.
Otherwise it is a infinite loop.
*/
if (p_word_pos > buf) {
p_cur -= (p_buf_cur - p_word_pos);
p_buf_cur = p_word_pos;
}
*p_buf_cur = 0; /* break the line */
/* append the calculated line to the text buffer */
pText = nh_append(pText, &pTextSize, buf);
pText = nh_append(pText, &pTextSize, "\r\n");
ZeroMemory(buf, sizeof(buf));
p_buf_cur = buf;
}
}
/* always break the line at the end of the buffer text */
if (p_buf_cur != buf) {
/* flush the current buffrer */
*p_buf_cur = 0; /* break the line */
pText = nh_append(pText, &pTextSize, buf);
pText = nh_append(pText, &pTextSize, "\r\n");
ZeroMemory(buf, sizeof(buf));
p_buf_cur = buf;
}
} else { /* do not wrap text */
int j;
for (j = 0; j < NHTextLine(pb, i).beg_padding; j++)
pText = nh_append(pText, &pTextSize, " ");
pText = nh_append(pText, &pTextSize, NHTextLine(pb, i).text);
pText = nh_append(pText, &pTextSize, "\r\n");
}
}
/* cleanup */
if (hFont)
SelectObject(hdcEdit, hOldFont);
ReleaseDC(edit_control, hdcEdit);
/* update edit control text */
if (pText) {
SendMessage(edit_control, EM_FMTLINES, 1, 0);
SetWindowText(edit_control, pText);
free(pText);
}
}
/*----------------------------------------------------------------*/

View File

@@ -0,0 +1,18 @@
/* NetHack 3.6 mhtxtbuf.h $NHDT-Date: 1432512799 2015/05/25 00:13:19 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#ifndef MSWINTextBuffer_h
#define MSWINTextBuffer_h
#include "winMS.h"
typedef struct mswin_nethack_text_buffer *PNHTextBuffer;
PNHTextBuffer mswin_init_text_buffer(BOOL wrap_text);
void mswin_free_text_buffer(PNHTextBuffer pb);
void mswin_add_text(PNHTextBuffer pb, int attr, const char *text);
void mswin_set_text_wrap(PNHTextBuffer pb, BOOL wrap_text);
BOOL mswin_get_text_wrap(PNHTextBuffer pb);
void mswin_render_text(PNHTextBuffer pb, HWND edit_control);
#endif /* MSWINTextBuffer_h */

1998
outdated/sys/wince/mswproc.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,43 @@
/* NetHack 3.6 newres.h $NHDT-Date: 1524689383 2018/04/25 20:49:43 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.3 $ */
/* Copyright (c) 2003 by Michael Allison */
/* NetHack may be freely redistributed. See license for details. */
#ifndef __NEWRES_H__
#define __NEWRES_H__
#if !defined(UNDER_CE)
#define UNDER_CE _WIN32_WCE
#endif
#if defined(_WIN32_WCE)
#if !defined(WCEOLE_ENABLE_DIALOGEX)
#define DIALOGEX DIALOG DISCARDABLE
#endif
#include <commctrl.h>
#define SHMENUBAR RCDATA
#if (defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)) \
&& (_WIN32_WCE >= 300)
#include <aygshell.h>
#else
#define I_IMAGENONE (-2)
#define NOMENU 0xFFFF
#define IDS_SHNEW 1
#define IDM_SHAREDNEW 10
#define IDM_SHAREDNEWDEFAULT 11
#endif
#endif // _WIN32_WCE
#ifdef RC_INVOKED
#ifndef _INC_WINDOWS
#define _INC_WINDOWS
#include "winuser.h" // extract from windows header
#endif
#endif
#ifdef IDC_STATIC
#undef IDC_STATIC
#endif
#define IDC_STATIC (-1)
#endif //__NEWRES_H__

555
outdated/sys/wince/nhico.uu Normal file
View File

@@ -0,0 +1,555 @@
begin 700 nethack.ico
M```!``8`("``````"`"H"```9@```!`0``````@`:`4```X)```L+``````(
M`!@-``!V#@``0$``````"``H%@``CAL``%I:``````@`N"@``+8Q```6%@``
M```(`)`&``!N6@``*````"````!``````0`(````````!```````````````
M`0````$``````````(```(````"`@`"`````@`"``("```#`P,``P-S``/#*
MI@`$!`0`"`@(``P,#``1$1$`%A86`!P<'``B(B(`*2DI`%5550!-34T`0D)"
M`#DY.0"`?/\`4%#_`),`U@#_[,P`QM;O`-;GYP"0J:T````S````9@```)D`
M``#,```S````,S,``#-F```SF0``,\P``#/_``!F````9C,``&9F``!FF0``
M9LP``&;_``"9````F3,``)EF``"9F0``F<P``)G_``#,````S#,``,QF``#,
MF0``S,P``,S_``#_9@``_YD``/_,`#,````S`#,`,P!F`#,`F0`S`,P`,P#_
M`#,S```S,S,`,S-F`#,SF0`S,\P`,S/_`#-F```S9C,`,V9F`#-FF0`S9LP`
M,V;_`#.9```SF3,`,YEF`#.9F0`SF<P`,YG_`#/,```SS#,`,\QF`#/,F0`S
MS,P`,\S_`#/_,P`S_V8`,_^9`#/_S``S__\`9@```&8`,P!F`&8`9@"9`&8`
MS`!F`/\`9C,``&8S,P!F,V8`9C.9`&8SS`!F,_\`9F8``&9F,P!F9F8`9F:9
M`&9FS`!FF0``9IDS`&:99@!FF9D`9IG,`&:9_P!FS```9LPS`&;,F0!FS,P`
M9LS_`&;_``!F_S,`9O^9`&;_S`#,`/\`_P#,`)F9``"9,YD`F0"9`)D`S`"9
M````F3,S`)D`9@"9,\P`F0#_`)EF``"99C,`F3-F`)EFF0"99LP`F3/_`)F9
M,P"9F68`F9F9`)F9S`"9F?\`F<P``)G,,P!FS&8`F<R9`)G,S`"9S/\`F?\`
M`)G_,P"9S&8`F?^9`)G_S`"9__\`S````)D`,P#,`&8`S`"9`,P`S`"9,P``
MS#,S`,PS9@#,,YD`S#/,`,PS_P#,9@``S&8S`)EF9@#,9ID`S&;,`)EF_P#,
MF0``S)DS`,R99@#,F9D`S)G,`,R9_P#,S```S,PS`,S,9@#,S)D`S,S,`,S,
M_P#,_P``S/\S`)G_9@#,_YD`S/_,`,S__P#,`#,`_P!F`/\`F0#,,P``_S,S
M`/\S9@#_,YD`_S/,`/\S_P#_9@``_V8S`,QF9@#_9ID`_V;,`,QF_P#_F0``
M_YDS`/^99@#_F9D`_YG,`/^9_P#_S```_\PS`/_,9@#_S)D`_\S,`/_,_P#_
M_S,`S/]F`/__F0#__\P`9F;_`&;_9@!F__\`_V9F`/]F_P#__V8`(0"E`%]?
M7P!W=W<`AH:&`):6E@#+R\L`LK*R`-?7UP#=W=T`X^/C`.KJZ@#Q\?$`^/CX
M`/#[_P"DH*``@("`````_P``_P```/__`/\```#_`/\`__\``/___P`*"@H*
M"O3R"@H*"@H*\_#R"@H*"@H*"@KT"@H*"@H*"@H*"@KS;1+T"@H*"O'PO`<'
M\@H*"@KSO/'T"@H*"@H*"@H*"@KL1.L*"O/Q\&\'!Y/WO`H*]`>\\O,*"@H*
M"@H*"@H*"O3J1._R\`=&1P<'(&_OO`H'!_.\"@H*"@H*"@H*"@H*"O!$[+R3
M("!'!Y,@($6\O`?S\/(*"@H*"@H*"@H*"@H*"N\''"`@($<'DR`@'T6\\/#Q
M"@H*"@H*"@H*"@H*"@KR!QP?("`@1P?O("`?'T7PO`H*"@H*"@H*"@H*"@H*
M"@<''Q\@("!&[.M%Z1\?`6[Q]`H*"@H*"@H*"@H*"@KR[VX!'^GL[`<'!P=M
M'Q\!`;SQ"@H*"@H*"@H*"@H*"O$'10%%!P<';_>2;D4?'P$!!_`*"@H*"@H*
M"@H*"@H*\`<!`0?W12!&Z^QNZNKJ1`&3O`H*"@H*"@H*"@H*"@KP!P%N!T0@
M$NR2[/?WD@?L`9.\"@H*"@H*"@H*"@H*"O$'`0?W'V[W!_"\[^P?D@=$D[P*
M"@H*"@H*"@H*"@H*\0>\!^N\!P?Q\_(';0?W!^R\!PH*"@H*"@H*"@H*"@KQ
MO+P';;SO!_+T\KSK\.\'[`<'"@H*"@H*"@H*"@H*"O*\`0?MZ6[W\/'P]^L?
M[`=$DP<*"@H*"@H*"@H*"@H*\O`![`=$(._O[^WO[!^2[`&3!PH*"@H*"@H*
M"@H*"@KR\`$!!_=%(&[W]^UN;0=$`9/O"@H*"@H*"@H*"@H*"O/Q`0%%!^]M
M1>WMZNL'$@$!'.\'!_(*"@H*"@H*"@H*\_$!`1_I'`<'[P<'[T4?`0$<[_$'
M[[P*"@H*"@H*"@KS\0$!'R`@(&^2]T8@'Q\!`>WW\`?O!_(*"@H*"@H*"O/Q
M`0$?("`@1@<'("`?'P$![9+P!^^2[_,*"@H*"@H*\_`!`1\?("!&!P<@(!\!
M`0%N[?`'[Y+L[PH*"@H*"@KS\._O!P?O[P<'\/"\O+P'!^V2O`?ODNP'"@H*
M"@H*"@?M[._R\+SP\?+R\O"\O`?O[^R\!^_M[.\*"@H*"@KQ1$1N"@H*"@H*
M"@KQ\_/Q!^\'[^V2!_`'[`H*"@H*"FU$ZO,*"@H*"@H*"@?S\_`'[Y*\[/(*
M"@KS"@H*"@KL1$0'"@H*"@H*"@H*\_/S\`?O[._Q[PH*"@H*"@H*[T1$'`H*
M"@H*"@H*"@H*\_/P!_<'"O0*"@H*"@H*"@KL'.P*"@H*"@H*"@H*"@KP!_`'
M]PH*"@H*"@H*"@H*"@H'\@H*"@H*"@H*"@H*"@KRO`?O"@H*"@H*"@H*"@H*
M"@H*"@H*"@H*"@H*"@H*"@H*\_#S"@H*"@H*"@H*^?C_?_#P/#_XP!@_^``(
M?_P``'_^``#__``!__P``/_X``#_^```__@``/_X``#_^```__@``/_X``#_
M^```__@``/_X``#_^```'_@```_X```'^````_@```/X```#^````_#_``/P
M_P`[X?\`/\/_@7_'_X/_Y__#____\?\H````$````"`````!``@````````!
M```````````````!`````0``````````@```@````("``(````"``(``@(``
M`,#`P`#`W,``\,JF``0$!``("`@`#`P,`!$1$0`6%A8`'!P<`"(B(@`I*2D`
M5555`$U-30!"0D(`.3DY`(!\_P!04/\`DP#6`/_LS`#&UN\`UN?G`)"IK0``
M`#,```!F````F0```,P``#,````S,P``,V8``#.9```SS```,_\``&8```!F
M,P``9F8``&:9``!FS```9O\``)D```"9,P``F68``)F9``"9S```F?\``,P`
M``#,,P``S&8``,R9``#,S```S/\``/]F``#_F0``_\P`,P```#,`,P`S`&8`
M,P"9`#,`S``S`/\`,S,``#,S,P`S,V8`,S.9`#,SS``S,_\`,V8``#-F,P`S
M9F8`,V:9`#-FS``S9O\`,YD``#.9,P`SF68`,YF9`#.9S``SF?\`,\P``#/,
M,P`SS&8`,\R9`#/,S``SS/\`,_\S`#/_9@`S_YD`,__,`#/__P!F````9@`S
M`&8`9@!F`)D`9@#,`&8`_P!F,P``9C,S`&8S9@!F,YD`9C/,`&8S_P!F9@``
M9F8S`&9F9@!F9ID`9F;,`&:9``!FF3,`9IEF`&:9F0!FF<P`9IG_`&;,``!F
MS#,`9LR9`&;,S`!FS/\`9O\``&;_,P!F_YD`9O_,`,P`_P#_`,P`F9D``)DS
MF0"9`)D`F0#,`)D```"9,S,`F0!F`)DSS`"9`/\`F68``)EF,P"9,V8`F6:9
M`)EFS`"9,_\`F9DS`)F99@"9F9D`F9G,`)F9_P"9S```F<PS`&;,9@"9S)D`
MF<S,`)G,_P"9_P``F?\S`)G,9@"9_YD`F?_,`)G__P#,````F0`S`,P`9@#,
M`)D`S`#,`)DS``#,,S,`S#-F`,PSF0#,,\P`S#/_`,QF``#,9C,`F69F`,QF
MF0#,9LP`F6;_`,R9``#,F3,`S)EF`,R9F0#,F<P`S)G_`,S,``#,S#,`S,QF
M`,S,F0#,S,P`S,S_`,S_``#,_S,`F?]F`,S_F0#,_\P`S/__`,P`,P#_`&8`
M_P"9`,PS``#_,S,`_S-F`/\SF0#_,\P`_S/_`/]F``#_9C,`S&9F`/]FF0#_
M9LP`S&;_`/^9``#_F3,`_YEF`/^9F0#_F<P`_YG_`/_,``#_S#,`_\QF`/_,
MF0#_S,P`_\S_`/__,P#,_V8`__^9`/__S`!F9O\`9O]F`&;__P#_9F8`_V;_
M`/__9@`A`*4`7U]?`'=W=P"&AH8`EI:6`,O+RP"RLK(`U]?7`-W=W0#CX^,`
MZNKJ`/'Q\0#X^/@`\/O_`*2@H`"`@(````#_``#_````__\`_P```/\`_P#_
M_P``____````[QP``/'P\@``\O0```````=$\/!O[I.\\[SR````````[.]&
M1@<@;^[P`````````+Q%($;MZ1^3\@```````/0''^SWDO@?`;P```````#R
MD^Q%;NSX^$3N````````\N[W[._S]Y+K[@```````//N]^SW\??MZP<`````
M``#SD^QN[.WM;43O````````\^\![.WL[.H![P<'`````/23'R!&[R`?`?>\
M[_````#T[VX<D[R3DQR2O/?O````[>N\\O+T\O`'![SOD@``!T0<`````/'R
M[Y+W`````.MN``````#S\._S\@````#T`````````//P]`````#,9P``P`<`
M`.`/``#@#P``P`\``,`/``#`#P``P`\``,`/``#``P``P`$``,`!``#``0``
MCP<``)\'``"_CP``*````"P```!8`````0`(``````"0!P``````````````
M`0````$``````````(```(````"`@`"`````@`"``("```#`P,``P-S``/#*
MI@`$!`0`"`@(``P,#``1$1$`%A86`!P<'``B(B(`*2DI`%5550!-34T`0D)"
M`#DY.0"`?/\`4%#_`),`U@#_[,P`QM;O`-;GYP"0J:T````S````9@```)D`
M``#,```S````,S,``#-F```SF0``,\P``#/_``!F````9C,``&9F``!FF0``
M9LP``&;_``"9````F3,``)EF``"9F0``F<P``)G_``#,````S#,``,QF``#,
MF0``S,P``,S_``#_9@``_YD``/_,`#,````S`#,`,P!F`#,`F0`S`,P`,P#_
M`#,S```S,S,`,S-F`#,SF0`S,\P`,S/_`#-F```S9C,`,V9F`#-FF0`S9LP`
M,V;_`#.9```SF3,`,YEF`#.9F0`SF<P`,YG_`#/,```SS#,`,\QF`#/,F0`S
MS,P`,\S_`#/_,P`S_V8`,_^9`#/_S``S__\`9@```&8`,P!F`&8`9@"9`&8`
MS`!F`/\`9C,``&8S,P!F,V8`9C.9`&8SS`!F,_\`9F8``&9F,P!F9F8`9F:9
M`&9FS`!FF0``9IDS`&:99@!FF9D`9IG,`&:9_P!FS```9LPS`&;,F0!FS,P`
M9LS_`&;_``!F_S,`9O^9`&;_S`#,`/\`_P#,`)F9``"9,YD`F0"9`)D`S`"9
M````F3,S`)D`9@"9,\P`F0#_`)EF``"99C,`F3-F`)EFF0"99LP`F3/_`)F9
M,P"9F68`F9F9`)F9S`"9F?\`F<P``)G,,P!FS&8`F<R9`)G,S`"9S/\`F?\`
M`)G_,P"9S&8`F?^9`)G_S`"9__\`S````)D`,P#,`&8`S`"9`,P`S`"9,P``
MS#,S`,PS9@#,,YD`S#/,`,PS_P#,9@``S&8S`)EF9@#,9ID`S&;,`)EF_P#,
MF0``S)DS`,R99@#,F9D`S)G,`,R9_P#,S```S,PS`,S,9@#,S)D`S,S,`,S,
M_P#,_P``S/\S`)G_9@#,_YD`S/_,`,S__P#,`#,`_P!F`/\`F0#,,P``_S,S
M`/\S9@#_,YD`_S/,`/\S_P#_9@``_V8S`,QF9@#_9ID`_V;,`,QF_P#_F0``
M_YDS`/^99@#_F9D`_YG,`/^9_P#_S```_\PS`/_,9@#_S)D`_\S,`/_,_P#_
M_S,`S/]F`/__F0#__\P`9F;_`&;_9@!F__\`_V9F`/]F_P#__V8`(0"E`%]?
M7P!W=W<`AH:&`):6E@#+R\L`LK*R`-?7UP#=W=T`X^/C`.KJZ@#Q\?$`^/CX
M`/#[_P"DH*``@("`````_P``_P```/__`/\```#_`/\`__\``/___P``````
M````]/+T````````````\O#R````````````````````````````````````
M`/3Q$^\`````````\_#PO`<'\0``````````\_'R]```````````````````
M\^M$1/```````/'P\+P'!P?O!_,``````/('!_3S````````````````````
MO$I$;?0``/3Q\O"3DP>\;^_W[_$```#S!P?S\O(`````````````````````
M[T1$[0#T\/'N1OD6![P@(&_O[_$```<'\?.\````````````````````````
M^$1$!_#PDR`@^18'[B`@($8'!_*\![SS\/````````````````````````#S
M;6T'O),@("#Y%@<'("`@'T7PO`<'\_&\```````````````````````````'
M[P>3("`@(/F3!P<@("`?'T7N\+SQ]```````````````````````````\P<'
MDQ\@("`@^9,'!R`@(!\?'T6\\0?T```````````````````````````'[^\?
M'R`@("#YD^_O("`@'Q\?`47Q\/0`````````````````````````\N\'11\?
M("`@($9N;6U$1>D?'Q\!`1SQ\?0````````````````````````'[^\!'Q\@
MZ6UM]P<'!P<'ZQ\?'P$!1?"\]`````````````````````````<';@$?'T4'
M!P>\[^\'!P?L'Q\?`0$!![ST````````````````````````[^X!`1_M!P<'
M;OD6[^\@("`?'Q\!`0&3!_,```````````````````````#OO`$!10<'$B`@
M(&YM^$7JZNKJZA,!`1P'\@```````````````````````.^\`0'O!^OI($7K
M[.WLZP<'O+P'[T0!DP?R````````````````````````!^X!10<'1"!%[>V2
M]_?O[/=%'P<'$@&3!_(````````````````````````'!P'W!_=%Z0?W!_#P
MO`?O[44![P=M`1P'\0````````````````````````>\\.\'Z[SO[^_P\O+Q
MO._K[[SO!^R\O._Q````````````````````````![SP!P=MO._WO/'S]//P
M[^SO\>\'[>\'[_$````````````````````````'O.\'!^N3'.\'\?/T\O#O
M[.V3]P?M'`?O\0```````````````````````+SN`6X'[T4@!Y*\\?'PO)*2
M'Q_O!^H!D^_P````````````````````````O+P!10<'$B!&!_<'!^_M[_<?
M'P<'$P&3[_````````````````````````#PO`$!'`?O1"!&!_`'!P<'[Q\2
M!^U$`1SW\````````````````````````/#P`0$?!P?W1"#Y;Y+O($9%$^_W
M1`$!'/>\````````````````````````\/`!`1]%!P<';41N[_=%$NL'[T0!
M`0$<D@?O[[ST``````````````````#Q\0$!'Q_ID[P'!^^2D@<'!^YN'P$!
M`9.2!_`'[^_R`````````````````/'Q`0$?'Q\@1FX'![R\[N]NZ1\?`0$!
M[9('\+P'[_#R````````````````\?$!`1\?'R`@(/EO!P<@("`@'Q\!`0'M
M[>_P!P?O[_+R``````````````#Q\`$!'Q\?("`@^6\'O"`@("`?'P$!`>WM
M[_`'!^^2D@<``````````````/+P`0$?'Q\@("#Y;P>\("`@(!\?`0$!;NSO
M\`?O[Y+L[/$`````````````\;QN;FYN;FYN;V^3!_"3;VYN;I,<[6[L[`>\
M!^_ODNSM!P````````````#Q\;P'!P?O[^_O[P<'O/#Q\O"\!^_ODNWL![P'
M[_>2[.SQ``````````````?WDO?N\;P'!P>\\/'Q\?"\O+R\!^_O[^SOO`?O
M]^WL^+P```````````#O%$1$[P````````````#T]/3SO`<'!_?P[Q+O!^SM
M[>SX]P``````````O!)#1.T``````````````/'P]/3R\+P'[_?SDOB2]```
M`/#M`````````/)M%41N]```````````````\;ST]/+P!^_ODN_O^/``````
M`/0`````````^!5$;?$`````````````````\/3T\O`'[_?M[`<'D@``````
M`````````!Q$1$H'````````````````````]/3R\`?O]^ST`.^2````````
M``````#O$D-$'`````````````````````#P\_'P!^^2\@```/#Q````````
M`````.T'[/@``````````````````````/#O\;P'[^\`````````````````
M`````)+M\P```````````````````````/('O`?O!P``````````````````
M`````````````````````````````````/3Q\`?O````````````````````
M``````````````````````````````````#T\O#S````````````````_C_C
M___P``#\/X#_#_```/P?`#X/\```_@P`'`_P``#_"``,'_```/^````?\```
M_X```#_P``#_P```?_```/^```!_\```_X```'_P``#_````/_```/\````_
M\```_P```#_P``#_````/_```/\````_\```_P```#_P``#_````/_```/\`
M```_\```_P```#_P``#_````/_```/\````_\```_P```#_P``#_````/_``
M`/\````_\```_P```#_P``#_`````_```/\````!\```_P````#P``#_````
M`'```/\`````<```_P`````P``#_`````#```/\`````,```_P`````P``#^
M#_P``#```/P?_``',```^!_\``^P``#X/_X`#_```/!__P!/\```X/__`.?P
M``#A__\!__```/'__X'_\```____P?_P``#____P__```"@```!`````@```
M``$`"````````!````````````````$````!``````````"```"`````@(``
M@````(``@`"`@```P,#``,#<P`#PRJ8`!`0$``@("``,#`P`$1$1`!86%@`<
M'!P`(B(B`"DI*0!5554`34U-`$)"0@`Y.3D`@'S_`%!0_P"3`-8`_^S,`,;6
M[P#6Y^<`D*FM````,P```&8```"9````S```,P```#,S```S9@``,YD``#/,
M```S_P``9@```&8S``!F9@``9ID``&;,``!F_P``F0```)DS``"99@``F9D`
M`)G,``"9_P``S````,PS``#,9@``S)D``,S,``#,_P``_V8``/^9``#_S``S
M````,P`S`#,`9@`S`)D`,P#,`#,`_P`S,P``,S,S`#,S9@`S,YD`,S/,`#,S
M_P`S9@``,V8S`#-F9@`S9ID`,V;,`#-F_P`SF0``,YDS`#.99@`SF9D`,YG,
M`#.9_P`SS```,\PS`#/,9@`SS)D`,\S,`#/,_P`S_S,`,_]F`#/_F0`S_\P`
M,___`&8```!F`#,`9@!F`&8`F0!F`,P`9@#_`&8S``!F,S,`9C-F`&8SF0!F
M,\P`9C/_`&9F``!F9C,`9F9F`&9FF0!F9LP`9ID``&:9,P!FF68`9IF9`&:9
MS`!FF?\`9LP``&;,,P!FS)D`9LS,`&;,_P!F_P``9O\S`&;_F0!F_\P`S`#_
M`/\`S`"9F0``F3.9`)D`F0"9`,P`F0```)DS,P"9`&8`F3/,`)D`_P"99@``
MF68S`)DS9@"99ID`F6;,`)DS_P"9F3,`F9EF`)F9F0"9F<P`F9G_`)G,``"9
MS#,`9LQF`)G,F0"9S,P`F<S_`)G_``"9_S,`F<QF`)G_F0"9_\P`F?__`,P`
M``"9`#,`S`!F`,P`F0#,`,P`F3,``,PS,P#,,V8`S#.9`,PSS`#,,_\`S&8`
M`,QF,P"99F8`S&:9`,QFS`"99O\`S)D``,R9,P#,F68`S)F9`,R9S`#,F?\`
MS,P``,S,,P#,S&8`S,R9`,S,S`#,S/\`S/\``,S_,P"9_V8`S/^9`,S_S`#,
M__\`S``S`/\`9@#_`)D`S#,``/\S,P#_,V8`_S.9`/\SS`#_,_\`_V8``/]F
M,P#,9F8`_V:9`/]FS`#,9O\`_YD``/^9,P#_F68`_YF9`/^9S`#_F?\`_\P`
M`/_,,P#_S&8`_\R9`/_,S`#_S/\`__\S`,S_9@#__YD`___,`&9F_P!F_V8`
M9O__`/]F9@#_9O\`__]F`"$`I0!?7U\`=W=W`(:&A@"6EI8`R\O+`+*RL@#7
MU]<`W=W=`./CXP#JZNH`\?'Q`/CX^`#P^_\`I*"@`("`@````/\``/\```#_
M_P#_````_P#_`/__``#___\`````````````````````````````````````
M`/'P\P``````````````````````````````````````````````````````
M``#RO&T`````````````````\+R\O`?P\@``````````````````]/0`]```
M```````````````````````````'\A,3[P````````````#S!_#PO`<'!P>\
M]`````````````#S\;P'\O0`````````````````````````````!VU$0VWQ
M``````````#Q\/'PO+P'!P?O[^_P``````````#TO`<'O/3S````````````
M``````````````````#O2D05^/0``````/3P\O+Q!Y.\!P>3[^_W]P?T````
M``#T\.\'!_3R\0```````````````````````````````.Q$1$0<`````/+P
M\O+PDT<7O`<';T:3]_?O!_,`````\^\'!_3SO/,`````````````````````
M``````````#S;D1#$NX``/+P\?+N;R#Y%P<'!V\@(&_W[^\'\@``]`<'!_+S
M\0<```````````````````````````````````?J1$/K\O*\\/&31B`@^1<'
M!P=O("`@1ASO!P?R``<'!_#T\KSP````````````````````````````````
M````'$1#1`<'O/!O("`@(/D7!P<';R`@("#IDP<'O+SO![ST\O`']```````
M``````````````````````````````!N1.\'O/!O("`@("#Y%P<'!V\@("`@
M'Q^3\;R\!P?S\_`'\P``````````````````````````````````````\?<'
M!P=O("`@("`@^1<'!P=O("`@(!\?Z6^\\/"\\_&\\@``````````````````
M`````````````````````/#O!P=N'R`@("`@(/D7!P<';R`@("`?'Q\!;O#Q
M\`>\\0```````````````````````````````````````/+O!P>3'Q\@("`@
M("#Y%P?O[V\@("`@'Q\?`0$<\?&\\```````````````````````````````
M```````````'[P>3'Q\?("`@("`@^1<'[^]O("`@(!\?'P$!`1SR\KP`````
M``````````````````````````````````#Q[^\'`1\?'R`@("`@(/D7!^_O
M;B`@("`?'Q\!`0%%O/+P\P``````````````````````````````````````
M!^\''`$?'Q\@("`@("!%$A(3$Q-$1$7I'Q\?`0$!`6[Q\?``````````````
M````````````````````````\>_O!P$!'Q\?("#I1!/K]^\'!P<'!^_W%!\?
M'P$!`0$![O"\`````````````````````````````````````+SO[^\!`1\?
M'^GMO`<'!P<'!P<'!P<'!Q0?'Q\!`0$!`1SPO/,`````````````````````
M```````````````'[P?M`0$?'^F\!P<'!_`'')+O[^\'!P<3'Q\?`0$!`0%N
M\+SR````````````````````````````````````!^^\10$!'^F\!P<'O!P@
M^1?O[_=N("`@(!\?'P$!`0$!1;P'\0``````````````````````````````
M``````?OO`$!`1_N!P?OZT8@(/D7[^_W;NE$1$1$1$1$1`$!`0&\!_$`````
M```````````````````````````````'[[P!`0%N!P<';>D@("!%$A(3$NKM
M]_?O[^_O[^Q$`0$!O`?Q````````````````````````````````````!P>\
M`0$!\`<'[$4@("`3[/CL^&WKD@<'!P<'!P?O$P$!`>X'\0``````````````
M``````````````````````<'O`$!;@<'[T0@("`4DNR2DO?O[VWO!^MN;@<'
M!VT!`0'N!_`````````````````````````````````````'![P!`0<'!Y)%
M("#K[Y*2[^_O]P<';0<2'Q]N!P?W1`%%!P?P````````````````````````
M````````````!P<'`0&\!P?K'Q]%O/?OO+SP\+P'O._L$Q\?1;P'[Q0!10<'
M\`````````````````````````````````````<'O.X'\`<'$@<'!P?OO/#Q
M\?'P\`<'ZQ+O[P>\!P<2[NX'[_``````````````````````````````````
M``"\![SP!_`'!^KPO`?O[_#Q\O/S\O`'[>T2\/#Q!P<'$KP'!^^\````````
M````````````````````````````O`>\\`?P!P?JO+R\]P?P\O/T]/+QO)*2
M$O#Q\;P'!^J\!P?OO````````````````````````````````````+R\O+P'
M\`<'$P<'!^\'\/+S]/3R\;R2[1*\[NZ\!P?J!P<'[[P`````````````````
M``````````````````#PO`<!`;P'!Q+I(&X']_#Q\O/R\?`']^T3Z1\?O`<'
M$P%%!^^\````````````````````````````````````\+P'`0'O!P?M12`@
MO.\'\/'Q\?"\[Y('$Q\?1;P'!Q,!10?O!P``````````````````````````
M`````````/"\!P$!;@<'!Q,@(&^\[^^\\+R\]^T'!Q(?'_@'!Y)$`44'[P<`
M``````````````````````````````````#P\+P!`0&\!P?L1"`@D[P'!P?W
MDO<'!P<2'P'K!P<2`0%%!_<'````````````````````````````````````
M\?"\`0$!1;P'!VWI("!&!_"\O+SO\?"\ZA\4[P>21`$!1>_W!P``````````
M`````````````````````````/'PO`$!`1^3!P?OZD4@(/E&[?<';R`@Z>D4
M]P?O%`$!`47O]P<```````````````````````````````````#Q\?`!`0$?
M'^X'!P?M$T;Y1N\'!V\@($03[P?O$@$!`0%%[Y+O[P>\]```````````````
M````````````````\?'P`0$!'Q\?[[P'!^_L$Q)M[/@2%.J2!P<'$@$!`0$!
M1>^2!_#O[.R2\0```````````````````````````/'Q\`$!`1\?'Q]OO`<'
M!P<'[_?W[P<'!P>\DQ\?`0$!`47OD@?Q\+P'[_<'````````````````````
M``````#Q\?$!`0$?'Q\?($:3![P'!P<'!P<'O+SO11\?'P$!`0%%[Y+O\/"\
M!P<'O+P`````````````````````````\?+Q`0$!'Q\?'R`@("!&D^\'![P'
MDT8@(!\?'Q\!`0$!1??M[[SPO`?O[P?S\@```````````````````````/'R
M\`$!`1\?'Q\@("`@(/E&!P<';R`@("`?'Q\?`0$!`47W[>_P\+P'[^_W[_/Q
M``````````````````````#Q\O`!`0$?'Q\?("`@("#Y1@<'O&\@("`@'Q\?
M'P$!`0%%]^WW\?`'!^_O]Y+OO/(`````````````````````\?*\`0$!'Q\?
M'R`@("`@^48'![QO("`@(!\?'Q\!`0$!1??LDO&\!P?O[_>2[>_O````````
M`````````````/'RO`$!`1\?'Q\@("`@(/D7!P>\;R`@("`?'Q\?`0$!`462
M[._PO`<'[^_W[>SLDO,```````````````````#Q\@<!`0$!`0$?'Q\?("`@
M1@<'\&X@'Q\?'P$!`0$!`0%$DNSO\+P'!^_ODNWL[.\'````````````````
M````\?$']^_O[^\'!^^2[^_O!^X'O/"\O`<'[P<'[KSPO.[O]^WL[_"\!P?O
M]Y+M[.SO!P```````````````````/#Q\/"\!P<'[^_O]^_O[P<'![R\\/'R
M\O'PO`<'[^_WDNWL[._PO`<'[_>2[>SL[_(```````````````````"\\+P'
M!P<'O`?O[^_O[^\'![R\\/#P\?&\O`<'!P?O[_>2[>WW\+P'[^_WDNWL[/?Q
M``````````````````#Q$D1$1$3L]`````````````````#T\O/S!P?O[^_O
M!P?O\+SL;?>\!^_O]Y+M[/CM!P````````````````#T;1%#1$3J]```````
M`````````````+ST]/3T\_'PO`?O[^_S!VWL]P?LZ^WW[Y+L[)(`````````
M````````["(10T1$\`````````````````````#W\O3T]//Q\+P'[^_W[_+O
M$NUM!P``````\NWL````````````````[T,B0T1$[P``````````````````
M````[?#T]/3R\?"\!^_ODI('!^T3\@``````````!P``````````````\401
M(D1$;@````````````````````````?P]/3T\O'P!P?O[Y+M]_`'[/<`````
M````````````````````]!)#0T1$2O0```````````````````````#RO/3T
M]/+Q\`<'[_>2[&WO\VWX`````````````````````````/A#0T-$1+P`````
M`````````````````````//T]//R\;P'!^_W[6WT\N_RZO,`````````````
M`````````.]#0T-$1!P```````````````````````````#T\_3S\O&\!P?O
M]_@`````O/3O`````````````````````._O0T-$1.P`````````````````
M`````````````/#R\_+PO`<'[Y('``````#R``````````````````````#M
M$A)$1&WT``````````````````````````````#P[_#R\+P'[^^2````````
M`/0`````````````````````\Y+Q\NWQ````````````````````````````
M``````?M!_"\!^_O]P````````````````````````````````#R[._Q````
M````````````````````````````````O.\'O`?O[^\`````````````````
M``````````````````````````````````````````````````````````#S
M\/"\!^_O````````````````````````````````````````````````````
M``````````````````````````#S]/+R!_(`````````````````````````
M``````````````````````````````````````````````````````#S\?#P
M`````````````````````````/____'______\?_P'_^7___@_\`'_@?__^!
M_@`/\!___\#X``/@'___X/```>`?___@8```P#____````!`/___^``````_
M___\`````'____P`````_____`````'____X`````_____@````#____\```
M``'____P`````?___^`````!____X`````#____@`````/___^``````____
MX`````#____@`````/___^``````____X`````#____@`````/___^``````
M____X`````#____@`````/___^``````____X`````#____@`````/___^``
M````____X`````#____@`````/___^``````____X`````#____@``````__
M_^```````___X``````!___@``````#__^```````'__X```````/__@````
M```?_^```````!__X```````#__@```````/_^````````__X```````#__@
M```````/_\`__@````__@'__````#_^`__\```^/_P'__P``'^_^`___```?
M__P#__\``!___`?__X``#__X#___@`>/__`?___`!]__\!___\`/[__P/___
MX`____A____P#_________@/_________@?_________A___*````%H```"T
M`````0`(``````!8(````````````````0````$``````````(```(````"`
M@`"`````@`"``("```#`P,``P-S``/#*I@`$!`0`"`@(``P,#``1$1$`%A86
M`!P<'``B(B(`*2DI`%5550!-34T`0D)"`#DY.0"`?/\`4%#_`),`U@#_[,P`
MQM;O`-;GYP"0J:T````S````9@```)D```#,```S````,S,``#-F```SF0``
M,\P``#/_``!F````9C,``&9F``!FF0``9LP``&;_``"9````F3,``)EF``"9
MF0``F<P``)G_``#,````S#,``,QF``#,F0``S,P``,S_``#_9@``_YD``/_,
M`#,````S`#,`,P!F`#,`F0`S`,P`,P#_`#,S```S,S,`,S-F`#,SF0`S,\P`
M,S/_`#-F```S9C,`,V9F`#-FF0`S9LP`,V;_`#.9```SF3,`,YEF`#.9F0`S
MF<P`,YG_`#/,```SS#,`,\QF`#/,F0`SS,P`,\S_`#/_,P`S_V8`,_^9`#/_
MS``S__\`9@```&8`,P!F`&8`9@"9`&8`S`!F`/\`9C,``&8S,P!F,V8`9C.9
M`&8SS`!F,_\`9F8``&9F,P!F9F8`9F:9`&9FS`!FF0``9IDS`&:99@!FF9D`
M9IG,`&:9_P!FS```9LPS`&;,F0!FS,P`9LS_`&;_``!F_S,`9O^9`&;_S`#,
M`/\`_P#,`)F9``"9,YD`F0"9`)D`S`"9````F3,S`)D`9@"9,\P`F0#_`)EF
M``"99C,`F3-F`)EFF0"99LP`F3/_`)F9,P"9F68`F9F9`)F9S`"9F?\`F<P`
M`)G,,P!FS&8`F<R9`)G,S`"9S/\`F?\``)G_,P"9S&8`F?^9`)G_S`"9__\`
MS````)D`,P#,`&8`S`"9`,P`S`"9,P``S#,S`,PS9@#,,YD`S#/,`,PS_P#,
M9@``S&8S`)EF9@#,9ID`S&;,`)EF_P#,F0``S)DS`,R99@#,F9D`S)G,`,R9
M_P#,S```S,PS`,S,9@#,S)D`S,S,`,S,_P#,_P``S/\S`)G_9@#,_YD`S/_,
M`,S__P#,`#,`_P!F`/\`F0#,,P``_S,S`/\S9@#_,YD`_S/,`/\S_P#_9@``
M_V8S`,QF9@#_9ID`_V;,`,QF_P#_F0``_YDS`/^99@#_F9D`_YG,`/^9_P#_
MS```_\PS`/_,9@#_S)D`_\S,`/_,_P#__S,`S/]F`/__F0#__\P`9F;_`&;_
M9@!F__\`_V9F`/]F_P#__V8`(0"E`%]?7P!W=W<`AH:&`):6E@#+R\L`LK*R
M`-?7UP#=W=T`X^/C`.KJZ@#Q\?$`^/CX`/#[_P"DH*``@("`````_P``_P``
M`/__`/\```#_`/\`__\``/___P``````````````````````````````````
M`````````````````````/+P\0``````````````````````````````````
M``````````````````````````````````````````````````#T\>SQ````
M`````````````````````/*\O+P'\/(`````````````````````````````
M````````````````````````````````````````````````````\?/O$I(`
M`````````````````````/,'O/"\O`<'![SQ````````````````````````
M`//S\_3S\P```````````````````````````````````````````/+P\1,5
M$>\```````````````````"\!_'P\+R\!P<'!^^\\P``````````````````
M`/3R\`<'!_3T````````````````````````````````````````````\/!M
M1$,B$_$```````````````#T!_#Q\?#PO+P'!P<'[^_OO```````````````
M``#T\0?O!P?R]/,```````````````````````````````````````````#T
M[T1$0R)#;?0`````````````\0?R\?'PO`>\!P<'[N_O[^_O[_,`````````
M````]/('[P<'\`#S\0``````````````````````````````````````````
M``#T;41$0T,B[0```````````+SP\O+Q\0=OD[P'!P?OD^_O[_?W[_``````
M``````#S!^\'![P`]/'P````````````````````````````````````````
M``````#S2D1$0R)$!P```````//P\?+R\O"31OF3O`<'!^\@;^_O]_?O[[ST
M````````]`?O!P<']/3R!_,`````````````````````````````````````
M``````````#O1$1#(D,3\@````#R\/'Q\O(';R#Y^9,'!P<'[R`@1I/W[^_O
M[P?S``````#Q[P<'!_/T\_'O````````````````````````````````````
M``````````````#L1$1#0Q'K````\KSP\?+R[T8@(/GYDP<'!P>3("`@(&_W
M[^_O![SS````\N\'!P?Q]//Q![P`````````````````````````````````
M`````````````````/1M1$1#(D/M`/*\\/#QO&\@("`@^?F3!P<'!Y,@("`@
M($8<[^\'![SS`/,'[P<'O/3S\O#O\P``````````````````````````````
M`````````````````````/!$1$0B$>KPO+SP\>Y&("`@("#Y^9,'!P<'DR`@
M("`@(!]O[P<'![SQ!^\'!P?T\_+P!P<`````````````````````````````
M`````````````````````````.]$1$-$[P>\O/`'1B`@("`@(/GYDP<'!P?O
M("`@("`@'Q]O![P'O+P'!P<'\_3R\;P']```````````````````````````
M`````````````````````````````&Y$1.\'![SP!^D@("`@("`@^?F3!P<'
M!Y,@("`@("`?'Q]O\[R\O/`'!_+T\O&\!_,`````````````````````````
M````````````````````````````````].KW!P<'O`?I("`@("`@("#Y^9,'
M!P<'[R`@("`@(!\?'Q]O![R\\+P']//Q\`?Q````````````````````````
M````````````````````````````````````!P<'![SOZ1\@("`@("`@(/GY
MDP<'[^^3("`@("`@'Q\?'Q]%!_#P\;R\\?`'\```````````````````````
M`````````````````````````````````````/`'!P<'!^D?'R`@("`@("`@
M^?F3!P?O[Y,@("`@("`?'Q\?'P%%!_#Q\0<'O/``````````````````````
M``````````````````````````````````````#R!^\'!P=%'Q\?("`@("`@
M("#Y^9,'!^_O'"`@("`@(!\?'Q\?`0%NO/'Q\N_P````````````````````
M``````````````````````````````````````````?O[P<';A\?'Q\@("`@
M("`@(/GYDP?O[^\<("`@("`@'Q\?'Q\!`0%N\/'R\;P`````````````````
M``````````````````````````````````````````#Q[^\'!Y,?'Q\?'R`@
M("`@("`@^?F3!^_O[Y(@("`@("`?'Q\?'P$!`0'M\?+R!P``````````````
M``````````````````````````````````````````````?O[P<'`1\?'Q\?
M("`@("`@("#Y^9,'[^_O[2`@("`@(!\?'Q\?`0$!`44'\O+Q\```````````
M``````````````````````````````````````````````#P[^_O!VX!'Q\?
M'Q\@("`@("`@("!&;FUM;6WJ147I("`@'Q\?'Q\!`0$!`6[R\?&\]```````
M``````````````````````````````````````````````````?O[^\'`0$?
M'Q\?'R`@("`@1403;>OL[.SL[.SL^&WJ$T0?'Q\?'P$!`0$!`>_Q\/#P````
M``````````````````````````````````````````````````#R[^_O!T4!
M`1\?'Q\?("`@;FWKDN_O[^_O[^_O[^_O[^_L1!\?'Q\?`0$!`0$!;O#PO/``
M``````````````````````````````````````````````````````?O[^_N
M`0$!'Q\?'Q\@1;R\[^\'!P<'!P<'!P<'!P<'!Y)$'Q\?'Q\!`0$!`0$!!_"\
MO/0`````````````````````````````````````````````````````!^_O
M[P<!`0$?'Q\?Z>_P!P<'!P<'O/#P!P<'!P>\\?"\]T0?'Q\?'P$!`0$!`0'O
M\+P'\@`````````````````````````````````````````````````````'
M[^\'[P$!`1\?'Q\'O`<'!P>\\.]O1I/O[^_O;B`@1F[M1!\?'Q\?`0$!`0$!
M`9+PO`?R````````````````````````````````````````````````````
M`._O[[QN`0$!'Q\?![P'!P<'\.]&(/GYD^_O[_?L("`@("`@'Q\?'Q\!`0$!
M`0$!;KR\!_(`````````````````````````````````````````````````
M````[^_O\$4!`0$?'P>\!P?O]_=&("`@^?F3[^_O]^P@("`@("`?'Q\?'P$!
M`0$!`0%%O`<'\@``````````````````````````````````````````````
M``````#O[^_P10$!`1]N\`<'!^T3("`@("#Y^9/L^.SW["#KZA(2ZNKJZNKJ
MZA,!`0$!`46\!P?Q````````````````````````````````````````````
M``````````?O!_!%`0$!1?`'!P?W$^D@("`@($43ZFWX;1(2(._O[^_O[^_O
M[^_O[1,!`0$!1;P'!_$`````````````````````````````````````````
M````````````!^\'O$4!`0'OO`<'[VU%("`@("`3^)+L;>IM^/CK[P<'!P<'
M!P<'!P?O;0$!`0%%O`<'\0``````````````````````````````````````
M```````````````'[P>\10$!`?`'!P?M$R`@("#I$^WL[)+O[P?O^.KO!P?O
MDN\'[KP'!^_L1`$!`44'!P?Q````````````````````````````````````
M``````````````````<'![Q%`0%N\`<'[VT?("`@(!+M[)+M[.SL[)('[Q+W
M!^_J'Q\?;KP'!_<3`0$!10<'!_$`````````````````````````````````
M````````````````````!P<'O$4!`0<'!P?W$R`@("#L]_?W[??O[^_W]P?P
M!Q+O[Q(?'Q]%\`<'[VT>`0%N!P<'\0``````````````````````````````
M```````````````````````'!P>\1`$!\0<'[^Q$("`@;KSO[Y+O![R\O`<'
M![SQ[VWO$Q\?'Q^\!P?O[$0!`6X'!^_P````````````````````````````
M``````````````````````````<'![QN143Q!P?OZT1%147N!P?W![SP\/#P
M\+R\O+R\Z_<2145%1>\'!P?W$T5%;@<'[_``````````````````````````
M````````````````````````````!P<'O+R\[_$'!^]M!P<'[_$'[P>\\/'Q
M\?'Q\+R\!^_W[!('!P<'[[P'!_<2O+R\!P?O\```````````````````````
M```````````````````````````````'!P>\\/#W\0<'[^KP\+SW\`?OO/#Q
M\O+S\O+Q\+SODN]M$KSP\/'O\`<'[Q*\O`<'[^_P````````````````````
M``````````````````````````````````<'O+SP\9+P!P?OZO"\O.^\[^^\
M\/+S\_3S\_+QO`?M[VT2\/#Q\0?P!P?O$[P'!P?O[_``````````````````
M````````````````````````````````````O`>\O/#Q[_`'!^]M\+R\[_#O
M[_#Q\O/T]/3S\O'P!^T'[!+P\/'Q![P'!^\2O`<'!^_OO```````````````
M``````````````````````````````````````"\![R\\/`'\`<'[VWO!P<'
M\`?W\/'R\_3T]//R\?`'[>_W$KR\O+P'O`<'[Q('!P<'[^^\````````````
M`````````````````````````````````````````+P'O`=%147Q!P?O[$5&
M1D:\!Y*\\/'R\_3S\O+PO._M]^\31D5%1>V\!P?O$T5%;P?O[[P`````````
M````````````````````````````````````````````O+R\!T0!`;P'!P>2
M$R`@(.V\[^_P\?+R\O+R\?"\[^_W[Q,?'Q\?[P<'!_<4`0%N!^_OO```````
M``````````````````````````````````````````````#PO/`'1`$![P<'
M!^_JZ2`@1O$']P?P\?'Q\?'PO`?W[0?O$Q\?'Q_P!P?O[$0!`6X'[_>\````
M`````````````````````````````````````````````````/"\\`=$`0%%
M\`<'[^Q$("`@;_`'[^_P\/#P\+P'DNT'!^\3'Q\?1;P'!^]M`0$!;N_O][P`
M````````````````````````````````````````````````````\+SP!T0!
M`0&\!P<']Q,@("`@[[P'!^\'!P?O]Y*2!P<'[Q,?'Q\2[P<']Q0!`0%N[^_W
M!P````````````````````````````````````````````````````#PO/"\
M1`$!`6[P!P?O[!,@("`@[_&\!_+P!^\'![P'!P?O$B`?1/CO!^_K1`$!`6[O
M[_<'`````````````````````````````````````````````````````/#P
M\+Q$`0$!`?>\!P?O^$0@("`@1N_Q\+R\O/`'[_'PO`?J(!_J[P<'DA,!`0$!
M;N_W]P<`````````````````````````````````````````````````````
M\?#QO$0!`0$!`;P'!P?OZT0@("`@^48<DO?O]Y-&;FYN;D7I$Y('!^_J`0$!
M`0%N[_>2!P``````````````````````````````````````````````````
M``#Q\/&\1`$!`0$?1?`'!P?O^!/I("#Y^6_O[P<''"`@("`@11*2!P?OZT0!
M`0$!`6[O]Y('\P``````````````````````````````````````````````
M`````/'P\;Q$`0$!`1\?[?$'!P?ODFT31OGY;^_O!P<<("`@11-M]P<'[^M$
M`0$!`0$!;N_WD@?O[^\'\0``````````````````````````````````````
M````````\?#Q\$0!`0$!'Q\?;O"\!P<'[^WJ$T1NDN\'!_A%1!/KDN\'!P?X
M1`$!`0$!`0%N[_>2!_$']^WL[0?T````````````````````````````````
M``````````#Q\?'P1`$!`0$?'Q\?10?P!P<'!^_W[>SK;>KJ;?CL]^\'!P>\
M!T0?`0$!`0$!`6[ODI('\?'PO.^2[9('````````````````````````````
M`````````````/'Q\O!%`0$!`1\?'Q\@'^WQO`<'!P<'[^_O[^_O[P<'!P>\
M\/<?'Q\!`0$!`0$!;O>2[0?Q\?"\!P?O[^\']```````````````````````
M````````````````\?'R\$4!`0$!'Q\?'R`@($;MO/"\!P<'!P<'!P<'!P?P
M\0=%'Q\?'P$!`0$!`0%N]Y+M!_#Q\+P'!P?O![R\]```````````````````
M``````````````````#Q\?+P10$!`0$?'Q\?("`@("`@19.\\/'Q\/#P\/&\
M[V[I("`?'Q\?`0$!`0$!`6[WDNT'O/#PO`<'[^_OO/+Q]```````````````
M`````````````````````/'R\O!%`0$!`1\?'Q\@("`@("`@(/GY;Y*2]^_M
M("`@("`@(!\?'Q\!`0$!`0$!;O?M[>\'\/"\!P?O[^_W\0#T````````````
M````````````````````````\?+R\$4!`0$!'Q\?'R`@("`@("`@^?EO!P<'
MO!P@("`@("`@'Q\?'P$!`0$!`0%N]^WM[_#PO+P'!^_O[_>2\//Q````````
M``````````````````````````#Q\O+P10$!`0$?'Q\?("`@("`@("#Y^6\'
M!P>\'"`@("`@("`?'Q\?`0$!`0$!`462[>SW\?"\O`<'[^_O]Y+MO/#R````
M`````````````````````````````/'R\KQ%`0$!`1\?'Q\@("`@("`@(/GY
M;P<'![P<("`@("`@(!\?'Q\!`0$!`0$!19+M[)+Q\+P'!P?O[_?WDNV2!^\`
M````````````````````````````````\?+RO$4!`0$!'Q\?'R`@("`@("`@
M^?EO!P<'O),@("`@("`@'Q\?'P$!`0$!`0%%DNWL]_'PO`<'!^_O]_>2[>R2
M][P```````````````````````````````#Q\O*\10$!`0$?'Q\?("`@("`@
M("#Y^6\'!P>\DR`@("`@("`?'Q\?`0$!`0$!`462[.SO\?"\!P<'[^_WDI+M
M[.SMD@```````````````````````````````/'R\0=%`0$!`1\?'Q\?("`@
M("`@(/GYDP<'O+SO("`@("`@(!\?'Q\!`0$!`0$!19+L[._Q\+P'!P?O[_>2
MDNWL[/?O````````````````````````````````\?+Q!T4>(T0C(R-$145$
M`45%145%1463!P>\\.]%145%145%145%145$1$1$1$1N[>SL[_#PO`<'[^_O
M]Y+M[>SL]P?P``````````````````````````````#P\O$'[^\'!P<'!P<'
M!^_W]_?O[^\'![P'![SP\+R\!P?O[^\'!P>\\/'P\+P'[_?M[.SO\/"\!P?O
M[^_WDNWM[.SM\;P``````````````````````````````/#Q\?#PO+P'!P<'
M[^_O[_?W[^_O[P<'!P<'O+SP\/'Q\O+Q\/"\!P<'[^_O]Y*2[>SL[._PO+P'
M!^_O[_>2[>SL[.SS\0````````````````````````````#T\/'Q\/"\O`<'
M!P<'[^_O]_?O[^_O!P<'![R\\/#Q\?+R\O'P\+P'!P?O[^_WDI+M[.SL[_"\
MO`<'[^_O]Y+M[.SL^//R```````````````````````````````'!P<'[^\'
M!P>\\?`'!^_O[^_O[^\'!P>\\/#Q\/#P\+P'!P<'!P<'!P<'[^_O]_?M[>WO
M![P'!P?O[_?WDNWL[.SX!_``````````````````````````````O!(4%41$
M1$1N\/0```````````````````````#T\_+S\_('[_>2DI*2[P<'!^\'\KR2
M;?B2!P<'!^_O]_>2[>SL^/CO!P```````````````````````````/+J$")#
M(D1$1`<```````````````````````````#S\/3T]/3T]//R\?"\!P?O[Y*\
M``?L$^R2!P<'DFUMZ_CK[.SX^)+O````````````````````````````^!`1
M(D-$1$0<`````````````````````````````/$']/3T]/3S\O+Q\+P'!^_O
M]_?P]._K$Y*2[^KX!P````#Q!_?X[.T``````````````````````````!Q$
M$")#(D1$;O0`````````````````````````````\/?T]/3T]//R\?'PO`<'
M[^_W]^_R\O=MZO@2\```````````]._L[0````````````````````````"\
M$Q`10T-$1$KT``````````````````````````````#P[/'T]/3T\_+Q\/"\
M!P?O[_>2D@?T!^SJZ_0```````````````?O````````````````````````
M`!(1(B)#1$1$\````````````````````````````````/+MO/3T]/3S\O'P
MO+P'!^_O]Y+MDKP'^.P3]P``````````````````````````````````````
M`/3K0Q!#0T1$1!P`````````````````````````````````].\']/3T]//R
M\?"\!P<'[^_WDNWM]_#T[^N2````````````````````````````````````
M````[1`10R)$1$3L````````````````````````````````````\+ST]/3T
M\_+Q\+P'!^_O[_>2[!+L[_*\%6T`````````````````````````````````
M``````=$$2)#1$1$;?(```````````````````````````````````#T\O3T
M]/3S\O'PO`<'[^_O]^T3[`#O[0?O%/$`````````````````````````````
M``````#P$A`10T-$1$J\````````````````````````````````````````
M]/3T]//R\?"\!P?O[_?WZNT`````]_#W[0``````````````````````````
M`````````.LB$2)#1$1$[P``````````````````````````````````````
M``#S]/3T\_+Q\+P'!^_O]^SL````````!_*2````````````````````````
M`````````/`'$B(B0T1$1/CU````````````````````````````````````
M`````/'P]//S\O'PO`<'[^_W^/0`````````\?/P````````````````````
M````````````[.\20R)$1$1N````````````````````````````````````
M````````\0>\\_+R\?"\!P?O[_>2````````````]```````````````````
M``````````````#W$FUM1$1$2O(`````````````````````````````````
M````````````!^\'\O'P\+P'!^_ODO``````````````````````````````
M``````````````````"2!_'Q'&WO````````````````````````````````
M``````````````#T]^WO\?"\O`<'[^_M\P``````````````````````````
M`````````````````````/22O/+R\0``````````````````````````````
M``````````````````#T[^_O\+P'!P?O[Y+T````````````````````````
M``````````````````````````"\[`?Q````````````````````````````
M``````````````````````#TO`<'O`<'!^_O]_0`````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````\O#Q\`?O[^_W\@``````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````//S]/*\[_<'````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````````#S]/3T\@<`````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````]/'P\/(`````````
M``````````````````````````#______X_______\#__P___@/______\#_
M_@__^`#__^!__\#__`?_\``__X!__\#__`/_P``?_P!__\#__`'_@``'_@)_
M_\#__@'_```#_@1__\#__P#\````_`!__\#__X!X````?`#__\#__\!P````
M.`#__\#__\`@````$`#__\#__^````````'__\#___````````'__\#___@`
M``````/__\#___@```````?__\#___P```````___\#___@``````!___\#_
M__```````#___\#___```````#___\#__^```````#___\#__^```````!__
M_\#__\````````___\#__\````````___\#__X````````___\#__X``````
M``?__\#__X````````?__\#__X````````?__\#__X````````?__\#__X``
M``````?__\#__X````````?__\#__X````````?__\#__X````````?__\#_
M_X````````?__\#__X````````?__\#__X````````?__\#__X````````?_
M_\#__X````````?__\#__X````````?__\#__X````````?__\#__X``````
M``?__\#__X````````?__\#__X````````?__\#__X````````?__\#__X``
M``````?__\#__X````````?__\#__X````````?__\#__X````````?__\#_
M_X````````?__\#__X````````?__\#__X````````?__\#__X````````/_
M_\#__X`````````__\#__X`````````'_\#__X`````````#_\#__X``````
M````_\#__X``````````?\#__X``````````/\#__X``````````O\#__X``
M````````'\#__X``````````#\#__X``````````#\#__X``````````!\#_
M_X``````````!\#__X``````````!\#__X```````````\#__X``````````
M`\#__X```````````\#__P```````````\#__X```````````\#__P`?__@`
M`````\#__@!___P``$```\#__@#___P````/`\#__`#___P````_P\#_^`'_
M__P```!_\\#_^`/___P```!__\#_X`?___P```!__\#_X`____X```!__\#_
MP`____X``!`__\#_@!____^``#P__\#_@#____^``'X__\#^`#____^``'\?
M_\#^`/____^``/^__\#^`/_____``/___\#_`?_____``/___\#_`______@
M`/___\#_P______P`/___\#________\`/___\#_________`/___\#_____
M____P/___\#_________\'___\`H````%@```"P````!``@``````!`"````
M```````````!`````0``````````@```@````("``(````"``(``@(```,#`
MP`#`W,``\,JF``0$!``("`@`#`P,`!$1$0`6%A8`'!P<`"(B(@`I*2D`5555
M`$U-30!"0D(`.3DY`(!\_P!04/\`DP#6`/_LS`#&UN\`UN?G`)"IK0```#,`
M``!F````F0```,P``#,````S,P``,V8``#.9```SS```,_\``&8```!F,P``
M9F8``&:9``!FS```9O\``)D```"9,P``F68``)F9``"9S```F?\``,P```#,
M,P``S&8``,R9``#,S```S/\``/]F``#_F0``_\P`,P```#,`,P`S`&8`,P"9
M`#,`S``S`/\`,S,``#,S,P`S,V8`,S.9`#,SS``S,_\`,V8``#-F,P`S9F8`
M,V:9`#-FS``S9O\`,YD``#.9,P`SF68`,YF9`#.9S``SF?\`,\P``#/,,P`S
MS&8`,\R9`#/,S``SS/\`,_\S`#/_9@`S_YD`,__,`#/__P!F````9@`S`&8`
M9@!F`)D`9@#,`&8`_P!F,P``9C,S`&8S9@!F,YD`9C/,`&8S_P!F9@``9F8S
M`&9F9@!F9ID`9F;,`&:9``!FF3,`9IEF`&:9F0!FF<P`9IG_`&;,``!FS#,`
M9LR9`&;,S`!FS/\`9O\``&;_,P!F_YD`9O_,`,P`_P#_`,P`F9D``)DSF0"9
M`)D`F0#,`)D```"9,S,`F0!F`)DSS`"9`/\`F68``)EF,P"9,V8`F6:9`)EF
MS`"9,_\`F9DS`)F99@"9F9D`F9G,`)F9_P"9S```F<PS`&;,9@"9S)D`F<S,
M`)G,_P"9_P``F?\S`)G,9@"9_YD`F?_,`)G__P#,````F0`S`,P`9@#,`)D`
MS`#,`)DS``#,,S,`S#-F`,PSF0#,,\P`S#/_`,QF``#,9C,`F69F`,QFF0#,
M9LP`F6;_`,R9``#,F3,`S)EF`,R9F0#,F<P`S)G_`,S,``#,S#,`S,QF`,S,
MF0#,S,P`S,S_`,S_``#,_S,`F?]F`,S_F0#,_\P`S/__`,P`,P#_`&8`_P"9
M`,PS``#_,S,`_S-F`/\SF0#_,\P`_S/_`/]F``#_9C,`S&9F`/]FF0#_9LP`
MS&;_`/^9``#_F3,`_YEF`/^9F0#_F<P`_YG_`/_,``#_S#,`_\QF`/_,F0#_
MS,P`_\S_`/__,P#,_V8`__^9`/__S`!F9O\`9O]F`&;__P#_9F8`_V;_`/__
M9@`A`*4`7U]?`'=W=P"&AH8`EI:6`,O+RP"RLK(`U]?7`-W=W0#CX^,`ZNKJ
M`/'Q\0#X^/@`\/O_`*2@H`"`@(````#_``#_````__\`_P```/\`_P#__P``
M____``````#Q\P```//P\@````#S]`````````````!*Z@``\NZ\!^_S`/('
M\P````````````#N1.WPD_GN;V\'\P?R\0``````````````[>]O(/D';R!%
MO/'P````````````````!VX?(/D';R`?1?#T``````````````#T!Q\?16[X
MZT0?`0?S``````````````#P[Q_L!QR2;D4?`6[Q``````````````"\'&[M
MZ47KZ^SLZD6\``````````````#P'.\2;O?P!^M%[$6\``````````````#P
M\`?M]_#T\>R\[^\'``````````````#QD^]M[0?QO/AN[VX'````````````
M``#Q'&[M1??W]^MM^$4'``````````````#R'`'M[$7W;FV21$7O\?,`````
M``````#R'`$?;O?O!^Q%`47O\`?P``````````#S'`$?("`';R`?`47WO._O
M\0````````#S[45%1D;NDT9%16Z2O._M[P````````#N[^\'[P?P\?"\!^_M
MO._M[P```````/-$$O,`````\O3R!_<'[^\'[0```````!)$[@``````\O3R
M!_>2D@``````````DD3M`````````/3Q!^WR!_,`````````[Y(`````````
M`/('!P<`````````````````````````````\KP``````````/.//`#S`CP`
M\``\`/@`?`#X`'P`\`!\`/``?`#P`'P`\`!\`/``?`#P`'P`\`!\`/``'`#P
C``P`\``$`/``!`#P``0`X>`$`./@/`#'\!P`S_#\`/_\_```
`
end

View File

@@ -0,0 +1,164 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by winhcksp.rc
//
#define IDC_MYICON 2
#define IDD_WINHACK_DIALOG 102
#define IDD_ABOUTBOX 103
#define IDS_APP_TITLE 103
#define IDM_ABOUT 104
#define IDM_EXIT 105
#define IDS_HELLO 106
#define IDI_WINHACK 107
#define IDC_WINHACK 109
#define IDC_SPHONE_DIALOGBAR 111
#define IDC_SPHONE_TEXTDIALOGBAR 112
#define IDR_MAINFRAME 128
#define IDB_TILES 129
#define IDD_TEXT 130
#define IDD_NHTEXT 130
#define IDD_MENU 132
#define IDB_MENU_SEL 133
#define IDB_MENU_UNSEL 134
#define IDD_COMMANDS 136
#define IDD_GETLIN 138
#define IDD_EXTCMD 139
#define IDD_PLAYER_SELECTOR 141
#define IDB_PETMARK 145
#define IDB_MENU_SEL_COUNT 146
#define IDB_KEYPAD 147
#define IDB_MENUBAR 154
#define IDC_TEXT_VIEW 1001
#define IDC_CMD_MOVE_NW 1001
#define IDC_CMD_MOVE_N 1002
#define IDC_MENU_LIST 1003
#define IDC_CMD_MOVE_NE 1003
#define IDC_MENU_TEXT 1004
#define IDC_CMD_MOVE_W 1004
#define IDC_CMD_MOVE_SELF 1005
#define IDC_CMD_MOVE_E 1006
#define IDC_CMD_MOVE_SW 1007
#define IDC_CMD_MOVE_S 1008
#define IDC_CMD_MOVE_SE 1009
#define IDC_CMD_MOVE_UP 1010
#define IDC_CMD_MOVE_DOWN 1011
#define IDC_CMD_5 1012
#define IDC_CMD_A 1013
#define IDC_CMD_B 1014
#define IDC_CMD_C 1015
#define IDC_CMD_D 1016
#define IDC_CMD_E 1017
#define IDC_CMD_F 1018
#define IDC_CMD_G 1019
#define IDC_CMD_H 1020
#define IDC_CMD_I 1021
#define IDC_CMD_J 1022
#define IDC_CMD_K 1023
#define IDC_CMD_L 1024
#define IDC_CMD_M 1025
#define IDC_CMD_N 1026
#define IDC_CMD_O 1027
#define IDC_CMD_P 1028
#define IDC_CMD_Q 1029
#define IDC_CMD_R 1030
#define IDC_CMD_S 1031
#define IDC_CMD_T 1032
#define IDC_CMD_U 1033
#define IDC_CMD_V 1034
#define IDC_CMD_W 1035
#define IDC_CMD_X 1036
#define IDC_CMD_Y 1037
#define IDC_CMD_Z 1038
#define IDC_CMD_AA 1039
#define IDC_CMD_BB 1040
#define IDC_CMD_CC 1041
#define IDC_CMD_DD 1042
#define IDC_CMD_EE 1043
#define IDC_CMD_FF 1044
#define IDC_CMD_GG 1045
#define IDC_CMD_HH 1046
#define IDC_CMD_II 1047
#define IDC_CMD_JJ 1048
#define IDC_CMD_KK 1049
#define IDC_CMD_LL 1050
#define IDC_CMD_MM 1051
#define IDC_CMD_NN 1052
#define IDC_CMD_OO 1053
#define IDC_CMD_PP 1054
#define IDC_CMD_QQ 1055
#define IDC_CMD_RR 1056
#define IDC_CMD_SS 1057
#define IDC_CMD_TT 1058
#define IDC_CMD_UU 1059
#define IDC_CMD_VV 1060
#define IDC_CMD_WW 1061
#define IDC_CMD_XX 1062
#define IDC_CMD_YY 1063
#define IDC_CMD_ZZ 1064
#define IDC_CMD_FIRST 1100
#define IDC_CMD_LAST 1300
#define IDC_GETLIN_EDIT 1309
#define IDC_EXTCMD_LIST 1310
#define IDC_PLSEL_NAME 1314
#define IDC_PLSEL_ROLE_RANDOM 1315
#define IDC_PLSEL_RACE_RANDOM 1318
#define IDC_PLSEL_GENDER_RANDOM 1319
#define IDC_PLSEL_ALIGN_RANDOM 1320
#define IDC_PLSEL_ROLE_LIST 1323
#define IDC_PLSEL_RACE_LIST 1324
#define IDC_PLSEL_ALIGN_LIST 1325
#define IDC_PLSEL_GENDER_LIST 1326
#define IDC_ABOUT_VERSION 1327
#define IDC_TEXT_CONTROL 1331
#define IDC_ABOUT_COPYRIGHT 1332
#define IDC_TEXT_TOGGLE_WRAP 1333
#define IDM_SAVE 32771
#define IDM_HELP_LONG 32772
#define IDM_HELP_COMMANDS 32773
#define IDM_HELP_HISTORY 32774
#define IDM_HELP_INFO_CHAR 32775
#define IDM_HELP_INFO_KEY 32776
#define IDM_HELP_OPTIONS 32777
#define IDM_HELP_OPTIONS_LONG 32778
#define IDM_HELP_EXTCMD 32779
#define IDM_HELP_LICENSE 32780
#define IDM_MAP_TILES 32781
#define IDM_MAP_ASCII4X6 32782
#define IDM_MAP_ASCII6X8 32783
#define IDM_MAP_ASCII8X8 32784
#define IDM_MAP_ASCII16X8 32785
#define IDM_MAP_ASCII7X12 32786
#define IDM_MAP_ASCII8X12 32787
#define IDM_MAP_ASCII16X12 32788
#define IDM_MAP_ASCII12X16 32789
#define IDM_MAP_ASCII10X18 32790
#define IDM_MAP_FIT_TO_SCREEN 32791
#define ID_FILE 32792
#define IDS_CAP_FILE 32793
#define ID_HELP 32794
#define IDS_CAP_HELP 32795
#define IDS_CAP_TEMP 32796
#define ID_MAP 32797
#define IDS_CAP_AMP 32798
#define IDS_CAP_MAP 32799
#define IDM_VIEW_KEYPAD 32800
#define ID_VIEW 32801
#define IDS_CAP_VIEW 32802
#define IDS_CAP_ENTIREMAP 32826
#define IDS_CAP_NORMALMAP 32827
#define IDM_HELP_MENU 32828
#define IDM_VIEW_OPTIONS 32829
#define IDM_DIRECT_COMMAND 32830
#define IDS_TEXT_WRAP 32831
#define IDS_TEXT_UNWRAP 32832
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 155
#define _APS_NEXT_COMMAND_VALUE 32833
#define _APS_NEXT_CONTROL_VALUE 1334
#define _APS_NEXT_SYMED_VALUE 110
#endif
#endif

187
outdated/sys/wince/winMS.h Normal file
View File

@@ -0,0 +1,187 @@
/* NetHack 3.6 winMS.h $NHDT-Date: 1433806609 2015/06/08 23:36:49 $ $NHDT-Branch: master $:$NHDT-Revision: 1.29 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#ifndef WINMS_H
#define WINMS_H
#pragma warning(disable : 4142) /* benign redefinition of type */
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <commctrl.h>
#include <tchar.h>
#include <newres.h>
#include "resource.h"
#include "hack.h"
#if defined(WIN_CE_POCKETPC)
#include <aygshell.h>
#include <sipapi.h>
#endif
#if defined(WIN_CE_SMARTPHONE)
#include <aygshell.h>
#include <sipapi.h>
#include <shlobj.h>
#include <prsht.h>
#include <Tpcshell.h>
#include <windowsm.h>
#include <KEYBD.H>
#endif
#if defined(WIN_CE_PS2xx) || defined(WIN32_PLATFORM_HPCPRO)
#include <sipapi.h>
#endif
/* Taskbar Menu height */
#define MENU_HEIGHT 26
/* Create an array to keep track of the various windows */
#ifndef MAXWINDOWS
#define MAXWINDOWS 15
#endif
/* RIP window ID */
#define NHW_RIP 32
#define NHW_KEYPAD 33
/* size of tiles */
#ifndef TILE_X
#define TILE_X 16
#endif
#define TILE_Y 16
/* tiles per line in the bitmap */
#define TILES_PER_LINE 40
/* tile background color */
#define TILE_BK_COLOR RGB(71, 108, 108)
/* minimum/maximum font size (in points - 1/72 inch) */
#define NHFONT_DEFAULT_SIZE 9
#define NHFONT_STATUS_DEFAULT_SIZE 6
#define NHFONT_SIZE_MIN 3
#define NHFONT_SIZE_MAX 20
typedef struct mswin_nhwindow_data {
HWND win;
int type;
int dead;
} MSNHWinData, *PMSNHWinData;
/* global application data - alailable thour GetNHApp() */
typedef struct mswin_nhwindow_app {
HINSTANCE hApp; /* hInstance from WinMain */
int nCmdShow; /* main window mode flag */
HWND hMainWnd; /* main window handle */
HACCEL hAccelTable; /* accelerator table */
HWND hPopupWnd; /* active dialog window (nethack menu, text, etc) */
HWND hMenuBar; /* menu bar */
MSNHWinData windowlist[MAXWINDOWS]; /* nethack windows array */
HBITMAP bmpTiles; /* nethack tiles */
HBITMAP bmpPetMark; /* pet mark Bitmap */
HBITMAP bmpMapTiles; /* alternative map tiles */
int mapTile_X; /* alt. tiles width */
int mapTile_Y; /* alt. tiles height */
int mapTilesPerLine; /* number of tile per row in the bitmap */
boolean bNoHScroll; /* disable cliparound for horizontal grid (map) */
boolean bNoVScroll; /* disable cliparound for vertical grid (map) */
int mapDisplayModeSave; /* saved map display mode */
int bCmdPad; /* command pad - on-screen keyboard */
HWND hCmdWnd; /* handle of on-screen keyboard window */
/* options */
boolean bWrapText; /* format text to fit the window */
boolean bFullScreen; /* run nethack in full-screen mode */
boolean bHideScrollBars; /* hide scroll bars */
boolean bUseSIP; /* use SIP (built-in software keyboard) for menus
(PocketPC only) */
} NHWinApp, *PNHWinApp;
extern PNHWinApp GetNHApp();
#define E extern
E struct window_procs mswin_procs;
#undef E
/* Some prototypes */
void mswin_init_nhwindows(int *argc, char **argv);
void mswin_player_selection(void);
void mswin_askname(void);
void mswin_get_nh_event(void);
void mswin_exit_nhwindows(const char *);
void mswin_suspend_nhwindows(const char *);
void mswin_resume_nhwindows(void);
winid mswin_create_nhwindow(int type);
void mswin_clear_nhwindow(winid wid);
void mswin_display_nhwindow(winid wid, BOOLEAN_P block);
void mswin_destroy_nhwindow(winid wid);
void mswin_curs(winid wid, int x, int y);
void mswin_putstr(winid wid, int attr, const char *text);
void mswin_putstr_ex(winid wid, int attr, const char *text, boolean append);
void mswin_display_file(const char *filename, BOOLEAN_P must_exist);
void mswin_start_menu(winid wid, unsigned long);
void mswin_add_menu(winid wid, int glyph, const ANY_P *identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr,
const char *str, unsigned int itemflags);
void mswin_end_menu(winid wid, const char *prompt);
int mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected);
void mswin_update_inventory(void);
void mswin_mark_synch(void);
void mswin_wait_synch(void);
void mswin_cliparound(int x, int y);
void mswin_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph, int bkglyph);
void mswin_raw_print(const char *str);
void mswin_raw_print_bold(const char *str);
int mswin_nhgetch(void);
int mswin_nh_poskey(int *x, int *y, int *mod);
void mswin_nhbell(void);
int mswin_doprev_message(void);
char mswin_yn_function(const char *question, const char *choices, CHAR_P def);
void mswin_getlin(const char *question, char *input);
int mswin_get_ext_cmd(void);
void mswin_number_pad(int state);
void mswin_delay_output(void);
void mswin_change_color(void);
char *mswin_get_color_string(void);
void mswin_start_screen(void);
void mswin_end_screen(void);
void mswin_outrip(winid wid, int how, time_t when);
void mswin_preference_update(const char *pref);
/* helper function */
HWND mswin_hwnd_from_winid(winid wid);
winid mswin_winid_from_type(int type);
winid mswin_winid_from_handle(HWND hWnd);
void mswin_window_mark_dead(winid wid);
void bail(const char *mesg);
void nhapply_image_transparent(HDC hDC, int x, int y, int width, int height,
HDC sourceDC, int s_x, int s_y, int s_width,
int s_height, COLORREF cTransparent);
void mswin_popup_display(HWND popup, int *done_indicator);
void mswin_popup_destroy(HWND popup);
#if defined(WIN_CE_SMARTPHONE)
void NHSPhoneDialogSetup(HWND hDlg, UINT nToolBarId, BOOL is_edit,
BOOL is_fullscreen);
#endif
void mswin_read_reg(void);
void mswin_destroy_reg(void);
void mswin_write_reg(void);
BOOL mswin_has_keyboard(void);
void mswin_set_fullscreen(BOOL is_fullscreen);
extern winid WIN_STATUS;
#endif /* WINmswin_H */

View File

@@ -0,0 +1,352 @@
/* NetHack 3.6 winhack.c $NHDT-Date: 1432512799 2015/05/25 00:13:19 $ $NHDT-Branch: master $:$NHDT-Revision: 1.18 $ */
/* Copyright (C) 2001 by Alex Kompel */
// winhack.cpp : Defines the entry point for the application.
//
#include "winMS.h"
#include "hack.h"
#include "dlb.h"
#include "mhmain.h"
#include "mhmap.h"
extern char orgdir[PATHLEN]; /* also used in pcsys.c, amidos.c */
extern void FDECL(nethack_exit, (int));
static TCHAR *_get_cmd_arg(TCHAR *pCmdLine);
// Global Variables:
NHWinApp _nethack_app;
// Foward declarations of functions included in this code module:
BOOL InitInstance(HINSTANCE, int);
static void win_hack_init(int, char **);
static void __cdecl mswin_moveloop(void *);
static BOOL setMapTiles(const char *fname);
extern boolean FDECL(pcmain, (int, char **));
#define MAX_CMDLINE_PARAM 255
int APIENTRY
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine,
int nCmdShow)
{
INITCOMMONCONTROLSEX InitCtrls;
HWND nethackWnd;
int argc;
char *argv[MAX_CMDLINE_PARAM];
size_t len;
TCHAR *p;
TCHAR wbuf[NHSTR_BUFSIZE];
char buf[NHSTR_BUFSIZE];
boolean resuming;
early_init();
/* ensure that we don't access violate on a panic() */
windowprocs.win_raw_print = mswin_raw_print;
windowprocs.win_raw_print_bold = mswin_raw_print_bold;
/* init applicatio structure */
_nethack_app.hApp = hInstance;
_nethack_app.nCmdShow = nCmdShow;
_nethack_app.hAccelTable =
LoadAccelerators(hInstance, (LPCTSTR) IDC_WINHACK);
_nethack_app.hMainWnd = NULL;
_nethack_app.hPopupWnd = NULL;
_nethack_app.hMenuBar = NULL;
_nethack_app.bmpTiles = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TILES));
if (_nethack_app.bmpTiles == NULL)
panic("cannot load tiles bitmap");
_nethack_app.bmpPetMark =
LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_PETMARK));
if (_nethack_app.bmpPetMark == NULL)
panic("cannot load pet mark bitmap");
_nethack_app.bmpMapTiles = _nethack_app.bmpTiles;
_nethack_app.mapTile_X = TILE_X;
_nethack_app.mapTile_Y = TILE_Y;
_nethack_app.mapTilesPerLine = TILES_PER_LINE;
_nethack_app.bNoHScroll = FALSE;
_nethack_app.bNoVScroll = FALSE;
_nethack_app.bCmdPad = !mswin_has_keyboard();
_nethack_app.bWrapText = TRUE;
_nethack_app.bFullScreen = TRUE;
#if defined(WIN_CE_SMARTPHONE)
_nethack_app.bHideScrollBars = TRUE;
#else
_nethack_app.bHideScrollBars = FALSE;
#endif
_nethack_app.bUseSIP = TRUE;
// check for running nethack programs
nethackWnd = FindWindow(szMainWindowClass, NULL);
if (nethackWnd) {
// bring on top
SetForegroundWindow(nethackWnd);
return FALSE;
}
// init controls
ZeroMemory(&InitCtrls, sizeof(InitCtrls));
InitCtrls.dwSize = sizeof(InitCtrls);
InitCtrls.dwICC = ICC_LISTVIEW_CLASSES;
if (!InitCommonControlsEx(&InitCtrls)) {
MessageBox(NULL, TEXT("Cannot init common controls"), TEXT("ERROR"),
MB_OK | MB_ICONSTOP);
return FALSE;
}
// Perform application initialization:
if (!InitInstance(hInstance, nCmdShow)) {
return FALSE;
}
/* get command line parameters */
p = _get_cmd_arg(
#if defined(WIN_CE_PS2xx) || defined(WIN32_PLATFORM_HPCPRO)
lpCmdLine
#else
GetCommandLine()
#endif
);
for (argc = 1; p && argc < MAX_CMDLINE_PARAM; argc++) {
len = _tcslen(p);
if (len > 0) {
argv[argc] = _strdup(NH_W2A(p, buf, BUFSZ));
} else {
argv[argc] = "";
}
p = _get_cmd_arg(NULL);
}
GetModuleFileName(NULL, wbuf, BUFSZ);
argv[0] = _strdup(NH_W2A(wbuf, buf, BUFSZ));
resuming = pcmain(argc, argv);
moveloop(resuming);
return 0;
}
//
// FUNCTION: InitInstance(HANDLE, int)
//
// PURPOSE: Saves instance handle and creates main window
//
// COMMENTS:
//
// In this function, we save the instance handle in a global variable
// and
// create and display the main program window.
//
BOOL
InitInstance(HINSTANCE hInstance, int nCmdShow)
{
return TRUE;
}
PNHWinApp
GetNHApp()
{
return &_nethack_app;
}
static int
eraseoldlocks()
{
register int i;
/* cannot use maxledgerno() here, because we need to find a lock name
* before starting everything (including the dungeon initialization
* that sets astral_level, needed for maxledgerno()) up
*/
for (i = 1; i <= MAXDUNGEON * MAXLEVEL + 1; i++) {
/* try to remove all */
set_levelfile_name(g.lock, i);
(void) unlink(fqname(g.lock, LEVELPREFIX, 0));
}
set_levelfile_name(g.lock, 0);
if (unlink(fqname(g.lock, LEVELPREFIX, 0)))
return 0; /* cannot remove it */
return (1); /* success! */
}
void
getlock()
{
const char *fq_lock;
char tbuf[BUFSZ];
TCHAR wbuf[BUFSZ];
HANDLE f;
int fd;
int choice;
/* regularize(lock); */ /* already done in pcmain */
Sprintf(tbuf, "%s", fqname(g.lock, LEVELPREFIX, 0));
set_levelfile_name(g.lock, 0);
fq_lock = fqname(g.lock, LEVELPREFIX, 1);
f = CreateFile(NH_A2W(fq_lock, wbuf, BUFSZ), GENERIC_READ, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (f == INVALID_HANDLE_VALUE) {
if (GetLastError() == ERROR_FILE_NOT_FOUND)
goto gotlock; /* no such file */
error("Cannot open %s", fq_lock);
}
CloseHandle(f);
/* prompt user that the game alredy exist */
choice = MessageBox(GetNHApp()->hMainWnd,
TEXT("There are files from a game in progress under "
"your name. Recover?"),
TEXT("Nethack"), MB_YESNO | MB_DEFBUTTON1);
switch (choice) {
case IDYES:
if (recover_savefile()) {
goto gotlock;
} else {
error("Couldn't recover old game.");
}
break;
case IDNO:
unlock_file(HLOCK);
error("%s", "Cannot start a new game.");
break;
};
gotlock:
fd = creat(fq_lock, FCMASK);
if (fd == -1) {
error("cannot creat lock file (%s.)", fq_lock);
} else {
if (write(fd, (char *) &g.hackpid, sizeof(g.hackpid))
!= sizeof(g.hackpid)) {
error("cannot write lock (%s)", fq_lock);
}
if (close(fd) == -1) {
error("cannot close lock (%s)", fq_lock);
}
}
}
/* misc functions */
void error
VA_DECL(const char *, s)
{
TCHAR wbuf[1024];
char buf[1024];
DWORD last_error = GetLastError();
VA_START(s);
VA_INIT(s, const char *);
/* error() may get called before tty is initialized */
if (iflags.window_inited)
end_screen();
vsprintf(buf, s, VA_ARGS);
NH_A2W(buf, wbuf, sizeof(wbuf) / sizeof(wbuf[0]));
if (last_error > 0) {
LPVOID lpMsgBuf;
if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, last_error,
0, // Default language
(LPTSTR) &lpMsgBuf, 0, NULL)) {
_tcsncat(wbuf, TEXT("\nSystem Error: "),
sizeof(wbuf) / sizeof(wbuf[0]) - _tcslen(wbuf));
_tcsncat(wbuf, lpMsgBuf,
sizeof(wbuf) / sizeof(wbuf[0]) - _tcslen(wbuf));
// Free the buffer.
LocalFree(lpMsgBuf);
}
}
MessageBox(NULL, wbuf, TEXT("Error"), MB_OK | MB_ICONERROR);
VA_END();
exit(EXIT_FAILURE);
}
TCHAR *
_get_cmd_arg(TCHAR *pCmdLine)
{
static TCHAR *pArgs = NULL;
TCHAR *pRetArg;
BOOL bQuoted;
if (!pCmdLine && !pArgs)
return NULL;
if (!pArgs)
pArgs = pCmdLine;
/* skip whitespace */
for (pRetArg = pArgs; *pRetArg && _istspace(*pRetArg);
pRetArg = CharNext(pRetArg))
;
if (!*pRetArg) {
pArgs = NULL;
return NULL;
}
/* check for quote */
if (*pRetArg == TEXT('"')) {
bQuoted = TRUE;
pRetArg = CharNext(pRetArg);
pArgs = _tcschr(pRetArg, TEXT('"'));
} else {
/* skip to whitespace */
for (pArgs = pRetArg; *pArgs && !_istspace(*pArgs);
pArgs = CharNext(pArgs))
;
}
if (pArgs && *pArgs) {
TCHAR *p;
p = pArgs;
pArgs = CharNext(pArgs);
*p = (TCHAR) 0;
} else {
pArgs = NULL;
}
return pRetArg;
}
/*
* Strip out troublesome file system characters.
*/
void nt_regularize(s) /* normalize file name */
register char *s;
{
register unsigned char *lp;
for (lp = s; *lp; lp++)
if (*lp == '?' || *lp == '"' || *lp == '\\' || *lp == '/'
|| *lp == '>' || *lp == '<' || *lp == '*' || *lp == '|'
|| *lp == ':' || (*lp > 127))
*lp = '_';
}
void
win32_abort()
{
if (wizard)
DebugBreak();
abort();
}
void
append_port_id(buf)
char *buf;
{
char *portstr = PORT_CE_PLATFORM " " PORT_CE_CPU;
Sprintf(eos(buf), " %s", portstr);
}

View File

@@ -0,0 +1,373 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "newres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_WINHACK ICON DISCARDABLE "..\\..\\wince\\NETHACK.ICO"
/////////////////////////////////////////////////////////////////////////////
//
// Menubar
//
IDC_WINHACK MENU DISCARDABLE
BEGIN
POPUP "File"
BEGIN
MENUITEM "&Save", IDM_SAVE
MENUITEM SEPARATOR
MENUITEM "&Quit", IDM_EXIT
END
POPUP "Map"
BEGIN
MENUITEM "&0 - Use Tiles", IDM_MAP_TILES
MENUITEM "&1 - ASCII (4x6)", IDM_MAP_ASCII4X6
MENUITEM "&2 - ASCII (6x8)", IDM_MAP_ASCII6X8
MENUITEM "&3 - ASCII (8x8)", IDM_MAP_ASCII8X8
MENUITEM "&4 - ASCII (16x8)", IDM_MAP_ASCII16X8
MENUITEM "&5 - ASCII (7x12)", IDM_MAP_ASCII7X12
MENUITEM "&6 - ASCII (8x12)", IDM_MAP_ASCII8X12
MENUITEM "&7 - ASCII (16x12)", IDM_MAP_ASCII16X12
MENUITEM "&8 - ASCII (12x16)", IDM_MAP_ASCII12X16
MENUITEM "&9 - ASCII (10x18)", IDM_MAP_ASCII10X18
MENUITEM SEPARATOR
MENUITEM "&Fit To Screen", IDM_MAP_FIT_TO_SCREEN
END
POPUP "View"
BEGIN
MENUITEM "&Keypad", IDM_VIEW_KEYPAD
MENUITEM "&Options", IDM_VIEW_OPTIONS
END
POPUP "Help"
BEGIN
MENUITEM "&About ...", IDM_ABOUT
MENUITEM "&Long description of the game", IDM_HELP_LONG
MENUITEM "List of &commands", IDM_HELP_COMMANDS
MENUITEM "&History of NetHack", IDM_HELP_HISTORY
MENUITEM "&Info on a character", IDM_HELP_INFO_CHAR
MENUITEM "Info on what a given &key does", IDM_HELP_INFO_KEY
MENUITEM "List of game &options", IDM_HELP_OPTIONS
MENUITEM "&Longer list of game options", IDM_HELP_OPTIONS_LONG
MENUITEM "List of e&xtended commands", IDM_HELP_EXTCMD
MENUITEM "The &NetHack license", IDM_HELP_LICENSE
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDC_WINHACK ACCELERATORS MOVEABLE PURE
BEGIN
"?", IDM_ABOUT, ASCII, ALT
"/", IDM_ABOUT, ASCII, ALT
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 123, 87
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About"
FONT 8, "System"
BEGIN
LTEXT "NetHack",IDC_ABOUT_VERSION,0,2,120,15,SS_NOPREFIX
LTEXT "Copyright",IDC_ABOUT_COPYRIGHT,0,20,120,50
DEFPUSHBUTTON "OK",IDOK,45,75,30,11,WS_GROUP
END
IDD_MENU DIALOG DISCARDABLE 0, 0, 109, 153
STYLE WS_CHILD | WS_CLIPSIBLINGS | WS_BORDER
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,5,130,50,14,BS_NOTIFY
PUSHBUTTON "Cancel",IDCANCEL,55,130,50,14,BS_NOTIFY
CONTROL "List1",IDC_MENU_LIST,"SysListView32",WS_BORDER |
WS_TABSTOP,5,5,100,60
EDITTEXT IDC_MENU_TEXT,5,70,100,55,ES_MULTILINE | ES_READONLY |
WS_VSCROLL | WS_HSCROLL
END
IDD_GETLIN DIALOG DISCARDABLE 0, 0, 115, 30
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Question?"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,0,16,55,14
PUSHBUTTON "Cancel",IDCANCEL,55,16,60,14
EDITTEXT IDC_GETLIN_EDIT,0,0,115,15,ES_AUTOHSCROLL
END
IDD_PLAYER_SELECTOR DIALOG DISCARDABLE 0, 0, 105, 124
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "What are you?"
FONT 8, "MS Sans Serif"
BEGIN
EDITTEXT IDC_PLSEL_NAME,35,0,70,12,ES_AUTOHSCROLL | ES_READONLY
LTEXT "Name:",IDC_STATIC,0,0,25,10
CONTROL "Random",IDC_PLSEL_ROLE_RANDOM,"Button",BS_AUTOCHECKBOX |
BS_NOTIFY | WS_GROUP | WS_TABSTOP,5,20,40,10
COMBOBOX IDC_PLSEL_ROLE_LIST,50,20,50,50,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_GROUP | WS_TABSTOP
CONTROL "Random",IDC_PLSEL_RACE_RANDOM,"Button",BS_AUTOCHECKBOX |
BS_NOTIFY | WS_GROUP | WS_TABSTOP,5,45,40,10
COMBOBOX IDC_PLSEL_RACE_LIST,50,45,50,45,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_GROUP | WS_TABSTOP
CONTROL "Random",IDC_PLSEL_GENDER_RANDOM,"Button",
BS_AUTOCHECKBOX | BS_NOTIFY | WS_GROUP | WS_TABSTOP,5,70,
40,10
COMBOBOX IDC_PLSEL_GENDER_LIST,50,70,50,40,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_GROUP | WS_TABSTOP
CONTROL "Random",IDC_PLSEL_ALIGN_RANDOM,"Button",BS_AUTOCHECKBOX |
BS_NOTIFY | WS_GROUP | WS_TABSTOP,5,95,40,10
COMBOBOX IDC_PLSEL_ALIGN_LIST,50,95,50,45,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_GROUP | WS_TABSTOP
GROUPBOX "Role",IDC_STATIC,0,10,105,25,WS_GROUP
GROUPBOX "Race",IDC_STATIC,0,35,105,25
GROUPBOX "Gender",IDC_STATIC,0,60,105,25
GROUPBOX "Alignment",IDC_STATIC,0,85,105,25
DEFPUSHBUTTON "Play",IDOK,0,110,55,14
PUSHBUTTON "Quit",IDCANCEL,55,110,50,14
END
IDD_NHTEXT DIALOG DISCARDABLE 0, 0, 100, 97
STYLE WS_CHILD | WS_BORDER
FONT 8, "System"
BEGIN
DEFPUSHBUTTON "OK",IDOK,0,80,50,14
PUSHBUTTON "Wrap",IDC_TEXT_TOGGLE_WRAP,50,80,50,14
EDITTEXT IDC_TEXT_CONTROL,5,0,70,75,ES_MULTILINE | ES_READONLY |
WS_VSCROLL | WS_HSCROLL
END
IDD_EXTCMD DIALOG DISCARDABLE 0, 0, 109, 114
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Extended Commands"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,75,5,30,14
PUSHBUTTON "Cancel",IDCANCEL,75,20,30,14
LISTBOX IDC_EXTCMD_LIST,5,5,65,105,LBS_NOINTEGRALHEIGHT |
WS_VSCROLL | WS_TABSTOP
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""newres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_TILES BITMAP DISCARDABLE "..\\..\\wince\\tiles.bmp"
IDB_MENU_SEL BITMAP DISCARDABLE "..\\..\\wince\\mnsel.bmp"
IDB_MENU_UNSEL BITMAP DISCARDABLE "..\\..\\wince\\mnunsel.bmp"
IDB_PETMARK BITMAP DISCARDABLE "..\\..\\wince\\petmark.bmp"
IDB_MENU_SEL_COUNT BITMAP DISCARDABLE "..\\..\\wince\\mnselcnt.bmp"
IDB_KEYPAD BITMAP DISCARDABLE "..\\..\\wince\\keypad.bmp"
IDB_MENUBAR BITMAP DISCARDABLE "..\\..\\wince\\menubar.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_PLAYER_SELECTOR, DIALOG
BEGIN
RIGHTMARGIN, 98
BOTTOMMARGIN, 117
END
IDD_NHTEXT, DIALOG
BEGIN
LEFTMARGIN, 5
RIGHTMARGIN, 76
TOPMARGIN, 7
BOTTOMMARGIN, 94
END
IDD_EXTCMD, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 102
TOPMARGIN, 7
BOTTOMMARGIN, 107
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Data
//
IDC_WINHACK SHMENUBAR DISCARDABLE
BEGIN
IDC_WINHACK, 6,
I_IMAGENONE, ID_FILE, TBSTATE_ENABLED,
TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, IDS_CAP_FILE, 0, 0,
I_IMAGENONE, ID_MAP, TBSTATE_ENABLED,
TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, IDS_CAP_MAP, 0, 1,
I_IMAGENONE, ID_VIEW, TBSTATE_ENABLED,
TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, IDS_CAP_VIEW, 0, 2,
I_IMAGENONE, ID_HELP, TBSTATE_ENABLED,
TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, IDS_CAP_HELP, 0, 3,
0, IDM_MAP_FIT_TO_SCREEN, TBSTATE_ENABLED, TBSTYLE_AUTOSIZE, 0,
IDM_MAP_FIT_TO_SCREEN, NOMENU,
1, IDM_VIEW_KEYPAD, TBSTATE_ENABLED, TBSTYLE_AUTOSIZE, 0,
IDM_VIEW_KEYPAD, NOMENU,
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,7,0,0
PRODUCTVERSION 3,7,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x9L
#else
FILEFLAGS 0x8L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "NetHack 3.7.0 for Windows CE\0"
VALUE "CompanyName", " \0"
VALUE "FileDescription", "nethackm\0"
VALUE "FileVersion", "3, 7, 0, 0\0"
VALUE "InternalName", "nethackm\0"
VALUE "LegalCopyright", "Copyright © 1985-2020\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "nethackm.exe\0"
VALUE "PrivateBuild", "090914\0"
VALUE "ProductName", "NetHack\0"
VALUE "ProductVersion", "3, 7, 0, 0\0"
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "NetHack"
IDC_WINHACK "NETHACK"
END
STRINGTABLE DISCARDABLE
BEGIN
IDM_MAP_FIT_TO_SCREEN "Fit to Screen"
IDS_CAP_FILE "File"
IDS_CAP_HELP "Help"
IDS_CAP_MAP "Map"
END
STRINGTABLE DISCARDABLE
BEGIN
IDM_VIEW_KEYPAD "Show/Hide keypad."
IDS_CAP_VIEW "View"
IDS_TEXT_WRAP "Wrap"
IDS_TEXT_UNWRAP "Unwrap"
END
STRINGTABLE DISCARDABLE
BEGIN
IDOK "Done"
IDCANCEL "Cancel"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,356 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "newres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_WINHACK ICON DISCARDABLE "..\\..\\wince\\NETHACK.ICO"
/////////////////////////////////////////////////////////////////////////////
//
// Menubar
//
IDC_WINHACK MENU DISCARDABLE
BEGIN
MENUITEM "Entire Map", IDM_MAP_FIT_TO_SCREEN
POPUP "Menu"
BEGIN
MENUITEM "Options", IDM_VIEW_OPTIONS
MENUITEM "Keypad", IDM_VIEW_KEYPAD
MENUITEM "Cmd", IDM_DIRECT_COMMAND
MENUITEM SEPARATOR
MENUITEM "ASCII", IDM_MAP_ASCII8X8
MENUITEM "Tiles", IDM_MAP_TILES
MENUITEM SEPARATOR
MENUITEM "Help", IDM_HELP_MENU
MENUITEM "Save", IDM_SAVE
MENUITEM "Quit", IDM_EXIT
END
END
IDC_SPHONE_DIALOGBAR MENU DISCARDABLE
BEGIN
MENUITEM "Done", IDOK
MENUITEM "Cancel", IDCANCEL
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDC_WINHACK ACCELERATORS MOVEABLE PURE
BEGIN
"?", IDM_ABOUT, ASCII, ALT
"/", IDM_ABOUT, ASCII, ALT
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 123, 87
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About"
FONT 8, "System"
BEGIN
LTEXT "NetHack",IDC_ABOUT_VERSION,0,2,120,15,SS_NOPREFIX
LTEXT "Copyright",IDC_ABOUT_COPYRIGHT,0,20,120,50
DEFPUSHBUTTON "OK",IDOK,45,75,30,11,WS_GROUP
END
IDD_MENU DIALOG DISCARDABLE 0, 0, 109, 131
STYLE DS_SETFOREGROUND | DS_CONTROL | WS_POPUP | WS_CLIPSIBLINGS | WS_BORDER
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "List1",IDC_MENU_LIST,"SysListView32",WS_BORDER |
WS_TABSTOP,5,5,100,60
EDITTEXT IDC_MENU_TEXT,5,70,100,55,ES_MULTILINE | ES_READONLY |
WS_VSCROLL | WS_HSCROLL
END
IDD_NHTEXT DIALOG DISCARDABLE 0, 0, 83, 83
STYLE WS_POPUP | WS_BORDER
FONT 8, "System"
BEGIN
EDITTEXT IDC_TEXT_CONTROL,5,0,70,75,ES_MULTILINE | ES_READONLY |
WS_VSCROLL | WS_HSCROLL
END
IDD_EXTCMD DIALOG DISCARDABLE 0, 0, 88, 82
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Extended Commands"
FONT 8, "MS Sans Serif"
BEGIN
LISTBOX IDC_EXTCMD_LIST,7,5,75,69,LBS_NOINTEGRALHEIGHT |
WS_VSCROLL | WS_TABSTOP
END
IDD_GETLIN DIALOG DISCARDABLE 0, 0, 115, 16
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Question?"
FONT 8, "MS Sans Serif"
BEGIN
EDITTEXT IDC_GETLIN_EDIT,0,0,115,15,ES_AUTOHSCROLL
END
IDD_PLAYER_SELECTOR DIALOG DISCARDABLE 0, 0, 105, 124
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "What are you?"
FONT 8, "MS Sans Serif"
BEGIN
EDITTEXT IDC_PLSEL_NAME,35,0,70,12,ES_AUTOHSCROLL | ES_READONLY
LTEXT "Name:",IDC_STATIC,0,0,25,10
CONTROL "Random",IDC_PLSEL_ROLE_RANDOM,"Button",BS_AUTOCHECKBOX |
BS_NOTIFY | WS_GROUP | WS_TABSTOP,5,20,40,10
COMBOBOX IDC_PLSEL_ROLE_LIST,50,20,50,50,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_GROUP | WS_TABSTOP
CONTROL "Random",IDC_PLSEL_RACE_RANDOM,"Button",BS_AUTOCHECKBOX |
BS_NOTIFY | WS_GROUP | WS_TABSTOP,5,45,40,10
COMBOBOX IDC_PLSEL_RACE_LIST,50,45,50,45,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_GROUP | WS_TABSTOP
CONTROL "Random",IDC_PLSEL_GENDER_RANDOM,"Button",
BS_AUTOCHECKBOX | BS_NOTIFY | WS_GROUP | WS_TABSTOP,5,70,
40,10
COMBOBOX IDC_PLSEL_GENDER_LIST,50,70,50,40,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_GROUP | WS_TABSTOP
CONTROL "Random",IDC_PLSEL_ALIGN_RANDOM,"Button",BS_AUTOCHECKBOX |
BS_NOTIFY | WS_GROUP | WS_TABSTOP,5,95,40,10
COMBOBOX IDC_PLSEL_ALIGN_LIST,50,95,50,45,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_GROUP | WS_TABSTOP
GROUPBOX "Role",IDC_STATIC,0,10,105,25,WS_GROUP
GROUPBOX "Race",IDC_STATIC,0,35,105,25
GROUPBOX "Gender",IDC_STATIC,0,60,105,25
GROUPBOX "Alignment",IDC_STATIC,0,85,105,25
DEFPUSHBUTTON "Play",IDOK,0,110,55,14
PUSHBUTTON "Quit",IDCANCEL,55,110,50,14
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""newres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_TILES BITMAP DISCARDABLE "..\\..\\wince\\tiles.bmp"
IDB_MENU_SEL BITMAP DISCARDABLE "..\\..\\wince\\mnsel.bmp"
IDB_MENU_UNSEL BITMAP DISCARDABLE "..\\..\\wince\\mnunsel.bmp"
IDB_PETMARK BITMAP DISCARDABLE "..\\..\\wince\\petmark.bmp"
IDB_MENU_SEL_COUNT BITMAP DISCARDABLE "..\\..\\wince\\mnselcnt.bmp"
IDB_KEYPAD BITMAP DISCARDABLE "..\\..\\wince\\keypad.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_NHTEXT, DIALOG
BEGIN
LEFTMARGIN, 5
RIGHTMARGIN, 76
TOPMARGIN, 7
END
IDD_EXTCMD, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 82
TOPMARGIN, 7
BOTTOMMARGIN, 75
END
IDD_PLAYER_SELECTOR, DIALOG
BEGIN
RIGHTMARGIN, 98
BOTTOMMARGIN, 117
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Data
//
IDC_WINHACK SHMENUBAR DISCARDABLE
BEGIN
IDC_WINHACK, 2,
I_IMAGENONE, IDM_MAP_FIT_TO_SCREEN, TBSTATE_ENABLED, TBSTYLE_AUTOSIZE, IDM_MAP_FIT_TO_SCREEN, 0, NOMENU,
I_IMAGENONE, ID_VIEW, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, IDS_CAP_VIEW, 0, 1,
END
IDC_SPHONE_DIALOGBAR SHMENUBAR DISCARDABLE
BEGIN
IDC_SPHONE_DIALOGBAR, 2,
I_IMAGENONE, IDOK, TBSTATE_ENABLED, TBSTYLE_AUTOSIZE, IDOK, 0, NOMENU,
I_IMAGENONE, IDCANCEL, TBSTATE_ENABLED, TBSTYLE_AUTOSIZE, IDCANCEL, 0,
NOMENU,
END
IDC_SPHONE_TEXTDIALOGBAR SHMENUBAR DISCARDABLE
BEGIN
IDC_SPHONE_DIALOGBAR, 2,
I_IMAGENONE, IDOK, TBSTATE_ENABLED, TBSTYLE_AUTOSIZE, IDOK, 0, NOMENU,
I_IMAGENONE, IDC_TEXT_TOGGLE_WRAP, TBSTATE_ENABLED, TBSTYLE_AUTOSIZE, IDS_TEXT_WRAP, 0,
NOMENU,
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,7,0,0
PRODUCTVERSION 3,7,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x9L
#else
FILEFLAGS 0x8L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "NetHack 3.7.0 for Smartphone 2002\0"
VALUE "CompanyName", " \0"
VALUE "FileDescription", "nethackm\0"
VALUE "FileVersion", "3, 7, 0, 0\0"
VALUE "InternalName", "nethackm\0"
VALUE "LegalCopyright", "Copyright © 1985-2020\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "nethackm.exe\0"
VALUE "PrivateBuild", "090914\0"
VALUE "ProductName", "NetHack For Smartphone\0"
VALUE "ProductVersion", "3, 7, 0, 0\0"
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "NetHack"
IDC_WINHACK "NETHACK"
END
STRINGTABLE DISCARDABLE
BEGIN
IDM_MAP_FIT_TO_SCREEN "Entire Map"
IDS_CAP_FILE "File"
IDS_CAP_HELP "Help"
IDS_CAP_MAP "Map"
END
STRINGTABLE DISCARDABLE
BEGIN
IDM_VIEW_KEYPAD "Show/Hide keypad."
IDS_CAP_VIEW "Menu"
END
STRINGTABLE DISCARDABLE
BEGIN
IDOK "Done"
IDCANCEL "Cancel"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_CAP_ENTIREMAP "Entire Map"
IDS_CAP_NORMALMAP "Normal Map"
IDM_HELP_MENU "Help Menu"
IDS_TEXT_WRAP "Wrap"
IDS_TEXT_UNWRAP "Unwrap"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,119 @@
// winmain.cpp : Defines the entry point for the application.
//
// $NHDT-Date: 1432512799 2015/05/25 00:13:19 $ $NHDT-Branch: master $:$NHDT-Revision: 1.5 $
#include "winMS.h"
#include <string.h>
#define MAX_CMDLINE_PARAM 255
extern int FDECL(main, (int, char **));
static TCHAR *_get_cmd_arg(TCHAR *pCmdLine);
int APIENTRY
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine,
int nCmdShow)
{
int argc;
char *argv[MAX_CMDLINE_PARAM];
size_t len;
TCHAR *p;
TCHAR wbuf[NHSTR_BUFSIZE];
char buf[NHSTR_BUFSIZE];
/* get command line parameters */
p = _get_cmd_arg(
#if defined(WIN_CE_PS2xx) || defined(WIN32_PLATFORM_HPCPRO)
lpCmdLine
#else
GetCommandLine()
#endif
);
for (argc = 1; p && argc < MAX_CMDLINE_PARAM; argc++) {
len = _tcslen(p);
if (len > 0) {
argv[argc] = _strdup(NH_W2A(p, buf, BUFSZ));
} else {
argv[argc] = "";
}
p = _get_cmd_arg(NULL);
}
GetModuleFileName(NULL, wbuf, BUFSZ);
argv[0] = _strdup(NH_W2A(wbuf, buf, BUFSZ));
main(argc, argv);
return 0;
}
TCHAR *
_get_cmd_arg(TCHAR *pCmdLine)
{
static TCHAR *pArgs = NULL;
TCHAR *pRetArg;
BOOL bQuoted;
if (!pCmdLine && !pArgs)
return NULL;
if (!pArgs)
pArgs = pCmdLine;
/* skip whitespace */
for (pRetArg = pArgs; *pRetArg && _istspace(*pRetArg);
pRetArg = CharNext(pRetArg))
;
if (!*pRetArg) {
pArgs = NULL;
return NULL;
}
/* check for quote */
if (*pRetArg == TEXT('"')) {
bQuoted = TRUE;
pRetArg = CharNext(pRetArg);
pArgs = _tcschr(pRetArg, TEXT('"'));
} else {
/* skip to whitespace */
for (pArgs = pRetArg; *pArgs && !_istspace(*pArgs);
pArgs = CharNext(pArgs))
;
}
if (pArgs && *pArgs) {
TCHAR *p;
p = pArgs;
pArgs = CharNext(pArgs);
*p = (TCHAR) 0;
} else {
pArgs = NULL;
}
return pRetArg;
}
#ifndef STRNCMPI
char lowc(c) /* force 'c' into lowercase */
char c;
{
return ((char) (('A' <= c && c <= 'Z') ? (c | 040) : c));
}
int strncmpi(s1, s2, n) /* case insensitive counted string comparison */
register const char *s1, *s2;
register int n; /*(should probably be size_t, which is usually unsigned)*/
{ /*{ aka strncasecmp }*/
register char t1, t2;
while (n--) {
if (!*s2)
return (*s1 != 0); /* s1 >= s2 */
else if (!*s1)
return -1; /* s1 < s2 */
t1 = lowc(*s1++);
t2 = lowc(*s2++);
if (t1 != t2)
return (t1 > t2) ? 1 : -1;
}
return 0; /* s1 == s2 */
}
#endif /* STRNCMPI */