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/win/Qt3/.gitattributes vendored Normal file
View File

@@ -0,0 +1,4 @@
Install.Qt NHSUBST
qpe-nethack.control NH_header=no
knethack.lnk NH_header=no
* NH_filestag=(file%s_for_the_Qt_3_widget_library_-_X11,_Windows,_Mac_OS_X,_or_Qtopia)

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleGetInfoHTML</key>
<string>http://www.nethack.org</string>
<key>CFBundleGetInfoString</key>
<string>Copyright (C) 1985-2003 Stichting Mathematisch Centrum</string>
<key>CFBundleIconFile</key>
<string>nethack.icns</string>
<key>CFBundleIdentifier</key>
<string>org.nethack.qt</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.5.0</string>
<key>CFBundleSignature</key>
<string>NHak</string>
</dict>
</plist>

113
outdated/win/Qt3/Install.Qt Normal file
View File

@@ -0,0 +1,113 @@
Installing NetHack with a Qt or KDE interface
---------------------------------------------
$NHDT-Date: 1524689332 2018/04/25 20:48:52 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.11 $
# Copyright (c) 2004 by Warwick Allison
# NetHack may be freely redistributed. See license for details.
This document describes the installation of NetHack with a Qt interface
on UNIX/X11 or Mac OS X. This code should also work with Qt/Windows, but
support for that is not currently official.
You can download Qt from http://www.trolltech.com.
You need Qt 2.0 or later to use this code.
To use this code on UNIX (not Mac OS X):
1. follow the directions for the UNIX installation (in ../../sys/unix)
to create the Makefiles.
2. ../../include/config.h
define QT_GRAPHICS (search for it). You can comment out
TTY_GRAPHICS if you want to, or leave it in to support both
interfaces (in which case be sure you have the right curses
libraries etc. required for that interface).
3. ../../src/Makefile
ensure your QTDIR environment variable was set correctly when
you installed Qt - $QTDIR/include/qwidget.h should exist, for
example.
ensure CXX and LINK are set to the compiler and linker you need
for compiling and linking C++ software (e.g., set both to g++).
add $(WINQTSRC), $(WINQTOBJ), and $(WINQTLIB) to WINSRC, WINOBJ,
and WINLIB respectively, and compile. This will give you an
executable supporting both Qt and tty windowing.
4. ../../Makefile (the top-level makefile)
Just change the VARDATND setting to contain the files
"x11tiles", "rip.xpm", and "nhsplash.xpm":
VARDATND = x11tiles rip.xpm nhsplash.xpm
5. Follow all the instructions in ../../sys/unix/Install.unx for
the remainder of the installation process.
6. Consider adding the lines below to your .nethackrc, as they are
likely to give the best interface for this window port:
OPTIONS=name:player,number_pad,menustyle:partial,!time,showexp
OPTIONS=hilite_pet,toptenwin,msghistory:200,windowtype:Qt
If you are using KDE, you may want to also try the KDE version. It just
uses the KDE menubar and follows other KDE conventions - there is no
extra functionality. To do so:
1. Ensure that you have KDE 2.x libraries on your system
(in 1999 KDE 1.x was the norm)
2. ../../src/Makefile
Add $(KDECXXFLAGS) to the CXXFLAGS definition, $(KDELFLAGS) to
the LFLAGS definition and $(WINKDELIB) to WINLIB.
3. Some additional files here - knh-mini.xpm, knh.xpm, and
knethack.lnk are useful if you want to install "knethack" in
the KDE games directory.
If you are using Qtopia, you can compile NetHack for that environment
with the following additional steps:
1. First be sure that you can build a simple Qtopia application,
such as the examples that ship with Qtopia. Do not attempt
something as challenging to compile as NetHack before you can
already build a Qtopia application for your target device.
2. If you are cross-compiling (eg. targetting an ARM-based handheld),
be sure to follow the steps for cross-compiling in the Makefile.src
and Makefile.utl files.
3. To CXXFLAGS in Makefile.src, add:
-DQWS -I$(QPEDIR)/include -fno-rtti -fno-exceptions
4. Rather than -lqt in WINQTLIB, have:
-L$(QPEDIR)/lib -lqpe -lqte
5. After building, use the "mkipks" program that ships with Qtopia
to package the result into an ipk file.
To use this code on Mac OS X:
1. follow the directions for the UNIX installation (in ../../sys/unix)
to create the Makefiles.
2. quite a number of changes are required to the Makefiles. They are
slowly being made 'official', but for now they are all in the patch
nethack-macosx-qt.patch:
cd ../..
patch -p0 < win/Qt/nethack-macosx-qt.patch
3. Follow all the instructions in ../../sys/unix/Install.unx for
the remainder of the installation process (basically run "make install").
4. Consider adding the lines below to a file called "NetHack Defaults",
in your "Library/Preferences" folder, as they are likely to give
the best interface for this window port:
OPTIONS=name:player,number_pad,menustyle:partial,!time,showexp
OPTIONS=hilite_pet,toptenwin,msghistory:200,windowtype:Qt

View File

@@ -0,0 +1,18 @@
# KDE Config File
# Call this file knethack.kdelnk or knethack.desktop
[KDE Desktop Entry]
Name=Nethack
Name[fr]=Nethack
Name[hu]=Nethack
Name[no]=Nethack
Name[sk]=Nethack
Name[cs]=Nethack
Name[hr]=Nethack
Name[pt]=Nethack
Name[pt_BR]=Nethack
Icon=knh.xpm
Exec=knethack -caption "%c" %i %m
Type=Application
DocPath=knethack/index.html
Comment=The classic Unix role-playing game - fight monsters and seek the Amulet of Yendor for your god!

View File

@@ -0,0 +1,30 @@
/* XPM */
static char *noname[] = {
/* width height ncolors chars_per_pixel */
"16 16 7 1",
/* colors */
" c #000000",
". c #DCDCDC",
"X c #008080",
"o c #A0A0A0",
"O c None",
"+ c #FFFFFF",
"@ c #C3C3C3",
/* pixels */
"OOOOOOOOOOOOOOOO",
"OOO+O+++@@@O@OOO",
"O+O+++++@@@@@O.O",
"O+o+XXXXX X @ . ",
"O+o+XXXX X X@ . ",
"OO +XXXXX X @ O ",
"OOO+XXXX X X@ OO",
"OOO+XXXXX X @ OO",
"OOO+XXXX X X@ OO",
"OOOO+XXXX X@ OO",
"OOOO+XXX X . OO",
"OOO+O+XXX . . OO",
"OO+++ +X . ... O",
"O+++. O+. .... ",
"OO+. OOOOOO.. O",
"OOOOOOOOOOOOOOOO"
};

67
outdated/win/Qt3/knh.xpm Normal file
View File

@@ -0,0 +1,67 @@
/* XPM */
static char *noname[] = {
/* width height ncolors chars_per_pixel */
"40 40 20 1",
/* colors */
" c #000000",
". c #0000C0",
"X c #FFC0FF",
"o c #FFC0C0",
"O c #DCDCDC",
"+ c #C0C0FF",
"@ c #008080",
"# c #A0A0A0",
"$ c None",
"% c #000080",
"& c #585858",
"* c #800080",
"= c #FFFFFF",
"- c #FFFFC0",
"; c #00C0C0",
": c #C0FFFF",
"> c #C0FFC0",
", c #C3C3C3",
"< c #FFDCA8",
"1 c #0000FF",
/* pixels */
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$=$$$$$$=,==<,=<,$$$$$$,$$$$$$$$$",
"$$$$$$$$==$$$=====,=<>,<><$$$<>$$$$$$$$$",
"$$$$$$$$===$====,==>,=<,<,,$,,<$$$$$$$$$",
"$$$==$$$==========<=<,><,><<><,$$$,<$$$$",
"$$$====$========,==,,=<>,<,>,<,$<><,$$$$",
"$$$====$==========<=<,,<<><,<><$,,<>$$$$",
"$$$$#&&&==$#$#$#@#$&@#&&@&&&&,, && $$",
"$$$;#@&@==;#;#;#$;&#@&@$&@&@$>< &@ $$",
"$$$====&==###1##.##@&#&@&&$&&<, <>O< $$",
"$$$====&==$;##;##;&#@&@$&@&@&>, O<,> $$",
"$$$==&@&==#1#;##.##@&#&@&$@$&,< ,< $$",
"$$$$ ==###1#;##.#@$&&&@&&@-, $ $$",
"$$$$$ =X;#;###&;#&@#&@$&@$&,< $$ $$$",
"$$$$$$ ==#$+@+1##@#&@&$@&&&@<> $$$$$$",
"$$$$$$$$=X;#1#$#@##@&#@&&&@$&<, $$$$$$",
"$$$$$$$$==##;#;##1$#@&$@$&&@&>< $$$$$$",
"$$$$$$$$=X;###1#@##@&#@&&@$&&O, $$$$$$",
"$$$$$$$$==#1#;##;#.#@&&$@&@&@<> $$$$$$",
"$$$$$$$$$==###;#*;#&@#&@&&$&O< $$$$$$$",
"$$$$$$$$$==;#1,$;#&#@$@&$@&@<, $$$$$$$",
"$$$$$$$$$$=X####.##@&#&&@&&<O $$$$$$$$",
"$$$$$$$$$$==;#;##;*#@&@$&&@O< $$$$$$$",
"$$$$$$$$==$==1##.#;&@+&&@&O< <, $$$$$$",
"$$$$$$$===#:=#;###&+%&@$&O> ><, $$$$$$",
"$$$$$$====@&=O##@#;&@#&&,< <,>< $$$$$",
"$$$$$===#$== ==$1#&#&@&O> ,<$#,,> $$$$",
"$$$$===#;#== ==$#;&@#O, >,#;&<,< $$$$",
"$$$==$#;*@O< ====Oo,> <,&$#@&O, $$$",
"$$$==;$#&&<, $===<,< <O@&;#&>< $$",
"$$$==##;&O>, $$==,> $$ ,<&&#$@o, $$",
"$$$===X=O,< $$$$$$$$$$$$$>OO,Oo> $$$",
"$$$$====,< $$$$$$$$$$$$$$,<,>,<, $$$$",
"$$$$$===<> $$$$$$$$$$$$$$$$><,<> $$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"
};

View File

@@ -0,0 +1,9 @@
Files: bin/nethack pics/NetHack.png apps/Games/nethack.desktop games/lib/nethackdir/[a-r]* games/lib/nethackdir/[t-z]* games/lib/nethackdir/save games/lib/nethackdir/s*.* games/lib/nethackdir/[A-Z0-9]*
Priority: optional
Section: qpe/games
Maintainer: Warwick Allison <warwick@trolltech.com>
Architecture: arm
Version: 3.5.0-1
Depends: qpe-base ($QPE_VERSION)
Description: NetHack - The Dungeon Game
Graphical version of NetHack for Qtopia

View File

@@ -0,0 +1,168 @@
/* NetHack 3.6 qt_clust.cpp $NHDT-Date: 1575917719 2019/12/09 18:55:19 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.0 $ */
/* Copyright (c) Warwick Allison, 1999. */
/* NetHack may be freely redistributed. See license for details. */
#include "qt3_clust.h"
static
void include(QRect& r, const QRect& rect)
{
if (rect.left()<r.left()) {
r.setLeft(rect.left());
}
if (rect.right()>r.right()) {
r.setRight(rect.right());
}
if (rect.top()<r.top()) {
r.setTop(rect.top());
}
if (rect.bottom()>r.bottom()) {
r.setBottom(rect.bottom());
}
}
/*
A Clusterizer groups rectangles (QRects) into non-overlapping rectangles
by a merging heuristic.
*/
Clusterizer::Clusterizer(int maxclusters) :
cluster(new QRect[maxclusters]),
count(0),
max(maxclusters)
{ }
Clusterizer::~Clusterizer()
{
delete [] cluster;
}
void Clusterizer::clear()
{
count=0;
}
void Clusterizer::add(int x, int y)
{
add(QRect(x,y,1,1));
}
void Clusterizer::add(int x, int y, int w, int h)
{
add(QRect(x,y,w,h));
}
void Clusterizer::add(const QRect& rect)
{
QRect biggerrect(rect.x()-1,rect.y()-1,rect.width()+2,rect.height()+2);
//assert(rect.width()>0 && rect.height()>0);
int cursor;
for (cursor=0; cursor<count; cursor++) {
if (cluster[cursor].contains(rect)) {
// Wholly contained already.
return;
}
}
int lowestcost=9999999;
int cheapest=-1;
for (cursor=0; cursor<count; cursor++) {
if (cluster[cursor].intersects(biggerrect)) {
QRect larger=cluster[cursor];
include(larger,rect);
int cost=larger.width()*larger.height()
- cluster[cursor].width()*cluster[cursor].height();
if (cost < lowestcost) {
bool bad=FALSE;
for (int c=0; c<count && !bad; c++) {
bad=cluster[c].intersects(larger) && c!=cursor;
}
if (!bad) {
cheapest=cursor;
lowestcost=cost;
}
}
}
}
if (cheapest>=0) {
include(cluster[cheapest],rect);
return;
}
if (count < max) {
cluster[count++]=rect;
return;
}
// Do cheapest of:
// add to closest cluster
// do cheapest cluster merge, add to new cluster
lowestcost=9999999;
cheapest=-1;
for (cursor=0; cursor<count; cursor++) {
QRect larger=cluster[cursor];
include(larger,rect);
int cost=larger.width()*larger.height()
- cluster[cursor].width()*cluster[cursor].height();
if (cost < lowestcost) {
bool bad=FALSE;
for (int c=0; c<count && !bad; c++) {
bad=cluster[c].intersects(larger) && c!=cursor;
}
if (!bad) {
cheapest=cursor;
lowestcost=cost;
}
}
}
// XXX could make an heuristic guess as to whether we
// XXX need to bother looking for a cheap merge.
int cheapestmerge1=-1;
int cheapestmerge2=-1;
for (int merge1=0; merge1<count; merge1++) {
for (int merge2=0; merge2<count; merge2++) {
if (merge1!=merge2) {
QRect larger=cluster[merge1];
include(larger,cluster[merge2]);
int cost=larger.width()*larger.height()
- cluster[merge1].width()*cluster[merge1].height()
- cluster[merge2].width()*cluster[merge2].height();
if (cost < lowestcost) {
bool bad=FALSE;
for (int c=0; c<count && !bad; c++) {
bad=cluster[c].intersects(larger) && c!=cursor;
}
if (!bad) {
cheapestmerge1=merge1;
cheapestmerge2=merge2;
lowestcost=cost;
}
}
}
}
}
if (cheapestmerge1>=0) {
include(cluster[cheapestmerge1],cluster[cheapestmerge2]);
cluster[cheapestmerge2]=cluster[count--];
} else {
// if (!cheapest) debugRectangles(rect);
include(cluster[cheapest],rect);
}
// NB: clusters do not intersect (or intersection will
// overwrite). This is a result of the above algorithm,
// given the assumption that (x,y) are ordered topleft
// to bottomright.
}
const QRect& Clusterizer::operator[](int i)
{
return cluster[i];
}

View File

@@ -0,0 +1,34 @@
/* NetHack 3.6 qt_clust.h $NHDT-Date: 1432512779 2015/05/25 00:12:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
/* Copyright (c) Warwick Allison, 1999. */
/* NetHack may be freely redistributed. See license for details. */
#ifndef clusterizer_H
#define clusterizer_H
#include <qrect.h>
class Clusterizer
{
public:
Clusterizer(int maxclusters);
~Clusterizer();
void add(int x, int y); // 1x1 rectangle (point)
void add(int x, int y, int w, int h);
void add(const QRect &rect);
void clear();
int
clusters()
{
return count;
}
const QRect &operator[](int i);
private:
QRect *cluster;
int count;
const int max;
};
#endif

View File

@@ -0,0 +1,11 @@
/* NetHack 3.6 qt_kde0.h $NHDT-Date: 1432512779 2015/05/25 00:12:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
/* Copyright (c) Warwick Allison, 1999. */
/* NetHack may be freely redistributed. See license for details. */
#ifndef QT_DUMMYKDE
#define QT_DUMMYKDE
class KTopLevelWidget : public QMainWindow
{
Q_OBJECT
};
#endif

5315
outdated/win/Qt3/qt3_win.cpp Normal file

File diff suppressed because it is too large Load Diff

890
outdated/win/Qt3/qt3_win.h Normal file
View File

@@ -0,0 +1,890 @@
// NetHack 3.6 qt_win.h $NHDT-Date: 1575917700 2019/12/09 18:55:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.0 $
// Copyright (c) Warwick Allison, 1999.
// NetHack may be freely redistributed. See license for details.
//
// Qt Binding for NetHack 3.4
//
// Unfortunately, this doesn't use Qt as well as I would like,
// primarily because NetHack is fundamentally a getkey-type
// program rather than being event driven (hence the ugly key
// and click buffer rather), but also because this is my first
// major application of Qt.
//
#ifndef qt_win_h
#define qt_win_h
#define QT_CLEAN_NAMESPACE
#include <qdialog.h>
#include <qpushbutton.h>
#include <qbuttongroup.h>
#include <qlabel.h>
#include <qlineedit.h>
#if defined(QWS)
#include <qpe/qpeapplication.h>
#else
#include <qapplication.h>
#endif
#include <qspinbox.h>
#include <qcheckbox.h>
#include <qfile.h>
#include <qlistbox.h>
#include <qlistview.h>
#include <qmessagebox.h>
#include <qpixmap.h>
#include <qimage.h>
#include <qarray.h>
#include <qcombobox.h>
#include <qscrollview.h>
#if QT_VERSION >= 300
#include <qttableview.h>
// Should stop using QTableView
#define QTableView QtTableView
#else
#include <qtableview.h>
#endif
#include <qmainwindow.h>
#include <qwidgetstack.h>
#ifdef KDE
#include <kapp.h>
#include <ktopwidget.h>
#endif
#include "qt3_clust.h"
class QVBox;
class QMenuBar;
class QRadioButton;
class NhPSListView;
//////////////////////////////////////////////////////////////
//
// The beautiful, abstracted and well-modelled classes...
//
//////////////////////////////////////////////////////////////
class NetHackQtGlyphs;
class NetHackQtLineEdit : public QLineEdit
{
public:
NetHackQtLineEdit();
NetHackQtLineEdit(QWidget *parent, const char *name);
void fakeEvent(int key, int ascii, int state);
};
class NetHackQtSettings : public QDialog
{
Q_OBJECT
public:
// Size of window - used to decide default sizes
NetHackQtSettings(int width, int height);
NetHackQtGlyphs &glyphs();
const QFont &normalFont();
const QFont &normalFixedFont();
const QFont &largeFont();
bool ynInMessages();
signals:
void fontChanged();
void tilesChanged();
public slots:
void toggleGlyphSize();
void setGlyphSize(bool);
private:
QSpinBox tilewidth;
QSpinBox tileheight;
QLabel widthlbl;
QLabel heightlbl;
QCheckBox whichsize;
QSize othersize;
QComboBox fontsize;
QFont normal, normalfixed, large;
NetHackQtGlyphs *theglyphs;
private slots:
void resizeTiles();
};
class NetHackQtKeyBuffer
{
public:
NetHackQtKeyBuffer();
bool Empty() const;
bool Full() const;
void Put(int k, int ascii, int state);
void Put(char a);
void Put(const char *str);
int GetKey();
int GetAscii();
int GetState();
int TopKey() const;
int TopAscii() const;
int TopState() const;
private:
enum { maxkey = 64 };
int key[maxkey];
int ascii[maxkey];
int state[maxkey];
int in, out;
};
class NetHackQtClickBuffer
{
public:
NetHackQtClickBuffer();
bool Empty() const;
bool Full() const;
void Put(int x, int y, int mod);
int NextX() const;
int NextY() const;
int NextMod() const;
void Get();
private:
enum { maxclick = 64 };
struct ClickRec {
int x, y, mod;
} click[maxclick];
int in, out;
};
class NetHackQtSavedGameSelector : public QDialog
{
public:
NetHackQtSavedGameSelector(const char **saved);
int choose();
};
class NetHackQtPlayerSelector : private QDialog
{
Q_OBJECT
public:
enum { R_None = -1, R_Quit = -2, R_Rand = -3 };
NetHackQtPlayerSelector(NetHackQtKeyBuffer &);
protected:
virtual void done(int);
public slots:
void Quit();
void Random();
void selectName(const QString &n);
void selectRole();
void selectRace();
void setupOthers();
void selectGender(int);
void selectAlignment(int);
public:
bool Choose();
private:
NetHackQtKeyBuffer &keysource;
NhPSListView *role;
NhPSListView *race;
QRadioButton **gender;
QRadioButton **alignment;
bool fully_specified_role;
};
class NetHackQtStringRequestor : QDialog
{
private:
QLabel prompt;
NetHackQtLineEdit input;
QPushButton *okay;
QPushButton *cancel;
NetHackQtKeyBuffer &keysource;
virtual void done(int);
public:
NetHackQtStringRequestor(NetHackQtKeyBuffer &, const char *p,
const char *cancelstr = "Cancel");
void SetDefault(const char *);
bool Get(char *buffer, int maxchar = 80);
virtual void resizeEvent(QResizeEvent *);
};
class NetHackQtExtCmdRequestor : public QDialog
{
Q_OBJECT
NetHackQtKeyBuffer &keysource;
public:
NetHackQtExtCmdRequestor(NetHackQtKeyBuffer &ks);
int get();
private slots:
void cancel();
void done(int i);
};
class NetHackQtWindow
{
public:
NetHackQtWindow();
virtual ~NetHackQtWindow();
virtual QWidget *Widget() = 0;
virtual void Clear();
virtual void Display(bool block);
virtual bool Destroy();
virtual void CursorTo(int x, int y);
virtual void PutStr(int attr, const char *text);
virtual void StartMenu();
virtual void AddMenu(int glyph, const ANY_P *identifier, char ch,
char gch, int attr, const char *str, unsigned itemflags);
virtual void EndMenu(const char *prompt);
virtual int SelectMenu(int how, MENU_ITEM_P **menu_list);
virtual void ClipAround(int x, int y);
virtual void PrintGlyph(int x, int y, int glyph);
virtual void UseRIP(int how, time_t when);
int nhid;
};
class NetHackQtGlyphs
{
public:
NetHackQtGlyphs();
int
width() const
{
return size.width();
}
int
height() const
{
return size.height();
}
void toggleSize();
void setSize(int w, int h);
void drawGlyph(QPainter &, int glyph, int pixelx, int pixely);
void drawCell(QPainter &, int glyph, int cellx, int celly);
private:
QImage img;
QPixmap pm, pm1, pm2;
QSize size;
int tiles_per_row;
};
class BlackScrollView : public QScrollView
{
public:
BlackScrollView()
{
viewport()->setBackgroundColor(black);
}
};
class NetHackQtMapWindow : public QWidget, public NetHackQtWindow
{
Q_OBJECT
private:
NetHackQtClickBuffer &clicksink;
unsigned short glyph[ROWNO][COLNO];
unsigned short &
Glyph(int x, int y)
{
return glyph[y][x];
}
QPoint cursor;
BlackScrollView viewport;
QPixmap pet_annotation;
Clusterizer change;
QFont *rogue_font;
QString messages;
QRect messages_rect;
void Changed(int x, int y);
signals:
void resized();
private slots:
void updateTiles();
void moveMessages(int x, int y);
#ifdef SAFERHANGUP
void timeout();
#endif
protected:
virtual void paintEvent(QPaintEvent *);
virtual void mousePressEvent(QMouseEvent *);
public:
NetHackQtMapWindow(NetHackQtClickBuffer &click_sink);
~NetHackQtMapWindow();
virtual QWidget *Widget();
virtual bool Destroy();
virtual void Clear();
virtual void Display(bool block);
virtual void CursorTo(int x, int y);
virtual void PutStr(int attr, const char *text);
virtual void ClipAround(int x, int y);
virtual void PrintGlyph(int x, int y, int glyph);
void Scroll(int dx, int dy);
// For messages
void displayMessages(bool block);
void putMessage(int attr, const char *text);
void clearMessages();
void clickCursor();
};
class NetHackQtScrollText;
class NetHackQtMessageWindow : QObject, public NetHackQtWindow
{
Q_OBJECT
public:
NetHackQtMessageWindow();
~NetHackQtMessageWindow();
virtual QWidget *Widget();
virtual void Clear();
virtual void Display(bool block);
virtual void PutStr(int attr, const char *text);
void Scroll(int dx, int dy);
void setMap(NetHackQtMapWindow *);
private:
NetHackQtScrollText *list;
bool changed;
NetHackQtMapWindow *map;
private slots:
void updateFont();
};
class NetHackQtLabelledIcon : public QWidget
{
public:
NetHackQtLabelledIcon(QWidget *parent, const char *label);
NetHackQtLabelledIcon(QWidget *parent, const char *label,
const QPixmap &icon);
enum { NoNum = -99999 };
void setLabel(const char *, bool lower = TRUE); // a string
void setLabel(const char *, long, const char *tail = ""); // a number
void setLabel(const char *, long show_value, long comparative_value,
const char *tail = "");
void setIcon(const QPixmap &);
virtual void setFont(const QFont &);
void highlightWhenChanging();
void lowIsGood();
void dissipateHighlight();
virtual void show();
protected:
void resizeEvent(QResizeEvent *);
private:
void initHighlight();
void setAlignments();
void highlight(const QPalette &highlight);
void unhighlight();
bool low_is_good;
int prev_value;
int turn_count; /* last time the value changed */
QPalette hl_good;
QPalette hl_bad;
QLabel *label;
QLabel *icon;
};
class NetHackQtStatusWindow : QWidget, public NetHackQtWindow
{
Q_OBJECT
public:
NetHackQtStatusWindow();
virtual QWidget *Widget();
virtual void Clear();
virtual void Display(bool block);
virtual void CursorTo(int x, int y);
virtual void PutStr(int attr, const char *text);
void fadeHighlighting();
protected:
void resizeEvent(QResizeEvent *);
private slots:
void doUpdate();
private:
enum { hilight_time = 1 };
QPixmap p_str;
QPixmap p_dex;
QPixmap p_con;
QPixmap p_int;
QPixmap p_wis;
QPixmap p_cha;
QPixmap p_chaotic;
QPixmap p_neutral;
QPixmap p_lawful;
QPixmap p_satiated;
QPixmap p_hungry;
QPixmap p_confused;
QPixmap p_sick_fp;
QPixmap p_sick_il;
QPixmap p_blind;
QPixmap p_stunned;
QPixmap p_hallu;
QPixmap p_encumber[5];
NetHackQtLabelledIcon name;
NetHackQtLabelledIcon dlevel;
NetHackQtLabelledIcon str;
NetHackQtLabelledIcon dex;
NetHackQtLabelledIcon con;
NetHackQtLabelledIcon intel;
NetHackQtLabelledIcon wis;
NetHackQtLabelledIcon cha;
NetHackQtLabelledIcon gold;
NetHackQtLabelledIcon hp;
NetHackQtLabelledIcon power;
NetHackQtLabelledIcon ac;
NetHackQtLabelledIcon level;
NetHackQtLabelledIcon exp;
NetHackQtLabelledIcon align;
NetHackQtLabelledIcon time;
NetHackQtLabelledIcon score;
NetHackQtLabelledIcon hunger;
NetHackQtLabelledIcon confused;
NetHackQtLabelledIcon sick_fp;
NetHackQtLabelledIcon sick_il;
NetHackQtLabelledIcon blind;
NetHackQtLabelledIcon stunned;
NetHackQtLabelledIcon hallu;
NetHackQtLabelledIcon encumber;
QFrame hline1;
QFrame hline2;
QFrame hline3;
int cursy;
bool first_set;
void nullOut();
void updateStats();
void checkTurnEvents();
};
class NetHackQtMenuDialog : public QDialog
{
Q_OBJECT
public:
NetHackQtMenuDialog();
void Accept();
void Reject();
void SetResult(int);
virtual void done(int);
protected:
void resizeEvent(QResizeEvent *);
signals:
void Resized();
};
class NetHackQtMenuWindow : public QTableView, public NetHackQtWindow
{
Q_OBJECT
public:
NetHackQtMenuWindow(NetHackQtKeyBuffer &);
~NetHackQtMenuWindow();
virtual QWidget *Widget();
virtual void StartMenu();
virtual void AddMenu(int glyph, const ANY_P *identifier, char ch,
char gch, int attr, const char *str, unsigned itemflags);
virtual void EndMenu(const char *prompt);
virtual int SelectMenu(int how, MENU_ITEM_P **menu_list);
public slots:
void All();
void ChooseNone();
void Invert();
void Search();
void Layout();
void ToggleSelect(int);
protected:
virtual void keyPressEvent(QKeyEvent *);
// virtual void mouseDoubleClickEvent(QMouseEvent*);
virtual void mousePressEvent(QMouseEvent *);
virtual void mouseReleaseEvent(QMouseEvent *);
virtual void mouseMoveEvent(QMouseEvent *);
virtual void focusOutEvent(QFocusEvent *);
virtual void focusInEvent(QFocusEvent *);
virtual void paintCell(QPainter *, int, int);
virtual int cellWidth(int col);
private:
struct MenuItem {
MenuItem();
~MenuItem();
int glyph;
ANY_P identifier;
int attr;
const char *str;
int count;
char ch;
bool selected;
bool
Selectable() const
{
return identifier.a_void != 0;
}
};
QArray<MenuItem> item;
int itemcount;
int str_width;
bool str_fixed;
int next_accel;
NetHackQtKeyBuffer &keysource;
NetHackQtMenuDialog *dialog;
QPushButton *ok;
QPushButton *cancel;
QPushButton *all;
QPushButton *none;
QPushButton *invert;
QPushButton *search;
QLabel prompt;
int how;
bool has_glyphs;
int pressed;
bool was_sel;
};
class NetHackQtTextListBox;
class NetHackQtRIP : public QWidget
{
private:
static QPixmap *pixmap;
char **line;
int riplines;
public:
NetHackQtRIP(QWidget *parent);
void setLines(char **l, int n);
protected:
virtual void paintEvent(QPaintEvent *event);
QSize sizeHint() const;
};
class NetHackQtTextWindow : public QDialog, public NetHackQtWindow
{
Q_OBJECT
public:
NetHackQtTextWindow(NetHackQtKeyBuffer &);
~NetHackQtTextWindow();
virtual QWidget *Widget();
virtual void Clear();
virtual bool Destroy();
virtual void Display(bool block);
virtual void PutStr(int attr, const char *text);
virtual void UseRIP(int how, time_t when);
public slots:
void Search();
protected:
virtual void done(int);
virtual void keyPressEvent(QKeyEvent *);
private slots:
void doUpdate();
private:
NetHackQtKeyBuffer &keysource;
bool use_rip;
bool str_fixed;
QPushButton ok;
QPushButton search;
NetHackQtTextListBox *lines;
NetHackQtRIP rip;
};
class NetHackQtMenuOrTextWindow : public NetHackQtWindow
{
private:
NetHackQtWindow *actual;
NetHackQtKeyBuffer &keysource;
public:
NetHackQtMenuOrTextWindow(NetHackQtKeyBuffer &);
virtual QWidget *Widget();
// Text
virtual void Clear();
virtual bool Destroy();
virtual void Display(bool block);
virtual void PutStr(int attr, const char *text);
// Menu
virtual void StartMenu();
virtual void AddMenu(int glyph, const ANY_P *identifier, char ch,
char gch, int attr, const char *str, unsigned itemflags);
virtual void EndMenu(const char *prompt);
virtual int SelectMenu(int how, MENU_ITEM_P **menu_list);
};
class NetHackQtDelay : QObject
{
private:
int msec;
public:
NetHackQtDelay(int ms);
void wait();
virtual void timerEvent(QTimerEvent *timer);
};
class NetHackQtInvUsageWindow : public QWidget
{
public:
NetHackQtInvUsageWindow(QWidget *parent);
virtual void paintEvent(QPaintEvent *);
private:
void drawWorn(QPainter &painter, obj *, int x, int y, bool canbe = TRUE);
};
// This class is the main widget for NetHack
//
// It is a collection of Message, Map, and Status windows. In the current
// version of nethack there is only one of each, and this class makes this
// assumption, not showing itself until all are inserted.
//
// This class simply knows how to layout such children sensibly.
//
// Since it is only responsible for layout, the class does not
// note the actual class of the windows.
//
#ifndef KDE
#include "qt3_kde0.h"
#endif
class NetHackQtMainWindow : public KTopLevelWidget
{
Q_OBJECT
public:
NetHackQtMainWindow(NetHackQtKeyBuffer &);
void AddMessageWindow(NetHackQtMessageWindow *window);
void AddMapWindow(NetHackQtMapWindow *window);
void AddStatusWindow(NetHackQtStatusWindow *window);
void RemoveWindow(NetHackQtWindow *window);
void updateInventory();
void fadeHighlighting();
public slots:
void doMenuItem(int);
void doKeys(const QString &);
protected:
virtual void resizeEvent(QResizeEvent *);
virtual void keyPressEvent(QKeyEvent *);
virtual void keyReleaseEvent(QKeyEvent *event);
virtual void closeEvent(QCloseEvent *);
private slots:
void layout();
void raiseMap();
void zoomMap();
void raiseMessages();
void raiseStatus();
private:
void ShowIfReady();
#ifdef KDE
KMenuBar *menubar;
#else
QMenuBar *menubar;
#endif
NetHackQtMessageWindow *message;
NetHackQtMapWindow *map;
NetHackQtStatusWindow *status;
NetHackQtInvUsageWindow *invusage;
NetHackQtKeyBuffer &keysink;
QWidgetStack *stack;
int dirkey;
const char **macro;
};
class NetHackQtYnDialog : QDialog
{
Q_OBJECT
private:
const char *question;
const char *choices;
char def;
NetHackQtKeyBuffer &keysource;
protected:
virtual void keyPressEvent(QKeyEvent *);
virtual void done(int);
private slots:
void doneItem(int);
public:
NetHackQtYnDialog(NetHackQtKeyBuffer &keysource, const char *,
const char *, char);
char Exec();
};
#ifdef KDE
#define NetHackQtBindBase KApplication
#elif defined(QWS)
#define NetHackQtBindBase QPEApplication
#else
#define NetHackQtBindBase QApplication
#endif
class NetHackQtBind : NetHackQtBindBase
{
private:
// Single-instance preservation...
NetHackQtBind(int &argc, char **argv);
static NetHackQtBind *instance;
static NetHackQtKeyBuffer keybuffer;
static NetHackQtClickBuffer clickbuffer;
static QWidget *splash;
static NetHackQtMainWindow *main;
public:
static void qt_init_nhwindows(int *argc, char **argv);
static void qt_player_selection();
static void qt_askname();
static void qt_get_nh_event();
static void qt_exit_nhwindows(const char *);
static void qt_suspend_nhwindows(const char *);
static void qt_resume_nhwindows();
static winid qt_create_nhwindow(int type);
static void qt_clear_nhwindow(winid wid);
static void qt_display_nhwindow(winid wid, BOOLEAN_P block);
static void qt_destroy_nhwindow(winid wid);
static void qt_curs(winid wid, int x, int y);
static void qt_putstr(winid wid, int attr, const char *text);
static void qt_display_file(const char *filename, BOOLEAN_P must_exist);
static void qt_start_menu(winid wid, unsigned long mbehavior);
static void qt_add_menu(winid wid, int glyph, const ANY_P *identifier,
CHAR_P ch, CHAR_P gch, int attr, const char *str,
unsigned itemflags);
static void qt_end_menu(winid wid, const char *prompt);
static int qt_select_menu(winid wid, int how, MENU_ITEM_P **menu_list);
static void qt_update_inventory();
static void qt_mark_synch();
static void qt_wait_synch();
static void qt_cliparound(int x, int y);
static void qt_cliparound_window(winid wid, int x, int y);
static void qt_print_glyph(winid wid, XCHAR_P x, XCHAR_P y,
int glyph, int bkglyph);
static void qt_raw_print(const char *str);
static void qt_raw_print_bold(const char *str);
static int qt_nhgetch();
static int qt_nh_poskey(int *x, int *y, int *mod);
static void qt_nhbell();
static int qt_doprev_message();
static char qt_yn_function(const char *question, const char *choices,
CHAR_P def);
static void qt_getlin(const char *prompt, char *line);
static int qt_get_ext_cmd();
static void qt_number_pad(int);
static void qt_delay_output();
static void qt_start_screen();
static void qt_end_screen();
static void qt_outrip(winid wid, int how, time_t when);
static int qt_kbhit();
private:
virtual bool notify(QObject *receiver, QEvent *event);
};
#endif

1422
outdated/win/Qt3/qt3_xpms.h Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,293 @@
/**********************************************************************
** $NHDT-Date: 1524683840 2018/04/25 19:17:20 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.5 $
** $Id: qttableview.h,v 1.2 2002/03/09 03:13:13 jwalz Exp $
**
** Definition of QtTableView class
**
** Created : 941115
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file contains a class moved out of the Qt GUI Toolkit API. It
** may be used, distributed and modified without limitation.
**
**********************************************************************/
#ifndef QTTABLEVIEW_H
#define QTTABLEVIEW_H
#ifndef QT_H
#include <qframe.h>
#endif // QT_H
#ifndef QT_NO_QTTABLEVIEW
class QScrollBar;
class QCornerSquare;
class QtTableView : public QFrame
{
Q_OBJECT
public:
virtual void setBackgroundColor(const QColor &);
virtual void setPalette(const QPalette &);
void show();
void repaint(bool erase = TRUE);
void repaint(int x, int y, int w, int h, bool erase = TRUE);
void repaint(const QRect &, bool erase = TRUE);
protected:
QtTableView(QWidget *parent = 0, const char *name = 0, WFlags f = 0);
~QtTableView();
int numRows() const;
virtual void setNumRows(int);
int numCols() const;
virtual void setNumCols(int);
int topCell() const;
virtual void setTopCell(int row);
int leftCell() const;
virtual void setLeftCell(int col);
virtual void setTopLeftCell(int row, int col);
int xOffset() const;
virtual void setXOffset(int);
int yOffset() const;
virtual void setYOffset(int);
virtual void setOffset(int x, int y, bool updateScrBars = TRUE);
virtual int cellWidth(int col);
virtual int cellHeight(int row);
int cellWidth() const;
int cellHeight() const;
virtual void setCellWidth(int);
virtual void setCellHeight(int);
virtual int totalWidth();
virtual int totalHeight();
uint tableFlags() const;
bool testTableFlags(uint f) const;
virtual void setTableFlags(uint f);
void clearTableFlags(uint f = ~0);
bool autoUpdate() const;
virtual void setAutoUpdate(bool);
void updateCell(int row, int column, bool erase = TRUE);
QRect cellUpdateRect() const;
QRect viewRect() const;
int lastRowVisible() const;
int lastColVisible() const;
bool rowIsVisible(int row) const;
bool colIsVisible(int col) const;
QScrollBar *verticalScrollBar() const;
QScrollBar *horizontalScrollBar() const;
private slots:
void horSbValue(int);
void horSbSliding(int);
void horSbSlidingDone();
void verSbValue(int);
void verSbSliding(int);
void verSbSlidingDone();
protected:
virtual void paintCell(QPainter *, int row, int col) = 0;
virtual void setupPainter(QPainter *);
void paintEvent(QPaintEvent *);
void resizeEvent(QResizeEvent *);
int findRow(int yPos) const;
int findCol(int xPos) const;
bool rowYPos(int row, int *yPos) const;
bool colXPos(int col, int *xPos) const;
int maxXOffset();
int maxYOffset();
int maxColOffset();
int maxRowOffset();
int minViewX() const;
int minViewY() const;
int maxViewX() const;
int maxViewY() const;
int viewWidth() const;
int viewHeight() const;
void scroll(int xPixels, int yPixels);
void updateScrollBars();
void updateTableSize();
private:
void coverCornerSquare(bool);
void snapToGrid(bool horizontal, bool vertical);
virtual void setHorScrollBar(bool on, bool update = TRUE);
virtual void setVerScrollBar(bool on, bool update = TRUE);
void updateView();
int findRawRow(int yPos, int *cellMaxY, int *cellMinY = 0,
bool goOutsideView = FALSE) const;
int findRawCol(int xPos, int *cellMaxX, int *cellMinX = 0,
bool goOutsideView = FALSE) const;
int maxColsVisible() const;
void updateScrollBars(uint);
void updateFrameSize();
void doAutoScrollBars();
void showOrHideScrollBars();
int nRows;
int nCols;
int xOffs, yOffs;
int xCellOffs, yCellOffs;
short xCellDelta, yCellDelta;
short cellH, cellW;
uint eraseInPaint : 1;
uint verSliding : 1;
uint verSnappingOff : 1;
uint horSliding : 1;
uint horSnappingOff : 1;
uint coveringCornerSquare : 1;
uint sbDirty : 8;
uint inSbUpdate : 1;
uint tFlags;
QRect cellUpdateR;
QScrollBar *vScrollBar;
QScrollBar *hScrollBar;
QCornerSquare *cornerSquare;
private: // Disabled copy constructor and operator=
#if defined(Q_DISABLE_COPY)
QtTableView(const QtTableView &);
QtTableView &operator=(const QtTableView &);
#endif
};
const uint Tbl_vScrollBar = 0x00000001;
const uint Tbl_hScrollBar = 0x00000002;
const uint Tbl_autoVScrollBar = 0x00000004;
const uint Tbl_autoHScrollBar = 0x00000008;
const uint Tbl_autoScrollBars = 0x0000000C;
const uint Tbl_clipCellPainting = 0x00000100;
const uint Tbl_cutCellsV = 0x00000200;
const uint Tbl_cutCellsH = 0x00000400;
const uint Tbl_cutCells = 0x00000600;
const uint Tbl_scrollLastHCell = 0x00000800;
const uint Tbl_scrollLastVCell = 0x00001000;
const uint Tbl_scrollLastCell = 0x00001800;
const uint Tbl_smoothHScrolling = 0x00002000;
const uint Tbl_smoothVScrolling = 0x00004000;
const uint Tbl_smoothScrolling = 0x00006000;
const uint Tbl_snapToHGrid = 0x00008000;
const uint Tbl_snapToVGrid = 0x00010000;
const uint Tbl_snapToGrid = 0x00018000;
inline int
QtTableView::numRows() const
{
return nRows;
}
inline int
QtTableView::numCols() const
{
return nCols;
}
inline int
QtTableView::topCell() const
{
return yCellOffs;
}
inline int
QtTableView::leftCell() const
{
return xCellOffs;
}
inline int
QtTableView::xOffset() const
{
return xOffs;
}
inline int
QtTableView::yOffset() const
{
return yOffs;
}
inline int
QtTableView::cellHeight() const
{
return cellH;
}
inline int
QtTableView::cellWidth() const
{
return cellW;
}
inline uint
QtTableView::tableFlags() const
{
return tFlags;
}
inline bool
QtTableView::testTableFlags(uint f) const
{
return (tFlags & f) != 0;
}
inline QRect
QtTableView::cellUpdateRect() const
{
return cellUpdateR;
}
inline bool
QtTableView::autoUpdate() const
{
return isUpdatesEnabled();
}
inline void
QtTableView::repaint(bool erase)
{
repaint(0, 0, width(), height(), erase);
}
inline void
QtTableView::repaint(const QRect &r, bool erase)
{
repaint(r.x(), r.y(), r.width(), r.height(), erase);
}
inline void
QtTableView::updateScrollBars()
{
updateScrollBars(0);
}
#endif // QT_NO_QTTABLEVIEW
#endif // QTTABLEVIEW_H

View File

@@ -0,0 +1,413 @@
/* NetHack 3.6 tileedit.cpp $NHDT-Date: 1524684508 2018/04/25 19:28:28 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.10 $ */
/* Copyright (c) Warwick Allison, 1999. */
/* NetHack may be freely redistributed. See license for details. */
/*
Build this little utility program if you want to use it to edit the tile
files. Move tileedit.cpp and tileedit.h to ../../util, add the
3 lines below to the Makefile there and "make tileedit".
tileedit: tileedit.cpp $(TEXT_IO)
moc -o tileedit.moc tileedit.h
$(CC) -o tileedit -I../include -I$(QTDIR)/include -L$(QTDIR)/lib tileedit.cpp $(TEXT_IO) -lqt
*/
#include "tileedit.h"
#include <qapplication.h>
#include <qmainwindow.h>
#include <qkeycode.h>
#include <qpopupmenu.h>
#include <qmenubar.h>
#include <qpainter.h>
#include <qstatusbar.h>
#include <qhbox.h>
#include <qlabel.h>
extern "C" {
#include "config.h"
#include "tile.h"
extern const char *FDECL(tilename, (int, int));
}
#define TILES_ACROSS 20
TilePickerTab::TilePickerTab(const char* basename, int i, QWidget* parent) :
QWidget(parent)
{
id = i;
filename = basename;
filename += ".txt";
num = 0;
int index = 0;
for (int real=0; real<2; real++) {
if ( real ) {
image.create( TILES_ACROSS*TILE_X,
((num+TILES_ACROSS-1)/TILES_ACROSS)*TILE_Y, 32 );
}
if ( !fopen_text_file(filename.latin1(), RDTMODE) ) {
// XXX handle better
exit(1);
}
pixel p[TILE_Y][TILE_X];
while ( read_text_tile(p) ) {
if ( real ) {
int ox = (index%TILES_ACROSS)*TILE_X;
int oy = (index/TILES_ACROSS)*TILE_Y;
for ( int y=0; y<TILE_Y; y++ ) {
QRgb* rgb = ((QRgb*)image.scanLine(oy+y)) + ox;
for ( int x=0; x<TILE_X; x++ ) {
*rgb++ = qRgb(p[y][x].r, p[y][x].g, p[y][x].b);
}
}
index++;
} else {
// Just count...
num++;
}
}
fclose_text_file();
}
image = image.convertDepth( 8, AvoidDither );
pixmap.convertFromImage( image );
}
bool TilePickerTab::save()
{
if ( !fopen_text_file(filename.latin1(), WRTMODE) ) {
// XXX handle better
exit(1);
}
pixel p[TILE_Y][TILE_X];
for ( int index=0; index < num; index++ ) {
int ox = (index%TILES_ACROSS)*TILE_X;
int oy = (index/TILES_ACROSS)*TILE_Y;
for ( int y=0; y<TILE_Y; y++ ) {
uchar* c = image.scanLine(oy+y) + ox;
for ( int x=0; x<TILE_X; x++ ) {
QRgb rgb = image.color(*c++);
p[y][x].r = qRed(rgb);
p[y][x].g = qGreen(rgb);
p[y][x].b = qBlue(rgb);
}
}
write_text_tile(p);
}
fclose_text_file();
}
void TilePickerTab::mousePressEvent(QMouseEvent* e)
{
int ox = e->x()-e->x()%TILE_X;
int oy = e->y()-e->y()%TILE_Y;
QImage subimage = image.copy(ox,oy,TILE_X,TILE_Y);
if ( e->button() == RightButton ) {
setCurrent(subimage);
} else {
last_pick = ox/TILE_X + oy/TILE_Y*TILES_ACROSS;
}
emit pick(subimage);
emit pickName(tilename(id, last_pick));
}
void TilePickerTab::setCurrent(const QImage& i)
{
int ox = last_pick%TILES_ACROSS * TILE_X;
int oy = last_pick/TILES_ACROSS * TILE_Y;
bitBlt( &image, ox, oy, &i );
bitBlt( &pixmap, ox, oy, &i );
repaint( ox, oy, TILE_X, TILE_Y, FALSE );
}
QSize TilePickerTab::sizeHint() const
{
return pixmap.size();
}
void TilePickerTab::paintEvent( QPaintEvent* )
{
QPainter p(this);
p.drawPixmap(0,0,pixmap);
}
static struct {
const char* name;
TilePickerTab* tab;
} tileset[] = {
{ "monsters", 0 },
{ "objects", 0 },
{ "other", 0 },
{ 0 }
};
TilePicker::TilePicker(QWidget* parent) :
QTabWidget(parent)
{
for (int i=0; tileset[i].name; i++) {
QString tabname = tileset[i].name;
tabname[0] = tabname[0].upper();
tileset[i].tab = new TilePickerTab(tileset[i].name,i+1,this);
addTab( tileset[i].tab, tabname );
connect( tileset[i].tab, SIGNAL(pick(const QImage&)),
this, SIGNAL(pick(const QImage&)) );
connect( tileset[i].tab, SIGNAL(pickName(const QString&)),
this, SIGNAL(pickName(const QString&)) );
}
}
void TilePicker::setCurrent(const QImage& i)
{
((TilePickerTab*)currentPage())->setCurrent(i);
}
void TilePicker::save()
{
for (int i=0; tileset[i].tab; i++) {
tileset[i].tab->save();
}
}
TrivialTileEditor::TrivialTileEditor( QWidget* parent ) :
QWidget(parent)
{
}
const QImage& TrivialTileEditor::image() const
{
return img;
}
void TrivialTileEditor::setColor( QRgb rgb )
{
pen = rgb;
for (penpixel = 0;
penpixel<img.numColors()-1 && (img.color(penpixel)&0xffffff)!=(pen.rgb()&0xffffff);
penpixel++)
continue;
}
void TrivialTileEditor::setImage( const QImage& i )
{
img = i;
setColor(pen.rgb()); // update penpixel
repaint(FALSE);
}
void TrivialTileEditor::paintEvent( QPaintEvent* e )
{
QRect r = e->rect();
QPoint tl = imagePoint(r.topLeft());
QPoint br = imagePoint(r.bottomRight());
r = QRect(tl,br).intersect(img.rect());
QPainter painter(this);
for (int y=r.top(); y<=r.bottom(); y++) {
for (int x=r.left(); x<=r.right(); x++) {
paintPoint(painter,QPoint(x,y));
}
}
}
void TrivialTileEditor::paintPoint(QPainter& painter, QPoint p)
{
QPoint p1 = screenPoint(p);
QPoint p2 = screenPoint(p+QPoint(1,1));
QColor c = img.color(img.scanLine(p.y())[p.x()]);
painter.fillRect(QRect(p1,p2-QPoint(1,1)), c);
}
void TrivialTileEditor::mousePressEvent(QMouseEvent* e)
{
QPoint p = imagePoint(e->pos());
if ( !img.rect().contains(p) )
return;
uchar& pixel = img.scanLine(p.y())[p.x()];
if ( e->button() == LeftButton ) {
pixel = penpixel;
QPainter painter(this);
paintPoint(painter,p);
} else if ( e->button() == RightButton ) {
emit pick( img.color(pixel) );
} else if ( e->button() == MidButton ) {
QPainter painter(this);
if ( pixel != penpixel )
fill(painter,p,pixel);
}
}
void TrivialTileEditor::fill(QPainter& painter, QPoint p, uchar from)
{
if ( img.rect().contains(p) ) {
uchar& pixel = img.scanLine(p.y())[p.x()];
if ( pixel == from ) {
pixel = penpixel;
paintPoint(painter,p);
fill(painter, p+QPoint(-1,0), from);
fill(painter, p+QPoint(+1,0), from);
fill(painter, p+QPoint(0,-1), from);
fill(painter, p+QPoint(0,+1), from);
}
}
}
void TrivialTileEditor::mouseReleaseEvent(QMouseEvent* e)
{
emit edited(image());
}
void TrivialTileEditor::mouseMoveEvent(QMouseEvent* e)
{
QPoint p = imagePoint(e->pos());
if ( !img.rect().contains(p) )
return;
uchar& pixel = img.scanLine(p.y())[p.x()];
pixel = penpixel;
QPainter painter(this);
paintPoint(painter,p);
}
QPoint TrivialTileEditor::imagePoint(QPoint p) const
{
return QPoint(p.x()*TILE_X/width(), p.y()*TILE_Y/height());
}
QPoint TrivialTileEditor::screenPoint(QPoint p) const
{
return QPoint(p.x()*width()/TILE_X, p.y()*height()/TILE_Y);
}
QSizePolicy TrivialTileEditor::sizePolicy() const
{
return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding, TRUE );
}
QSize TrivialTileEditor::sizeHint() const
{
return sizeForWidth(-1);
}
QSize TrivialTileEditor::sizeForWidth(int w) const
{
if ( w < 0 )
return QSize(TILE_X*32,TILE_Y*32);
else
return QSize(w,w*TILE_Y/TILE_X);
}
TilePalette::TilePalette( QWidget* parent ) :
QWidget(parent)
{
num = 0;
rgb = 0;
}
TilePalette::~TilePalette()
{
delete rgb;
}
void TilePalette::setFromImage( const QImage& i )
{
num = i.numColors();
rgb = new QRgb[num];
memcpy(rgb, i.colorTable(), num*sizeof(QRgb));
repaint(FALSE);
}
void TilePalette::setColor(QRgb c)
{
for (int i=0; i<num; i++)
if ( c == rgb[i] ) {
emit pick(c);
return;
}
}
QSizePolicy TilePalette::sizePolicy() const
{
return QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum, FALSE );
}
QSize TilePalette::sizeHint() const
{
return QSize(num*16,16);
}
void TilePalette::paintEvent( QPaintEvent* )
{
QPainter p(this);
for (int i=0; i<num; i++) {
int x1 = width()*i/num;
int x2 = width()*(i+1)/num;
p.fillRect(x1,0,x2-x1,height(),QColor(rgb[i]));
}
}
void TilePalette::mousePressEvent(QMouseEvent* e)
{
int c = e->x()*num/width();
emit pick(rgb[c]);
}
TileEditor::TileEditor(QWidget* parent) :
QVBox(parent),
editor(this),
palette(this)
{
connect( &palette, SIGNAL(pick(QRgb)),
&editor, SLOT(setColor(QRgb)) );
connect( &editor, SIGNAL(pick(QRgb)),
&palette, SLOT(setColor(QRgb)) );
connect( &editor, SIGNAL(edited(const QImage&)),
this, SIGNAL(edited(const QImage&)) );
}
void TileEditor::edit(const QImage& i)
{
editor.setImage(i);
palette.setFromImage(i);
}
const QImage& TileEditor::image() const
{
return editor.image();
}
class Main : public QMainWindow {
public:
Main() :
central(this),
editor(&central),
picker(&central)
{
QPopupMenu* file = new QPopupMenu(menuBar());
file->insertItem("&Save", &picker, SLOT(save()), CTRL+Key_S);
file->insertSeparator();
file->insertItem("&Exit", qApp, SLOT(quit()), CTRL+Key_Q);
menuBar()->insertItem("&File", file);
connect( &picker, SIGNAL(pick(const QImage&)),
&editor, SLOT(edit(const QImage&)) );
connect( &picker, SIGNAL(pickName(const QString&)),
statusBar(), SLOT(message(const QString&)) );
connect( &editor, SIGNAL(edited(const QImage&)),
&picker, SLOT(setCurrent(const QImage&)) );
setCentralWidget(&central);
}
private:
QHBox central;
TileEditor editor;
TilePicker picker;
};
main(int argc, char** argv)
{
QApplication app(argc,argv);
Main m;
app.setMainWidget(&m);
m.show();
return app.exec();
}
#include "tileedit.moc"

135
outdated/win/Qt3/tileedit.h Normal file
View File

@@ -0,0 +1,135 @@
/* NetHack 3.6 tileedit.h $NHDT-Date: 1432512809 2015/05/25 00:13:29 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
/* Copyright (c) Warwick Allison, 1999. */
/* NetHack may be freely redistributed. See license for details. */
#ifndef QNHTILEEDIT_H
#define QNHTILEEDIT_H
#include <qtabwidget.h>
#include <qpixmap.h>
#include <qimage.h>
#include <qvbox.h>
class TilePickerTab : public QWidget
{
Q_OBJECT
public:
TilePickerTab(const char *basename, int id, QWidget *parent);
bool save();
int numTiles();
signals:
void pick(const QImage &);
void pickName(const QString &);
public slots:
void setCurrent(const QImage &);
protected:
void paintEvent(QPaintEvent *);
QSize sizeHint() const;
void mousePressEvent(QMouseEvent *);
private:
QString filename;
int id;
int last_pick;
int num;
QPixmap pixmap;
QImage image;
};
class TilePicker : public QTabWidget
{
Q_OBJECT
public:
TilePicker(QWidget *parent);
void setTile(int tilenum, const QImage &);
signals:
void pick(const QImage &);
void pickName(const QString &);
public slots:
void setCurrent(const QImage &);
void save();
};
class TrivialTileEditor : public QWidget
{
Q_OBJECT
public:
TrivialTileEditor(QWidget *parent);
const QImage &image() const;
signals:
void edited(const QImage &);
void pick(QRgb);
public slots:
void setColor(QRgb);
void setImage(const QImage &);
protected:
void paintEvent(QPaintEvent *);
void mousePressEvent(QMouseEvent *);
void mouseReleaseEvent(QMouseEvent *);
void mouseMoveEvent(QMouseEvent *);
QSize sizeHint() const;
QSize sizeForWidth(int) const;
QSizePolicy sizePolicy() const;
private:
void fill(QPainter &painter, QPoint p, uchar from);
QImage img;
QColor pen;
int penpixel;
void paintPoint(QPainter &painter, QPoint p);
QPoint screenPoint(QPoint) const;
QPoint imagePoint(QPoint) const;
};
class TilePalette : public QWidget
{
Q_OBJECT
public:
TilePalette(QWidget *parent);
~TilePalette();
void setFromImage(const QImage &);
protected:
void paintEvent(QPaintEvent *);
void mousePressEvent(QMouseEvent *);
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
signals:
void pick(QRgb);
public slots:
void setColor(QRgb);
private:
int num;
QRgb *rgb;
};
class TileEditor : public QVBox
{
Q_OBJECT
public:
TileEditor(QWidget *parent);
const QImage &image() const;
signals:
void edited(const QImage &);
public slots:
void edit(const QImage &);
private:
TrivialTileEditor editor;
TilePalette palette;
};
#endif

1
outdated/win/gem/.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
* NH_filestag=(file%s_for_GEM_versions_-_untested_for_3.7)

View File

@@ -0,0 +1,40 @@
$NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$
Hi,
This is nethack3.5.0 for Atari Gem and tty
Windowing System.
It is by far not complete or perfect.
(My english too :-))
You need at least 2Meg free RAM, 16 colors and
3 Meg free Disk space.
In fact it works also with monochrome, but you
have to create a nh2.img (and title2.img) on your own.
Atari windowport changes from 3.3.0:
added a ASCII-Mode in GEM -> F2
the cursor is switchable -> F3
added inventory/menu search -> :
removed the redraw problem
removed almost all flicker (except with NOVA-Card :-()
placed the GEM-dialogues more pleasent
tty corner windows (i.e. inv) display now correct in a vt52-win
greyed out old messages
placed the GEM-windows more convient
...
Feel free to contact me about Issues and Errors.
e-mail: gaston@cs.tu-berlin.de
You use this program at your own risk, I can't
guarantee it will work or do you no harm.
Look at the nethack licence too.
As you may have noticed the look and feel is from
Warwick Allisons nethack3.1.3d Gem Version
and I have used E_Gem2.2.0 from Christian Grunenberg.
Marvin

338
outdated/win/gem/bitmfile.c Normal file
View File

@@ -0,0 +1,338 @@
/****************************\
* Bitmap mit Farbtabelle als *
* Graphik-Datei speichern *
* Autor: Gabriel Schmidt *
* (c) 1992 by MAXON-Computer *
* Modifiziert von Sebastian *
* Bieber, Dez. 1994 *
* -> Programmcode *
\****************************/
/*
* $NHDT-Date: 1432512809 2015/05/25 00:13:29 $ $NHDT-Branch: master $:$NHDT-Revision: 1.4 $
*/
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include "bitmfile.h"
/* --- (X) IMG-Implementation ----------------- */
#define IMG_COMPRESSED
typedef struct {
UWORD img_version;
UWORD img_headlen;
UWORD img_nplanes;
UWORD img_patlen;
UWORD img_pixw;
UWORD img_pixh;
UWORD img_w;
UWORD img_h;
} IMG_HEADER;
typedef enum { NONE, SOLID0, SOLID1, PATRUN, BITSTR } IMG_MODE;
typedef UBYTE IMG_SOLID;
typedef enum { RGB = 0, CMY = 1, Pantone = 2 } XIMG_COLMODEL;
typedef struct {
ULONG img_ximg;
XIMG_COLMODEL img_colmodel;
} XIMG_HEADER;
typedef struct RGB XIMG_RGB;
int
bitmap_to_img(FILE_TYP typ, int ww, int wh, unsigned int pixw,
unsigned int pixh, unsigned int planes, unsigned int colors,
const char *filename,
void (*get_color)(unsigned int colind, struct RGB *rgb),
void (*get_pixel)(int x, int y, unsigned int *colind))
{
int file, error, cnt;
IMG_HEADER header;
XIMG_HEADER xheader;
XIMG_RGB xrgb;
IMG_MODE mode;
UBYTE *line_buf, *write_buf;
register UBYTE *startpnt, *bufpnt;
unsigned int colind, line_len, line, bit;
register unsigned int byte;
register UBYTE count;
/* fill in (X) IMG-Header */
header.img_version = 1;
header.img_headlen = (UWORD) sizeof(header) / 2;
if (typ == XIMG)
header.img_headlen +=
(UWORD)(sizeof(xheader) + colors * sizeof(xrgb)) / 2;
header.img_nplanes = planes;
header.img_patlen = 2;
header.img_pixw = pixw;
header.img_pixh = pixh;
header.img_w = ww;
header.img_h = wh;
xheader.img_ximg = XIMG_MAGIC;
xheader.img_colmodel = RGB;
/* calculate linelength, allocate buffer. */
line_len = (ww + 7) / 8;
line_buf = malloc((size_t) planes * line_len);
if (line_buf == NULL)
return (ENOMEM);
/* Worst case: the bufferd line could grow to max. 3 times the length */
/* of the original!
*/
write_buf = malloc((size_t) 3 * line_len);
if (write_buf == NULL) {
free(line_buf);
return (ENOMEM);
};
/* open file */
file = open(filename, O_WRONLY | O_CREAT | O_TRUNC);
if (file < 0) {
error = errno;
free(line_buf);
free(write_buf);
return (error);
};
/* write Header */
if (write(file, &header, sizeof(header)) != sizeof(header)
|| (typ == XIMG
&& write(file, &xheader, sizeof(xheader)) != sizeof(xheader))) {
error = errno;
close(file);
free(line_buf);
free(write_buf);
return (error);
};
/* save the colortable if possible */
if (typ == XIMG)
for (cnt = 0; cnt < colors; cnt++) {
get_color(cnt, &xrgb);
if (write(file, &xrgb, sizeof(xrgb)) != sizeof(xrgb)) {
error = errno;
close(file);
free(line_buf);
free(write_buf);
return (error);
};
};
/* And now line by line ... */
for (line = 0; line < wh; line++) {
/* get pixel, split it up and */
/* store it as planes in buffer */
for (byte = 0; byte < line_len; byte++) {
for (cnt = 0; cnt < planes; cnt++)
line_buf[cnt * line_len + byte] = 0x00;
for (bit = 0; bit < 8; bit++) {
if (8 * byte + bit < ww)
get_pixel(8 * byte + bit, line, &colind);
for (cnt = 0; cnt < planes; cnt++) {
line_buf[cnt * line_len + byte] <<= 1;
line_buf[cnt * line_len + byte] |= colind & 0x01;
colind >>= 1;
};
};
};
/* compress bitstrings in buffer */
/* and write it to file */
for (cnt = 0; cnt < planes; cnt++) {
/* Bitstringpointer to start of plane */
startpnt = &line_buf[cnt * line_len];
bufpnt = write_buf;
while (startpnt < &line_buf[(cnt + 1) * line_len]) {
/*********************************************/
/* Which _new_ compression-mode "fits" the */
/* the current byte?
*/
/* Note: the compressing modes get choosen */
/* "positive". The non compressing BITSTR- */
/* mode is choosen only if nothing else */
/* "fits" ...
*/
/*********************************************/
switch (*startpnt) {
case 0x00:
mode = SOLID0;
break;
case 0xFF:
mode = SOLID1;
break;
default:
if (startpnt < &line_buf[(cnt + 1) * line_len - 3]
&& *(startpnt) == *(startpnt + 2)
&& *(startpnt + 1) == *(startpnt + 3))
mode = PATRUN;
else
mode = BITSTR;
};
/************************************************/
/* The mode is choosen, now work with it.
*/
/* The compressing modi stay current as long as */
/* possible.
*/
/************************************************/
count = 0;
switch (mode) {
case SOLID0:
while ((startpnt < &line_buf[(cnt + 1) * line_len])
&& (*(startpnt) == 0x00) && (count < 0x7F)) {
startpnt++;
count++;
};
*(bufpnt++) = count;
break;
case SOLID1:
while ((startpnt < &line_buf[(cnt + 1) * line_len])
&& (*(startpnt) == 0xFF) && (count < 0x7F)) {
startpnt++;
count++;
};
*(bufpnt++) = 0x80 | count;
break;
case PATRUN:
*(bufpnt++) = 0x00;
startpnt += 2;
count = 1;
while (startpnt < &line_buf[(cnt + 1) * line_len - 1]
&& *(startpnt) == *(startpnt - 2)
&& *(startpnt + 1) == *(startpnt - 1)
&& (count < 0xFF)) {
count++;
startpnt += 2;
};
*(bufpnt++) = count;
*(bufpnt++) = *(startpnt - 2);
*(bufpnt++) = *(startpnt - 1);
break;
/************************************************/
/* The while Condition is ment as follows: */
/* */
/* while ( NOT(2-Byte-Solidrun possible) &&
*/
/* NOT(6-Byte-Patternrun possible) &&
*/
/* count < 0xFF
* && */
/* still Bytes remaining )
*/
/* */
/* As soon as a _compressing_ alternative shows */
/* up, BITSTR gets cancelled!
*/
/************************************************/
case BITSTR:
*(bufpnt++) = 0x80;
while (!(((startpnt + count)
< &line_buf[(cnt + 1) * line_len - 1])
&& (((*(startpnt + count) == 0xFF)
&& (*(startpnt + count + 1) == 0xFF))
|| ((*(startpnt + count) == 0x00)
&& (*(startpnt + count + 1) == 0x00))))
&& !(((startpnt + count)
< &line_buf[(cnt + 1) * line_len - 5])
&& (*(startpnt + count)
== *(startpnt + count + 2))
&& (*(startpnt + count + 1)
== *(startpnt + count + 3))
&& (*(startpnt + count)
== *(startpnt + count + 4))
&& (*(startpnt + count + 1)
== *(startpnt + count + 5)))
&& (count < 0xFF)
&& ((startpnt + count)
< &line_buf[(cnt + 1) * line_len]))
count++;
*(bufpnt++) = count;
for (; count > 0; count--)
*(bufpnt++) = *(startpnt++);
break;
};
};
if (write(file, write_buf, bufpnt - write_buf)
!= (bufpnt - write_buf)) {
error = errno;
close(file);
free(line_buf);
free(write_buf);
return (error);
};
};
};
/*close file, free buffer. */
close(file);
free(line_buf);
free(write_buf);
return (0);
}
/*---filetype-dispatcher--------------------*/
const char *
get_file_ext(FILE_TYP typ)
{
switch (typ) {
case IMG:
case XIMG:
return ("IMG");
default:
return ("");
};
}
int
bitmap_to_file(FILE_TYP typ, int ww, int wh, unsigned int pwx,
unsigned int pwy, unsigned int planes, unsigned int colors,
const char *filename,
void (*get_color)(unsigned int colind, struct RGB *rgb),
void (*get_pixel)(int x, int y, unsigned int *colind))
{
switch (typ) {
case IMG:
case XIMG:
return (bitmap_to_img(typ, ww, wh, pwx, pwy, planes, colors, filename,
get_color, get_pixel));
default:
return (-1);
};
}

230
outdated/win/gem/gem_rsc.uu Normal file
View File

@@ -0,0 +1,230 @@
begin 777 GEM_RSC.RSC
M $29@^Z$B(/N@^Z #0)&@^Z)]X Y0 , !8 @ "@.
M "!.151(04-+ "!'86UE "!(97)E "!4:&5R90 @271E;0 @07!P
M87)E; @36%G:6, ("!!8F]U="!.971H86-K+BXN "TM+2TM+2TM+2TM+2TM
M+2TM+2TM+2T ("!$97-K($%C8V5S<V]R>2 Q(" ("!$97-K($%C8V5S<V]R
M>2 R(" ("!$97-K($%C8V5S<V]R>2 S(" ("!$97-K($%C8V5S<V]R>2 T
M(" ("!$97-K($%C8V5S<V]R>2 U(" ("!$97-K($%C8V5S<V]R>2 V("
M("!(96QP+BXN(" @(" @(" @/P @(%=H870@:7,N+BX@(" @(" O " @0V]M
M;6%N9"!H96QP+BXN("8 +2TM+2TM+2TM+2TM+2TM+2TM+2TM " @3W!T:6]N
M<RXN+B @(" @($\ ("!$:7-C;W9E<GD@;6]D92 @6 M+2TM+2TM+2TM+2TM
M+2TM+2TM+2T ("!3879E("8@475I=" @(" @4P M+2TM+2TM+2TM+2TM+2TM
M+2TM+2T ("!1=6ET(" @(" @(" @(" %<0 @(%)E<W0@(" @(" @(" @("X
M("!,;V]K(&1O=VX@(" @(" Z " @1V5T(" @(" @(" @(" @+ @(%-I=" @
M(" @(" @(" @!7, ("!7:7!E(&9A8V4@(" @( 5W " @57-E(&%B:6QI='D@
M(" %;0 @(%!A>2!S:&]P(" @(" @(' +2TM+2TM+2TM+2TM+2TM+2TM+2T
M("!5<" @(" @(" @(" @(" \ " @1&]W;B @(" @(" @(" @/@ M+2TM+2TM
M+2TM+2TM+2TM+2TM+0 @($9O<F-E(&QO8VL@(" @!68 ("!,;V]T(&)O>" @
M(" @( 5L " @16YG<F%V92!F;&]O<B @10 @($%G86EN(" @("!>00 M+2TM
M+2TM+2TM+2TM+2TM " @3&]O:R!A=" @(" [ " @4V5A<F-H(" @("!S " @
M3W!E;B @(" @("!O " @0VQO<V4@(" @("!C " @2VEC:R @(" @(%Y$ " @
M56YT<F%P(" @( 5U " @06)O=70@=')A<"!> " @2G5M<" @(" @( 5J " @
M0VAA=" @(" @( 5C " @1FEG:'0@(" @("!& " @4VAO=R!A;&P@(" @("!I
M " @4VAO=R!K:6YD(" @("!) " @1&ES8V]V97)I97,@("!< "TM+2TM+2TM
M+2TM+2TM+2TM+2T ("!%870@(" @(" @(" @(&4 ("!$<FEN:R @(" @(" @
M('$ ("!!<'!L>2 @(" @(" @(&$ ("!5<V5D('1O;VQS(" @("@ ("!0<F]J
M96-T:6QE(" @('0 ("!$<F]P(" @(" @(" @(&0 ("!$<F]P(&MI;F0@(" @
M($0 ("!$:7 @(" @(" @(" @!60 +2TM+2TM+2TM+2TM+2TM+2TM+0 @($YA
M;64@:71E;2 @(" %3@ @($YA;64@;6]N<W1E<B @0P @(%=I96QD('=E87!O
M;B @(" @=P @(%-W:71C:"!W96%P;VYS(" @> @($9I;&P@<75I=F5R(" @
M(" @40 @($9I<F4@*'%U:79E<BD@(" @9@ @(%-H;W<@=V5A<&]N(" @(" @
M*0 @($5N:&%N8V4@<VMI;&P@(" %90 M+2TM+2TM+2TM+2TM+2TM+2TM+2TM
M " @5V5A<B!A<FUO=7(@(" @("!7 " @4F5M;W9E(&%R;6]U<B @("!4 " @
M4F5M;W9E(&%L;" @(" @("!! " @5V]R;B!A<FUO<B @(" @("!; "TM+2TM
M+2TM+2TM+2TM+2TM+2TM+2T ("!796%R(&%C8V5S<V]R>2 @(% ("!296UO
M=F4@86-C97-S;W)Y(%( ("!7;W)N(')I;F=S(" @(" @(#T ("!7;W)N(&%M
M=6QE=" @(" @("( ("!,:7-T('-P96QL<R @*P M+2TM+2TM+2TM+2TM+2TM
M+2T ("!:87 @=V%N9" @(" @>@ @($-A<W0@<W!E;&P@("!: " @4F5A9" @
M(" @(" @('( ("!1=6%F9B @(" @(" @<0 @(%1E;&5P;W)T(" @(%Y4 " @
M26YV;VME(" @(" @!6D ("!4=7)N('5N9&5A9" %= @(%!R87D@(" @(" @
M( 5P " @4V%C<FEF:6-E(" @!6\ ("!2=6(@;&%M<" @(" %<@!/2P 3F5T
M2&%C:P!#;W!Y<FEG:'0@O2 Q.3@U+3(P,# 4W1I8VAT:6YG($UA=&AE;6%T
M:7-C:"!#96YT<G5M &%N9"!-+B!3=&5P:&5N<V]N %-E92!L:6-E;G-E(&9O
M<B!D971A:6QS+@!'14T@26YT97)F86-E(&)Y($-H<FES=&EA;B!"<F5S<VQE
M<B!W:71H($4M1V5M 0V]N=&%C=#H@9V%S=&]N0&-S+G1U+6)E<FQI;BYD
M90 $-A;F-E; !;4')O;7!T70 #\ /P _ #\ /P _ #\ /P _ #\ /P _
M #\ /P _ #\ /P _ #\ /P _ #\ /P _ #\ /P! $-H;VEC93H@7P!8 $]+
M #DY.3D 0V]U;G0Z(%]?7U\ .0!/2P!;4')O;7!T70 $! 0$! 0$! 0$!
M0$! 0$! 0$! 0$! 0$! 0$! 0$! 0$! 0$! 0$! 0$! 0$! 0$! 0$! %]?
M7U]?7U]?7U]?7U]?7U]?7U]?7U]?7U]?7U]?7U]?7U]?7U]?7U]?7U]?7U]?
M7U]?7U]? %@ 0V%N8V5L $]+ #$ R ,P #0 U -@ #<
M X .0 $1/5TX@/@ %50(#P !7:&\@87)T('1H;W4L('1R879E
M;&QE<C\ ! 0$! 0$! 0$! %]?7U]?7U]?7U\ 6 !/2P "A024-455)%
M($E.(#8T,'@T.# @34]$15,I 36]R90!.151(04-+ /[___________\
M____________ /___________P#___________\ X ' .
M !P#@ < X ' . !P#@ <
MX 0 " ' . & !@ !P#@ !X !X < X'P3X ?R#X' .!$$#^#
M\ @B!P#@;! _@ (-@< X#@0 "!P' . H$ @4!P#@.! (' <
MX"@0 "!0' . X$ @<!P#@*! (% < X?\0" ("/^' ./_D!P(
M' G_QP#B.) >'#P)'$< X#@0/YS^"!P' . X$#_=_@@<!P#@.!!___\(' <
MX#@0?___"!P' . X$'___P@<!P#@.!!___\(' < X#@0?___"!P' . X$#_=
M_@@<!P#@.! _G/X(' < X#@0'AP\"!P' . X$!P<' @<!P#@.! (' @(' <
MX#@0 !P "!P' . X$ < @<!P#@.! ' (' < X#@0 !P "!P' . X$ <
M @<!P#@.! ' (' < X#@0 !P "!P' . X$ < @<!P#@.! % (' <
MX#@0 !P "!P' . 0& 4 @(!P#@$ P ' 8" < X & !0 , ' . P <
M & !P#@ & % # < X P!P!@ ' . & V P (!P#@$ P(@8 20<
MX)( &#X, #8' .!L P & B!P#@1 & # P8< X8, P!@ "(' .!$ &
MP V!P#@; P8 20< X)( '\ @' . 0 !P#@ <
MX ' . !P#@ < X ' /______
M_____P#___________\ ____________ /___________P
M
M
M
M
M
M
M
M
M
M
M
M
M
M
M
M \\
M// ))"28">?GF @ !@)__^8"0 F D 59@) "8"0!5F D )@) 168"0
MF D%!9@$@ $X!($5, 2 3 "0%9P D "8 $@5. D G $A3@ D)P $DX
M F< $. G ' #SP\\ \\//@/
M___X#___^ ____@/ #X#U55^ \ /@/557X#P ^ ]55?@/ #X#U55^ >
M ?@'U57P!X !\ /55_ #P /@ ?47X #P#\ ?5^ #P_ ??@ #_P ?X
M #\ < '0 !V\ =P 4 !@ "$8 /__
M "\ 0 !W$ >1 'D@ % 8 A& #__P @ $ >: 'HP !Z0
M P & 0 __\ "0 ! 'V0 !]L ?E , !@ "$8 /__ ( "@
M!^H ?O '^P # 8 A& #__P % P @ ("0 " H P & 0
M __\ "0 ! ("P "$$ AW , !@ "$8 /__ #8 -@ "(, B%
M (A@ # 8 A$ #__@ " $ B' (B0 "(H P & (1 __X
M @ ! (BP "(T B. , !@ "$0 /_^ ( 0 "(\ B1 (D@ #
M 8 A$ #__@ " $ B3 (E0 ")8 P & (1 __X @ ! (
MEP ")D B: , !@ "$0 /_^ ( 0 ")L B= (G@ # 8 A$
M #__@ " $ B? (H0 "*( P & (1 __X @ ! (HP "*4
M BF , !@ "$0 /_^ ( 0 "*< BN (KP % 8 A& #__P '
M $ BP (M0 "+8 !0 & (1@ __\ !0 ! (MP "- C1 ,
M!@ "$P, /__ !D 0 "-( C= (Z # 8 I!Y #__P + L CJ
M ([0 ".X P & (0> $ P ! ([P "0H D+ , !@ "$0$
M /__ !L 0 "^H D: &URD 4 !( @ \Z
M .N@ "1$0 !P " ( ! " +0 (__\ 0 * !D
M : 9 H @ " !0 1 : ,! $ P ) !D
M " ,@,! 3_____ " - "0,! 7_____ "
M /0 ) !@,! ;_____ " 0P / !@,! ?_____
M " 20 5 !P,! C_____ " 4 < !@,! G_
M____ " 5@ B "0,! +_____ " 7P K !P,!
M "P!< !D P$ 40 3 !0 # 3 !0 /\1 "
M%@ ( W_____ !P 9@ %@ ! [_____ !P ( >0
M $ %@ ! ______ !P D ( %@ ! !#_____ !P
MI0 , %@ ! !'_____ !P N@ 0 %@ ! !+_____ !P
M SP 4 %@ ! !/_____ !P Y 8 %@ ! O_____ !P
M ^0 < %@ ! !\ %0 > !0 /\1 + %0 * !;_____
M !P !#@ %0 ! !?_____ !P !(@ $ %0 ! !C_
M____ !P !-@ ( %0 ! !G_____ !P ( !2@ , %0 !
M !K_____ !P !8 0 %0 ! !O_____ !P != 4
M%0 ! !S_____ !P ( !B 8 %0 ! !W_____ !P !G@
M < %0 ! ![_____ !P ( !L@ @ %0 ! !3_____ !P !
MR D %0 ! "X ( M !0 /\1 1 % . "'_____ !P
M !W % ! "+_____ !P ![P $ % ! "/_____ !P
M " @ ( % ! "3_____ !P "%0 , % ! "7_____
M !P "* 0 % ! ";_____ !P ".P 4 % ! "?_
M____ !P "3@ 8 % ! "C_____ !P ( "80 < % !
M "G_____ !P "=@ @ % ! "K_____ !P "B0 D
M% ! "O_____ !P ( "G H % ! "S_____ !P "L0
M L % ! "W_____ !P "Q P % ! !______ !P "
MUP T % ! #L +P Z !0 /\1 7 $ , ##_____ !P
M "Z@ $ ! #'_____ !P ( "^0 $ $ ! #+_____ !P
M #"@ ( $ ! #/_____ !P #&0 , $ ! #3_____
M !P #* 0 $ ! #7_____ !P #-P 4 $ ! #;_
M____ !P #1@ 8 $ ! #?_____ !P #50 < $ !
M #C_____ !P #9 @ $ ! #G_____ !P #<P D
M$ ! #K_____ !P #@@ H $ ! "[_____ !P #D0
M L $ ! $L / !* !0 /\1 > $P / #W_____ !P #
MH $P ! #[_____ !P #L@ $ $P ! #______ !P
M #Q ( $P ! $#_____ !P ( #U@ , $P ! $'_____ !P
M #Z@ 0 $P ! $+_____ !P #_ 4 $P ! $/_____
M !P $#@ 8 $P ! $3_____ !P $( < $P ! $7_
M____ !P $,@ @ $P ! $;_____ !P $1 D $P !
M $?_____ !P $5@ H $P ! $C_____ !P $: L
M$P ! $G_____ !P ( $>@ P $P ! $K_____ !P $C@
M T $P ! #O_____ !P $H X $P ! %P 3 !; !0 /\1
M D %@ 0 $W_____ !P $L@ %@ ! $[_____ !P
M $QP $ %@ ! $______ !P $W ( %@ ! %#_____ !P
M $\0 , %@ ! %'_____ !P %!@ 0 %@ ! %+_____
M !P %&P 4 %@ ! %/_____ !P ( %, 8 %@ ! %3_
M____ !P %1P < %@ ! %7_____ !P %7 @ %@ !
M %;_____ !P %<0 D %@ ! %?_____ !P %A@ H
M%@ ! %C_____ !P ( %FP L %@ ! %G_____ !P %L@
M P %@ ! %K_____ !P %QP T %@ ! %O_____ !P %
MW X %@ ! $O_____ !P %\0 \ %@ ! H 70!H !0
M /\1 M $@ , %[_____ !P &!@ $@ ! %______ !P
M ( &%P $ $@ ! &#_____ !P &*@ ( $@ ! &'_____
M !P &.P , $@ ! &+_____ !P &3 0 $@ ! &/_
M____ !P &70 4 $@ ! &3_____ !P &;@ 8 $@ !
M &7_____ !P &?P < $@ ! &;_____ !P &D @
M$@ ! &?_____ !P &H0 D $@ ! &C_____ !P &L@
M H $@ ! %S_____ !P ( &PP L $@ !__\ 0 ! !0 1
M 4 3P " #_____"Q0 8 $1>0 @ "__\ 0 ! !0
M $1 " $ H 5 #_____ !D ( $A 1 , @ !__\ 0 *"Q0
M 0 (1 # $ +@ * +_____ !H,!P &U I @$ P8! 4 P $
M !0 /\1 0 !" #0 ' 3_____ !\ 2(@ "" !0 % +_
M____ !P &V #" 4 !P ! ;_____ !P( &X / $ %0 !
M ?_____ !P &]@ / , '@ ! C_____ !P '%0 / 0
M$0 ! G_____ !P ')P / 8 & ! K_____ !4 /N@ !
M# <$(@ ! #_____ !4 ( /U@ !" @ (0 !__\ 0 ""Q0 0 /X1
M> ! ( 3P@6 +_____$QH,!P 'DP " !4 " ! #_____ !@ (
M ) ( @ &3@ 4__\ 0 ["Q0 0 (1> ! $ + ) +_____ !4(
M /\@ " $ " ! #< P U !0 $1>0 " , * @# 4 ! $
M !H,!0 'I0 !" @ ! /_____!1D $1 0 ! <
M!@ & !H,!0 'IP $" @ ! 7_____!1D $1 0 !
M D " ( !H,!0 'J0 '" @ ! ?_____!1D $1
M 0 ! L "@ * !H,!0 'JP *" @ ! G_____!1D $1
M 0 ! T # , !H,!0 'K0 -" @ ! O_____!1D $1
M 0 ! \ #@ . !H,!0 'KP 0" @ ! W_____!1D
M $1 0 ! !$ $ 0 !H,!0 'L0 3" @ ! ______!1D
M $1 0 ! !, $@ 2 !H,!0 'LP 6" @ ! !'_____
M!1D $1 0 ! !4 % 4 !H,!0 'M0 9" @ ! !/_
M____!1D $1 0 ! !< %@ 6 !H,!0 'MP <" @ !
M !7_____!1D $1 0 ! !D & 8 !H,!0 'N0 ?"
M @ ! !?_____!1D $1 0 ! !L &@ : !H,!0 'NP B
M" @ ! !G_____!1D $1 0 ! !T ' < !H,!0 '
MO0 E" @ ! !O_____!1D $1 0 ! !\ '@ > !H,!0
M 'OP ! ( @ ! !W_____!1D $1 0 ! "$ ( @ !H,
M!0 'P0 $ ( @ ! !______!1D $1 0 ! ", (@ B
M !H,!0 'PP ' ( @ ! "'_____!1D $1 0 ! "4
M) D !H,!0 'Q0 * ( @ ! "/_____!1D $1 0 !
M "< )@ F !H,!0 'QP - ( @ ! "7_____!1D $1
M 0 ! "D * H !H,!0 'R0 0 ( @ ! "?_____!1D $1
M 0 ! "L *@ J !H,!0 'RP 3 ( @ ! "G_____!1D $1
M 0 ! "T + L !H,!0 'S0 6 ( @ ! "O_____!1D
M $1 0 ! "\ +@ N !H,!0 'SP 9 ( @ ! "W_____!1D
M $1 0 ! #$ , P !H,!0 'T0 < ( @ ! "______
M!1D $1 0 ! #, ,@ R !H,!0 'TP ? ( @ ! #'_
M____!1D $1 0 ! #4 - T !H,!0 'U0 B ( @ !
M #/_____!1D $1 0 ! ( -@ V !H,!0 'UP E (
M @ ! #7_____!1D $1 0 ! #H . Y !0 $1>0 #
M , %@ # #G_____ !X(" 0#@ ! $ "P ! #?_____ !H,!P '
MYP - $ !P ! #O_____ !X(" 0*@ # < # ! #_____ !H,)0
M '_0 1 < !@ !__\ 0 $"Q0( 0 (1> ! $ .P ' +_____ !4(
M 01@ " $ -P ! /_____ !X(" 08@ " , -P ! 3_____
M$QH$!0 (>0 # 4 " ! #_____ !H,)P (@ P 4 " !__\
M 0 9"Q0 0 1> ( 0 # & +_____ !L 0 6> % @ !
M /_____ !L ! 6> " ( @ ! 3_____ !L P 6> *" (
M @ ! 7_____ !L @ 6> % 4 @ ! < !@ & !8,!0 0?@ "
M 0 @ ! 7_____!1D $1 0 ! D " ( !8,!0 0
MF@ % 0 @ ! ?_____!1D $1 0 ! L "@ * !8,!0
M 0M@ ( 0 @ ! G_____!1D $1 0 ! T # , !8,
M!0 0T@ "" ( @ ! O_____!1D $1 0 ! \ #@ .
M !8,!0 0[@ %" ( @ ! W_____!1D $1 0 ! !$
M$ 0 !8,!0 1"@ (" ( @ ! ______!1D $1 0 !
M !, $@ 2 !8,!0 1)@ " $ @ ! !'_____!1D $1
M 0 ! !4 % 4 !8,!0 10@ % $ @ ! !/_____!1D $1
M 0 ! !< %@ 6 !8,!0 17@ ( $ @ ! !7_____!1D $1
M 0 ! !D & 8 !8,!0 1>@ '! 4 !0P !?_____!1D
M $1 ! 0P &@ : !8,!0 1E@ ' !0P !G_____!1D
M( $1 ! 0P __\ 0 $ !0 1 ! 4 3P # +_____
M !L, 0 0 6>0 @ ! /_____"Q0( $1>0 $ @ ! 3_
M____ !L, 0 @ 6>0 ( @ ! #_____ !@ ( + " 30 #
M__\ 0 $"Q0 0 (1>0 ! $ + @4 +_____ !4( 1L@ !
M+ ! /_____"AX " 1S@ . !( $ ! 3_____ !8,!P 1Z@ A
M !( "0@! #_____ !8 ( 2!@ " $ * @,__\ 0 !"Q0 $1
M<@ # , " " #_____ !H,)P )# !" !@ !__\ 0 ! !0 0 @
M /\1>0 " , !@ # #_____ !\ ( 21 P # 29@ '#X
G !QN <G@ ':8 !WN CC@ ) 8 ":. G!@ )WX ">N
end

View File

@@ -0,0 +1,22 @@
begin 777 GEM_RSC.RSO
M4E-/2 1( @ " ! !#__P __\
M
M '___^!____@
M #__P #__P
M
M /_ '___^!____@ :1F]1)Y2KX@
M (\TJP "!$U%3E4 P'1$]!0D]55 '@9$3U%5250 __\ 0 #"E-4
M05154TQ)3D4 $*1U)!0E-405154P#__P " ,&34%05TE. !DU!4$)/
M6 0E-05!#55)33U( __\ P #!4%"3U54 "$9,64%"3U54 !!T]+
M04)/550 ,+3D542$%#2TE-1S __\ ! #!4Q)3D53 "$9,64Q)3D53
M !!5%,24Y% ""4Q)3D533$E35 #__P % ,(64Y#2$])0T4 +1DQ9
M64Y#2$])0T4 $(64Y04D]-4%0 ()4T]-14-(05)3 # UE.,0 -0-9
M3DX #<'04Y90TA!4@ . A#2$]314Y#2 .@5#3U5.5 .P193D]+ /__
M 8 P=,24Y%1T54 "D9,64Q)3D5'150 $(3$=04D]-4%0 ('3$=2
M15!,60 P-13$< 0$3$=/2P#__P ' ,)1$E214-424]. #$9,641)
M4D5#5$E/3@ !01$25(Q 5!$1)4CD !<'1$E21$]73@ &05$25)54 #_
M_P ( ,&35-'5TE. !!55035-' ""D=204)-4T=724X ,%1$Y-4T<
M 0(35-'3$E.15, __\ "0 #!TY!345'150 *1DQ93D%-14=%5 @90
M3$Y!344 0.3D542$%#2U!)0U154D4 __\ "@ #!5!!1T52 "$9,65!!
@1T52 !!E%004=%4@#__P + ,&3DA)0T]. /____\
end

204
outdated/win/gem/gr_rect.c Normal file
View File

@@ -0,0 +1,204 @@
/* NetHack 3.6 gr_rect.c $NHDT-Date: 1432512810 2015/05/25 00:13:30 $ $NHDT-Branch: master $:$NHDT-Revision: 1.7 $ */
*/
/* Copyright (c) Christian Bressler, 2001 */
/* NetHack may be freely redistributed. See license for details. */
/* This is an almost exact copy of qt_clust.cpp */
/* gr_rect.c */
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include "gr_rect.h"
dirty_rect *
new_dirty_rect(int size)
{
dirty_rect *new = NULL;
if (size > 0) {
new = (dirty_rect *) calloc(1L, sizeof(dirty_rect));
if (new) {
new->rects = (GRECT *) calloc((long) size, sizeof(GRECT));
if (new->rects == NULL) {
free(new);
return (NULL);
}
new->max = size;
}
}
return (new);
}
void
delete_dirty_rect(dirty_rect *this)
{
if (this == NULL)
return;
if (this->rects)
free(this->rects);
/* In case the Pointer is reused wrongly */
this->rects = NULL;
this->max = 0;
this->used = 0;
free(this);
}
static int gc_inside(GRECT *frame, GRECT *test);
static int gc_touch(GRECT *frame, GRECT *test);
static void gc_combine(GRECT *frame, GRECT *test);
static long gc_area(GRECT *area);
int
add_dirty_rect(dirty_rect *dr, GRECT *area)
{
int cursor;
long lowestcost = 9999999L;
int cheapest = -1;
int cheapestmerge1 = -1;
int cheapestmerge2 = -1;
int merge1;
int merge2;
for (cursor = 0; cursor < dr->used; cursor++) {
if (gc_inside(&dr->rects[cursor], area)) {
/* Wholly contained already. */
return (TRUE);
}
}
for (cursor = 0; cursor < dr->used; cursor++) {
if (gc_touch(&dr->rects[cursor], area)) {
GRECT larger = dr->rects[cursor];
long cost;
gc_combine(&larger, area);
cost = gc_area(&larger) - gc_area(&dr->rects[cursor]);
if (cost < lowestcost) {
int bad = FALSE, c;
for (c = 0; c < dr->used && !bad; c++) {
bad = gc_touch(&dr->rects[c], &larger) && c != cursor;
}
if (!bad) {
cheapest = cursor;
lowestcost = cost;
}
}
}
}
if (cheapest >= 0) {
gc_combine(&dr->rects[cheapest], area);
return (TRUE);
}
if (dr->used < dr->max) {
dr->rects[dr->used++] = *area;
return (TRUE);
}
// Do cheapest of:
// add to closest cluster
// do cheapest cluster merge, add to new cluster
lowestcost = 9999999L;
cheapest = -1;
for (cursor = 0; cursor < dr->used; cursor++) {
GRECT larger = dr->rects[cursor];
long cost;
gc_combine(&larger, area);
cost = gc_area(&larger) - gc_area(&dr->rects[cursor]);
if (cost < lowestcost) {
int bad = FALSE, c;
for (c = 0; c < dr->used && !bad; c++) {
bad = gc_touch(&dr->rects[c], &larger) && c != cursor;
}
if (!bad) {
cheapest = cursor;
lowestcost = cost;
}
}
}
// XXX could make an heuristic guess as to whether we
// XXX need to bother looking for a cheap merge.
for (merge1 = 0; merge1 < dr->used; merge1++) {
for (merge2 = 0; merge2 < dr->used; merge2++) {
if (merge1 != merge2) {
GRECT larger = dr->rects[merge1];
long cost;
gc_combine(&larger, &dr->rects[merge2]);
cost = gc_area(&larger) - gc_area(&dr->rects[merge1])
- gc_area(&dr->rects[merge2]);
if (cost < lowestcost) {
int bad = FALSE, c;
for (c = 0; c < dr->used && !bad; c++) {
bad = gc_touch(&dr->rects[c], &larger) && c != cursor;
}
if (!bad) {
cheapestmerge1 = merge1;
cheapestmerge2 = merge2;
lowestcost = cost;
}
}
}
}
}
if (cheapestmerge1 >= 0) {
gc_combine(&dr->rects[cheapestmerge1], &dr->rects[cheapestmerge2]);
dr->rects[cheapestmerge2] = dr->rects[dr->used - 1];
dr->rects[dr->used - 1] = *area;
} else {
gc_combine(&dr->rects[cheapest], area);
}
// NB: clusters do not intersect (or intersection will
// overwrite). This is a result of the above algorithm,
// given the assumption that (x,y) are ordered topleft
// to bottomright.
return (TRUE);
}
int
get_dirty_rect(dirty_rect *dr, GRECT *area)
{
if (dr == NULL || area == NULL || dr->rects == NULL || dr->used <= 0
|| dr->max <= 0)
return (FALSE);
*area = dr->rects[--dr->used];
return (TRUE);
}
int
clear_dirty_rect(dirty_rect *dr)
{
if (dr)
dr->used = 0;
return (TRUE);
}
int
resize_dirty_rect(dirty_rect *dr, int new_size)
{
return (FALSE);
}
static int
gc_inside(GRECT *frame, GRECT *test)
{
if (frame && test && frame->g_x <= test->g_x && frame->g_y <= test->g_y
&& frame->g_x + frame->g_w >= test->g_x + test->g_w
&& frame->g_y + frame->g_h >= test->g_y + test->g_h)
return (TRUE);
return (FALSE);
}
static int
gc_touch(GRECT *frame, GRECT *test)
{
GRECT tmp = { test->g_x - 1, test->g_y - 1, test->g_w + 2,
test->g_h + 2 };
return (rc_intersect(frame, &tmp));
}
static void
gc_combine(GRECT *frame, GRECT *test)
{
if (!frame || !test)
return;
if (frame->g_x > test->g_x) {
frame->g_w += frame->g_x - test->g_x;
frame->g_x = test->g_x;
}
if (frame->g_y > test->g_y) {
frame->g_h += frame->g_y - test->g_y;
frame->g_y = test->g_y;
}
if (frame->g_x + frame->g_w < test->g_x + test->g_w)
frame->g_w = test->g_x + test->g_w - frame->g_x;
if (frame->g_y + frame->g_h < test->g_y + test->g_h)
frame->g_h = test->g_y + test->g_h - frame->g_y;
}
static long
gc_area(GRECT *area)
{
return ((long) area->g_h * (long) area->g_w);
}

View File

@@ -0,0 +1,17 @@
/* gr_rect.h */
/*
* $NHDT-Date: 1432512809 2015/05/25 00:13:29 $ $NHDT-Branch: master $:$NHDT-Revision: 1.4 $
*/
#include <e_gem.h>
/********** structs **********/
typedef struct {
GRECT *rects;
int max, used;
} dirty_rect;
/********* functions ************/
dirty_rect *new_dirty_rect(int size);
void delete_dirty_rect(dirty_rect *this);
int add_dirty_rect(dirty_rect *dr, GRECT *area);
int get_dirty_rect(dirty_rect *dr, GRECT *area);
int clear_dirty_rect(dirty_rect *dr);
int resize_dirty_rect(dirty_rect *dr, int new_size);

321
outdated/win/gem/load_img.c Normal file
View File

@@ -0,0 +1,321 @@
/*
* $NHDT-Date: 1432512809 2015/05/25 00:13:29 $ $NHDT-Branch: master $:$NHDT-Revision: 1.5 $
*/
#define __TCC_COMPAT__
#include <stdio.h>
#include <string.h>
#include <osbind.h>
#include <memory.h>
#include <aesbind.h>
#include <vdibind.h>
#include <gemfast.h>
#include <e_gem.h>
#include "load_img.h"
#ifndef FALSE
#define FALSE 0
#define TRUE !FALSE
#endif
/* VDI <-> Device palette order conversion matrixes: */
/* Four-plane vdi-device */
int vdi2dev4[] = { 0, 15, 1, 2, 4, 6, 3, 5, 7, 8, 9, 10, 12, 14, 11, 13 };
/* Two-plane vdi-device */
int vdi2dev2[] = { 0, 3, 1, 2 };
void
get_colors(int handle, short *palette, int col)
{
int i, idx;
/* get current color palette */
for (i = 0; i < col; i++) {
/* device->vdi->device palette order */
switch (planes) {
case 1:
idx = i;
break;
case 2:
idx = vdi2dev2[i];
break;
case 4:
idx = vdi2dev4[i];
break;
default:
if (i < 16)
idx = vdi2dev4[i];
else
idx = i == 255 ? 1 : i;
}
vq_color(handle, i, 0, (int *) palette + idx * 3);
}
}
void
img_set_colors(int handle, short *palette, int col)
{
int i, idx, end;
/* set color palette */
end = min(1 << col, 1 << planes);
for (i = 0; i < end; i++) {
switch (planes) { /* MAR -- war col 10.01.2001 */
case 1:
idx = i;
break;
case 2:
idx = vdi2dev2[i];
break;
case 4:
idx = vdi2dev4[i];
break;
default:
if (i < 16)
idx = vdi2dev4[i];
else
idx = i == 255 ? 1 : i;
}
vs_color(handle, i, (int *) palette + idx * 3);
}
}
int
convert(MFDB *image, long size)
{
int plane, mplanes;
char *line_addr, *buf_addr, *new_addr, *new1_addr, *image_addr,
*screen_addr;
MFDB dev_form, tmp;
long new_size;
/* convert size from words to bytes */
size <<= 1;
/* memory for the device raster */
new_size = size * (long) planes;
if ((new_addr = (char *) calloc(1, new_size)) == NULL)
return (FALSE);
/* initialize MFDBs */
tmp = *image;
tmp.fd_nplanes = planes;
tmp.fd_addr = new_addr;
tmp.fd_stand = 1; /* standard format */
dev_form = tmp;
screen_addr = new_addr;
dev_form.fd_stand = 0; /* device format */
image_addr = (char *) image->fd_addr;
/* initialize some variables and zero temp. line buffer */
mplanes = min(image->fd_nplanes, planes);
/* convert image */
line_addr = image_addr;
buf_addr = screen_addr;
if (mplanes > 1) {
/* cut/pad color planes into temp buf */
for (plane = 0; plane < mplanes; plane++) {
memcpy(buf_addr, line_addr, size);
line_addr += size;
buf_addr += size;
}
} else {
/* fill temp line bitplanes with a b&w line */
for (plane = 0; plane < planes; plane++) {
memcpy(buf_addr, line_addr, size);
buf_addr += size;
}
}
free(image->fd_addr);
/* convert image line in temp into current device raster format */
if ((new1_addr = (char *) calloc(1, new_size)) == NULL)
return (FALSE);
dev_form.fd_addr = new1_addr;
vr_trnfm(x_handle, &tmp, &dev_form);
free(new_addr);
/* change image description */
image->fd_stand = 0; /* device format */
image->fd_addr = new1_addr;
image->fd_nplanes = planes;
return (TRUE);
}
int
transform_img(MFDB *image)
{ /* return FALSE if transform_img fails */
int success;
long size;
if (!image->fd_addr)
return (FALSE);
size = (long) ((long) image->fd_wdwidth * (long) image->fd_h);
success = convert(
image, size); /* Use vr_trfm(), which needs quite a lot memory. */
if (success)
return (TRUE);
/* else show_error(ERR_ALLOC); */
return (FALSE);
}
/* Loads & depacks IMG (0 if succeded, else error). */
/* Bitplanes are one after another in address IMG_HEADER.addr. */
int
depack_img(char *name, IMG_header *pic)
{
int b, line, plane, width, word_aligned, opcode, patt_len, pal_size,
byte_repeat, patt_repeat, scan_repeat, error = FALSE;
char *pattern, *to, *endline, *puffer, sol_pat;
long size;
FILE *fp;
if ((fp = fopen(name, "rb")) == NULL)
return (ERR_FILE);
setvbuf(fp, NULL, _IOLBF, BUFSIZ);
/* read header info (bw & ximg) into image structure */
fread((char *) &(pic->version), 2, 8 + 3, fp);
/* only 2-256 color imgs */
if (pic->planes < 1 || pic->planes > 8) {
error = ERR_COLOR;
goto end_depack;
}
/* if XIMG, read info */
if (pic->magic == XIMG && pic->paltype == 0) {
pal_size = (1 << pic->planes) * 3 * 2;
if ((pic->palette = (short *) calloc(1, pal_size))) {
fread((char *) pic->palette, 1, pal_size, fp);
}
} else {
pic->palette = NULL;
}
/* width in bytes word aliged */
word_aligned = (pic->img_w + 15) >> 4;
word_aligned <<= 1;
/* width byte aligned */
width = (pic->img_w + 7) >> 3;
/* allocate memory for the picture */
free(pic->addr);
size = (long) ((long) word_aligned * (long) pic->img_h
* (long) pic->planes); /*MAR*/
/* check for header validity & malloc long... */
if (pic->length > 7 && pic->planes < 33 && pic->img_w > 0
&& pic->img_h > 0) {
if (!(pic->addr = (char *) calloc(1, size))) {
error = ERR_ALLOC;
goto end_depack;
}
} else {
error = ERR_HEADER;
goto end_depack;
}
patt_len = pic->pat_len;
/* jump over the header and possible (XIMG) info */
fseek(fp, (long) pic->length * 2L, SEEK_SET);
for (line = 0, to = pic->addr; line < pic->img_h;
line += scan_repeat) { /* depack whole img */
for (plane = 0, scan_repeat = 1; plane < pic->planes;
plane++) { /* depack one scan line */
puffer = to =
pic->addr
+ (long) (line + plane * pic->img_h) * (long) word_aligned;
endline = puffer + width;
do { /* depack one line in one bitplane */
switch ((opcode = fgetc(fp))) {
case 0: /* pattern or scan repeat */
if ((patt_repeat = fgetc(fp))) { /* repeat a pattern */
fread(to, patt_len, 1, fp);
pattern = to;
to += patt_len;
while (--patt_repeat) { /* copy pattern */
memcpy(to, pattern, patt_len);
to += patt_len;
}
} else { /* repeat a line */
if (fgetc(fp) == 0xFF)
scan_repeat = fgetc(fp);
else {
error = ERR_DEPACK;
goto end_depack;
}
}
break;
case 0x80: /* Literal */
byte_repeat = fgetc(fp);
fread(to, byte_repeat, 1, fp);
to += byte_repeat;
break;
default: /* Solid run */
byte_repeat = opcode & 0x7F;
sol_pat = opcode & 0x80 ? 0xFF : 0x00;
while (byte_repeat--)
*to++ = sol_pat;
}
} while (to < endline);
if (to == endline) {
/* ensure that lines aren't repeated past the end of the img
*/
if (line + scan_repeat > pic->img_h)
scan_repeat = pic->img_h - line;
/* copy line to image buffer */
if (scan_repeat > 1) {
/* calculate address of a current line in a current
* bitplane */
/* to=pic->addr+(long)(line+1+plane*pic->img_h)*(long)word_aligned;*/
for (b = scan_repeat - 1; b; --b) {
memcpy(to, puffer, width);
to += word_aligned;
}
}
} else {
error = ERR_DEPACK;
goto end_depack;
}
}
}
end_depack:
fclose(fp);
return (error);
}
int
half_img(MFDB *s, MFDB *d)
{
int pxy[8], i, j;
MFDB tmp;
mfdb(&tmp, NULL, s->fd_w / 2, s->fd_h, s->fd_stand, s->fd_nplanes);
tmp.fd_w = s->fd_w / 2;
tmp.fd_addr = calloc(1, mfdb_size(&tmp));
if (!tmp.fd_addr)
return (FALSE);
pxy[1] = pxy[5] = 0;
pxy[3] = pxy[7] = s->fd_h - 1;
for (i = 0; i < s->fd_w / 2; i++) {
pxy[0] = pxy[2] = 2 * i;
pxy[4] = pxy[6] = i;
vro_cpyfm(x_handle, S_ONLY, pxy, s, &tmp);
}
pxy[0] = pxy[4] = 0;
pxy[2] = pxy[6] = s->fd_w / 2 - 1;
for (j = 0; j < s->fd_h / 2; j++) {
pxy[1] = pxy[3] = 2 * j;
pxy[5] = pxy[7] = j;
vro_cpyfm(x_handle, S_ONLY, pxy, &tmp, d);
}
free(tmp.fd_addr);
return (TRUE);
}

159
outdated/win/gem/tile2img.c Normal file
View File

@@ -0,0 +1,159 @@
/* NetHack 3.6 tile2img.c $NHDT-Date: 1432512809 2015/05/25 00:13:29 $ $NHDT-Branch: master $:$NHDT-Revision: 1.6 $ */
/* Copyright (c) NetHack PC Development Team 1995 */
/* NetHack may be freely redistributed. See license for details. */
/*
* Edit History:
*
* Initial Creation M.Allison 94/01/11
* Marvin was here Marvin 97/01/11
*
*/
/* #include <stdlib.h> */
#include "hack.h"
#include "tile.h"
#include "bitmfile.h"
/* #define COLORS_IN_USE MAXCOLORMAPSIZE /* 256 colors */
#define COLORS_IN_USE 16 /* 16 colors */
extern char *FDECL(tilename, (int, int));
static void FDECL(build_ximgtile, (pixel(*) [TILE_X]));
void get_color(unsigned int colind, struct RGB *rgb);
void get_pixel(int x, int y, unsigned int *colind);
#if COLORS_IN_USE == 16
#define MAX_X 320 /* 2 per byte, 4 bits per pixel */
#else
#define MAX_X 640
#endif
#define MAX_Y 1200
FILE *tibfile2;
pixel tilepixels[TILE_Y][TILE_X];
char *tilefiles[] = { "..\\win\\share\\monsters.txt",
"..\\win\\share\\objects.txt",
"..\\win\\share\\other.txt" };
unsigned int **Bild_daten;
int num_colors = 0;
int tilecount;
int max_tiles_in_row = 40;
int tiles_in_row;
int filenum;
int initflag;
int yoffset, xoffset;
char bmpname[128];
FILE *fp;
int
main(argc, argv)
int argc;
char *argv[];
{
int i;
if (argc != 2) {
Fprintf(stderr, "usage: tile2img outfile.img\n");
exit(EXIT_FAILURE);
} else
strcpy(bmpname, argv[1]);
#ifdef OBSOLETE
bmpfile2 = fopen(NETHACK_PACKED_TILEFILE, WRBMODE);
if (bmpfile2 == (FILE *) 0) {
Fprintf(stderr, "Unable to open output file %s\n",
NETHACK_PACKED_TILEFILE);
exit(EXIT_FAILURE);
}
#endif
tilecount = 0;
xoffset = yoffset = 0;
initflag = 0;
filenum = 0;
fp = fopen(bmpname, "wb");
if (!fp) {
printf("Error creating tile file %s, aborting.\n", bmpname);
exit(1);
}
fclose(fp);
Bild_daten = (unsigned int **) malloc(MAX_Y * sizeof(unsigned int *));
for (i = 0; i < MAX_Y; i++)
Bild_daten[i] = (unsigned int *) malloc(MAX_X * sizeof(unsigned int));
while (filenum < 3) {
if (!fopen_text_file(tilefiles[filenum], RDTMODE)) {
Fprintf(stderr, "usage: tile2img (from the util directory)\n");
exit(EXIT_FAILURE);
}
num_colors = colorsinmap;
if (num_colors > 62) {
Fprintf(stderr, "too many colors (%d)\n", num_colors);
exit(EXIT_FAILURE);
}
while (read_text_tile(tilepixels)) {
build_ximgtile(tilepixels);
tilecount++;
xoffset += TILE_X;
if (xoffset >= MAX_X) {
yoffset += TILE_Y;
xoffset = 0;
}
}
(void) fclose_text_file();
++filenum;
}
Fprintf(stderr, "Total of %d tiles in memory.\n", tilecount);
bitmap_to_file(XIMG, MAX_X, (tilecount / 20 + 1) * 16, 372, 372, 4, 16,
bmpname, get_color, get_pixel);
Fprintf(stderr, "Total of %d tiles written to %s.\n", tilecount, bmpname);
exit(EXIT_SUCCESS);
/*NOTREACHED*/
return 0;
}
void
get_color(unsigned int colind, struct RGB *rgb)
{
rgb->r = (1000L * (long) ColorMap[CM_RED][colind]) / 0xFF;
rgb->g = (1000L * (long) ColorMap[CM_GREEN][colind]) / 0xFF;
rgb->b = (1000L * (long) ColorMap[CM_BLUE][colind]) / 0xFF;
}
void
get_pixel(int x, int y, unsigned int *colind)
{
*colind = Bild_daten[y][x];
}
static void
build_ximgtile(pixels)
pixel (*pixels)[TILE_X];
{
int cur_x, cur_y, cur_color;
int x, y;
for (cur_y = 0; cur_y < TILE_Y; cur_y++) {
for (cur_x = 0; cur_x < TILE_X; cur_x++) {
for (cur_color = 0; cur_color < num_colors; cur_color++) {
if (ColorMap[CM_RED][cur_color] == pixels[cur_y][cur_x].r
&& ColorMap[CM_GREEN][cur_color] == pixels[cur_y][cur_x].g
&& ColorMap[CM_BLUE][cur_color] == pixels[cur_y][cur_x].b)
break;
}
if (cur_color >= num_colors)
Fprintf(stderr, "color not in colormap!\n");
y = cur_y + yoffset;
x = cur_x + xoffset;
Bild_daten[y][x] = cur_color;
}
}
}

426
outdated/win/gem/title.uu Normal file
View File

@@ -0,0 +1,426 @@
begin 777 title.img
M $ .P $ $!= %T 4 R%A)34< /H ^@#Z /H &K ^@ /H ^@
M #Z /H #Z LH#Z &K CT"R@$: :L!JP+* 1H CT /H
M :L (] 1H -; UL"R@/H LH"/0 _PDH*"BH!H ) ?_@'_^_
M___'A( /_#_\!__X _P#__P?__P!B@HAH )_@ ?X ! X!( / \ #^ '
M__ /\ /@ /A@>!@ ?@#_^____'@X 0W_@?^ /_\ __ ?_X!__P 8H!X (
M?\ '_Q___X.#@ ^/\ _P ?_@ ?P ?_ #_\'AX (?]_W_U___[N#@!"O]^_W
M_?_O_\?S^?_?[_\_A@> "& P!@,8 #& X !V( .&!@8 8 P '@.$8# # ,'
M* > "#_@ _X/__^#@X /C_ /\ #_X ?_ #_@ ?^!X> "* O^@+H "Z X /
MJ!?H%_Z +_^8#>Z O_0"AP> "& P P8, #& X /S# ,, & 8 #@ Q&!P P&
M!R@'@ @_X '\!___@X. #X?@!^ _\ ?_X _X '_ >'@ B@+_T%] N@.
M#[0O]"_^@%__8 +N@;_T!8<'@ @P, &&# Q@. #\PP## !@& !P &Q@X ,
M# <H!X ('^ _ ?__X.#@ ^'X ?@ /_ '__ /X !_@'AX (T"_^A?0 +H#
M@ ^T+_0O_H!?_D !3H)_] N'!X (,#X!A_P /X#@!#\/\P_P8!_@8 \8/_
M&!__!@B !PX ? #@#@ @P#\ /P ?@ 2! 8 "!_\&!X ('^X _??__[N#
M@!"W[\?OP/_?@/__@/[_#_?_!H> "- O_H7T "Z X /M"_T+_Z 7_Z (Z"
M_^@7AP6 "O@ ,!X!A_P /X#@!#\/XP_@8!_ P \8/^&#_\!@B !P8 ?
M #@#@ <P#X /@ ?!8 $_@ /_ 8%@ KX !_V /WW__^[@X 0M^^'[X#_WP'_
M_Z#^_@_O_ :'@ C0%_Z%] N@. #[0O]"_^@%_] "N@O_H+X<%@ KX # ?
M 8?\ #^ X 0_#^,/X, /P,!X'&#_#!_\ 8%@ H@ ' 'P X X ', ^
M#X #P6 !/P '_ &!8 *N ?]P#]]___NX. $+?OA^^!_^\!___@_OP?W_ &
MA8 *W__0%_Z%] N@. #[0O]"_] "_] >!N@O_07X<%@!U\ # ? 8?L/_S^
M?P'X_#\,/P, /@<'_#&#_&!_X 8%@ H0 ' '@ X X ', \ #P #@6
M!/P '^ &!8 *' ?]P#]Y___NX. $+?O!^\!_^X!_A_@_OP_W^ &A8 <[__0
M%_Z%]#_\NG\!^+0O]"_] "_Y!APN@O^@7X<%@!T\ # / 8?L?__^_X/__#\,
M/P, /@8/_CN#^&#_P 8%@ H0 # '@ X X 0, \ #P #@ !X H ^ _
MP 8%@!T< !_[ /WGP .[@/X'M^\'[P'_[@/YX^K^^#^_P :%@!SO_] +_H7T
M0 .Z@(('M"_T+_T +_H)XBZ"_Z"_AP6 "#P , \!A^Q_@X 2@__\/PP_ P ^
M!A__/X/PP/^ !@6 '1@ , > ?_#A^ /@P#P / . ?X#@#P #^ !@6
M'1P '_L _>??_+M^_OBW[P?O ?_N _?Y[O[P?[^ !H6 '.?_T O^A?1?_+M^
M@OBT+_0O_0 O^A?Y+H+_0+^'!8 </X P#X&'['___W^#__P_##\#!#X./_^_
M@_&!_P<%@!P;@ #@ '@'_\X?@#_, \ #P #@ /_@X \ !_!P6 '!^ '_N
M_>??_SI^_O\W[P?O ?_N ^_^[O[P_W\'A8 <Y__0"_Z%]%__.OZ"_S0O]"_]
M!"_R+_ZN@OZ!?X<%@!P_@# /@8?L?__^?X/__#\,/P,.'PQ___^#\8/^!P6
M'!N . > ?_[A^ /^P#P / ' !__#@#P /X'!8 <'X ?^X#]Y]__N'[^
M_[?O!^\!^_<'W_]N_O#^_@>%@!OG_] +_H7T7_^Y_H+_M"_T+_T*%_1?_VZ"
M_H*(!8 </\ P!X&'['___G^#__P_##\&#A\,?___@_,#_@<%@!P;P !@ '@
M'__X?@#_\ \ #P !P ?_XX \ #^!P6 '!_ '_V _>??__A^_O_W[P?O _OW
M!]__KO[Q_OX'A8 ;Y__0!?Z%]%__^?Z"__0O]"_Z"A?T7_^N@OT"B 6 '#_
M, ?!A^Q___Q_@__\/PP_!@X?#/_A_X/V!_P'!8 <&\ < !X!__^'X __ /
M \ < /^'. / !_ <%@!P?P!_]P/WGW__X?O[_]^\'[P/[]P>_X<[^\_W\
M!X6 &^?_T 7^A?1?__O^@O_T+_0O^@H7]+__SH+Z!8@%@!P_P# 'P8?L?@ \
M>8/P?#\,/P8>'QS_@'^#_ _\!P6 '!O ' > > #QX /!P#P / ' #^
M;@#P _P'!8 <'\ ?_<#]Y]X /'C^\'?O!^\#\_<'OX!N_O?[_ >%@!OG_] %
M_H7T7____H+_]"_T+_H2%^2__^Z"] N(!8 </\ P \&'['X #'&#\ P_##\&
M'Q\9_P ?@_P/^ <%@!P;P P '@'@ ,< #P \ #P $!P!_ !X \ /X!P6
M'!_ '_[ _>?> QP_O '[P?O _7W#W\ 'O[W^_@'A8 ;Y__0 OZ%]%____Z"
M__0O]"_Z%1?I?__^@O0+B 6 '#_ , /!A^Q^ 1AH_ ,/_P_!A\?F?X #X/X
M'_ '!8 -&\ , !X!X !& \ . # \ ! > ?@ . . '\ <%@!P?P!_^P/WG
MW@ $8-[P!^ '[P/U]X]^ [^[_?P!X6 &^?_T +^A?1?___^@O_T( 0O^A47
MZ7___H+H%X@%@!P_P# #X8?L?@ 88/P#!_X/PP?#YG^ >#\#_P!P6 #1O
M #@ > > !@ / #@ P/ 0#@'X !@# #_ '!8 <'\ ?_N#]Y]X &#^\ ?_
M_^\']?N/?@ &_M_O\ >%@!OG_] "_H7T7____H+_]!_X+_05"^E___Z"T"^(
M!8 </\ P ^&'['X $'C\ P #\,'P^9_ #@_ _X <%@ T;P X '@'@
M0 #P X ,#P $ X!\ ( P _@!P6 '!_ '_[@_>?> ! GO '___O!_7[CWP
M O[?[^ 'A8 ;Y__0 OZ%]%____Z"__0 "_T%0OI?__^@M OB 6 '#_ , 'A
MA^Q^ !Z_ , _##\/F?P 8/@?\ '!8 (&\ & !X!X$@ 'P X &#P ,
M X!\!( "'\ '!8 ('\ ?_V#]Y]X#@!&6\ ?__^\'[?N/? _C_?P >%@!OG
M_] !?H7T7____H+_] +_0M"^E___Z"(%^(!8 </\ Q ?&'['X &C\ P
M #\,/P^9^ !@<!_P <%@ @;P < '@'@2 ? #@ 8/ P#@'@$@ (?P <%
M@ @?P!__</WGW@. $=[P!___[P?M^X]X #__]_ !X6 &^?_T0%^A?1?___^
M@O_T O]"T+Z7___H' 7X@%@!Q_P#.!\8?L?@ 8/P# /PP_C['X &
M /^ !P6 "!O !P > >!( !\ . !@\ #@. > 2 C^ !P6 "!_ 'O]P_>?>
M X 1_O '___O!^[[GW@ /__OX 'A8 ;Y__2@7Z%]%____Z"__0 "_T+HO1
M?__^@ "_B 6 &W_ ,X#QA^Q^! !F_ , !_##^'\?@ 8 !_P@%@ @[P
M, '@'@2 ? #@ 8/ X!P'@$@ %_" 6 "#_ 'O^P_>?> X 0YO '__^O!^[]
MWW@ /__?PB%@!O'_]* OH7T7_O__H+_] +_0NA=%___Z 7^(@ $.!(&
M&L S@/&'['X, '#\ P #\8/X?S^ !@ '_"( !#@2 "#O P > >!( !
M\ . !@\ #@' ^ 2 7\(!8 (/\ >_[#]Y]X#@!"^\ ?__^\/[OW>^ __]_
M"(6 &\?_TH"^A?1?\__^@O_T OZ"Z%TO___H !?XB (!^ !_\ SP/F'
M['X\ &+\ P?^'\8?X?S^ !@ /^"( "'X #@ A[P . '@'@2 ? #@ 8/
M !X!P/@$@ '^" 6 &W_ 'G^X_>?>" ]O '__^O#][]WO@ /_^_@B%@!J'
M_]) OH7T7\O__H+_]!_X+^A>A=+___Z HF 3.$@!O\ #/ P88,8?P <<
M#+_\,!AAAC, & 8 #@ )Y7@. 3^$@ 'X'8 "!_X#@ $,!( 5_ >?X#\
M!\ X "Z =@!^ /P/P> X($@ )__@.%@!4$ !) @(0$0#@ (( !" $( A
MA!(#@ * 02 G@!@X @;X . #-@888,?\P ;\ ## ,,!AAAC, &!
M@8 %@ -UP " 7^$@ & 'X ##\ @!H0?____? 'C_ _ ? ^ P@ 'X ?@
M#\#\'@."!H #?\ A( 6_G $B! A 1 R @@ $( 0@"$"$$@. H&!!H #
M<#__@ %?A * &3-@888,/PP 8, #K ,<!A@PS, &#P, &@ (- ( !>82
M 7 @@ (# ( !( . %@.( !X_P/P'__@ /X !6 'H _ ?AX#@ /^?X &@ (/
M (2 %OSX !(@0(0$/P@ (( !" $( A 0A(#@ ."0( &@ (,_X2 '/X #,P
M888, P ?, #+ -L!A@PS, &#X, '@ ' @ '@@ 55555^^"& 4 $@!8'
M! >'\#\!__X ". =@!F /P'X> X #_C^ !X !P(2 %OF, !(00(0$ @
M (( !" $( A 0A(#@ ."(( '@ &_A( <_ ,S QA@P C !XP ,, SP-,##
M,P 8-@P > 3" < #@ (=O"& 1 $@!8& @ >'^#\!_]X "> ?@!R ;
M@'X> X #_C^ !X !,(2 %OL& !(0((0$ @ (( !" $(!" 0A(#@ ."(( '
M@ $OA( 6_ '_\_@_A_P)#___T__\/_T_\O_#\X. X/P?X> ?" < #@ (-
M_"($@!P& __>[^[]]_;[__ZN__?O]N_=OW[>___^_M_?AX !\(2 '/L'_]+H
M+H7T O__H+_]"_T+]"_0M+___Z"T%^(A( 6Z '_\_@_A_P'[___@__\?_R_
M^?_#\X. X/P?X> >" 8 #@!P)_?_ X X!\ #__X __ /\ _ /P# ___^
M , ?AX !X 2 '!(#_][O[OWW__O__O[_]Z_W;]:_?M[___[^W]^'@ '@A8 5
M!@ 2"""$! ?H "" 0@!" 0@$(2 X #@A! !X !'X& #*JJJH !__/X/Z?\
M/X. "L?__'_\__?_P_.#@ .#\'^'@ $P@ & !( ;^?_ X X!\ #__X __ /
M\ _ /P# ___^ , ?AX !, & 'U5557D%_][O[MWW^!O__KK_]Z_W+]B_?M[_
M__[^W]^'@ $PA8 5C@ 2"""$!#@8 "" 0@!" 0@$(2 X #@A! !X& 5\$
M@ <#__/\/[?\A( *@__]/_X_\/_!\X. X/X/X: L7\!8 ;<__ \ 8!\ ?C
M__X __ /\ _ !P! ___^ . /AH "Q?R 2"#@!S\B__>]];-]T?C__[^__;O
M]>_?AW]>___^_N_OAH "Q?R%@ C\ !($$(0$0 . "H( !" $(!" 01(#@ ."
M"" &@ (__X !! 2 " ?_]_R?C_Q_@X *@__]O_T_X7_A\X. \/X/X2 !/P)
M__X%@!L'_\#P!@'P'_O__@#_\ _P#X $#___X X ^$@ 3\"?_^@ %[@X <
M_G?_VO=V]???^__^_O_V;_;OOOA?7O___K[O[X2 !/P)__Z%@ CX !($$(0$
M0 . "H( !" $("!X01(#@ .""" $@ $#@P6 "(__^_X_E_Q_@X *S___/_^_
MZQ_I]X. YOX/X. H"?@P6 &XO_P/@& ? ?___^ /_P#_ /@ 0/___@#@
M#X. H"?@X !/X2 &X__UOO6[???___^LO_T[_1OM.>76O___N;O[X. H"?
M@X6 "'0 $@(0A 1 X *@@ $( 0@( >!$@. X((( . 7^$ 8 !?X6 !?/_
M#^?]A( *Q__\/_T_?VS1\X. \/\'X> ?X!@!5____^>__ ^ (!\!____X
M__ /\ \#@ = ___^ / 'AX !_H !'X. '/Y__][Z^IWV7____KK_]^_V[R"3
M+U[___Z^]_>'@ '^A8 ;A__2^@J%]%____Z"__0O]"^@ %2___^@O07B( !
M 8: !O/_G__\?X. "OO__+__?W:.>_.#@ .C_!^'@ 'X@ $!A( 1.__ _ (!
M\!____X __ /\ \#@ = ___^ / 'AX !^( !#X2 &S__WOUJA???___^AO_W
M;_2O*7&%7O___M[W]X> ?B%@!O'_]+]"H7T7____H+_]"_T+Z 5+___Z"
M]!>(@ $'AH %\_\OK_R'@ 5__/]]](6 X/^'X> :" 0>$@!&[_\#\ @'P
M'____@#_\ _P#P2"@ 3^ /@'AX !H( !!X2 &[__WOW:U?=?___^@O_TK_<O
M(@L DO___O[[]X> :"%@!O'_]+]"H7T7____H+_]"_T+Z( )+___Z"^A>(
M@ $'B( #G\_]A( *B___/_]_>?WW]X. ^?^#X: F@ @ $'A( 1F__ _@(!
M\!____X __ /\ \$@H $_@#X X: F@ @ $'A( ;G__2_NJU]E____[V__3O
M]*\G_@B:___^FOO[AH ": "%@!OG_]+^BH7T7____H+_]"_TKZ/\ )K___Z"
M^@N(@ $#AH &]_^7__Q_@X %V___?_Z#@ +L]X2 OX/A( $[4 ( ! X2
M$=O_P/X! ? ?___^ /_P#_ /!( &?__^ /@#A( $[4 ( ! X2 &]__VO[M
MA???___^IO_TK_4O0@/SF7___H+[^X2 !.U "%@!OG_]+^A87T7____H;_
M]"_U+T(#X)E___Z"^@N(@ (!^ . '#_ ,_'GU^_^ !O_ -?PW_[__^_?
M ?_S3X '@ (!^ . "!O / > >!( *\ / \ _ @< . _ #@ > @'X
M X ('\ >\)LMY%X#@!'"\ :O!B]2_!&K< @O&[@ >%@!OG_]+^@P7T7___
M_L+_]"_T+T+\$*E___Z"_0N( 8 !X . '#_ /_#5G^]^ !@_ ,/P[_U__Z
M__ ??S3X ' 8 !X . "!O / > >!( *\ / \ _\ @< . _ !@ <!
M@ '@ X ('\ 2\&IEY-X#@!'^\ ?O!2]J_]6I< BO&U@ >%@!OG_]+_0 7T
M7____M[_]*_T+V+_T*E___Z"_06(!8 </\ [\,N_[/X @&7\ T_#K_O__W_
M\ !^_/W@ <%@ @;P #P '@'@2 "O #P / /_ ' #@ /P 8 '!8 ('\ 6
M\'1%YUX#@!'J\ ;O!6]2_]))< AO$-@ >%@!OG_]+_0 7T7__]_NK_]"_T
M;T+_TDE___Z"_06(!8 </\ _\'S_[_X @'G\ ^_##_?__C]\ !S_''P <%
M@ @;P #P '@'@2 "O #P / /_ ' #@ /P < '!8 ('\ 2\",%Y%X#@!&:
M\ 1O!^]B_]=+< LO"]P >%@!OG_]+_H 7T7__]_IK_]&_U;T+_T4M___Z"
M_H6(!8 </\ [\';O[GX !@';\ \_#G^O__W_^ !__'_P <%@ @;P #P '@
M'@2 "O #P . ?_@ '@#@ /P , '!8 ('\ 6\"D5Y=X#@!&F\ 3O!:[5_^I)
M> @O""P >%@!OG_]+_H 7U7__Y_J;_]._U+M7_ZDE___Z"_H*(!8 </\ _
M\#YG[/X !@'S\ W_#?^_\#M]^ ![_&WP <%@ @;P #P '@'@2 "O #P .
M ? @$#@#@ /P , '!8 ('\ 2\!&=YUX#@!&.\ 8O!B[%\"S6N DO#*P >%
M@!OG_]+_T 7W7__Y_H[_]B_V+L7_[%:___Z2_H*(!8 </\ W\#O?[_X #@&+
M\ Y_#K_W\!M_^ )[_#GX <%@ @;P #P '@'@2 "O #P . ? $#@#@ /P
M & '!8 <'\ :\!0EY%X ! #V\ 6O!6Z-\ S4N DO!98 >%@!SG_]+_T 7T
M7__U_O;_]:_U;HW_[-2___:2_T%_AP6 '#_ -_ V[^[^ XAB_ /OPS_K_ 8
M?O@ ">_P]> '!8 6&\ \ !X!X " \ / X!\ 0. . _ 8 <%@!P?
MP!KP&17E7@ $(/;P!&\'+M7P#]6X "2\$M@!X6 '.?_TO_0%?1?__7^]O_T
M;_4NU?_N5;__]H+_07^'!8 </\ _\!RO[_X 'B'+\ Q_##^7\!U]> 9S_#[
MX <%@!8;P #P '@'@ ( #P \ #@'P 8 X #\ !@!P6 '!_ $O +5>1>
M P@MO 'KP?N[? *IM@ ++P16 'A8 <Y__2_^L%]%__[?ZV__>O]^[E_^JF
MW__FDO]!?X<%@!P_P#?P'=?O_@ V89/P##\,/R_@&O_X !G'\'7P!P6 %AO
M / > > !@ / #P , ^ "!@#@ /P # '!8 <'\ :\ HMY%X '&#N\ ?O
M!^W;X TJ6 NO JL >%@!SG_]+_Z@WT7__=_N[_]^_W[=O_[2I?_^::_ZB_
MAP6 '#_ /_ /M^U^ .9AP_ ,/PP^#^ ,?WP .?_P?_ '!8 6&\ \ !X!X
M & \ / @#X (' . _ , <%@!P?P!+P!$WFW@ \8+[P!^\'Z_O@!ZK<
M !""\""P!X6 '.?_TO_T3?;?_SW^OO_W[_?K^__WJM__UH+_H+^'!8 </\ [
M\ XG[/X#QN&!\!@?&!P/X P^/ !YG_!_^ <%@!83P #P '@'@ X !P <
M /@ @, X #\ X!P6 '!_ %O %W>=> /S@_W /]P_W^^ 'Z^P ,.+P(+@'
MA8 <[__6__5=]U_\_?[_?^_W[_?[__<K[_^VXO^@OX<%@!Q_P#_P!U_L?O\&
MX8'P&_\?_\?@##\< /&C\#;X!P6 %A/ / > > #@ ' P > # 0#
M@ /P !@'!8 <'\ 2\ *EY]X#_.#_< _[#__]X ?M] !@WO 96 >%@!SO_]+_
M^J7WWP/]_O]_[_OO__W_]^WW_V[>_]!?AP6 '/O /_ &!^S__ ?C ? __S__
M_^ </PX!L8/P/G@'!8 5(\ \ !X! > , ! !X $!( #\ 8!P6
M'+O $O #_>=0__WA_[ < 0 /> 'U?@ X/[P$=@'A8 <W__2__O]]U#__?W_
MO]P!P ]_^?5^?[N_O_1WX<%@!S[P#?P P?L?P 'X__P?/\ _S_ 'A^'_V&3
M\#M\!P6 "P/ / > '@ X$!@0& \ !@2 _ ' <%@!S[P!KP ?WG
MS__]X?X /\ _P# #_;^ <#N\!3<!X> #-K__?WWS__]_?X/@X. "\#_[_;^
M =[N_]1?AP6 ' / ,_ #!^PP ?G__ _P#_?\ __\'^8Z/P'_P'!8 < \
M\ !X > !\ #_ /]_P ' " / # <%@!P#P![P ?WG___]X@'P /\
M_W_ ?=__\+>\ @L!X> "MK__?WW___]^@&'@ G!]W__WM[_Z"^'!8 < \ _
M\ ,'[ #__\?^ '_@?__P '_< #'@_ ;/ <%@!P#P #P '@ !X!_X ?^!
M___ , 8 \ ,!P6 ' / $O !_>?___G@'_@!_X'__\ &S__AO[P#.P'
MAX )TO_]_??___G@B( )_AN__[[^_^QOAP6 ' ? ,_ !A^P ?__@'_@!_\'_
M_^ _SX#CX/P#_X'!8 <!\ \ !X !^ ?^ '_P?__X #A . / #@<%
M@!P'P![P /WG__P'X!_X ?_!___@ .$/_P[^\ 0N!X> "-[__OWW__P'BH (
MX<__?O[_]"^'!8 <#X _\ &'[ ___^ __ /_X___X '_O_\?@_ .W@<%@!P/
M@ #P '@ /_X#_\ __C___@ ?^P !X \ &!P6 ' ^ $O _>?_@__@/_P#
M_^/__^ !_['\'O[P!38'AX 'TO_^_??_@XR !_'\_O[_]#>'!8 &#X S\ #'
MA( 2X#__!\ /P ?^?__\#\ Q^!P6 ' ^ / > ?__@/_\'P _ !
M_YX#^ #P 8'!8 <#X >\ !][_!__^ __P? #\ '_G@/Y_O 'E@>'@ ?6
M__]][_!_C( '_@/Y_O_WEX<'@ 0W\ #'A( #X'_@!H ) _^/__\!\ 9?!PB
M"O > /___@?^ &@ D#_X__\ !P <'!X +&O ?>P/___@?^ &@ D#_X__
M]_]P [<'AX &VO__?>P/CX %]_]_^[>'!X %,_ 9_R#@ +A\ B "!_'___!
M\ :O!PB !/ <"#@ +A\ B "!_'_^ < #!P> !1[P #W @X "X? (@ @?
MQ__@_W #6P>'@ 7>__^]PY" !>#_?_M;AP> !3/P '_@@X !@ F " 'C__CY
M\ 8/!PB !/ <"#@ & "8 ( >/_^ P ,'!X %'O .<"#@ & "8 ( >/_
M^ >P _L'AX %WO__N=^1@ 0'O_O[AP> "#/P #_@___ #(& !O ?\ 8O@ 8(
M@ ?P ?@___ #(& !O 0$ #@ 8'@ @>\ 'X/__P R!@ ;P$% #VX &AX $
MWO__QY* !/!?^]N'!X '8? #^'_^ V !Q_ ?_ &!X &"( &< /X?_X#8 '
M'\!_@ !@ 8'@ <_< /X?_X#8 ''\!_@ /]@ :'@ *_?Y6 X_[_8<'@ 9@
M\ /X?\0@8 $^ P'@ 8(@ 40 _A_Q"!@ 3X & !@> !C^0 _A_Q"!@ 3X
M!_V !H> K^?EH "]_V'!X &8'@ !^/ #X & ?_X?P? !@J P?CP ^ !@'_
M^ !P 8'@ 8_X 'X\ /@ 8!__@/_< &AX "O^>6@ */_8<'@ 7!_ 'XA&
M!0_\#\/ !@J @?B$8 %#_P , &!X %?^ !^(1@ 4/_ #^P :'@ )_XY:
M O#^AP> !<_P . $H $_@#[P 8(@ 00 . $H $_@ P 8'@ 5^$ #@!*
M!/X /L &AX "?A^7@ $^AP: P&_^!6 ! < ?^ &!X " ?@5@ 0' $!@!@>
M O'X%8 $!P!'8 :&@ +^\9B L=_A@: P/W_A>!@ '@!@> @?^%X "^" &
M!H # <?^%X "^: &AH "_<^8@ +YOX8&@ 0'Q_^ %8 #!__@!@> P?_@!6
M @?^!P: ! ('_X 5@ ('_@>&@ +Z/YB OX?A@: ! X/_\ 6@8 !\ 8'@ ,/
M_\ 6@8 !P 8'@ ,/_\ 6@8 !P :&@ 'QFH !SX8'@ (/_A> @_P!@> @_^
M%X "#_ &!X "#_X7@ (/\ :H!X "'^ 7@ (#^ 8'@ (?X!> @/X!@> A_@
M%X " _@&J > 3\9@ %\!@> 3\9@ %\!@> 3\9@ %\!J@'@ %\&8 !'@8'
M@ %\&8 !'@8'@ %\&8 !'@:H!X !X!F 0,&!X !X!F 0,&!X !X!F 0,&
MJ"@H'8 !. JH*"@<@ (!_@JH"X "'X #@ (#P!8+@ '\!( " \ %@ '\$ N
M > $@ (#P 6 ?P$@ (#_PJ+@ +\?X. OP_E@N A^ X "#/ 6"H " _P$
M@ (/\ 2 @'^$ J @/@!( "#_ $@ (#_P2 P/_@ F+@ +\?X. O /E@N
M A_ X "&?@6"H "!_P$@ (?^ 6 ?P0"H "!^ $@ (?^ 2 P?_@ . P?_
M@ F+@ +\/X. N 'E@J P?^0 . A/X%@J @_@!( "'_@%@ '\!8 !_ H*
M@ $(!8 "'_@$@ ,'_X #@ ,'_X )BX "X;^#@ +@!Y8*@ ('_@2 B?\%@J
M A_@!( "/_P$@ (!_@6 ?P*"H !& 6 C_\!( #!_^ X #!_^ "8N >&$
M@ + Y8*@ (/_ 2 B_\%@J A_P!( "/_P$@ (!_@2 @'^"@J 1 %@ (_
M_ 2 P?_@ . P?_@ F+@ 'SA( "P .%@ $SA8 !,XH*@ (/_ 2 C_\!8 !
M9 6 :@*"H "/_@$@ (__ 2 P??@ . @'>"@J C?@!( "/_P$@ ,'WX #
M@ ,'WX )BX !^X2 L #A8 !=X6 ;N*"H "'_P$@ (YG 6 2 %@ $@"@J
M C_X!( ".9P$@ (#WP2 @'>"@J B?P!( "/_P$@ ,#WX #@ ,'WX )BX !
M^X2 L #E@J AZ\!( "/_P%@ $@!8 !( H*@ (^N 2 C_\!( " ]\$@ (!
MW@H*@ (O\ 2 C_\!( " ]\$@ ,'WX )BX !^X2 L9CE@J AU<!( "/=P6
M"H "/5@$@ (__ 2 @'^!( " ?X*"H "+_ $@ (SK 2 @'_!( #'__@"8N
M ?N$@ +.<Y8*@ (>O 2 AB(!8 !> 6 7@*"H "/K@$@ (?^ 2 @&&!( "
M 88*"H "+_ $@ (7> 2 @&'!( #/X?@"8N ?N$@ +O]X6 8>%@ &'B@J
M A_\!( "*!06"H "/_@$@ (O] 6 ?P%@ '\"@J BO0!( "+_0%@ '^!( #
M/__P"8N ?N$@ +7ZY8*@ ([W 2 @O0!( # P. X $ 08 < @*@ (_^ 2
M @PP!( # P. !( #? !P" J @PP!( "## %@ '\!( $/OWP< B+@ '[A( "
M_#^*@ /X_'^)"H ".]P$@ (($ 2 ! >'P#@#@ -^#_@("H "/#@$@ (/\ 2
M! >'@#@#@ -\#_@("H "## $@ (/\ 6 "7@ . /_W_^ B*@ +\.XR ;^#
M@ /X_'^)"H "/#P$@ (,, 2 "@__X/P 0$#_X("H "/_ $@ (/\ 2 ! O_
M@/P$@ (/_@@*@ (+T 2 @_P!X '_ ._O__@B+@ 'SBH #^_^?@X "^'B*
M"H 6/_\/_ !^ !^ '__]_@ '@#__@@*@!8_\P_\ '__X'X 8 W^
M 8 _^" J "@PS#_P ?__@?@$@ @-_@ ?\/_@B+@ 'S@X $_@?@?X.
M _@ #X. _@!#XD*@ T__[_^ #__X?\ _@P* !#\!__\("H 6/^.__@ '
M___G_ ,_\'_P . /_P@*@ H'X[_^ ?__^?\!( "!_\#@ /^#_\(BX !
MXX. !/@'X!^#@ /S_P>#@ /X @^)"H !/X,!@ @"__]O_ ?X,"@ 1_P___
M" J %C@'__\ !O__;_P &/_!_\ & !_\("X ) ___ ;__V_\!( "!_\#
M@ ,\!_\(BX !YX. !/D#P)^#@ /C_P>#@ /@ >)"H !#X. "8 #?_[__
M^X,"A @)@!<!__Q__X /?_[__ R?X#_P Q^0#_P@)@!$!\ !__X /?_[_
M_ @ #_P. Q@#_PB+@ C\?___\( !#X. \O^ X. \?\ XD*@ 'G@X 2
M@ >__?_\ #Z___^ #_\___" F %P/_^#__@ ^__?_\ #8_@'^ #/X /_
M" F $0,8 #__@ ^__?_\ # '^ X #% /_"(N "/@____P0 (/@X #V_X!
M@X #S_0#B0F %P'G'__[@ ??^__\ 'Z___X '_\__^" F %P?_X!_[@ _?
M^__\ ' _$'X '/X '^" F $088X!_[@ _?^__\ # $'X X #% '^"(N
M". ?___P( 0/@X #P_Q!@X #S_0!B0F %P/P'__Q@ >O=?_X '#/^/@ ![
M]_G\" F %P__X _Q@ ^O]?_X ' ''W@ '; .?\" F %PP/X _Q@ ^O]?_X
M # 'W@ &8]^?\"(N #N /___QT N/___YPQQ]@X #W_?GB0F %P_\/__@
M _7<__X 8_W_'X C /'\" F %P__P _@ _7\__X ' #'_X 'C /_\
M" J %@/ #^ #]?S__@ !__@?_@ > __P(BX (P ____'H#X^$@ +L?X0!
MB@F 0^#@!/ _7\__P "'_/\ #D//\" F %P__^@_ _7\__P #@
M#'_\ ##@/_\" J %D "#\ #]?S__ ./@?_P ,!W__P(BX (^@____'H
M#X^#@ +[[(6 ?>*"8 7",?_'^ , ##\ +___P 'R__P("8 +#__[
M[^ #\ #_\ #@ D(?_P '@__P("8 7!_@#[^ #\ #_\ , ?_P (5
M__P(BX "^^^)@ /[SW^$@ 'UB@J %L__#^ "/'#^ +___@ (1__@(
M"8 +#__C_^ #R/'_^ $@ A_^ @'_^ @)@!</\ /_X /(\?_X P!_
M^ ?;_^ B+@ 'CA( "_#^$@ /[?'^$@ 'WB@F "P''_X_@ G[X_@ X*
M!_@ /S__@("8 +#__C_^ #B?O_^ #@ E\?_@ /@__@("8 1#_@#_^
M#B?O_^ , ?_@#@ ,4__@(BX !XX2 O@?A8 "?'^$@ 'TB@> #3@ __
MG^/ ?O_^ #@H '^ _/_^ @'@!H@ 8_Z__CP 7[__@ #_'_X #
MX/_X' <'@!,&' 8P __@ 7[__@ # '_X X #%/_X"(N !^O__#__Z!>%
M@ +\?X2 !/3___>'!X -. '___[_ ]__X ."@ ?X #\__X" > &B
M #_C_^_P #O?_^ /\/_@ /@?_C\!P> $P<\ " #_^ #O?_^ ,
M/_@#@ ,4?_@(BX 'X__QC__$(X6 OP_A( $]'__(X<'@ 0X /@X &^ ,
M/__ X* !_@ 'S__@(!X :( ?^O___@ /#__P !_P_^ _!_^_P'
M!X 9!_P < /_X /#__P !P _^ @Q_^ B+@ ?K_^!'_\/#A8 "_#^$
M@ 3\?_PGAP> &3 #__\]_X !O[^\ '__[@ '__S@(!X :( ?^/S
MW_@ ._O[P #_X?N _P_/_P'!X 9#_P 0 /SP ._O[P\ #@ ?O^
M @ _. B+@ ?C_^!'_\6'A8 "_A^$@ 3\/_@?AP> &3 #__\]WX ?[^\
M ?__S@( '__B (!X :( __WSW_@ )_O[P #_\/. @ !_X>/_ '!X 9
M#_P P 'SP@ )_O[S_ " //_@ !@ >( B+@ ?]_^H7_]F'AH !#X2 !/X?
MX!^'!X 9, ?__YV)@ '[?YQ40 "__^)P0 __^( @'@!H@ '_\?G?^ _
MM_G ! ?_PX@! /_PX__ <&@!H(#_P1@ 'YQV /[?YVKP % ../P # .
M( B+@ ?Q_^=G_\/+AH !#X6 P_@/X<&@ </ !?__X X /?[_P$]( '__\
M#@( !__^"0: &P$ ?_^G@?^ #_O_ @ __X0 @ ?_X8__ <'@H 6]H
M>!_X /^_\"PN " !#'^ !@ !@F+@ +Z?X. @/ AH !AX6 X?!^X<&@!D/
M__P#___X 0 _[_P#!$ +__\& $ #___"0: &P& ___+@?_ '_O_ 0!_
M_\0 0!__\$__ <(@!<#_ .!F< ?^_\'/O % !&?_ ' 0F+@ C\O_N_
M_@/ ?X6 <>%@ /!P:.'!H 9!\ !?__\ -$ ?\_\$ %___ @#___PD&
M@ T!P ?__T0'_P!_S_P X +?__H " ___PO_T'!X :/__Z 0&MP!_S_P
M/_\ ( __^ P @ $'BX (_1____X#P'^%@ 'KA8 #\, #AP> "#?\!___
M ")$!( %0 " !_\$@ 4/_^" 0<'@ @P ?__P ?^ 2 #A_X@ ?_ !_X __
MX/__!P> 7@%@ (]N 2 ";__@ ?__@ . L [!Y^ D ZAP> DSD!( "
M 8(&@ & !8 &0 /@ "$!P> 4 %@ (^?@2 S_\@ . "#_\0 /@'_^!P:
M P'S& 2 CY^!( )\\^ !\\_ X "7WH'AX "_.>6@ +1QX<'@ *Q* 6
M 0($@ ,-,( #@ ,-,$ #@ (@0 <'@ *MS 2 C_^!( #/_R X #/_Q X "
M<<8'!X "[]P$@ (__@2 ">RW@ >RWP . ENN!X> OWOEH "\<>'!X "
M4" $@ (GY 2 P(@@ . T(@0 2 40'!X "3]P$@ (X' 2 S_<@ . S_<
M0 . G_^!P> N_<!( ".!P$@ G]WX &]W\ #@ )_N@>-@ +X'YD'@ &P
M!8 ", P$@ ."@( #@ /"@$ #@ )@!@<'@ *O_ 2 B_T!( #/_R X #/_Q
M X "?_X'!H # >_\!( "+_0$@ E__X $__\ #@ )__@>?@ *__8<'@ ,1
M! P#@ 0,, #@!( '@ L 0 . !# D X%!X ##O@, X )>]X X '_B
M X #/_Q X $/]P #@4'@ ,N^ P#@ ][W@#@ #__X $__\ #@ 0OW .
M!8> ?Z8@ '?AP> "ACP#A@ &?D _@#@ <!@ L/"!( $$>P /@4'@ H'
M" X8 &?^X/X X " 8 #@ )\/@2 !!X< #X%!X 5!P@.& !__^#^ ?_^
M !?#_P X $'A0 /@6(@ $/D( "_#^$@ +^'X<'@!0, ]\ &#R ?X !#
MR8'\ +'X@2 !!@,!'X%!X * _ /? "?_?G^ . !P&!_ >!X$@ 0?_ 1^
M!0> %0/P#WP ___Y_@ #PW@?P 7@?\ . !!?\!'X%DX "_#^$@ +X'XT'
M@!P&( ?^ (!D _\ "@P/\ +%8@/P ,/ S^!0> ' ' !_X !?_O[_P
M :C _P 'U^ _ _\#/X%!X < < '_@ '___O_ /K\#_ !?7_S\
M"]P,_@63@ +^OX2 OU_C0: !0'__ __ X 5@ _\ @0 !_^ +CQ _X .
M< _\!0: !P'V( __ ^#@!/\ _!P__^ #\/$_X __ _\!0> ' 8CC_\
M#_]___P !^__[_X #?P___@ 6@#_P%F8 "_#^$@ +'XX<&@!T#__P?_P "
M !/^ $ 0'_@ D P'_ #_ /_ 4&@ <##R ?_P /@X 3^ ?X ?__@ (
M'_Q/_ __\/_ 4'@!P&(]__ W__[_X !_O__O^ ]____\ #'XP_\!9^
M L?CAP: '0?__!__ $ @(?X 0# /^ "8& /\ #P!_\!0: !P8#P!__
M !^#@!/X #_P#__^ #P?^._\ '__Y_\!0> # /#__\ 'O]_?_@ /X. #?X
M/W____P </#G_P%GX "Q^.'!H =#_ #_X ,@+!_@ 0 0X _X 0!_P _P
M / ?_@%!H 9# #_X '_?W__@ ?_P___X ?A_P__P 8. ?@%!X <#___
M_@ ?M_7_^ ____]_@ _[__]_ !P /_^ 6?@ + 'X<&@!</^ /_X P4,'
M\ @>!A_@ #^ !_ 2 C_X!0: !PP __@!^#@ /P '^#@ G^ 'X/X'_\
M .#@ 'X!0> 0>#@!B '_Z___ ?W__G_X ?_?___P \ #__@%GX "P!^'
M!H =#_P"#__@$>(G#\ !X P?P C_@0?P % */_H%!H '"$ "#__@'X.
M#\ ?7____P ?C@ ?_P X. ?H%!X !0X. &. .W=OWP !X?_\__ !]P!^_
M_ #T O_^@6?@ +0'X<&@!T/]@,/^> 3\ ^?X #@ '!_ #_^'!_ \ \?
M_@4'@ ;P P_YX!^#@ /@ '^#@ G\ '_X ?_\ >#@ '^!0> ',G___G@#>_W
M;^ ??__O_P ?< ?O_P !_ /__X%GX "\#^'!H =#_,#C_@ ?"/W^ > #
M@?P !__CX?P / /'_X%!H ' ? #C_@ #X. #^ ?_OO__P ?_@#__P !X.
M ?X%!H = <S___@ #^]WK^ ?]____P >< ?G_P !_ /__X%GX "\#^'!H =
M#_&#C_@ ? /C_ &? #D_@ 0?_C@_@ _ /W_@%!H ' ? #C_@ #X. #_
M/^____@ ?_@#__@ !X. ?@%!H ' <Y___@ #X. $_ )\__[_@ /\ ?_?@
M!? /O_@%GX "\#^'!X <L,,/\ !X.>/\ 0__D/^ !_^.#^ T \?X 4&
M@!T/L /_\ /X ?_\ ?X '_^ _^ /_^ 'W___X 4&@!T/CS__\ /_Q__
M\ /@ ?W^ _P!__^ 'T __X 6?@ +P?X<'@!8P<X_P # XP?P #_\0_X
M '_XX?X X #!Q_ !0: '0XP __P !_ __P _@ ?_X !_X __X <?___
M!0: '0X/C__P !__'__P ^ #__X !_ '__X < !__ !9^ >&(!X 6,#^/
M\ !P..'\ __,/^ !_^./^ . P,_P 4&@!T., /_\ ?X ?_\ /\ /_
M^ /^ /_^ #/___P 4&@!T.#\/_\ ?_Q__\ /P __^ /P!__^ # /_
MP 6?@ '#B > !# ?__ #@ \#A^ #_CG^ #_C_^ #@ .#_< %!X <, /_
M\ >, __X #. /_X . /_X /__]P 4'@! /X__P !X____@ , '__@
M X #'__@ X #@_W !9^ <>(!X $, /]\ . %0./P /^/_X /^/_X
M </YP 4'@!PP _WP XX'__ X __@ X __@ ___G !0> "@___?
M#C___\ #@ ,?_^ #@ D?_^ '#^< %GX !QX@'@ 00!_G X 5!__ ?
MX__ _X__ !P_' !0> '! '^< #Y__\ #@'_\ #@#_\ #__
M\< %!X 0#__YP /_O_P (!__P . "1__P </QP 6?@ ''B > '!_[
M\< "&'\\ /#\< /#_< '#\\ %!X <'_OQP /__SP /__Q
MP /__]P /__SP 4'@!P/__' ?^_/ ___' ___W !P_/
M!9^ <>(!X <$<)QP (8?SP \/QP \/YP </SP 4'@!P1PG'
M ___/ ___' ___G ___/ !0> ' __\< !_[\\ #__\<
M #__^< '#\\ %GX !QX@'@!SYP!A #P_' #P_# #P_# !
MP_& !0> ' ' &$ #__\< #__\, #__\, #__\8 %!X <!__X0
M/__QP /__PP /__PP </Q@ 6?@ ''B : ! '!@X@#@ D+$/& !
M@'@#@ ,!@'@#@ -#@_ &!H $ <& " .!@ X_\8 ?^_^ ?^_^ . S^=
M\ 8'@ ,_O'@#@ _W+_& '_O_@ '_O_@#@ ,[C? &J : ! &! X@#@ ,G
M!' #@ .I%3@#@ .I%3@#@ .C!> &!H 6 8$ " ?\?\ _]_^ _]_
M^ . U\:X 8'@!5_/'@ '?&_ -7:O@ -7:O@#@ -;"N &J : ! &!
M!^ #@ .G!7 #@ .I%3 #@ .I%3 #@ ,& . &!H " 8$$@! !_Q_P #_W_P
M #_W_P X #_A_@!@> %7\X$ 5\:\ U=J\ U=J\ . _X?X :H
M #_ B@H**@/@ '@#H " > (#X !X Z @_@" ^ > .@ (/^ B>@ +P!X@.
M@ (!\ . 3X*@ (#P @.@ (!\ Z C_ " Z @'P X " ? )@ (_\ B>@ +
M#X@.@ (!\ . 7 *@ (/P @.@ (!\ Z G_ " Z @'P X "#_@)@ )_X B>
M@ * 'X@.@ ("X . 6 *@ %_"0Z @+@#H$)#H " ^ #@ (?^ F!@ '@")X!
M@ $?B B R 0 . C^@ X !8 6 ?P$@ %^"0Z C^@"8 !_ . @'^"0B
M R 0 . C_@ X "'_@(@ ,!_^ (F8 ! X. _X 'X@(@ -@ & #@8 !P .
M 6 $@ ,'_X #@0D.@8 !P B !P?_@ ?\)"( #8 !@ X& < #@ (?^ B
M P'_P B8@ CX '____X /X@(@ AP & '_P . 6 $@ ,.+\ #@8 !@ @-
M@ ,!_\ (@ @.+\ /_@ @(@ AP & '_P . A_X"( # __ "(J 7^-
M@ CP #____Q^/X@(@ H__N /_X !@X +_@ $/_@ !_X (#8 # __@
M"( ($/_@ #_X ("( (/X;@ #_^ -@ ,#_\ (B( "O@:.@ C@ !____Q_
M/X@(@ A__^ ?_\ B "!?NX >N " J !B ?_\ B "!?NX ^N
M" B "G\#X !__P .$!X # __ "(B _P#WXV ". '____/\_B B "#__
MP !__P"( (/__P !U8 ("H &0 !__P"( (/__P #U8 ("( */@'
M '__ 8. ?X'@ ,#_\ (B( #^ &_C8 (P /___\_S^("( "#_\#@ @.
M ' '__P. ""@ \ >N " V P__\ . A;1 X (+__P #ZX ("( !
M# 2 P__\ 2 0$#@ ('_P. P/_P B(@ +P (B _X6T8. ",?_#____/\_
MB B @__ X (# P !XQX#@ AQ2G '_@ @-@ ,/__ #@ )_^@. "'XQ
M\ _^ " B 0@$@ ,/__ #@ (<X@. " __@ [W "(B O B( #_F,;
M@X (CWN/___\_S^("( "#_\#@ ,,!# #@ +)0@. "'*U$ [V " V P\<
M< .!@ '^ X (?)30 #_X ("( !# 2 P_[\ . C[^ X (#^_ #P\ (
MB( "\ ")@ +K7X. "(ZUS____/\_B B @__ X ## 0P!( !@@. "E 0,
M [V & &#8 ##__P X& ?X#@ I?__ /#@ !@!@V P_[\ .!@ %^ X *
M#^_ #P\ 8 :(@ +X 8Z "(__S____,,_B B @__ X ## P!( ! @.
M"I@(< \. #_P&#8 ##__P X& ?X#@ J?__ /_@ _\!@V P__\ .!
M@ '^ X *!_> #O< /_ :8@ @'_X____S_/X@(@ (((0. P0 ( . #PA$
M8 N !P #_[#__@8(@ (&<@. P?_X . #W>\8 O__P #_[#__@8(
M@ ('W@. P?_X . #W>\8 !_^ #P_#__@:(@ +^<XF O>_@X (!_^/
M___\_S^("( ""#$#@ ,"'$ #@ ]'B?P8 ;1X\ _\[__X&"( "!_X#@ ,#
MX\ #@ ]X>?P8 ;>'\ _\[__X&"( "!\X#@ ,#X\ #@ =X>?P8 .' X %
M __[__X&CH !XX2 #?A____^ X</___\?C^("8 !$ . P, P . #V 9_GP#
M?C'P #@'___@8(@ (/_P. P/_P . #W_Y_GP#?\_P #@'___@8(@ (/
M[P. P/_P . !W_Y_GP \\#@ $#@X !_@:7@ G\ \\/___\ #^("( "" $#
M@!4#@< ? P,?_^ O\#Y_ ,'/_\(&"( "#_\#@!4#_\ ? _\?_^ L'^
M)_ #\'/_\(&"( "#_\#@!$#_\ ? _\?_^ '^!_ #X. <(&EX )_#__
MW___\ /B B !03B ( !@X #OX #@X ,_@<Y_X/_ Y_@__ !@B "P<> (
M 'X /X #@X ,_@<!_@/_ #__@__ !@B !0<> ( !@X .OX #\#__@#'_G__
M #^#@ ' !HF #Q____X ?@!___P/P/__^(6 \ X@(@ 4&9@& (2 $=@%
MG_G__@XX_X'_ !Y\ ?^ !@B "P>> 8 #P _]@'@X ,_@X _ '_ '[^ ?^
M!@B !0>> 8 A( -V /P'_^ <?\?_\ ?X. 8 &B8 !GX,!@ H\ /__^ _
M?__QA8 #@ !B B !0,/ X A( 1^ ^?^?_^,C\"@?^ /P !_X &"( + _\#
M@ " '_^ ^#@ S^,P _^ ?WP!_X &"( 6 _\#@ !___[_^ '@#_^ <#]
M?_^ ?X. 8 &C8 +@ !___P!X __\&%@ . &("( : ?CC@ ?__C_^ /_
M_S_^)@.'@?^ ?X _X &"( +!__C@ #@ ?_^ ^#@ S^)T$$#_^ _X _X &
M"( 5!__C@ #G_^?_^ P /_^ ?QX?_^ A( !@ :(@ +Y^(. "^ !____
M___!A0.("( 9 ?A[X ?__C_X "[/!_^/@// ?^ __\ _@<(@ L/__O@ .
M!__@'X. "_X_P@@'_X#__P#^!PB %0__^^ X__'_^ ? /__@'\,/__@(.
M ?X'B( (\?A____@ ># 8 $ ___P84#B F &/ _^ ?__C_P #_-!_^>@//
M ?^ __X _ <(@ L____X .0 )__ 'X. "_Y[X ?_X#__@#\!PB %3____@
MY__G_\ ? /__@'\,/__@(. ?P'B( (P/ ____D "># 8 $ ___@84#B B
M&7 '__PG! Y_\ #Y_\?_]X;SV'_@!_^,/X'"( %0_P?__"$@ + 'X2 "M_X
M '__@/_^-_X'"( !#X. $?!O__;_P!\ ___@>PP__^ @X !_@>(@ +P (.
M _P /X,!@ 0#__^AA8 #^ WB B &? #__@GBBY_\ #YO\?_\X;CF'_@!/\
M./X'"( %@?@/_^"$@ + 'X2 "L_X '__@//\/_X'"( !#X. %>!O__;_P!\
M ___@>1Q__^ \____@>(@ +P (. _P /X,!@ 4#__^Q]X2 _P /X@'@!H!
M\ G_P ,1##_@ .?SQ__GCP \?^ _YX_P<)@ 3P!_\ A( "@!^$@ J?_ #_
M_X#C_G__!PB !0__W_\ A( (@!\ ___@<>#@ * XX,'B( "\ "#@ /\ #^#
M 8 % ___X>>$@ /\ '^(!X : _@!V_\ #((P_X !F<X?\^8?_^'_@ !\?/\'
M"( %. '#_P"$@ * 'X. "_/G_@'__X#!_'__!PB !3__Y_\ A( -@!\ __S
MX>X!__^ P8,'B( "^ &#@ /\ #^# 8 % ___^>^$@ /^ '^(!X : _P#^_X
M#1%P_X #^?\?\8P^ ?'_ #^?_X'"( %? /C_@"$@ * 'X. "_&-_@'__P !
M_G_^!PB !7__Y_X A( (@!\ __Q@<># 8 $ ?___@>(@ +\ X. _P /X,!
M@ 4#___SYX2 _X ?X@'@!H#_ /__@ . +#_@ /_]Q_P #ZD\?P 'P_[@<(
M@ 5\ ^/^ (2 H ?@X +\ '^ /_\ '\/^X'"( %?__C_@"$@!" 'X '__ !
M]UO__ !___N!XB OP#@X #_ _@X "@ >#@ 'WA( #_@ _B B !@__P_X
M X,"@ Y@!__@ #7^__@ /Z_[@<'@ 4#R!'__@. C__ X -!__@ #0 __@
M _Z_[@<'@!H#R '__@ #@#__ ?___@ 8!__@ ___[@>)@ 'O@X #_ _
MB( !SX2 _P /X@)@!@XP_P ____@ 8 ?_X '___X '^/\P'!X % \ X
M__P#@ (__@. #0?_X $ /_X /^/\P'!X : \_'__P X(__@ '___X $
M /_X /__\P'B8 !QX. _P /XV _P /X@)@!@8X_@ ]___@ 8 ?_P #
MMW_X #^O\ '!X % X 8__@#@ (__@. #0?_P ,'_X ?^O\ '!X : X_G
M__@ Z(__@ '___P $>/_X ?__\ 'B8 !YX. _P@/XV _@ /X@(@!@/
MQ__P /?_YP #,'YX ![-^. #_C\("( 8" #_\ '#^< !##^> P
M?C@ !_X_" F %SC_\ #OC^< !/_^> !\_C@ !___"(V _P\/XV _@
M/X@(@!@/S__P /__YP ,'YX ![M^> #_]\("( 8" #_\ '#^< !_
M_^> X?G@ #__?" F %S#_\ #GC^< !__^> !\_G@ #___"(V _P<
M/XV _ 'X@(@!D/___ /__YP ,'XX !7A^> '_Q^ !PF &&#_P
M'#^< !__^. +Y?G@ '_\?@ <)@!A@_\ YX_G ?__C@ "__YX !__
M_X 'C8 #_!P_C8 #X ?B B "#___P '___ X # P#@ X (<'XP !?_I\ '
M"8 "\#\#@!,\!P ___X !W/^, !__Z? !PF &/ _ ?__\ /__^
M ?W_C ?___P >-@ /@/ >-@ . >("( (?\_\ ?\_\#@ ,# . #@ A@
M'@ /__+P <)@ + ' . $S ' #___@ ?Y_X /__R\ '"8 4P!P !_S
M_P ___X '^?^ "#@ ' !XV ^ \!XT"@ $#B B "'_'_ '_'_ X #
M#@#@ X '8 X %__T0@(@ ,!P!P#@!)P!P _X_X /^?^ /__]$("( 5
M < < ?\?\ /^/^ #_G_@ #@PB-@ /@?@>,@ 3\ !B!V W__\ @=
4@ -___ ('8 #?__P")V X #X@
end

1236
outdated/win/gem/wingem.c Normal file

File diff suppressed because it is too large Load Diff

3294
outdated/win/gem/wingem1.c Normal file

File diff suppressed because it is too large Load Diff

184
outdated/win/gem/xpm2img.c Normal file
View File

@@ -0,0 +1,184 @@
/* NetHack 3.6 xpm2img.c $NHDT-Date: 1432512809 2015/05/25 00:13:29 $ $NHDT-Branch: master $:$NHDT-Revision: 1.7 $ */
/* Copyright (c) Christian Bressler 2002 */
/* NetHack may be freely redistributed. See license for details. */
/* This is mainly a reworked tile2bmp.c + xpm2iff.c -- Marvin */
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "bitmfile.h"
#define TRUE 1
#define FALSE 0
void get_color(unsigned int colind, struct RGB *rgb);
void get_pixel(int x, int y, unsigned int *colind);
char *xpmgetline();
unsigned int **Bild_daten;
/* translation table from xpm characters to RGB and colormap slots */
struct Ttable {
char flag;
struct RGB col;
int slot; /* output colortable index */
} ttable[256];
struct RGB *ColorMap;
int num_colors = 0;
int width = 0, height = 0;
int initflag;
FILE *fp;
int
main(argc, argv)
int argc;
char *argv[];
{
int i;
int row, col, planeno;
int farben, planes;
if (argc != 3) {
fprintf(stderr, "usage: tile2img infile.xpm outfile.img\n");
exit(EXIT_FAILURE);
}
initflag = 0;
fp = fopen(argv[2], "wb");
if (!fp) {
printf("Error creating IMG-file %s, aborting.\n", argv[2]);
exit(EXIT_FAILURE);
}
fclose(fp);
if (fopen_xpm_file(argv[1], "r") != TRUE) {
printf("Error reading xpm-file %s, aborting.\n", argv[1]);
exit(EXIT_FAILURE);
}
Bild_daten =
(unsigned int **) malloc((long) height * sizeof(unsigned int *));
for (i = 0; i < height; i++)
Bild_daten[i] =
(unsigned int *) malloc((long) width * sizeof(unsigned int));
for (row = 0; row < height; row++) {
char *xb = xpmgetline();
int plane_offset;
if (xb == 0) {
printf("Error to few lines in xpm-file %s, aborting.\n", argv[1]);
exit(EXIT_FAILURE);
}
for (col = 0; col < width; col++) {
int color = xb[col];
if (!ttable[color].flag)
fprintf(stderr, "Bad image data\n");
Bild_daten[row][col] = ttable[color].slot;
}
}
if (num_colors > 256) {
fprintf(stderr, "ERROR: zuviele Farben\n");
exit(EXIT_FAILURE);
} else if (num_colors > 16) {
farben = 256;
planes = 8;
} else if (num_colors > 2) {
farben = 16;
planes = 4;
} else {
farben = 2;
planes = 1;
}
bitmap_to_file(XIMG, width, height, 372, 372, planes, farben, argv[2],
get_color, get_pixel);
exit(EXIT_SUCCESS);
/*NOTREACHED*/
return 0;
}
void
get_color(unsigned int colind, struct RGB *rgb)
{
rgb->r = (1000L * (long) ColorMap[colind].r) / 0xFF;
rgb->g = (1000L * (long) ColorMap[colind].g) / 0xFF;
rgb->b = (1000L * (long) ColorMap[colind].b) / 0xFF;
}
void
get_pixel(int x, int y, unsigned int *colind)
{
*colind = Bild_daten[y][x];
}
FILE *xpmfh = 0;
char initbuf[200];
char *xpmbuf = initbuf;
/* version 1. Reads the raw xpm file, NOT the compiled version. This is
* not a particularly good idea but I don't have time to do the right thing
* at this point, even if I was absolutely sure what that was. */
fopen_xpm_file(const char *fn, const char *mode)
{
int temp;
char *xb;
if (strcmp(mode, "r"))
return FALSE; /* no choice now */
if (xpmfh)
return FALSE; /* one file at a time */
xpmfh = fopen(fn, mode);
if (!xpmfh)
return FALSE; /* I'm hard to please */
/* read the header */
xb = xpmgetline();
if (xb == 0)
return FALSE;
if (4 != sscanf(xb, "%d %d %d %d", &width, &height, &num_colors, &temp))
return FALSE; /* bad header */
/* replace the original buffer with one big enough for
* the real data
*/
/* XXX */
xpmbuf = malloc(width * 2);
if (!xpmbuf) {
fprintf(stderr, "ERROR: Can't allocate line buffer\n");
exit(1);
}
if (temp != 1)
return FALSE; /* limitation of this code */
{
/* read the colormap and translation table */
int ccount = -1;
ColorMap =
(struct RGB *) malloc((long) num_colors * sizeof(struct RGB));
while (ccount++ < (num_colors - 1)) {
char index;
int r, g, b;
xb = xpmgetline();
if (xb == 0)
return FALSE;
if (4 != sscanf(xb, "%c c #%2x%2x%2x", &index, &r, &g, &b)) {
fprintf(stderr, "Bad color entry: %s\n", xb);
return FALSE;
}
ttable[index].flag = 1; /* this color is valid */
ttable[index].col.r = r;
ttable[index].col.g = g;
ttable[index].col.b = b;
ttable[index].slot = ccount;
ColorMap[ccount].r = r;
ColorMap[ccount].g = g;
ColorMap[ccount].b = b;
}
}
return TRUE;
}
/* This deserves better. Don't read it too closely - you'll get ill. */
#define bufsz 2048
char buf[bufsz];
char *
xpmgetline()
{
char *bp;
do {
if (fgets(buf, bufsz, xpmfh) == 0)
return 0;
} while (buf[0] != '"');
/* strip off the trailing <",> if any */
for (bp = buf; *bp; bp++)
;
bp--;
while (isspace(*bp))
bp--;
if (*bp == ',')
bp--;
if (*bp == '"')
bp--;
bp++;
*bp = '\0';
return &buf[1];
}

1
outdated/win/gnome/.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
* NH_filestag=(file%s_for_GNOME_versions_-_untested_for_3.7)

53
outdated/win/gnome/README Normal file
View File

@@ -0,0 +1,53 @@
This directory contains the windowing code written for GnomeHack. The NetHack
devteam is in the process of making it part of the normal distribution.
It should be noted that this is still work in progress and that there are
still problems with this code. So use at your own risk. Of course any
contributions, especially bug fixes, are more than welcome!
These files are based on the files from GnomeHack 1.0.5 by Erik Andersen.
Some files have been renamed to fit into 8.3 name constraints (yuk!).
These are:
GnomeHack.h gnomeprv.h
GnomeHackAskStringDialog.c gnaskstr.c
GnomeHackAskStringDialog.h gnaskstr.h
GnomeHackBind.c gnbind.c
GnomeHackBind.h gnbind.h
GnomeHackGlyph.c gnglyph.c
GnomeHackGlyph.h gnglyph.h
GnomeHackMainWindow.c gnmain.c
GnomeHackMainWindow.h gnmain.h
GnomeHackMapWindow.c gnmap.c
GnomeHackMapWindow.h gnmap.h
GnomeHackMenuWindow.c gnmenu.c
GnomeHackMenuWindow.h gnmenu.h
GnomeHackMessageWindow.c gnmesg.c
GnomeHackMessageWindow.h gnmesg.h
GnomeHackPlayerSelDialog.c gnplayer.c
GnomeHackPlayerSelDialog.h gnplayer.h
GnomeHackSettings.c gnopts.c
GnomeHackSettings.h gnopts.h
GnomeHackSignals.c gnsignal.c
GnomeHackSignals.h gnsignal.h
GnomeHackStatusWindow.c gnstatus.c
GnomeHackStatusWindow.h gnstatus.h
GnomeHackTextWindow.c gntext.c
GnomeHackTextWindow.h gntext.h
GnomeHackYesNoDialog.c gnyesno.c
GnomeHackYesNoDialog.h gnyesno.h
Other files have been removed because we don't or can't use them (yet).
Makefile.am
Makefile.in
gnomehack.desktop
gnomehack.desktop.in
NetHack currently doesn't use autoconf, so the setup for that has not
made the translation.
Note: All loss in style, elegance, and readability is entirely our fault
and not Erik's.

1451
outdated/win/gnome/gn_xpms.h Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,57 @@
/* NetHack 3.6 gnaskstr.c $NHDT-Date: 1432512806 2015/05/25 00:13:26 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#include "gnaskstr.h"
#include "gnmain.h"
#include <gnome.h>
static void
ghack_ask_string_callback(gchar *string, gpointer data)
{
char **user_text = (char **) data;
g_assert(user_text != NULL);
*user_text = string; /* note - value must be g_free'd */
}
int
ghack_ask_string_dialog(const char *szMessageStr, const char *szDefaultStr,
const char *szTitleStr, char *buffer)
{
int i;
GtkWidget *dialog;
gchar *user_text = NULL;
dialog =
gnome_request_dialog(FALSE, szMessageStr, szDefaultStr, 0,
ghack_ask_string_callback, &user_text, NULL);
g_assert(dialog != NULL);
gtk_window_set_title(GTK_WINDOW(dialog), szTitleStr);
gnome_dialog_set_default(GNOME_DIALOG(dialog), 0);
gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
gnome_dialog_set_parent(GNOME_DIALOG(dialog),
GTK_WINDOW(ghack_get_main_window()));
i = gnome_dialog_run_and_close(GNOME_DIALOG(dialog));
/* Quit */
if (i != 0 || user_text == NULL) {
if (user_text)
g_free(user_text);
return -1;
}
if (*user_text == 0) {
g_free(user_text);
return -1;
}
g_assert(strlen(user_text) > 0);
strcpy(buffer, user_text);
g_free(user_text);
return 0;
}

View File

@@ -0,0 +1,12 @@
/* NetHack 3.6 gnaskstr.h $NHDT-Date: 1432512806 2015/05/25 00:13:26 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef GnomeHackAskStringDialog_h
#define GnomeHackAskStringDialog_h
int ghack_ask_string_dialog(const char *szMessageStr,
const char *szDefaultStr, const char *szTitleStr,
char *buffer);
#endif /* GnomeHackAskStringDialog_h */

1192
outdated/win/gnome/gnbind.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,88 @@
/* NetHack 3.6 gnbind.h $NHDT-Date: 1432512806 2015/05/25 00:13:26 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef GnomeHackBind_h
#define GnomeHackBind_h
/*
* This header files defines the interface between the window port specific
* code in the Gnome port and the rest of the nethack game engine.
*/
#include <gnome.h>
#include <gdk/gdkkeysyms.h>
#include "gnomeprv.h"
#include "gnmain.h"
#include "gnmap.h"
#include "gnmenu.h"
#include "gnplayer.h"
#include "gnsignal.h"
#include "gnstatus.h"
#include "gntext.h"
#include "gnmesg.h"
#include "gnyesno.h"
#include "gnglyph.h"
#include "gnworn.h"
/* Create an array to keep track of the various windows */
#ifndef MAXWINDOWS
#define MAXWINDOWS 15
#endif
typedef struct gnome_nhwindow_data {
GtkWidget *win;
int type;
} GNHWinData;
/* Some prototypes */
void gnome_init_nhwindows(int *argc, char **argv);
void gnome_player_selection(void);
void gnome_askname(void);
void gnome_get_nh_event(void);
void gnome_exit_nhwindows(const char *);
void gnome_suspend_nhwindows(const char *);
void gnome_resume_nhwindows(void);
winid gnome_create_nhwindow(int type);
void gnome_create_nhwindow_by_id(int type, winid i);
void gnome_clear_nhwindow(winid wid);
void gnome_display_nhwindow(winid wid, BOOLEAN_P block);
void gnome_destroy_nhwindow(winid wid);
void gnome_curs(winid wid, int x, int y);
void gnome_putstr(winid wid, int attr, const char *text);
void gnome_display_file(const char *filename, BOOLEAN_P must_exist);
void gnome_start_menu(winid wid, unsigned long mbehavior);
void gnome_add_menu(winid wid, int glyph, const ANY_P *identifier,
CHAR_P accelerator, CHAR_P group_accel, int attr,
const char *str, BOOLEAN_P presel);
void gnome_end_menu(winid wid, const char *prompt);
int gnome_select_menu(winid wid, int how, MENU_ITEM_P **selected);
/* No need for message_menu -- we'll use genl_message_menu instead */
void gnome_update_inventory(void);
void gnome_mark_synch(void);
void gnome_wait_synch(void);
void gnome_cliparound(int x, int y);
/* The following function does the right thing. The nethack
* gnome_cliparound (which lacks the winid) simply calls this function.
*/
void gnome_cliparound_proper(winid wid, int x, int y);
void gnome_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph);
void gnome_raw_print(const char *str);
void gnome_raw_print_bold(const char *str);
int gnome_nhgetch(void);
int gnome_nh_poskey(int *x, int *y, int *mod);
void gnome_nhbell(void);
int gnome_doprev_message(void);
char gnome_yn_function(const char *question, const char *choices, CHAR_P def);
void gnome_getlin(const char *question, char *input);
int gnome_get_ext_cmd(void);
void gnome_number_pad(int state);
void gnome_delay_output(void);
void gnome_start_screen(void);
void gnome_end_screen(void);
void gnome_outrip(winid wid, int how, time_t when);
void gnome_delete_nhwindow_by_reference(GtkWidget *menuWin);
#endif /* GnomeHackBind_h */

View File

@@ -0,0 +1,221 @@
/* NetHack 3.6 gnglyph.c $NHDT-Date: 1432512806 2015/05/25 00:13:26 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#include "gnglyph.h"
#include "tile2x11.h"
/* from tile.c */
extern int total_tiles_used;
static GHackGlyphs ghack_glyphs;
static GdkImlibImage **ghack_tiles = NULL;
/* NAME:
* ghack_init_glyphs(char* xpm_file)
*
* ARGUMENTS:
* char *xpm_file -- The name of the image file.
* May be any image format imlib recognizes.
* Does not have to be XPM.
*
* RETURNS:
* TRUE upon successful loading of the glyphs.
* FALSE upon failure.
*
* PURPOSE:
* Constructor for the Glyph object. Well, really each glyph
* object is a collection of glyphs, or tiles. This constructor
* takes a single argument: the name of the image file that contains
* the tile images.
*
* NOTES:
* The glyphs (tiles) must be in the image in a certain way: the
* glyphs must be stacked such that the resultant image is
* TILE_X * TILES_PER_ROW wide, and
* TILE_Y * (number of glyphs) / TILES_PER_ROW high (rounded up).
* In this sense, TILE_X == TILE_Y, and can be any reasonable integer
* say, 16 <= TILE_X <= 64. Because the glyph number is tightly
* coupled to the Nethack object it represents, the order of the
* glyphs in the image is imporant: Glyph 1 is at the top of the
* image, while Glyph N (the last glyph) is at the bottom.
*
* What's the difference between a glyph and a tile? Well, a
* tile is just an image. A glyph is a tile that knows its
* place in line.
*
* This initializer relies heavily on gdk_imlib. Thanks, Rasterman.
*/
int
ghack_init_glyphs(const char *xpmFile)
{
ghack_glyphs.im = gdk_imlib_load_image((char *) xpmFile);
if (!ghack_glyphs.im) {
g_error("Couldn't load required xpmFile!");
return -1;
}
gdk_imlib_render(ghack_glyphs.im, ghack_glyphs.im->rgb_width,
ghack_glyphs.im->rgb_height);
if ((ghack_glyphs.im->rgb_width % TILES_PER_ROW) != 0
|| ghack_glyphs.im->rgb_width <= TILES_PER_ROW) {
g_error(
"%s is not a multiple of %d (number of tiles/row) pixels wide",
xpmFile, TILES_PER_ROW);
return -1;
}
ghack_glyphs.count = total_tiles_used;
if ((ghack_glyphs.count % TILES_PER_ROW) != 0) {
ghack_glyphs.count +=
TILES_PER_ROW - (ghack_glyphs.count % TILES_PER_ROW);
}
ghack_glyphs.width = ghack_glyphs.im->rgb_width / TILES_PER_ROW;
ghack_glyphs.height =
ghack_glyphs.im->rgb_height / (ghack_glyphs.count / TILES_PER_ROW);
/* Assume the tiles are organized in rows of TILES_PER_ROW */
ghack_tiles = g_new0(GdkImlibImage *, ghack_glyphs.count);
return (ghack_tiles == NULL) ? -1 : 0;
}
void
ghack_free_glyphs()
{
int i;
for (i = 0; i < ghack_glyphs.count; i++)
gdk_imlib_destroy_image(ghack_tiles[i]);
g_free(ghack_tiles);
gdk_imlib_destroy_image(ghack_glyphs.im);
ghack_glyphs.im = NULL;
}
/* NAME:
* ghack_glyph_count( )
*
* ARGUMENTS:
* None.
*
* RETURNS:
* int -- The number of glyphs in this object.
*
* PURPOSE:
* Simply reports the number of glyphs in this object.
*/
int
ghack_glyph_count()
{
return ghack_glyphs.count;
}
/* NAME:
* ghack_glyph_height()
*
* ARGUMENTS:
* None
*
* RETURNS:
* int -- The glyph height.
*
* PURPOSE:
* Returns the standard glyph height.
*/
int
ghack_glyph_height()
{
return ghack_glyphs.height;
}
/* NAME:
* ghack_glyph_width()
*
* ARGUMENTS:
* None
*
* RETURNS:
* int -- The glyph width.
*
* PURPOSE:
* Returns the standard glyph width.
*/
int
ghack_glyph_width()
{
return ghack_glyphs.width;
}
/* NAME:
* ghack_image_from_glyph( int glyph, gboolean force)
*
* ARGUMENTS:
* int glyph -- The glyph number.
* gboolean force -- force it to re-render.
*
* RETURNS:
* GdkImlibImage* -- The glyph image, as a GdkImlibImage.
*
* PURPOSE:
* Decodes the glyph into an image suitable for manipulation
*/
GdkImlibImage *
ghack_image_from_glyph(int glyph, gboolean force)
{
int tile = glyph2tile[glyph];
if (tile >= ghack_glyphs.count || tile < 0) {
g_warning(
"Aiiee! I've was asked for a tile outside the allowed range!\n"
"Email this to other-gnomehack@lists.debian.org");
g_warning("Max tile: %d Tile asked for: %d", ghack_glyphs.count,
tile);
return NULL;
}
if (ghack_glyphs.im == NULL) {
g_warning("Aiiee! I've been asked to clone from a null image.\n"
"Email this to other-gnomehack@lists.debian.org");
g_warning("making image from tile %d, force=%s\n", tile,
(force == TRUE) ? "TRUE" : "FALSE");
}
if (force == TRUE) {
g_warning("Aiiee! I've been asked to force rendering.\n"
"Email this to other-gnomehack@lists.debian.org");
g_warning("making image from tile %d, force=%s\n", tile,
(force == TRUE) ? "TRUE" : "FALSE");
}
if (!ghack_tiles[tile] || force) {
int src_x, src_y;
#if 0
fprintf( stderr, "crop_and_clone: glyph=%d, tile=%d, ptr=%p, x=%d, y=%d, w=%d, h=%d\n", glyph, tile,
(void*)&(ghack_tiles[tile]), 0,
tile * ghack_glyphs.width,
ghack_glyphs.height,
ghack_glyphs.width);
#endif
if (ghack_glyphs.im->pixmap == NULL)
g_warning("Aiiee! ghack_glyphs.im->pixmap==NULL!!!!\n");
src_x = (tile % TILES_PER_ROW) * ghack_glyphs.width;
src_y = (tile / TILES_PER_ROW) * ghack_glyphs.height;
ghack_tiles[tile] = gdk_imlib_crop_and_clone_image(
ghack_glyphs.im, src_x, src_y, ghack_glyphs.width,
ghack_glyphs.height);
}
if (ghack_tiles[tile] && (!ghack_tiles[tile]->pixmap || force)) {
if (gdk_imlib_render(ghack_tiles[tile], ghack_tiles[tile]->rgb_width,
ghack_tiles[tile]->rgb_height) == 0) {
g_error("GLYPH: couldn't create tile # %d", tile);
}
if (!ghack_tiles[tile]->pixmap)
g_error("Strange, tile # %d didn't get rendered???", tile);
}
return ghack_tiles[tile];
}

View File

@@ -0,0 +1,41 @@
/* NetHack 3.6 gnglyph.h $NHDT-Date: 1432512806 2015/05/25 00:13:26 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef GnomeHackGlyph_h
#define GnomeHackGlyph_h
#include "config.h"
#include "global.h"
/* the prototypes in system headers contain useless argument names
that trigger spurious warnings if gcc's `-Wshadow' option is used */
#undef index
#define index _hide_index_
#define time _hide_time_
#include <gdk_imlib.h>
#include <gdk/gdk.h>
#undef index
#define index strchr
#undef time
extern short glyph2tile[]; /* From tile.c */
typedef struct {
GdkImlibImage *im;
int count;
int width;
int height;
} GHackGlyphs;
extern int ghack_init_glyphs(const char *);
extern void ghack_free_glyphs(void);
extern void ghack_dispose_glyphs(void);
extern int ghack_glyph_count(void);
extern GdkImlibImage *ghack_image_from_glyph(int, gboolean);
extern int ghack_glyph_height(void);
extern int ghack_glyph_width(void);
#endif /* GnomeHackGlyph_h */

706
outdated/win/gnome/gnmain.c Normal file
View File

@@ -0,0 +1,706 @@
/* NetHack 3.6 gnmain.c $NHDT-Date: 1432512807 2015/05/25 00:13:27 $ $NHDT-Branch: master $:$NHDT-Revision: 1.15 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#include "gnmain.h"
#include "gnsignal.h"
#include "gnbind.h"
#include "gnopts.h"
#include <gnome.h>
#include <getopt.h>
#include <gdk/gdk.h>
#include <sys/time.h>
#include <unistd.h>
#include <signal.h>
#include "hack.h"
#include "date.h"
static GtkWidget *mainWindow = NULL;
static GtkWidget *about = NULL;
static GtkWidget *hBoxFirstRow;
static GtkWidget *vBoxMain;
int restarted = 0;
int os_x = 0, os_y = 0, os_w = 0, os_h = 0;
static GnomeClient *session_id;
static void
ghack_quit_game(GtkWidget *widget, int button)
{
gtk_widget_hide(widget);
if (button == 0) {
gnome_exit_nhwindows(0);
gtk_object_unref(GTK_OBJECT(session_id));
clearlocks();
gtk_exit(0);
}
}
static void
ghack_quit_game_cb(GtkWidget *widget, gpointer data)
{
GtkWidget *box;
box = gnome_message_box_new(
_("Do you really want to quit?"), GNOME_MESSAGE_BOX_QUESTION,
GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO, NULL);
gnome_dialog_set_default(GNOME_DIALOG(box), 1);
gnome_dialog_set_parent(GNOME_DIALOG(box),
GTK_WINDOW(ghack_get_main_window()));
gnome_dialog_set_accelerator(GNOME_DIALOG(box), 1, 'n', 0);
gnome_dialog_set_accelerator(GNOME_DIALOG(box), 0, 'y', 0);
gtk_window_set_modal(GTK_WINDOW(box), TRUE);
gtk_signal_connect(GTK_OBJECT(box), "clicked",
(GtkSignalFunc) ghack_quit_game, NULL);
gtk_widget_show(box);
}
static void
ghack_save_game(GtkWidget *widget, int button)
{
gtk_widget_hide(widget);
if (button == 0) {
if (dosave0()) {
/* make sure they see the Saving message */
display_nhwindow(WIN_MESSAGE, TRUE);
gnome_exit_nhwindows("Be seeing you...");
clearlocks();
gtk_exit(0);
} else
(void) doredraw();
}
}
void
ghack_save_game_cb(GtkWidget *widget, gpointer data)
{
GtkWidget *box;
box = gnome_message_box_new(
_("Quit and save the current game?"), GNOME_MESSAGE_BOX_QUESTION,
GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO, NULL);
gnome_dialog_set_default(GNOME_DIALOG(box), 1);
gnome_dialog_set_parent(GNOME_DIALOG(box),
GTK_WINDOW(ghack_get_main_window()));
gnome_dialog_set_accelerator(GNOME_DIALOG(box), 1, 'n', 0);
gnome_dialog_set_accelerator(GNOME_DIALOG(box), 0, 'y', 0);
gtk_window_set_modal(GTK_WINDOW(box), TRUE);
gtk_signal_connect(GTK_OBJECT(box), "clicked",
(GtkSignalFunc) ghack_save_game, NULL);
gtk_widget_show(box);
}
static void
ghack_new_game(GtkWidget *widget, int button)
{
if (button == 0) {
g_message("This feature is not yet implemented. Sorry.");
}
}
static void
ghack_new_game_cb(GtkWidget *widget, gpointer data)
{
GtkWidget *box;
box = gnome_message_box_new(
_("Start a new game?"), GNOME_MESSAGE_BOX_QUESTION,
GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO, NULL);
gnome_dialog_set_default(GNOME_DIALOG(box), 1);
gnome_dialog_set_parent(GNOME_DIALOG(box),
GTK_WINDOW(ghack_get_main_window()));
gnome_dialog_set_accelerator(GNOME_DIALOG(box), 1, 'n', 0);
gnome_dialog_set_accelerator(GNOME_DIALOG(box), 0, 'y', 0);
gtk_window_set_modal(GTK_WINDOW(box), TRUE);
gtk_signal_connect(GTK_OBJECT(box), "clicked",
(GtkSignalFunc) ghack_new_game, NULL);
gtk_widget_show(box);
}
static void
about_destroy_callback(void)
{
about = NULL;
}
static void
ghack_about_cb(GtkWidget *widget, gpointer data)
{
char buf[BUFSZ] = "\0";
char buf1[BUFSZ] = "\0";
const gchar *authors[] = { "Erik Andersen", "Anthony Taylor",
"Jeff Garzik", "The Nethack Dev Team", NULL };
if (about) {
gdk_window_raise(about->window);
return;
}
getversionstring(buf);
#if 0
/* XXX this needs further re-write to use DEVTEAM_EMAIL, DEVTEAM_URL,
* sysopt.support, etc. I'm not doing it now because I can't test
* it yet. (keni)
*/
/* out of date first cut: */
! len = strlen(buf);
! char *str1 = _("\nSend comments and bug reports to:\n");
! len += strlen(str1);
! len += sysopt.email;
! char *str2 = _("\nThis game is free software. See License for details.");
! len += strlen(str2);
! str = (char*)alloc(len+1);
! strcat(buf, str1);
! strcat(buf, sysopt.email);
! strcat(buf, str2);
free(str) below
#else
strcat(buf1, VERSION_STRING);
strcat(buf,
_("\nSend comments and bug reports to: nethack-bugs@nethack.org\n"
"This game is free software. See License for details."));
#endif
about = gnome_about_new(_("Nethack"), buf1,
"Copyright (C) 1985-2002 Mike Stephenson",
(const char **) authors, buf, NULL);
gtk_signal_connect(GTK_OBJECT(about), "destroy",
(GtkSignalFunc) about_destroy_callback, NULL);
gtk_widget_show(about);
}
static void
ghack_settings_cb(GtkWidget *widget, gpointer data)
{
ghack_settings_dialog();
}
static void
ghack_accelerator_selected(GtkWidget *widget, gpointer data)
{
GdkEventKey event;
int key = GPOINTER_TO_INT(data);
/* g_message("An accelerator for \"%c\" was selected", key); */
/* stuff a key directly into the keybuffer */
event.state = 0;
event.keyval = key;
ghack_handle_key_press(NULL, &event, NULL);
}
#ifndef M
#ifndef NHSTDC
#define M(c) (0x80 | (c))
#else
#define M(c) ((c) -128)
#endif /* NHSTDC */
#endif
#ifndef C
#define C(c) (0x1f & (c))
#endif
GnomeUIInfo game_tree[] = {
{ GNOME_APP_UI_ITEM, N_("_Change Settings..."),
N_("Change Game Settings"), ghack_settings_cb, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL },
GNOMEUIINFO_SEPARATOR,
{ GNOME_APP_UI_ITEM, N_("Version"), NULL, ghack_accelerator_selected,
GINT_TO_POINTER('v'), NULL, GNOME_APP_PIXMAP_STOCK,
GNOME_STOCK_MENU_ABOUT, 'v', 0 },
{ GNOME_APP_UI_ITEM, N_("History..."), NULL, ghack_accelerator_selected,
GINT_TO_POINTER('V'), NULL, GNOME_APP_PIXMAP_STOCK,
GNOME_STOCK_MENU_ABOUT, 'V', GDK_SHIFT_MASK },
{ GNOME_APP_UI_ITEM, N_("Compilation..."), NULL,
ghack_accelerator_selected, GINT_TO_POINTER(M('v')), NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_ABOUT, 'v', GDK_MOD1_MASK },
{ GNOME_APP_UI_ITEM, N_("Options..."), NULL, ghack_accelerator_selected,
GINT_TO_POINTER('O'), NULL, GNOME_APP_PIXMAP_STOCK,
GNOME_STOCK_MENU_PREF, 'O', GDK_SHIFT_MASK },
{ GNOME_APP_UI_ITEM, N_("Explore Mode..."), NULL,
ghack_accelerator_selected, GINT_TO_POINTER('X'), NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_QUIT, 'X', GDK_SHIFT_MASK },
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_MENU_NEW_GAME_ITEM(ghack_new_game_cb, NULL),
GNOMEUIINFO_MENU_SAVE_ITEM(ghack_save_game_cb, NULL),
{ GNOME_APP_UI_ITEM, N_("Exit"), NULL, ghack_quit_game_cb,
GINT_TO_POINTER(M('Q')), NULL, GNOME_APP_PIXMAP_STOCK,
GNOME_STOCK_MENU_ABOUT, 'Q', GDK_MOD1_MASK },
GNOMEUIINFO_END
};
GnomeUIInfo edit_menu[] = {
{ GNOME_APP_UI_ITEM, N_("Inventory"), N_("Edit/View your Inventory"),
ghack_accelerator_selected, GINT_TO_POINTER('i'), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'i', 0 },
{ GNOME_APP_UI_ITEM, N_("Discoveries"), N_("Edit/View your Discoveries"),
ghack_accelerator_selected, GINT_TO_POINTER('\\'), NULL,
GNOME_APP_PIXMAP_NONE, NULL, '\\', 0 },
{ GNOME_APP_UI_ITEM, N_("List/reorder your spells"),
N_("List/reorder your spells"), ghack_accelerator_selected,
GINT_TO_POINTER('x'), NULL, GNOME_APP_PIXMAP_NONE, NULL, 'x', 0 },
{ GNOME_APP_UI_ITEM, N_("Adjust letters"),
N_("Adjust letter for items in your Inventory"),
ghack_accelerator_selected, GINT_TO_POINTER(M('a')), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'a', GDK_MOD1_MASK },
GNOMEUIINFO_SEPARATOR,
{ GNOME_APP_UI_ITEM, N_("Name object"), N_("Assign a name to an object"),
ghack_accelerator_selected, GINT_TO_POINTER(M('n')), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'n', GDK_MOD1_MASK },
{ GNOME_APP_UI_ITEM, N_("Name creature"),
N_("Assign a name to a creature"), ghack_accelerator_selected,
GINT_TO_POINTER('C'), NULL, GNOME_APP_PIXMAP_NONE, NULL, 'C',
GDK_SHIFT_MASK },
GNOMEUIINFO_SEPARATOR,
{ GNOME_APP_UI_ITEM, N_("Qualifications"), N_("Edit your Qualifications"),
ghack_accelerator_selected, GINT_TO_POINTER(M('e')), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'e', GDK_MOD1_MASK },
GNOMEUIINFO_END
};
GnomeUIInfo apparel_menu[] = {
{ GNOME_APP_UI_ITEM, N_("Wield Weapon"),
N_("Select a weapon to fight with"), ghack_accelerator_selected,
GINT_TO_POINTER('w'), NULL, GNOME_APP_PIXMAP_NONE, NULL, 'w', 0 },
{ GNOME_APP_UI_ITEM, N_("Remove Apparel..."),
N_("Remove apparel dialog bog"), ghack_accelerator_selected,
GINT_TO_POINTER('A'), NULL, GNOME_APP_PIXMAP_NONE, NULL, 'A',
GDK_SHIFT_MASK },
GNOMEUIINFO_SEPARATOR,
{ GNOME_APP_UI_ITEM, N_("Wear Armor"), N_("Put on armor"),
ghack_accelerator_selected, GINT_TO_POINTER('W'), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'W', GDK_SHIFT_MASK },
{ GNOME_APP_UI_ITEM, N_("Take off Armor"),
N_("Take off armor you are wearing"), ghack_accelerator_selected,
GINT_TO_POINTER('T'), NULL, GNOME_APP_PIXMAP_NONE, NULL, 'T',
GDK_SHIFT_MASK },
GNOMEUIINFO_SEPARATOR,
{ GNOME_APP_UI_ITEM, N_("Put on non-armor"),
N_("Put on non-armor apparel"), ghack_accelerator_selected,
GINT_TO_POINTER('P'), NULL, GNOME_APP_PIXMAP_NONE, NULL, 'P',
GDK_SHIFT_MASK },
{ GNOME_APP_UI_ITEM, N_("Remove non-armor"),
N_("Remove non-armor apparel you are wearing"),
ghack_accelerator_selected, GINT_TO_POINTER('R'), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'R', GDK_SHIFT_MASK },
GNOMEUIINFO_END
};
GnomeUIInfo action_menu[] = {
{ GNOME_APP_UI_ITEM, N_("Get"),
N_("Pick up things at the current location"),
ghack_accelerator_selected, GINT_TO_POINTER(','), NULL,
GNOME_APP_PIXMAP_NONE, NULL, ',', 0 },
{ GNOME_APP_UI_ITEM, N_("Loot"), N_("loot a box on the floor"),
ghack_accelerator_selected, GINT_TO_POINTER(M('l')), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'l', GDK_MOD1_MASK },
{ GNOME_APP_UI_ITEM, N_("Sit"), N_("sit down"),
ghack_accelerator_selected, GINT_TO_POINTER(M('s')), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 's', GDK_MOD1_MASK },
{ GNOME_APP_UI_ITEM, N_("Force"), N_("force a lock"),
ghack_accelerator_selected, GINT_TO_POINTER(M('f')), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'f', GDK_MOD1_MASK },
{ GNOME_APP_UI_ITEM, N_("Kick"), N_("kick something (usually a door)"),
ghack_accelerator_selected, GINT_TO_POINTER(C('d')), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'd', GDK_CONTROL_MASK },
{ GNOME_APP_UI_ITEM, N_("Jump"), N_("jump to another location"),
ghack_accelerator_selected, GINT_TO_POINTER(M('j')), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'j', GDK_MOD1_MASK },
{ GNOME_APP_UI_ITEM, N_("Ride"), N_("Ride (or stop riding) a monster"),
doride, GINT_TO_POINTER(M('r')), NULL, GNOME_APP_PIXMAP_NONE, NULL, 'R',
GDK_MOD1_MASK },
{ GNOME_APP_UI_ITEM, N_("Wipe face"), N_("wipe off your face"),
ghack_accelerator_selected, GINT_TO_POINTER(M('w')), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'w', GDK_MOD1_MASK },
{ GNOME_APP_UI_ITEM, N_("Throw/Shoot"), N_("throw or shoot a weapon"),
ghack_accelerator_selected, GINT_TO_POINTER('t'), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 't', 0 },
{
GNOME_APP_UI_ITEM, N_("Quiver/Ready"),
N_("ready or quiver some ammunition"), ghack_accelerator_selected,
GINT_TO_POINTER('Q'), NULL, GNOME_APP_PIXMAP_NONE, NULL, 'Q',
GDK_SHIFT_MASK,
},
{ GNOME_APP_UI_ITEM, N_("Open Door"), N_("open a door"),
ghack_accelerator_selected, GINT_TO_POINTER('o'), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'o', 0 },
{ GNOME_APP_UI_ITEM, N_("Close Door"), N_("open a door"),
ghack_accelerator_selected, GINT_TO_POINTER('c'), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'c', 0 },
GNOMEUIINFO_SEPARATOR,
{ GNOME_APP_UI_ITEM, N_("Drop"), N_("drop an object"),
ghack_accelerator_selected, GINT_TO_POINTER('d'), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'd', 0 },
{ GNOME_APP_UI_ITEM, N_("Drop Many"),
N_("drop selected types of objects"), ghack_accelerator_selected,
GINT_TO_POINTER('D'), NULL, GNOME_APP_PIXMAP_NONE, NULL, 'D',
GDK_SHIFT_MASK },
{ GNOME_APP_UI_ITEM, N_("Eat"), N_("eat something"),
ghack_accelerator_selected, GINT_TO_POINTER('e'), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'e', 0 },
{ GNOME_APP_UI_ITEM, N_("Engrave"),
N_("write a message in the dust on the floor"),
ghack_accelerator_selected, GINT_TO_POINTER('E'), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'E', GDK_SHIFT_MASK },
{ GNOME_APP_UI_ITEM, N_("Apply"),
N_("apply or use a tool (pick-axe, key, camera, etc.)"),
ghack_accelerator_selected, GINT_TO_POINTER('a'), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'a', 0 },
GNOMEUIINFO_SEPARATOR,
{ GNOME_APP_UI_ITEM, N_("Up"), N_("go up the stairs"),
ghack_accelerator_selected, GINT_TO_POINTER('<'), NULL,
GNOME_APP_PIXMAP_NONE, NULL, '<', 0 },
{ GNOME_APP_UI_ITEM, N_("Down"), N_("go down the stairs"),
ghack_accelerator_selected, GINT_TO_POINTER('>'), NULL,
GNOME_APP_PIXMAP_NONE, NULL, '>', 0 },
{ GNOME_APP_UI_ITEM, N_("Rest"), N_("wait for a moment"),
ghack_accelerator_selected, GINT_TO_POINTER('.'), NULL,
GNOME_APP_PIXMAP_NONE, NULL, '.', 0 },
{ GNOME_APP_UI_ITEM, N_("Search"),
N_("search for secret doors, hidden traps and monsters"),
ghack_accelerator_selected, GINT_TO_POINTER('s'), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 's', 0 },
GNOMEUIINFO_SEPARATOR,
{ GNOME_APP_UI_ITEM, N_("Chat"), N_("talk to someone"),
ghack_accelerator_selected, GINT_TO_POINTER(M('c')), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'c', GDK_MOD1_MASK },
{ GNOME_APP_UI_ITEM, N_("Pay"), N_("pay your bill to the shopkeeper"),
ghack_accelerator_selected, GINT_TO_POINTER('p'), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'p', 0 },
GNOMEUIINFO_END
};
GnomeUIInfo magic_menu[] = {
{ GNOME_APP_UI_ITEM, N_("Quaff potion"), N_("drink a potion"),
ghack_accelerator_selected, GINT_TO_POINTER('q'), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'q', 0 },
{ GNOME_APP_UI_ITEM, N_("Read Book/Scroll"),
N_("read a spell book or a scroll"), ghack_accelerator_selected,
GINT_TO_POINTER('r'), NULL, GNOME_APP_PIXMAP_NONE, NULL, 'r', 0 },
{ GNOME_APP_UI_ITEM, N_("Zap Wand"), N_("zap a wand"),
ghack_accelerator_selected, GINT_TO_POINTER('z'), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'z', 0 },
{ GNOME_APP_UI_ITEM, N_("Zap Spell"), N_("cast a spell"),
ghack_accelerator_selected, GINT_TO_POINTER('Z'), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'Z', GDK_SHIFT_MASK },
GNOMEUIINFO_SEPARATOR,
{ GNOME_APP_UI_ITEM, N_("Dip"), N_("dip an object into something"),
ghack_accelerator_selected, GINT_TO_POINTER(M('d')), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'd', GDK_MOD1_MASK },
{ GNOME_APP_UI_ITEM, N_("Rub"), N_("Rub something (i.e. a lamp)"),
ghack_accelerator_selected, GINT_TO_POINTER(M('r')), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'r', GDK_MOD1_MASK },
{ GNOME_APP_UI_ITEM, N_("Invoke"),
N_("invoke an object's special powers"), ghack_accelerator_selected,
GINT_TO_POINTER(M('i')), NULL, GNOME_APP_PIXMAP_NONE, NULL, 'i',
GDK_MOD1_MASK },
GNOMEUIINFO_SEPARATOR,
{ GNOME_APP_UI_ITEM, N_("Offer"), N_("offer a sacrifice to the gods"),
ghack_accelerator_selected, GINT_TO_POINTER(M('o')), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'o', GDK_MOD1_MASK },
{ GNOME_APP_UI_ITEM, N_("Pray"), N_("pray to the gods for help"),
ghack_accelerator_selected, GINT_TO_POINTER(M('p')), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 'p', GDK_MOD1_MASK },
GNOMEUIINFO_SEPARATOR,
{ GNOME_APP_UI_ITEM, N_("Teleport"), N_("teleport (if you can)"),
ghack_accelerator_selected, GINT_TO_POINTER(C('t')), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 't', GDK_CONTROL_MASK },
{ GNOME_APP_UI_ITEM, N_("Monster Action"),
N_("use a monster's special ability"), ghack_accelerator_selected,
GINT_TO_POINTER(M('m')), NULL, GNOME_APP_PIXMAP_NONE, NULL, 'm',
GDK_MOD1_MASK },
{ GNOME_APP_UI_ITEM, N_("Turn Undead"), N_("turn undead"),
ghack_accelerator_selected, GINT_TO_POINTER(M('t')), NULL,
GNOME_APP_PIXMAP_NONE, NULL, 't', GDK_MOD1_MASK },
GNOMEUIINFO_END
};
GnomeUIInfo help_menu[] = {
{ GNOME_APP_UI_ITEM, N_("About..."), N_("About GnomeHack"),
ghack_about_cb, NULL, NULL, GNOME_APP_PIXMAP_STOCK,
GNOME_STOCK_MENU_ABOUT, 0, 0, NULL },
{ GNOME_APP_UI_ITEM, N_("Help"), NULL, ghack_accelerator_selected,
GINT_TO_POINTER('?'), NULL, GNOME_APP_PIXMAP_STOCK,
GNOME_STOCK_MENU_ABOUT, '?', 0 },
GNOMEUIINFO_SEPARATOR,
{ GNOME_APP_UI_ITEM, N_("What is here"),
N_("Check what items occupy the current location"),
ghack_accelerator_selected, GINT_TO_POINTER(':'), NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_ABOUT, ':', 0 },
{ GNOME_APP_UI_ITEM, N_("What is that"), N_("Identify an object"),
ghack_accelerator_selected, GINT_TO_POINTER(';'), NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_ABOUT, ';', 0 },
{ GNOME_APP_UI_ITEM, N_("Identify a map symbol"),
N_("Identify a map symbol"), ghack_accelerator_selected,
GINT_TO_POINTER('/'), NULL, GNOME_APP_PIXMAP_STOCK,
GNOME_STOCK_MENU_ABOUT, '/', 0 },
GNOMEUIINFO_END
};
GnomeUIInfo mainmenu[] = { GNOMEUIINFO_MENU_GAME_TREE(game_tree),
GNOMEUIINFO_MENU_EDIT_TREE(edit_menu),
{ GNOME_APP_UI_SUBTREE, N_("Apparel"), NULL,
apparel_menu, NULL, NULL, 0, NULL, 0, 0, NULL },
{ GNOME_APP_UI_SUBTREE, N_("Action"), NULL,
action_menu, NULL, NULL, 0, NULL, 0, 0, NULL },
{ GNOME_APP_UI_SUBTREE, N_("Magic"), NULL,
magic_menu, NULL, NULL, 0, NULL, 0, 0, NULL },
GNOMEUIINFO_MENU_HELP_TREE(help_menu),
GNOMEUIINFO_END };
static void
ghack_main_window_key_press(GtkWidget *widget, GdkEventKey *event,
gpointer data)
{
/* First, turn off the key press propogation. We've got the
* key, but we don't wan't the underlying Gtk widgets to get it,
* since they do the wrong thing with the arrow keys (shift focus)... */
gtk_signal_emit_stop_by_name(GTK_OBJECT(mainWindow), "key_press_event");
/* stuff the key event into the keybuffer */
ghack_handle_key_press(widget, event, data);
}
/* parsing args */
void
parse_args(int argc, char *argv[])
{
gint ch;
struct option options[] = { /* Default args */
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'v' },
{ NULL, 0, NULL, 0 }
};
gchar *id = NULL;
/* initialize getopt */
optarg = NULL;
optind = 0;
optopt = 0;
while ((ch = getopt_long(argc, argv, "hv", options, NULL)) != EOF) {
switch (ch) {
case 'h':
g_print(
_("%s: A gnomified 'Hello World' program\n\n"
"Usage: %s [--help] [--version]\n\n"
"Options:\n"
" --help display this help and exit\n"
" --version output version information and exit\n"),
argv[0], argv[0]);
exit(0);
break;
case 'v':
g_print(_("NetHack %s.\n"), VERSION_STRING);
exit(0);
break;
case ':':
case '?':
g_print(_("Options error\n"));
exit(0);
break;
}
}
/* SM stuff */
session_id = gnome_client_new();
#if 0
session_id = gnome_client_new (
/* callback to save the state and parameter for it */
save_state, argv[0],
/* callback to die and parameter for it */
NULL, NULL,
/* id from the previous session if restarted, NULL otherwise */
id);
#endif
/* set the program name */
gnome_client_set_program(session_id, argv[0]);
g_free(id);
return;
}
/*
* [ALI] Gnome installs its own handler(s) for SIGBUS, SIGFPE and SIGSEGV.
* These handlers will fork and exec a helper program. When that helper
* comes to initialize GTK+, it may fail if setuid/setgid. We solve this
* by dropping privileges before passing the signal along the chain.
* Note: We don't need to either drop or mask the saved ID since this
* will be reset when the child process performs the execve() anyway.
*/
static struct {
int signum;
void (*handler)(int);
} ghack_chain[] = {
{ SIGBUS },
{ SIGFPE },
{ SIGSEGV },
{ SIGILL } /* Not currently handled by Gnome */
};
static void
ghack_sig_handler(int signum)
{
int i;
uid_t uid, euid;
gid_t gid, egid;
uid = getuid();
euid = geteuid();
gid = getgid();
egid = getegid();
if (gid != egid)
setgid(gid);
if (uid != euid)
setuid(uid);
for (i = SIZE(ghack_chain) - 1; i >= 0; i--)
if (ghack_chain[i].signum == signum) {
ghack_chain[i].handler(signum);
break;
}
if (i < 0)
impossible("Unhandled ghack signal");
if (uid != euid)
setuid(euid);
if (gid != egid)
setgid(egid);
}
/* initialize gnome and fir up the main window */
void
ghack_init_main_window(int argc, char **argv)
{
int i;
struct timeval tv;
uid_t uid, euid;
/* It seems that the authors of gnome_score_init() drop group
* priveledges. We need group priveledges, so until we change the
* way we save games to do things the gnome way(???), this stays
* commented out. (after hours of frusteration...)
* -Erik
*/
/* gnome_score_init("gnomehack"); */
gettimeofday(&tv, NULL);
srand(tv.tv_usec);
uid = getuid();
euid = geteuid();
if (uid != euid)
setuid(uid);
hide_privileges(TRUE);
/* XXX gnome_init must print nethack options for --help, but does not */
gnome_init("nethack", VERSION_STRING, argc, argv);
hide_privileges(FALSE);
parse_args(argc, argv);
/* Initialize the i18n stuff (not that gnomehack supperts it yet...) */
#if 0
textdomain (PACKAGE);
#endif
gdk_imlib_init();
/* Main window */
mainWindow =
gnome_app_new((char *) "nethack", (char *) N_("Nethack for Gnome"));
gtk_widget_realize(mainWindow);
if (restarted) {
gtk_widget_set_uposition(mainWindow, os_x, os_y);
gtk_widget_set_usize(mainWindow, os_w, os_h);
}
gtk_window_set_default_size(GTK_WINDOW(mainWindow), 800, 600);
gtk_window_set_policy(GTK_WINDOW(mainWindow), FALSE, TRUE, TRUE);
gnome_app_create_menus(GNOME_APP(mainWindow), mainmenu);
gtk_signal_connect(GTK_OBJECT(mainWindow), "key_press_event",
GTK_SIGNAL_FUNC(ghack_main_window_key_press), NULL);
gtk_signal_connect(GTK_OBJECT(mainWindow), "delete_event",
GTK_SIGNAL_FUNC(ghack_quit_game_cb), NULL);
/* Put some stuff into our main window */
vBoxMain = gtk_vbox_new(FALSE, 0);
hBoxFirstRow = gtk_hbox_new(FALSE, 0);
/* pack Boxes into other boxes to produce the right structure */
gtk_box_pack_start(GTK_BOX(vBoxMain), hBoxFirstRow, FALSE, TRUE, 0);
/* pack vBoxMain which contains all our widgets into the main window. */
gnome_app_set_contents(GNOME_APP(mainWindow), vBoxMain);
/* DONT show the main window yet, due to a Gtk bug that causes it
* to not refresh the window when adding widgets after the window
* has already been shown */
if (uid != euid)
setuid(euid);
for (i = 0; i < SIZE(ghack_chain); i++)
ghack_chain[i].handler =
signal(ghack_chain[i].signum, ghack_sig_handler);
}
void
ghack_main_window_add_map_window(GtkWidget *win)
{
GtkWidget *vBox;
vBox = gtk_vbox_new(TRUE, 0);
gtk_box_pack_start(GTK_BOX(vBox), win, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(vBoxMain), vBox, TRUE, TRUE, 2);
gtk_widget_show_all(vBox);
/* Ok, now show the main window -- now that we have added in
* all the windows (relys on nethack displaying the map window last
* (This is an ugly kludge, BTW)
*/
gtk_widget_show_all(mainWindow);
}
void
ghack_main_window_add_message_window(GtkWidget *win)
{
gtk_box_pack_start(GTK_BOX(hBoxFirstRow), win, TRUE, TRUE, 2);
gtk_widget_show_all(win);
}
void
ghack_main_window_add_status_window(GtkWidget *win)
{
gtk_box_pack_start(GTK_BOX(hBoxFirstRow), win, FALSE, TRUE, 2);
gtk_widget_show_all(win);
}
void
ghack_main_window_add_worn_window(GtkWidget *win)
{
gtk_box_pack_end(GTK_BOX(hBoxFirstRow), win, FALSE, TRUE, 2);
gtk_widget_show_all(win);
}
void
ghack_main_window_add_text_window(GtkWidget *win)
{
g_warning("Fixme!!! AddTextWindow is not yet implemented");
}
void
ghack_main_window_remove_window(GtkWidget *win)
{
g_warning("Fixme!!! RemoveWindow is not yet implemented");
}
void
ghack_main_window_update_inventory()
{
/* For now, do very little. Eventually we may allow the inv. window
to stay active. When we do this, we'll need to implement this...
g_warning("Fixme!!! updateInventory is not yet implemented");
*/
gnome_display_nhwindow(WIN_WORN, FALSE);
}
GtkWidget *
ghack_get_main_window()
{
return (GTK_WIDGET(mainWindow));
}

View File

@@ -0,0 +1,22 @@
/* NetHack 3.6 gnmain.h $NHDT-Date: 1432512805 2015/05/25 00:13:25 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef GnomeHackMainWindow_h
#define GnomeHackMainWindow_h
#include <gnome.h>
#include <gtk/gtk.h>
void ghack_init_main_window(int argc, char **argv);
void ghack_main_window_add_map_window(GtkWidget *win);
void ghack_main_window_add_message_window(GtkWidget *win);
void ghack_main_window_add_status_window(GtkWidget *win);
void ghack_main_window_add_text_window(GtkWidget *);
void ghack_main_window_add_worn_window(GtkWidget *win);
void ghack_main_window_remove_window(GtkWidget *);
void ghack_main_window_update_inventory();
void ghack_save_game_cb(GtkWidget *widget, gpointer data);
GtkWidget *ghack_get_main_window();
#endif /* GnomeHackMainWindow_h */

529
outdated/win/gnome/gnmap.c Normal file
View File

@@ -0,0 +1,529 @@
/* NetHack 3.6 gnmap.c $NHDT-Date: 1432512806 2015/05/25 00:13:26 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* Copyright (C) 1998 by Anthony Taylor <tonyt@ptialaska.net> */
/* NetHack may be freely redistributed. See license for details. */
#include "gnmap.h"
#include "gnglyph.h"
#include "gnsignal.h"
#include "hack.h"
#ifndef ROWNO
#define ROWNO 21
#define COLNO 80
#endif
/* globals static to this file go here */
struct {
GnomeCanvas *canvas;
GnomeCanvasImage *map[(ROWNO + 1) * COLNO];
GnomeCanvasImage *overlay[(ROWNO + 1) * COLNO];
double zoom;
GtkWidget *frame;
} ghack_map;
static GdkImlibImage *background;
static GdkImlibImage *petmark;
static GnomeCanvasGroup *myCanvasGroup;
/* static function declarations -- local to this file go here */
void ghack_map_cursor_to(GtkWidget *win, int x, int y, gpointer data);
void ghack_map_putstr(GtkWidget *win, int attr, const char *text,
gpointer data);
void ghack_map_print_glyph(GtkObject *win, guint x, guint y,
GdkImlibImage *im, gpointer data);
void ghack_map_clear(GtkWidget *win, gpointer data);
static void ghack_map_display(GtkWidget *win, boolean block, gpointer data);
static void ghack_map_cliparound(GtkWidget *win, int x, int y, gpointer data);
static void ghack_map_window_zoom(GtkAdjustment *adj, gpointer data);
/* The following XPM is the artwork of Warwick Allison
* <warwick@troll.no>. It has been borrowed from
* the most excellent NetHackQt, until such time as
* we can come up with something better.
*
* More information about NetHackQt can be had from:
* http://www.troll.no/~warwick/nethack/
*/
/* XPM */
static char *pet_mark_xpm[] = {
/* width height ncolors chars_per_pixel */
"8 7 2 1",
/* colors */
". c None", " c #FF0000",
/* pixels */
"........", ".. . .", ". ", ". ",
".. .", "... ..", ".... ..."
};
/* NAME:
* ghack_init_map_window( )
*
* ARGUMENTS:
* NONE
*
* RETURNS:
* GtkWidget*
*
* PURPOSE:
* Create the basic map necessities. Create a canvas;
* give it a background. Attach all the right signals
* to all the right places. Generally prepare the map
* to behave properly.
*/
GtkWidget *
ghack_init_map_window()
{
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *table;
GtkWidget *frame;
GtkWidget *w;
GtkWidget *hSeparator;
GtkAdjustment *adj;
GnomeCanvasImage *bg;
double width, height, x, y;
int i;
width = COLNO * ghack_glyph_width();
height = ROWNO * ghack_glyph_height();
vbox = gtk_vbox_new(FALSE, 4);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 4);
gtk_widget_show(vbox);
/* Add in a horiz seperator */
hSeparator = gtk_hseparator_new();
gtk_box_pack_start(GTK_BOX(vbox), hSeparator, FALSE, FALSE, 2);
gtk_widget_show(hSeparator);
hbox = gtk_hbox_new(FALSE, 4);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show(hbox);
/* Create the Zoom spinbutton.
*/
ghack_map.zoom = 1.0;
w = gtk_label_new("Zoom:");
gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
gtk_widget_show(w);
adj =
GTK_ADJUSTMENT(gtk_adjustment_new(1.00, 0.5, 3.00, 0.05, 0.50, 0.50));
w = gtk_spin_button_new(adj, 0.5, 2);
gtk_widget_set_usize(w, 50, 0);
gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
gtk_widget_show(w);
/* Canvas and scrollbars
*/
gtk_widget_push_visual(gdk_imlib_get_visual());
gtk_widget_push_colormap(gdk_imlib_get_colormap());
ghack_map.canvas = GNOME_CANVAS(gnome_canvas_new());
// gtk_widget_push_visual(gdk_rgb_get_visual());
// gtk_widget_push_colormap(gdk_rgb_get_cmap());
// ghack_map.canvas = GNOME_CANVAS (gnome_canvas_new_aa());
gtk_widget_pop_colormap();
gtk_widget_pop_visual();
gtk_widget_show(GTK_WIDGET(ghack_map.canvas));
table = gtk_table_new(2, 2, FALSE);
gtk_table_set_row_spacings(GTK_TABLE(table), 4);
gtk_table_set_col_spacings(GTK_TABLE(table), 4);
gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0);
gtk_widget_show(table);
frame = gtk_frame_new(NULL);
ghack_map.frame = frame;
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
gtk_table_attach(GTK_TABLE(table), frame, 0, 1, 0, 1,
GTK_EXPAND | GTK_FILL | GTK_SHRINK,
GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0);
gtk_widget_show(frame);
gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(ghack_map.canvas));
gnome_canvas_set_scroll_region(GNOME_CANVAS(ghack_map.canvas), 0, 0,
width + 2 * ghack_glyph_width(),
height + 2 * ghack_glyph_height());
gnome_canvas_set_pixels_per_unit(GNOME_CANVAS(ghack_map.canvas), 1.0);
w = gtk_hscrollbar_new(GTK_LAYOUT(ghack_map.canvas)->hadjustment);
gtk_table_attach(GTK_TABLE(table), w, 0, 1, 1, 2,
GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL, 0, 0);
gtk_widget_show(w);
w = gtk_vscrollbar_new(GTK_LAYOUT(ghack_map.canvas)->vadjustment);
gtk_table_attach(GTK_TABLE(table), w, 1, 2, 0, 1, GTK_FILL,
GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0);
gtk_widget_show(w);
myCanvasGroup = GNOME_CANVAS_GROUP(gnome_canvas_item_new(
gnome_canvas_root(GNOME_CANVAS(ghack_map.canvas)),
gnome_canvas_group_get_type(), "x", 0.0, "y", 0.0, NULL));
/* Tile the map background with a pretty image */
background = gdk_imlib_load_image((char *) "mapbg.xpm");
if (background == NULL) {
g_warning(
"Bummer! Failed to load the map background image (mapbg.xpm)!");
} else {
gdk_imlib_render(background, background->rgb_width,
background->rgb_height);
/* Tile the map background */
for (y = 0; y < height + background->rgb_height;
y += background->rgb_height) {
for (x = 0; x < width + background->rgb_width;
x += background->rgb_width) {
bg = GNOME_CANVAS_IMAGE(gnome_canvas_item_new(
myCanvasGroup, gnome_canvas_image_get_type(), "x",
(double) x, "y", (double) y, "width",
(double) background->rgb_width, "height",
(double) background->rgb_height, "image", background,
"anchor", (GtkAnchorType) GTK_ANCHOR_CENTER, NULL));
gnome_canvas_item_lower_to_bottom(GNOME_CANVAS_ITEM(bg));
}
}
}
/* ghack_map.map is an array of canvas images. Each cell of
* the array will contain one tile. Here, we create the
* space for the cells and then create the cells for easy
* access later.
*/
for (i = 0, y = 0; y < height; y += ghack_glyph_height()) {
for (x = 0; x < width; x += ghack_glyph_width()) {
ghack_map.map[i++] = GNOME_CANVAS_IMAGE(gnome_canvas_item_new(
myCanvasGroup, gnome_canvas_image_get_type(), "x", (double) x,
"y", (double) y, "width", (double) ghack_glyph_width(),
"height", (double) ghack_glyph_height(), "anchor",
GTK_ANCHOR_NORTH_WEST, NULL));
}
}
/* Set up the pet mark image */
petmark = gdk_imlib_create_image_from_xpm_data(pet_mark_xpm);
if (petmark == NULL) {
g_warning("Bummer! Failed to load the pet_mark image!");
} else {
gdk_imlib_render(petmark, petmark->rgb_width, petmark->rgb_height);
/* ghack_map.overlay is an array of canvas images used to
* overlay tile images...
*/
for (i = 0, y = 0; y < height; y += ghack_glyph_height()) {
for (x = 0; x < width; x += ghack_glyph_width()) {
ghack_map.overlay[i] =
GNOME_CANVAS_IMAGE(gnome_canvas_item_new(
myCanvasGroup, gnome_canvas_image_get_type(), "x",
(double) x, "y", (double) y, "width",
(double) petmark->rgb_width, "height",
(double) petmark->rgb_height, "image", petmark,
"anchor", GTK_ANCHOR_NORTH_WEST, NULL));
gnome_canvas_item_lower_to_bottom(
GNOME_CANVAS_ITEM(ghack_map.overlay[i++]));
}
}
}
/* Resize the canvas when the spinbutton changes
*/
gtk_signal_connect(GTK_OBJECT(adj), "value_changed",
(GtkSignalFunc) ghack_map_window_zoom,
ghack_map.canvas);
/* Game signals
*/
gtk_signal_connect(GTK_OBJECT(vbox), "ghack_curs",
GTK_SIGNAL_FUNC(ghack_map_cursor_to), NULL);
gtk_signal_connect(GTK_OBJECT(vbox), "ghack_putstr",
GTK_SIGNAL_FUNC(ghack_map_putstr), NULL);
gtk_signal_connect(GTK_OBJECT(vbox), "ghack_print_glyph",
GTK_SIGNAL_FUNC(ghack_map_print_glyph), NULL);
gtk_signal_connect(GTK_OBJECT(vbox), "ghack_clear",
GTK_SIGNAL_FUNC(ghack_map_clear), NULL);
gtk_signal_connect(GTK_OBJECT(vbox), "ghack_display",
GTK_SIGNAL_FUNC(ghack_map_display), NULL);
gtk_signal_connect(GTK_OBJECT(vbox), "ghack_cliparound",
GTK_SIGNAL_FUNC(ghack_map_cliparound), NULL);
gtk_signal_connect(GTK_OBJECT(ghack_map.canvas), "button_press_event",
GTK_SIGNAL_FUNC(ghack_handle_button_press), NULL);
gtk_signal_connect(GTK_OBJECT(ghack_map.canvas), "gnome_delay_output",
GTK_SIGNAL_FUNC(ghack_delay), NULL);
return GTK_WIDGET(vbox);
}
/* NAME:
* ghack_map_window_zoom
*
* ARGUMENTS:
* double zoom -- The zoom factor
*
* RETURNS:
* Nothing.
*
* PURPOSE:
* Zoom the map image in and out. This should allow the user to
* dynamically scale the map. Ideally, the background should
* *NOT* scale, but this may be impractical.
*/
static void
ghack_map_window_zoom(GtkAdjustment *adj, gpointer data)
{
if (adj->value > 3.0)
adj->value = 3.0;
if (adj->value < 0.5)
adj->value = 0.5;
ghack_map.zoom = adj->value;
gnome_canvas_set_pixels_per_unit(data, adj->value);
}
void
ghack_map_cursor_to(GtkWidget *win, int x, int y, gpointer data)
{
GnomeCanvasGroup *group;
static GnomeCanvasRE *cursor = NULL;
double x1, y1, x2, y2;
float hp;
guint r, g, b;
x1 = x * ghack_glyph_width() - 1;
y1 = y * ghack_glyph_height() - 1;
x2 = x1 + ghack_glyph_width() + 2;
y2 = y1 + ghack_glyph_height() + 2;
hp = u.mtimedone ? (u.mhmax ? (float) u.mh / u.mhmax : 1)
: (u.uhpmax ? (float) u.uhp / u.uhpmax : 1);
r = 255;
g = (hp >= 0.75) ? 255 : (hp >= 0.25 ? 255 * 2 * (hp - 0.25) : 0);
b = (hp >= 0.75) ? 255 * 4 * (hp - 0.75)
: (hp >= 0.25 ? 0 : 255 * 4 * (0.25 - hp));
group = gnome_canvas_root(GNOME_CANVAS(ghack_map.canvas));
if (!cursor) {
cursor = GNOME_CANVAS_RE(gnome_canvas_item_new(
group, gnome_canvas_rect_get_type(), "width_units", 1.0, NULL));
}
gnome_canvas_item_set(GNOME_CANVAS_ITEM(cursor), "outline_color_rgba",
GNOME_CANVAS_COLOR(r, g, b), "x1", x1, "y1", y1,
"x2", x2, "y2", y2, NULL);
gnome_canvas_item_raise_to_top(GNOME_CANVAS_ITEM(cursor));
gnome_canvas_item_show(GNOME_CANVAS_ITEM(cursor));
}
void
ghack_map_putstr(GtkWidget *win, int attr, const char *text, gpointer data)
{
g_warning("Fixme!!! ghack_map_putstr is not implemented");
}
/* NAME:
* ghack_map_print_glyph( )
*
* ARGUMENTS:
* XCHAR_P x, y -- The coordinates where which to print the glyph
* GdkImlibImage* glyph -- The glyph image to print
*
* RETURNS:
* Nothing.
*
* PURPOSE:
* Draw the glyph-tile at the specified coordinates.
*/
void
ghack_map_print_glyph(GtkObject *win, guint x, guint y, GdkImlibImage *im,
gpointer data)
{
GnomeCanvasGroup *group;
int i = y * COLNO + x;
int glyph = glyph_at(x, y);
GnomeCanvasImage *canvas_image = GNOME_CANVAS_IMAGE(ghack_map.map[i]);
group = gnome_canvas_root(GNOME_CANVAS(ghack_map.canvas));
gnome_canvas_item_set(GNOME_CANVAS_ITEM(canvas_image), "image", im, NULL);
gnome_canvas_item_show(GNOME_CANVAS_ITEM(canvas_image));
canvas_image = GNOME_CANVAS_IMAGE(ghack_map.overlay[i]);
if (x == u.ux && y == u.uy)
ghack_map_cliparound(NULL, x, y, NULL);
if (glyph_is_pet(glyph)
#ifdef TEXTCOLOR
&& iflags.hilite_pet
#endif
) {
gnome_canvas_item_raise_to_top(GNOME_CANVAS_ITEM(canvas_image));
gnome_canvas_item_show(GNOME_CANVAS_ITEM(canvas_image));
} else {
gnome_canvas_item_hide(GNOME_CANVAS_ITEM(canvas_image));
}
}
/* NAME:
* ghack_map_clear( )
*
* ARGUMENTS:
* NONE
*
* RETURNS:
* Nothing.
*
* PURPOSE:
* Clear the map by hiding all the map tiles.
*/
void
ghack_map_clear(GtkWidget *win, gpointer data)
{
int i;
for (i = 0; i < ROWNO * COLNO; i++) {
if (GNOME_IS_CANVAS_IMAGE(ghack_map.map[i])) {
gnome_canvas_item_hide(GNOME_CANVAS_ITEM(ghack_map.map[i]));
}
if (GNOME_IS_CANVAS_IMAGE(ghack_map.overlay[i])) {
gnome_canvas_item_hide(GNOME_CANVAS_ITEM(ghack_map.overlay[i]));
}
}
gnome_canvas_update_now(GNOME_CANVAS(ghack_map.canvas));
}
void
ghack_map_display(GtkWidget *win, boolean block, gpointer data)
{
gtk_widget_show_all(GTK_WIDGET(win));
}
void
ghack_map_cliparound(GtkWidget *win, int x, int y, gpointer data)
{
int map_width, map_height;
int to_x, to_y;
int cur_x, cur_y;
int width, height, half_width, half_height;
x *= ghack_glyph_width() * ghack_map.zoom;
y *= ghack_glyph_height() * ghack_map.zoom;
map_width = COLNO * ghack_glyph_width() * ghack_map.zoom;
map_height = ROWNO * ghack_glyph_height() * ghack_map.zoom;
gdk_window_get_size(GTK_LAYOUT(ghack_map.canvas)->bin_window, &width,
&height);
gnome_canvas_get_scroll_offsets(ghack_map.canvas, &cur_x, &cur_y);
half_width = width * 0.5;
half_height = height * 0.5;
if (((x - cur_x) < (width * 0.25)) || ((x - cur_x) > (width * 0.75))) {
to_x = ((x - half_width) > 0) ? x - half_width : 0;
to_x = ((x + half_width) > map_width) ? map_width - 2 * half_width
: to_x;
} else {
to_x = cur_x;
}
if (((y - cur_y) < (height * 0.25)) || ((y - cur_y) > (height * 0.75))) {
to_y = ((y - half_height) > 0) ? y - half_height : 0;
to_y = ((y + half_height) > map_height) ? map_height - 2 * half_height
: to_y;
} else {
to_y = cur_y;
}
if (to_x != cur_x || to_y != cur_y)
gnome_canvas_scroll_to(ghack_map.canvas, to_x, to_y);
// gnome_canvas_update_now ( ghack_map.canvas);
}
void
ghack_reinit_map_window()
{
GnomeCanvasImage *bg;
double width, height, x, y;
int i;
/* ghack_map_clear(NULL, NULL); */
width = COLNO * ghack_glyph_width();
height = ROWNO * ghack_glyph_height();
gnome_canvas_set_scroll_region(GNOME_CANVAS(ghack_map.canvas), 0, 0,
width + 2 * ghack_glyph_width(),
height + 2 * ghack_glyph_height());
/* remove everything currently in the canvas map */
gtk_object_destroy(GTK_OBJECT(myCanvasGroup));
/* Put some groups back */
myCanvasGroup = GNOME_CANVAS_GROUP(gnome_canvas_item_new(
gnome_canvas_root(GNOME_CANVAS(ghack_map.canvas)),
gnome_canvas_group_get_type(), "x", 0.0, "y", 0.0, NULL));
/* Tile the map background with a pretty image */
if (background != NULL) {
/* Tile the map background */
for (y = 0; y < height + background->rgb_height;
y += background->rgb_height) {
for (x = 0; x < width + background->rgb_width;
x += background->rgb_width) {
bg = GNOME_CANVAS_IMAGE(gnome_canvas_item_new(
myCanvasGroup, gnome_canvas_image_get_type(), "x",
(double) x, "y", (double) y, "width",
(double) background->rgb_width, "height",
(double) background->rgb_height, "image", background,
"anchor", (GtkAnchorType) GTK_ANCHOR_CENTER, NULL));
gnome_canvas_item_lower_to_bottom(GNOME_CANVAS_ITEM(bg));
}
}
}
/* ghack_map.map is an array of canvas images. Each cell of
* the array will contain one tile. Here, we create the
* space for the cells and then create the cells for easy
* access later.
*/
for (i = 0, y = 0; y < height; y += ghack_glyph_height()) {
for (x = 0; x < width; x += ghack_glyph_width()) {
ghack_map.map[i++] = GNOME_CANVAS_IMAGE(gnome_canvas_item_new(
myCanvasGroup, gnome_canvas_image_get_type(), "x", (double) x,
"y", (double) y, "width", (double) ghack_glyph_width(),
"height", (double) ghack_glyph_height(), "anchor",
GTK_ANCHOR_NORTH_WEST, NULL));
}
}
if (petmark != NULL) {
/* ghack_map.overlay is an array of canvas images used to
* overlay tile images...
*/
for (i = 0, y = 0; y < height; y += ghack_glyph_height()) {
for (x = 0; x < width; x += ghack_glyph_width()) {
ghack_map.overlay[i] =
GNOME_CANVAS_IMAGE(gnome_canvas_item_new(
myCanvasGroup, gnome_canvas_image_get_type(), "x",
(double) x, "y", (double) y, "width",
(double) petmark->rgb_width, "height",
(double) petmark->rgb_height, "image", petmark,
"anchor", GTK_ANCHOR_NORTH_WEST, NULL));
gnome_canvas_item_lower_to_bottom(
GNOME_CANVAS_ITEM(ghack_map.overlay[i++]));
}
}
}
ghack_map_cliparound(NULL, u.ux, u.uy, NULL);
ghack_map_cursor_to(NULL, u.ux, u.uy, NULL);
gnome_canvas_update_now(ghack_map.canvas);
doredraw();
}

View File

@@ -0,0 +1,16 @@
/* NetHack 3.6 gnmap.h $NHDT-Date: 1432512807 2015/05/25 00:13:27 $ $NHDT-Branch: master $:$NHDT-Revision: 1.7 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef GnomeHackMapWindow_h
#define GnomeHackMapWindow_h
#include <gnome.h>
#include <gdk_imlib.h>
#include "config.h"
#include "global.h"
GtkWidget *ghack_init_map_window(void);
void ghack_reinit_map_window(void);
#endif /* GnomeHackMapWindow_h */

741
outdated/win/gnome/gnmenu.c Normal file
View File

@@ -0,0 +1,741 @@
/* NetHack 3.6 gnmenu.c $NHDT-Date: 1432512805 2015/05/25 00:13:25 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#include <string.h>
#include <gtk/gtk.h>
#include <gnome.h>
#include "gnmenu.h"
#include "gnmain.h"
#include "gnbind.h"
#include "func_tab.h"
typedef enum { MenuUnknown = 0, MenuText, MenuMenu } MenuWinType;
typedef struct {
ANY_P identifier;
gchar accelerator[BUFSZ];
int itemNumber;
int selected;
} menuItem;
typedef struct {
int curItem;
int numRows;
int charIdx;
guint32 lastTime;
} extMenu;
static GdkColor color_blue = { 0, 0, 0, 0xffff };
static void
ghack_menu_window_key(GtkWidget *menuWin, GdkEventKey *event, gpointer data)
{
int i, numRows;
menuItem *item;
MenuWinType isMenu;
isMenu = (MenuWinType) GPOINTER_TO_INT(
gtk_object_get_data(GTK_OBJECT(menuWin), "isMenu"));
if (isMenu == MenuMenu) {
GtkWidget *clist;
gint selection_mode;
clist = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(menuWin), "clist"));
g_assert(clist != NULL);
numRows = GPOINTER_TO_INT(
gtk_object_get_data(GTK_OBJECT(clist), "numRows"));
selection_mode = GPOINTER_TO_INT(
gtk_object_get_data(GTK_OBJECT(clist), "selection_mode"));
for (i = 0; i <= numRows; ++i) {
item = (menuItem *) gtk_clist_get_row_data(GTK_CLIST(clist), i);
if (item == NULL)
continue;
if (!strcmp(item->accelerator, ""))
continue;
if ((!strcmp(item->accelerator, event->string))
|| ((selection_mode == GTK_SELECTION_MULTIPLE)
&& (event->keyval == ','))) {
if (item->selected) {
gtk_clist_unselect_row(GTK_CLIST(clist), item->itemNumber,
0);
item->selected = FALSE;
} else {
gtk_clist_select_row(GTK_CLIST(clist), item->itemNumber,
0);
if (gtk_clist_row_is_visible(GTK_CLIST(clist),
item->itemNumber)
!= GTK_VISIBILITY_FULL)
gtk_clist_moveto(GTK_CLIST(clist), item->itemNumber,
0, 0.5, 0);
item->selected = TRUE;
}
}
}
}
}
static void
ghack_menu_row_selected(GtkCList *clist, int row, int col, GdkEvent *event)
{
/* FIXME: Do something */
}
void
ghack_menu_window_clear(GtkWidget *menuWin, gpointer data)
{
MenuWinType isMenu;
int i, numRows;
menuItem *item;
isMenu = (MenuWinType) GPOINTER_TO_INT(
gtk_object_get_data(GTK_OBJECT(menuWin), "isMenu"));
if (isMenu == MenuMenu) {
GtkWidget *clist;
clist = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(menuWin), "clist"));
g_assert(clist != NULL);
/* destroy existing menu data, if any */
if (clist) {
/* destroy all the row_data we stored in the clist */
numRows = GPOINTER_TO_INT(
gtk_object_get_data(GTK_OBJECT(clist), "numRows"));
for (i = 0; i < numRows; i++) {
item =
(menuItem *) gtk_clist_get_row_data(GTK_CLIST(clist), i);
if (item != NULL) {
g_free(item);
gtk_clist_set_row_data(GTK_CLIST(clist), i,
(gpointer) NULL);
}
}
gtk_object_set_data(GTK_OBJECT(clist), "numItems",
GINT_TO_POINTER(-1));
gtk_clist_clear(GTK_CLIST(clist));
}
}
else if (isMenu == MenuText) {
GnomeLess *gless;
gless = GNOME_LESS(gtk_object_get_data(GTK_OBJECT(menuWin), "gless"));
g_assert(gless != NULL);
gtk_editable_delete_text(GTK_EDITABLE(gless->text), 0, 0);
}
}
void
ghack_menu_window_display(GtkWidget *menuWin, gboolean blocking,
gpointer data)
{
// if(blocking) {
gnome_dialog_close_hides(GNOME_DIALOG(menuWin), TRUE);
gnome_dialog_set_close(GNOME_DIALOG(menuWin), TRUE);
gnome_dialog_run_and_close(GNOME_DIALOG(menuWin));
//}
// else {
// gtk_widget_show(menuWin);
//}
}
gint
ghack_menu_hide(GtkWidget *menuWin, GdkEvent *event, gpointer data)
{
gtk_widget_hide(menuWin);
return FALSE; /* FIXME: what is correct result here? */
}
void
ghack_menu_window_start_menu(GtkWidget *menuWin, gpointer data)
{
GtkWidget *frame1, *swin, *clist;
MenuWinType isMenu;
g_assert(menuWin != NULL);
g_assert(data == NULL);
/* destroy existing menu data, if any */
frame1 = gtk_object_get_data(GTK_OBJECT(menuWin), "frame1");
if (frame1)
gtk_widget_destroy(frame1);
isMenu = MenuMenu;
gtk_object_set_data(GTK_OBJECT(menuWin), "isMenu",
GINT_TO_POINTER(isMenu));
gtk_widget_set_usize(GTK_WIDGET(menuWin), 500, 400);
gtk_window_set_policy(GTK_WINDOW(menuWin), TRUE, TRUE, FALSE);
frame1 = gtk_frame_new("Make your selection");
g_assert(frame1 != NULL);
gtk_object_set_data(GTK_OBJECT(menuWin), "frame1", frame1);
gtk_widget_show(GTK_WIDGET(frame1));
gtk_container_set_border_width(GTK_CONTAINER(frame1), 5);
gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(menuWin)->vbox), frame1, TRUE,
TRUE, 0);
swin = gtk_scrolled_window_new(NULL, NULL);
g_assert(swin != NULL);
gtk_object_set_data(GTK_OBJECT(menuWin), "swin", swin);
gtk_widget_show(GTK_WIDGET(swin));
gtk_container_add(GTK_CONTAINER(frame1), swin);
clist = gtk_clist_new(4);
g_assert(clist != NULL);
gtk_object_set_data(GTK_OBJECT(menuWin), "clist", clist);
gtk_widget_show(GTK_WIDGET(clist));
gtk_container_add(GTK_CONTAINER(swin), clist);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_signal_connect(GTK_OBJECT(clist), "select_row",
GTK_SIGNAL_FUNC(ghack_menu_row_selected), NULL);
gtk_object_set_data(GTK_OBJECT(clist), "numItems", GINT_TO_POINTER(-1));
}
int
ghack_menu_window_select_menu(GtkWidget *menuWin, MENU_ITEM_P **_selected,
gint how)
{
gint rc;
guint num_sel, i, idx;
GtkWidget *clist;
GList *cur;
MENU_ITEM_P *selected = NULL;
menuItem *item;
g_assert(_selected != NULL);
*_selected = NULL;
if (how == PICK_NONE) {
gnome_dialog_close_hides(GNOME_DIALOG(menuWin), TRUE);
rc = gnome_dialog_run_and_close(GNOME_DIALOG(menuWin));
return (rc == 1 ? -1 : 0);
}
clist = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(menuWin), "clist"));
g_assert(clist != NULL);
gtk_object_set_data(GTK_OBJECT(clist), "selection_mode",
GINT_TO_POINTER((how == PICK_ANY)
? GTK_SELECTION_MULTIPLE
: GTK_SELECTION_SINGLE));
gtk_clist_set_selection_mode(GTK_CLIST(clist),
(how == PICK_ANY) ? GTK_SELECTION_MULTIPLE
: GTK_SELECTION_SINGLE);
gnome_dialog_close_hides(GNOME_DIALOG(menuWin), TRUE);
rc = gnome_dialog_run_and_close(GNOME_DIALOG(menuWin));
if ((rc == 1) || (GTK_CLIST(clist)->selection == NULL)) {
return (-1);
}
num_sel = g_list_length(GTK_CLIST(clist)->selection);
if (num_sel < 1) {
return (-1);
}
/* fill in array with selections from clist */
selected = g_new0(MENU_ITEM_P, num_sel);
g_assert(selected != NULL);
cur = GTK_CLIST(clist)->selection;
i = 0;
while (cur) {
g_assert(i < num_sel);
/* grab row number from clist selection list */
idx = GPOINTER_TO_INT(cur->data);
item = (menuItem *) gtk_clist_get_row_data(GTK_CLIST(clist), idx);
selected[i].item = item->identifier;
selected[i].count = -1;
cur = g_list_next(cur);
i++;
}
*_selected = selected;
return ((int) num_sel);
}
void
ghack_menu_window_add_menu(GtkWidget *menuWin, gpointer menu_item,
gpointer data)
{
GHackMenuItem *item;
GtkWidget *clist;
gchar buf[BUFSZ] = "", accelBuf[BUFSZ] = "";
gchar *pbuf;
char *text[4] = { buf, NULL, NULL, NULL };
gint nCurrentRow = -1, numItems = -1;
MenuWinType isMenu;
GtkStyle *bigStyle = NULL;
gboolean item_selectable;
GdkImlibImage *image;
static gboolean special;
g_assert(menu_item != NULL);
item = (GHackMenuItem *) menu_item;
item_selectable = (item->identifier->a_int == 0) ? FALSE : TRUE;
isMenu = (MenuWinType) GPOINTER_TO_INT(
gtk_object_get_data(GTK_OBJECT(menuWin), "isMenu"));
clist = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(menuWin), "clist"));
g_assert(clist != NULL);
/* This is a special kludge to make the special hidden help menu item work
* as designed */
if (special == TRUE) {
special = FALSE;
item_selectable = TRUE;
}
if (!strcmp(item->str, "The NetHack license.")) {
special = TRUE;
}
if (item->str) {
/* First, make a new blank entry in the clist */
nCurrentRow = gtk_clist_append(GTK_CLIST(clist), text);
if (item->glyph != NO_GLYPH) {
image = ghack_image_from_glyph(item->glyph, FALSE);
if (image == NULL || image->pixmap == NULL) {
g_warning("Bummer -- having to force rendering for glyph %d!",
item->glyph);
/* wierd -- pixmap is NULL so retry rendering it */
image = ghack_image_from_glyph(item->glyph, TRUE);
}
if (image == NULL || image->pixmap == NULL) {
g_error("Aiiee! glyph is still NULL for item\n\"%s\"",
item->str);
} else
gtk_clist_set_pixmap(GTK_CLIST(clist), nCurrentRow, 1,
gdk_imlib_move_image(image),
gdk_imlib_move_mask(image));
}
if (item->accelerator) {
/* FIXME: handle accelerator, */
g_snprintf(accelBuf, sizeof(accelBuf), "%c ", item->accelerator);
gtk_clist_set_text(GTK_CLIST(clist), nCurrentRow, 0, accelBuf);
g_snprintf(buf, sizeof(buf), "%s", item->str);
gtk_clist_set_text(GTK_CLIST(clist), nCurrentRow, 2, buf);
} else {
if (item->group_accel) {
/* FIXME: maybe some day I should try to handle
* group accelerators... */
}
if (((item->attr == 0) && (item->identifier->a_int != 0))
|| (special == TRUE)) {
numItems = GPOINTER_TO_INT(gtk_object_get_data(
GTK_OBJECT(clist), "numItems")) + 1;
/* Ok, now invent a unique accelerator */
if (('a' + numItems) <= 'z') {
g_snprintf(accelBuf, sizeof(accelBuf), "%c ",
'a' + numItems);
gtk_clist_set_text(GTK_CLIST(clist), nCurrentRow, 0,
accelBuf);
} else if (('A' + numItems - 26) <= 'Z') {
g_snprintf(accelBuf, sizeof(accelBuf), "%c ",
'A' + numItems - 26);
gtk_clist_set_text(GTK_CLIST(clist), nCurrentRow, 0,
accelBuf);
} else {
accelBuf[0] = buf[0] = 0;
}
g_snprintf(buf, sizeof(buf), "%s", item->str);
gtk_clist_set_text(GTK_CLIST(clist), nCurrentRow, 2, buf);
gtk_object_set_data(GTK_OBJECT(clist), "numItems",
GINT_TO_POINTER(numItems));
/* This junk is to specially handle the options menu */
pbuf = strstr(buf, " [");
if (pbuf == NULL) {
pbuf = strstr(buf, "\t[");
}
if (pbuf != NULL) {
*pbuf = 0;
pbuf++;
gtk_clist_set_text(GTK_CLIST(clist), nCurrentRow, 3,
pbuf);
}
}
/* FIXME: handle more than 26*2 accelerators (but how?
* since I only have so many keys to work with???)
else
{
foo();
}
*/
else {
g_snprintf(buf, sizeof(buf), "%s", item->str);
pbuf = strstr(buf, " [");
if (pbuf == NULL) {
pbuf = strstr(buf, "\t[");
}
if (pbuf != NULL) {
*pbuf = 0;
pbuf++;
gtk_clist_set_text(GTK_CLIST(clist), nCurrentRow, 3,
pbuf);
}
gtk_clist_set_text(GTK_CLIST(clist), nCurrentRow, 2, buf);
}
}
if (item->attr) {
switch (item->attr) {
case ATR_ULINE:
case ATR_BOLD:
case ATR_BLINK:
case ATR_INVERSE:
bigStyle = gtk_style_copy(GTK_WIDGET(clist)->style);
g_assert(bigStyle != NULL);
gdk_font_unref(bigStyle->font);
bigStyle->font =
gdk_font_load("-misc-fixed-*-*-*-*-20-*-*-*-*-*-*-*");
bigStyle->fg[GTK_STATE_NORMAL] = color_blue;
gtk_clist_set_cell_style(GTK_CLIST(clist), nCurrentRow, 2,
bigStyle);
item_selectable = FALSE;
}
}
g_assert(nCurrentRow >= 0);
gtk_clist_set_selectable(GTK_CLIST(clist), nCurrentRow,
item_selectable);
if (item_selectable == TRUE && item->presel == TRUE) {
/* pre-select this item */
gtk_clist_select_row(GTK_CLIST(clist), nCurrentRow, 0);
}
gtk_object_set_data(GTK_OBJECT(clist), "numRows",
GINT_TO_POINTER(nCurrentRow));
/* We have to allocate memory here, since the menu_item currently
* lives on the stack, and will otherwise go to the great bit bucket
* in the sky as soon as this function exits, which would leave a
* pointer to crap in the row_data. Use g_memdup to make a private,
* persistant copy of the item identifier.
*
* We need to arrange to blow away this memory somewhere (like
* ghack_menu_destroy and ghack_menu_window_clear for example).
*
* -Erik
*/
{
menuItem newItem;
menuItem *pNewItem;
newItem.identifier = *item->identifier;
newItem.itemNumber = nCurrentRow;
newItem.selected = FALSE;
newItem.accelerator[0] = 0;
/* only copy 1 char, since accel keys are by definition 1 char */
if (accelBuf[0]) {
strncpy(newItem.accelerator, accelBuf, 1);
}
newItem.accelerator[1] = 0;
pNewItem = g_memdup(&newItem, sizeof(menuItem));
gtk_clist_set_row_data(GTK_CLIST(clist), nCurrentRow,
(gpointer) pNewItem);
}
}
/* Now adjust the column widths to match the contents */
gtk_clist_columns_autosize(GTK_CLIST(clist));
}
void
ghack_menu_window_end_menu(GtkWidget *menuWin, gpointer data)
{
const char *p = (const char *) data;
if ((p) && (*p)) {
GtkWidget *frame1 =
gtk_object_get_data(GTK_OBJECT(menuWin), "frame1");
g_assert(frame1 != NULL);
gtk_frame_set_label(GTK_FRAME(frame1), p);
}
}
void
ghack_menu_window_put_string(GtkWidget *menuWin, int attr, const char *text,
gpointer data)
{
GnomeLess *gless;
MenuWinType isMenu;
if (text == NULL)
return;
isMenu = (MenuWinType) GPOINTER_TO_INT(
gtk_object_get_data(GTK_OBJECT(menuWin), "isMenu"));
if (isMenu == MenuText) {
gless = GNOME_LESS(gtk_object_get_data(GTK_OBJECT(menuWin), "gless"));
g_assert(gless != NULL);
g_assert(gless->text != NULL);
g_assert(GTK_IS_TEXT(gless->text));
/* Don't bother with attributes yet */
gtk_text_insert(GTK_TEXT(gless->text), NULL, NULL, NULL, text, -1);
gtk_text_insert(GTK_TEXT(gless->text), NULL, NULL, NULL, "\n", -1);
}
else if (isMenu == MenuUnknown) {
isMenu = MenuText;
gtk_object_set_data(GTK_OBJECT(menuWin), "isMenu",
GINT_TO_POINTER(isMenu));
gtk_widget_set_usize(GTK_WIDGET(menuWin), 500, 400);
gtk_window_set_policy(GTK_WINDOW(menuWin), TRUE, TRUE, FALSE);
gless = GNOME_LESS(gnome_less_new());
g_assert(gless != NULL);
gtk_object_set_data(GTK_OBJECT(menuWin), "gless", gless);
gtk_widget_show(GTK_WIDGET(gless));
gnome_less_show_string(gless, text);
gtk_text_insert(GTK_TEXT(gless->text), NULL, NULL, NULL, "\n", -1);
gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(menuWin)->vbox),
GTK_WIDGET(gless), TRUE, TRUE, 0);
}
}
void
ghack_menu_destroy(GtkWidget *menuWin, gpointer data)
{
MenuWinType isMenu;
isMenu = (MenuWinType) GPOINTER_TO_INT(
gtk_object_get_data(GTK_OBJECT(menuWin), "isMenu"));
if (isMenu == MenuText) {
GnomeLess *gless;
gless = GNOME_LESS(gtk_object_get_data(GTK_OBJECT(menuWin), "gless"));
g_assert(gless != NULL);
g_assert(gless->text != NULL);
g_assert(GTK_IS_TEXT(gless->text));
gtk_widget_destroy(GTK_WIDGET(gless));
}
else if (isMenu == MenuMenu) {
GtkWidget *frame1, *swin, *clist;
/* destroy existing menu data, if any */
clist = gtk_object_get_data(GTK_OBJECT(menuWin), "clist");
if (clist) {
/* destroy all the row_data we stored in the clist */
int i, numRows;
menuItem *item;
numRows = GPOINTER_TO_INT(
gtk_object_get_data(GTK_OBJECT(clist), "numRows"));
for (i = 0; i < numRows; i++) {
item =
(menuItem *) gtk_clist_get_row_data(GTK_CLIST(clist), i);
if (item != NULL) {
g_free(item);
gtk_clist_set_row_data(GTK_CLIST(clist), i,
(gpointer) NULL);
}
}
gtk_object_set_data(GTK_OBJECT(clist), "numItems",
GINT_TO_POINTER(-1));
gtk_widget_destroy(clist);
}
swin = gtk_object_get_data(GTK_OBJECT(menuWin), "swin");
if (swin) {
gtk_widget_destroy(swin);
}
frame1 = gtk_object_get_data(GTK_OBJECT(menuWin), "frame1");
if (frame1) {
gtk_widget_destroy(frame1);
}
}
gnome_delete_nhwindow_by_reference(menuWin);
}
GtkWidget *
ghack_init_menu_window(void)
{
GtkWidget *menuWin = NULL;
GtkWidget *parent = ghack_get_main_window();
menuWin = gnome_dialog_new("GnomeHack", GNOME_STOCK_BUTTON_OK,
GNOME_STOCK_BUTTON_CANCEL, NULL);
gnome_dialog_set_default(GNOME_DIALOG(menuWin), 0);
gtk_signal_connect(GTK_OBJECT(menuWin), "destroy",
GTK_SIGNAL_FUNC(ghack_menu_destroy), NULL);
gtk_signal_connect(GTK_OBJECT(menuWin), "delete_event",
GTK_SIGNAL_FUNC(ghack_menu_hide), NULL);
gtk_signal_connect(GTK_OBJECT(menuWin), "ghack_clear",
GTK_SIGNAL_FUNC(ghack_menu_window_clear), NULL);
gtk_signal_connect(GTK_OBJECT(menuWin), "ghack_display",
GTK_SIGNAL_FUNC(ghack_menu_window_display), NULL);
gtk_signal_connect(GTK_OBJECT(menuWin), "ghack_start_menu",
GTK_SIGNAL_FUNC(ghack_menu_window_start_menu), NULL);
gtk_signal_connect(GTK_OBJECT(menuWin), "ghack_add_menu",
GTK_SIGNAL_FUNC(ghack_menu_window_add_menu), NULL);
gtk_signal_connect(GTK_OBJECT(menuWin), "ghack_end_menu",
GTK_SIGNAL_FUNC(ghack_menu_window_end_menu), NULL);
gtk_signal_connect(GTK_OBJECT(menuWin), "ghack_select_menu",
GTK_SIGNAL_FUNC(ghack_menu_window_select_menu), NULL);
gtk_signal_connect(GTK_OBJECT(menuWin), "ghack_putstr",
GTK_SIGNAL_FUNC(ghack_menu_window_put_string), NULL);
gtk_signal_connect(GTK_OBJECT(menuWin), "key_press_event",
GTK_SIGNAL_FUNC(ghack_menu_window_key), NULL);
/* Center the dialog over parent */
g_assert(parent != NULL);
g_assert(menuWin != NULL);
g_assert(GTK_IS_WINDOW(parent));
g_assert(GNOME_IS_DIALOG(menuWin));
gnome_dialog_set_parent(GNOME_DIALOG(menuWin), GTK_WINDOW(parent));
return menuWin;
}
static void
ghack_ext_key_hit(GtkWidget *menuWin, GdkEventKey *event, gpointer data)
{
GtkWidget *clist;
extMenu *info = (extMenu *) data;
int i;
char c = event->string[0];
clist = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(menuWin), "clist"));
g_assert(clist != NULL);
/* if too long between keystrokes, reset to initial state */
if (event->time - info->lastTime > 500)
goto init_state;
/* see if current item continue to match */
if (info->charIdx > 0) {
if (extcmdlist[info->curItem].ef_txt[info->charIdx] == c) {
++info->charIdx;
goto found;
}
}
/* see if the prefix matches a later command in the list */
if (info->curItem >= 0) {
for (i = info->curItem + 1; i < info->numRows; ++i) {
if (!strncmp(extcmdlist[info->curItem].ef_txt,
extcmdlist[i].ef_txt, info->charIdx)) {
if (extcmdlist[i].ef_txt[info->charIdx] == c) {
++info->charIdx;
info->curItem = i;
goto found;
}
}
}
}
init_state:
/* reset to initial state, look for matching 1st character */
for (i = 0; i < info->numRows; ++i) {
if (extcmdlist[i].ef_txt[0] == c) {
info->charIdx = 1;
info->curItem = i;
goto found;
}
}
/* no match: leave prior, if any selection in place */
return;
found:
info->lastTime = event->time;
gtk_clist_select_row(GTK_CLIST(clist), info->curItem, 0);
if (gtk_clist_row_is_visible(GTK_CLIST(clist), info->curItem)
!= GTK_VISIBILITY_FULL)
gtk_clist_moveto(GTK_CLIST(clist), info->curItem, 0, 0.5, 0);
}
int
ghack_menu_ext_cmd(void)
{
int n;
GtkWidget *dialog;
GtkWidget *swin;
GtkWidget *frame1;
GtkWidget *clist;
extMenu info;
dialog = gnome_dialog_new("Extended Commands", GNOME_STOCK_BUTTON_OK,
GNOME_STOCK_BUTTON_CANCEL, NULL);
gnome_dialog_close_hides(GNOME_DIALOG(dialog), FALSE);
gtk_signal_connect(GTK_OBJECT(dialog), "key_press_event",
GTK_SIGNAL_FUNC(ghack_ext_key_hit), &info);
frame1 = gtk_frame_new("Make your selection");
gtk_object_set_data(GTK_OBJECT(dialog), "frame1", frame1);
gtk_widget_show(frame1);
gtk_container_border_width(GTK_CONTAINER(frame1), 3);
swin = gtk_scrolled_window_new(NULL, NULL);
clist = gtk_clist_new(2);
gtk_object_set_data(GTK_OBJECT(dialog), "clist", clist);
gtk_widget_set_usize(clist, 500, 400);
gtk_container_add(GTK_CONTAINER(swin), clist);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_signal_connect(GTK_OBJECT(clist), "select_row",
GTK_SIGNAL_FUNC(ghack_menu_row_selected), NULL);
gtk_container_add(GTK_CONTAINER(frame1), swin);
gtk_box_pack_start_defaults(GTK_BOX(GNOME_DIALOG(dialog)->vbox), frame1);
/* Add the extended commands into the list here... */
for (n = 0; extcmdlist[n].ef_txt; ++n) {
const char *text[3] = { extcmdlist[n].ef_txt, extcmdlist[n].ef_desc,
NULL };
gtk_clist_insert(GTK_CLIST(clist), n, (char **) text);
}
/* fill in starting info fields */
info.curItem = -1;
info.numRows = n;
info.charIdx = 0;
info.lastTime = 0;
gtk_clist_columns_autosize(GTK_CLIST(clist));
gtk_widget_show_all(swin);
/* Center the dialog over over parent */
gnome_dialog_set_default(GNOME_DIALOG(dialog), 0);
gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
gnome_dialog_set_parent(GNOME_DIALOG(dialog),
GTK_WINDOW(ghack_get_main_window()));
/* Run the dialog -- returning whichever button was pressed */
n = gnome_dialog_run_and_close(GNOME_DIALOG(dialog));
/* Quit on button 2 or error */
return (n != 0) ? -1 : info.curItem;
}

View File

@@ -0,0 +1,32 @@
/* NetHack 3.6 gnmenu.h $NHDT-Date: 1432512805 2015/05/25 00:13:25 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef GnomeHackMenuWindow_h
#define GnomeHackMenuWindow_h
#include <gnome.h>
#include "config.h"
#include "global.h"
#include "gnomeprv.h"
GtkWidget *ghack_init_menu_window(void);
struct _GHackMenuItem {
int glyph;
const ANY_P *identifier;
CHAR_P accelerator;
CHAR_P group_accel;
int attr;
unsigned itemflags;
const char *str;
BOOLEAN_P presel;
};
typedef struct _GHackMenuItem GHackMenuItem;
int ghack_menu_window_select_menu(GtkWidget *menuWin, MENU_ITEM_P **_selected,
gint how);
int ghack_menu_ext_cmd(void);
#endif /* GnomeHackMenuWindow_h */

View File

@@ -0,0 +1,99 @@
/* NetHack 3.6 gnmesg.c $NHDT-Date: 1432512805 2015/05/25 00:13:25 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#include "gnmesg.h"
#include "gnsignal.h"
/* Pick an arbitrary number of chars such as 80 col X 40 rows text = 3200
* chars */
#define nCharsBeforeDeletingStuff 3200
/* Message Window widgets */
GtkWidget *MW_table;
GtkWidget *MW_text;
GtkWidget *MW_scrollbar;
void
ghack_message_window_clear(GtkWidget *widget, gpointer data)
{
/* Seems nethack calls this after every move -- we don't want
* to really clear the window at all though. Ignore the request */
gint len;
len = gtk_text_get_length(GTK_TEXT(MW_text));
if (len < nCharsBeforeDeletingStuff)
return;
gtk_text_freeze(GTK_TEXT(MW_text));
gtk_text_set_point(GTK_TEXT(MW_text), 0);
gtk_text_forward_delete(GTK_TEXT(MW_text),
len - ((guint)(nCharsBeforeDeletingStuff * 0.5)));
gtk_text_set_point(GTK_TEXT(MW_text),
(guint)(nCharsBeforeDeletingStuff * 0.5));
gtk_text_thaw(GTK_TEXT(MW_text));
}
void
ghack_message_window_destroy(GtkWidget *win, gpointer data)
{
}
void
ghack_message_window_display(GtkWidget *widget, boolean block, gpointer data)
{
}
void
ghack_message_window_put_string(GtkWidget *widget, int attr, const char *text,
gpointer data)
{
if (text == NULL)
return;
/* Don't bother with attributes yet */
gtk_text_insert(GTK_TEXT(MW_text), NULL, NULL, NULL, text, -1);
gtk_text_insert(GTK_TEXT(MW_text), NULL, NULL, NULL, "\n", -1);
}
void
ghack_message_window_use_RIP(int how)
{
}
void
ghack_message_window_scroll(int dx, int dy)
{
}
GtkWidget *
ghack_init_message_window(void)
{
MW_table = gtk_table_new(2, 1, FALSE);
gtk_table_set_row_spacing(GTK_TABLE(MW_table), 0, 2);
MW_text = gtk_text_new(NULL, NULL);
gtk_text_set_editable(GTK_TEXT(MW_text), FALSE);
gtk_text_set_word_wrap(GTK_TEXT(MW_text), TRUE);
gtk_table_attach(GTK_TABLE(MW_table), MW_text, 0, 1, 0, 1,
(GTK_EXPAND | GTK_FILL), (GTK_EXPAND | GTK_FILL), 0, 0);
MW_scrollbar = gtk_vscrollbar_new(GTK_TEXT(MW_text)->vadj);
gtk_table_attach(GTK_TABLE(MW_table), MW_scrollbar, 1, 2, 0, 1, GTK_FILL,
(GTK_EXPAND | GTK_FILL), 0, 0);
gtk_signal_connect(GTK_OBJECT(MW_table), "ghack_putstr",
GTK_SIGNAL_FUNC(ghack_message_window_put_string),
NULL);
gtk_signal_connect(GTK_OBJECT(MW_table), "ghack_clear",
GTK_SIGNAL_FUNC(ghack_message_window_clear), NULL);
gtk_signal_connect(GTK_OBJECT(MW_table), "gnome_delay_output",
GTK_SIGNAL_FUNC(ghack_delay), NULL);
gtk_widget_show_all(MW_table);
return GTK_WIDGET(MW_table);
}

View File

@@ -0,0 +1,22 @@
/* NetHack 3.6 gnmesg.h $NHDT-Date: 1432512807 2015/05/25 00:13:27 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef GnomeHackMessageWindow_h
#define GnomeHackMessageWindow_h
#include <gnome.h>
#include "config.h"
GtkWidget *ghack_init_message_window(/* GnomeHackKeyBuffer g_keybuffer,
GnomeHackClickBuffer g_clickbuffer */);
void ghack_message_window_clear(GtkWidget *widget, gpointer data);
void ghack_message_window_destroy();
void ghack_message_window_display(GtkWidget *widget, boolean block,
gpointer data);
void ghack_message_window_put_string(GtkWidget *widget, int attr,
const char *text, gpointer data);
void ghack_message_window_use_RIP(int how);
void ghack_message_window_scroll(int dx, int dy);
#endif /* GnomeHackMessageWindow_h */

View File

@@ -0,0 +1,15 @@
/* NetHack 3.6 gnomeprv.h $NHDT-Date: 1432512806 2015/05/25 00:13:26 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef GnomeHack_h
#define GnomeHack_h
/* These are the base nethack include files */
#include "hack.h"
#include "dlb.h"
#include "patchlevel.h"
#include "winGnome.h"
#endif /* GnomeHack_h */

114
outdated/win/gnome/gnopts.c Normal file
View File

@@ -0,0 +1,114 @@
/* NetHack 3.6 gnopts.c $NHDT-Date: 1432512805 2015/05/25 00:13:25 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#include "gnopts.h"
#include "gnglyph.h"
#include "gnmain.h"
#include "gnmap.h"
#include <gnome.h>
#include <ctype.h>
#include "hack.h"
static gint tileset;
static GtkWidget *clist;
const char *tilesets[] = { "Traditional (16x16)", "Big (32x32)", 0 };
static void
opt_sel_key_hit(GtkWidget *widget, GdkEventKey *event, gpointer data)
{
int i;
for (i = 0; tilesets[i] != 0; ++i) {
if (tilesets[i][0] == toupper(event->keyval)) {
tileset = i;
gtk_clist_select_row(GTK_CLIST(clist), i, 0);
}
}
}
static void
opt_sel_row_selected(GtkCList *cList, int row, int col, GdkEvent *event)
{
tileset = row;
}
void
ghack_settings_dialog()
{
int i;
static GtkWidget *dialog;
static GtkWidget *swin;
static GtkWidget *frame1;
dialog = gnome_dialog_new(_("GnomeHack Settings"), GNOME_STOCK_BUTTON_OK,
GNOME_STOCK_BUTTON_CANCEL, NULL);
gnome_dialog_close_hides(GNOME_DIALOG(dialog), FALSE);
gtk_signal_connect(GTK_OBJECT(dialog), "key_press_event",
GTK_SIGNAL_FUNC(opt_sel_key_hit), tilesets);
frame1 = gtk_frame_new(_("Choose one of the following tilesets:"));
gtk_object_set_data(GTK_OBJECT(dialog), "frame1", frame1);
gtk_widget_show(frame1);
gtk_container_border_width(GTK_CONTAINER(frame1), 3);
swin = gtk_scrolled_window_new(NULL, NULL);
clist = gtk_clist_new(2);
gtk_clist_column_titles_hide(GTK_CLIST(clist));
gtk_widget_set_usize(GTK_WIDGET(clist), 100, 180);
gtk_container_add(GTK_CONTAINER(swin), clist);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_signal_connect(GTK_OBJECT(clist), "select_row",
GTK_SIGNAL_FUNC(opt_sel_row_selected), NULL);
gtk_container_add(GTK_CONTAINER(frame1), swin);
gtk_box_pack_start_defaults(GTK_BOX(GNOME_DIALOG(dialog)->vbox), frame1);
/* Add the tilesets into the list here... */
for (i = 0; tilesets[i]; i++) {
gchar accelBuf[BUFSZ];
const char *text[3] = { accelBuf, tilesets[i], NULL };
sprintf(accelBuf, "%c ", tolower(tilesets[i][0]));
gtk_clist_insert(GTK_CLIST(clist), i, (char **) text);
}
gtk_clist_columns_autosize(GTK_CLIST(clist));
gtk_widget_show_all(swin);
/* Center the dialog over over parent */
gnome_dialog_set_default(GNOME_DIALOG(dialog), 0);
gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
gnome_dialog_set_parent(GNOME_DIALOG(dialog),
GTK_WINDOW(ghack_get_main_window()));
/* Run the dialog -- returning whichever button was pressed */
i = gnome_dialog_run(GNOME_DIALOG(dialog));
gnome_dialog_close(GNOME_DIALOG(dialog));
/* They hit Quit or error */
if (i != 0) {
return;
}
switch (tileset) {
case 0:
/* They selected traditional */
ghack_free_glyphs();
if (ghack_init_glyphs(HACKDIR "/x11tiles"))
g_error("ERROR: Could not initialize glyphs.\n");
ghack_reinit_map_window();
break;
case 1:
ghack_free_glyphs();
if (ghack_init_glyphs(HACKDIR "/t32-1024.xpm"))
g_error("ERROR: Could not initialize glyphs.\n");
ghack_reinit_map_window();
/* They selected big */
break;
default:
/* This shouldn't happen */
g_warning("This shouldn't happen\n");
}
}

View File

@@ -0,0 +1,10 @@
/* NetHack 3.6 gnopts.h $NHDT-Date: 1432512806 2015/05/25 00:13:26 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef GnomeHackSettings_h
#define GnomeHackSettings_h
void ghack_settings_dialog(void);
#endif /* GnomeHackSettings.h */

View File

@@ -0,0 +1,100 @@
/* NetHack 3.6 gnplayer.c $NHDT-Date: 1432512806 2015/05/25 00:13:26 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#include <gnome.h>
#include <ctype.h>
#include "gnplayer.h"
#include "gnmain.h"
#include "hack.h"
static gint role_number;
static GtkWidget *clist;
static void
player_sel_key_hit(GtkWidget *widget, GdkEventKey *event, gpointer data)
{
const char **roles = data;
int i;
for (i = 0; roles[i] != 0; ++i) {
if (tolower(roles[i][0]) == tolower(event->keyval)) {
role_number = i;
gtk_clist_select_row(GTK_CLIST(clist), i, 0);
if (gtk_clist_row_is_visible(GTK_CLIST(clist), i)
!= GTK_VISIBILITY_FULL)
gtk_clist_moveto(GTK_CLIST(clist), i, 0, 0.5, 0);
}
}
}
static void
player_sel_row_selected(GtkCList *clist, int row, int col, GdkEvent *event)
{
role_number = row;
}
int
ghack_player_sel_dialog(const char **choices, const gchar *title,
const gchar *prompt)
{
int i;
static GtkWidget *dialog;
static GtkWidget *swin;
static GtkWidget *frame1;
dialog = gnome_dialog_new(title, GNOME_STOCK_BUTTON_OK, _("Random"),
GNOME_STOCK_BUTTON_CANCEL, NULL);
gnome_dialog_close_hides(GNOME_DIALOG(dialog), FALSE);
gtk_signal_connect(GTK_OBJECT(dialog), "key_press_event",
GTK_SIGNAL_FUNC(player_sel_key_hit), choices);
frame1 = gtk_frame_new(prompt);
gtk_object_set_data(GTK_OBJECT(dialog), "frame1", frame1);
gtk_widget_show(frame1);
gtk_container_border_width(GTK_CONTAINER(frame1), 3);
swin = gtk_scrolled_window_new(NULL, NULL);
clist = gtk_clist_new(2);
gtk_clist_column_titles_hide(GTK_CLIST(clist));
gtk_widget_set_usize(GTK_WIDGET(clist), 100, 180);
gtk_container_add(GTK_CONTAINER(swin), clist);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_signal_connect(GTK_OBJECT(clist), "select_row",
GTK_SIGNAL_FUNC(player_sel_row_selected), NULL);
gtk_container_add(GTK_CONTAINER(frame1), swin);
gtk_box_pack_start_defaults(GTK_BOX(GNOME_DIALOG(dialog)->vbox), frame1);
/* Add the roles into the list here... */
for (i = 0; choices[i]; i++) {
gchar accelBuf[BUFSZ];
const char *text[3] = { accelBuf, choices[i], NULL };
sprintf(accelBuf, "%c ", tolower(choices[i][0]));
gtk_clist_insert(GTK_CLIST(clist), i, (char **) text);
}
gtk_clist_columns_autosize(GTK_CLIST(clist));
gtk_widget_show_all(swin);
/* Center the dialog over over parent */
gnome_dialog_set_default(GNOME_DIALOG(dialog), 0);
gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
gnome_dialog_set_parent(GNOME_DIALOG(dialog),
GTK_WINDOW(ghack_get_main_window()));
/* Run the dialog -- returning whichever button was pressed */
i = gnome_dialog_run_and_close(GNOME_DIALOG(dialog));
/* Quit on button 2 or error */
if (i < 0 || i > 1) {
return (ROLE_NONE);
}
/* Random is button 1*/
if (i == 1) {
return (ROLE_RANDOM);
}
return (role_number);
}

View File

@@ -0,0 +1,10 @@
/* NetHack 3.6 gnplayer.h $NHDT-Date: 1432512807 2015/05/25 00:13:27 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef GnomeHackPlayerSelDialog_h
#define GnomeHackPlayerSelDialog_h
int ghack_player_sel_dialog(const char **, const gchar *, const gchar *);
#endif /* GnomeHackPlayerSelDialog_h */

View File

@@ -0,0 +1,399 @@
/* NetHack 3.6 gnsignal.c $NHDT-Date: 1432512805 2015/05/25 00:13:25 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ */
/* Copyright (C) 1998 by Anthony Taylor <tonyt@ptialaska.net> */
/* NetHack may be freely redistributed. See license for details. */
#include "gnsignal.h"
#include "gnmain.h"
#include <gdk/gdkkeysyms.h>
GList *g_keyBuffer;
GList *g_clickBuffer;
int g_numKeys = 0;
int g_numClicks = 0;
int g_askingQuestion = 0;
static int s_done = FALSE;
/*
* ghack_init_signals
*
* Create some signals and attach them to the GtkWidget class.
* These are the signals:
*
* ghack_curs : NONE:INT,INT
* INT 1 = x
* INT 2 = y
*
* ghack_putstr : NONE:INT,POINTER
* INT = attribute
* POINTER = char* string to print
*
* ghack_print_glyph : NONE:INT,INT,POINTER
* INT 1 = x
* INT 2 = y
* INT 3 = GtkPixmap* to rendered glyph
*
* ghack_clear : NONE:NONE
*
* ghack_display : NONE:BOOL
* BOOL = blocking flag
*
* ghack_start_menu : NONE:NONE
*
* ghack_add_menu : NONE:POINTER
* POINTER = GHackMenuItem*
*
* ghack_end_menu : NONE:POINTER
* POINTER = char* to closing string
*
* ghack_select_menu : NONE:POINTER,INT,POINTER
* POINTER = int pointer-- filled with number
* of selected items on return
* INT = number of items selected
* POINTER = structure to fill
*
* ghack_cliparound : NONE:INT,INT
* INT 1 = x
* INT 2 = y
*/
void
ghack_init_signals(void)
{
ghack_signals[GHSIG_CURS] = gtk_object_class_user_signal_new(
gtk_type_class(gtk_widget_get_type()), "ghack_curs", GTK_RUN_FIRST,
gtk_marshal_NONE__INT_INT, GTK_TYPE_NONE, 2, GTK_TYPE_INT,
GTK_TYPE_INT);
ghack_signals[GHSIG_PUTSTR] = gtk_object_class_user_signal_new(
gtk_type_class(gtk_widget_get_type()), "ghack_putstr", GTK_RUN_FIRST,
gtk_marshal_NONE__INT_POINTER, GTK_TYPE_NONE, 2, GTK_TYPE_INT,
GTK_TYPE_POINTER);
ghack_signals[GHSIG_PRINT_GLYPH] = gtk_object_class_user_signal_new(
gtk_type_class(gtk_widget_get_type()), "ghack_print_glyph",
GTK_RUN_FIRST, gtk_marshal_NONE__INT_INT_POINTER, GTK_TYPE_NONE, 3,
GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER);
ghack_signals[GHSIG_CLEAR] = gtk_object_class_user_signal_new(
gtk_type_class(gtk_widget_get_type()), "ghack_clear", GTK_RUN_FIRST,
gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0);
ghack_signals[GHSIG_DISPLAY] = gtk_object_class_user_signal_new(
gtk_type_class(gtk_widget_get_type()), "ghack_display", GTK_RUN_FIRST,
gtk_marshal_NONE__BOOL, GTK_TYPE_NONE, 1, GTK_TYPE_BOOL);
ghack_signals[GHSIG_START_MENU] = gtk_object_class_user_signal_new(
gtk_type_class(gtk_widget_get_type()), "ghack_start_menu",
GTK_RUN_FIRST, gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0);
ghack_signals[GHSIG_ADD_MENU] = gtk_object_class_user_signal_new(
gtk_type_class(gtk_widget_get_type()), "ghack_add_menu",
GTK_RUN_FIRST, gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
ghack_signals[GHSIG_END_MENU] = gtk_object_class_user_signal_new(
gtk_type_class(gtk_widget_get_type()), "ghack_end_menu",
GTK_RUN_FIRST, gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
ghack_signals[GHSIG_SELECT_MENU] = gtk_object_class_user_signal_new(
gtk_type_class(gtk_widget_get_type()), "ghack_select_menu",
GTK_RUN_FIRST, gtk_marshal_NONE__POINTER_INT_POINTER, GTK_TYPE_NONE,
3, GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_POINTER);
ghack_signals[GHSIG_CLIPAROUND] = gtk_object_class_user_signal_new(
gtk_type_class(gtk_widget_get_type()), "ghack_cliparound",
GTK_RUN_FIRST, gtk_marshal_NONE__INT_INT, GTK_TYPE_NONE, 2,
GTK_TYPE_INT, GTK_TYPE_INT);
ghack_signals[GHSIG_FADE_HIGHLIGHT] = gtk_object_class_user_signal_new(
gtk_type_class(gtk_widget_get_type()), "ghack_fade_highlight",
GTK_RUN_FIRST, gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0);
ghack_signals[GHSIG_DELAY] = gtk_object_class_user_signal_new(
gtk_type_class(gtk_widget_get_type()), "gnome_delay_output",
GTK_RUN_FIRST, gtk_marshal_NONE__INT, GTK_TYPE_NONE, 1, GTK_TYPE_INT);
}
/* For want of a better place, I'm putting the delay output stuff here
* -Erik
*/
static gint
timeout_callback(gpointer data)
{
s_done = TRUE;
return FALSE;
}
void
ghack_delay(GtkWidget *win, int numMillisecs, gpointer data)
{
s_done = FALSE;
gtk_timeout_add((unsigned int) numMillisecs, timeout_callback, NULL);
while (s_done == FALSE)
gtk_main_iteration();
}
void
ghack_handle_button_press(GtkWidget *widget, GdkEventButton *event,
gpointer data)
{
GHClick *click;
double x1, y1;
if (event->type != GDK_BUTTON_PRESS)
return;
gnome_canvas_window_to_world(GNOME_CANVAS(widget), event->x, event->y,
&x1, &y1);
/*
g_message("I got a click at %f,%f with button %d \n",
x1, y1, event->button);
*/
/* We allocate storage here, so we need to remember if (g_numClicks>0)
* to blow this away when closing the app using something like
* while (g_clickBuffer)
* {
* g_free((GHClick)g_clickBuffer->data);
* g_clickBuffer = g_clickBuffer->next;
* }
* g_list_free( g_clickBuffer );
*
*/
click = g_new(GHClick, 1);
click->x = (int) x1 / ghack_glyph_width();
click->y = (int) y1 / ghack_glyph_height();
click->mod = (event->button == 1) ? CLICK_1 : CLICK_2;
g_clickBuffer = g_list_prepend(g_clickBuffer, click);
/* Could use g_list_length(), but it is stupid and just
* traverses the list while counting, so we'll just do
* the counting ourselves in advance. */
g_numClicks++;
}
#ifndef M
#ifndef NHSTDC
#define M(c) (0x80 | (c))
#else
#define M(c) ((c) -128)
#endif /* NHSTDC */
#endif
#ifndef C
#define C(c) (0x1f & (c))
#endif
void
ghack_handle_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data)
{
static int was_pound = 0;
int key = 0;
int ctl = GDK_CONTROL_MASK;
int alt = GDK_MOD1_MASK;
/* Turn this on to debug key events */
#if 0
g_message("I got a \"%s\" key (%d) %s%s",
gdk_keyval_name (event->keyval), event->keyval,
(event->state&ctl)? "+CONTROL":"", (event->state&alt)? "+ALT":"");
#endif
switch (event->keyval) {
/* special keys to do stuff with */
/* Set up the direction keys */
/* First handle the arrow keys -- these always mean move */
case GDK_Right:
case GDK_rightarrow:
key = Cmd.move_E;
break;
case GDK_Left:
case GDK_leftarrow:
key = Cmd.move_W;
break;
case GDK_Up:
case GDK_uparrow:
key = Cmd.move_N;
break;
case GDK_Down:
case GDK_downarrow:
key = Cmd.move_S;
break;
case GDK_Home:
key = Cmd.move_NW;
break;
case GDK_End:
key = Cmd.move_SW;
break;
case GDK_Page_Down:
key = Cmd.move_SE;
break;
case GDK_Page_Up:
key = Cmd.move_NE;
break;
case ' ':
key = '.';
break;
/* Now, handle the numberpad (move or numbers) */
case GDK_KP_Right:
case GDK_KP_6:
if (event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)
&& iflags.num_pad)
key = GDK_KP_6;
else
key = '6';
break;
case GDK_KP_Left:
case GDK_KP_4:
if (event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)
&& iflags.num_pad)
key = GDK_KP_4;
else
key = '4';
break;
case GDK_KP_Up:
case GDK_KP_8:
if (event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)
&& iflags.num_pad)
key = GDK_KP_8;
else
key = '8';
break;
case GDK_KP_Down:
case GDK_KP_2:
if (event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)
&& iflags.num_pad)
key = GDK_KP_2;
else
key = '2';
break;
/* Move Top-Left */
case GDK_KP_Home:
case GDK_KP_7:
if (event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)
&& iflags.num_pad)
key = GDK_KP_7;
else
key = '7';
break;
case GDK_KP_Page_Up:
case GDK_KP_9:
if (event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)
&& iflags.num_pad)
key = GDK_KP_9;
else
key = '9';
break;
case GDK_KP_End:
case GDK_KP_1:
if (event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)
&& iflags.num_pad)
key = GDK_KP_1;
else
key = '1';
break;
case GDK_KP_Page_Down:
case GDK_KP_3:
if (event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)
&& iflags.num_pad)
key = GDK_KP_3;
else
key = '3';
break;
case GDK_KP_5:
if (event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)
&& iflags.num_pad)
key = GDK_KP_5;
else
key = '5';
break;
case GDK_KP_Delete:
case GDK_KP_Decimal:
key = '.';
break;
/* can't just ignore "#", it's a core feature */
case GDK_numbersign:
key = '#';
break;
/* We will probably want to do something with these later... */
case GDK_KP_Begin:
case GDK_KP_F1:
case GDK_F1:
case GDK_KP_F2:
case GDK_F2:
case GDK_KP_F3:
case GDK_F3:
case GDK_KP_F4:
case GDK_F4:
case GDK_F5:
case GDK_F6:
case GDK_F7:
case GDK_F8:
case GDK_F9:
case GDK_F10:
case GDK_F11:
case GDK_F12:
break;
/* various keys to ignore */
case GDK_KP_Insert:
case GDK_Insert:
case GDK_Delete:
case GDK_Print:
case GDK_BackSpace:
case GDK_Pause:
case GDK_Scroll_Lock:
case GDK_Shift_Lock:
case GDK_Num_Lock:
case GDK_Caps_Lock:
case GDK_Control_L:
case GDK_Control_R:
case GDK_Shift_L:
case GDK_Shift_R:
case GDK_Alt_L:
case GDK_Alt_R:
case GDK_Meta_L:
case GDK_Meta_R:
case GDK_Mode_switch:
case GDK_Multi_key:
return;
default:
key = event->keyval;
break;
}
if ((event->state & alt) || was_pound) {
key = M(event->keyval);
} else if (event->state & ctl) {
key = C(event->keyval);
}
if (was_pound) {
was_pound = 0;
}
/* Ok, here is where we do clever stuff to overide the default
* game behavior */
if (g_askingQuestion == 0) {
if (key == 'S' || key == M('S') || key == C('S')) {
ghack_save_game_cb(NULL, NULL);
return;
}
}
g_keyBuffer = g_list_prepend(g_keyBuffer, GINT_TO_POINTER(key));
g_numKeys++;
}

View File

@@ -0,0 +1,53 @@
/* NetHack 3.6 gnsignal.h $NHDT-Date: 1432512807 2015/05/25 00:13:27 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
/* Copyright (C) 1998 by Anthony Taylor <tonyt@ptialaska.net> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef GnomeHackSignals_h
#define GnomeHackSignals_h
#include <gtk/gtk.h>
#include <gnome.h>
#include "gnomeprv.h"
#include "gnglyph.h"
/* The list of custom signals */
enum {
GHSIG_CURS,
GHSIG_PUTSTR,
GHSIG_PRINT_GLYPH,
GHSIG_CLEAR,
GHSIG_DISPLAY,
GHSIG_START_MENU,
GHSIG_ADD_MENU,
GHSIG_END_MENU,
GHSIG_SELECT_MENU,
GHSIG_CLIPAROUND,
GHSIG_FADE_HIGHLIGHT,
GHSIG_DELAY,
GHSIG_LAST_SIG
};
guint ghack_signals[GHSIG_LAST_SIG];
extern void ghack_init_signals(void);
void ghack_handle_key_press(GtkWidget *widget, GdkEventKey *event,
gpointer data);
void ghack_handle_button_press(GtkWidget *widget, GdkEventButton *event,
gpointer data);
typedef struct {
int x, y, mod;
} GHClick;
extern GList *g_keyBuffer;
extern GList *g_clickBuffer;
extern int g_numKeys;
extern int g_numClicks;
extern int g_askingQuestion;
void ghack_delay(GtkWidget *win, int numMillisecs, gpointer data);
#endif /* GnomeHackSignals_h */

View File

@@ -0,0 +1,908 @@
/* NetHack 3.6 gnstatus.c $NHDT-Date: 1432512806 2015/05/25 00:13:26 $ $NHDT-Branch: master $:$NHDT-Revision: 1.15 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#include "gnstatus.h"
#include "gnsignal.h"
#include "gn_xpms.h"
#include "gnomeprv.h"
extern const char *hu_stat[]; /* from eat.c */
extern const char *enc_stat[]; /* from botl.c */
void ghack_status_window_update_stats();
void ghack_status_window_clear(GtkWidget *win, gpointer data);
void ghack_status_window_destroy(GtkWidget *win, gpointer data);
void ghack_status_window_display(GtkWidget *win, boolean block,
gpointer data);
void ghack_status_window_cursor_to(GtkWidget *win, int x, int y,
gpointer data);
void ghack_status_window_put_string(GtkWidget *win, int attr,
const char *text, gpointer data);
static void ghack_fade_highlighting();
static void ghack_highlight_widget(GtkWidget *widget, GtkStyle *oldStyle,
GtkStyle *newStyle);
/* some junk to handle when to fade the highlighting */
#define NUM_TURNS_HIGHLIGHTED 3
static GList *s_HighLightList;
typedef struct {
GtkWidget *widget;
GtkStyle *oldStyle;
int nTurnsLeft;
} Highlight;
/* Ok, now for a LONG list of widgets... */
static GtkWidget *statTable = NULL;
static GtkWidget *titleLabel = NULL;
static GtkWidget *dgnLevelLabel = NULL;
static GtkWidget *strPix = NULL;
static GtkWidget *strLabel = NULL;
static GtkWidget *dexPix = NULL;
static GtkWidget *dexLabel = NULL;
static GtkWidget *intPix = NULL;
static GtkWidget *intLabel = NULL;
static GtkWidget *wisPix = NULL;
static GtkWidget *wisLabel = NULL;
static GtkWidget *conPix = NULL;
static GtkWidget *conLabel = NULL;
static GtkWidget *chaPix = NULL;
static GtkWidget *chaLabel = NULL;
static GtkWidget *goldLabel = NULL;
static GtkWidget *hpLabel = NULL;
static GtkWidget *powLabel = NULL;
static GtkWidget *acLabel = NULL;
static GtkWidget *levlLabel = NULL;
static GtkWidget *expLabel = NULL;
static GtkWidget *timeLabel = NULL;
static GtkWidget *scoreLabel = NULL;
static GtkWidget *alignPix = NULL;
static GtkWidget *alignLabel = NULL;
static GtkWidget *hungerPix = NULL;
static GtkWidget *hungerLabel = NULL;
static GtkWidget *sickPix = NULL;
static GtkWidget *sickLabel = NULL;
static GtkWidget *blindPix = NULL;
static GtkWidget *blindLabel = NULL;
static GtkWidget *stunPix = NULL;
static GtkWidget *stunLabel = NULL;
static GtkWidget *halluPix = NULL;
static GtkWidget *halluLabel = NULL;
static GtkWidget *confuPix = NULL;
static GtkWidget *confuLabel = NULL;
static GtkWidget *encumbPix = NULL;
static GtkWidget *encumbLabel = NULL;
static GtkStyle *normalStyle = NULL;
static GtkStyle *bigStyle = NULL;
static GtkStyle *redStyle = NULL;
static GtkStyle *greenStyle = NULL;
static GtkStyle *bigRedStyle = NULL;
static GtkStyle *bigGreenStyle = NULL;
/* Pure red */
static GdkColor color_red = { 0, 0xff00, 0, 0 };
/* ForestGreen (looks better than just pure green) */
static GdkColor color_green = { 0, 0x2200, 0x8b00, 0x2200 };
static int lastDepth;
static int lastStr;
static int lastInt;
static int lastWis;
static int lastDex;
static int lastCon;
static int lastCha;
static long lastAu;
static int lastHP;
static int lastMHP;
static int lastLevel;
static int lastPOW;
static int lastMPOW;
static int lastAC;
static int lastExp;
static aligntyp lastAlignment;
static unsigned lastHungr;
static long lastConf;
static long lastBlind;
static long lastStun;
static long lastHalu;
static long lastSick;
static int lastEncumb;
void
ghack_status_window_clear(GtkWidget *win, gpointer data)
{
/* Don't think we need this at all */
}
void
ghack_status_window_destroy(GtkWidget *win, gpointer data)
{
while (s_HighLightList) {
g_free((Highlight *) s_HighLightList->data);
s_HighLightList = s_HighLightList->next;
}
g_list_free(s_HighLightList);
}
void
ghack_status_window_display(GtkWidget *win, boolean block, gpointer data)
{
gtk_widget_show_all(GTK_WIDGET(win));
}
void
ghack_status_window_cursor_to(GtkWidget *win, int x, int y, gpointer data)
{
/* Don't think we need this at all */
}
void
ghack_status_window_put_string(GtkWidget *win, int attr, const char *text,
gpointer data)
{
ghack_status_window_update_stats();
}
GtkWidget *
ghack_init_status_window()
{
GtkWidget *horizSep0, *horizSep1, *horizSep2, *horizSep3;
GtkWidget *statsHBox, *strVBox, *dexVBox, *intVBox, *statHBox;
GtkWidget *wisVBox, *conVBox, *chaVBox;
GtkWidget *alignVBox, *hungerVBox, *sickVBox, *blindVBox;
GtkWidget *stunVBox, *halluVBox, *confuVBox, *encumbVBox;
/* Set up a (ridiculous) initial state */
lastDepth = 9999;
lastStr = 9999;
lastInt = 9999;
lastWis = 9999;
lastDex = 9999;
lastCon = 9999;
lastCha = 9999;
lastAu = 9999;
lastHP = 9999;
lastMHP = 9999;
lastLevel = 9999;
lastPOW = 9999;
lastMPOW = 9999;
lastAC = 9999;
lastExp = 9999;
lastAlignment = A_NEUTRAL; /* start off guessing neutral */
lastHungr = 9999;
lastConf = 9999;
lastBlind = 9999;
lastStun = 9999;
lastHalu = 9999;
lastSick = 9999;
lastEncumb = 9999;
statTable = gtk_table_new(10, 8, FALSE);
gtk_table_set_row_spacings(GTK_TABLE(statTable), 1);
gtk_table_set_col_spacings(GTK_TABLE(statTable), 1);
/* Begin the first row of the table -- the title */
titleLabel = gtk_label_new(_("GnomeHack!"));
gtk_table_attach(GTK_TABLE(statTable), titleLabel, 0, 8, 0, 1, GTK_FILL,
0, 0, 0);
if (!normalStyle)
normalStyle =
gtk_style_copy(gtk_widget_get_style(GTK_WIDGET(titleLabel)));
/* Set up some styles to draw stuff with */
if (!redStyle) {
g_assert(greenStyle == NULL);
g_assert(bigStyle == NULL);
g_assert(bigRedStyle == NULL);
g_assert(bigGreenStyle == NULL);
greenStyle = gtk_style_copy(normalStyle);
redStyle = gtk_style_copy(normalStyle);
bigRedStyle = gtk_style_copy(normalStyle);
bigGreenStyle = gtk_style_copy(normalStyle);
bigStyle = gtk_style_copy(normalStyle);
greenStyle->fg[GTK_STATE_NORMAL] = color_green;
redStyle->fg[GTK_STATE_NORMAL] = color_red;
bigRedStyle->fg[GTK_STATE_NORMAL] = color_red;
bigGreenStyle->fg[GTK_STATE_NORMAL] = color_green;
gdk_font_unref(bigRedStyle->font);
gdk_font_unref(bigGreenStyle->font);
bigRedStyle->font =
gdk_font_load("-misc-fixed-*-*-*-*-20-*-*-*-*-*-*-*");
bigGreenStyle->font =
gdk_font_load("-misc-fixed-*-*-*-*-20-*-*-*-*-*-*-*");
gdk_font_unref(bigStyle->font);
bigStyle->font =
gdk_font_load("-misc-fixed-*-*-*-*-20-*-*-*-*-*-*-*");
}
gtk_widget_set_style(GTK_WIDGET(titleLabel), bigStyle);
/* Begin the second row */
dgnLevelLabel = gtk_label_new(_("Nethack for Gnome"));
gtk_table_attach(GTK_TABLE(statTable), dgnLevelLabel, 0, 8, 1, 2,
GTK_FILL, 0, 0, 0);
gtk_widget_set_style(GTK_WIDGET(dgnLevelLabel), bigStyle);
/* Begin the third row */
horizSep0 = gtk_hseparator_new();
gtk_table_attach(GTK_TABLE(statTable), horizSep0, 0, 8, 2, 3, GTK_FILL,
GTK_FILL, 0, 0);
/* Begin the fourth row */
statsHBox = gtk_hbox_new(TRUE, 0);
strVBox = gtk_vbox_new(FALSE, 0);
strPix = gnome_pixmap_new_from_xpm_d(str_xpm);
strLabel = gtk_label_new("STR: ");
gtk_box_pack_start(GTK_BOX(strVBox), strPix, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(strVBox), strLabel, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(statsHBox), GTK_WIDGET(strVBox), TRUE, TRUE,
2);
dexVBox = gtk_vbox_new(FALSE, 0);
dexPix = gnome_pixmap_new_from_xpm_d(dex_xpm);
dexLabel = gtk_label_new("DEX: ");
gtk_box_pack_start(GTK_BOX(dexVBox), dexPix, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(dexVBox), dexLabel, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(statsHBox), GTK_WIDGET(dexVBox), TRUE, TRUE,
2);
conVBox = gtk_vbox_new(FALSE, 0);
conPix = gnome_pixmap_new_from_xpm_d(cns_xpm);
conLabel = gtk_label_new("CON: ");
gtk_box_pack_start(GTK_BOX(conVBox), conPix, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(conVBox), conLabel, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(statsHBox), GTK_WIDGET(conVBox), TRUE, TRUE,
2);
intVBox = gtk_vbox_new(FALSE, 0);
intPix = gnome_pixmap_new_from_xpm_d(int_xpm);
intLabel = gtk_label_new("INT: ");
gtk_box_pack_start(GTK_BOX(intVBox), intPix, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(intVBox), intLabel, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(statsHBox), GTK_WIDGET(intVBox), TRUE, TRUE,
2);
wisVBox = gtk_vbox_new(FALSE, 0);
wisPix = gnome_pixmap_new_from_xpm_d(wis_xpm);
wisLabel = gtk_label_new("WIS: ");
gtk_box_pack_start(GTK_BOX(wisVBox), wisPix, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(wisVBox), wisLabel, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(statsHBox), GTK_WIDGET(wisVBox), TRUE, TRUE,
2);
chaVBox = gtk_vbox_new(FALSE, 0);
chaPix = gnome_pixmap_new_from_xpm_d(cha_xpm);
chaLabel = gtk_label_new("CHA: ");
gtk_box_pack_start(GTK_BOX(chaVBox), chaPix, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(chaVBox), chaLabel, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(statsHBox), GTK_WIDGET(chaVBox), TRUE, TRUE,
2);
gtk_table_attach(GTK_TABLE(statTable), GTK_WIDGET(statsHBox), 0, 8, 3, 4,
GTK_FILL, 0, 0, 0);
/* Begin the fifth row */
horizSep1 = gtk_hseparator_new();
gtk_table_attach(GTK_TABLE(statTable), horizSep1, 0, 8, 4, 5, GTK_FILL,
GTK_FILL, 0, 0);
/* Begin the sixth row */
hpLabel = gtk_label_new("HP: ");
gtk_table_attach(GTK_TABLE(statTable), hpLabel, 0, 1, 5, 6, GTK_FILL, 0,
0, 0);
acLabel = gtk_label_new("AC: ");
gtk_table_attach(GTK_TABLE(statTable), acLabel, 2, 3, 5, 6, GTK_FILL, 0,
0, 0);
powLabel = gtk_label_new("Power: ");
gtk_table_attach(GTK_TABLE(statTable), powLabel, 4, 5, 5, 6, GTK_FILL, 0,
0, 0);
goldLabel = gtk_label_new("Au: ");
gtk_table_attach(GTK_TABLE(statTable), goldLabel, 6, 7, 5, 6, GTK_FILL, 0,
0, 0);
/* Begin the seventh row */
horizSep2 = gtk_hseparator_new();
gtk_table_attach(GTK_TABLE(statTable), horizSep2, 0, 8, 6, 7, GTK_FILL,
GTK_FILL, 0, 0);
/* Begin the eigth row */
levlLabel = gtk_label_new("Level: ");
gtk_table_attach(GTK_TABLE(statTable), levlLabel, 0, 1, 7, 8, GTK_FILL, 0,
0, 0);
expLabel = gtk_label_new("Exp: ");
gtk_table_attach(GTK_TABLE(statTable), expLabel, 2, 3, 7, 8, GTK_FILL, 0,
0, 0);
timeLabel = gtk_label_new("Time: ");
gtk_table_attach(GTK_TABLE(statTable), timeLabel, 4, 5, 7, 8, GTK_FILL, 0,
0, 0);
scoreLabel = gtk_label_new("Score: ");
gtk_table_attach(GTK_TABLE(statTable), scoreLabel, 6, 7, 7, 8, GTK_FILL,
0, 0, 0);
/* Begin the ninth row */
horizSep3 = gtk_hseparator_new();
gtk_table_attach(GTK_TABLE(statTable), horizSep3, 0, 8, 8, 9, GTK_FILL,
GTK_FILL, 0, 0);
/* Begin the tenth and last row */
statHBox = gtk_hbox_new(FALSE, 0);
alignVBox = gtk_vbox_new(FALSE, 0);
alignPix = gnome_pixmap_new_from_xpm_d(neutral_xpm);
alignLabel = gtk_label_new("Neutral");
gtk_box_pack_start(GTK_BOX(alignVBox), alignPix, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(alignVBox), alignLabel, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(statHBox), GTK_WIDGET(alignVBox), TRUE, FALSE,
2);
hungerVBox = gtk_vbox_new(FALSE, 0);
hungerPix = gnome_pixmap_new_from_xpm_d(hungry_xpm);
hungerLabel = gtk_label_new("Hungry");
gtk_box_pack_start(GTK_BOX(hungerVBox), hungerPix, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(hungerVBox), hungerLabel, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(statHBox), GTK_WIDGET(hungerVBox), TRUE, FALSE,
2);
sickVBox = gtk_vbox_new(FALSE, 0);
sickPix = gnome_pixmap_new_from_xpm_d(sick_fp_xpm);
sickLabel = gtk_label_new("FoodPois");
gtk_box_pack_start(GTK_BOX(sickVBox), sickPix, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(sickVBox), sickLabel, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(statHBox), GTK_WIDGET(sickVBox), TRUE, FALSE,
2);
blindVBox = gtk_vbox_new(FALSE, 0);
blindPix = gnome_pixmap_new_from_xpm_d(blind_xpm);
blindLabel = gtk_label_new("Blind");
gtk_box_pack_start(GTK_BOX(blindVBox), blindPix, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(blindVBox), blindLabel, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(statHBox), GTK_WIDGET(blindVBox), TRUE, FALSE,
2);
stunVBox = gtk_vbox_new(FALSE, 0);
stunPix = gnome_pixmap_new_from_xpm_d(stunned_xpm);
stunLabel = gtk_label_new("Stun");
gtk_box_pack_start(GTK_BOX(stunVBox), stunPix, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(stunVBox), stunLabel, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(statHBox), GTK_WIDGET(stunVBox), TRUE, FALSE,
2);
confuVBox = gtk_vbox_new(FALSE, 0);
confuPix = gnome_pixmap_new_from_xpm_d(confused_xpm);
confuLabel = gtk_label_new("Confused");
gtk_box_pack_start(GTK_BOX(confuVBox), confuPix, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(confuVBox), confuLabel, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(statHBox), GTK_WIDGET(confuVBox), TRUE, FALSE,
2);
halluVBox = gtk_vbox_new(FALSE, 0);
halluPix = gnome_pixmap_new_from_xpm_d(hallu_xpm);
halluLabel = gtk_label_new("Hallu");
gtk_box_pack_start(GTK_BOX(halluVBox), halluPix, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(halluVBox), halluLabel, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(statHBox), GTK_WIDGET(halluVBox), TRUE, FALSE,
2);
encumbVBox = gtk_vbox_new(FALSE, 0);
encumbPix = gnome_pixmap_new_from_xpm_d(slt_enc_xpm);
encumbLabel = gtk_label_new("Burdened");
gtk_box_pack_start(GTK_BOX(encumbVBox), encumbPix, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(encumbVBox), encumbLabel, TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(statHBox), GTK_WIDGET(encumbVBox), TRUE, FALSE,
2);
gtk_table_attach(GTK_TABLE(statTable), GTK_WIDGET(statHBox), 0, 8, 9, 10,
GTK_FILL, GTK_FILL, 0, 0);
/* Set up the necessary signals */
gtk_signal_connect(GTK_OBJECT(statTable), "ghack_fade_highlight",
GTK_SIGNAL_FUNC(ghack_fade_highlighting), NULL);
gtk_signal_connect(GTK_OBJECT(statTable), "ghack_putstr",
GTK_SIGNAL_FUNC(ghack_status_window_put_string), NULL);
gtk_signal_connect(GTK_OBJECT(statTable), "ghack_clear",
GTK_SIGNAL_FUNC(ghack_status_window_clear), NULL);
gtk_signal_connect(GTK_OBJECT(statTable), "ghack_curs",
GTK_SIGNAL_FUNC(ghack_status_window_cursor_to), NULL);
gtk_signal_connect(GTK_OBJECT(statTable), "gnome_delay_output",
GTK_SIGNAL_FUNC(ghack_delay), NULL);
/* Lastly, show the status window and everything in it */
gtk_widget_show_all(statTable);
return GTK_WIDGET(statTable);
}
void
ghack_status_window_update_stats()
{
char buf[BUFSZ];
gchar *buf1;
const char *hung;
const char *enc;
static int firstTime = TRUE;
long umoney;
/* First, fill in the player name and the dungeon level */
strcpy(buf, g.plname);
if ('a' <= buf[0] && buf[0] <= 'z')
buf[0] += 'A' - 'a';
strcat(buf, " the ");
if (u.mtimedone) {
char mname[BUFSZ];
int k = 0;
strcpy(mname, mons[u.umonnum].mname);
while (mname[k] != 0) {
if ((k == 0 || (k > 0 && mname[k - 1] == ' ')) && 'a' <= mname[k]
&& mname[k] <= 'z') {
mname[k] += 'A' - 'a';
}
k++;
}
strcat(buf, mname);
} else {
strcat(buf, rank_of(u.ulevel, pl_character[0], flags.female));
}
gtk_label_get(GTK_LABEL(titleLabel), &buf1);
if (strcmp(buf1, buf) != 0 && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(titleLabel, bigStyle, bigGreenStyle);
}
gtk_label_set(GTK_LABEL(titleLabel), buf);
if (In_endgame(&u.uz)) {
strcpy(buf, (Is_astralevel(&u.uz) ? "Astral Plane" : "End Game"));
} else {
sprintf(buf, "%s, level %d", dungeons[u.uz.dnum].dname, depth(&u.uz));
}
if (lastDepth > depth(&u.uz) && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(dgnLevelLabel, bigStyle, bigRedStyle);
} else if (lastDepth < depth(&u.uz) && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(dgnLevelLabel, bigStyle, bigGreenStyle);
}
lastDepth = depth(&u.uz);
gtk_label_set(GTK_LABEL(dgnLevelLabel), buf);
/* Next, fill in the player's stats */
if (ACURR(A_STR) > 118) {
sprintf(buf, "STR:%d", ACURR(A_STR) - 100);
} else if (ACURR(A_STR) == 118) {
sprintf(buf, "STR:18/**");
} else if (ACURR(A_STR) > 18) {
sprintf(buf, "STR:18/%02d", ACURR(A_STR) - 18);
} else {
sprintf(buf, "STR:%d", ACURR(A_STR));
}
if (lastStr < ACURR(A_STR) && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(strLabel, normalStyle, greenStyle);
} else if (lastStr > ACURR(A_STR) && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(strLabel, normalStyle, redStyle);
}
lastStr = ACURR(A_STR);
gtk_label_set(GTK_LABEL(strLabel), buf);
sprintf(buf, "INT:%d", ACURR(A_INT));
if (lastInt < ACURR(A_INT) && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(intLabel, normalStyle, greenStyle);
} else if (lastInt > ACURR(A_INT) && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(intLabel, normalStyle, redStyle);
}
lastInt = ACURR(A_INT);
gtk_label_set(GTK_LABEL(intLabel), buf);
sprintf(buf, "WIS:%d", ACURR(A_WIS));
if (lastWis < ACURR(A_WIS) && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(wisLabel, normalStyle, greenStyle);
} else if (lastWis > ACURR(A_WIS) && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(wisLabel, normalStyle, redStyle);
}
lastWis = ACURR(A_WIS);
gtk_label_set(GTK_LABEL(wisLabel), buf);
sprintf(buf, "DEX:%d", ACURR(A_DEX));
if (lastDex < ACURR(A_DEX) && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(dexLabel, normalStyle, greenStyle);
} else if (lastDex > ACURR(A_DEX) && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(dexLabel, normalStyle, redStyle);
}
lastDex = ACURR(A_DEX);
gtk_label_set(GTK_LABEL(dexLabel), buf);
sprintf(buf, "CON:%d", ACURR(A_CON));
if (lastCon < ACURR(A_CON) && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(conLabel, normalStyle, greenStyle);
} else if (lastCon > ACURR(A_CON) && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(conLabel, normalStyle, redStyle);
}
lastCon = ACURR(A_CON);
gtk_label_set(GTK_LABEL(conLabel), buf);
sprintf(buf, "CHA:%d", ACURR(A_CHA));
if (lastCha < ACURR(A_CHA) && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(chaLabel, normalStyle, greenStyle);
} else if (lastCha > ACURR(A_CHA) && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(chaLabel, normalStyle, redStyle);
}
lastCha = ACURR(A_CHA);
gtk_label_set(GTK_LABEL(chaLabel), buf);
/* Now do the non-pixmaped stats (gold and such) */
umoney = money_cnt(g.invent);
sprintf(buf, "Au:%ld", umoney);
if (lastAu < umoney && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(goldLabel, normalStyle, greenStyle);
} else if (lastAu > umoney && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(goldLabel, normalStyle, redStyle);
}
lastAu = umoney;
gtk_label_set(GTK_LABEL(goldLabel), buf);
if (u.mtimedone) {
/* special case: when polymorphed, show "HD", disable exp */
sprintf(buf, "HP:%d/%d", ((u.mh > 0) ? u.mh : 0), u.mhmax);
if ((lastHP < u.mh || lastMHP < u.mhmax) && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(hpLabel, normalStyle, greenStyle);
} else if ((lastHP > u.mh || lastMHP > u.mhmax)
&& firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(hpLabel, normalStyle, redStyle);
}
lastHP = u.mh;
lastMHP = u.mhmax;
} else {
sprintf(buf, "HP:%d/%d", ((u.uhp > 0) ? u.uhp : 0), u.uhpmax);
if ((lastHP < u.uhp || lastMHP < u.uhpmax) && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(hpLabel, normalStyle, greenStyle);
} else if ((lastHP > u.uhp || lastMHP > u.uhpmax)
&& firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(hpLabel, normalStyle, redStyle);
}
lastHP = u.uhp;
lastMHP = u.uhpmax;
}
gtk_label_set(GTK_LABEL(hpLabel), buf);
if (u.mtimedone) {
/* special case: when polymorphed, show "HD", disable exp */
sprintf(buf, "HD:%d", mons[u.umonnum].mlevel);
if (lastLevel < mons[u.umonnum].mlevel && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(levlLabel, normalStyle, greenStyle);
} else if (lastLevel > mons[u.umonnum].mlevel && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(levlLabel, normalStyle, redStyle);
}
lastLevel = mons[u.umonnum].mlevel;
} else {
sprintf(buf, "Level:%d", u.ulevel);
if (lastLevel < u.ulevel && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(levlLabel, normalStyle, greenStyle);
} else if (lastLevel > u.ulevel && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(levlLabel, normalStyle, redStyle);
}
lastLevel = u.ulevel;
}
gtk_label_set(GTK_LABEL(levlLabel), buf);
sprintf(buf, "Power:%d/%d", u.uen, u.uenmax);
if ((lastPOW < u.uen || lastMPOW < u.uenmax) && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(powLabel, normalStyle, greenStyle);
}
if ((lastPOW > u.uen || lastMPOW > u.uenmax) && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(powLabel, normalStyle, redStyle);
}
lastPOW = u.uen;
lastMPOW = u.uenmax;
gtk_label_set(GTK_LABEL(powLabel), buf);
sprintf(buf, "AC:%d", u.uac);
if (lastAC > u.uac && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(acLabel, normalStyle, greenStyle);
} else if (lastAC < u.uac && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(acLabel, normalStyle, redStyle);
}
lastAC = u.uac;
gtk_label_set(GTK_LABEL(acLabel), buf);
if (flags.showexp) {
sprintf(buf, "Exp:%ld", u.uexp);
if (lastExp < u.uexp && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(expLabel, normalStyle, greenStyle);
} else if (lastExp > u.uexp && firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(expLabel, normalStyle, redStyle);
}
lastExp = u.uexp;
gtk_label_set(GTK_LABEL(expLabel), buf);
} else {
gtk_label_set(GTK_LABEL(expLabel), "");
}
if (flags.time) {
sprintf(buf, "Time:%ld", g.moves);
gtk_label_set(GTK_LABEL(timeLabel), buf);
} else
gtk_label_set(GTK_LABEL(timeLabel), "");
#ifdef SCORE_ON_BOTL
if (flags.showscore) {
sprintf(buf, "Score:%ld", botl_score());
gtk_label_set(GTK_LABEL(scoreLabel), buf);
} else
gtk_label_set(GTK_LABEL(scoreLabel), "");
#else
{
gtk_label_set(GTK_LABEL(scoreLabel), "");
}
#endif
/* See if their alignment has changed */
if (lastAlignment != u.ualign.type) {
if (firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(alignLabel, normalStyle, redStyle);
}
lastAlignment = u.ualign.type;
/* looks like their alignment has changed -- change out the icon */
if (u.ualign.type == A_CHAOTIC) {
gtk_label_set(GTK_LABEL(alignLabel), "Chaotic");
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(alignPix), chaotic_xpm);
} else if (u.ualign.type == A_NEUTRAL) {
gtk_label_set(GTK_LABEL(alignLabel), "Neutral");
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(alignPix), neutral_xpm);
} else {
gtk_label_set(GTK_LABEL(alignLabel), "Lawful");
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(alignPix), lawful_xpm);
}
}
hung = hu_stat[u.uhs];
if (lastHungr != u.uhs) {
if (firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(hungerLabel, normalStyle, redStyle);
}
lastHungr = u.uhs;
if (hung[0] == ' ') {
gtk_label_set(GTK_LABEL(hungerLabel), " ");
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(hungerPix), nothing_xpm);
} else if (u.uhs == 0 /* SATIATED */) {
gtk_label_set(GTK_LABEL(hungerLabel), hung);
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(hungerPix), satiated_xpm);
} else {
gtk_label_set(GTK_LABEL(hungerLabel), hung);
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(hungerPix), hungry_xpm);
}
}
if (lastConf != Confusion) {
if (firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(confuLabel, normalStyle, redStyle);
}
lastConf = Confusion;
if (Confusion) {
gtk_label_set(GTK_LABEL(confuLabel), "Confused");
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(confuPix), confused_xpm);
} else {
gtk_label_set(GTK_LABEL(confuLabel), " ");
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(confuPix), nothing_xpm);
}
}
if (lastBlind != Blind) {
if (firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(blindLabel, normalStyle, redStyle);
}
lastBlind = Blind;
if (Blind) {
gtk_label_set(GTK_LABEL(blindLabel), "Blind");
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(blindPix), blind_xpm);
} else {
gtk_label_set(GTK_LABEL(blindLabel), " ");
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(blindPix), nothing_xpm);
}
}
if (lastStun != Stunned) {
if (firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(stunLabel, normalStyle, redStyle);
}
lastStun = Stunned;
if (Stunned) {
gtk_label_set(GTK_LABEL(stunLabel), "Stun");
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(stunPix), stunned_xpm);
} else {
gtk_label_set(GTK_LABEL(stunLabel), " ");
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(stunPix), nothing_xpm);
}
}
if (lastHalu != Hallucination) {
if (firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(halluLabel, normalStyle, redStyle);
}
lastHalu = Hallucination;
if (Hallucination) {
gtk_label_set(GTK_LABEL(halluLabel), "Hallu");
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(halluPix), hallu_xpm);
} else {
gtk_label_set(GTK_LABEL(halluLabel), " ");
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(halluPix), nothing_xpm);
}
}
if (lastSick != Sick) {
if (firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(sickLabel, normalStyle, redStyle);
}
lastSick = Sick;
if (Sick) {
if (u.usick_type & SICK_VOMITABLE) {
gtk_label_set(GTK_LABEL(sickLabel), "FoodPois");
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(sickPix), sick_fp_xpm);
} else if (u.usick_type & SICK_NONVOMITABLE) {
gtk_label_set(GTK_LABEL(sickLabel), "Ill");
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(sickPix), sick_il_xpm);
} else {
gtk_label_set(GTK_LABEL(sickLabel), "FoodPois");
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(sickPix), sick_fp_xpm);
}
} else {
gtk_label_set(GTK_LABEL(sickLabel), " ");
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(sickPix), nothing_xpm);
}
}
enc = enc_stat[near_capacity()];
if (lastEncumb != near_capacity()) {
if (firstTime == FALSE) {
/* Ok, this changed so add it to the highlighing list */
ghack_highlight_widget(encumbLabel, normalStyle, redStyle);
}
lastEncumb = near_capacity();
switch (lastEncumb) {
case 0:
gtk_label_set(GTK_LABEL(encumbLabel), " ");
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(encumbPix), nothing_xpm);
break;
case 1:
gtk_label_set(GTK_LABEL(encumbLabel), enc);
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(encumbPix), slt_enc_xpm);
break;
case 2:
gtk_label_set(GTK_LABEL(encumbLabel), enc);
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(encumbPix), mod_enc_xpm);
break;
case 3:
gtk_label_set(GTK_LABEL(encumbLabel), enc);
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(encumbPix), hvy_enc_xpm);
break;
case 4:
gtk_label_set(GTK_LABEL(encumbLabel), enc);
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(encumbPix), ext_enc_xpm);
break;
case 5:
gtk_label_set(GTK_LABEL(encumbLabel), enc);
gnome_pixmap_load_xpm_d(GNOME_PIXMAP(encumbPix), ovr_enc_xpm);
}
}
firstTime = FALSE;
}
static void
ghack_fade_highlighting()
{
GList *item;
Highlight *highlt;
/* Remove any items from the queue if their time is up */
for (item = g_list_first(s_HighLightList); item;) {
highlt = (Highlight *) item->data;
if (highlt) {
if (highlt->nTurnsLeft <= 0) {
gtk_widget_set_style(GTK_WIDGET(highlt->widget),
highlt->oldStyle);
s_HighLightList = g_list_remove_link(s_HighLightList, item);
g_free(highlt);
g_list_free_1(item);
item = g_list_first(s_HighLightList);
continue;
} else
(highlt->nTurnsLeft)--;
}
if (item)
item = item->next;
else
break;
}
}
/* Widget changed, so add it to the highlighing list */
static void
ghack_highlight_widget(GtkWidget *widget, GtkStyle *oldStyle,
GtkStyle *newStyle)
{
Highlight *highlt;
GList *item;
/* Check if this widget is already in the queue. If so then
* remove it, so we will only have the new entry in the queue */
for (item = g_list_first(s_HighLightList); item;) {
highlt = (Highlight *) item->data;
if (highlt) {
if (highlt->widget == widget) {
s_HighLightList = g_list_remove_link(s_HighLightList, item);
g_free(highlt);
g_list_free_1(item);
break;
}
}
if (item)
item = item->next;
else
break;
}
/* Ok, now highlight this widget and add it into the fade
* highlighting queue */
highlt = g_new(Highlight, 1);
highlt->nTurnsLeft = NUM_TURNS_HIGHLIGHTED;
highlt->oldStyle = oldStyle;
highlt->widget = widget;
s_HighLightList = g_list_prepend(s_HighLightList, highlt);
gtk_widget_set_style(GTK_WIDGET(widget), newStyle);
}

View File

@@ -0,0 +1,14 @@
/* NetHack 3.6 gnstatus.h $NHDT-Date: 1432512805 2015/05/25 00:13:25 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef GnomeHackStatusWindow_h
#define GnomeHackStatusWindow_h
#include <gnome.h>
#include "config.h"
#include "global.h"
GtkWidget *ghack_init_status_window();
#endif /* GnomeHackStatusWindow_h */

151
outdated/win/gnome/gntext.c Normal file
View File

@@ -0,0 +1,151 @@
/* NetHack 3.6 gntext.c $NHDT-Date: 1432512804 2015/05/25 00:13:24 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#include "gntext.h"
#include "gnmain.h"
#include <gnome.h>
/* include the standard RIP window (win/X11/rip.xpm) */
#include "gn_rip.h"
/* dimensions of the pixmap */
#define RIP_IMAGE_WIDTH 400
#define RIP_IMAGE_HEIGHT 200
/* dimensions and location of area where we can draw text on the pixmap */
#define RIP_DRAW_WIDTH 84
#define RIP_DRAW_HEIGHT 89
#define RIP_DRAW_X 114
#define RIP_DRAW_Y 69
/* Text Window widgets */
GtkWidget *RIP = NULL;
GtkWidget *RIPlabel = NULL;
GtkWidget *TW_window = NULL;
GnomeLess *gless;
static int showRIP = 0;
void
ghack_text_window_clear(GtkWidget *widget, gpointer data)
{
g_assert(gless != NULL);
gtk_editable_delete_text(GTK_EDITABLE(gless->text), 0, 0);
}
void
ghack_text_window_destroy()
{
TW_window = NULL;
}
void
ghack_text_window_display(GtkWidget *widget, boolean block, gpointer data)
{
if (showRIP == 1) {
gtk_widget_show(GTK_WIDGET(RIP));
gtk_window_set_title(GTK_WINDOW(TW_window), "Rest In Peace");
}
gtk_signal_connect(GTK_OBJECT(TW_window), "destroy",
(GtkSignalFunc) ghack_text_window_destroy, NULL);
if (block)
gnome_dialog_run(GNOME_DIALOG(TW_window));
else
gnome_dialog_run_and_close(GNOME_DIALOG(TW_window));
if (showRIP == 1) {
showRIP = 0;
gtk_widget_hide(GTK_WIDGET(RIP));
gtk_window_set_title(GTK_WINDOW(TW_window), "Text Window");
}
}
void
ghack_text_window_put_string(GtkWidget *widget, int attr, const char *text,
gpointer data)
{
if (text == NULL)
return;
/* Don't bother with attributes yet */
gtk_text_insert(GTK_TEXT(gless->text), NULL, NULL, NULL, text, -1);
gtk_text_insert(GTK_TEXT(gless->text), NULL, NULL, NULL, "\n", -1);
}
GtkWidget *
ghack_init_text_window()
{
GtkWidget *pixmap;
if (TW_window)
return (GTK_WIDGET(TW_window));
TW_window = gnome_dialog_new("Text Window", GNOME_STOCK_BUTTON_OK, NULL);
gtk_window_set_default_size(GTK_WINDOW(TW_window), 500, 400);
gtk_window_set_policy(GTK_WINDOW(TW_window), TRUE, TRUE, FALSE);
gtk_window_set_title(GTK_WINDOW(TW_window), "Text Window");
/* create GNOME pixmap object */
pixmap = gnome_pixmap_new_from_xpm_d(rip_xpm);
g_assert(pixmap != NULL);
gtk_widget_show(GTK_WIDGET(pixmap));
/* create label with our "death message", sized to fit into the
* tombstone */
RIPlabel = gtk_label_new("RIP");
g_assert(RIPlabel != NULL);
/* gtk_label_set_justify is broken? */
gtk_label_set_justify(GTK_LABEL(RIPlabel), GTK_JUSTIFY_CENTER);
gtk_label_set_line_wrap(GTK_LABEL(RIPlabel), TRUE);
gtk_widget_set_usize(RIPlabel, RIP_DRAW_WIDTH, RIP_DRAW_HEIGHT);
gtk_widget_show(RIPlabel);
/* create a fixed sized widget for the RIP pixmap */
RIP = gtk_fixed_new();
g_assert(RIP != NULL);
gtk_widget_set_usize(RIP, RIP_IMAGE_WIDTH, RIP_IMAGE_HEIGHT);
gtk_fixed_put(GTK_FIXED(RIP), pixmap, 0, 0);
gtk_fixed_put(GTK_FIXED(RIP), RIPlabel, RIP_DRAW_X, RIP_DRAW_Y);
gtk_widget_show(RIP);
gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(TW_window)->vbox), RIP, TRUE,
TRUE, 0);
/* create a gnome Less widget for the text stuff */
gless = GNOME_LESS(gnome_less_new());
g_assert(gless != NULL);
gtk_widget_show(GTK_WIDGET(gless));
gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(TW_window)->vbox),
GTK_WIDGET(gless), TRUE, TRUE, 0);
/* Hook up some signals */
gtk_signal_connect(GTK_OBJECT(TW_window), "ghack_putstr",
GTK_SIGNAL_FUNC(ghack_text_window_put_string), NULL);
gtk_signal_connect(GTK_OBJECT(TW_window), "ghack_clear",
GTK_SIGNAL_FUNC(ghack_text_window_clear), NULL);
gtk_signal_connect(GTK_OBJECT(TW_window), "ghack_display",
GTK_SIGNAL_FUNC(ghack_text_window_display), NULL);
/* Center the dialog over over parent */
gnome_dialog_set_parent(GNOME_DIALOG(TW_window),
GTK_WINDOW(ghack_get_main_window()));
gtk_window_set_modal(GTK_WINDOW(TW_window), TRUE);
gtk_widget_show_all(TW_window);
gtk_widget_hide(GTK_WIDGET(RIP));
gnome_dialog_close_hides(GNOME_DIALOG(TW_window), TRUE);
return GTK_WIDGET(TW_window);
}
void
ghack_text_window_rip_string(const char *string)
{
/* This is called to specify that the next message window will
* be a RIP window, which will include this text */
showRIP = 1;
gtk_label_set(GTK_LABEL(RIPlabel), string);
}

View File

@@ -0,0 +1,21 @@
/* NetHack 3.6 gntext.h $NHDT-Date: 1432512805 2015/05/25 00:13:25 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef GnomeHackTextWindow_h
#define GnomeHackTextWindow_h
#include <gnome.h>
#include "config.h"
#include "global.h"
GtkWidget *ghack_init_text_window();
void ghack_text_window_clear(GtkWidget *widget, gpointer data);
void ghack_text_window_destroy();
void ghack_text_window_display(GtkWidget *widget, boolean block,
gpointer data);
void ghack_text_window_put_string(GtkWidget *widget, int attr,
const char *text, gpointer data);
void ghack_text_window_rip_string(const char *ripString);
#endif /* GnomeHackTextWindow_h */

103
outdated/win/gnome/gnworn.c Normal file
View File

@@ -0,0 +1,103 @@
/* NetHack 3.6 gnworn.c 2009/05/06 10:58:06 1.3 */
/*
* $NHDT-Date: 1432512804 2015/05/25 00:13:24 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $
*/
/* Copyright (C) 2002, Dylan Alex Simon */
/* NetHack may be freely redistributed. See license for details. */
#include "gnworn.h"
#include "gnglyph.h"
#include "gnsignal.h"
#include "gnomeprv.h"
#define WORN_WIDTH 3
#define WORN_HEIGHT 6
#define WORN_OBJECT_LIST /* struct obj *[WORN_HEIGHT][WORN_WIDTH] = */ \
{ \
{ \
uquiver, uarmh, u.twoweap ? NULL : uswapwep \
} \
, { u.twoweap ? uswapwep : NULL, ublindf, uwep }, \
{ uleft, uamul, uright }, { uarms, uarmc, uarmg }, \
{ uarmu, uarm, uskin }, \
{ \
uball, uarmf, uchain \
} \
}
static GtkWidget *worn_contents[WORN_HEIGHT][WORN_WIDTH];
static struct obj *last_worn_objects[WORN_HEIGHT][WORN_WIDTH];
GdkImlibImage *image_of_worn_object(struct obj *o);
void ghack_worn_display(GtkWidget *win, boolean block, gpointer data);
GtkWidget *
ghack_init_worn_window()
{
GtkWidget *top;
GtkWidget *table;
GtkWidget *tablealign;
GtkWidget *label;
int i, j;
top = gtk_vbox_new(FALSE, 2);
table = gtk_table_new(WORN_HEIGHT, WORN_WIDTH, TRUE);
for (i = 0; i < WORN_HEIGHT; i++) {
for (j = 0; j < WORN_WIDTH; j++) {
worn_contents[i][j] =
gnome_pixmap_new_from_imlib(image_of_worn_object(NULL));
last_worn_objects[i][j] = NULL; /* a pointer that will never be */
gtk_table_attach(GTK_TABLE(table),
GTK_WIDGET(worn_contents[i][j]), j, j + 1, i,
i + 1, 0, 0, 0, 0);
}
}
tablealign = gtk_alignment_new(0.5, 0.0, 0.0, 1.0);
gtk_box_pack_start(GTK_BOX(top), tablealign, FALSE, FALSE, 0);
gtk_container_add(GTK_CONTAINER(tablealign), table);
label = gtk_label_new("Equipment");
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
gtk_box_pack_start(GTK_BOX(top), label, FALSE, FALSE, 0);
gtk_signal_connect(GTK_OBJECT(top), "ghack_display",
GTK_SIGNAL_FUNC(ghack_worn_display), NULL);
return top;
}
GdkImlibImage *
image_of_worn_object(struct obj *o)
{
int glyph;
GdkImlibImage *im;
if (o)
glyph = obj_to_glyph(o, rn2_on_display_rng);
else
glyph = cmap_to_glyph(S_stone);
im = ghack_image_from_glyph(glyph, FALSE);
return im;
}
void
ghack_worn_display(GtkWidget *win, boolean block, gpointer data)
{
int i, j;
struct obj *worn_objects[WORN_HEIGHT][WORN_WIDTH] = WORN_OBJECT_LIST;
for (i = 0; i < WORN_HEIGHT; i++) {
for (j = 0; j < WORN_WIDTH; j++) {
if (worn_objects[i][j] != last_worn_objects[i][j]) {
last_worn_objects[i][j] = worn_objects[i][j];
gnome_pixmap_load_imlib(
GNOME_PIXMAP(worn_contents[i][j]),
image_of_worn_object(worn_objects[i][j]));
}
}
}
}

View File

@@ -0,0 +1,17 @@
/* NetHack 3.6 gnworn.h 2009/05/06 10:58:06 1.3 */
/*
* $NHDT-Date: 1432512804 2015/05/25 00:13:24 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $
*/
/* Copyright (C) 2002 by Dylan Alex Simon */
/* NetHack may be freely redistributed. See license for details. */
#ifndef GnomeHackWornWindow_h
#define GnomeHackWornWindow_h
#include <gnome.h>
#include "config.h"
#include "global.h"
GtkWidget *ghack_init_worn_window();
#endif /* GnomeHackWornWindow_h */

View File

@@ -0,0 +1,70 @@
/* NetHack 3.6 gnyesno.c $NHDT-Date: 1432512807 2015/05/25 00:13:27 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#include "gnbind.h"
#include "gnyesno.h"
int
ghack_yes_no_dialog(const char *question, const char *choices, int def)
{
int i = 0, ret;
gchar button_name[BUFSZ];
GtkWidget *box;
GtkWidget *mainWnd = NULL;
box = gnome_message_box_new(question, GNOME_MESSAGE_BOX_QUESTION, NULL);
/* add buttons for each choice */
if (!strcmp(GNOME_STOCK_BUTTON_OK, choices)) {
gnome_dialog_append_button(GNOME_DIALOG(box), GNOME_STOCK_BUTTON_OK);
gnome_dialog_set_default(GNOME_DIALOG(box), 0);
gnome_dialog_set_accelerator(GNOME_DIALOG(box), 0, 'o', 0);
#if 0
g_print("Setting accelerator '%c' for button %d\n", 'o', 0);
#endif
} else {
for (; choices[i] != '\0'; i++) {
if (choices[i] == 'y') {
sprintf(button_name, GNOME_STOCK_BUTTON_YES);
} else if (choices[i] == 'n') {
sprintf(button_name, GNOME_STOCK_BUTTON_NO);
} else if (choices[i] == 'q') {
sprintf(button_name, "Quit");
} else {
sprintf(button_name, "%c", choices[i]);
}
if (def == choices[i])
gnome_dialog_set_default(GNOME_DIALOG(box), i);
gnome_dialog_append_button(GNOME_DIALOG(box), button_name);
gnome_dialog_set_accelerator(GNOME_DIALOG(box), i, choices[i], 0);
#if 0
g_print("Setting accelerator '%c' for button %d\n", choices[i], i);
#endif
}
}
#if 0
/* Perhaps add in a quit game button, like this... */
gnome_dialog_append_button ( GNOME_DIALOG(box), GNOME_STOCK_BUTTON_CLOSE);
gnome_dialog_set_accelerator( GNOME_DIALOG(box), i, choices[i], 0);
g_print("Setting accelerator '%c' for button %d\n", 'Q', i);
#endif
gnome_dialog_set_close(GNOME_DIALOG(box), TRUE);
mainWnd = ghack_get_main_window();
gtk_window_set_modal(GTK_WINDOW(box), TRUE);
gtk_window_set_title(GTK_WINDOW(box), "GnomeHack");
if (mainWnd != NULL) {
gnome_dialog_set_parent(GNOME_DIALOG(box), GTK_WINDOW(mainWnd));
}
ret = gnome_dialog_run_and_close(GNOME_DIALOG(box));
#if 0
g_print("You selected button %d\n", ret);
#endif
if (ret == -1)
return ('\033');
else
return (choices[ret]);
}

View File

@@ -0,0 +1,11 @@
/* NetHack 3.6 gnyesno.h $NHDT-Date: 1432512807 2015/05/25 00:13:27 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
/* NetHack may be freely redistributed. See license for details. */
#ifndef GnomeHackYesNoDialog_h
#define GnomeHackYesNoDialog_h
int ghack_yes_no_dialog(const char *szQuestionStr, const char *szChoicesStr,
int nDefault);
#endif

View File

@@ -0,0 +1,353 @@
/* XPM */
static char * mapbg_xpm[] = {
"96 96 254 2",
" c None",
". c #BC6C33",
"+ c #AC6324",
"@ c #B46B2B",
"# c #B47734",
"$ c #AC6B2C",
"% c #B46C3D",
"& c #BC7945",
"* c #A4774B",
"= c #B48643",
"- c #AC7F40",
"; c #AC773A",
"> c #C49054",
", c #C48044",
"' c #B4642C",
") c #B45E21",
"! c #BC642B",
"~ c #BD723E",
"{ c #C4884E",
"] c #C48F4B",
"^ c #C49753",
"/ c #CC9052",
"( c #CC7234",
"_ c #B4804F",
": c #C4985D",
"< c #946232",
"[ c #AC6431",
"} c #C46637",
"| c #945222",
"1 c #8C5435",
"2 c #844C29",
"3 c #945836",
"4 c #AC653D",
"5 c #A45E2B",
"6 c #AC5E2A",
"7 c #A44D21",
"8 c #A45823",
"9 c #A4592C",
"0 c #B46C34",
"a c #B46536",
"b c #AC7240",
"c c #AC7231",
"d c #944C1B",
"e c #8C5223",
"f c #945722",
"g c #AC6B34",
"h c #944C24",
"i c #9C5222",
"j c #B47234",
"k c #C4783B",
"l c #BC7833",
"m c #BC7F3B",
"n c #BC8044",
"o c #BC783C",
"p c #A46332",
"q c #9C6331",
"r c #B4773C",
"s c #B4723D",
"t c #A46B33",
"u c #B48043",
"v c #CC814C",
"w c #B46422",
"x c #C47946",
"y c #C48743",
"z c #BC6D3D",
"A c #BC6536",
"B c #94522E",
"C c #A4643E",
"D c #B45E2F",
"E c #A45223",
"F c #9C4C1B",
"G c #B47845",
"H c #C4804D",
"I c #9C5723",
"J c #AC5E35",
"K c #A45935",
"L c #9B5E29",
"M c #BE7234",
"N c #BC8744",
"O c #AC5924",
"P c #A45E35",
"Q c #9C582C",
"R c #AC501F",
"S c #9C5935",
"T c #8C4D28",
"U c #643D21",
"V c #845437",
"W c #B47E31",
"X c #844126",
"Y c #B45823",
"Z c #954627",
"` c #9C4C24",
" . c #7C4124",
".. c #B4592D",
"+. c #9C5E37",
"@. c #945644",
"#. c #AC6C3E",
"$. c #8C4627",
"%. c #9C643E",
"&. c #744021",
"*. c #A4723C",
"=. c #844628",
"-. c #743819",
";. c #844019",
">. c #944D2D",
",. c #A4512C",
"'. c #B45227",
"). c #C4622A",
"!. c #9C522E",
"~. c #7C3A1A",
"{. c #BC5E24",
"]. c #CC8243",
"^. c #9C664C",
"/. c #AC5934",
"(. c #9C4E2E",
"_. c #7C4B29",
":. c #8C532C",
"<. c #A46423",
"[. c #7C422C",
"}. c #743214",
"|. c #AC592C",
"1. c #8C4224",
"2. c #C47F3C",
"3. c #8C421C",
"4. c #8C410F",
"5. c #8C5D3E",
"6. c #8C5B32",
"7. c #88461A",
"8. c #663626",
"9. c #AC6B4C",
"0. c #94411A",
"a. c #845C30",
"b. c #744B20",
"c. c #7C4D34",
"d. c #CC874A",
"e. c #D49053",
"f. c #C46C32",
"g. c #BC814D",
"h. c #CC7842",
"i. c #A45A44",
"j. c #8C4B1A",
"k. c #843204",
"l. c #945E37",
"m. c #7C564C",
"n. c #74422C",
"o. c #95461B",
"p. c #AC7747",
"q. c #745634",
"r. c #94572C",
"s. c #7C4621",
"t. c #CC7A54",
"u. c #B47654",
"v. c #BC5E2C",
"w. c #B49056",
"x. c #C4915C",
"y. c #B4874E",
"z. c #BC884D",
"A. c #A46C45",
"B. c #D48749",
"C. c #BC5A30",
"D. c #CCA06C",
"E. c #BCA26C",
"F. c #BC8F54",
"G. c #BC895C",
"H. c #BC8F4C",
"I. c #BC995E",
"J. c #C46D3D",
"K. c #D4985A",
"L. c #C4562C",
"M. c #843A16",
"N. c #C49F63",
"O. c #BC9652",
"P. c #B48F4C",
"Q. c #CC915C",
"R. c #BC5824",
"S. c #B49A60",
"T. c #CC9F60",
"U. c #DC995F",
"V. c #AC8A54",
"W. c #B4875F",
"X. c #C4885C",
"Y. c #BC905E",
"Z. c #CC975B",
"`. c #D4A167",
" + c #7C5334",
".+ c #9C6B39",
"++ c #845323",
"@+ c #B46D4C",
"#+ c #A46B3C",
"$+ c #CC9864",
"%+ c #8C4E34",
"&+ c #743A24",
"*+ c #6C3D2E",
"=+ c #C45E30",
"-+ c #AC7E52",
";+ c #9C6C47",
">+ c #6C3C1B",
",+ c #CC8954",
"'+ c #542810",
")+ c #7C5E3C",
"!+ c #84532C",
"~+ c #946C45",
"{+ c #946340",
"]+ c #BCA870",
"^+ c #B49E5C",
"/+ c #C47E5C",
"(+ c #AC8E44",
"_+ c #8C633A",
":+ c #C4A86C",
"<+ c #CCA76E",
"[+ c #CCA961",
"}+ c #7A462D",
"|+ c #8C6644",
"1+ c #744623",
"2+ c #A47248",
"3+ c #94624C",
"4+ c #845E3C",
"5+ c #7C5329",
"6+ c #9C7249",
"7+ c #844D34",
"8+ c #6C4C30",
"9+ c #A46E54",
"0+ c #A4624C",
"a+ c #6C3E24",
"b+ c #5C3224",
"c+ c #D4A66C",
"d+ c #744B30",
"e+ c #BC926C",
"f+ c #AC7954",
"g+ c #AC522C",
"h+ c #6C4526",
"i+ c #A47A54",
"j+ c #BC6644",
"k+ c #BC6E4C",
"l+ c #A48650",
"m+ c #AC825C",
"n+ c #CC6A34",
"o+ c #9C7E5C",
"p+ c #7C623C",
"q+ c #5C3A2C",
"r+ c #644A34",
"s+ c #4C3624",
"t+ c #844B1B",
"u+ c #7C4018",
"v+ c #D49A68",
"w+ c #7C4B1C",
"x+ c #742E04",
"y+ c #CC8157",
"z+ c #745A44",
"A+ c #B46644",
"B+ c #643614",
"C+ c #C4A65C",
"D+ c #843A04",
"E+ c #6C2E14",
". + @ # @ $ % & * = - ; > , ' . ) ! ~ { ] ^ ] / ( ' , _ : < [ } [ | 1 2 3 4 5 ! 6 7 8 ' 8 9 0 a b c d | [ 0 % e 8 f 5 ~ g h i % & % 5 a ' 8 ' a < j k l m { n o . ! 6 . 0 % p p q g r s 0 @ 0 . ",
"j + $ # @ t g s u > u c { v @ ! w ' ~ x y y m u . ) z r > f 5 A [ B 3 2 B C 6 @ D E E 8 F i 6 0 g G 0 o H , j d I I [ & % i f [ . @ . 6 J K 2 3 L $ . M o N # j D ' O % [ 0 p P L g & l 0 0 . % ",
"4 Q 5 % j $ @ g u / G t M k ' R 9 9 J A . M p 3 . O ! M { L 3 4 [ Q S T B Q 6 ' 6 6 J a a 9 9 a c & 0 ~ ~ z 0 L 5 8 5 [ [ d 8 & M . x i B 3 U V 3 4 . l & N m W 6 6 8 % [ g 8 5 q % & o j [ [ 0 ",
"3 X h [ 0 0 0 0 ~ n j p 0 z Y 7 T Z ` Y ! ' Q .a ..! . , t +.@.#.[ C S S 9 [ . D a J a z J 8 % , o + 8 8 [ @ ' J 9 Q 6 5 5 [ x P [ 4 $.1 %.&.V S p ~ o b *.; c 9 6 5 % [ [ 5 p p b & o 0 $ [ 6 ",
"=.-.;.9 a . j j . 0 [ @ z . Y O >.h ,.'.).! !.~.P D {.! ].& ^.T & & s % 4 [ A . 4 /.` Z (.d Q , H #.8 E 8 [ [ [ a 9 /.% z 0 . ~ _.1 :.T S C S | < <.M 0 | 2 T >.Q Q | [ 5 [ p 0 0 % # s j % 5 !.",
"[.}.~.!.' 0 @ @ . 6 O 0 ~ a D Y P K |.... . K 1.8 D {.! 2.y b Q o x % % a 6 . A ,.` 3.1.1.4.i ~ & 5 i d 8 J 9 [ A J |.D a D a a 5.3 .;.h 8 a I 6.f $ g 7.}.1.$.T T T +.Q 0 g 0 % % 0 0 0 % 5 h ",
"_.8.;.E 6 ' ' @ ' O 8 ' @ . a ..+ D 9 9 0 o ~ p 6 ' ! . , n 0 . 0 o [ A a |.a 6 ` 3.Z (.>.$.I 0 #.e h d !.J I C a D E F F 7 |.D 9.>.>.Z 0.9 a 8 a.b.Q [ =.;.!.K 2 T 7.S 5 #.[ 0 g [ g g % g J Q ",
"c.-.;.8 D ) @ w . ' w [ a ~ ~ Y O O 9 S c d.e.d.f.A . H g.# @ h.$ ~ [ % z |.. 6 /.Z ` i.Z d [ o %.j.S P 4 % Q p E 8 O 7 F Z E /.O k.a a 9 & #.l.m.n.B C j.T 5 ) :.:.2 q p % [ [ [ [ [ [ [ 4 p Q ",
"o.F i I 9 [ 0 0 ' 6 8 6 # n o 0 @ ) L W d.].0 [ + @ M k m ; $ @ $ 0 j 0 0 0 0 a c g G p.q f p s ' 0 d !.Q h & M Y '.7 E 7 7 7 R [ @ ) |.[ 4 3 b.q.b.2 L % g P r.j.I 6 a a 6 + [ [ p [ [ g & & I ",
"I d d E 0 ~ 0 6 ' O E 8 j n m . ( j # N 2.@ O !.@ @ ! M r # # M # m n , & r % s m r & o p I [ [ $ @ 7.Q P Q o j f.. O 8 F 7 O ..6 ' ' ..a a q 2 _.s.;.j.F o.o.j.I 5 p O 8 O @ M [ 0 0 g 0 o ~ L ",
"[ 9 F 9 z t.. O ' ) O w r n , ~ A % u.n o w |.|.a ' D ' o o n ~ j l , N n r G _ u 0 #.a |.[ 0 # n r | 9 P 8 0 [ l o o % g [ D 6 7 O ..Y a A 4 p C #.s ' O 6 D a g % 0 a [ 6 [ 0 @ , k o o n o c ",
"[ [ [ ' a . a |.8 O Y 0 o ~ . v./.r.S #.z . D D 5 6 ..! s & o ~ # o m r u _ w.x.y.p.[ J 6 % y z.] n p g a 6 @ [ # m y { m ~ @ @ 9 |.D ' A ~ % [ A.G x ~ ' ! 0 z 0 0 0 % . 0 [ [ [ o o $ M # 0 o ",
"g s ~ 0 0 a ' ' O ' ~ B.{ o ' C./.$.;.B ' A R ` Z ,...A . o & ~ y m N N ] : : D.E.F.G.g.G _ H.I.y N s % 0 a z M r u m & o o m m & & ~ ~ l j 0 <.t s G j $ 0 # j % [ 8 [ 0 % . ~ @ o o 0 r j # y ",
"o o l s o & , x 0 J.B.e.K., . L.a >.M.d 6 ! E 3.M.o...! . & n r 2.y n { > : : F.I.I.N.: y.F.O.P.n o a ' D 6 ' 0 $ c % o & o o m & G # j # r c [ q p L I I L <.p . ' [ 0 o % 0 % o k o o o o o , ",
"k n o o & { / Q., l ~ , { m ! R.D !.h 6 . . ) P 7.i ..w M m { n m n N z.z.z.y.= y.z.I.S.w.I.x.g.o ' 6 Y R O 8 [ [ a [ a z o r # s j j j @ 0 . 0 ~ . 0 0 0 0 0 o ! . o H o [ [ a g 6 [ s 0 g g g ",
"@ o o r c u > T.U.H # n ] n J.).D 6 0 k ( M ~ & +.[ D w l y / g.{ { { { N z.] > y z.w.w.V.W.X.& ~ 6 Y R Y ! ' 0 ~ a E 7 9 0 m n o k k k . ' D } D D A z z ' [ A 6 ' 0 0 p L [ x a I [ & & & s g ",
"I E D ! 0 s z.F.T.H.o o h.d., c j m / Y.Z.`.n t ' ' $ , y y N m m y y ] { z.n N n { ; > H.r / z.~ p E O D 6 ' . @ 5 i d F 5 g r [ j o 0 g % 0 [ ' 6 5 p I 4.4.o.o.d e U +c.6..+[ i j d.# m { p ",
"0 5 i O a g.Q.F.T.^ N o & ].n @ # m { b p.Q.N c ! a M , / { m m W m N z.z.n N y n { ; z.] u ] r 0 + 8 ..a D w @ @ ' 8 d T r.g r @ 0 g [ <.[ [ p 5 5 [ p Q Q 5 z 6 p :.b.V _.l.p s 5 0 m @ # { G ",
"H ~ [ a & H g._ > Z.: ] z.] , o . o ~ f Q H H j . . x y d., 2.o y N z.z.z.N n & { { ; z.> u { s 0 a D 6 v.a ' w Y O >. .&.2 q $ g 0 [ 5 5 [ [ [ 0 [ | 7.>.Q 9 h !.P ++2 5.=.4 @ C | Q P Q 5 0 k ",
"H , s % @+#.#+#+#.z.$+N.: Z.H k 0 a a E 9 & x ~ z k x , , l M k y ] > ^ > G.n m { N u ] ^ { y s k . a |.6 ! ' + {.|.%+&+*+V p l [ $ @ [ $ 0 0 p % S 7.$.B C Q T ;.3 T 2 @.%+a @ +.T $.>.K 9 [ k ",
"n & q B +.+.S p :.#+y.Y.w.H.{ , J.a a /.a z a o x k , o ~ . . f.# n ] : Z.: > { o n u > ^ { n o ~ J.a 9 6 0 . @ =+O T 8.8.1 [ 0 $ 0 s j % % g 0 +.Q S !.B h h f ~.4 t %.3 3 4 6 r.T X $.i.J a k ",
"~ % B e ^.%.e T 3 q * -+_ u H / x a a a A 0 [ & , { , n l M f.. . o z.> : : ] H o n N F.z.n o J.~ a [ [ 0 % M M w |.Z }.-.T L O j ~ o 0 $ [ [ % p 5 9 K i j.j.| 4.% G p 1 S B r.| T X Z K a [ . ",
"' % +.l.* ;+2 2 ;+%.q s b b u x.x % 0 . 0 M j n N z.y n o o f.! ).. & z.F.> z.n n n z.H.z.n 0 . a [ [ b & r g j @ 0 [ >.` K a ' 0 r o % [ 5 5 g $ p 8 9 a ~ o # D @ o #+T @.>+1 K 5 5 [ % ~ z J ",
"E a +.1 ;+;+6.A.* %.+.@+% p #+= #.g 0 0 M , r y u N N n o k . {.R.v.0 u G.F.{ z.,+y > H.H.G ' ' @ [ g n z.# $ <.<.0 a |.E a A 0 <.0 x o g L 8 [ <.% 0 8 8 @ k m B.M o g V 1 '+)+h Q @ j M 0 J o.",
"_..+^.!+6.l.l.l.~+;+6.V {+:.:.A.r.e q G F.N.]+]+^+I.^ K.d.' 6 z @ M % a /+{ y.H.(+T.^ u ,+2.a ' [ <.t y.x.y.b t L $ @ ' [ 0 # g j j r % [ I p g [ 0 O Y ) w 2.y l j $ @ 5 I P i I <.0 0 0 0 5 e ",
":.%.< :.1 {+l.3 ~+;+_+6.l.!+s.5.3 T q g.> > :+<+:+: H.y ].. ) A + ' 6 9 [ G z.> P.[+^ N { d.0 . . @ s g.z.n 0 @ j o o 0 @ M r # $ j o #.[ <.g #.j . 6 . . 0 , y j l k , g 8 p 5 [ g a z % a 5 i ",
"A.%.%.+.l.C #+%.{+~+{+{+5.}+n.}+3 6.#.H { z.> T.<+Z.n o , ~ ! a w ' D 9 !.[ n ] O.<+N.= ] y o l M . o o & s 0 . n n o 0 $ j r # $ j s 0 #.s s # g [ 9 0 z 5 g #+2.o , ,+d.H & 0 s % a a a [ J 5 ",
"b S %.C +.^.9.A.5.{+~+^.|+1+*+n.c.1 #.H x o H ,+> { n s x k . . . ! A A O a v y I.[+N.N H.y m 2.h.l l & o r ~ o & m r g g s o G j g b G G r r & r #.[ % 4 | S q o 5 <.~ , d.o $ z a 6 a a /.4 a ",
"#.3 +.%.r.+.2+b 5.5.3+;+5.c.n.n.8.T #.~ 0 z x & % & & o x M . z ! D A A D o d.d.: T.: H.z.] y ] 2.m n n z.N N n m G r # r r m r n g c g.{ G j o H r [ #.9 7.e q [ | [ $ g o o o % a [ J [ [ a a ",
"C p %.C {+l.;+;+{+4+3+;+l.%+2 .2 Q @+z J 6 K Q [ M & & , s 0 l ~ ' a ' ' o , n F.F.> H.m N N m N N u y.z.H.z.N n n n n z.n G o , s r G.F.r # & o & [ g L j.Q p o 5 0 [ 0 , o x M . s g % % % a ",
"C A.#+A.A.;+5.1 ~+5.{+;+^.S +.Q #.g ~ x 6 h $.=.. [ [ r g.o # , , H o 0 j o m N = N { N u u m r N N N n _ u = = & u u _ N _ n r & & n z.z.n o # x x j o o $ o r ].L + [ 0 d.g g 0 n , n u n % p ",
"q p.2+A.* ;+5+1+6+a.< A.#+#+~ g v ' . h.a $. .7+. + I #.{ { m / H e.{ k d.y N ] N N ] / n n y m N { { { G G u _ r b r u = u G r ~ g.{ u y.z.n @ 0 0 0 o 2.y ].m , + , o s , 0 & @ , { N , y o 5 ",
"k @ j j . H & 6.a.6+a.6+;+s ~ [ 2.j C C !.j.b.8+[ K j.l r H.N.P.= z.K.N Z.; N > r z.H.N ] r t o u u n n u u u V.<.G I p ;.g g u = V.H.u { # o g $ g G z.z.m m , N = = ] # y m # W <.o ~ ; t r t ",
". + $ [ ' ~ & .+l.;+l.2+9+#.~ a n q 1 2 T &.1+q.C [ % { y T.^ I.> z./ o e.r n z.# u N N { u # l u u m r r r p.u s % [ J I 5 r { z.u > u { r r 0 j ~ b g t #.o d.H.y N K.y { o r n g k o g.N { j ",
"D 9 + + O ' % b S 0+@.9+C C 4 z A.}+a+b+V &._.7+e p { { { c+F.<+Z.N n $ y 0 ~ % j $ r y n # ~ 0 u m n G r s G n & $ % 5 4 j.t n F.G.] g.{ r n 0 d.n p $.X I # 2.y n u y g 0 0 , 2.' . % & { e.. ",
"..|.6 a D D a j S @.2 3+1 5.S #.S [.d+U l.T +.B e b X.g.> D.F.N.x.z.r 6 M D ' |.0 [ o , r j ~ $ r n g.& & r r & s p % P % j.<.p.> z.z._ / n n o y & S ~.~.Q j m / H H v 5 I |.x M ' A /.5 s x a ",
"C./.9 9 D v.' . %.7+a+c.d+c.2 q !.1 3+2 #+9 % S u.Z.G.y.e+x.z.f+> { & [ . ....... 0 , v % . ~ ' [ b & n & s ~ s t #.& G & b _ g.z._ z.g./ g.{ H m g Q X >.s { y 5 L p , [ a [ x . ! A |.4.Q z {.",
"..g+d 0.7 ..' z %.c.U }+h+5+s.l.$.%+3 h ' ' z g G.$+-+_ Y.* f+r._ H & w D O ..D A z ~ o j % 0 a I [ s G r s b s G x.H X.G X.G.z.G.= G.z.x.z.> > z.u #.C b H > N <.| d % % h.~ ~ . } v./.~.d D v.",
"..|.d ;.F ..D . C T _.c.[.B $.P }+ .%+K z ' s _ z.i+-+i+_ 2+;+e t r z [ 6 |.|.A 6 a D [ 0 ~ 0 [ E [ s g.G G r u > : z._ p.G.F.P.Y.F.F.F.: y.> Z.Z.> g.n g.> ] > U.,+o , [ ~ a ! f.{...J 3.| D ! ",
"v.J.p h /.A A J.i.B B @.=.i.(.j+a.c.@.k+t.~ A.l+F..+e+m+W.f+;+:.P s % ' D a a z ..D 8 I ~ & 0 a /.@+x z.z.= y.z.x.y.p.A.b y.I.N.: Y.N.: : y.F.N.x.F.N y ] ] : T.r n n , 5 5 [ ' M ! /.k+B 4 . n+",
"] u 6 R ! A z g.I #.=.%+l.%+J a B T p [ & C k+g.u ; g.e+o+p+ +3 {+q #.[ 6 . o g [ H [ n { > N j D 6 a & { : I.w._ _ !+_.+.9.Y.N.]+S.I.F.Z.u n n u u - H.Z.N # y I l o u j j m l l l + $ K.] u : ",
"z.m @ ' f.~ ~ g.& & :.1 @.S % a %.+.C % @+[ u.& u b _ m+~+)+_+^.#+#.% @ [ . & c s d.g.> ] { z.N ~ z s u G.x.O.F.G -+c.&.1 ^.y.I.]+S.N.G.> n n N ] = ; W Z.] u n @ n o m n m , $ l 2.j k e.{ N Z.",
"n , j . k o n > { G e T 3 C H a P 0+J % [ [ % & n G _ f+|+4+2+f+p 4 % a ' ~ , s & % { { F.N z.z., n & n z.z.F.y.s 9+b.U c.@._ O.S.I.N.G.H.n { { N ] H.= H.y m y , , s j g j & . j M . M & [ 5 r ",
"n o j . o y z.T.,+_ r.:.:.#.,+a 3 K !.4 8 a % x u G u.A._+|+9+#.4 #.z a [ ~ x % G f u u > ^ z.N N u u g.z.z.g.G p 3 8+q+*+V p.] w.I.T.z.G.z.{ { u ] Z.> z.= r #.~ ].r g <.<.~ o ~ x k z A O i a ",
"& o j @ , N ] : K.{ p.#+p #.H g Q P Q a 6 ~ ~ H _ g.& _ p.-+p.#+% % @+0 0 % & #.& | G y.Z.> H.y.> z.u u g.g.G b i 2 r+s+8.7+#+r -+F.T.F.> g.{ g.> ] = u y.g.t t++ & & , r g j 0 o ~ z z z J D z ",
"0 o o o n & _ G.x.> { _ G g.H & #.s % s z H H & W.u.g.X.G.e+g.A.i.3 p % % 0 ~ z ~ #.g.> > y.u n Z.> u G r r s #.S 2 +}+n.3 C c u z.Z.> > g.{ & > N y.u p.u #.| g ~ r n H & & 0 r b g a a 6 ' a ",
"g o x o @+p +.@+= G.> { ,+{ g.{ g.g., o H v H #.6.1 %.u.-+i+2+l.:.u+!+#.s g M x % & G g.g.G ; u { z.{ n s % g 0 S 2 %.l.Q @+r G G u { G.> _ n G N u > > u p.u.g & G ; r u r u s F.= n & 0 . a a ",
"g o n % 9 $.>.0+z.> Z.Q.v+,+n ,+z.n n 0 , & u.I 8+&.1 A.* i+;++.5.&.++b r [ @ ~ % /+5 G g.g.n G c r { H & [ [ p 3 2 C t a ].{ u g.G z.z.: r _ & > u G.x.z._ b r.b n z.> N b G r P.- u n o ~ M 0 ",
";.P 9 ~ #.u+7.6.t u F.y.g.o k m . . a ~ I ~ j p ++s.w+;+{+< _ ;+7+l.2 _ 4 s ' M c c # & s g 0 k @ o u u r g 8 |.2 &.t+b P.w.y.r ; { z.H.; z.o s t ; z.: F.z.n ; # m r t #.c r & u H.; y o ~ ~ Q ",
"h T x+K & | r.r.% & y.u s s z s a 9 p [ g & n <.l.>+&.b 2+%.p.f+V 1 3 #.% g % o m u n & & % $ [ p 0 r r n g 9 6 +.e Q u F.P.N r n n ; = u { r s ; r y.x.y.N u # u N o c s s G g.] Z.= ] % a J T ",
"X S 3.j.9 K 4 Q A s s % % a 4 +.+.e Q r.G & d.g b 7.:.p.G p.b p.6.6.4 [ x % > z.z.{ { { y n o % $ j r u g.r [ a 3 Q 4 & _ y.n % p.n u g.; ; s H , n z.{ z.g.n o o , n s r & G H = F.= H 9 7 (.T ",
"~.P S 3.0.i a K J.~ & & u.@+^.l.l.1 3 e #.G { & u.r.C #.p.H G c .+t % J y+u.T.y.G.g.F.] { r & H ~ o G , ,+& [ [ T K % G ; - & g #.#.s g.s #.s ,+y 2.{ H r b & r #.& o s r o & n z.] z.{ 9 /.,.(.",
"S 1.M.,.|./.a a a u.n g.@++.c.8+V {+6.l.< G { / G +.p q #.{ r s u m % % x g.Y.l+X.#.#.u n g [ k+o ~ g & { & [ [ S a k+x p.G & 4 #.r.3 #.& & @+s r s & r 5 | Q p 9 #.s s o n G H H.F.z.n E ,.Z Z ",
"4 ` ` |.A ~ z J P #.s r t e q+s+c.~+5.q l.g.g.K.{ % t % s b 4 s r , 0 n H : : w./+r.7.+.; #.[ . s [ I [ & G p 4 S 4 k+n G u g.% 3 t+T Q u.#.#.t C p g % | 4.7.T >.C s r n N n z.F.z.z.G 7 ..Z >.",
"J a J.D |.J.~ E 4 C #.o z +.d+r+!+;+%.%.p.g.g.Q.K.X.r G s +.Q %.a o b > : T.T.: ~ Q u+=.P @+~ f.s [ i <.& & @+r | !.[ s G u & @+2 s.:.B #.p #+t 3 !.C a S h B :.$.P G n ] z.N F.Z.x.^ { [ } ..a ",
"D R D D O a 6 h (.h i ' a 4 5.z+6.%.A..+G.z.g.u z.K.G #.%.r.r.T 6 ~ n Z.N.F.> { . [ >.X T J . f.H g 8 #.y+H g.H 3 i 9 % ; p.b [ 6.s.=.T #.#.#+l.=.X 3 4 [ +.Q 3 $.C g.{ ^ ^ H.F.x.F.: 2.8 v.R [ ",
"E a D 8 8 6 5 I 5+5+!+B [ ~ C 5+#+* L u.#.s p #.0 [ #.3 +.1 1 =.p u.r Z./ n G H % 5 B 2 T L 0 ! $ l W m { n s o p.b g G ~ #.P +.l.w+w+f .+G r L 1+s.f K [ 6 9 o a P g & m m g.z.u m { , 0 O D ..",
"R |.O E 8 ' [ [ ++!+1 Q ..a [ {+G -+r.#+4 #+p g 8 5 C e 1 2 2 =.q r #.Q.{ r #.z.% p q L +.#.~ . j 2.m 2.{ { n l b p.n H g 5 +.#.b T j.+.% 0 0 @ 2 T S 5 [ 6 I 4 a 6 0 x & r n g.m u m G @ [ a |.",
"D D O O D 0 z ~ Q S K /...D % & _ f+f +.p #.p +.| +.C 2 2 2 5.2 p s g e.{ # c H & % #.b t #.4 ` K % m o g.H g.# p.s s % #.p S S K S J 4 x a [ D r.r.q [ % a i 5 a 6 0 o g [ #.#.o # 0 0 0 z . 6 ",
"A ..J D J J z ~ J P J a A ! z g.2+A.e P % @+C r.T l.A.7+2 7++.:.p G g / , n & H /+& u ] / Q.@+1.9 ~ ,+g.G z.,+y & p.#.g g 4 9 T 1.P @+/.~ 4 D 9 +.r.P [ o ~ I 8 a [ a 0 [ 5 P [ 0 g 0 g z , , [ ",
"v.O D 4 (.` /.a [ S 3 J . a #.A.l.C Q 5 k+s A.:.=.3 ^.s._.2 3 r.I ~ 0 m o , o s +.B e t z.Q.u.$.1.[ & <.j.r.G # s g.g.r #.[ P !.2 %.#.B C S P 4 P 9 p [ , & 5 8 [ p [ 0 [ [ a a ~ ' [ @ ~ v x 0 ",
"v./.D P Z h K 7 P r.T p s ~ q :.6.#+C 9 z C C :._.1 l.s.2 :.q !.Q ~ [ o k , ~ [ C B e L g.`.v+G @+H / #.t+Q & , s & n o r s [ d !+!+1 < 3 7.j.C [ /.[ g H , [ I S I p [ [ % z z % [ 0 z ~ k k 0 ",
"! |.P S X B J ` /.K S C z & q _.:.#+% |.4 Q +.V T 7+1 2 3 S [ 5 9 [ Q ~ H v % [ +.r.3 r.+._ : z.g.n y u I p ~ ' g o o r n , a d 2 s.2 b 3 T ;.C D J [ g H H [ 9 T T f [ g . % [ [ 5 ' o . 0 . . ",
"' E !.T u+S 4 h g+/.K J z z S . .C & D a >.S 7+%+2 1 2 +.p [ 5 i (.4.~ v x [ 0 +.C 9.+.3 b H.H.,+N ] / G x x 8 8 l Z./ m o ~ 6 :.T T 9.$.+.K A+/.|.[ g , ,+g 5 2 2 +.g % o 0 8 I | [ k % ) A k ",
"O O 8 Z h K p p <.+.r.B Q q :.&.&+S @+#.9 B S {+I f r.T 2 l.l.e ;.q 9 x x k ~ 9 q.B+1 0+S C s / 2.N ^ C+O.; [ v.Y 0 M ,+m n [ ' I I 5 % 4 t r r [ [ 0 0 , n { ; R O @ p.; #.p 9 7.Q #.% a O O z ",
"i 9 9 i !.L S r.< 3 >.:.Q +.:. .}+3 4 4 6 Q Q +.$ Q L 3 1 :.r.e | p 5 ~ 0 s [ 5 5.s.c.^.0+r.p n H m u H.z.j @ J.+ [ t r r n o k [ i S 4 #.s r # j 0 o 0 , o n n . ' <.p p r.!.Q Q P [ 4 % [ !.9 ",
"2 B P J 9 S :.c._.2 =.%+P #.4 @.T >.P 4 J 5 P %.[ % C 3 2 B l.T 9 [ [ . 6 z [ #._.>+'+c.{+_.Q #.,+# j m N r o , e./ ] u = n n s [ 3.3.P u.g.n N o c o 0 ~ g n { , 0 [ a [ B $.2 d Q Q Q C C B T ",
"&.1 P [ 6 3 2 1+c.V %+3 4 @+P >.%+%+B J [ K 9 P a P +.B 2 :.%.%.a [ z . 9 % r.C i.@.>+ +|+2 >.6 r M j ~ x d.z.N > Z.T.z.^ > / n J ;.u+Q u.{ { N G 0 % 0 0 5 0 n m j . a ..!.T u+7.5 4 r.>.1 2 =.",
"h+7++.J +.r.c.d+_.!+1 C #.o % S T =.>.S K Q Q J 4 7.X 1 1 2 C H ~ % x z 5 [ T B 0+3 V 1+4+l.B a <.0 z ' . , y r - N Z.= H.z./ z.& S | #.G n z.u N j o 0 o O [ [ N , % E ` !.S :.I % @+Q 2 _.n.n.",
"n.7+3 3 r.B !+V b.++3 +.j o 0 S =.2 T B >.>.(.K $.T _.&._.A.& ~ b s % & g #.L q d 2 1 a+u+%.I % 6 M ~ w [ o , r n { > n u u N z.,+G s G g.y.z.z.n r r 0 . 8 8 I o d.& |.i J 4 S 6 g p B 1 2 n.a+",
"=.=.7+V 6.1 1 r.l.{+S +.5 p r.;.c.7+7+2 T >.>.(. .1 +U _._ ,+6 l.C L s s & g.X.s #.#.C Q p g $ . J.. @ [ . ~ . 0 o o n n z.z.> > , n z.n z.> z.n r r [ 0 O 6 E + o , G & n % I [ [ !.T :.7+}+}+",
"$.=._. +V 6.3 9 !+1 %+%+r.C S %+_.7+7+[.=.B (.T 1 n.h+5+|+p.o @ ++l.s.t #.& X.Q.N g.x y+k+0 ,+W A ' @ 0 0 + D ) O [ [ x 0 u ; u y N N u - z.F._ u r o [ ' ' . . E [ r N { y 0 R % 4 p r.B =. .7+",
"2 s.7+1 &+1 .:._.1+1+2 1 %+7+1.5+2 X $.[.n._.3 >.Q i [ M g #.p 2 e :.l.f #.[ a g p #.% 0 % z . $ m 8 x |.v.' w *.$ # @ j l p f + , k s d f z.n u ; o # $ o l 2.m $ <.j x o [ L @ j % [ h $.P 1.",
"1 2 2 %+ .S T :._._._.2 7+2 %+@.6.T %+X [.n. .T B K 8 6 [ 0 #.p 2 2 !+e T #+Q 9 t p g % [ ' a 5 r.<.I . /.a 6 w p #.~ M z ~ [ 9 $ r g.g f t n z., u m , c , # 2.2.l j s s [ <.[ $ j s % | >.K >.",
"S T T T $.%.3 T c.c.2 _.}+=.1 +.+.S B }+n.h+s.1.!.Q 6 |.' o #.p 2 1 :.2 2 #.3 | r.p #.a 9 [ [ I &.2 <.' a A J [ d Q J z z z A+a g s { #.C _ b G.m & r { $ y g 0 j o o g <.[ s o $ & r & 4 L p S ",
"p Q S >.>.C P | 2 2 V 2 2 2 3 C P 4 S 2 h+1+7+Z 3 ` |.D J.~ [ p 1 3 :.5+2 2++.T :.p @+[ 9 J [ f 8.>+t + . a 9 P 0.` F |.a D a D I #.& A.G _ *.n n s s n 0 , g @ t s s #.p g r o s & s o & g [ g ",
"a [ J K S S 4 r.%+1 3 3 3 S %.C 9 a J %+&.2 S /.+.>.E D } z K S B 3 :._._.A.1 2 3 #.& a 9 9 C r.b+>+#.5 0 J Q B 0 a 8 a z . . a 4.P L #+f+b G g.x g x % & & , m 0 o s [ p #.t <.#.G $ s m % g p ",
"5 P 4 P Q T +.Q S P P 4 4 #.p 9 B K D i T S J A+#.0+E D A ..4 q S S 3 2 s.%.7+2 1 +.@+a /.[ #.l.8.1+#.8 6 !.>.2 6 i D+| I F + 8 E #.L #.p.t n & & P & 5 o s H n o s % C p q q f @+#.g r r s b p ",
"8 9 P J S M.+.S P [ % 4 [ 4 J Q j.Q ..'.|.D a j+l.u.9 D D E s +.J C p 3 2 3 2 %+2 >.K a a #.4 l.>+1 P O ,.Z r.w+S Q -.r.p L & . z a [ G G ; o j a i a Q 5 p o G M j $ p S r.3 %.t #.s m s b & S ",
"9 i 4 4 0+u+%.%.' % . [ 6 |.9 Q w+(.7 L.=+A A ) >+p.J D |.` G T 4 % 4 +.2 1 [.1 3 :.!.a % 4 l.s.&.q 9 /.,.$.r.++T =.E+2 @.T #.% } F % G & { s @ P ` K I d p [ % l M g q | 2 r.A.+.t G n t #.u.B ",
"t r.J @+P B 9 ' a [ J |.J p B ;.T Q [ D v.. . + ; l w . 4 T #+e t #+6.!+!+:.f P K S r.S 0 % S &+s.f P Q ` Q 5 Q <.+ | <.0 5 7.l.P I 8 ' . @ 0 % a Q i i ` [ % I 6 & P #.| >+3 S !+p q c b - C C ",
"t r.P A+q p % A % [ [ 9 6 P S =.T Q a D A M k m m 2.@ f.P T #+q 4 [ r.T 3 S P [ K S S #.% 4 B }+e L +.Q ` 9 P 6 # l j k o g t+| P !.8 D ' 6 J [ [ 8 9 5 5 5 6 I i 0 g r q u+r.@.6.p p 0 b & #.a ",
"#+q J 4 P #+% a [ J O 8 9 !.>.2 ` 9 /...! k ].].y / M M 5 T #.[ z |.K =.C K A+z P S +.4 [ !.>.7+3 3 | ` ` 8 6 a j o l l 0 s p C 9 ` 7 ,.|.8 9 |.K 9 5 a @+6 i 9 i @ j o t j.:.e ++S 9 P p g [ A ",
"q C J P p % % |.' [ 6 9 !.| >.T ,.9 |.|.' . k 2.N 2.k k P T 4 g z J p ;.C B 4 A+[ 5 +.P 8 ` >.V T T h (.8 |.D z y 2.o k $ o g I ,.` 7 ,.9 g+9 |.|.[ [ a z [ i 9 I [ [ 0 L T r.:.1 +.S Q +.q P A+",
":.+.J P #.g.% a a a [ P 9 Q !.S |./.|.|.D z M ~ r o h.k [ Q C [ s p #+s.3 s.3 +.5 #.4 9 O 6 3 7+[.T Q |.6 a A A #.o 2.B., d.~ L ,.,.,.K /.K g+/.8 a 6 9 4 4 Q Q Q 9 d h h T 1 V 5+6.1 2 _._.++3 ",
":.C A+4 s & ~ a a p P P K K 9 |.,.,.,.|.D a ' a [ @ f.k #.C [ [ s #+%.b.c.h+_.:.| C 4 6 J a !.&.X T K 5 6 a [ 9 f p [ ~ k y+o a 9 K K K K 9 9 |.6 a |.i 9 [ 9 | Z $.0.0.Z >.%+s.b.++e &.h+U h+_.",
"1 #.k+#.s r #.z Q Q B r.K 9 O ..8 !.E 9 O |.Y Y a O . . b b b g #.#+l._.d+&.&.2 | 9 4 J ..D B &.$.B I i 5 g p T Q 4 8 [ 8 [ I [ 9 K 9 Q Q Q 9 [ ' [ [ 6 9 S Q h h !.(.` h >.=.s.++l.+.s.c.U 8+c.",
"_.4 @+[ s b a x S T :.S P 6 D v.J K |.|.|...g+'.A O v.. #._ G r a C B }+[.}+ .7+I +.p D D |.3 V B S I d 5 G 4 2 7.C 5 a a ' i % 8 9 Q :.| I p ' . 6 A ~ P I Q B p 6 [ E F d t+w+t+h K .1+b+*+}+",
"r.q S f q r z.- !.i Q L g ' ! ).O A O z [ 4.+ ' #.I z ..a K r.#+| T 2 i.[ i [ L h i 7 J I f | Q ` 5 + 0 @ c b f e $ c m j H r #.Q I f [ Q Q 0+T r.q t % [ 6 |...p t m y r L T ;.t+:.r.p u+&.h+q.",
"< A.b p g u _ - #.p 5 6 0 . . ! 6 |.d 6 % 6 . O 5 d 9 9 J Q Q q [ S %+C P E [ f T P 9 9 h p +.S 6 6 5 j j j & g o , j $ I g G v #+#.f 5 [ #.g u+f p n r @ [ a a g 0 r o c [ Q T 7.T K a Q | e 6.",
"#+G g._ p.u N u f+#.p 6 A . . @ @ [ g % % a A A [ K Q r.r.;.p @+~ C r.S K 8 9 B u+Q ,.` ;.l.I h 8 6 6 2.v # o s . z 0 o o & p | f G & s s s G [ r # 2.<.l l , 0 & n o j c #.p h $.3.` /.a 4 a C ",
"f+g.z.n u u y.z.u r a v.A M o # o o , & a . a } z x G p.< u+4 t.~ p r.S 9 ,.Q T ;.P /.8 7.q +.B 8 ' ' , ,+o z g D 8 E 0 x o 5 T D+u.,+].o 0 l { ,+0 @ I k o n p g & o g j ~ #.5 3 1.h F /.J x ~ ",
"n u G G u n z.] y.n o . f.k 2.m o j s 0 a % ....a x x.x.G.f % j+0 Q r.S 9 6 9 h T P /.J Q q Q K ' J.[ [ o ~ . ' ,.,.|.6 a 6 4 z r.[ % 0 o l $ n s 5 0 8 o I Q e d [ #.g o n & ~ 2+Q q h p [ & o ",
"& r b c u n N n N , x M ~ k 2.m j M ~ s [ ` 8 |.z % & z.Z.% z /.0 I S S /.z a Q B 9 g+a Q 5 B K D z I I g #.5 F d (.a [ % [ a a #.Q I 5 z o j y & p [ 6 ~ !.B T j.[ 0 g x & ~ , g.p.G #.g c o j ",
"~ @ j r m G o o m m # j 2.d.2.@ @ 2.& v % 7.6 ~ x + 0 s v & a a a Q +.P J ~ ' g J J '.A 6 % [ z 9 [ h T #.P F 4.K S 9 d 6 J % D C Q % 0 [ M & { / & 0 0 ~ 0 [ +.9 @+[ g x o $ o r & G g.#.o o c ",
". @ j n , r 0 0 x l # # y K.].. M ~ <.y+H 5 & x 2.0 ].x ].z O ' a B P S O ~ . g 5 ..R ..O % a A z 4 u+7.A.+.` E :.p u.9 P 8 A+a 9 9 v ~ [ s % % N ] B.B.k z g g 4 s J [ & M [ o + 0 0 & 0 & l @ "};