Michael Allison wrote:

> There has been some feedback from others on the development team
> around the tiles:
>   "The Rogue Level should ideally be text-mode. It freaks out the
>    tiled-version-only players when they first get there, but that
>    makes it a good reminder of NetHack's roots."
>
> The other supported tiled ports work this way too.  They display
> regular ASCII characters on the Rogue level, just like Rogue did.

-Adds Rogue-level ascii support.
-Also removes unicode support.

Some other build script tweaks as well.

M. Allison
This commit is contained in:
nethack.allison
2002-01-14 12:36:09 +00:00
parent 50b24456cd
commit 59b7cb4be4
8 changed files with 174 additions and 120 deletions

View File

@@ -250,7 +250,7 @@ typedef xchar boolean; /* 0 or 1 */
# define EXIT_FAILURE 1
#endif
#if defined(X11_GRAPHICS) || defined(QT_GRAPHICS) || defined(GNOME_GRAPHICS)
#if defined(X11_GRAPHICS) || defined(QT_GRAPHICS) || defined(GNOME_GRAPHICS) || defined(MSWIN_GRAPHICS)
# ifndef USE_TILES
# define USE_TILES /* glyph2tile[] will be available */
# endif

View File

@@ -45,11 +45,11 @@ If you received some warning messages about not having
a uudecode utility, you must find a way to uudecode the following files
elsewhere and move the decoded version to its target directory:
win\win32\mnsel.uu ---> winhacknt\mnsel.bmp
win\win32\mnunsel.uu ---> winhacknt\mnunsel.bmp
sys\winnt\nhico.uu ---> winhacknt\nethack.ico
win\win32\mnsel.uu ---> win\win32\mnsel.bmp
win\win32\mnunsel.uu ---> win\win32\mnunsel.bmp
sys\winnt\nhico.uu ---> win\win32\nethack.ico
(NOTE: The winhacknt directory is not part of the distribution.
(NOTE: The build directory is not part of the distribution.
It was created when you executed nhsetup.bat as part of
the FIRST STEP just above this.)

View File

@@ -45,7 +45,7 @@ goto done
:do_win
set opt=Graphical NetHack for Windows
if not exist ..\..\win\win32\winnt.dsw goto err_win
if not exist ..\..\win\win32\nethack.dsw goto err_win
echo.
echo "Copying Visual C project files file to ..\..\build directory"
@@ -54,7 +54,7 @@ REM copy ..\..\win\win32\winnt.dsw ..\.. >nul
echo copy ..\..\win\win32\nethack.dsw ..\..
copy ..\..\win\win32\nethack.dsw ..\..
if NOT exist ..\..\build\*.* mkdir ..\..\build >nul
if NOT exist ..\..\build\*.* mkdir ..\..\build
copy ..\..\win\win32\dgncomp.dsp ..\..\build >nul
copy ..\..\win\win32\dgnstuff.dsp ..\..\build >nul
copy ..\..\win\win32\dgnstuff.mak ..\..\build >nul
@@ -131,15 +131,15 @@ goto done
:err_set
echo.
echo Usage:
echo "%0 <TTY | WINHACK | CE >"
echo "%0 <TTY | win | CE >"
echo.
echo Run this batch file specifying one of the following:
echo tty, winhack, ce
echo tty, win, ce
echo.
echo The tty argument is for preparing to build a console I/O TTY version
echo of NetHack.
echo.
echo The winhack argument is for preparing to build a graphical version
echo The win argument is for preparing to build a graphical version
echo of NetHack.
echo.
echo The CE argument is for preparing to build a Windows CE version

View File

@@ -14,7 +14,7 @@ static struct font_table_entry {
} font_table[MAXFONTS] ;
static int font_table_size = 0;
#define NHFONT_CODE(win, attr) (((win_type&0xFF)<<8)|(attr&0xFF))
#define NHFONT_CODE(win, attr) (((attr&0xFF)<<8)|(win_type&0xFF))
/* create font based on window type, charater attributes and
@@ -105,6 +105,24 @@ HGDIOBJ mswin_create_font(int win_type, int attr, HDC hdc)
lgfnt.lfPitchAndFamily = FIXED_PITCH; // pitch and family
/* lgfnt.lfFaceName */
break;
case NHW_MAP:
lgfnt.lfHeight = -TILE_Y; // height of font
lgfnt.lfWidth = -TILE_X; // 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 = DEFAULT_CHARSET; // character set identifier
// we need OEM charset for Rogue level
lgfnt.lfOutPrecision = OUT_DEFAULT_PRECIS; // output precision
lgfnt.lfClipPrecision = CLIP_DEFAULT_PRECIS; // clipping precision
lgfnt.lfQuality = DEFAULT_QUALITY; // output quality
lgfnt.lfPitchAndFamily = FIXED_PITCH; // pitch and family
_tcscpy( lgfnt.lfFaceName, TEXT("Terminal"));
break;
}
fnt = CreateFontIndirect(&lgfnt);

View File

@@ -6,6 +6,7 @@
#include "mhstatus.h"
#include "mhmsg.h"
#include "mhinput.h"
#include "mhfont.h"
#define MAXWINDOWTEXT 255
extern short glyph2tile[];
@@ -27,6 +28,9 @@ 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);
#ifdef TEXTCOLOR
static COLORREF nhcolor_to_RGB(int c);
#endif
HWND mswin_init_map_window () {
static int run_once = 0;
@@ -301,31 +305,127 @@ void onPaint(HWND hWnd)
/* calculate paint rectangle */
if( !IsRectEmpty(&ps.rcPaint) ) {
/* prepare tiles DC for mapping */
tileDC = CreateCompatibleDC(hDC);
saveBmp = SelectObject(tileDC, GetNHApp()->bmpTiles);
/* calculate paint rectangle */
paint_rt.top = data->yPos + ps.rcPaint.top/TILE_X;
paint_rt.left = data->xPos + ps.rcPaint.left/TILE_Y;
paint_rt.bottom = min(data->yPos+ps.rcPaint.bottom/TILE_Y+1, ROWNO);
paint_rt.right = min(data->xPos+ps.rcPaint.right/TILE_X+1, COLNO);
/* draw the map */
for(i=paint_rt.left; i<paint_rt.right; i++)
for(j=paint_rt.top; j<paint_rt.bottom; j++)
#ifdef REINCARNATION
if (Is_rogue_level(&u.uz)) {
/* You enter a VERY primitive world! */
HGDIOBJ oldFont;
int offset;
oldFont = SelectObject(hDC, mswin_create_font(NHW_MAP, ATR_NONE, hDC));
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) {
short ntile;
int t_x, t_y;
uchar ch;
TCHAR wch;
RECT glyph_rect;
unsigned short g=data->map[i][j];
/* (from wintty, naturally)
*
* Map the glyph back to a character.
*
* Warning: For speed, this makes an assumption on the order of
* offsets. The order is set in display.h.
*/
ntile = glyph2tile[ data->map[i][j] ];
t_x = (ntile % TILES_PER_LINE)*TILE_X;
t_y = (ntile / TILES_PER_LINE)*TILE_Y;
#ifdef TEXTCOLOR
int color;
BitBlt(hDC, (i-data->xPos)*TILE_X, (j-data->yPos)*TILE_Y, TILE_X, TILE_Y, tileDC, t_x, t_y, SRCCOPY );
#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)
SetTextColor( hDC, nhcolor_to_RGB(CLR_WHITE) );
#endif
if ((offset = (g - GLYPH_WARNING_OFF)) >= 0) { /* a warning flash */
ch = warnsyms[offset];
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)];
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)];
zap_color((offset >> 2));
} else if ((offset = (g - GLYPH_CMAP_OFF)) >= 0) { /* cmap */
ch = showsyms[offset];
cmap_color(offset);
} else if ((offset = (g - GLYPH_OBJ_OFF)) >= 0) { /* object */
ch = oc_syms[(int)objects[offset].oc_class];
obj_color(offset);
} else if ((offset = (g - GLYPH_BODY_OFF)) >= 0) { /* a corpse */
ch = oc_syms[(int)objects[CORPSE].oc_class];
mon_color(offset);
} else if ((offset = (g - GLYPH_PET_OFF)) >= 0) { /* a pet */
ch = monsyms[(int)mons[offset].mlet];
pet_color(offset);
} else { /* a monster */
ch = monsyms[(int)mons[g].mlet];
mon_color(g);
}
// end of wintty code
#ifdef TEXTCOLOR
if( color == NO_COLOR ) continue;
else SetTextColor( hDC, nhcolor_to_RGB(color) );
#endif
glyph_rect.left = (i-data->xPos)*TILE_X;
glyph_rect.top = (j-data->yPos)*TILE_Y;
glyph_rect.right = glyph_rect.left + TILE_X;
glyph_rect.bottom = glyph_rect.top + TILE_Y;
DrawText(hDC,
NH_A2W(&ch, &wch, 1),
1,
&glyph_rect,
DT_CENTER | DT_VCENTER | DT_NOPREFIX
);
}
SelectObject(tileDC, saveBmp);
DeleteDC(tileDC);
mswin_destroy_font( SelectObject(hDC, oldFont) );
} else
#endif
{
/* prepare tiles DC for mapping */
tileDC = CreateCompatibleDC(hDC);
saveBmp = SelectObject(tileDC, GetNHApp()->bmpTiles);
/* 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;
ntile = glyph2tile[ data->map[i][j] ];
t_x = (ntile % TILES_PER_LINE)*TILE_X;
t_y = (ntile / TILES_PER_LINE)*TILE_Y;
BitBlt(hDC, (i-data->xPos)*TILE_X, (j-data->yPos)*TILE_Y, TILE_X, TILE_Y, tileDC, t_x, t_y, SRCCOPY );
}
SelectObject(tileDC, saveBmp);
DeleteDC(tileDC);
}
/* draw focus rect */
paint_rt.left = (data->xCur - data->xPos)*TILE_X;
@@ -464,3 +564,28 @@ void onMSNH_HScroll(HWND hWnd, WPARAM wParam, LPARAM lParam)
SetScrollInfo(hWnd, SB_HORZ, &si, TRUE);
}
#ifdef TEXTCOLOR
static
COLORREF nhcolor_to_RGB(int c)
{
switch(c) {
case CLR_BLACK: return RGB( 0, 0, 0);
case CLR_RED: return RGB(255, 0, 0);
case CLR_GREEN: return RGB( 0, 128, 0);
case CLR_BROWN: return RGB(165, 42, 42);
case CLR_BLUE: return RGB( 0, 0, 255);
case CLR_MAGENTA: return RGB(255, 0, 255);
case CLR_CYAN: return RGB( 0, 255, 255);
case CLR_GRAY: return RGB(192, 192, 192);
case NO_COLOR: return RGB( 0, 0, 0);
case CLR_ORANGE: return RGB(255, 165, 0);
case CLR_BRIGHT_GREEN: return RGB( 0, 255, 0);
case CLR_YELLOW: return RGB(255, 255, 0);
case CLR_BRIGHT_BLUE: return RGB(0, 191, 255);
case CLR_BRIGHT_MAGENTA: return RGB(255, 127, 255);
case CLR_BRIGHT_CYAN: return RGB(127, 255, 255); /* something close to aquamarine */
case CLR_WHITE: return RGB(255, 255, 255);
default: return RGB( 0, 0, 0); /* black */
}
}
#endif

View File

@@ -115,7 +115,8 @@ LRESULT CALLBACK StatusWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
for(i=0; i<NHSW_LINES; i++ ) {
GetTextExtentPoint32(hdc, NH_A2W(data->window_text[i], wbuf, sizeof(wbuf)), strlen(data->window_text[i]), &sz);
DrawText(hdc, NH_A2W(data->window_text[i], wbuf, sizeof(wbuf)), strlen(data->window_text[i]), &rt, DT_LEFT);
OemToChar(data->window_text[i], wbuf);
DrawText(hdc, wbuf, strlen(data->window_text[i]), &rt, DT_LEFT);
rt.top += sz.cy;
}

View File

@@ -55,7 +55,7 @@ LINK32=link.exe
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Building nhtiles.bmp
PostBuild_Cmds=pushd ..\src ..\util\tile2bmp.exe tiles.bmp popd
PostBuild_Cmds=pushd ..\src ..\util\tile2bmp.exe tiles.bmp if exist tiles.bmp copy tiles.bmp ..\win\win32 popd
# End Special Build Tool
!ELSEIF "$(CFG)" == "tile2bmp - Win32 Debug"

View File

@@ -4,7 +4,7 @@
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=winhack - Win32 Unicode Debug
CFG=winhack - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
@@ -13,14 +13,12 @@ CFG=winhack - Win32 Unicode Debug
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "winhack.mak" CFG="winhack - Win32 Unicode Debug"
!MESSAGE NMAKE /f "winhack.mak" CFG="winhack - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "winhack - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "winhack - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE "winhack - Win32 Unicode Release" (based on "Win32 (x86) Application")
!MESSAGE "winhack - Win32 Unicode Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
@@ -97,83 +95,12 @@ PostBuild_Desc=Install exe
PostBuild_Cmds=if NOT exist ..\binary\*.* mkdir ..\binary copy $(OutDir)\winhack.exe ..\binary copy ..\dat\nhdat ..\binary copy ..\dat\license ..\binary if exist tiles.bmp copy tiles.bmp ..\binary if exist ..\doc\Guidebook.txt copy ..\doc\Guidebook.txt ..\binary\Guidebook.txt if exist ..\doc\nethack.txt copy ..\doc\nethack.txt ..\binary\NetHack.txt if exist ..\doc\recover.txt copy ..\doc\recover.txt ..\binary\recover.txt copy ..\sys\winnt\winnt.cnf ..\binary\defaults.nh
# End Special Build Tool
!ELSEIF "$(CFG)" == "winhack - Win32 Unicode Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "winhack___Win32_Unicode_Release"
# PROP BASE Intermediate_Dir "winhack___Win32_Unicode_Release"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Unicode_Release"
# PROP Intermediate_Dir "Unicode_Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\win\win32" /I "..\include" /I "..\sys\winnt" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "DLB" /FD /c
# SUBTRACT BASE CPP /YX /Yc /Yu
# ADD CPP /nologo /W3 /GX /O2 /I "..\win\win32" /I "..\include" /I "..\sys\winnt" /I "..\sys\share" /I "..\win\share" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D "DLB" /D "MSWIN_GRAPHICS" /FD /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib comctl32.lib advapi32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib comctl32.lib advapi32.lib /nologo /subsystem:windows /machine:I386
# Begin Special Build Tool
OutDir=.\Unicode_Release
SOURCE="$(InputPath)"
PostBuild_Desc=Install exe
PostBuild_Cmds=copy $(OutDir)\winhack.exe ..\binary copy ..\dat\nhdat ..\binary copy ..\dat\license ..\binary if exist tiles.bmp copy tiles.bmp ..\binary if exist ..\doc\Guidebook.txt copy ..\doc\Guidebook.txt ..\binary\Guidebook.txt if exist ..\doc\nethack.txt copy ..\doc\nethack.txt ..\binary\NetHack.txt if exist ..\doc\recover.txt copy ..\doc\recover.txt ..\binary\recover.txt copy ..\sys\winnt\winnt.cnf ..\binary\defaults.nh
# End Special Build Tool
!ELSEIF "$(CFG)" == "winhack - Win32 Unicode Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "winhack___Win32_Unicode_Debug"
# PROP BASE Intermediate_Dir "winhack___Win32_Unicode_Debug"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Unicode_Debug"
# PROP Intermediate_Dir "Unicode_Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\win\win32" /I "..\include" /I "..\sys\winnt" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "DLB" /FD /GZ /c
# SUBTRACT BASE CPP /YX /Yc /Yu
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\win\win32" /I "..\include" /I "..\sys\winnt" /I "..\sys\share" /I "..\win\share" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /D "DLB" /D "MSWIN_GRAPHICS" /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib comctl32.lib advapi32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib comctl32.lib advapi32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# Begin Special Build Tool
OutDir=.\Unicode_Debug
SOURCE="$(InputPath)"
PostBuild_Cmds=copy $(OutDir)\winhack.exe ..\binary copy ..\dat\nhdat ..\binary copy ..\dat\license ..\binary if exist ..\src\tiles.bmp copy ..\src\tiles.bmp ..\binary if exist ..\doc\Guidebook.txt copy ..\doc\Guidebook.txt ..\binary\Guidebook.txt if exist ..\doc\nethack.txt copy ..\doc\nethack.txt ..\binary\NetHack.txt if exist ..\doc\recover.txt copy ..\doc\recover.txt ..\binary\recover.txt copy ..\sys\winnt\winnt.cnf ..\binary\defaults.nh
# End Special Build Tool
!ENDIF
# Begin Target
# Name "winhack - Win32 Release"
# Name "winhack - Win32 Debug"
# Name "winhack - Win32 Unicode Release"
# Name "winhack - Win32 Unicode Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
@@ -608,23 +535,6 @@ SOURCE=..\src\windows.c
# Begin Source File
SOURCE=..\sys\winnt\winnt.c
!IF "$(CFG)" == "winhack - Win32 Release"
!ELSEIF "$(CFG)" == "winhack - Win32 Debug"
!ELSEIF "$(CFG)" == "winhack - Win32 Unicode Release"
# ADD CPP /D "_MBCS"
# SUBTRACT CPP /D "_UNICODE" /D "UNICODE"
!ELSEIF "$(CFG)" == "winhack - Win32 Unicode Debug"
# ADD CPP /D "_MBCS"
# SUBTRACT CPP /D "_UNICODE" /D "UNICODE"
!ENDIF
# End Source File
# Begin Source File