Importing source for great justice

git-svn-id: https://svn.eduke32.com/eduke32@5 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
Plagman 2006-04-13 20:47:06 +00:00
parent 17cdbabc42
commit 09f0c239b6
260 changed files with 179831 additions and 0 deletions

495
polymer/build/ChangeLog Normal file
View File

@ -0,0 +1,495 @@
8 Jun 2004
* Transparency bug noticed by Usurper should now be fixed.
* MD2 definition problem noticed by Parkar should also be fixed too.
5 Jun 2004
* Some foolish bugs in my (JonoF) code in the MD2 stuff now fixed.
* Linux should be fine now. At least, it worked on my machine.
3 Jun 2004
* MD2 model support is official now. We've also added a script reader
for the new .DEF format. KenBuild uses KENBUILD.DEF for its stuff.
26 May 2004
* glusecds is set to 0 by default now. The glusecds console variable
can be set to 1 to enable the use of the ChangeDisplaySettings()
function which works better for Intel video chipsets.
22 May 2004
* Gave things a nice overhaul to cut back the insanity of the
classic/softpolymost/glpolymost stuff. It was beginning to scare
me. The underhanded and behind-the-back tricks are banished.
The whole rendermethod thing is gone. Now, setgamemode() and
related paraphenalia all accept a 'bits-per-pixel' parameter.
Colour depths > 8 are forced to use GL polymost (naturally).
8bpp modes can use the regular renderer, and the software polymost
stuff. This means switchrendermethod() is removed from the layers.
SDLayer.c is back in sync too, so Build on Linux works again.
8 May 2004
* Finally remembered to add 33%/66% translucency support to hightile
tiles.
8 Mar 2004
* Added setpalettefadeclamps() to allow continual palette tinting
effects.
* Added back PCX format screenshot saving. The new screenshotformat
console variable selects whether to take PCX format (= 0, default)
or TGA format (= 1).
12 Feb 2004
* Greyscaling and inverting of tiles in hightile/polymost added.
This makes Duke's nightvision work better for Hightile textures
that use palette 6.
11 Feb 2004
* Broke out the non-OSD related commands from osd.c into baselayer.c.
* Added alternative display mode setting method using
ChangeDisplayMode() which can optionally be used for OpenGL mode
changes. Set the environment variable BUILD_USEGLCDS=TRUE to use.
* Added the glcolourdepth variable for selection of fullscreen GL
colour depth.
* Changed OSD_HandleKey() to not ignore releases, otherwise the game
world will always think its keys are held down. It ignores presses
though, which we want.
10 Feb 2004
* Added some protection to [k]?dfread() to indicate whether they
have failed to decompress some bytes so that the game doesn't
crash if a demo or savegame is fragged.
7 Feb 2004
* Hightile integration seems fine now. New functions to specify
replacement textures and palette tints can be seen in build.h.
* Joystick support is added. Seems to work.
* Hopefully a change I've made to the tile selector in Build when
using OpenGL mode has fixed the problem of the edges being
clipped off the screen...
22 Jan 2004
* Modified screencapture() to not overwrite existing screenshots.
19 Jan 2004
* loadboard() got a new second parameter inserted. This tells
kopen4load() where to seek out the map file. The values are:
0 - anywhere
1 - the first GRP file (same as setting strlen(fn)-1 to 0xff)
2 - any grp file
17 Jan 2004
* Fixed Bcorrectfilename() to handle Win98's different operation
of GetFullPathName() when compared to Win2k. Now Build doesn't
ascend 2 directories at once when running on 98.
16 Jan 2004
* Undid some stuff which was a little braindamaged in winlayer.c.
I can't for the life of me remember why I was destroying the
window and recreating it when switching rendering modes when it
was entirely unnecessary and could potentially piss off other
services which aren't expecting their window handle to suddenly
be invalid, like DirectSound.
* In typical JonoF style of a couple of years ago, I made an error
when I did the gruntwork to port Build to Windows and as a
sideeffect of my unchecked amateurness I bent the point
highlighting in the editor. It's straightened now. :-(
12 Jan 2004
* sdlayer.c has been brought into line with winlayer.c. Now
everything that winlayer.c also works in SDL.
10 Jan 2004
* Added uninitsinglegroupfile() to unload a particular group file.
* Added a mechanism to do a "findfirst/next" over the group files.
* Modified Build.c to include maps inside the GRPs in the file
list.
2 Jan 2004
* Crash bug on starting Build editor fixed. See list of original
bugs for information.
1 Jan 2004
* Many Polymost bugs fixed. Mirrors now work. All kinds of funky
stuff.
29 Dec 2003
* Updated screencapture() to support GL modes.
* Modified 2D mode editor screen capture to keep the status bar
visible. Done with Ken's blessing.
23 Dec 2003
* Build mouse sensitivity has changed to use a floating point value
in the configuration file to specify the sen
* First public release of Ken's new "Polymost" renderer. 6 degrees
of freedom and full 3D rendering, including OpenGL.
* Palette handling has changed somewhat drastically. The engine now
supports palette fading natively, which means where games used
to manipulate a copy of the palette and send it to the video card,
this manipulation is now done by the engine via a function named
setpalettefade(). See the header for details. In adding this,
setbrightness() gained a third parameter, which is almost always
passed as 0 unless doing a palette fade and adjusting the game
palette immediately before it, in which case pass 1 so that
setbrightness() doesn't apply its base palette, otherwise weird
palette flashes will happen and we don't want that.
This was all necessary in order to let Ken's Polymost code have
access to the basic, unmodified palette for its own purposes.
20 Dec 2003
* Dynamic player collection has been cleaned up ever so slightly and
seems to work pretty well so far on just my LAN. No internet test
has been performed yet.
* Screen tilting in game.c now uses polymost's tilting abilities if
rendmode > 0 is used.
10 Dec 2003
* Dynamic player collection works at this stage. It's all implemented
in game-land because it's easier to do at this stage, but I
anticipate moving most of the general stuff into the engine if I
find it necessary.
6 Dec 2003
* Modified the checkvideomodes() function in winlayer.c to behave
slightly different and return 0x7fffffffl if the video mode passed
is not a recognized mode in windowed operation, otherwise it
returns the video mode index in validmode*[]. Sdlayer.c isn't
modified to do this yet.
* Applied Ken's fix for crashes which ensue when calling rotatesprite
inside drawrooms. See details in bug fixes list below.
5 Dec 2003
* At 2.50pm today jmulti.c achieved operational capacity and survived
a 15 minute 2-player network game with my father on our LAN.
25 Nov 2003
* Added a missing "CDECLENDSET 6" on line 504 of a.nasm. Without it
the registers are trashed upon return which made Win98 crash when
running GCC-built executables.
24 Nov 2003
* Silly typo fixed in winlayer.c.
23 Nov 2003
* Modified build.c and config.c to use integer arithmetic for mouse
sensitivity stuff. I don't like floating-point all that much out of
a general sense of prejudice.
19 Nov 2003
* Modified the Build editor such that it no longer is constrained to
640x480 in 2D mode. It now defaults to using the same resolution
that is selected in 3D mode, but may be overridden by using a
new setting named '2dresolution' in the build.cfg file. It uses the
same mode numbers as the existing 'resolution' setting.
* Ctrl+A, Ctrl+Z, KP2, KP4, KP6, and KP8 in 3D mode, plus A and Z in
2D mode are now speed limited.
19 Oct 2003
* Fixed some brain damaged error causing crashes when hitting enter
after entering a filename for Save As. I really am dumb sometimes.
* Added mouse sensitivity to Build editor. Add this to your build.cfg
; Mouse sensitivity
; 128 = 1:2
; 256 = 1:1
; 512 = 2:1
mousesensitivity = 256
4 Oct 2003
* Modified things to allow compilation with Microsoft C. Building
with MSC requires using the C-only configuration, which is how
the makefile is currently configured.
13 Sep 2003
* Added tab-completion of symbols into the OSD.
* Moved the "dumpbuildinfo" console function from the Duke source
into the OSD as a basic function.
11 Sep 2003
* Engine now able to build entirely from C source. Assembly
is entirely optional now.
* Engine now compiles with OpenWatcom 1.0.
22 May 2003
* Fixed a bug where the movement clipping lines array was being
overrun in extreme circumstances. Thanks to BlasterDRP for
pointing this out. See the epilogue for more details.
17 May 2003
* With Ken's help the rendering performance in 1024x768 is now
dramatically improved. By making scanlines odd lengths the CPU
cache issues associated with multiples of 4096 are now eliminated.
* Modified the 16-colour emulation functions since 640 bytes is no
longer the pitch of one line.
* Added auto-repainting of the frame if WM_PAINT is posted in the
winlayer. The repaint happens on a call to handleevents();
15 May 2003
* Rewrote the map menu.
11 May 2003
* Rewrote the onscreen display. It's now a lot like Quake's console.
7 May 2003
* Changed CACHE1D.C to open the group file in read-only mode. Why it
was being opened in random-access is a mystery to me. This fixes
problems where the GRP file was read-only and the games would not
start. Thanks to Sean Magiera for this one.
* Added detection of input devices to winlayer.c (and made sdlayer.c
currently enable only keyboard and mouse without testing). Now the
Duke input code can grow a little more intelligent.
1 May 2003
* Made Ctrl+Tab show sprite stats in the way Alt+Tab does.
* Added task switching disabling to winlayer.c.
25 Apr 2003
* Modifications here and there, plus I've adjusted the Makefile to
allow code which links against the engine to compile its own copy
in its development tree. Duke uses this to compile the engine
without voxel support.
17 Apr 2003
* Various changes have been made in order to fully support my Duke3D
port.
7 Apr 2003
* Quite a few minor changes have been made here and there.
* Added support to the interface layers for game-defined input event
callbacks which are used with the jMACT library I have written for
Duke.
* Fixed a bug which was preventing screen-tilting and savegame screen-
shots from being drawn in Duke3D. Side-effect being windowed render
mode is now more similar to fullscreen in its behaviour, ie. the
frameplace variable is set to NULL when unlocked.
1 Apr 2003
* Thanks to a report by admin@combatgold1.co.uk these bugs are fixed:
- Alt-key combinations broken. Thankyou for nothing, DirectInput.
- Prompts for menu, 3d-mode quit, etc not being displayed. A little
short-sightedness on my part to blame here.
- Crash on changing palette to a palette mapping that is NULL.
This has been a bug from the very beginning in Ken's original DOS
version too, benign back then but turned malignant now thanks to
the great debugging tool known as the segmentation fault. Fixed now.
* Took a leaf from SDL's book and made the input code not suck anymore
by having buffered keyboard and mouse with event objects to tell when
there's data available. Very nice. Something I should have done from
the start had I had a brain. Mouse is now perfectly smooth.
* Made the flash speed of highlighted sprites and lines in Build derive
from the clock and not the speed at which the frames can be drawn to
the display. In DOS, locking to the display refresh worked fine, but
my haste in porting originally did not take this into account. Fixed
now.
* Fixed a problem in my very amateur DirectDraw code where I wasn't
restoring surfaces once they'd been lost (d'uh). We now have a picture
when Alt-tabbing back to the game/editor.
* Made operation on 8-bit desktops much more sane. It actually kinda
works reliably now.
Bugs present in Ken's original source
-------------------------------------
This epilogue is here for those people wishing to do their own port of
the Build source and wish to save time tracking down bugs in Ken's source.
The bugs here are the ones I found during my travels and the list should
not be considered complete. Thankfully, Ken's code is very solid and the
bugs that do exist did not pose a serious threat under DOS, but they do
make life very interesting these days.
(Line numbers refer to Ken's original source distribution)
ENGINE.C (various locations):
Before this fix is applied you may notice crashes in game.exe
if you press Enter (main keyboard). In Ken's words:
| It crashes in dorotatesprite because it accesses rx1[], ry1[],
| rx2[], and ry2[] - global arrays which were originally intended
| to be used only by drawrooms! When I wrote that code, I must have
| assumed rotatesprite would never be called INSIDE drawrooms...
| which makes sense because I wrote rotatesprite before I wrote
| all that faketimerhandler stuff.
The solution is to place this line below somewhere, Ken suggests
immediately before clippoly4, but I chose to keep it with the rest
of static variables in ENGINE.C and put it on line 156:
static long nrx1[8], nry1[8], nrx2[8], nry2[8];
Then, all references to rx1[], ry1[], rx2[], and ry2[] in
clippoly4 and dorotatesprite *ONLY* need to be prefixed with an
'n'. Only those functions need patching, and nothing else.
ENGINE.C l1222, l1388, l7225:
palookup[] is accessed from the assembly functions to translate
palette indexes to alternate indexes for palette-shifting of
images. It contains pointers to tables which map the original
palette index to the new index. Unused lookup entries have their
pointer set to NULL. If a NULL palette lookup is referenced then
a null-pointer exception is raised. In DOS this just caused
garbage palette mappings. In Windows/Linux it causes segfaults.
A fix for this is to add a line after the specified ones like:
if (!globalpalwritten) globalpalwritten = palookup[globalpal];
This remaps the NULL palette to the default one.
ENGINE.C l5691, l5692, l5697, l5698:
drawline16() is used for the 2D map view in the BUILD editor.
In the clipping calculations it sometimes happens that the x-
coordinates are not properly clipped to the left or right of the
video memory and are offscreen by one or two pixels when clipping
against the very top or very bottom rows of video memory. Adding
these checks before the closing braces of the specified lines
makes sure the coordinate does not go negative and segfault.
Line 5691 and 5698: if (x1 < 0) x1 = 0;
Line 5692 and 5697: if (x2 < 0) x2 = 0;
ENGINE.C l88, l8326:
slopalookup[] is a table used for drawing sloped sector floors
and ceilings. It holds the palette shading indicies for each
scanline. Problem is, in high resolutions somewhere around
1024x768, this array is too small and memory corruption happens
when the code writes past the end of this array. The way to fix
it is to rewrite the algorithm. Since that's an unattractive
proposition, increasing the size of this array will hold the
problem off for more typical cases.
Line 88: long slopalookup[16384];
Line 8326: ... else shoffs = ((16380-ydimen)<<15);
ENGINE.C l6773:
The addclipline() macro appends a clipping line for the movement
clipping code to test, but it doesn't attempt to see if adding
the new line would overrun the buffer. Extreme cases exist where
the buffer overruns and the game crashes. The problem can be fixed
by testing if clipnum is less than MAXCLIPNUM before adding the
new line.
#define addclipline(dax1, day1, dax2, day2, daoval) \
{ \
if (clipnum < MAXCLIPNUM) { \
clipit[clipnum].x1 = dax1; clipit[clipnum].y1 = day1; \
clipit[clipnum].x2 = dax2; clipit[clipnum].y2 = day2; \
clipobjectval[clipnum] = daoval; \
clipnum++; \
} \
} \
This change will increase the possibility of clipping bugs though
because not all possible sprites may being included in the test,
so increasing the MAXCLIPNUM constant on line 31 to 1024 will
decrease the chance of this happening.
ENGINE.C l7880:
The for loop that reverses the rendered image of a mirror is
iterating one too many times. Change the for loop to read:
for(dy=mirrorsy2-mirrorsy1-1;dy>=0;dy--)
BUILD.C l2137:
gettile() sometimes gets handed a tile with an index of -1, and
doesn't adjust this to something safe before it tries to draw the
cursor for the selected tile. This is demonstrated by loading
nukeland.map in Build.exe, and making a 1-way wall on the ledge
to the left of the starting point, and then pressing 'V' on the
now grey-stone wall. Adding this line fixes the crash that ensues.
Line 2137: if (tilenum < 0) tilenum = 0;
BUILD.C l2495, l3444:
bstatus, local to overheadeditor() is not initialized to 0 on entry
to the function, which sometimes causes the sprite dragging code to
misfire resulting in a crash immediately on starting the editor. The
following changes will prevent this happening.
Line 2495: "oldmousebstatus = 0;" should be changed to "bstatus = 0;"
Line 3444: append "if ((pointhighlight&0xc000) == 16384)" to "else"

7
polymer/build/LICENSE Normal file
View File

@ -0,0 +1,7 @@
The source code is covered by the terms of Ken's original license
which can be found in the file "buildlic.txt" or at
http://jonof.edgenetwk.com/buildport/buildlic.txt
My additions and modifications are covered by the same license.
-- Jonathon Fowler (10 March 2003)

View File

@ -0,0 +1,47 @@
# GNU Makefile to prepare source and binary distributions.
# make -f MakeDistributions [source|binary]
SOURCEFILES=build.cfg buildlic.txt ChangeLog game.cfg LICENSE \
Makefile Makefile.deps Makefile.shared Makefile.msvc Makefile.watcom \
MakeDistributions makegnu.bat makemsc.bat makew.bat NAMES.H README
BINARYFILES=build.cfg build.exe buildlic.txt ChangeLog fmod.dll \
game.cfg game.exe LICENSE NAMES.H neatsong.ogg README
BINARYCHECKS=checkfmoddll checkneatsongogg
.PHONY: source binary $(BINARYCHECKS)
datenow=$(shell date +%Y%m%d)
sourcedir=txbuild_src_$(datenow)
binarydir=txbuild_$(datenow)
all: source binary
source:
rm -rf $(sourcedir) $(sourcedir).zip
mkdir $(sourcedir) $(sourcedir)/obj.gnu $(sourcedir)/obj.watcom $(sourcedir)/obj.msc
touch $(sourcedir)/obj.gnu/keep.me $(sourcedir)/obj.watcom/keep.me $(sourcedir)/obj.msc/keep.me
cp $(SOURCEFILES) $(sourcedir)
find . -name "*~" -exec rm -rf '{}' ';';
find . -name "*.orig" -exec rm -rf '{}' ';';
find . -name "*.rej" -exec rm -rf '{}' ';';
find . -name "*.mine" -exec rm -rf '{}' ';';
find . -name "*.c.r*" -exec rm -rf '{}' ';';
cp -R src rsrc include devcpp osx $(sourcedir)
find $(sourcedir) | grep -i svn | xargs rm -rf
rm -f $(sourcedir)/src/tmp/*
touch $(sourcedir)/src/tmp/keep.me
kzip -r $(sourcedir).zip $(sourcedir)
binary: $(BINARYCHECKS)
make RELEASE=1
upx --best build.exe game.exe
mkdir $(binarydir)
cp $(BINARYFILES) $(binarydir)
kzip -r $(binarydir).zip $(binarydir)
# Binary checks
checkfmoddll: fmod.dll
checkneatsongogg: neatsong.ogg

285
polymer/build/Makefile Normal file
View File

@ -0,0 +1,285 @@
# Build Makefile for GNU Make
# Notes:
# As of 6 July 2005, the engine should handle optimisations being enabled.
# If things seem to be going wrong, lower or disable optimisations, then
# try again. If things are still going wrong, call me.
#
# Engine options - these may be overridden by game makefiles
# SUPERBUILD - enables voxels
# POLYMOST - enables Polymost renderer
# USE_OPENGL - enables OpenGL support in Polymost
# DYNAMIC_OPENGL - enables run-time loading of OpenGL library
# USE_A_C - enables use of C version of classic renderer
# NOASM - disables the use of inline assembly pragmas
#
# SETSPRITEZ - set to 1 for Shadow Warrior
SUPERBUILD ?= 1
POLYMOST ?= 1
USE_OPENGL ?= 1
DYNAMIC_OPENGL ?= 1
USE_A_C ?= 0
NOASM ?= 0
SETSPRITEZ ?= 0
# Debugging options
# RELEASE - 1 = no debugging
# EFENCE - 1 = compile with Electric Fence for malloc() debugging
RELEASE?=1
EFENCE?=0
# SDK locations - adjust to match your setup
DXROOT=c:/sdks/msc/dx61
FMODROOTWIN=c:/sdks/fmodapi374win/api
# build locations - OBJ gets overridden to the game-specific objects dir
OBJ?=obj.gnu/
SRC=src/
RSRC=rsrc/
INC=include/
# filename extensions - these won't need to change
o=o
res=o
asm=nasm
# debugging and release
ifneq ($(RELEASE),0)
# debugging disabled
debug=-fomit-frame-pointer -O2
else
# debugging enabled
debug=-ggdb -O0 -DDEBUGGINGAIDS -DNOSDLPARACHUTE
endif
CC=gcc
CXX=gcc
AS=nasm
RC=windres
AR=ar
RANLIB=ranlib
OURCFLAGS=$(debug) -W -Wall -Wimplicit -Wno-char-subscripts -Wno-unused \
-funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS \
-DKSFORBUILD -I$(INC:/=) -I../jfaud/src
OURCXXFLAGS=-fno-exceptions -fno-rtti
LIBS=
GAMELIBS=../jfaud/libjfaud.a #../jfaud/mpadec/libmpadec/libmpadec.a
ASFLAGS=-s #-g
EXESUFFIX=
include Makefile.shared
ifneq (0,$(USE_A_C))
ENGINEOBJS=$(OBJ)a-c.$o
else
ENGINEOBJS=$(OBJ)a.$o
endif
ENGINEOBJS+= \
$(OBJ)baselayer.$o \
$(OBJ)cache1d.$o \
$(OBJ)compat.$o \
$(OBJ)crc32.$o \
$(OBJ)defs.$o \
$(OBJ)engine.$o \
$(OBJ)engineinfo.$o \
$(OBJ)glbuild.$o \
$(OBJ)kplib.$o \
$(OBJ)lzf_c.$o \
$(OBJ)lzf_d.$o \
$(OBJ)md4.$o \
$(OBJ)mmulti.$o \
$(OBJ)osd.$o \
$(OBJ)pragmas.$o \
$(OBJ)scriptfile.$o
EDITOROBJS=$(OBJ)build.$o \
$(OBJ)config.$o
GAMEEXEOBJS=$(OBJ)game.$o \
$(OBJ)jfaud_sound.$o \
$(OBJ)config.$o \
$(OBJ)$(ENGINELIB)
EDITOREXEOBJS=$(OBJ)bstub.$o \
$(OBJ)$(EDITORLIB) \
$(OBJ)$(ENGINELIB)
# detect the platform
ifeq ($(PLATFORM),LINUX)
ASFLAGS+= -f elf
LIBS+= -lm
endif
ifeq ($(PLATFORM),BSD)
ASFLAGS+= -f elf
OURCFLAGS+= -I/usr/X11R6/include
LIBS+= -lm
endif
ifeq ($(PLATFORM),WINDOWS)
OURCFLAGS+= -DUNDERSCORES -I$(DXROOT)/include -I$(FMODROOTWIN)/inc
LIBS+= -lm
GAMELIBS+= -L$(FMODROOTWIN)/lib
ASFLAGS+= -DUNDERSCORES -f win32
endif
ifeq ($(PLATFORM),BEOS)
ASFLAGS+= -f elf
TARGETOPTS+= -DNOASM
endif
ifeq ($(PLATFORM),SUNOS)
LIBS+= -lm
endif
ifeq ($(PLATFORM),SYLLABLE)
ASFLAGS+= -f elf
endif
ifeq ($(RENDERTYPE),SDL)
ENGINEOBJS+= $(OBJ)sdlayer.$o
OURCFLAGS+= $(subst -Dmain=SDL_main,,$(SDLCONFIG_CFLAGS))
ifeq (1,$(HAVE_GTK2))
OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0)
ENGINEOBJS+= $(OBJ)gtkbits.$o
GAMEEXEOBJS+= $(OBJ)game_banner.$o
EDITOREXEOBJS+= $(OBJ)editor_banner.$o
endif
GAMEEXEOBJS+= $(OBJ)game_icon.$o
EDITOREXEOBJS+= $(OBJ)build_icon.$o
endif
ifeq ($(RENDERTYPE),WIN)
ENGINEOBJS+= $(OBJ)winlayer.$o
EDITOROBJS+= $(OBJ)buildstartwin.$o
GAMEEXEOBJS+= $(OBJ)gameres.$(res) $(OBJ)gamestartwin.$o
EDITOREXEOBJS+= $(OBJ)buildres.$(res)
endif
ifneq (0,$(EFENCE))
LIBS+= -lefence
OURCFLAGS+= -DEFENCE
endif
OURCFLAGS+= $(BUILDCFLAGS)
.PHONY: clean veryclean all utils writeengineinfo enginelib editorlib
# TARGETS
# Invoking Make from the terminal in OSX just chains the build on to xcode
ifeq ($(PLATFORM),DARWIN)
ifeq ($(RELEASE),0)
style=Development
else
style=Deployment
endif
.PHONY: alldarwin
alldarwin:
cd osx/engine && xcodebuild -target All -buildstyle $(style)
cd osx/game && xcodebuild -target All -buildstyle $(style)
endif
UTILS=kextract$(EXESUFFIX) kgroup$(EXESUFFIX) transpal$(EXESUFFIX) wad2art$(EXESUFFIX) wad2map$(EXESUFFIX)
all: game$(EXESUFFIX) build$(EXESUFFIX) $(OBJ)$(ENGINELIB) $(OBJ)$(EDITORLIB)
utils: $(UTILS)
enginelib: $(OBJ)$(ENGINELIB)
$(OBJ)$(ENGINELIB): $(ENGINEOBJS)
$(AR) rc $@ $^
$(RANLIB) $@
editorlib: $(OBJ)$(EDITORLIB)
$(OBJ)$(EDITORLIB): $(EDITOROBJS)
$(AR) rc $@ $^
$(RANLIB) $@
game$(EXESUFFIX): $(GAMEEXEOBJS)
$(CC) $(CFLAGS) $(OURCFLAGS) -o $@ $^ $(LIBS) $(GAMELIBS) $(STDCPPLIB)
build$(EXESUFFIX): $(EDITOREXEOBJS)
$(CC) $(CFLAGS) $(OURCFLAGS) -o $@ $^ $(LIBS)
pragmacheck$(EXESUFFIX): $(OBJ)pragmacheck.$o $(OBJ)pragmas.$o
$(CC) $(subst -Dmain=app_main,,$(OURCFLAGS)) -o $@ $^
kextract$(EXESUFFIX): $(OBJ)kextract.$o $(OBJ)compat.$o
$(CC) -o $@ $^
kgroup$(EXESUFFIX): $(OBJ)kgroup.$o $(OBJ)compat.$o
$(CC) -o $@ $^
transpal$(EXESUFFIX): $(OBJ)transpal.$o $(OBJ)pragmas.$o $(OBJ)compat.$o
$(CC) -o $@ $^
wad2art$(EXESUFFIX): $(OBJ)wad2art.$o $(OBJ)pragmas.$o $(OBJ)compat.$o
$(CC) -o $@ $^
wad2map$(EXESUFFIX): $(OBJ)wad2map.$o $(OBJ)pragmas.$o $(OBJ)compat.$o
$(CC) -o $@ $^
generateicon$(EXESUFFIX): $(OBJ)generateicon.$o $(OBJ)kplib.$o
$(CC) -o $@ $^
cacheinfo$(EXESUFFIX): $(OBJ)cacheinfo.$o $(OBJ)compat.$o
$(CC) -o $@ $^
enumdisplay$(EXESUFFIX): src/misc/enumdisplay.c
$(CC) -g -Os -o $@ $^ -I$(DXROOT)/include -lgdi32
# DEPENDENCIES
include Makefile.deps
.PHONY: $(OBJ)engineinfo.$o
$(OBJ)engineinfo.$o:
echo "const char _engine_cflags[] = \"$(CFLAGS) $(OURCFLAGS)\";" > $(SRC)tmp/engineinfo.c
echo "const char _engine_libs[] = \"$(LIBS)\";" >> $(SRC)tmp/engineinfo.c
echo "const char _engine_uname[] = \"$(shell uname -a)\";" >> $(SRC)tmp/engineinfo.c
echo "const char _engine_compiler[] = \"$(CC) $(shell $(CC) -dumpversion) $(shell $(CC) -dumpmachine)\";" >> $(SRC)tmp/engineinfo.c
echo "const char _engine_date[] = __DATE__ \" \" __TIME__;" >> $(SRC)tmp/engineinfo.c
$(CC) $(CFLAGS) $(OURCFLAGS) -c $(SRC)tmp/engineinfo.c -o $@ 2>&1
# RULES
$(OBJ)%.$o: $(SRC)%.nasm
$(AS) $(ASFLAGS) $< -o $@
$(OBJ)%.$o: $(SRC)%.c
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
$(OBJ)%.$o: $(SRC)%.cpp
$(CXX) $(CXXFLAGS) $(OURCXXFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
$(OBJ)%.$o: $(SRC)tmp/%.c
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
$(OBJ)%.$o: $(SRC)misc/%.rc
$(RC) -i $^ -o $@
$(OBJ)%.$o: $(SRC)util/%.c
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
$(OBJ)%.$o: $(RSRC)%.c
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
$(OBJ)game_banner.$o: $(RSRC)game_banner.c
$(OBJ)editor_banner.$o: $(RSRC)editor_banner.c
$(RSRC)game_banner.c: $(RSRC)game.bmp
echo "#include <gdk-pixbuf/gdk-pixdata.h>" > $@
gdk-pixbuf-csource --extern --struct --raw --name=startbanner_pixdata $^ | sed 's/load_inc//' >> $@
$(RSRC)editor_banner.c: $(RSRC)build.bmp
echo "#include <gdk-pixbuf/gdk-pixdata.h>" > $@
gdk-pixbuf-csource --extern --struct --raw --name=startbanner_pixdata $^ | sed 's/load_inc//' >> $@
# PHONIES
clean:
ifeq ($(PLATFORM),DARWIN)
cd osx/engine && xcodebuild -target All clean
cd osx/game && xcodebuild -target All clean
else
-rm -f $(OBJ)*
endif
veryclean: clean
ifeq ($(PLATFORM),DARWIN)
else
-rm -f $(ENGINELIB) $(EDITORLIB) game$(EXESUFFIX) build$(EXESUFFIX) $(UTILS)
endif
.PHONY: fixlineends
fixlineends:
for a in `find . -type f \( -name '*.c' -o -name '*.h' -o -name 'Makefile*' \) \! -path '*/.svn/*'`; do \
echo Fixing $$a && tr -d "\015" < $$a > $$a.fix && mv $$a.fix $$a; \
done

View File

@ -0,0 +1,46 @@
# Build Engine dependencies
#
$(OBJ)a-c.$o: $(SRC)a-c.c $(INC)a.h
$(OBJ)a.$o: $(SRC)a.$(asm)
$(OBJ)baselayer.$o: $(SRC)baselayer.c $(INC)compat.h $(INC)baselayer.h $(INC)build.h $(INC)osd.h
$(OBJ)bstub.$o: $(SRC)bstub.c $(INC)compat.h $(INC)a.h $(INC)build.h $(INC)pragmas.h $(INC)baselayer.h $(INC)names.h $(INC)osd.h $(INC)cache1d.h $(INC)editor.h
$(OBJ)build.$o: $(SRC)build.c $(INC)build.h $(INC)pragmas.h $(INC)compat.h $(INC)baselayer.h $(INC)editor.h
$(OBJ)cache1d.$o: $(SRC)cache1d.c $(INC)compat.h $(INC)cache1d.h $(INC)pragmas.h $(INC)baselayer.h
$(OBJ)compat.$o: $(SRC)compat.c $(INC)compat.h
$(OBJ)config.$o: $(SRC)config.c $(INC)compat.h $(INC)osd.h $(INC)editor.h
$(OBJ)crc32.$o: $(SRC)crc32.c $(INC)crc32.h
$(OBJ)defs.$o: $(SRC)defs.c $(INC)build.h $(INC)baselayer.h $(INC)scriptfile.h $(INC)compat.h
$(OBJ)engine.$o: $(SRC)engine.c $(SRC)polymost.c $(INC)kplib.h $(SRC)hightile.c $(SRC)mdsprite.c $(INC)md4.h $(INC)lzf.h $(INC)lzwnew.h $(INC)compat.h $(INC)build.h $(INC)pragmas.h $(INC)cache1d.h $(INC)a.h $(INC)osd.h $(INC)baselayer.h
$(OBJ)game.$o: $(SRC)game.c $(INC)compat.h $(INC)build.h $(INC)names.h $(INC)pragmas.h $(INC)cache1d.h $(INC)game.h $(INC)osd.h $(INC)baselayer.h
$(OBJ)glbuild.$o: $(SRC)glbuild.c $(INC)glbuild.h $(INC)baselayer.h
$(OBJ)jfaud_sound.$o: $(SRC)jfaud_sound.cpp $(INC)osd.h $(INC)compat.h $(INC)cache1d.h
$(OBJ)kplib.$o: $(SRC)kplib.c $(INC)compat.h
$(OBJ)lzf_c.$o: $(SRC)lzf_c.c $(SRC)lzfP.h
$(OBJ)lzf_d.$o: $(SRC)lzf_d.c $(SRC)lzfP.h
$(OBJ)lzwnew.$o: $(SRC)lzwnew.c
$(OBJ)md4.$o: $(SRC)md4.c $(INC)md4.h $(INC)compat.h
$(OBJ)mmulti_null.$o: $(SRC)mmulti_null.c $(INC)mmulti.h
$(OBJ)mmulti.$o: $(SRC)mmulti.c
$(OBJ)osd.$o: $(SRC)osd.c $(INC)build.h $(INC)osd.h $(INC)compat.h $(INC)engineinfo.h $(INC)baselayer.h
$(OBJ)pragmas.$o: $(SRC)pragmas.c $(INC)compat.h
$(OBJ)scriptfile.$o: $(SRC)scriptfile.c $(INC)scriptfile.h $(INC)cache1d.h $(INC)compat.h
$(OBJ)sdlayer.$o: $(SRC)sdlayer.c $(INC)compat.h $(INC)sdlayer.h $(INC)baselayer.h $(INC)cache1d.h $(INC)pragmas.h $(INC)a.h $(INC)build.h $(INC)osd.h $(INC)glbuild.h
$(OBJ)sound.$o: $(SRC)sound.c $(INC)osd.h $(INC)compat.h $(INC)cache1d.h
$(OBJ)winlayer.$o: $(SRC)winlayer.c $(INC)compat.h $(INC)winlayer.h $(INC)baselayer.h $(INC)pragmas.h $(INC)build.h $(INC)a.h $(INC)osd.h $(INC)dxdidf.h $(INC)glbuild.h
$(OBJ)gtkbits.$o: $(SRC)gtkbits.c $(INC)baselayer.h $(INC)build.h
$(OBJ)gameres.$(res): $(SRC)misc/gameres.rc
$(OBJ)buildres.$(res): $(SRC)misc/buildres.rc
$(OBJ)gamestartwin.$o: $(SRC)gamestartwin.c $(INC)winlayer.h $(INC)build.h $(INC)compat.h
$(OBJ)buildstartwin.$o: $(SRC)buildstartwin.c $(INC)winlayer.h $(INC)build.h $(INC)compat.h
$(OBJ)game_icon.$o: $(RSRC)game_icon.c
$(OBJ)build_icon.$o: $(RSRC)build_icon.c
$(OBJ)kextract.$o: $(SRC)util/kextract.c $(INC)compat.h
$(OBJ)kgroup.$o: $(SRC)util/kgroup.c $(INC)compat.h
$(OBJ)transpal.$o: $(SRC)util/transpal.c $(INC)compat.h $(INC)pragmas.h
$(OBJ)wad2art.$o: $(SRC)util/wad2art.c $(INC)compat.h $(INC)pragmas.h
$(OBJ)wad2map.$o: $(SRC)util/wad2map.c $(INC)compat.h $(INC)pragmas.h
$(OBJ)generateicon.$o: $(SRC)util/generateicon.c
$(OBJ)cacheinfo.$o: $(SRC)util/cacheinfo.c $(INC)compat.h

166
polymer/build/Makefile.msvc Normal file
View File

@ -0,0 +1,166 @@
# Build Makefile for Microsoft NMake
!ifdef OVERRIDES
!include $(OVERRIDES)
!endif
SRC=src\ #
!ifndef OBJ
OBJ=obj.msc\ #
!endif
INC=include\ #
!ifndef CFLAGS
CFLAGS=/DSUPERBUILD /DPOLYMOST /DUSE_OPENGL /DDYNAMIC_OPENGL /DKSFORBUILD
!endif
o=obj
res=res
asm=masm
ENGINELIB=engine.lib
EDITORLIB=build.lib
DXROOT=c:\sdks\msc\dx7
FMODROOT=c:\sdks\fmodapi374win\api
# /D these to enable certain features of the port's compile process
# USE_A_C This uses a C version of the classic renderer code rather
# than the assembly version in A.ASM.
# If this is defined, alter the $(OBJ)a.$o in the
# ENGINEOBJS declaration to be $(OBJ)a-c.$o
# NOASM When defined, uses C instead of Microsoft inline
# assembly for the features in PRAGMAS.H
TARGETOPTS=#/DUSE_A_C #/DNOASM
!ifdef DEBUG
# debugging options
flags_cl=/G6 /Ot /Z7
flags_link=/DEBUG
!else
# release options
#flags_cl=/G6Fy /Ox
flags_cl=/G6 /O2
flags_link=/RELEASE
!endif
CC=cl
AS=ml
RC=rc
LINK=link /opt:nowin98 /opt:ref /nologo
CFLAGS=$(CFLAGS) /nologo /MD /J $(flags_cl) $(TARGETOPTS) /I$(INC) /I$(DXROOT)\include /I$(FMODROOT)\inc
LIBS=fmodvc.lib #opengl32.lib
ASFLAGS=/nologo /coff
EXESUFFIX=.exe
ENGINEOBJS=$(OBJ)a.$o \
$(OBJ)baselayer.$o \
$(OBJ)cache1d.$o \
$(OBJ)compat.$o \
$(OBJ)crc32.$o \
$(OBJ)defs.$o \
$(OBJ)engine.$o \
$(OBJ)engineinfo.$o \
$(OBJ)glbuild.$o \
$(OBJ)kplib.$o \
$(OBJ)lzf_c.$o \
$(OBJ)lzf_d.$o \
$(OBJ)lzwnew.$o \
$(OBJ)md4.$o \
$(OBJ)mmulti.$o \
$(OBJ)osd.$o \
$(OBJ)pragmas.$o \
$(OBJ)scriptfile.$o \
$(OBJ)winlayer.$o
EDITOROBJS=$(OBJ)build.$o \
$(OBJ)buildstartwin.$o \
$(OBJ)config.$o
GAMEEXEOBJS=$(OBJ)config.$o \
$(OBJ)game.$o \
$(OBJ)gameres.$(res) \
$(OBJ)gamestartwin.$o \
$(OBJ)sound.$o \
$(OBJ)$(ENGINELIB)
EDITOREXEOBJS=$(OBJ)bstub.$o \
$(OBJ)buildres.$(res) \
$(OBJ)$(EDITORLIB) \
$(OBJ)$(ENGINELIB)
RENDERTYPE=WIN
LIBS=$(LIBS) user32.lib gdi32.lib shell32.lib dxguid.lib wsock32.lib
CFLAGS=$(CFLAGS) /DRENDERTYPE$(RENDERTYPE)=1
# RULES
.SUFFIXES: .masm
{$(SRC)}.masm{$(OBJ)}.$o:
$(AS) /c $(ASFLAGS) /Fo$@ $<
{$(SRC)tmp}.c{$(OBJ)}.$o:
$(CC) /c $(CFLAGS) /Fo$@ $<
{$(SRC)util}.c{$(OBJ)}.$o:
$(CC) /c $(CFLAGS) /Fo$@ $<
{$(SRC)misc}.rc{$(OBJ)}.$(res):
$(RC) /fo$@ /r $<
{$(SRC)}.c{$(OBJ)}.$o:
$(CC) /c $(CFLAGS) /Fo$@ $<
# TARGETS
UTILS=kextract$(EXESUFFIX) kgroup$(EXESUFFIX) transpal$(EXESUFFIX) wad2map$(EXESUFFIX) wad2map$(EXESUFFIX)
all: game$(EXESUFFIX) build$(EXESUFFIX) $(OBJ)$(ENGINELIB) $(OBJ)$(EDITORLIB) ;
utils: $(UTILS) ;
enginelib: $(OBJ)$(ENGINELIB) ;
$(OBJ)$(ENGINELIB): $(ENGINEOBJS)
lib /out:$@ /nologo $**
editorlib: $(OBJ)$(EDITORLIB) ;
$(OBJ)$(EDITORLIB): $(EDITOROBJS)
lib /out:$@ /nologo $**
game$(EXESUFFIX): $(GAMEEXEOBJS)
$(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS /LIBPATH:$(DXROOT)\lib /LIBPATH:$(FMODROOT)\lib $(flags_link) /MAP $** $(LIBS) msvcrt.lib
build$(EXESUFFIX): $(EDITOREXEOBJS)
$(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS /LIBPATH:$(DXROOT)\lib /LIBPATH:$(FMODROOT)\lib $(flags_link) /MAP $** $(LIBS) msvcrt.lib
# the tools
kextract$(EXESUFFIX): $(OBJ)kextract.$o $(OBJ)compat.$o
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** msvcrt.lib
kgroup$(EXESUFFIX): $(OBJ)kgroup.$o $(OBJ)compat.$o
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** msvcrt.lib
transpal$(EXESUFFIX): $(OBJ)transpal.$o $(OBJ)pragmas.$o $(OBJ)compat.$o
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** msvcrt.lib
wad2map$(EXESUFFIX): $(OBJ)wad2map.$o $(OBJ)pragmas.$o $(OBJ)compat.$o
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** msvcrt.lib
wad2art$(EXESUFFIX): $(OBJ)wad2art.$o $(OBJ)pragmas.$o $(OBJ)compat.$o
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** msvcrt.lib
# DEPENDENCIES
!include Makefile.deps
$(OBJ)engineinfo.$o: writeengineinfo $(SRC)tmp\engineinfo.c
writeengineinfo:
echo const char _engine_cflags[] = "$(CFLAGS:\=\\)"; > $(SRC)tmp\engineinfo.c
echo const char _engine_libs[] = "$(LIBS)"; >> $(SRC)tmp\engineinfo.c
echo const char _engine_uname[] = "unknown"; >> $(SRC)tmp\engineinfo.c
echo const char _engine_compiler[] = "$(CC)"; >> $(SRC)tmp\engineinfo.c
echo const char _engine_date[] = __DATE__ " " __TIME__; >> $(SRC)tmp\engineinfo.c
# PHONIES
clean:
-del $(ENGINEOBJS) $(EDITOROBJS) $(GAMEEXEOBJS) $(EDITOREXEOBJS)
veryclean: clean
-del $(OBJ)$(ENGINELIB) $(OBJ)$(EDITORLIB) game$(EXESUFFIX) build$(EXESUFFIX) $(UTILS)

View File

@ -0,0 +1,160 @@
# Shared make information between Build engine and games
ENGINELIB=libengine.a
EDITORLIB=libbuild.a
# These are used when DYNAMIC_OPENGL is false
GLLIBWIN=-lopengl32
GLLIBBSD=-lopengl32
GLLIBLIN=-lGL
SDLCONFIG=sdl-config
#SDLCONFIG=/usr/local/bin/sdl11-config
# overridden for OSes that don't have the cutdown stdc++ that is supc++
STDCPPLIB=-lsupc++
BUILDCFLAGS=
# Detect the platform if it wasn't explicitly given to us from
# the outside world. This allows cross-compilation by overriding
# CC and giving us PLATFORM specifically.
ifndef PLATFORM
uname=$(strip $(shell uname -s))
PLATFORM=UNKNOWN
ifeq ($(findstring Linux,$(uname)),Linux)
PLATFORM=LINUX
endif
ifeq ($(findstring BSD,$(uname)),BSD)
PLATFORM=BSD
endif
ifeq ($(findstring MINGW,$(uname)),MINGW)
PLATFORM=WINDOWS
endif
ifeq ($(findstring Darwin,$(uname)),Darwin)
PLATFORM=DARWIN
endif
ifeq ($(findstring BeOS,$(uname)),BeOS)
PLATFORM=BEOS
endif
ifeq ($(findstring skyos,$(uname)),skyos)
PLATFORM=SKYOS
endif
ifeq ($(findstring QNX,$(uname)),QNX)
PLATFORM=QNX
endif
ifeq ($(findstring SunOS,$(uname)),SunOS)
PLATFORM=SUNOS
endif
ifeq ($(findstring syllable,$(uname)),syllable)
PLATFORM=SYLLABLE
endif
endif
ifeq ($(PLATFORM),LINUX)
RENDERTYPE=SDL
ifneq ($(DYNAMIC_OPENGL),1)
LIBS+= $(GLLIBLIN)
endif
ifeq ($(findstring x86_64,$(shell uname -m)),x86_64)
# on my 64bit Gentoo these are the 32bit emulation libs
LIBS+= -m32 -L/emul/linux/x86/usr/lib
BUILDCFLAGS+= -m32
override WITHOUT_GTK=1
endif
endif
ifeq ($(PLATFORM),WINDOWS)
RENDERTYPE ?= WIN
EXESUFFIX=.exe
LIBS+= -lmingwex -lwinmm -L$(DXROOT)/lib -lwsock32 #-lshfolder
ifneq ($(DYNAMIC_OPENGL),1)
LIBS+= $(GLLIBWIN)
endif
endif
ifeq ($(PLATFORM),BSD)
RENDERTYPE=SDL
ifneq ($(DYNAMIC_OPENGL),1)
LIBS+= $(GLLIBBSD)
endif
endif
ifeq ($(PLATFORM),BEOS)
RENDERTYPE=SDL
STDCPPLIB=-lstdc++
endif
ifeq ($(PLATFORM),SKYOS)
RENDERTYPE=SDL
EXESUFFIX=.app
override USE_A_C=1
BUILDCFLAGS+= -DUNDERSCORES
SDLCONFIG=
SDLCONFIG_CFLAGS=-I/boot/programs/sdk/include/sdl
LIBS+= -lSDL -lnet
endif
ifeq ($(PLATFORM),QNX)
RENDERTYPE=SDL
override USE_OPENGL=0
override USE_A_C=1
STDCPPLIB=-lstdc++
LIBS+= -lsocket
endif
ifeq ($(PLATFORM),SUNOS)
RENDERTYPE=SDL
override USE_OPENGL=0
override NOASM=1
override USE_A_C=1
STDCPPLIB=-lstdc++
LIBS+= -lsocket -lnsl
endif
ifeq ($(PLATFORM),SYLLABLE)
RENDERTYPE=SDL
override USE_OPENGL=0
override NOASM=1
endif
ifeq ($(RENDERTYPE),SDL)
ifneq ($(SDLCONFIG),)
LIBS+= $(shell $(SDLCONFIG) --libs)
SDLCONFIG_CFLAGS+=$(shell $(SDLCONFIG) --cflags)
endif
ifeq (1,$(WITHOUT_GTK))
HAVE_GTK2=0
else
ifneq (No,$(shell pkg-config --exists gtk+-2.0 || echo No))
HAVE_GTK2=1
LIBS+= $(shell pkg-config --libs gtk+-2.0)
else
HAVE_GTK2=0
endif
endif
else
ifeq ($(RENDERTYPE),WIN)
LIBS+= -mwindows -ldxguid
endif
endif
BUILDCFLAGS+= -DRENDERTYPE$(RENDERTYPE)=1
ifneq (0,$(SUPERBUILD))
BUILDCFLAGS+= -DSUPERBUILD
endif
ifneq (0,$(POLYMOST))
BUILDCFLAGS+= -DPOLYMOST
endif
ifneq (0,$(USE_OPENGL))
BUILDCFLAGS+= -DUSE_OPENGL
ifneq (0,$(DYNAMIC_OPENGL))
BUILDCFLAGS+= -DDYNAMIC_OPENGL
endif
endif
ifneq (0,$(USE_A_C))
BUILDCFLAGS+= -DUSE_A_C
endif
ifneq (0,$(NOASM))
BUILDCFLAGS+= -DNOASM
endif
ifneq (0,$(SETSPRITEZ))
BUILDCFLAGS+= -DSETSPRITEZ
endif

View File

@ -0,0 +1,174 @@
# Build Makefile for Watcom Make
!ifdef OVERRIDES
!include $(OVERRIDES)
!endif
SRC=src\
!ifndef OBJ
OBJ=obj.watcom\
!endif
INC=include\
!ifndef CFLAGS
CFLAGS=-dSUPERBUILD -dPOLYMOST -dUSE_OPENGL -dDYNAMIC_OPENGL -dKSFORBUILD
!endif
o=obj
res=res
asm=wasm
ENGINELIB=engine.lib
EDITORLIB=build.lib
DXROOT=c:\sdks\msc\dx7
FMODROOT=c:\sdks\fmodapi374win\api
!ifdef __LOADDLL__
! loaddll wcc386 wccd386
!endif
# -d these to enable certain features of the port's compile process
# USE_A_C This uses a C version of the classic renderer code rather
# than the assembly version in A.ASM.
# If this is defined, alter the $(OBJ)a.$o in the
# ENGINEOBJS declaration to be $(OBJ)a-c.$o
# NOASM When defined, uses C code instead of Watcom inline
# assembly for the features in PRAGMAS.H
TARGETOPTS=#-dUSE_A_C #-dNOASM
CC=wcc386
AS=wasm
RC=wrc
CFLAGS+= -5r -s -orb -fp5 $(TARGETOPTS) -d2 -dRENDERTYPEWIN=1 &
-i=$(INC) -i=$(DXROOT)\include -i=$(FMODROOT)\inc
LIBS=dxguid.lib wsock32.lib fmodwc.lib #opengl32.lib
ASFLAGS=# -d1
EXESUFFIX=.exe
ENGINEOBJS=$(OBJ)a.$o &
$(OBJ)baselayer.$o &
$(OBJ)cache1d.$o &
$(OBJ)compat.$o &
$(OBJ)crc32.$o &
$(OBJ)defs.$o &
$(OBJ)engine.$o &
$(OBJ)engineinfo.$o &
$(OBJ)glbuild.$o &
$(OBJ)kplib.$o &
$(OBJ)lzf_c.$o &
$(OBJ)lzf_d.$o &
$(OBJ)lzwnew.$o &
$(OBJ)md4.$o &
$(OBJ)mmulti.$o &
$(OBJ)osd.$o &
$(OBJ)pragmas.$o &
$(OBJ)scriptfile.$o &
$(OBJ)winlayer.$o
EDITOROBJS=$(OBJ)build.$o &
$(OBJ)config.$o &
$(OBJ)buildstartwin.$o
GAMEEXEOBJS=$(OBJ)game.$o &
$(OBJ)sound.$o &
$(OBJ)config.$o &
$(OBJ)gamestartwin.$o
EDITOREXEOBJS=$(OBJ)bstub.$o
# RULES
.EXTENSIONS: .wasm .res .rc
.wasm: $(SRC)
.c: $(SRC)
.c: $(SRC)tmp/
.c: $(SRC)util/
.rc: $(SRC)misc/
.wasm.$o:
$(AS) $(ASFLAGS) -fo=$(OBJ).$o $[@
.c.$o:
$(CC) $(CFLAGS) -fo=$(OBJ).$o $[@
.rc.$(res):
$(RC) -fo=$^*.$(res) -r $[@
# TARGETS
UTILS=kextract$(EXESUFFIX) kgroup$(EXESUFFIX) transpal$(EXESUFFIX) wad2art$(EXESUFFIX) wad2map$(EXESUFFIX)
all: game$(EXESUFFIX) build$(EXESUFFIX) $(OBJ)$(ENGINELIB) $(OBJ)$(EDITORLIB) .SYMBOLIC
%null
utils: $(UTILS) .SYMBOLIC
%null
enginelib: $(OBJ)$(ENGINELIB) .SYMBOLIC
%null
$(OBJ)$(ENGINELIB): $(ENGINEOBJS)
%create $(OBJ)$(ENGINELIB).tmp
for %i in ($(ENGINEOBJS)) do %append $(OBJ)$(ENGINELIB).tmp +%i
wlib -b -n $^* @$(OBJ)$(ENGINELIB).tmp
erase $(OBJ)$(ENGINELIB).tmp
editorlib: $(OBJ)$(EDITORLIB) .SYMBOLIC
%null
$(OBJ)$(EDITORLIB): $(EDITOROBJS)
%create $(OBJ)$(EDITORLIB).tmp
for %i in ($(EDITOROBJS)) do %append $(OBJ)$(EDITORLIB).tmp +%i
wlib -b -n $^* @$(OBJ)$(EDITORLIB).tmp
erase $(OBJ)$(EDITORLIB).tmp
game$(EXESUFFIX): $(GAMEEXEOBJS) $(OBJ)gameres.$(res) $(OBJ)$(ENGINELIB)
wlink NAME $@ &
SYSTEM WIN95 &
DEBUG ALL &
OPTION MAP &
FILE { $(GAMEEXEOBJS) } &
RESOURCE $(OBJ)gameres.$(res) &
LIBPATH $(DXROOT)\lib &
LIBPATH $(FMODROOT)\lib &
LIBPATH $(OBJ) &
LIBRARY { $(ENGINELIB) $(LIBS) }
build$(EXESUFFIX): $(EDITOREXEOBJS) $(OBJ)buildres.$(res) $(OBJ)$(ENGINELIB) $(OBJ)$(EDITORLIB)
wlink NAME $@ &
SYSTEM WIN95 &
DEBUG ALL &
OPTION MAP &
FILE { $(EDITOREXEOBJS) } &
RESOURCE $(OBJ)buildres.$(res) &
LIBPATH $(DXROOT)\lib &
LIBPATH $(FMODROOT)\lib &
LIBPATH $(OBJ) &
LIBRARY { $(ENGINELIB) $(EDITORLIB) $(LIBS) }
kextract$(EXESUFFIX): $(OBJ)kextract.$o $(OBJ)compat.$o
wlink NAME $@ SYSTEM 386 DEBUG ALL FILE { $< }
kgroup$(EXESUFFIX): $(OBJ)kgroup.$o $(OBJ)compat.$o
wlink NAME $@ SYSTEM 386 DEBUG ALL FILE { $< }
transpal$(EXESUFFIX): $(OBJ)transpal.$o $(OBJ)pragmas.$o $(OBJ)compat.$o
wlink NAME $@ SYSTEM 386 DEBUG ALL FILE { $< }
wad2art$(EXESUFFIX): $(OBJ)wad2art.$o $(OBJ)pragmas.$o $(OBJ)compat.$o
wlink NAME $@ SYSTEM 386 DEBUG ALL FILE { $< }
wad2map$(EXESUFFIX): $(OBJ)wad2map.$o $(OBJ)pragmas.$o $(OBJ)compat.$o
wlink NAME $@ SYSTEM 386 DEBUG ALL FILE { $< }
# DEPENDENCIES
!include Makefile.deps
$(OBJ)engineinfo.$o: writeengineinfo $(SRC)tmp\engineinfo.c
writeengineinfo: .SYMBOLIC
echo const char _engine_cflags[] = "$(CFLAGS:\=\\)"; > $(SRC)tmp\engineinfo.c
echo const char _engine_libs[] = "$(LIBS:\=\\)"; >> $(SRC)tmp\engineinfo.c
echo const char _engine_uname[] = "unknown"; >> $(SRC)tmp\engineinfo.c
echo const char _engine_compiler[] = "$(CC)"; >> $(SRC)tmp\engineinfo.c
echo const char _engine_date[] = __DATE__ " " __TIME__; >> $(SRC)tmp\engineinfo.c
# PHONIES
clean: .SYMBOLIC
-erase /q $(OBJ)* game$(EXESUFFIX) build$(EXESUFFIX) $(UTILS) *.err

49
polymer/build/NAMES.H Normal file
View File

@ -0,0 +1,49 @@
//Be careful when changing this file - it is parsed by Editart and Build.
#define SWITCH1ON 15
#define SLIME 34
#define BACKGROUND 37
#define KENPICTURE 48
#define BUILDDISK 49
#define SWITCH2ON 66
#define SWITCH2OFF 69
#define ALPHABET 73
#define NO 74
#define DEMOSIGN 75
#define COIN 76
#define COINSTACK 77
#define GIFTBOX 78
#define DIAMONDS 79
#define EVILALGRAVE 83
#define STATUSBAR 87
#define DAYSKY 89
#define WATERFOUNTAIN 90
#define USEWATERFOUNTAIN 91
#define NIGHTSKY 93
#define BULLET 98
#define BOMB 100
#define CANNON 101
#define GUNONBOTTOM 102
#define BOMBEMITTER 103
#define EXPLOSION 105
#define SPLASH 106
#define BROWNMONSTER 110
#define SKELETON 113
#define AL 114
#define EVILAL 115
#define PLAYER 120
#define SWITCH3OFF 146
#define SWITCH3ON 147
#define AIRPLANE 148
#define SPIRAL 149
#define COMPASS 150
#define FOOTPRINT 156
#define STATUSBARFILL8 160
#define STATUSBARFILL4 161
#define BOUNCYMAT 162
#define MIRROR 165
#define FLOORMIRROR 166
#define GRABBER 167
#define GRABCANNON 168
#define MISSILE 169
#define LAUNCHER 171
#define MIRRORLABEL 4000

141
polymer/build/README Normal file
View File

@ -0,0 +1,141 @@
Build Source Port by Jonathon Fowler
With contributions by Ken Silverman
ReadMe Information
First Source Release: 9 March 2003
This Release: 9 October 2005
A Few Notes and Words
---------------------
This is a release of the source code to my port of Ken
Silverman's Build game engine [1]. The port intends to bring the engine
source up to speed so that it may be used more easily with modern
operating systems on the x86 platform, like Microsoft Windows and *nix-
like ones such as Linux and BSD.
WinBuild is the name I give to the Windows target of this port.
It uses native Windows APIs like DirectX and the GDI to provide close
interaction with Windows for the sake of performance.
I have also developed a more platform-independant layer for
use on systems other than Windows by way of the Simple Direct-media
Layer (SDL) [2]. This layer should assist as a basis for further system
ports or for easier implementation on the platforms SDL supports.
Work on this port is a continuing process. I welcome the
contributions of programmers who have something they'd like to add (or
fix).
Configuration
-------------
Runtime settings for BUILD.EXE and GAME.EXE are set in build.cfg
and game.cfg respectively. These files are normal text files. The
original SETUP.DAT that is used in Ken's original code is not used in
this port. The config files are automatically created on the first run of
the game or editor.
Building the Source
-------------------
I build the Windows binaries using the following tools and libraries:
* MSYS ('Current' version) (http://www.mingw.org)
* MinGW ('Current' version) (http://www.mingw.org)
* NASM (http://nasm.sourceforge.net/)
* DirectX 6 or above headers and import libraries
DX6: (http://www.libsdl.org/extras/win32/common/directx-devel.tar.gz)
DX9: (http://www.microsoft.com/downloads/details.aspx?FamilyID=afc15f29-d7c9-4cf7-a8d5-8ab81f14ae1b&DisplayLang=en)
* SDL 1.2 (http://www.libsdl.org/download-1.2.php)
SDL is only used for the SDL interface layer and may be
omitted if building the DirectX version.
* FMOD (http://www.fmod.org)
Some good MinGW guides and whatnot:
- http://www.libsdl.org/extras/win32/mingw32/README.txt
- http://www.spacejack.org/games/mingw/
The engine compiles under Linux, FreeBSD, and NetBSD with minimal/no
modification.
Building the source involves just typing "make" in the directory
where you have unpacked the source. Windows users should make sure the
directory structure in the ZIP is maintained on extraction. The default
interface layer on Windows is the DirectX interface. This can be overriden
to the SDL one by using the command "make RENDERTYPE=SDL" instead. Linux
builds will always use SDL.
For compilation on other operating systems, see the addendum "Other OSes".
Things Missing
--------------
Nothing much is missing anymore. Networking is being improved as
time passes.
Bugs and Whatnot
----------------
I'm sure during my hacking I've perhaps introduced a bug here or
there. I want to try and nail these as I can. If you think you've found
a bug I would certainly like to hear about it. If you get it to crash,
a crash dump would be extremely helpful. Contact me using the details
found below.
Points of Contact
-----------------
The official location for this port on the WWW is at
http://jonof.edgenetwork.org/?p=jfbuild where the latest binaries and
source may be found. You can contact me via email at jonof@edgenetwork.org
Credits and Thanks
------------------
* Ken Silverman for his patience, help, and guidance in this. I
realise my rambling is taxing but your wisdom is invaluable.
* The folks at icculus.org for inspiring me to try and equal their
work done in the first public port of the engine.
* Do I dare mention myself?
* Pimping the edgenetwork (http://www.edgenetwk.com) who host my
site wouldn't go astray.
* Pär Karlsson for his contributions
Can't think of anything else at the moment, so, enjoy!
Jonathon Fowler
[1] http://www.advsys.net/ken/buildsrc
[2] http://www.libsdl.org
Addendum: Other OSes
--------------------
QNX 6.2.1:
I got the engine compiling and running on QNX 6.2.1 on the
23rd November 2005. The QNX 6.2.1 Non-commercial CDROM includes
the GCC 2.95-series compiler (though you do have to install the
package), and the only extra library you need to obtain and
install (probably from source like I did) is SDL 1.2.9 or newer.
You also have to disable linking to fmod and use the
sound_stub.$o in the Makefile.
SkyOS 5 beta 8.5:
Disabling fmod and using sound_stub.$o in the Makefile will get
it running.
Solaris 9:
Because of how Solaris seems to set itself up, you need to:
1. Edit Makefile and change AR to be 'gar' and RANLIB to be
'granlib'
2. Edit Makefile.shared and add (I think) /opt/sfw/bin/
to the start of SDLCONFIG's value
3. Disable fmod and use sound_stub.$o in Makefile
BSD:
Disable fmod and use sound_stub.$o in the Makefile. Use 'gmake'
to build.

104
polymer/build/build.cfg Normal file
View File

@ -0,0 +1,104 @@
; Build editor configuration
; Video mode selection
; 0 - Windowed
; 1 - Fullscreen
fullscreen = 0
; Video resolution selection
; 0 - 320 x 200
; 1 - 360 x 200
; 2 - 320 x 240
; 3 - 360 x 240
; 4 - 320 x 400
; 5 - 360 x 400
; 6 - 640 x 350
; 7 - 640 x 400
; 8 - 640 x 480
; 9 - 800 x 600
; 10 - 1024 x 768
; 11 - 1280 x 1024
; 12 - 1600 x 1200
; You can select a seperate 2D editor resolution by
; removing the semicolon from the second line below
; and selecting a mode number. The minimum 2D mode
; is 640x480 (mode #8)
resolution = 8
;2dresolution = 8
; 3D-mode colour depth
bpp = 8
; Maximum OpenGL mode refresh rate (Windows only, in Hertz)
maxrefreshfreq = 60
; 3D mode brightness setting
; 0 - lowest
; 15 - highest
brightness = 0
; Sound sample frequency
; 0 - 6 KHz
; 1 - 8 KHz
; 2 - 11.025 KHz
; 3 - 16 KHz
; 4 - 22.05 KHz
; 5 - 32 KHz
; 6 - 44.1 KHz
samplerate = 4
; Music playback
; 0 - Off
; 1 - On
music = 1
; Enable mouse
; 0 - No
; 1 - Yes
mouse = 1
; Mouse sensitivity
mousesensitivity = 1.0
; Key Settings
; Here's a map of all the keyboard scan codes: NOTE: values are listed in hex!
; +---------------------------------------------------------------------------------------------+
; | 01 3B 3C 3D 3E 3F 40 41 42 43 44 57 58 46 |
; |ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SCROLL |
; | |
; |29 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E D2 C7 C9 45 B5 37 4A |
; | ` '1' '2' '3' '4' '5' '6' '7' '8' '9' '0' - = BACK INS HOME PGUP NUMLK KP/ KP* KP- |
; | |
; | 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 2B D3 CF D1 47 48 49 4E |
; |TAB Q W E R T Y U I O P [ ] \ DEL END PGDN KP7 KP8 KP9 KP+ |
; | |
; | 3A 1E 1F 20 21 22 23 24 25 26 27 28 1C 4B 4C 4D |
; |CAPS A S D F G H J K L ; ' ENTER KP4 KP5 KP6 9C |
; | KPENTER|
; | 2A 2C 2D 2E 2F 30 31 32 33 34 35 36 C8 4F 50 51 |
; |LSHIFT Z X C V B N M , . / RSHIFT UP KP1 KP2 KP3 |
; | |
; | 1D 38 39 B8 9D CB D0 CD 52 53 |
; |LCTRL LALT SPACE RALT RCTRL LEFT DOWN RIGHT KP0 KP. |
; +---------------------------------------------------------------------------------------------+
keyforward = C8
keybackward = D0
keyturnleft = CB
keyturnright = CD
keyrun = 2A
keystrafe = 9D
keyfire = 1D
keyuse = 39
keystandhigh = 1E
keystandlow = 2C
keylookup = D1
keylookdown = C9
keystrafeleft = 33
keystraferight = 34
key2dmode = 9C
keyviewcycle = 1C
key2dzoomin = D
key2dzoomout = C
keychat = F

View File

@ -0,0 +1,71 @@
BUILD SOURCE CODE LICENSE TERMS: 06/20/2000
[1] I give you permission to make modifications to my Build source and
distribute it, BUT:
[2] Any derivative works based on my Build source may be distributed ONLY
through the INTERNET.
[3] Distribution of any derivative works MUST be done completely FREE of
charge - no commercial exploitation whatsoever.
[4] Anything you distribute which uses a part of my Build Engine source
code MUST include:
[A] The following message somewhere in the archive:
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
// Ken Silverman's official web site: "http://www.advsys.net/ken"
// See the included license file "BUILDLIC.TXT" for license info.
[B] This text file "BUILDLIC.TXT" along with it.
[C] Any source files that you modify must include this message as well:
// This file has been modified from Ken Silverman's original release
[5] The use of the Build Engine for commercial purposes will require an
appropriate license arrangement with me. Contact information is
on my web site.
[6] I take no responsibility for damage to your system.
[7] Technical support: Before contacting me with questions, please read
and do ALL of the following!
[A] Look through ALL of my text files. There are 7 of them (including this
one). I like to think that I wrote them for a reason. You will find
many of your answers in the history section of BUILD.TXT and
BUILD2.TXT (they're located inside SRC.ZIP).
[B] If that doesn't satisfy you, then try going to:
"http://www.advsys.net/ken/buildsrc"
where I will maintain a Build Source Code FAQ (or perhaps I might
just provide a link to a good FAQ).
[C] I am willing to respond to questions, but ONLY if they come at a rate
that I can handle.
PLEASE TRY TO AVOID ASKING DUPLICATE QUESTIONS!
As my line of defense, I will post my current policy about
answering Build source questions (right below the E-mail address
on my web site.) You can check there to see if I'm getting
overloaded with questions or not.
If I'm too busy, it might say something like this:
I'm too busy to answer Build source questions right now.
Sorry, but don't expect a reply from me any time soon.
If I'm open for Build source questions, please state your question
clearly and don't include any unsolicited attachments unless
they're really small (like less than 50k). Assume that I have
a 28.8k modem. Also, don't leave out important details just
to make your question appear shorter - making me guess what
you're asking doesn't save me time!
----------------------------------------------------------------------------
-Ken S. (official web site: http://www.advsys.net/ken)

View File

@ -0,0 +1,68 @@
[Project]
FileName=Build.dev
Name=KenBuild Editor
UnitCount=2
Type=0
Ver=1
ObjFiles=
Includes=..\include
Libs=C:\sdks\msc\dx7\include
PrivateResource=Build_private.rc
ResourceIncludes=..\
MakeIncludes=
Compiler=-DRENDERTYPEWIN=1_@@_-DSUPERBUILD_@@_-DPOLYMOST_@@_-DUSE_OPENGL_@@_-DDYNAMIC_OPENGL_@@_-DNO_GCC_BUILTINS_@@_-DUNDERSCORES_@@_-funsigned-char_@@_
CppCompiler=
Linker=libeditor.a_@@_libengine.a_@@_-ldxguid_@@_-lws2_32_@@_
IsCpp=0
Icon=
ExeOutput=..\devcpp
ObjectOutput=..\devcpp
OverrideOutput=0
OverrideOutputName=libengine.a
HostApplication=
Folders=
CommandLine=
UseCustomMakefile=0
CustomMakefile=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000000100010000d0
[VersionInfo]
Major=0
Minor=1
Release=1
Build=1
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0
[Unit1]
FileName=..\src\bstub.c
CompileCpp=0
Folder=KenBuild Editor
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit2]
FileName=..\src\misc\buildres.rc
Folder=KenBuild Editor
Compile=1
Link=0
Priority=1000
OverrideBuildCmd=0
BuildCmd=

View File

@ -0,0 +1,98 @@
[Project]
FileName=Game.dev
Name=KenBuild Game
UnitCount=5
Type=0
Ver=1
ObjFiles=
Includes=..\include;C:\sdks\fmodapi373win\api\inc
Libs=C:\sdks\msc\dx7\include;C:\sdks\fmodapi373win\api\lib
PrivateResource=Game_private.rc
ResourceIncludes=..\
MakeIncludes=
Compiler=-DRENDERTYPEWIN=1_@@_-DSUPERBUILD_@@_-DPOLYMOST_@@_-DUSE_OPENGL_@@_-DDYNAMIC_OPENGL_@@_-DNO_GCC_BUILTINS_@@_-DUNDERSCORES_@@_-funsigned-char_@@_
CppCompiler=
Linker=libeditor.a_@@_libengine.a_@@_-ldxguid_@@_-lws2_32_@@_-lfmod_@@_
IsCpp=0
Icon=
ExeOutput=..\devcpp
ObjectOutput=..\devcpp
OverrideOutput=0
OverrideOutputName=libengine.a
HostApplication=
Folders=
CommandLine=
UseCustomMakefile=0
CustomMakefile=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000000100010000d0
[VersionInfo]
Major=0
Minor=1
Release=1
Build=1
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0
[Unit3]
FileName=..\src\sound.c
CompileCpp=0
Folder=KenBuild Editor
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit4]
FileName=..\src\misc\gameres.rc
Folder=KenBuild Game
Compile=1
Link=0
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit1]
FileName=..\src\config.c
CompileCpp=0
Folder=KenBuild Editor
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit2]
FileName=..\src\game.c
CompileCpp=0
Folder=KenBuild Editor
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit5]
FileName=..\src\gamestartwin.c
CompileCpp=0
Folder=KenBuild Game
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

View File

@ -0,0 +1,5 @@
const char _engine_cflags[] = "Dev-C++ made this";
const char _engine_libs[] = "Dev-C++ made this";
const char _engine_uname[] = "Dev-C++";
const char _engine_compiler[] = "Dev-C++";
const char _engine_date[] = __DATE__ " " __TIME__;

View File

@ -0,0 +1,79 @@
[Project]
FileName=libEditor.dev
Name=Build Editor library
UnitCount=3
Type=2
Ver=1
ObjFiles=
Includes=..\include;..\src
Libs=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=-DRENDERTYPEWIN=1_@@_-DSUPERBUILD_@@_-DPOLYMOST_@@_-DUSE_OPENGL_@@_-DDYNAMIC_OPENGL_@@_-DNO_GCC_BUILTINS_@@_-DUNDERSCORES_@@_-funsigned-char_@@_
CppCompiler=
Linker=
IsCpp=0
Icon=
ExeOutput=..\devcpp
ObjectOutput=..\devcpp
OverrideOutput=1
OverrideOutputName=libeditor.a
HostApplication=
Folders=
CommandLine=
UseCustomMakefile=0
CustomMakefile=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000000100010000d0
[VersionInfo]
Major=0
Minor=1
Release=1
Build=1
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0
[Unit3]
FileName=..\src\buildstartwin.c
CompileCpp=0
Folder=KenBuild Editor
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit1]
FileName=..\src\build.c
CompileCpp=0
Folder=Build Editor library
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit2]
FileName=..\src\config.c
CompileCpp=0
Folder=Build Editor library
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

View File

@ -0,0 +1,198 @@
[Project]
FileName=libEngine.dev
Name=Build Engine library
UnitCount=15
Type=2
Ver=1
ObjFiles=
Includes=..\include;..\src;C:\sdks\msc\dx7\include
Libs=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=-DRENDERTYPEWIN=1_@@_-DSUPERBUILD_@@_-DPOLYMOST_@@_-DUSE_OPENGL_@@_-DDYNAMIC_OPENGL_@@_-DNO_GCC_BUILTINS_@@_-DUNDERSCORES_@@_-DKSFORBUILD_@@_-funsigned-char_@@_
CppCompiler=
Linker=
IsCpp=0
Icon=
ExeOutput=..\devcpp
ObjectOutput=..\devcpp
OverrideOutput=1
OverrideOutputName=libengine.a
HostApplication=
Folders=
CommandLine=
UseCustomMakefile=0
CustomMakefile=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000000100010000d0
[Unit1]
FileName=..\src\cache1d.c
CompileCpp=0
Folder=Engine
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit2]
FileName=..\src\engine.c
CompileCpp=0
Folder=Engine
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit3]
FileName=..\src\crc32.c
CompileCpp=0
Folder=Engine
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit4]
FileName=..\src\osd.c
CompileCpp=0
Folder=Engine
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit5]
FileName=..\src\pragmas.c
CompileCpp=0
Folder=Engine
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit6]
FileName=..\src\a.nasm
Folder=Engine
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=1
BuildCmd=nasm -s -DUNDERSCORES -f win32 ../src/a.nasm -o ../devcpp/a.o
[Unit7]
FileName=engineinfo.c
CompileCpp=0
Folder=Engine
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit8]
FileName=..\src\defs.c
CompileCpp=0
Folder=Engine
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit9]
FileName=..\src\compat.c
CompileCpp=0
Folder=Engine
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit10]
FileName=..\src\baselayer.c
CompileCpp=0
Folder=Engine
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit11]
FileName=..\src\glbuild.c
CompileCpp=0
Folder=Engine
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit12]
FileName=..\src\kplib.c
CompileCpp=0
Folder=Engine
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit13]
FileName=..\src\mmulti.c
CompileCpp=0
Folder=Engine
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit14]
FileName=..\src\scriptfile.c
CompileCpp=0
Folder=Engine
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[VersionInfo]
Major=0
Minor=1
Release=1
Build=1
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0
[Unit15]
FileName=..\src\winlayer.c
CompileCpp=0
Folder=Build Engine
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

97
polymer/build/game.cfg Normal file
View File

@ -0,0 +1,97 @@
; KenBuild configuration
; Video mode selection
; 0 - Windowed
; 1 - Fullscreen
fullscreen = 0
; Video resolution selection
; 0 - 320 x 200
; 1 - 360 x 200
; 2 - 320 x 240
; 3 - 360 x 240
; 4 - 320 x 400
; 5 - 360 x 400
; 6 - 640 x 350
; 7 - 640 x 400
; 8 - 640 x 480
; 9 - 800 x 600
; 10 - 1024 x 768
; 11 - 1280 x 1024
; 12 - 1600 x 1200
resolution = 8
; 3D-mode colour depth
bpp = 8
; 3D mode brightness setting
; 0 - lowest
; 15 - highest
brightness = 0
; Maximum OpenGL mode refresh rate (Windows only, in Hertz)
maxrefreshfreq = 60
; Sound sample frequency
; 0 - 6 KHz
; 1 - 8 KHz
; 2 - 11.025 KHz
; 3 - 16 KHz
; 4 - 22.05 KHz
; 5 - 32 KHz
; 6 - 44.1 KHz
samplerate = 4
; Music playback
; 0 - Off
; 1 - On
music = 1
; Enable mouse
; 0 - No
; 1 - Yes
mouse = 1
; Key Settings
; Here's a map of all the keyboard scan codes: NOTE: values are listed in hex!
; +---------------------------------------------------------------------------------------------+
; | 01 3B 3C 3D 3E 3F 40 41 42 43 44 57 58 46 |
; |ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SCROLL |
; | |
; |29 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E D2 C7 C9 45 B5 37 4A |
; | ` '1' '2' '3' '4' '5' '6' '7' '8' '9' '0' - = BACK INS HOME PGUP NUMLK KP/ KP* KP- |
; | |
; | 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 2B D3 CF D1 47 48 49 4E |
; |TAB Q W E R T Y U I O P [ ] \ DEL END PGDN KP7 KP8 KP9 KP+ |
; | |
; | 3A 1E 1F 20 21 22 23 24 25 26 27 28 1C 4B 4C 4D |
; |CAPS A S D F G H J K L ; ' ENTER KP4 KP5 KP6 9C |
; | KPENTER|
; | 2A 2C 2D 2E 2F 30 31 32 33 34 35 36 C8 4F 50 51 |
; |LSHIFT Z X C V B N M , . / RSHIFT UP KP1 KP2 KP3 |
; | |
; | 1D 38 39 B8 9D CB D0 CD 52 53 |
; |LCTRL LALT SPACE RALT RCTRL LEFT DOWN RIGHT KP0 KP. |
; +---------------------------------------------------------------------------------------------+
keyforward = C8
keybackward = D0
keyturnleft = CB
keyturnright = CD
keyrun = 2A
keystrafe = 9D
keyfire = 1D
keyuse = 39
keystandhigh = 1E
keystandlow = 2C
keylookup = D1
keylookdown = C9
keystrafeleft = 33
keystraferight = 34
key2dmode = 9C
keyviewcycle = 1C
key2dzoomin = D
key2dzoomout = C
keychat = F
keyconsole = 29

245
polymer/build/include/a.h Normal file
View File

@ -0,0 +1,245 @@
// Assembly-language function wrappers for a.asm functions
// for the Build Engine
// by Jonathon Fowler (jonof@edgenetwk.com)
#ifndef __a_h__
#define __a_h__
#if defined(USE_A_C)
#define ENGINE_USING_A_C
void setvlinebpl(long dabpl);
void fixtransluscence(long datransoff);
void settransnormal(void);
void settransreverse(void);
void sethlinesizes(long logx, long logy, long bufplc);
void setpalookupaddress(char *paladdr);
void setuphlineasm4(long bxinc, long byinc);
void hlineasm4(long cnt, long skiploadincs, long paloffs, unsigned long by, unsigned long bx, long p);
void setupslopevlin(long logylogx, long bufplc, long pinc);
void slopevlin(long p, long i, long slopaloffs, long cnt, long bx, long by);
void setupvlineasm(long neglogy);
void vlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufplc, long p);
void setupmvlineasm(long neglogy);
void mvlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufplc, long p);
void setuptvlineasm(long neglogy);
void tvlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufplc, long p);
void msethlineshift(long logx, long logy);
void mhline(long bufplc, unsigned long bx, long cntup16, long junk, unsigned long by, long p);
void tsethlineshift(long logx, long logy);
void thline(long bufplc, unsigned long bx, long cntup16, long junk, unsigned long by, long p);
void setupspritevline(long paloffs, long bxinc, long byinc, long ysiz);
void spritevline(long bx, long by, long cnt, long bufplc, long p);
void msetupspritevline(long paloffs, long bxinc, long byinc, long ysiz);
void mspritevline(long bx, long by, long cnt, long bufplc, long p);
void tsetupspritevline(long paloffs, long bxinc, long byinc, long ysiz);
void tspritevline(long bx, long by, long cnt, long bufplc, long p);
void setupdrawslab (long dabpl, long pal);
void drawslab (long dx, long v, long dy, long vi, long vptr, long p);
void stretchhline (long p0, long u, long cnt, long uinc, long rptr, long p);
void mmxoverlay();
#elif defined(__WATCOMC__) // USE_A_C
extern long mmxoverlay();
#pragma aux mmxoverlay modify [eax ebx ecx edx];
extern long sethlinesizes(long,long,long);
#pragma aux sethlinesizes parm [eax][ebx][ecx];
extern long setpalookupaddress(char *);
#pragma aux setpalookupaddress parm [eax];
extern long setuphlineasm4(long,long);
#pragma aux setuphlineasm4 parm [eax][ebx];
extern long hlineasm4(long,long,long,long,long,long);
#pragma aux hlineasm4 parm [eax][ebx][ecx][edx][esi][edi];
extern long setuprhlineasm4(long,long,long,long,long,long);
#pragma aux setuprhlineasm4 parm [eax][ebx][ecx][edx][esi][edi];
extern long rhlineasm4(long,long,long,long,long,long);
#pragma aux rhlineasm4 parm [eax][ebx][ecx][edx][esi][edi];
extern long setuprmhlineasm4(long,long,long,long,long,long);
#pragma aux setuprmhlineasm4 parm [eax][ebx][ecx][edx][esi][edi];
extern long rmhlineasm4(long,long,long,long,long,long);
#pragma aux rmhlineasm4 parm [eax][ebx][ecx][edx][esi][edi];
extern long setupqrhlineasm4(long,long,long,long,long,long);
#pragma aux setupqrhlineasm4 parm [eax][ebx][ecx][edx][esi][edi];
extern long qrhlineasm4(long,long,long,long,long,long);
#pragma aux qrhlineasm4 parm [eax][ebx][ecx][edx][esi][edi];
extern long setvlinebpl(long);
#pragma aux setvlinebpl parm [eax];
extern long fixtransluscence(long);
#pragma aux fixtransluscence parm [eax];
extern long prevlineasm1(long,long,long,long,long,long);
#pragma aux prevlineasm1 parm [eax][ebx][ecx][edx][esi][edi];
extern long vlineasm1(long,long,long,long,long,long);
#pragma aux vlineasm1 parm [eax][ebx][ecx][edx][esi][edi];
extern long setuptvlineasm(long);
#pragma aux setuptvlineasm parm [eax];
extern long tvlineasm1(long,long,long,long,long,long);
#pragma aux tvlineasm1 parm [eax][ebx][ecx][edx][esi][edi];
extern long setuptvlineasm2(long,long,long);
#pragma aux setuptvlineasm2 parm [eax][ebx][ecx];
extern long tvlineasm2(long,long,long,long,long,long);
#pragma aux tvlineasm2 parm [eax][ebx][ecx][edx][esi][edi];
extern long mvlineasm1(long,long,long,long,long,long);
#pragma aux mvlineasm1 parm [eax][ebx][ecx][edx][esi][edi];
extern long setupvlineasm(long);
#pragma aux setupvlineasm parm [eax];
extern long vlineasm4(long,long);
#pragma aux vlineasm4 parm [ecx][edi] modify [eax ebx ecx edx esi edi];
extern long setupmvlineasm(long);
#pragma aux setupmvlineasm parm [eax];
extern long mvlineasm4(long,long);
#pragma aux mvlineasm4 parm [ecx][edi] modify [eax ebx ecx edx esi edi];
extern void setupspritevline(long,long,long,long,long,long);
#pragma aux setupspritevline parm [eax][ebx][ecx][edx][esi][edi];
extern void spritevline(long,long,long,long,long,long);
#pragma aux spritevline parm [eax][ebx][ecx][edx][esi][edi];
extern void msetupspritevline(long,long,long,long,long,long);
#pragma aux msetupspritevline parm [eax][ebx][ecx][edx][esi][edi];
extern void mspritevline(long,long,long,long,long,long);
#pragma aux mspritevline parm [eax][ebx][ecx][edx][esi][edi];
extern void tsetupspritevline(long,long,long,long,long,long);
#pragma aux tsetupspritevline parm [eax][ebx][ecx][edx][esi][edi];
extern void tspritevline(long,long,long,long,long,long);
#pragma aux tspritevline parm [eax][ebx][ecx][edx][esi][edi];
extern long mhline(long,long,long,long,long,long);
#pragma aux mhline parm [eax][ebx][ecx][edx][esi][edi];
extern long mhlineskipmodify(long,long,long,long,long,long);
#pragma aux mhlineskipmodify parm [eax][ebx][ecx][edx][esi][edi];
extern long msethlineshift(long,long);
#pragma aux msethlineshift parm [eax][ebx];
extern long thline(long,long,long,long,long,long);
#pragma aux thline parm [eax][ebx][ecx][edx][esi][edi];
extern long thlineskipmodify(long,long,long,long,long,long);
#pragma aux thlineskipmodify parm [eax][ebx][ecx][edx][esi][edi];
extern long tsethlineshift(long,long);
#pragma aux tsethlineshift parm [eax][ebx];
extern long setupslopevlin(long,long,long);
#pragma aux setupslopevlin parm [eax][ebx][ecx] modify [edx];
extern long slopevlin(long,long,long,long,long,long);
#pragma aux slopevlin parm [eax][ebx][ecx][edx][esi][edi];
extern long settransnormal();
#pragma aux settransnormal parm;
extern long settransreverse();
#pragma aux settransreverse parm;
extern long setupdrawslab(long,long);
#pragma aux setupdrawslab parm [eax][ebx];
extern long drawslab(long,long,long,long,long,long);
#pragma aux drawslab parm [eax][ebx][ecx][edx][esi][edi];
#elif defined(__GNUC__) && defined(__i386__) // __WATCOMC__
#if defined(__linux) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__SYLLABLE__)
#define __cdecl
#endif
extern long __cdecl mmxoverlay();
extern long __cdecl sethlinesizes(long,long,long);
extern long __cdecl setpalookupaddress(char *);
extern long __cdecl setuphlineasm4(long,long);
extern long __cdecl hlineasm4(long,long,long,long,long,long);
extern long __cdecl setuprhlineasm4(long,long,long,long,long,long);
extern long __cdecl rhlineasm4(long,long,long,long,long,long);
extern long __cdecl setuprmhlineasm4(long,long,long,long,long,long);
extern long __cdecl rmhlineasm4(long,long,long,long,long,long);
extern long __cdecl setupqrhlineasm4(long,long,long,long,long,long);
extern long __cdecl qrhlineasm4(long,long,long,long,long,long);
extern long __cdecl setvlinebpl(long);
extern long __cdecl fixtransluscence(long);
extern long __cdecl prevlineasm1(long,long,long,long,long,long);
extern long __cdecl vlineasm1(long,long,long,long,long,long);
extern long __cdecl setuptvlineasm(long);
extern long __cdecl tvlineasm1(long,long,long,long,long,long);
extern long __cdecl setuptvlineasm2(long,long,long);
extern long __cdecl tvlineasm2(long,long,long,long,long,long);
extern long __cdecl mvlineasm1(long,long,long,long,long,long);
extern long __cdecl setupvlineasm(long);
extern long __cdecl vlineasm4(long,long);
extern long __cdecl setupmvlineasm(long);
extern long __cdecl mvlineasm4(long,long);
extern long __cdecl setupspritevline(long,long,long,long,long,long);
extern long __cdecl spritevline(long,long,long,long,long,long);
extern long __cdecl msetupspritevline(long,long,long,long,long,long);
extern long __cdecl mspritevline(long,long,long,long,long,long);
extern long __cdecl tsetupspritevline(long,long,long,long,long,long);
extern long __cdecl tspritevline(long,long,long,long,long,long);
extern long __cdecl mhline(long,long,long,long,long,long);
extern long __cdecl mhlineskipmodify(long,long,long,long,long,long);
extern long __cdecl msethlineshift(long,long);
extern long __cdecl thline(long,long,long,long,long,long);
extern long __cdecl thlineskipmodify(long,long,long,long,long,long);
extern long __cdecl tsethlineshift(long,long);
extern long __cdecl setupslopevlin(long,long,long);
extern long __cdecl slopevlin(long,long,long,long,long,long);
extern long __cdecl settransnormal();
extern long __cdecl settransreverse();
extern long __cdecl setupdrawslab(long,long);
extern long __cdecl drawslab(long,long,long,long,long,long);
extern void __cdecl stretchhline(long,long,long,long,long,long);
#elif defined(_MSC_VER) // __GNUC__ && __i386__
extern long _cdecl mmxoverlay();
extern long _cdecl sethlinesizes(long,long,long);
extern long _cdecl setpalookupaddress(char *);
extern long _cdecl setuphlineasm4(long,long);
extern long _cdecl hlineasm4(long,long,long,long,long,long);
extern long _cdecl setuprhlineasm4(long,long,long,long,long,long);
extern long _cdecl rhlineasm4(long,long,long,long,long,long);
extern long _cdecl setuprmhlineasm4(long,long,long,long,long,long);
extern long _cdecl rmhlineasm4(long,long,long,long,long,long);
extern long _cdecl setupqrhlineasm4(long,long,long,long,long,long);
extern long _cdecl qrhlineasm4(long,long,long,long,long,long);
extern long _cdecl setvlinebpl(long);
extern long _cdecl fixtransluscence(long);
extern long _cdecl prevlineasm1(long,long,long,long,long,long);
extern long _cdecl vlineasm1(long,long,long,long,long,long);
extern long _cdecl setuptvlineasm(long);
extern long _cdecl tvlineasm1(long,long,long,long,long,long);
extern long _cdecl setuptvlineasm2(long,long,long);
extern long _cdecl tvlineasm2(long,long,long,long,long,long);
extern long _cdecl mvlineasm1(long,long,long,long,long,long);
extern long _cdecl setupvlineasm(long);
extern long _cdecl vlineasm4(long,long);
extern long _cdecl setupmvlineasm(long);
extern long _cdecl mvlineasm4(long,long);
extern long _cdecl setupspritevline(long,long,long,long,long,long);
extern long _cdecl spritevline(long,long,long,long,long,long);
extern long _cdecl msetupspritevline(long,long,long,long,long,long);
extern long _cdecl mspritevline(long,long,long,long,long,long);
extern long _cdecl tsetupspritevline(long,long,long,long,long,long);
extern long _cdecl tspritevline(long,long,long,long,long,long);
extern long _cdecl mhline(long,long,long,long,long,long);
extern long _cdecl mhlineskipmodify(long,long,long,long,long,long);
extern long _cdecl msethlineshift(long,long);
extern long _cdecl thline(long,long,long,long,long,long);
extern long _cdecl thlineskipmodify(long,long,long,long,long,long);
extern long _cdecl tsethlineshift(long,long);
extern long _cdecl setupslopevlin(long,long,long);
extern long _cdecl slopevlin(long,long,long,long,long,long);
extern long _cdecl settransnormal();
extern long _cdecl settransreverse();
extern long _cdecl setupdrawslab(long,long);
extern long _cdecl drawslab(long,long,long,long,long,long);
extern void _cdecl stretchhline(long,long,long,long,long,long);
#else // _MSC_VER
#error Unsupported compiler or architecture.
#endif // else
#endif // __a_h__

View File

@ -0,0 +1,126 @@
// Base services interface declaration
// for the Build Engine
// by Jonathon Fowler (jonof@edgenetwk.com)
#ifndef __baselayer_h__
#define __baselayer_h__
#ifdef __cplusplus
extern "C" {
#endif
extern int _buildargc;
extern char **_buildargv;
extern char quitevent, appactive;
extern char *startwin_labeltext;
// video
extern long xres, yres, bpp, fullscreen, bytesperline, imageSize, frameplace;
extern char offscreenrendering;
extern void (*baselayer_onvideomodechange)(int);
#ifdef USE_OPENGL
struct glinfo {
const char *vendor;
const char *renderer;
const char *version;
const char *extensions;
float maxanisotropy;
char bgra;
char clamptoedge;
char texcompr;
char texnpot;
char multisample;
char nvmultisamplehint;
};
extern struct glinfo glinfo;
#endif
extern char inputdevices;
// keys
#define KEYFIFOSIZ 64
extern char keystatus[256], keyfifo[KEYFIFOSIZ], keyfifoplc, keyfifoend;
extern unsigned char keyasciififo[KEYFIFOSIZ], keyasciififoplc, keyasciififoend;
// mouse
extern long mousex, mousey, mouseb;
// joystick
extern long *joyaxis, *joyhat, joyb;
extern char joyisgamepad, joynumaxes, joynumbuttons, joynumhats;
extern long joyaxespresent;
int initsystem(void);
void uninitsystem(void);
void initprintf(const char *, ...);
void debugprintf(const char *,...);
int handleevents(void);
typedef void (*KeyPressCallback)(long,long);
typedef void (*MousePressCallback)(long,long);
typedef void (*JoyPressCallback)(long,long);
int initinput(void);
void uninitinput(void);
void releaseallbuttons(void);
void setkeypresscallback(void (*callback)(long,long));
void setmousepresscallback(void (*callback)(long,long));
void setjoypresscallback(void (*callback)(long,long));
const unsigned char *getkeyname(int num);
const unsigned char *getjoyname(int what, int num); // what: 0=axis, 1=button, 2=hat
unsigned char bgetchar(void);
int bkbhit(void);
void bflushchars(void);
int initmouse(void);
void uninitmouse(void);
void grabmouse(char a);
void readmousexy(long *x, long *y);
void readmousebstatus(long *b);
void setjoydeadzone(int axis, unsigned short dead, unsigned short satur);
void getjoydeadzone(int axis, unsigned short *dead, unsigned short *satur);
int inittimer(int);
void uninittimer(void);
void sampletimer(void);
unsigned long getticks(void);
int gettimerfreq(void);
void (*installusertimercallback(void (*callback)(void)))(void);
int checkvideomode(int *x, int *y, int c, int fs);
int setvideomode(int x, int y, int c, int fs);
void getvalidmodes(void);
void resetvideomode(void);
void begindrawing(void);
void enddrawing(void);
void showframe(int);
int setpalette(int start, int num, char *dapal);
//int getpalette(int start, int num, char *dapal);
int setgamma(float ro, float go, float bo);
int switchrendermethod(int,int); // 0 = software, 1 = opengl | bool = reinit
int wm_msgbox(char *name, char *fmt, ...);
int wm_ynbox(char *name, char *fmt, ...);
void wm_setapptitle(char *name);
// baselayer.c
int baselayer_init();
#ifdef __cplusplus
}
#endif
#endif // __baselayer_h__

View File

@ -0,0 +1,121 @@
// Base services interface declaration
// for the Build Engine
// by Jonathon Fowler (jonof@edgenetwk.com)
#ifndef __baselayer_h__
#define __baselayer_h__
#ifdef __cplusplus
extern "C" {
#endif
extern int _buildargc;
extern char **_buildargv;
extern char quitevent, appactive;
extern char *startwin_labeltext;
// video
extern long xres, yres, bpp, fullscreen, bytesperline, imageSize, frameplace;
extern char offscreenrendering;
extern void (*baselayer_onvideomodechange)(int);
#ifdef USE_OPENGL
struct glinfo {
const char *vendor;
const char *renderer;
const char *version;
const char *extensions;
float maxanisotropy;
char bgra, clamptoedge, texcompr, texnpot;
};
extern struct glinfo glinfo;
#endif
extern char inputdevices;
// keys
#define KEYFIFOSIZ 64
extern char keystatus[256], keyfifo[KEYFIFOSIZ], keyfifoplc, keyfifoend;
extern unsigned char keyasciififo[KEYFIFOSIZ], keyasciififoplc, keyasciififoend;
// mouse
extern long mousex, mousey, mouseb;
// joystick
extern long *joyaxis, *joyhat, joyb;
extern char joyisgamepad, joynumaxes, joynumbuttons, joynumhats;
extern long joyaxespresent;
int initsystem(void);
void uninitsystem(void);
void initprintf(const char *, ...);
void debugprintf(const char *,...);
int handleevents(void);
typedef void (*KeyPressCallback)(long,long);
typedef void (*MousePressCallback)(long,long);
typedef void (*JoyPressCallback)(long,long);
int initinput(void);
void uninitinput(void);
void releaseallbuttons(void);
void setkeypresscallback(void (*callback)(long,long));
void setmousepresscallback(void (*callback)(long,long));
void setjoypresscallback(void (*callback)(long,long));
const unsigned char *getkeyname(int num);
const unsigned char *getjoyname(int what, int num); // what: 0=axis, 1=button, 2=hat
unsigned char bgetchar(void);
int bkbhit(void);
void bflushchars(void);
int initmouse(void);
void uninitmouse(void);
void grabmouse(char a);
void readmousexy(long *x, long *y);
void readmousebstatus(long *b);
void setjoydeadzone(int axis, unsigned short dead, unsigned short satur);
void getjoydeadzone(int axis, unsigned short *dead, unsigned short *satur);
int inittimer(int);
void uninittimer(void);
void sampletimer(void);
unsigned long getticks(void);
int gettimerfreq(void);
void (*installusertimercallback(void (*callback)(void)))(void);
int checkvideomode(int *x, int *y, int c, int fs);
int setvideomode(int x, int y, int c, int fs);
void getvalidmodes(void);
void resetvideomode(void);
void begindrawing(void);
void enddrawing(void);
void showframe(int);
int setpalette(int start, int num, char *dapal);
//int getpalette(int start, int num, char *dapal);
int setgamma(float ro, float go, float bo);
int switchrendermethod(int,int); // 0 = software, 1 = opengl | bool = reinit
int wm_msgbox(char *name, char *fmt, ...);
int wm_ynbox(char *name, char *fmt, ...);
void wm_setapptitle(char *name);
// baselayer.c
int baselayer_init();
#ifdef __cplusplus
}
#endif
#endif // __baselayer_h__

View File

@ -0,0 +1,126 @@
// Base services interface declaration
// for the Build Engine
// by Jonathon Fowler (jonof@edgenetwk.com)
#ifndef __baselayer_h__
#define __baselayer_h__
#ifdef __cplusplus
extern "C" {
#endif
extern int _buildargc;
extern char **_buildargv;
extern char quitevent, appactive;
extern char *startwin_labeltext;
// video
extern long xres, yres, bpp, fullscreen, bytesperline, imageSize, frameplace;
extern char offscreenrendering;
extern void (*baselayer_onvideomodechange)(int);
#ifdef USE_OPENGL
struct glinfo {
const char *vendor;
const char *renderer;
const char *version;
const char *extensions;
float maxanisotropy;
char bgra;
char clamptoedge;
char texcompr;
char texnpot;
char multisample;
char nvmultisamplehint;
};
extern struct glinfo glinfo;
#endif
extern char inputdevices;
// keys
#define KEYFIFOSIZ 64
extern char keystatus[256], keyfifo[KEYFIFOSIZ], keyfifoplc, keyfifoend;
extern unsigned char keyasciififo[KEYFIFOSIZ], keyasciififoplc, keyasciififoend;
// mouse
extern long mousex, mousey, mouseb;
// joystick
extern long *joyaxis, *joyhat, joyb;
extern char joyisgamepad, joynumaxes, joynumbuttons, joynumhats;
extern long joyaxespresent;
int initsystem(void);
void uninitsystem(void);
void initprintf(const char *, ...);
void debugprintf(const char *,...);
int handleevents(void);
typedef void (*KeyPressCallback)(long,long);
typedef void (*MousePressCallback)(long,long);
typedef void (*JoyPressCallback)(long,long);
int initinput(void);
void uninitinput(void);
void releaseallbuttons(void);
void setkeypresscallback(void (*callback)(long,long));
void setmousepresscallback(void (*callback)(long,long));
void setjoypresscallback(void (*callback)(long,long));
const unsigned char *getkeyname(int num);
const unsigned char *getjoyname(int what, int num); // what: 0=axis, 1=button, 2=hat
unsigned char bgetchar(void);
int bkbhit(void);
void bflushchars(void);
int initmouse(void);
void uninitmouse(void);
void grabmouse(char a);
void readmousexy(long *x, long *y);
void readmousebstatus(long *b);
void setjoydeadzone(int axis, unsigned short dead, unsigned short satur);
void getjoydeadzone(int axis, unsigned short *dead, unsigned short *satur);
int inittimer(int);
void uninittimer(void);
void sampletimer(void);
unsigned long getticks(void);
int gettimerfreq(void);
void (*installusertimercallback(void (*callback)(void)))(void);
int checkvideomode(int *x, int *y, int c, int fs);
int setvideomode(int x, int y, int c, int fs);
void getvalidmodes(void);
void resetvideomode(void);
void begindrawing(void);
void enddrawing(void);
void showframe(int);
int setpalette(int start, int num, char *dapal);
//int getpalette(int start, int num, char *dapal);
int setgamma(float ro, float go, float bo);
int switchrendermethod(int,int); // 0 = software, 1 = opengl | bool = reinit
int wm_msgbox(char *name, char *fmt, ...);
int wm_ynbox(char *name, char *fmt, ...);
void wm_setapptitle(char *name);
// baselayer.c
int baselayer_init();
#ifdef __cplusplus
}
#endif
#endif // __baselayer_h__

View File

@ -0,0 +1,516 @@
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
// Ken Silverman's official web site: "http://www.advsys.net/ken"
// See the included license file "BUILDLIC.TXT" for license info.
//
// This file has been modified from Ken Silverman's original release
// by Jonathon Fowler (jonof@edgenetwk.com)
#ifndef __build_h__
#define __build_h__
#ifdef __cplusplus
extern "C" {
#endif
#define MAXSECTORSV8 4096
#define MAXWALLSV8 16384
#define MAXSPRITESV8 16384
#define MAXSECTORSV7 1024
#define MAXWALLSV7 8192
#define MAXSPRITESV7 4096
#define MAXSECTORS MAXSECTORSV8
#define MAXWALLS MAXWALLSV8
#define MAXSPRITES MAXSPRITESV8
#define MAXTILES 15360
#define MAXVOXELS 4096
#define MAXSTATUS 1024
#define MAXPLAYERS 16
#define MAXXDIM 1600
#define MAXYDIM 1200
#define MAXPALOOKUPS 256
#define MAXPSKYTILES 256
#define MAXSPRITESONSCREEN 2048
#define MAXUNIQHUDID 256 //Extra slots so HUD models can store animation state without messing game sprites
#define CLIPMASK0 (((1L)<<16)+1L)
#define CLIPMASK1 (((256L)<<16)+64L)
//Make all variables in BUILD.H defined in the ENGINE,
//and externed in GAME
#ifdef ENGINE
# define EXTERN
#else
# define EXTERN extern
#endif
#ifdef __GNUC__
#define BPACK __attribute__ ((packed))
#else
#define BPACK
#endif
#ifdef _MSC_VER
#pragma pack(1)
#endif
#ifdef __WATCOMC__
#pragma pack(push,1);
#endif
//ceilingstat/floorstat:
// bit 0: 1 = parallaxing, 0 = not "P"
// bit 1: 1 = groudraw, 0 = not
// bit 2: 1 = swap x&y, 0 = not "F"
// bit 3: 1 = double smooshiness "E"
// bit 4: 1 = x-flip "F"
// bit 5: 1 = y-flip "F"
// bit 6: 1 = Align texture to first wall of sector "R"
// bits 7-8: "T"
// 00 = normal floors
// 01 = masked floors
// 10 = transluscent masked floors
// 11 = reverse transluscent masked floors
// bits 9-15: reserved
//40 bytes
typedef struct BPACK
{
short wallptr, wallnum;
long ceilingz, floorz;
short ceilingstat, floorstat;
short ceilingpicnum, ceilingheinum;
signed char ceilingshade;
char ceilingpal, ceilingxpanning, ceilingypanning;
short floorpicnum, floorheinum;
signed char floorshade;
char floorpal, floorxpanning, floorypanning;
char visibility, filler;
short lotag, hitag, extra;
} sectortype;
//cstat:
// bit 0: 1 = Blocking wall (use with clipmove, getzrange) "B"
// bit 1: 1 = bottoms of invisible walls swapped, 0 = not "2"
// bit 2: 1 = align picture on bottom (for doors), 0 = top "O"
// bit 3: 1 = x-flipped, 0 = normal "F"
// bit 4: 1 = masking wall, 0 = not "M"
// bit 5: 1 = 1-way wall, 0 = not "1"
// bit 6: 1 = Blocking wall (use with hitscan / cliptype 1) "H"
// bit 7: 1 = Transluscence, 0 = not "T"
// bit 8: 1 = y-flipped, 0 = normal "F"
// bit 9: 1 = Transluscence reversing, 0 = normal "T"
// bits 10-15: reserved
//32 bytes
typedef struct BPACK
{
long x, y;
short point2, nextwall, nextsector, cstat;
short picnum, overpicnum;
signed char shade;
char pal, xrepeat, yrepeat, xpanning, ypanning;
short lotag, hitag, extra;
} walltype;
//cstat:
// bit 0: 1 = Blocking sprite (use with clipmove, getzrange) "B"
// bit 1: 1 = transluscence, 0 = normal "T"
// bit 2: 1 = x-flipped, 0 = normal "F"
// bit 3: 1 = y-flipped, 0 = normal "F"
// bits 5-4: 00 = FACE sprite (default) "R"
// 01 = WALL sprite (like masked walls)
// 10 = FLOOR sprite (parallel to ceilings&floors)
// bit 6: 1 = 1-sided sprite, 0 = normal "1"
// bit 7: 1 = Real centered centering, 0 = foot center "C"
// bit 8: 1 = Blocking sprite (use with hitscan / cliptype 1) "H"
// bit 9: 1 = Transluscence reversing, 0 = normal "T"
// bits 10-14: reserved
// bit 15: 1 = Invisible sprite, 0 = not invisible
//44 bytes
typedef struct BPACK
{
long x, y, z;
short cstat, picnum;
signed char shade;
char pal, clipdist, filler;
unsigned char xrepeat, yrepeat;
signed char xoffset, yoffset;
short sectnum, statnum;
short ang, owner, xvel, yvel, zvel;
short lotag, hitag, extra;
} spritetype;
typedef struct BPACK {
unsigned long mdanimtims;
short mdanimcur;
short angoff;
short pitch, roll;
short xoff, yoff, zoff;
unsigned char flags;
char filler[3];
} spriteexttype;
#define SPREXT_NOTMD 1
#define SPREXT_NOMDANIM 2
EXTERN spriteexttype spriteext[MAXSPRITES+MAXUNIQHUDID];
EXTERN long guniqhudid;
EXTERN sectortype sector[MAXSECTORS];
EXTERN walltype wall[MAXWALLS];
EXTERN spritetype sprite[MAXSPRITES];
EXTERN long spritesortcnt;
EXTERN spritetype tsprite[MAXSPRITESONSCREEN];
EXTERN long xdim, ydim, ylookup[MAXYDIM+1], numpages;
EXTERN long yxaspect, viewingrange;
#define MAXVALIDMODES 256
EXTERN long validmodecnt;
struct validmode_t {
long xdim,ydim;
char bpp;
char fs; // bit 0 = fullscreen flag
char filler[2];
long extra; // internal use
};
EXTERN struct validmode_t validmode[MAXVALIDMODES];
EXTERN short numsectors, numwalls;
EXTERN /*volatile*/ long totalclock;
EXTERN long numframes, randomseed;
EXTERN short sintable[2048];
EXTERN char palette[768];
EXTERN short numpalookups;
EXTERN char *palookup[MAXPALOOKUPS];
EXTERN char parallaxtype, showinvisibility;
EXTERN long parallaxyoffs, parallaxyscale;
EXTERN long visibility, parallaxvisibility;
EXTERN long windowx1, windowy1, windowx2, windowy2;
EXTERN short startumost[MAXXDIM], startdmost[MAXXDIM];
EXTERN short pskyoff[MAXPSKYTILES], pskybits;
EXTERN short headspritesect[MAXSECTORS+1], headspritestat[MAXSTATUS+1];
EXTERN short prevspritesect[MAXSPRITES], prevspritestat[MAXSPRITES];
EXTERN short nextspritesect[MAXSPRITES], nextspritestat[MAXSPRITES];
EXTERN short tilesizx[MAXTILES], tilesizy[MAXTILES];
EXTERN char walock[MAXTILES];
EXTERN long numtiles, picanm[MAXTILES], waloff[MAXTILES];
//These variables are for auto-mapping with the draw2dscreen function.
//When you load a new board, these bits are all set to 0 - since
//you haven't mapped out anything yet. Note that these arrays are
//bit-mapped.
//If you want draw2dscreen() to show sprite #54 then you say:
// spritenum = 54;
// show2dsprite[spritenum>>3] |= (1<<(spritenum&7));
//And if you want draw2dscreen() to not show sprite #54 then you say:
// spritenum = 54;
// show2dsprite[spritenum>>3] &= ~(1<<(spritenum&7));
//Automapping defaults to 0 (do nothing). If you set automapping to 1,
// then in 3D mode, the walls and sprites that you see will show up the
// next time you flip to 2D mode.
EXTERN char show2dsector[(MAXSECTORS+7)>>3];
EXTERN char show2dwall[(MAXWALLS+7)>>3];
EXTERN char show2dsprite[(MAXSPRITES+7)>>3];
EXTERN char automapping;
EXTERN char gotpic[(MAXTILES+7)>>3];
EXTERN char gotsector[(MAXSECTORS+7)>>3];
EXTERN char captureformat;
extern char vgapalette[5*256];
extern unsigned long drawlinepat;
extern void faketimerhandler(void);
extern char apptitle[256];
typedef struct {
unsigned char r,g,b,f;
} palette_t;
extern palette_t curpalette[256], curpalettefaded[256], palfadergb;
extern char palfadedelta;
extern long dommxoverlay, novoxmips;
#ifdef SUPERBUILD
extern long tiletovox[MAXTILES];
extern long usevoxels, voxscale[MAXVOXELS];
#endif
#ifdef POLYMOST
extern long usemodels, usehightile;
#endif
extern char *engineerrstr;
extern char noclip;
/*************************************************************************
POSITION VARIABLES:
POSX is your x - position ranging from 0 to 65535
POSY is your y - position ranging from 0 to 65535
(the length of a side of the grid in EDITBORD would be 1024)
POSZ is your z - position (height) ranging from 0 to 65535, 0 highest.
ANG is your angle ranging from 0 to 2047. Instead of 360 degrees, or
2 * PI radians, I use 2048 different angles, so 90 degrees would
be 512 in my system.
SPRITE VARIABLES:
EXTERN short headspritesect[MAXSECTORS+1], headspritestat[MAXSTATUS+1];
EXTERN short prevspritesect[MAXSPRITES], prevspritestat[MAXSPRITES];
EXTERN short nextspritesect[MAXSPRITES], nextspritestat[MAXSPRITES];
Example: if the linked lists look like the following:
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ
Sector lists: Status lists:
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ
Sector0: 4, 5, 8 Status0: 2, 0, 8
Sector1: 16, 2, 0, 7 Status1: 4, 5, 16, 7, 3, 9
Sector2: 3, 9
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Notice that each number listed above is shown exactly once on both the
left and right side. This is because any sprite that exists must
be in some sector, and must have some kind of status that you define.
Coding example #1:
To go through all the sprites in sector 1, the code can look like this:
sectnum = 1;
i = headspritesect[sectnum];
while (i != -1)
{
nexti = nextspritesect[i];
//your code goes here
//ex: printf("Sprite %d is in sector %d\n",i,sectnum);
i = nexti;
}
Coding example #2:
To go through all sprites with status = 1, the code can look like this:
statnum = 1; //status 1
i = headspritestat[statnum];
while (i != -1)
{
nexti = nextspritestat[i];
//your code goes here
//ex: printf("Sprite %d has a status of 1 (active)\n",i,statnum);
i = nexti;
}
insertsprite(short sectnum, short statnum);
deletesprite(short spritenum);
changespritesect(short spritenum, short newsectnum);
changespritestat(short spritenum, short newstatnum);
TILE VARIABLES:
NUMTILES - the number of tiles found TILES.DAT.
TILESIZX[MAXTILES] - simply the x-dimension of the tile number.
TILESIZY[MAXTILES] - simply the y-dimension of the tile number.
WALOFF[MAXTILES] - the actual 32-bit offset pointing to the top-left
corner of the tile.
PICANM[MAXTILES] - flags for animating the tile.
TIMING VARIABLES:
TOTALCLOCK - When the engine is initialized, TOTALCLOCK is set to zero.
From then on, it is incremented 120 times a second by 1. That
means that the number of seconds elapsed is totalclock / 120.
NUMFRAMES - The number of times the draw3dscreen function was called
since the engine was initialized. This helps to determine frame
rate. (Frame rate = numframes * 120 / totalclock.)
OTHER VARIABLES:
STARTUMOST[320] is an array of the highest y-coordinates on each column
that my engine is allowed to write to. You need to set it only
once.
STARTDMOST[320] is an array of the lowest y-coordinates on each column
that my engine is allowed to write to. You need to set it only
once.
SINTABLE[2048] is a sin table with 2048 angles rather than the
normal 360 angles for higher precision. Also since SINTABLE is in
all integers, the range is multiplied by 16383, so instead of the
normal -1<sin(x)<1, the range of sintable is -16383<sintable[]<16383
If you use this sintable, you can possibly speed up your code as
well as save space in memory. If you plan to use sintable, 2
identities you may want to keep in mind are:
sintable[ang&2047] = sin(ang * (3.141592/1024)) * 16383
sintable[(ang+512)&2047] = cos(ang * (3.141592/1024)) * 16383
NUMSECTORS - the total number of existing sectors. Modified every time
you call the loadboard function.
***************************************************************************/
int initengine(void);
void uninitengine(void);
void initspritelists(void);
long loadboard(char *filename, char fromwhere, long *daposx, long *daposy, long *daposz, short *daang, short *dacursectnum);
long loadmaphack(char *filename);
long saveboard(char *filename, long *daposx, long *daposy, long *daposz, short *daang, short *dacursectnum);
long loadpics(char *filename, long askedsize);
void loadtile(short tilenume);
long qloadkvx(long voxindex, char *filename);
long allocatepermanenttile(short tilenume, long xsiz, long ysiz);
void copytilepiece(long tilenume1, long sx1, long sy1, long xsiz, long ysiz, long tilenume2, long sx2, long sy2);
void makepalookup(long palnum, char *remapbuf, signed char r, signed char g, signed char b, char dastat);
void setvgapalette(void);
void setbrightness(char dabrightness, char *dapal, char noapply);
void setpalettefade(char r, char g, char b, char offset);
void squarerotatetile(short tilenume);
long setgamemode(char davidoption, long daxdim, long daydim, long dabpp);
void nextpage(void);
void setview(long x1, long y1, long x2, long y2);
void setaspect(long daxrange, long daaspect);
void flushperms(void);
void plotpixel(long x, long y, char col);
char getpixel(long x, long y);
void setviewtotile(short tilenume, long xsiz, long ysiz);
void setviewback(void);
void preparemirror(long dax, long day, long daz, short daang, long dahoriz, short dawall, short dasector, long *tposx, long *tposy, short *tang);
void completemirror(void);
void drawrooms(long daposx, long daposy, long daposz, short daang, long dahoriz, short dacursectnum);
void drawmasks(void);
void clearview(long dacol);
void clearallviews(long dacol);
void drawmapview(long dax, long day, long zoome, short ang);
void rotatesprite(long sx, long sy, long z, short a, short picnum, signed char dashade, char dapalnum, char dastat, long cx1, long cy1, long cx2, long cy2);
void drawline256(long x1, long y1, long x2, long y2, char col);
void printext16(long xpos, long ypos, short col, short backcol, char *name, char fontsize);
void printext256(long xpos, long ypos, short col, short backcol, char *name, char fontsize);
long clipmove(long *x, long *y, long *z, short *sectnum, long xvect, long yvect, long walldist, long ceildist, long flordist, unsigned long cliptype);
long clipinsidebox(long x, long y, short wallnum, long walldist);
long clipinsideboxline(long x, long y, long x1, long y1, long x2, long y2, long walldist);
long pushmove(long *x, long *y, long *z, short *sectnum, long walldist, long ceildist, long flordist, unsigned long cliptype);
void getzrange(long x, long y, long z, short sectnum, long *ceilz, long *ceilhit, long *florz, long *florhit, long walldist, unsigned long cliptype);
long hitscan(long xs, long ys, long zs, short sectnum, long vx, long vy, long vz, short *hitsect, short *hitwall, short *hitsprite, long *hitx, long *hity, long *hitz, unsigned long cliptype);
long neartag(long xs, long ys, long zs, short sectnum, short ange, short *neartagsector, short *neartagwall, short *neartagsprite, long *neartaghitdist, long neartagrange, char tagsearch);
long cansee(long x1, long y1, long z1, short sect1, long x2, long y2, long z2, short sect2);
void updatesector(long x, long y, short *sectnum);
void updatesectorz(long x, long y, long z, short *sectnum);
long inside(long x, long y, short sectnum);
void dragpoint(short pointhighlight, long dax, long day);
void setfirstwall(short sectnum, short newfirstwall);
void getmousevalues(long *mousx, long *mousy, long *bstatus);
long krand(void);
long ksqrt(long num);
long getangle(long xvect, long yvect);
void rotatepoint(long xpivot, long ypivot, long x, long y, short daang, long *x2, long *y2);
long lastwall(short point);
long nextsectorneighborz(short sectnum, long thez, short topbottom, short direction);
long getceilzofslope(short sectnum, long dax, long day);
long getflorzofslope(short sectnum, long dax, long day);
void getzsofslope(short sectnum, long dax, long day, long *ceilz, long *florz);
void alignceilslope(short dasect, long x, long y, long z);
void alignflorslope(short dasect, long x, long y, long z);
long sectorofwall(short theline);
long loopnumofsector(short sectnum, short wallnum);
long insertsprite(short sectnum, short statnum);
long deletesprite(short spritenum);
long changespritesect(short spritenum, short newsectnum);
long changespritestat(short spritenum, short newstatnum);
long setsprite(short spritenum, long newx, long newy, long newz);
long screencapture(char *filename, char inverseit);
#define STATUS2DSIZ 144
void qsetmode640350(void);
void qsetmode640480(void);
void qsetmodeany(long,long);
void clear2dscreen(void);
void draw2dgrid(long posxe, long posye, short ange, long zoome, short gride);
void draw2dscreen(long posxe, long posye, short ange, long zoome, short gride);
void drawline16(long x1, long y1, long x2, long y2, char col);
void drawcircle16(long x1, long y1, long r, char col);
int setrendermode(int renderer);
int getrendermode(void);
void setrollangle(long rolla);
// pal: pass -1 to invalidate all palettes for the tile, or >=0 for a particular palette
// how: pass -1 to invalidate all instances of the tile in texture memory, or a bitfield
// bit 0: opaque or masked (non-translucent) texture, using repeating
// bit 1: ignored
// bit 2: 33% translucence, using repeating
// bit 3: 67% translucence, using repeating
// bit 4: opaque or masked (non-translucent) texture, using clamping
// bit 5: ignored
// bit 6: 33% translucence, using clamping
// bit 7: 67% translucence, using clamping
// clamping is for sprites, repeating is for walls
void invalidatetile(short tilenume, long pal, long how);
void setpolymost2dview(void); // sets up GL for 2D drawing
long polymost_drawtilescreen(long tilex, long tiley, long wallnum, long dimen);
void polymost_glreset(void);
void polymost_precache(long dapicnum, long dapalnum, long datype);
#if defined(POLYMOST) && defined(USE_OPENGL)
extern long glanisotropy;
extern long glusetexcompr;
extern long gltexfiltermode;
extern long glredbluemode;
extern long glusetexcache, glusetexcachecompression;
extern long glmultisample, glnvmultisamplehint;
void gltexapplyprops (void);
#endif
void hicinit(void);
// effect bitset: 1 = greyscale, 2 = invert
void hicsetpalettetint(long palnum, unsigned char r, unsigned char g, unsigned char b, unsigned char effect);
// flags bitset: 1 = don't compress
int hicsetsubsttex(long picnum, long palnum, char *filen, float alphacut, char flags);
int hicsetskybox(long picnum, long palnum, char *faces[6]);
int hicclearsubst(long picnum, long palnum);
int md_loadmodel(const char *fn);
int md_setmisc(int modelid, float scale, int shadeoff, float zadd);
int md_tilehasmodel(int tilenume);
int md_defineframe(int modelid, const char *framename, int tilenume, int skinnum);
int md_defineanimation(int modelid, const char *framestart, const char *frameend, int fps, int flags);
int md_defineskin(int modelid, const char *skinfn, int palnum, int skinnum, int surfnum);
int md_definehud (int modelid, int tilex, double xadd, double yadd, double zadd, double angadd, int flags);
int md_undefinetile(int tile);
int md_undefinemodel(int modelid);
int loaddefinitionsfile(char *fn);
extern long mapversion; // if loadboard() fails with -2 return, try loadoldboard(). if it fails with -2, board is dodgy
long loadoldboard(char *filename, char fromwhere, long *daposx, long *daposy, long *daposz, short *daang, short *dacursectnum);
#ifdef _MSC_VER
#pragma pack()
#endif
#ifdef __WATCOMC__
#pragma pack(pop)
#endif
#undef BPACK
#ifdef __cplusplus
}
#endif
#endif // __build_h__

View File

@ -0,0 +1,63 @@
// cache1d.h
#ifndef __cache1d_h__
#define __cache1d_h__
#ifdef __cplusplus
extern "C" {
#endif
void initcache(long dacachestart, long dacachesize);
void allocache(long *newhandle, long newbytes, char *newlockptr);
void suckcache(long *suckptr);
void agecache(void);
extern int pathsearchmode; // 0 = gamefs mode (default), 1 = localfs mode (editor's mode)
int addsearchpath(const char *p);
int findfrompath(const char *fn, char **where);
int openfrompath(const char *fn, int flags, int mode);
BFILE *fopenfrompath(const char *fn, const char *mode);
long initgroupfile(char *filename);
void uninitsinglegroupfile(long grphandle);
void uninitgroupfile(void);
long kopen4load(char *filename, char searchfirst); // searchfirst: 0 = anywhere, 1 = first group, 2 = any group
long kread(long handle, void *buffer, long leng);
long klseek(long handle, long offset, long whence);
long kfilelength(long handle);
long ktell(long handle);
void kclose(long handle);
enum {
CACHE1D_FIND_FILE = 1,
CACHE1D_FIND_DIR = 2,
CACHE1D_FIND_DRIVE = 4,
CACHE1D_OPT_NOSTACK = 0x100,
// the lower the number, the higher the priority
CACHE1D_SOURCE_DRIVE = 0,
CACHE1D_SOURCE_CURDIR = 1,
CACHE1D_SOURCE_PATH = 2, // + path stack depth
CACHE1D_SOURCE_ZIP = 0x7ffffffe,
CACHE1D_SOURCE_GRP = 0x7fffffff,
};
typedef struct _CACHE1D_FIND_REC {
char *name;
int type, source;
struct _CACHE1D_FIND_REC *next, *prev, *usera, *userb;
} CACHE1D_FIND_REC;
void klistfree(CACHE1D_FIND_REC *rec);
CACHE1D_FIND_REC *klistpath(const char *path, const char *mask, int type);
int kdfread(void *buffer, bsize_t dasizeof, bsize_t count, long fil);
int dfread(void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil);
void kdfwrite(void *buffer, bsize_t dasizeof, bsize_t count, long fil);
void dfwrite(void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil);
#ifdef __cplusplus
}
#endif
#endif // __cache1d_h__

View File

@ -0,0 +1,432 @@
// Compatibility declarations for things which might not be present in
// certain build environments. It also levels the playing field caused
// by different platforms.
#ifndef __compat_h__
#define __compat_h__
// Define this to rewrite all 'B' versions to library functions. This
// is for platforms which give us a standard sort of C library so we
// link directly. Platforms like PalmOS which don't have a standard C
// library will need to wrap these functions with suitable emulations.
#define __compat_h_macrodef__
#ifdef __cplusplus
# include <cstdarg>
#else
# include <stdarg.h>
#endif
#ifdef __compat_h_macrodef__
# ifdef __cplusplus
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <ctime>
# else
# include <stdio.h>
# include <string.h>
# include <stdlib.h>
# include <time.h>
# endif
# include <fcntl.h>
# include <ctype.h>
# include <sys/types.h>
# include <sys/stat.h>
# include <errno.h>
# if defined(_WIN32)
# include <io.h>
# else
# include <unistd.h>
# endif
#endif
#ifdef EFENCE
# include <efence.h>
#endif
#if defined(__WATCOMC__)
# define inline __inline
# define int64 __int64
# define uint64 unsigned __int64
# define longlong(x) x##i64
#elif defined(_MSC_VER)
# define inline __inline
# define int64 __int64
# define uint64 unsigned __int64
# define longlong(x) x##i64
#else
# define longlong(x) x##ll
typedef long long int64;
typedef unsigned long long uint64;
#endif
#ifndef NULL
# define NULL ((void *)0)
#endif
#if defined(__linux)
# include <endian.h>
# if __BYTE_ORDER == __LITTLE_ENDIAN
# define B_LITTLE_ENDIAN 1
# define B_BIG_ENDIAN 0
# elif __BYTE_ORDER == __BIG_ENDIAN
# define B_LITTLE_ENDIAN 0
# define B_BIG_ENDIAN 1
# endif
# define B_ENDIAN_C_INLINE 1
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
# include <sys/endian.h>
# if _BYTE_ORDER == _LITTLE_ENDIAN
# define B_LITTLE_ENDIAN 1
# define B_BIG_ENDIAN 0
# elif _BYTE_ORDER == _BIG_ENDIAN
# define B_LITTLE_ENDIAN 0
# define B_BIG_ENDIAN 1
# endif
# define B_SWAP64(x) __bswap64(x)
# define B_SWAP32(x) __bswap32(x)
# define B_SWAP16(x) __bswap16(x)
#elif defined(__APPLE__)
# if defined(__LITTLE_ENDIAN__)
# define B_LITTLE_ENDIAN 1
# define B_BIG_ENDIAN 0
# elif defined(__BIG_ENDIAN__)
# define B_LITTLE_ENDIAN 0
# define B_BIG_ENDIAN 1
# endif
# include <libkern/OSByteOrder.h>
# define B_SWAP64(x) OSSwapConstInt64(x)
# define B_SWAP32(x) OSSwapConstInt32(x)
# define B_SWAP16(x) OSSwapConstInt16(x)
#elif defined(__BEOS__)
# include <posix/endian.h>
# if LITTLE_ENDIAN != 0
# define B_LITTLE_ENDIAN 1
# define B_BIG_ENDIAN 0
# elif BIG_ENDIAN != 0
# define B_LITTLE_ENDIAN 0
# define B_BIG_ENDIAN 1
# endif
# define B_ENDIAN_C_INLINE 1
#elif defined(__QNX__)
# if defined __LITTLEENDIAN__
# define B_LITTLE_ENDIAN 1
# define B_BIG_ENDIAN 0
# elif defined __BIGENDIAN__
# define B_LITTLE_ENDIAN 0
# define B_BIG_ENDIAN 1
# endif
# define B_ENDIAN_C_INLINE 1
#elif defined(__sun)
# if defined _LITTLE_ENDIAN
# define B_LITTLE_ENDIAN 1
# define B_BIG_ENDIAN 0
# elif defined _BIG_ENDIAN
# define B_LITTLE_ENDIAN 0
# define B_BIG_ENDIAN 1
# endif
# define B_ENDIAN_C_INLINE 1
#elif defined(_WIN32) || defined(SKYOS) || defined(__SYLLABLE__)
# define B_LITTLE_ENDIAN 1
# define B_BIG_ENDIAN 0
# define B_ENDIAN_C_INLINE 1
#endif
#if !defined(B_LITTLE_ENDIAN) || !defined(B_BIG_ENDIAN)
# error Unknown endianness
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if defined B_ENDIAN_X86_INLINE
# if defined(_MSC_VER)
// inline asm using bswap/xchg
# elif defined(__GNUC__)
// inline asm using bswap/xchg
# elif defined(__WATCOMC__)
// inline asm using bswap/xchg
# endif
#elif defined B_ENDIAN_C_INLINE
static inline unsigned short B_SWAP16(unsigned short s) { return (s>>8)|(s<<8); }
static inline unsigned long B_SWAP32(unsigned long l) { return ((l>>8)&0xff00)|((l&0xff00)<<8)|(l<<24)|(l>>24); }
static inline uint64 B_SWAP64(uint64 l) { return (l>>56)|((l>>40)&0xff00)|((l>>24)&0xff0000)|((l>>8)&0xff000000)|((l&255)<<56)|((l&0xff00)<<40)|((l&0xff0000)<<24)|((l&0xff000000)<<8); }
#endif
#if B_LITTLE_ENDIAN == 1
# define B_LITTLE64(x) (x)
# define B_BIG64(x) B_SWAP64(x)
# define B_LITTLE32(x) (x)
# define B_BIG32(x) B_SWAP32(x)
# define B_LITTLE16(x) (x)
# define B_BIG16(x) B_SWAP16(x)
#elif B_BIG_ENDIAN == 1
# define B_LITTLE64(x) B_SWAP64(x)
# define B_BIG64(x) (x)
# define B_LITTLE32(x) B_SWAP32(x)
# define B_BIG32(x) (x)
# define B_LITTLE16(x) B_SWAP16(x)
# define B_BIG16(x) (x)
#endif
#ifndef FP_OFF
# define FP_OFF(__p) ((unsigned)(__p))
#endif
#ifdef __compat_h_macrodef__
# ifndef O_BINARY
# define O_BINARY 0
# endif
# ifndef O_TEXT
# define O_TEXT 0
# endif
# ifndef F_OK
# define F_OK 0
# endif
# define BO_BINARY O_BINARY
# define BO_TEXT O_TEXT
# define BO_RDONLY O_RDONLY
# define BO_WRONLY O_WRONLY
# define BO_RDWR O_RDWR
# define BO_APPEND O_APPEND
# define BO_CREAT O_CREAT
# define BO_TRUNC O_TRUNC
# define BS_IRGRP S_IRGRP
# define BS_IWGRP S_IWGRP
# define BS_IEXEC S_IEXEC
# define BS_IWRITE S_IWRITE
# define BS_IREAD S_IREAD
# define BS_IFIFO S_IFIFO
# define BS_IFCHR S_IFCHR
# define BS_IFBLK S_IFBLK
# define BS_IFDIR S_IFDIR
# define BS_IFREG S_IFREG
# define BSEEK_SET SEEK_SET
# define BSEEK_CUR SEEK_CUR
# define BSEEK_END SEEK_END
#else
# define BO_BINARY 0
# define BO_TEXT 1
# define BO_RDONLY 2
# define BO_WRONLY 4
# define BO_RDWR 6
# define BO_APPEND 8
# define BO_CREAT 16
# define BO_TRUNC 32
# define BS_IRGRP 0
# define BS_IWGRP 0
# define BS_IEXEC 1
# define BS_IWRITE 2
# define BS_IREAD 4
# define BS_IFIFO 0x1000
# define BS_IFCHR 0x2000
# define BS_IFBLK 0x3000
# define BS_IFDIR 0x4000
# define BS_IFREG 0x8000
# define BSEEK_SET 0
# define BSEEK_CUR 1
# define BSEEK_END 2
#endif
#ifdef UNDERSCORES
# define ASMSYM(x) "_" x
#else
# define ASMSYM(x) x
#endif
#ifndef min
# define min(a,b) ( ((a) < (b)) ? (a) : (b) )
#endif
#ifndef max
# define max(a,b) ( ((a) > (b)) ? (a) : (b) )
#endif
#define BMAX_PATH 260
struct Bdirent {
unsigned short namlen;
char *name;
unsigned mode;
unsigned size;
unsigned mtime;
};
typedef void BDIR;
BDIR* Bopendir(const char *name);
struct Bdirent* Breaddir(BDIR *dir);
int Bclosedir(BDIR *dir);
#ifdef __compat_h_macrodef__
# define BFILE FILE
# define bsize_t size_t
# define bssize_t ssize_t
#else
typedef void BFILE;
typedef unsigned long bsize_t;
typedef signed long bssize_t;
#endif
#ifdef __compat_h_macrodef__
# define Brand rand
# define Balloca alloca
# define Bmalloc malloc
# define Bcalloc calloc
# define Brealloc realloc
# define Bfree free
# define Bopen open
# define Bclose close
# define Bwrite write
# define Bread read
# define Blseek lseek
# if defined(__GNUC__)
# define Btell(h) lseek(h,0,SEEK_CUR)
# else
# define Btell tell
# endif
# define Bstat stat
# define Bfopen fopen
# define Bfclose fclose
# define Bfeof feof
# define Bfgetc fgetc
# define Brewind rewind
# define Bfgets fgets
# define Bfputc fputc
# define Bfputs fputs
# define Bfread fread
# define Bfwrite fwrite
# define Bfprintf fprintf
# define Bstrdup strdup
# define Bstrcpy strcpy
# define Bstrncpy strncpy
# define Bstrcmp strcmp
# define Bstrncmp strncmp
# if defined(__WATCOMC__) || defined(_MSC_VER) || defined(__QNX__)
# define Bstrcasecmp stricmp
# define Bstrncasecmp strnicmp
# else
# define Bstrcasecmp strcasecmp
# define Bstrncasecmp strncasecmp
# endif
# if defined(_WIN32)
# define Bstrlwr strlwr
# define Bstrupr strupr
# define Bmkdir(s,x) mkdir(s)
# else
# define Bmkdir mkdir
# endif
# define Bstrcat strcat
# define Bstrncat strncat
# define Bstrlen strlen
# define Bstrchr strchr
# define Bstrrchr strrchr
# define Batoi atoi
# define Batol atol
# define Bstrtol strtol
# define Bstrtoul strtoul
# define Bstrtod strtod
# define Btoupper toupper
# define Btolower tolower
# define Bmemcpy memcpy
# define Bmemmove memmove
# define Bmemchr memchr
# define Bmemset memset
# define Bmemcmp memcmp
# define Bprintf printf
# define Bsprintf sprintf
# ifdef _MSC_VER
# define Bsnprintf _snprintf
# define Bvsnprintf _vsnprintf
# else
# define Bsnprintf snprintf
# define Bvsnprintf vsnprintf
# endif
# define Bvfprintf vfprintf
# define Bgetcwd getcwd
# define Bgetenv getenv
# define Btime() time(NULL)
#else
int Brand(void);
void *Bmalloc(bsize_t size);
void Bfree(void *ptr);
int Bopen(const char *pathname, int flags, unsigned mode);
int Bclose(int fd);
bssize_t Bwrite(int fd, const void *buf, bsize_t count);
bssize_t Bread(int fd, void *buf, bsize_t count);
int Blseek(int fildes, int offset, int whence);
BFILE *Bfopen(const char *path, const char *mode);
int Bfclose(BFILE *stream);
int Bfeof(BFILE *stream);
int Bfgetc(BFILE *stream);
void Brewind(BFILE *stream);
char *Bfgets(char *s, int size, BFILE *stream);
int Bfputc(int c, BFILE *stream);
int Bfputs(const char *s, BFILE *stream);
bsize_t Bfread(void *ptr, bsize_t size, bsize_t nmemb, BFILE *stream);
bsize_t Bfwrite(const void *ptr, bsize_t size, bsize_t nmemb, BFILE *stream);
char *Bstrdup(const char *s);
char *Bstrcpy(char *dest, const char *src);
char *Bstrncpy(char *dest, const char *src, bsize_t n);
int Bstrcmp(const char *s1, const char *s2);
int Bstrncmp(const char *s1, const char *s2, bsize_t n);
int Bstrcasecmp(const char *s1, const char *s2);
int Bstrncasecmp(const char *s1, const char *s2, bsize_t n);
char *Bstrcat(char *dest, const char *src);
char *Bstrncat(char *dest, const char *src, bsize_t n);
bsize_t Bstrlen(const char *s);
char *Bstrchr(const char *s, int c);
char *Bstrrchr(const char *s, int c);
int Batoi(const char *nptr);
long Batol(const char *nptr);
long int Bstrtol(const char *nptr, char **endptr, int base);
unsigned long int Bstrtoul(const char *nptr, char **endptr, int base);
void *Bmemcpy(void *dest, const void *src, bsize_t n);
void *Bmemmove(void *dest, const void *src, bsize_t n);
void *Bmemchr(const void *s, int c, bsize_t n);
void *Bmemset(void *s, int c, bsize_t n);
int Bmemcmp(const void *s1, const void *s2, bsize_t n);
int Bprintf(const char *format, ...);
int Bsprintf(char *str, const char *format, ...);
int Bsnprintf(char *str, bsize_t size, const char *format, ...);
int Bvsnprintf(char *str, bsize_t size, const char *format, va_list ap);
char *Bgetcwd(char *buf, bsize_t size);
char *Bgetenv(const char *name);
#endif
char *Bgethomedir(void);
unsigned int Bgetsysmemsize(void);
int Bcorrectfilename(char *filename, int removefn);
int Bcanonicalisefilename(char *filename, int removefn);
char *Bgetsystemdrives(void);
long Bfilelength(int fd);
char *Bstrtoken(char *s, char *delim, char **ptrptr, int chop);
long Bwildmatch (const char *i, const char *j);
#if !defined(_WIN32)
char *Bstrlwr(char *);
char *Bstrupr(char *);
#endif
#ifdef __cplusplus
}
#endif
#endif // __compat_h__

View File

@ -0,0 +1,20 @@
#ifndef __crc32_h__
#define __crc32_h__
#ifdef __cplusplus
extern "C" {
#endif
void initcrc32table(void);
unsigned long crc32once(unsigned char *blk, unsigned long len);
void crc32init(unsigned long *crcvar);
void crc32block(unsigned long *crcvar, unsigned char *blk, unsigned long len);
unsigned long crc32finish(unsigned long *crcvar);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,332 @@
#ifndef __dxdidf_h__
#define __dxdidf_h__
// Keyboard
static DIOBJECTDATAFORMAT c_dfDIKeyboard_odf[] = {
{ &GUID_Key, 0, 0x8000000C, 0x00000000 },
{ &GUID_Key, 1, 0x8000010C, 0x00000000 },
{ &GUID_Key, 2, 0x8000020C, 0x00000000 },
{ &GUID_Key, 3, 0x8000030C, 0x00000000 },
{ &GUID_Key, 4, 0x8000040C, 0x00000000 },
{ &GUID_Key, 5, 0x8000050C, 0x00000000 },
{ &GUID_Key, 6, 0x8000060C, 0x00000000 },
{ &GUID_Key, 7, 0x8000070C, 0x00000000 },
{ &GUID_Key, 8, 0x8000080C, 0x00000000 },
{ &GUID_Key, 9, 0x8000090C, 0x00000000 },
{ &GUID_Key, 10, 0x80000A0C, 0x00000000 },
{ &GUID_Key, 11, 0x80000B0C, 0x00000000 },
{ &GUID_Key, 12, 0x80000C0C, 0x00000000 },
{ &GUID_Key, 13, 0x80000D0C, 0x00000000 },
{ &GUID_Key, 14, 0x80000E0C, 0x00000000 },
{ &GUID_Key, 15, 0x80000F0C, 0x00000000 },
{ &GUID_Key, 16, 0x8000100C, 0x00000000 },
{ &GUID_Key, 17, 0x8000110C, 0x00000000 },
{ &GUID_Key, 18, 0x8000120C, 0x00000000 },
{ &GUID_Key, 19, 0x8000130C, 0x00000000 },
{ &GUID_Key, 20, 0x8000140C, 0x00000000 },
{ &GUID_Key, 21, 0x8000150C, 0x00000000 },
{ &GUID_Key, 22, 0x8000160C, 0x00000000 },
{ &GUID_Key, 23, 0x8000170C, 0x00000000 },
{ &GUID_Key, 24, 0x8000180C, 0x00000000 },
{ &GUID_Key, 25, 0x8000190C, 0x00000000 },
{ &GUID_Key, 26, 0x80001A0C, 0x00000000 },
{ &GUID_Key, 27, 0x80001B0C, 0x00000000 },
{ &GUID_Key, 28, 0x80001C0C, 0x00000000 },
{ &GUID_Key, 29, 0x80001D0C, 0x00000000 },
{ &GUID_Key, 30, 0x80001E0C, 0x00000000 },
{ &GUID_Key, 31, 0x80001F0C, 0x00000000 },
{ &GUID_Key, 32, 0x8000200C, 0x00000000 },
{ &GUID_Key, 33, 0x8000210C, 0x00000000 },
{ &GUID_Key, 34, 0x8000220C, 0x00000000 },
{ &GUID_Key, 35, 0x8000230C, 0x00000000 },
{ &GUID_Key, 36, 0x8000240C, 0x00000000 },
{ &GUID_Key, 37, 0x8000250C, 0x00000000 },
{ &GUID_Key, 38, 0x8000260C, 0x00000000 },
{ &GUID_Key, 39, 0x8000270C, 0x00000000 },
{ &GUID_Key, 40, 0x8000280C, 0x00000000 },
{ &GUID_Key, 41, 0x8000290C, 0x00000000 },
{ &GUID_Key, 42, 0x80002A0C, 0x00000000 },
{ &GUID_Key, 43, 0x80002B0C, 0x00000000 },
{ &GUID_Key, 44, 0x80002C0C, 0x00000000 },
{ &GUID_Key, 45, 0x80002D0C, 0x00000000 },
{ &GUID_Key, 46, 0x80002E0C, 0x00000000 },
{ &GUID_Key, 47, 0x80002F0C, 0x00000000 },
{ &GUID_Key, 48, 0x8000300C, 0x00000000 },
{ &GUID_Key, 49, 0x8000310C, 0x00000000 },
{ &GUID_Key, 50, 0x8000320C, 0x00000000 },
{ &GUID_Key, 51, 0x8000330C, 0x00000000 },
{ &GUID_Key, 52, 0x8000340C, 0x00000000 },
{ &GUID_Key, 53, 0x8000350C, 0x00000000 },
{ &GUID_Key, 54, 0x8000360C, 0x00000000 },
{ &GUID_Key, 55, 0x8000370C, 0x00000000 },
{ &GUID_Key, 56, 0x8000380C, 0x00000000 },
{ &GUID_Key, 57, 0x8000390C, 0x00000000 },
{ &GUID_Key, 58, 0x80003A0C, 0x00000000 },
{ &GUID_Key, 59, 0x80003B0C, 0x00000000 },
{ &GUID_Key, 60, 0x80003C0C, 0x00000000 },
{ &GUID_Key, 61, 0x80003D0C, 0x00000000 },
{ &GUID_Key, 62, 0x80003E0C, 0x00000000 },
{ &GUID_Key, 63, 0x80003F0C, 0x00000000 },
{ &GUID_Key, 64, 0x8000400C, 0x00000000 },
{ &GUID_Key, 65, 0x8000410C, 0x00000000 },
{ &GUID_Key, 66, 0x8000420C, 0x00000000 },
{ &GUID_Key, 67, 0x8000430C, 0x00000000 },
{ &GUID_Key, 68, 0x8000440C, 0x00000000 },
{ &GUID_Key, 69, 0x8000450C, 0x00000000 },
{ &GUID_Key, 70, 0x8000460C, 0x00000000 },
{ &GUID_Key, 71, 0x8000470C, 0x00000000 },
{ &GUID_Key, 72, 0x8000480C, 0x00000000 },
{ &GUID_Key, 73, 0x8000490C, 0x00000000 },
{ &GUID_Key, 74, 0x80004A0C, 0x00000000 },
{ &GUID_Key, 75, 0x80004B0C, 0x00000000 },
{ &GUID_Key, 76, 0x80004C0C, 0x00000000 },
{ &GUID_Key, 77, 0x80004D0C, 0x00000000 },
{ &GUID_Key, 78, 0x80004E0C, 0x00000000 },
{ &GUID_Key, 79, 0x80004F0C, 0x00000000 },
{ &GUID_Key, 80, 0x8000500C, 0x00000000 },
{ &GUID_Key, 81, 0x8000510C, 0x00000000 },
{ &GUID_Key, 82, 0x8000520C, 0x00000000 },
{ &GUID_Key, 83, 0x8000530C, 0x00000000 },
{ &GUID_Key, 84, 0x8000540C, 0x00000000 },
{ &GUID_Key, 85, 0x8000550C, 0x00000000 },
{ &GUID_Key, 86, 0x8000560C, 0x00000000 },
{ &GUID_Key, 87, 0x8000570C, 0x00000000 },
{ &GUID_Key, 88, 0x8000580C, 0x00000000 },
{ &GUID_Key, 89, 0x8000590C, 0x00000000 },
{ &GUID_Key, 90, 0x80005A0C, 0x00000000 },
{ &GUID_Key, 91, 0x80005B0C, 0x00000000 },
{ &GUID_Key, 92, 0x80005C0C, 0x00000000 },
{ &GUID_Key, 93, 0x80005D0C, 0x00000000 },
{ &GUID_Key, 94, 0x80005E0C, 0x00000000 },
{ &GUID_Key, 95, 0x80005F0C, 0x00000000 },
{ &GUID_Key, 96, 0x8000600C, 0x00000000 },
{ &GUID_Key, 97, 0x8000610C, 0x00000000 },
{ &GUID_Key, 98, 0x8000620C, 0x00000000 },
{ &GUID_Key, 99, 0x8000630C, 0x00000000 },
{ &GUID_Key, 100, 0x8000640C, 0x00000000 },
{ &GUID_Key, 101, 0x8000650C, 0x00000000 },
{ &GUID_Key, 102, 0x8000660C, 0x00000000 },
{ &GUID_Key, 103, 0x8000670C, 0x00000000 },
{ &GUID_Key, 104, 0x8000680C, 0x00000000 },
{ &GUID_Key, 105, 0x8000690C, 0x00000000 },
{ &GUID_Key, 106, 0x80006A0C, 0x00000000 },
{ &GUID_Key, 107, 0x80006B0C, 0x00000000 },
{ &GUID_Key, 108, 0x80006C0C, 0x00000000 },
{ &GUID_Key, 109, 0x80006D0C, 0x00000000 },
{ &GUID_Key, 110, 0x80006E0C, 0x00000000 },
{ &GUID_Key, 111, 0x80006F0C, 0x00000000 },
{ &GUID_Key, 112, 0x8000700C, 0x00000000 },
{ &GUID_Key, 113, 0x8000710C, 0x00000000 },
{ &GUID_Key, 114, 0x8000720C, 0x00000000 },
{ &GUID_Key, 115, 0x8000730C, 0x00000000 },
{ &GUID_Key, 116, 0x8000740C, 0x00000000 },
{ &GUID_Key, 117, 0x8000750C, 0x00000000 },
{ &GUID_Key, 118, 0x8000760C, 0x00000000 },
{ &GUID_Key, 119, 0x8000770C, 0x00000000 },
{ &GUID_Key, 120, 0x8000780C, 0x00000000 },
{ &GUID_Key, 121, 0x8000790C, 0x00000000 },
{ &GUID_Key, 122, 0x80007A0C, 0x00000000 },
{ &GUID_Key, 123, 0x80007B0C, 0x00000000 },
{ &GUID_Key, 124, 0x80007C0C, 0x00000000 },
{ &GUID_Key, 125, 0x80007D0C, 0x00000000 },
{ &GUID_Key, 126, 0x80007E0C, 0x00000000 },
{ &GUID_Key, 127, 0x80007F0C, 0x00000000 },
{ &GUID_Key, 128, 0x8000800C, 0x00000000 },
{ &GUID_Key, 129, 0x8000810C, 0x00000000 },
{ &GUID_Key, 130, 0x8000820C, 0x00000000 },
{ &GUID_Key, 131, 0x8000830C, 0x00000000 },
{ &GUID_Key, 132, 0x8000840C, 0x00000000 },
{ &GUID_Key, 133, 0x8000850C, 0x00000000 },
{ &GUID_Key, 134, 0x8000860C, 0x00000000 },
{ &GUID_Key, 135, 0x8000870C, 0x00000000 },
{ &GUID_Key, 136, 0x8000880C, 0x00000000 },
{ &GUID_Key, 137, 0x8000890C, 0x00000000 },
{ &GUID_Key, 138, 0x80008A0C, 0x00000000 },
{ &GUID_Key, 139, 0x80008B0C, 0x00000000 },
{ &GUID_Key, 140, 0x80008C0C, 0x00000000 },
{ &GUID_Key, 141, 0x80008D0C, 0x00000000 },
{ &GUID_Key, 142, 0x80008E0C, 0x00000000 },
{ &GUID_Key, 143, 0x80008F0C, 0x00000000 },
{ &GUID_Key, 144, 0x8000900C, 0x00000000 },
{ &GUID_Key, 145, 0x8000910C, 0x00000000 },
{ &GUID_Key, 146, 0x8000920C, 0x00000000 },
{ &GUID_Key, 147, 0x8000930C, 0x00000000 },
{ &GUID_Key, 148, 0x8000940C, 0x00000000 },
{ &GUID_Key, 149, 0x8000950C, 0x00000000 },
{ &GUID_Key, 150, 0x8000960C, 0x00000000 },
{ &GUID_Key, 151, 0x8000970C, 0x00000000 },
{ &GUID_Key, 152, 0x8000980C, 0x00000000 },
{ &GUID_Key, 153, 0x8000990C, 0x00000000 },
{ &GUID_Key, 154, 0x80009A0C, 0x00000000 },
{ &GUID_Key, 155, 0x80009B0C, 0x00000000 },
{ &GUID_Key, 156, 0x80009C0C, 0x00000000 },
{ &GUID_Key, 157, 0x80009D0C, 0x00000000 },
{ &GUID_Key, 158, 0x80009E0C, 0x00000000 },
{ &GUID_Key, 159, 0x80009F0C, 0x00000000 },
{ &GUID_Key, 160, 0x8000A00C, 0x00000000 },
{ &GUID_Key, 161, 0x8000A10C, 0x00000000 },
{ &GUID_Key, 162, 0x8000A20C, 0x00000000 },
{ &GUID_Key, 163, 0x8000A30C, 0x00000000 },
{ &GUID_Key, 164, 0x8000A40C, 0x00000000 },
{ &GUID_Key, 165, 0x8000A50C, 0x00000000 },
{ &GUID_Key, 166, 0x8000A60C, 0x00000000 },
{ &GUID_Key, 167, 0x8000A70C, 0x00000000 },
{ &GUID_Key, 168, 0x8000A80C, 0x00000000 },
{ &GUID_Key, 169, 0x8000A90C, 0x00000000 },
{ &GUID_Key, 170, 0x8000AA0C, 0x00000000 },
{ &GUID_Key, 171, 0x8000AB0C, 0x00000000 },
{ &GUID_Key, 172, 0x8000AC0C, 0x00000000 },
{ &GUID_Key, 173, 0x8000AD0C, 0x00000000 },
{ &GUID_Key, 174, 0x8000AE0C, 0x00000000 },
{ &GUID_Key, 175, 0x8000AF0C, 0x00000000 },
{ &GUID_Key, 176, 0x8000B00C, 0x00000000 },
{ &GUID_Key, 177, 0x8000B10C, 0x00000000 },
{ &GUID_Key, 178, 0x8000B20C, 0x00000000 },
{ &GUID_Key, 179, 0x8000B30C, 0x00000000 },
{ &GUID_Key, 180, 0x8000B40C, 0x00000000 },
{ &GUID_Key, 181, 0x8000B50C, 0x00000000 },
{ &GUID_Key, 182, 0x8000B60C, 0x00000000 },
{ &GUID_Key, 183, 0x8000B70C, 0x00000000 },
{ &GUID_Key, 184, 0x8000B80C, 0x00000000 },
{ &GUID_Key, 185, 0x8000B90C, 0x00000000 },
{ &GUID_Key, 186, 0x8000BA0C, 0x00000000 },
{ &GUID_Key, 187, 0x8000BB0C, 0x00000000 },
{ &GUID_Key, 188, 0x8000BC0C, 0x00000000 },
{ &GUID_Key, 189, 0x8000BD0C, 0x00000000 },
{ &GUID_Key, 190, 0x8000BE0C, 0x00000000 },
{ &GUID_Key, 191, 0x8000BF0C, 0x00000000 },
{ &GUID_Key, 192, 0x8000C00C, 0x00000000 },
{ &GUID_Key, 193, 0x8000C10C, 0x00000000 },
{ &GUID_Key, 194, 0x8000C20C, 0x00000000 },
{ &GUID_Key, 195, 0x8000C30C, 0x00000000 },
{ &GUID_Key, 196, 0x8000C40C, 0x00000000 },
{ &GUID_Key, 197, 0x8000C50C, 0x00000000 },
{ &GUID_Key, 198, 0x8000C60C, 0x00000000 },
{ &GUID_Key, 199, 0x8000C70C, 0x00000000 },
{ &GUID_Key, 200, 0x8000C80C, 0x00000000 },
{ &GUID_Key, 201, 0x8000C90C, 0x00000000 },
{ &GUID_Key, 202, 0x8000CA0C, 0x00000000 },
{ &GUID_Key, 203, 0x8000CB0C, 0x00000000 },
{ &GUID_Key, 204, 0x8000CC0C, 0x00000000 },
{ &GUID_Key, 205, 0x8000CD0C, 0x00000000 },
{ &GUID_Key, 206, 0x8000CE0C, 0x00000000 },
{ &GUID_Key, 207, 0x8000CF0C, 0x00000000 },
{ &GUID_Key, 208, 0x8000D00C, 0x00000000 },
{ &GUID_Key, 209, 0x8000D10C, 0x00000000 },
{ &GUID_Key, 210, 0x8000D20C, 0x00000000 },
{ &GUID_Key, 211, 0x8000D30C, 0x00000000 },
{ &GUID_Key, 212, 0x8000D40C, 0x00000000 },
{ &GUID_Key, 213, 0x8000D50C, 0x00000000 },
{ &GUID_Key, 214, 0x8000D60C, 0x00000000 },
{ &GUID_Key, 215, 0x8000D70C, 0x00000000 },
{ &GUID_Key, 216, 0x8000D80C, 0x00000000 },
{ &GUID_Key, 217, 0x8000D90C, 0x00000000 },
{ &GUID_Key, 218, 0x8000DA0C, 0x00000000 },
{ &GUID_Key, 219, 0x8000DB0C, 0x00000000 },
{ &GUID_Key, 220, 0x8000DC0C, 0x00000000 },
{ &GUID_Key, 221, 0x8000DD0C, 0x00000000 },
{ &GUID_Key, 222, 0x8000DE0C, 0x00000000 },
{ &GUID_Key, 223, 0x8000DF0C, 0x00000000 },
{ &GUID_Key, 224, 0x8000E00C, 0x00000000 },
{ &GUID_Key, 225, 0x8000E10C, 0x00000000 },
{ &GUID_Key, 226, 0x8000E20C, 0x00000000 },
{ &GUID_Key, 227, 0x8000E30C, 0x00000000 },
{ &GUID_Key, 228, 0x8000E40C, 0x00000000 },
{ &GUID_Key, 229, 0x8000E50C, 0x00000000 },
{ &GUID_Key, 230, 0x8000E60C, 0x00000000 },
{ &GUID_Key, 231, 0x8000E70C, 0x00000000 },
{ &GUID_Key, 232, 0x8000E80C, 0x00000000 },
{ &GUID_Key, 233, 0x8000E90C, 0x00000000 },
{ &GUID_Key, 234, 0x8000EA0C, 0x00000000 },
{ &GUID_Key, 235, 0x8000EB0C, 0x00000000 },
{ &GUID_Key, 236, 0x8000EC0C, 0x00000000 },
{ &GUID_Key, 237, 0x8000ED0C, 0x00000000 },
{ &GUID_Key, 238, 0x8000EE0C, 0x00000000 },
{ &GUID_Key, 239, 0x8000EF0C, 0x00000000 },
{ &GUID_Key, 240, 0x8000F00C, 0x00000000 },
{ &GUID_Key, 241, 0x8000F10C, 0x00000000 },
{ &GUID_Key, 242, 0x8000F20C, 0x00000000 },
{ &GUID_Key, 243, 0x8000F30C, 0x00000000 },
{ &GUID_Key, 244, 0x8000F40C, 0x00000000 },
{ &GUID_Key, 245, 0x8000F50C, 0x00000000 },
{ &GUID_Key, 246, 0x8000F60C, 0x00000000 },
{ &GUID_Key, 247, 0x8000F70C, 0x00000000 },
{ &GUID_Key, 248, 0x8000F80C, 0x00000000 },
{ &GUID_Key, 249, 0x8000F90C, 0x00000000 },
{ &GUID_Key, 250, 0x8000FA0C, 0x00000000 },
{ &GUID_Key, 251, 0x8000FB0C, 0x00000000 },
{ &GUID_Key, 252, 0x8000FC0C, 0x00000000 },
{ &GUID_Key, 253, 0x8000FD0C, 0x00000000 },
{ &GUID_Key, 254, 0x8000FE0C, 0x00000000 },
{ &GUID_Key, 255, 0x8000FF0C, 0x00000000 }
};
const DIDATAFORMAT c_dfDIKeyboard = { 24, 16, 0x00000002, 256, 256, c_dfDIKeyboard_odf };
// Mouse
static DIOBJECTDATAFORMAT c_dfDIMouse_odf[] = {
{ &GUID_XAxis, 0, 0x00FFFF03, 0x00000000 },
{ &GUID_YAxis, 4, 0x00FFFF03, 0x00000000 },
{ &GUID_ZAxis, 8, 0x80FFFF03, 0x00000000 },
{ NULL, 12, 0x00FFFF0C, 0x00000000 },
{ NULL, 13, 0x00FFFF0C, 0x00000000 },
{ NULL, 14, 0x80FFFF0C, 0x00000000 },
{ NULL, 15, 0x80FFFF0C, 0x00000000 }
};
const DIDATAFORMAT c_dfDIMouse = { 24, 16, 0x00000002, 16, 7, c_dfDIMouse_odf };
// Joystick
static DIOBJECTDATAFORMAT c_dfDIJoystick_odf[] = {
{ &GUID_XAxis, 0, 0x80FFFF03, 0x00000100 },
{ &GUID_YAxis, 4, 0x80FFFF03, 0x00000100 },
{ &GUID_ZAxis, 8, 0x80FFFF03, 0x00000100 },
{ &GUID_RxAxis, 12, 0x80FFFF03, 0x00000100 },
{ &GUID_RyAxis, 16, 0x80FFFF03, 0x00000100 },
{ &GUID_RzAxis, 20, 0x80FFFF03, 0x00000100 },
{ &GUID_Slider, 24, 0x80FFFF03, 0x00000100 },
{ &GUID_Slider, 28, 0x80FFFF03, 0x00000100 },
{ &GUID_POV, 32, 0x80FFFF10, 0x00000000 },
{ &GUID_POV, 36, 0x80FFFF10, 0x00000000 },
{ &GUID_POV, 40, 0x80FFFF10, 0x00000000 },
{ &GUID_POV, 44, 0x80FFFF10, 0x00000000 },
{ NULL, 48, 0x80FFFF0C, 0x00000000 },
{ NULL, 49, 0x80FFFF0C, 0x00000000 },
{ NULL, 50, 0x80FFFF0C, 0x00000000 },
{ NULL, 51, 0x80FFFF0C, 0x00000000 },
{ NULL, 52, 0x80FFFF0C, 0x00000000 },
{ NULL, 53, 0x80FFFF0C, 0x00000000 },
{ NULL, 54, 0x80FFFF0C, 0x00000000 },
{ NULL, 55, 0x80FFFF0C, 0x00000000 },
{ NULL, 56, 0x80FFFF0C, 0x00000000 },
{ NULL, 57, 0x80FFFF0C, 0x00000000 },
{ NULL, 58, 0x80FFFF0C, 0x00000000 },
{ NULL, 59, 0x80FFFF0C, 0x00000000 },
{ NULL, 60, 0x80FFFF0C, 0x00000000 },
{ NULL, 61, 0x80FFFF0C, 0x00000000 },
{ NULL, 62, 0x80FFFF0C, 0x00000000 },
{ NULL, 63, 0x80FFFF0C, 0x00000000 },
{ NULL, 64, 0x80FFFF0C, 0x00000000 },
{ NULL, 65, 0x80FFFF0C, 0x00000000 },
{ NULL, 66, 0x80FFFF0C, 0x00000000 },
{ NULL, 67, 0x80FFFF0C, 0x00000000 },
{ NULL, 68, 0x80FFFF0C, 0x00000000 },
{ NULL, 69, 0x80FFFF0C, 0x00000000 },
{ NULL, 70, 0x80FFFF0C, 0x00000000 },
{ NULL, 71, 0x80FFFF0C, 0x00000000 },
{ NULL, 72, 0x80FFFF0C, 0x00000000 },
{ NULL, 73, 0x80FFFF0C, 0x00000000 },
{ NULL, 74, 0x80FFFF0C, 0x00000000 },
{ NULL, 75, 0x80FFFF0C, 0x00000000 },
{ NULL, 76, 0x80FFFF0C, 0x00000000 },
{ NULL, 77, 0x80FFFF0C, 0x00000000 },
{ NULL, 78, 0x80FFFF0C, 0x00000000 },
{ NULL, 79, 0x80FFFF0C, 0x00000000 }
};
const DIDATAFORMAT c_dfDIJoystick = { 24, 16, 0x00000001, 80, 44, c_dfDIJoystick_odf };
#endif // __dxdidf_h__

View File

@ -0,0 +1,68 @@
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
// Ken Silverman's official web site: "http://www.advsys.net/ken"
// See the included license file "BUILDLIC.TXT" for license info.
#ifndef __editor_h__
#define __editor_h__
#ifdef __cplusplus
extern "C" {
#endif
#define NUMBUILDKEYS 20
extern long qsetmode;
extern short searchsector, searchwall, searchstat;
extern long zmode, kensplayerheight;
extern short defaultspritecstat;
extern short temppicnum, tempcstat, templotag, temphitag, tempextra;
extern char tempshade, temppal, tempxrepeat, tempyrepeat;
extern char somethingintab;
extern char buildkeys[NUMBUILDKEYS];
extern long ydim16, xdimgame, ydimgame, bppgame, xdim2d, ydim2d;
extern int ExtInit(void);
extern void ExtUnInit(void);
extern void ExtPreCheckKeys(void);
#ifdef SUPERBUILD
extern void ExtAnalyzeSprites(void);
#endif
extern void ExtCheckKeys(void);
extern void ExtPreLoadMap(void);
extern void ExtLoadMap(const char *mapname);
extern void ExtPreSaveMap(void);
extern void ExtSaveMap(const char *mapname);
extern const char *ExtGetSectorCaption(short sectnum);
extern const char *ExtGetWallCaption(short wallnum);
extern const char *ExtGetSpriteCaption(short spritenum);
extern void ExtShowSectorData(short sectnum);
extern void ExtShowWallData(short wallnum);
extern void ExtShowSpriteData(short spritenum);
extern void ExtEditSectorData(short sectnum);
extern void ExtEditWallData(short wallnum);
extern void ExtEditSpriteData(short spritenum);
int loadsetup(const char *fn); // from config.c
int writesetup(const char *fn); // from config.c
void editinput(void);
void clearmidstatbar16(void);
long getnumber256(char namestart[80], long num, long maxnumber, char sign);
long getnumber16(char namestart[80], long num, long maxnumber, char sign);
void printmessage256(char name[82]);
void printmessage16(char name[82]);
void getpoint(long searchxe, long searchye, long *x, long *y);
long getpointhighlight(long xplc, long yplc);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,6 @@
extern const char _engine_cflags[];
extern const char _engine_libs[];
extern const char _engine_uname[];
extern const char _engine_compiler[];
extern const char _engine_date[];

View File

@ -0,0 +1,56 @@
// game.h
void operatesector(short dasector);
void operatesprite(short dasprite);
long changehealth(short snum, short deltahealth);
void changenumbombs(short snum, short deltanumbombs);
void changenummissiles(short snum, short deltanummissiles);
void changenumgrabbers(short snum, short deltanumgrabbers);
void drawstatusflytime(short snum);
void drawstatusbar(short snum);
void prepareboard(char *daboardfilename);
void checktouchsprite(short snum, short sectnum);
void checkgrabbertouchsprite(short snum, short sectnum);
void shootgun(short snum, long x, long y, long z, short daang, long dahoriz, short dasectnum, char guntype);
void analyzesprites(long dax, long day);
void tagcode(void);
void statuslistcode(void);
void activatehitag(short dahitag);
void bombexplode(long i);
void processinput(short snum);
void view(short snum, long *vx, long *vy, long *vz, short *vsectnum, short ang, long horiz);
void updatesectorz(long x, long y, long z, short *sectnum);
void drawscreen(short snum, long dasmoothratio);
void movethings(void);
void fakedomovethings(void);
void fakedomovethingscorrect(void);
void domovethings(void);
void getinput(void);
void initplayersprite(short snum);
void playback(void);
void setup3dscreen(void);
void findrandomspot(long *x, long *y, short *sectnum);
void warp(long *x, long *y, long *z, short *daang, short *dasector);
void warpsprite(short spritenum);
void initlava(void);
void movelava(char *dapic);
void doanimations(void);
long getanimationgoal(long animptr);
long setanimation(long *animptr, long thegoal, long thevel, long theacc);
void checkmasterslaveswitch(void);
long testneighborsectors(short sect1, short sect2);
long loadgame(void);
long savegame(void);
void faketimerhandler(void);
void getpackets(void);
void drawoverheadmap(long cposx, long cposy, long czoom, short cang);
long movesprite(short spritenum, long dx, long dy, long dz, long ceildist, long flordist, long clipmask);
void waitforeverybody(void);
void searchmap(short startsector);
void setinterpolation(long *posptr);
void stopinterpolation(long *posptr);
void updateinterpolations(void);
void dointerpolations(void);
void restoreinterpolations(void);
void printext(long x, long y, char *buffer, short tilenum, char invisiblecol);
void drawtilebackground (long thex, long they, short tilenum, signed char shade, long cx1, long cy1, long cx2, long cy2, char dapalnum);

View File

@ -0,0 +1,211 @@
#ifdef USE_OPENGL
#ifdef RENDERTYPEWIN
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#if defined(__APPLE__)
# include <OpenGL/gl.h>
#else
# include <GL/gl.h>
#endif
// get this header from http://oss.sgi.com/projects/ogl-sample/registry/
// if you are missing it
//#include <GL/glext.h>
#if defined(__APPLE__)
# include <OpenGL/glext.h>
#else
# include "glext.h"
#endif
#ifndef GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
#error You should get an updated copy of glext.h from http://oss.sgi.com/projects/ogl-sample/registry/
#endif
#ifdef DYNAMIC_OPENGL
#ifndef APIENTRY
# define APIENTRY
#endif
extern void (APIENTRY * bglClearColor)( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
extern void (APIENTRY * bglClear)( GLbitfield mask );
extern void (APIENTRY * bglColorMask)( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha );
extern void (APIENTRY * bglAlphaFunc)( GLenum func, GLclampf ref );
extern void (APIENTRY * bglBlendFunc)( GLenum sfactor, GLenum dfactor );
extern void (APIENTRY * bglCullFace)( GLenum mode );
extern void (APIENTRY * bglFrontFace)( GLenum mode );
extern void (APIENTRY * bglPolygonOffset)( GLfloat factor, GLfloat units );
extern void (APIENTRY * bglPolygonMode)( GLenum face, GLenum mode );
extern void (APIENTRY * bglEnable)( GLenum cap );
extern void (APIENTRY * bglDisable)( GLenum cap );
extern void (APIENTRY * bglGetFloatv)( GLenum pname, GLfloat *params );
extern void (APIENTRY * bglGetIntegerv)( GLenum pname, GLint *params );
extern void (APIENTRY * bglPushAttrib)( GLbitfield mask );
extern void (APIENTRY * bglPopAttrib)( void );
extern GLenum (APIENTRY * bglGetError)( void );
extern const GLubyte* (APIENTRY * bglGetString)( GLenum name );
extern void (APIENTRY * bglHint)( GLenum target, GLenum mode );
// Depth
extern void (APIENTRY * bglDepthFunc)( GLenum func );
extern void (APIENTRY * bglDepthMask)( GLboolean flag );
extern void (APIENTRY * bglDepthRange)( GLclampd near_val, GLclampd far_val );
// Matrix
extern void (APIENTRY * bglMatrixMode)( GLenum mode );
extern void (APIENTRY * bglOrtho)( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val );
extern void (APIENTRY * bglFrustum)( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val );
extern void (APIENTRY * bglViewport)( GLint x, GLint y, GLsizei width, GLsizei height );
extern void (APIENTRY * bglPushMatrix)( void );
extern void (APIENTRY * bglPopMatrix)( void );
extern void (APIENTRY * bglLoadIdentity)( void );
extern void (APIENTRY * bglLoadMatrixf)( const GLfloat *m );
// Drawing
extern void (APIENTRY * bglBegin)( GLenum mode );
extern void (APIENTRY * bglEnd)( void );
extern void (APIENTRY * bglVertex2f)( GLfloat x, GLfloat y );
extern void (APIENTRY * bglVertex2i)( GLint x, GLint y );
extern void (APIENTRY * bglVertex3d)( GLdouble x, GLdouble y, GLdouble z );
extern void (APIENTRY * bglVertex3fv)( const GLfloat *v );
extern void (APIENTRY * bglColor4f)( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
extern void (APIENTRY * bglColor4ub)( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha );
extern void (APIENTRY * bglTexCoord2d)( GLdouble s, GLdouble t );
extern void (APIENTRY * bglTexCoord2f)( GLfloat s, GLfloat t );
// Lighting
extern void (APIENTRY * bglShadeModel)( GLenum mode );
// Raster funcs
extern void (APIENTRY * bglReadPixels)( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels );
// Texture mapping
extern void (APIENTRY * bglTexEnvf)( GLenum target, GLenum pname, GLfloat param );
extern void (APIENTRY * bglGenTextures)( GLsizei n, GLuint *textures ); // 1.1
extern void (APIENTRY * bglDeleteTextures)( GLsizei n, const GLuint *textures); // 1.1
extern void (APIENTRY * bglBindTexture)( GLenum target, GLuint texture ); // 1.1
extern void (APIENTRY * bglTexImage2D)( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels );
extern void (APIENTRY * bglTexSubImage2D)( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ); // 1.1
extern void (APIENTRY * bglTexParameterf)( GLenum target, GLenum pname, GLfloat param );
extern void (APIENTRY * bglTexParameteri)( GLenum target, GLenum pname, GLint param );
extern void (APIENTRY * bglGetTexLevelParameteriv)( GLenum target, GLint level, GLenum pname, GLint *params );
extern void (APIENTRY * bglCompressedTexImage2DARB)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
extern void (APIENTRY * bglGetCompressedTexImageARB)(GLenum, GLint, GLvoid *);
// Fog
extern void (APIENTRY * bglFogf)( GLenum pname, GLfloat param );
extern void (APIENTRY * bglFogi)( GLenum pname, GLint param );
extern void (APIENTRY * bglFogfv)( GLenum pname, const GLfloat *params );
#ifdef RENDERTYPEWIN
// Windows
extern HGLRC (WINAPI * bwglCreateContext)(HDC);
extern BOOL (WINAPI * bwglDeleteContext)(HGLRC);
extern PROC (WINAPI * bwglGetProcAddress)(LPCSTR);
extern BOOL (WINAPI * bwglMakeCurrent)(HDC,HGLRC);
extern BOOL (WINAPI * bwglSwapBuffers)(HDC);
extern int (WINAPI * bwglChoosePixelFormat)(HDC,CONST PIXELFORMATDESCRIPTOR*);
extern int (WINAPI * bwglDescribePixelFormat)(HDC,int,UINT,LPPIXELFORMATDESCRIPTOR);
extern int (WINAPI * bwglGetPixelFormat)(HDC);
extern BOOL (WINAPI * bwglSetPixelFormat)(HDC,int,const PIXELFORMATDESCRIPTOR*);
#endif
#else // DYNAMIC_OPENGL
#define bglClearColor glClearColor
#define bglClear glClear
#define bglColorMask glColorMask
#define bglAlphaFunc glAlphaFunc
#define bglBlendFunc glBlendFunc
#define bglCullFace glCullFace
#define bglFrontFace glFrontFace
#define bglPolygonOffset glPolygonOffset
#define bglPolygonMode glPolygonMode
#define bglEnable glEnable
#define bglDisable glDisable
#define bglGetFloatv glGetFloatv
#define bglGetIntegerv glGetIntegerv
#define bglPushAttrib glPushAttrib
#define bglPopAttrib glPopAttrib
#define bglGetError glGetError
#define bglGetString glGetString
#define bglHint glHint
// Depth
#define bglDepthFunc glDepthFunc
#define bglDepthMask glDepthMask
#define bglDepthRange glDepthRange
// Matrix
#define bglMatrixMode glMatrixMode
#define bglOrtho glOrtho
#define bglFrustum glFrustum
#define bglViewport glViewport
#define bglPushMatrix glPushMatrix
#define bglPopMatrix glPopMatrix
#define bglLoadIdentity glLoadIdentity
#define bglLoadMatrixf glLoadMatrixf
// Drawing
#define bglBegin glBegin
#define bglEnd glEnd
#define bglVertex2f glVertex2f
#define bglVertex2i glVertex2i
#define bglVertex3d glVertex3d
#define bglVertex3fv glVertex3fv
#define bglColor4f glColor4f
#define bglColor4ub glColor4ub
#define bglTexCoord2d glTexCoord2d
#define bglTexCoord2f glTexCoord2f
// Lighting
#define bglShadeModel glShadeModel
// Raster funcs
#define bglReadPixels glReadPixels
// Texture mapping
#define bglTexEnvf glTexEnvf
#define bglGenTextures glGenTextures
#define bglDeleteTextures glDeleteTextures
#define bglBindTexture glBindTexture
#define bglTexImage2D glTexImage2D
#define bglTexSubImage2D glTexSubImage2D
#define bglTexParameterf glTexParameterf
#define bglTexParameteri glTexParameteri
#define bglGetTexLevelParameteriv glGetTexLevelParameteriv
#define bglCompressedTexImage2DARB glCompressedTexImage2DARB
#define bglGetCompressedTexImageARB glGetCompressedTexImageARB
// Fog
#define bglFogf glFogf
#define bglFogi glFogi
#define bglFogfv glFogfv
#ifdef RENDERTYPEWIN
#define bwglCreateContext wglCreateContext
#define bwglDeleteContext wglDeleteContext
#define bwglGetProcAddress wglGetProcAddress
#define bwglMakeCurrent wglMakeCurrent
#define bwglSwapBuffers SwapBuffers
#define bwglChoosePixelFormat ChoosePixelFormat
#define bwglDescribePixelFormat DescribePixelFormat
#define bwglGetPixelFormat GetPixelFormat
#define bwglSetPixelFormat SetPixelFormat
#endif
#endif
#endif //USE_OPENGL
extern char *gldriver;
int loadgldriver(const char *driver);
int loadglextensions(void);
int unloadgldriver(void);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
#ifndef __gtkbits_h__
#define __gtkbits_h__
extern void gtkbuild_init(int *argc, char ***argv);
extern void gtkbuild_exit(int r);
extern int gtkbuild_msgbox(char *name, char *msg);
extern int gtkbuild_ynbox(char *name, char *msg);
extern void gtkbuild_create_startwin(void);
extern void gtkbuild_settitle_startwin(const char *title);
extern void gtkbuild_puts_startwin(const char *str);
extern void gtkbuild_close_startwin(void);
extern void gtkbuild_update_startwin(void);
extern void *gtkbuild_get_app_icon(void);
#endif

View File

@ -0,0 +1,21 @@
//High-level (easy) picture loading function:
extern void kpzload (const char *, long *, long *, long *, long *);
//Low-level PNG/JPG functions:
extern void kpgetdim (const char *, long, long *, long *);
extern long kprender (const char *, long, long, long, long, long, long, long);
//ZIP functions:
extern long kzaddstack (const char *);
extern void kzuninit ();
extern long kzopen (const char *);
extern long kzread (void *, long);
extern long kzfilelength ();
extern long kzseek (long, long);
extern long kztell ();
extern long kzgetc ();
extern long kzeof ();
extern void kzclose ();
extern void kzfindfilestart (const char *); //pass wildcard string
extern long kzfindfile (char *); //you alloc buf, returns 1:found,0:~found

101
polymer/build/include/lzf.h Normal file
View File

@ -0,0 +1,101 @@
/*
* Copyright (c) 2000-2005 Marc Alexander Lehmann <schmorp@schmorp.de>
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
* CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
* ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU General Public License version 2 (the "GPL"), in which case the
* provisions of the GPL are applicable instead of the above. If you wish to
* allow the use of your version of this file only under the terms of the
* GPL and not to allow others to use your version of this file under the
* BSD license, indicate your decision by deleting the provisions above and
* replace them with the notice and other provisions required by the GPL. If
* you do not delete the provisions above, a recipient may use your version
* of this file under either the BSD or the GPL.
*/
#ifndef LZF_H
#define LZF_H
/***********************************************************************
**
** lzf -- an extremely fast/free compression/decompression-method
** http://liblzf.plan9.de/
**
** This algorithm is believed to be patent-free.
**
***********************************************************************/
#define LZF_VERSION 0x0105 /* 1.5 */
/*
* Compress in_len bytes stored at the memory block starting at
* in_data and write the result to out_data, up to a maximum length
* of out_len bytes.
*
* If the output buffer is not large enough or any error occurs
* return 0, otherwise return the number of bytes used (which might
* be considerably larger than in_len, so it makes sense to always
* use out_len == in_len - 1), to ensure _some_ compression, and store
* the data uncompressed otherwise.
*
* lzf_compress might use different algorithms on different systems and
* even diferent runs, thus might result in different compressed strings
* depending on the phase of the moon or similar factors. However, all
* these strings are architecture-independent and will result in the
* original data when decompressed using lzf_decompress.
*
* The buffers must not be overlapping.
*
* If the option LZF_STATE_ARG is enabled, an extra argument must be
* supplied which is not reflected in this header file. Refer to lzfP.h
* and lzf_c.c.
*
*/
unsigned int
lzf_compress (const void *const in_data, unsigned int in_len,
void *out_data, unsigned int out_len);
/*
* Decompress data compressed with some version of the lzf_compress
* function and stored at location in_data and length in_len. The result
* will be stored at out_data up to a maximum of out_len characters.
*
* If the output buffer is not large enough to hold the decompressed
* data, a 0 is returned and errno is set to E2BIG. Otherwise the number
* of decompressed bytes (i.e. the original length of the data) is
* returned.
*
* If an error in the compressed data is detected, a zero is returned and
* errno is set to EINVAL.
*
* This function is very fast, about as fast as a copying loop.
*/
unsigned int
lzf_decompress (const void *const in_data, unsigned int in_len,
void *out_data, unsigned int out_len);
#endif

View File

@ -0,0 +1,2 @@
long lzwcompress (unsigned char *ucompbuf, long ucompleng, unsigned char *compbuf);
long lzwuncompress (unsigned char *compbuf, long compleng, unsigned char *ucompbuf, long ucompleng);

View File

@ -0,0 +1,38 @@
/* MD4.H - header file for MD4C.C
Modified from original version published in RFC1320 by
Jonathon Fowler (jonof@edgenetwork.org)
*/
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD4 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD4 Message-Digest Algorithm" in all material
mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
*/
/* MD4 context. */
typedef struct {
unsigned long state[4]; /* state (ABCD) */
unsigned long count[2]; /* number of bits, modulo 2^64 (lsb first) */
unsigned char buffer[64]; /* input buffer */
} MD4_CTX;
void md4once(unsigned char *block, unsigned int len, unsigned char digest[16]);
void md4init(MD4_CTX *);
void md4block(MD4_CTX *, unsigned char *, unsigned int);
void md4finish(unsigned char [16], MD4_CTX *);

View File

@ -0,0 +1,29 @@
// mmulti.h
#ifndef __mmulti_h__
#define __mmulti_h__
#define MAXMULTIPLAYERS 16
extern long myconnectindex, numplayers;
extern long connecthead, connectpoint2[MAXMULTIPLAYERS];
extern char syncstate;
long initmultiplayersparms(long argc, char **argv);
long initmultiplayerscycle(void);
void initmultiplayers(long argc, char **argv, char damultioption, char dacomrateoption, char dapriority);
void setpackettimeout(long datimeoutcount, long daresendagaincount);
void uninitmultiplayers(void);
void sendlogon(void);
void sendlogoff(void);
long getoutputcirclesize(void);
void setsocket(short newsocket);
void sendpacket(long other, char *bufptr, long messleng);
long getpacket(long *other, char *bufptr);
void flushpackets(void);
void genericmultifunction(long other, char *bufptr, long messleng, long command);
long isvalidipaddress(char *st);
#endif // __mmulti_h__

View File

@ -0,0 +1,65 @@
#ifndef __MMULTIMSGS_H__
#define __MMULTIMSGS_H__
/*
* Ok, so this header file defines the message bytes and outlines the basic
* message descriptions for out-of-band messages that are common to all games
* that utilize my net code. Once a game determines that it is indeed talking
* to another peer of the same genus, the rest is up to the game itself to
* decide, but for basic stuff, the interfaces will be identical.
*
* Why am I not choosing to implement all this engine-side? Because all the
* games are different and about the only thing they are guaranteed to use in
* common that I can be certain of is the services my net code will provide.
* So, since I can't code anything in particular with every Build game in mind,
* I'm putting handling all the game-visible messages into the game's domain.
* The engine will still handle its own internal messages because the game
* never sees them. Ever.
*
* CMDs are messages sent by a peer to another, and RSPs are the replies.
*
* The master of the network game, regardless if the eventual game is talking
* with a peer-to-peer design or not, shall enumerate each peer as it joins
* and the master will always assign itself peer number 0. This simplifies
* things all-round because each peer that joins automatically knows that
* id 0 is its master and it already knows the master's address. Technically
* every other peer who joins may get a sequential number for its id so maybe
* even transmitting the peer unique ids is unnecessary and we'd be easier
* just sending a number of players, but the less craftiness at this point
* in time, the better.
*
* -- Jonathon
*/
#define MSGPROTOVER 0x00
// 0x00 20031209
#define MSG_CMD_GETGAMEINFO 0x10
// char MSG_CMD_GETGAMEINFO
// char MSGPROTOVER
#define MSG_RSP_BADPROTO 0x11
// char MSG_RSP_BADPROTO
#define MSG_RSP_NOGAME 0x12
// char MSG_RSP_NOGAME
// char[8] gamename
#define MSG_RSP_GAMEINFO 0x13
// char MSG_RSP_GAMEINFO
// char[8] gamename eg. DUKE3DSW/DUKE3D\x00\x00/DUKE3DAT
// ... other information particular to the game
#define MSG_CMD_JOINGAME 0x20
// char MSG_CMD_JOINGAME
#define MSG_RSP_GAMEINPROG 0x21
// char MSG_RSP_GAMEINPROG
#define MSG_RSP_JOINACCEPTED 0x22
// char MSG_RSP_JOINACCEPTED
// short uniqueid
// char numtofollow
// short[numtofollow] peeruid
// ... other information particular to the game
#define MSG_RSP_GAMEFULL 0x23
// char MSG_RSP_GAMEFULL
#endif

View File

@ -0,0 +1,49 @@
//Be careful when changing this file - it is parsed by Editart and Build.
#define SWITCH1ON 15
#define SLIME 34
#define BACKGROUND 37
#define KENPICTURE 48
#define BUILDDISK 49
#define SWITCH2ON 66
#define SWITCH2OFF 69
#define ALPHABET 73
#define NO 74
#define DEMOSIGN 75
#define COIN 76
#define COINSTACK 77
#define GIFTBOX 78
#define DIAMONDS 79
#define EVILALGRAVE 83
#define STATUSBAR 87
#define DAYSKY 89
#define WATERFOUNTAIN 90
#define USEWATERFOUNTAIN 91
#define NIGHTSKY 93
#define BULLET 98
#define BOMB 100
#define CANNON 101
#define GUNONBOTTOM 102
#define BOMBEMITTER 103
#define EXPLOSION 105
#define SPLASH 106
#define BROWNMONSTER 110
#define SKELETON 113
#define AL 114
#define EVILAL 115
#define PLAYER 120
#define SWITCH3OFF 146
#define SWITCH3ON 147
#define AIRPLANE 148
#define SPIRAL 149
#define COMPASS 150
#define FOOTPRINT 156
#define STATUSBARFILL8 160
#define STATUSBARFILL4 161
#define BOUNCYMAT 162
#define MIRROR 165
#define FLOORMIRROR 166
#define GRABBER 167
#define GRABCANNON 168
#define MISSILE 169
#define LAUNCHER 171
#define MIRRORLABEL 4000

View File

@ -0,0 +1,77 @@
// On-screen display (ie. console)
// for the Build Engine
// by Jonathon Fowler (jonof@edgenetwk.com)
#ifndef __osd_h__
#define __osd_h__
typedef struct {
int numparms;
const char *name;
const char **parms;
const char *raw;
} osdfuncparm_t;
#define OSDCMD_OK 0
#define OSDCMD_SHOWHELP 1
// initializes things
void OSD_Init(void);
// sets the file to echo output to
void OSD_SetLogFile(char *fn);
// sets the functions the OSD will call to interrogate the environment
void OSD_SetFunctions(
void (*drawchar)(int,int,char,int,int),
void (*drawstr)(int,int,char*,int,int,int),
void (*drawcursor)(int,int,int,int),
int (*colwidth)(int),
int (*rowheight)(int),
void (*clearbg)(int,int),
int (*gettime)(void),
void (*onshow)(int)
);
// sets the parameters for presenting the text
void OSD_SetParameters(
int promptshade, int promptpal,
int editshade, int editpal,
int textshade, int textpal
);
// sets the scancode for the key which activates the onscreen display
void OSD_CaptureKey(int sc);
// handles keyboard input when capturing input. returns 0 if key was handled
// or the scancode if it should be handled by the game.
int OSD_HandleKey(int sc, int press);
// handles the readjustment when screen resolution changes
void OSD_ResizeDisplay(int w,int h);
// shows or hides the onscreen display
void OSD_ShowDisplay(int onf);
// draw the osd to the screen
void OSD_Draw(void);
// just like printf
void OSD_Printf(const char *fmt, ...);
#define printOSD OSD_Printf
// executes buffered commands
void OSD_DispatchQueued(void);
// executes a string
int OSD_Dispatch(const char *cmd);
// registers a function
// name = name of the function
// help = a short help string
// func = the entry point to the function
int OSD_RegisterFunction(const char *name, const char *help, int (*func)(const osdfuncparm_t*));
#endif // __osd_h__

View File

@ -0,0 +1,7 @@
#ifndef __osxbits_h__
#define __osxbits_h__
int osx_msgbox(char *name, char *msg);
int osx_ynbox(char *name, char *msg);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,26 @@
typedef struct {
char *textbuf;
unsigned int textlength;
char *ltextptr; // pointer to start of the last token fetched (use this for line numbers)
char *textptr;
char *eof;
char *filename;
int linenum;
long *lineoffs;
} scriptfile;
char *scriptfile_gettoken(scriptfile *sf);
int scriptfile_getnumber(scriptfile *sf, int *num);
int scriptfile_getdouble(scriptfile *sf, double *num);
int scriptfile_getstring(scriptfile *sf, char **st);
int scriptfile_getsymbol(scriptfile *sf, int *num);
int scriptfile_getlinum(scriptfile *sf, char *ptr);
int scriptfile_getbraces(scriptfile *sf, char **braceend);
scriptfile *scriptfile_fromfile(char *fn);
scriptfile *scriptfile_fromstring(char *string);
void scriptfile_close(scriptfile *sf);
int scriptfile_getsymbolvalue(char *name, int *val);
int scriptfile_addsymbolvalue(char *name, int val);
void scriptfile_clearsymbols(void);

View File

@ -0,0 +1,21 @@
// SDL interface layer
// for the Build Engine
// by Jonathon Fowler (jonof@edgenetwk.com)
#ifndef __build_interface_layer__
#define __build_interface_layer__ SDL
#include "baselayer.h"
struct sdlappicon {
int width,height;
unsigned int *pixels;
unsigned char *mask;
};
#else
#if (__build_interface_layer__ != SDL)
#error "Already using the " __build_interface_layer__ ". Can't now use SDL."
#endif
#endif // __build_interface_layer__

View File

@ -0,0 +1,15 @@
typedef struct {
unsigned long samplerate; // sample rate of the sound
unsigned short channels; // number of channels
unsigned short bitspersample; // bits per sample
unsigned short format; // 0 = pcm
unsigned long soundlength; // bytes required for sound storage
} SoundInfo;
int ReadVOCInfo(int fh, SoundInfo *snd);
int ReadVOCData(int fh, char *data, int bufferlen);
int ReadWAVInfo(int fh, SoundInfo *snd);
int ReadWAVData(int fh, char *data, int bufferlen);

View File

@ -0,0 +1,159 @@
#ifdef USE_C_FUNCTION_PRAGMAS
long sqr(long a);
long scale(long a, long d, long c);
long mulscale(long a, long d, long c);
long mulscale1(long a, long d);
long mulscale2(long a, long d);
long mulscale3(long a, long d);
long mulscale4(long a, long d);
long mulscale5(long a, long d);
long mulscale6(long a, long d);
long mulscale7(long a, long d);
long mulscale8(long a, long d);
long mulscale9(long a, long d);
long mulscale10(long a, long d);
long mulscale11(long a, long d);
long mulscale12(long a, long d);
long mulscale13(long a, long d);
long mulscale14(long a, long d);
long mulscale15(long a, long d);
long mulscale16(long a, long d);
long mulscale17(long a, long d);
long mulscale18(long a, long d);
long mulscale19(long a, long d);
long mulscale20(long a, long d);
long mulscale21(long a, long d);
long mulscale22(long a, long d);
long mulscale23(long a, long d);
long mulscale24(long a, long d);
long mulscale25(long a, long d);
long mulscale26(long a, long d);
long mulscale27(long a, long d);
long mulscale28(long a, long d);
long mulscale29(long a, long d);
long mulscale30(long a, long d);
long mulscale31(long a, long d);
long mulscale32(long a, long d);
long dmulscale(long a, long d, long S, long D, long c);
long dmulscale1(long a, long d, long S, long D);
long dmulscale2(long a, long d, long S, long D);
long dmulscale3(long a, long d, long S, long D);
long dmulscale4(long a, long d, long S, long D);
long dmulscale5(long a, long d, long S, long D);
long dmulscale6(long a, long d, long S, long D);
long dmulscale7(long a, long d, long S, long D);
long dmulscale8(long a, long d, long S, long D);
long dmulscale9(long a, long d, long S, long D);
long dmulscale10(long a, long d, long S, long D);
long dmulscale11(long a, long d, long S, long D);
long dmulscale12(long a, long d, long S, long D);
long dmulscale13(long a, long d, long S, long D);
long dmulscale14(long a, long d, long S, long D);
long dmulscale15(long a, long d, long S, long D);
long dmulscale16(long a, long d, long S, long D);
long dmulscale17(long a, long d, long S, long D);
long dmulscale18(long a, long d, long S, long D);
long dmulscale19(long a, long d, long S, long D);
long dmulscale20(long a, long d, long S, long D);
long dmulscale21(long a, long d, long S, long D);
long dmulscale22(long a, long d, long S, long D);
long dmulscale23(long a, long d, long S, long D);
long dmulscale24(long a, long d, long S, long D);
long dmulscale25(long a, long d, long S, long D);
long dmulscale26(long a, long d, long S, long D);
long dmulscale27(long a, long d, long S, long D);
long dmulscale28(long a, long d, long S, long D);
long dmulscale29(long a, long d, long S, long D);
long dmulscale30(long a, long d, long S, long D);
long dmulscale31(long a, long d, long S, long D);
long dmulscale32(long a, long d, long S, long D);
long tmulscale1(long a, long d, long b, long c, long S, long D);
long tmulscale2(long a, long d, long b, long c, long S, long D);
long tmulscale3(long a, long d, long b, long c, long S, long D);
long tmulscale4(long a, long d, long b, long c, long S, long D);
long tmulscale5(long a, long d, long b, long c, long S, long D);
long tmulscale6(long a, long d, long b, long c, long S, long D);
long tmulscale7(long a, long d, long b, long c, long S, long D);
long tmulscale8(long a, long d, long b, long c, long S, long D);
long tmulscale9(long a, long d, long b, long c, long S, long D);
long tmulscale10(long a, long d, long b, long c, long S, long D);
long tmulscale11(long a, long d, long b, long c, long S, long D);
long tmulscale12(long a, long d, long b, long c, long S, long D);
long tmulscale13(long a, long d, long b, long c, long S, long D);
long tmulscale14(long a, long d, long b, long c, long S, long D);
long tmulscale15(long a, long d, long b, long c, long S, long D);
long tmulscale16(long a, long d, long b, long c, long S, long D);
long tmulscale17(long a, long d, long b, long c, long S, long D);
long tmulscale18(long a, long d, long b, long c, long S, long D);
long tmulscale19(long a, long d, long b, long c, long S, long D);
long tmulscale20(long a, long d, long b, long c, long S, long D);
long tmulscale21(long a, long d, long b, long c, long S, long D);
long tmulscale22(long a, long d, long b, long c, long S, long D);
long tmulscale23(long a, long d, long b, long c, long S, long D);
long tmulscale24(long a, long d, long b, long c, long S, long D);
long tmulscale25(long a, long d, long b, long c, long S, long D);
long tmulscale26(long a, long d, long b, long c, long S, long D);
long tmulscale27(long a, long d, long b, long c, long S, long D);
long tmulscale28(long a, long d, long b, long c, long S, long D);
long tmulscale29(long a, long d, long b, long c, long S, long D);
long tmulscale30(long a, long d, long b, long c, long S, long D);
long tmulscale31(long a, long d, long b, long c, long S, long D);
long tmulscale32(long a, long d, long b, long c, long S, long D);
long divscale(long a, long b, long c);
long divscale1(long a, long b);
long divscale2(long a, long b);
long divscale3(long a, long b);
long divscale4(long a, long b);
long divscale5(long a, long b);
long divscale6(long a, long b);
long divscale7(long a, long b);
long divscale8(long a, long b);
long divscale9(long a, long b);
long divscale10(long a, long b);
long divscale11(long a, long b);
long divscale12(long a, long b);
long divscale13(long a, long b);
long divscale14(long a, long b);
long divscale15(long a, long b);
long divscale16(long a, long b);
long divscale17(long a, long b);
long divscale18(long a, long b);
long divscale19(long a, long b);
long divscale20(long a, long b);
long divscale21(long a, long b);
long divscale22(long a, long b);
long divscale23(long a, long b);
long divscale24(long a, long b);
long divscale25(long a, long b);
long divscale26(long a, long b);
long divscale27(long a, long b);
long divscale28(long a, long b);
long divscale29(long a, long b);
long divscale30(long a, long b);
long divscale31(long a, long b);
long divscale32(long d, long b);
long readpixel(void *D);
void drawpixel(void *D, long a);
void drawpixels(void *D, long a);
void drawpixelses(void *D, long a);
void clearbuf(void* D, long c, long a);
void copybuf(void *S, void *D, long c);
long mul3(long a);
long mul5(long a);
long mul9(long a);
long divmod(long a, long b);
long moddiv(long a, long b);
long klabs(long a);
long ksgn(long b);
long umin(long a, long b);
long umax(long a, long b);
long kmin(long a, long b);
long kmax(long a, long b);
void swapchar(void *a, void *b);
void swapshort(void *a, void *b);
void swaplong(void *a, void *b);
void swapbuf4(void *a, void *b, long c);
void swap64bit(void *a, void *b);
void swapchar2(void *a, void *b, long S);
#endif

View File

@ -0,0 +1,54 @@
// Windows DIB/DirectDraw interface layer
// for the Build Engine
// by Jonathon Fowler (jonof@edgenetwk.com)
#ifndef __build_interface_layer__
#define __build_interface_layer__ WIN
extern int backgroundidle; // set to 1 to tell winlayer to go to idle priority when inactive
extern unsigned maxrefreshfreq;
extern int glusecds;
long win_gethwnd(void);
long win_gethinstance(void);
// resource ids
#define WIN_STARTWIN 1000
#define WIN_STARTWIN_ITEMBITMAP 100 // banner bitmap
#define WIN_STARTWIN_ITEMTEXT 101 // text header
#define WIN_STARTWIN_ITEMLIST 102 // output list box
#define WIN_STARTWINBMP 200
// *hwnd - receives the window handle to the startup dialog box
// saferect[] - receives the safe area to draw controls over (l,t,w,h)
// onclose - called before the startup window closes
// returns 0 if successful, 1 if the window isn't open
int win_getstartupwin(long *hwnd, long saferect[4], void (*onclose)(void));
int win_getstartupcommand(void);
void win_allowtaskswitching(int onf);
int win_checkinstance(void);
/*
#ifdef KENBUILD
#define DISCLAIMER "IMPORTANT:\n" \
"\tThis is a source port by Jonathon Fowler (jonof@edgenetwk.com) of the Build Engine, " \
"editor and test game by Ken Silverman to the Windows and Linux operating systems. It is " \
"distributed under the terms listed in BUILDLIC.TXT included with this package."
#endif
#ifdef DUKE3D
#define DISCLAIMER "IMPORTANT:\n" \
"\tThis port of Duke Nukem 3D was done by Jonathon Fowler (jonof@edgenetwk.com) and is not " \
"endorsed or supported by 3D Realms or Apogee. They will not provide support for it. Visit " \
"http://jonof.edgenetwk.com/buildport/duke3d/ for details."
#endif
*/
#include "baselayer.h"
#else
#if (__build_interface_layer__ != WIN)
#error "Already using the " __build_interface_layer__ ". Can't now use Windows."
#endif
#endif // __build_interface_layer__

View File

@ -0,0 +1 @@
make -f Makefile %1 %2 %3 %4 %5

View File

@ -0,0 +1 @@
nmake /f Makefile.msvc %1 %2 %3 %4 %5

1
polymer/build/makew.bat Normal file
View File

@ -0,0 +1 @@
wmake -f Makefile.watcom %1 %2 %3 %4 %5

View File

View File

View File

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
const char _engine_cflags[] = "";
const char _engine_libs[] = "";
const char _engine_uname[] = "Darwin megumi.fnord 7.9.0 Darwin Kernel Version 7.9.0: Wed Mar 30 20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE_PPC Power Macintosh powerpc";
const char _engine_compiler[] = "gcc 3.3 ppc-darwin";
const char _engine_date[] = __DATE__ " " __TIME__;

View File

@ -0,0 +1,10 @@
#!/bin/sh
UNAME=`uname -a`
CC="gcc"
CCVERSION=`$CC -dumpversion`
CCMACHINE=`$CC -dumpmachine`
echo "const char _engine_cflags[] = \"$OTHER_CFLAGS\";" > engineinfo.c
echo "const char _engine_libs[] = \"$LIBS\";" >> engineinfo.c
echo "const char _engine_uname[] = \"$UNAME\";" >> engineinfo.c
echo "const char _engine_compiler[] = \"$CC $CCVERSION $CCMACHINE\";" >> engineinfo.c
echo "const char _engine_date[] = __DATE__ \" \" __TIME__;" >> engineinfo.c

View File

@ -0,0 +1,11 @@
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
Feel free to customize this file to suit your needs
*/
#import <Cocoa/Cocoa.h>
@interface SDLMain : NSObject
@end

View File

@ -0,0 +1,179 @@
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
Feel free to customize this file to suit your needs
*/
#import <SDL/SDL.h>
#import "build.osxmain.h"
#import <sys/param.h> /* for MAXPATHLEN */
#import <unistd.h>
static int gArgc;
static char **gArgv;
static BOOL gFinderLaunch;
/* A helper category for NSString */
@interface NSString (ReplaceSubString)
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;
@end
@interface SDLApplication : NSApplication
@end
@implementation SDLApplication
/* Invoked from the Quit menu item */
- (void)terminate:(id)sender
{
/* Post a SDL_QUIT event */
SDL_Event event;
event.type = SDL_QUIT;
SDL_PushEvent(&event);
}
@end
/* The main class of the application, the application's delegate */
@implementation SDLMain
/* Set the working directory to the .app's parent directory */
- (void) setupWorkingDirectory:(BOOL)shouldChdir
{
char parentdir[MAXPATHLEN];
char *c;
strncpy ( parentdir, gArgv[0], sizeof(parentdir) );
c = (char*) parentdir;
while (*c != '\0') /* go to end */
c++;
while (*c != '/') /* back up to parent */
c--;
*c++ = '\0'; /* cut off last part (binary name) */
if (shouldChdir)
{
assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */
assert ( chdir ("../../../") == 0 ); /* chdir to the .app's parent */
}
}
/* Fix menu to contain the real app name instead of "SDL App" */
- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName
{
NSRange aRange;
NSEnumerator *enumerator;
NSMenuItem *menuItem;
aRange = [[aMenu title] rangeOfString:@"SDL App"];
if (aRange.length != 0)
[aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]];
enumerator = [[aMenu itemArray] objectEnumerator];
while ((menuItem = [enumerator nextObject]))
{
aRange = [[menuItem title] rangeOfString:@"SDL App"];
if (aRange.length != 0)
[menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]];
if ([menuItem hasSubmenu])
[self fixMenu:[menuItem submenu] withAppName:appName];
}
[ aMenu sizeToFit ];
}
/* Called when the internal event loop has just started running */
- (void) applicationDidFinishLaunching: (NSNotification *) note
{
int status;
/* Set the working directory to the .app's parent directory */
[self setupWorkingDirectory:gFinderLaunch];
/* Set the main menu to contain the real app name instead of "SDL App" */
//[self fixMenu:[NSApp mainMenu] withAppName:[[NSProcessInfo processInfo] processName]];
[self fixMenu:[NSApp mainMenu] withAppName:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"]];
/* Hand off to main application code */
status = SDL_main (gArgc, gArgv);
/* We're done, thank you for playing */
exit(status);
}
@end
@implementation NSString (ReplaceSubString)
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
{
unsigned int bufferSize;
unsigned int selfLen = [self length];
unsigned int aStringLen = [aString length];
unichar *buffer;
NSRange localRange;
NSString *result;
bufferSize = selfLen + aStringLen - aRange.length;
buffer = NSAllocateMemoryPages(bufferSize*sizeof(unichar));
/* Get first part into buffer */
localRange.location = 0;
localRange.length = aRange.location;
[self getCharacters:buffer range:localRange];
/* Get middle part into buffer */
localRange.location = 0;
localRange.length = aStringLen;
[aString getCharacters:(buffer+aRange.location) range:localRange];
/* Get last part into buffer */
localRange.location = aRange.location + aRange.length;
localRange.length = selfLen - localRange.location;
[self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];
/* Build output string */
result = [NSString stringWithCharacters:buffer length:bufferSize];
NSDeallocateMemoryPages(buffer, bufferSize);
return result;
}
@end
#ifdef main
# undef main
#endif
/* Main entry point to executable - should *not* be SDL_main! */
int main (int argc, char **argv)
{
/* Copy the arguments into a global variable */
int i;
/* This is passed if we are launched by double-clicking */
if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
gArgc = 1;
gFinderLaunch = YES;
} else {
gArgc = argc;
gFinderLaunch = NO;
}
gArgv = (char**) malloc (sizeof(*gArgv) * (gArgc+1));
assert (gArgv != NULL);
for (i = 0; i < gArgc; i++)
gArgv[i] = argv[i];
gArgv[i] = NULL;
[SDLApplication poseAsClass:[NSApplication class]];
NSApplicationMain (argc, argv);
return 0;
}

View File

@ -0,0 +1,24 @@
<?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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>build</string>
<key>CFBundleIdentifier</key>
<string>au.id.jonof.build</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSMainNibFile</key>
<string>osxmain</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

View File

@ -0,0 +1,24 @@
<?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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>game</string>
<key>CFBundleIdentifier</key>
<string>au.id.jonof.kenbuild</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSMainNibFile</key>
<string>osxmain</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

View File

@ -0,0 +1,11 @@
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
Feel free to customize this file to suit your needs
*/
#import <Cocoa/Cocoa.h>
@interface SDLMain : NSObject
@end

View File

@ -0,0 +1,179 @@
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
Feel free to customize this file to suit your needs
*/
#import <SDL/SDL.h>
#import "game.osxmain.h"
#import <sys/param.h> /* for MAXPATHLEN */
#import <unistd.h>
static int gArgc;
static char **gArgv;
static BOOL gFinderLaunch;
/* A helper category for NSString */
@interface NSString (ReplaceSubString)
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;
@end
@interface SDLApplication : NSApplication
@end
@implementation SDLApplication
/* Invoked from the Quit menu item */
- (void)terminate:(id)sender
{
/* Post a SDL_QUIT event */
SDL_Event event;
event.type = SDL_QUIT;
SDL_PushEvent(&event);
}
@end
/* The main class of the application, the application's delegate */
@implementation SDLMain
/* Set the working directory to the .app's parent directory */
- (void) setupWorkingDirectory:(BOOL)shouldChdir
{
char parentdir[MAXPATHLEN];
char *c;
strncpy ( parentdir, gArgv[0], sizeof(parentdir) );
c = (char*) parentdir;
while (*c != '\0') /* go to end */
c++;
while (*c != '/') /* back up to parent */
c--;
*c++ = '\0'; /* cut off last part (binary name) */
if (shouldChdir)
{
assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */
assert ( chdir ("../../../") == 0 ); /* chdir to the .app's parent */
}
}
/* Fix menu to contain the real app name instead of "SDL App" */
- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName
{
NSRange aRange;
NSEnumerator *enumerator;
NSMenuItem *menuItem;
aRange = [[aMenu title] rangeOfString:@"SDL App"];
if (aRange.length != 0)
[aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]];
enumerator = [[aMenu itemArray] objectEnumerator];
while ((menuItem = [enumerator nextObject]))
{
aRange = [[menuItem title] rangeOfString:@"SDL App"];
if (aRange.length != 0)
[menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]];
if ([menuItem hasSubmenu])
[self fixMenu:[menuItem submenu] withAppName:appName];
}
[ aMenu sizeToFit ];
}
/* Called when the internal event loop has just started running */
- (void) applicationDidFinishLaunching: (NSNotification *) note
{
int status;
/* Set the working directory to the .app's parent directory */
[self setupWorkingDirectory:gFinderLaunch];
/* Set the main menu to contain the real app name instead of "SDL App" */
//[self fixMenu:[NSApp mainMenu] withAppName:[[NSProcessInfo processInfo] processName]];
[self fixMenu:[NSApp mainMenu] withAppName:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"]];
/* Hand off to main application code */
status = SDL_main (gArgc, gArgv);
/* We're done, thank you for playing */
exit(status);
}
@end
@implementation NSString (ReplaceSubString)
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
{
unsigned int bufferSize;
unsigned int selfLen = [self length];
unsigned int aStringLen = [aString length];
unichar *buffer;
NSRange localRange;
NSString *result;
bufferSize = selfLen + aStringLen - aRange.length;
buffer = NSAllocateMemoryPages(bufferSize*sizeof(unichar));
/* Get first part into buffer */
localRange.location = 0;
localRange.length = aRange.location;
[self getCharacters:buffer range:localRange];
/* Get middle part into buffer */
localRange.location = 0;
localRange.length = aStringLen;
[aString getCharacters:(buffer+aRange.location) range:localRange];
/* Get last part into buffer */
localRange.location = aRange.location + aRange.length;
localRange.length = selfLen - localRange.location;
[self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];
/* Build output string */
result = [NSString stringWithCharacters:buffer length:bufferSize];
NSDeallocateMemoryPages(buffer, bufferSize);
return result;
}
@end
#ifdef main
# undef main
#endif
/* Main entry point to executable - should *not* be SDL_main! */
int main (int argc, char **argv)
{
/* Copy the arguments into a global variable */
int i;
/* This is passed if we are launched by double-clicking */
if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
gArgc = 1;
gFinderLaunch = YES;
} else {
gArgc = argc;
gFinderLaunch = NO;
}
gArgv = (char**) malloc (sizeof(*gArgv) * (gArgc+1));
assert (gArgv != NULL);
for (i = 0; i < gArgc; i++)
gArgv[i] = argv[i];
gArgv[i] = NULL;
[SDLApplication poseAsClass:[NSApplication class]];
NSApplicationMain (argc, argv);
return 0;
}

View File

@ -0,0 +1,825 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 39;
objects = {
AB2B5CB408E698F600899067 = {
fileType = archive.ar;
isa = PBXReferenceProxy;
path = libenginez.a;
refType = 3;
remoteRef = AB2B5CB808E6992B00899067;
sourceTree = BUILT_PRODUCTS_DIR;
};
AB2B5CB808E6992B00899067 = {
containerPortal = AB3AFA5F08DEE45000C0AA42;
isa = PBXContainerItemProxy;
proxyType = 2;
remoteGlobalIDString = AB2B5C9708E6979600899067;
remoteInfo = enginez;
};
AB2B5D3708E69B7D00899067 = {
containerPortal = AB3AF9E808DEE39200C0AA42;
isa = PBXContainerItemProxy;
proxyType = 1;
remoteGlobalIDString = AB3AFEC008DF04E300C0AA42;
remoteInfo = editor;
};
AB2B5D3808E69B7D00899067 = {
isa = PBXTargetDependency;
target = AB3AFEC008DF04E300C0AA42;
targetProxy = AB2B5D3708E69B7D00899067;
};
AB3A002208DF064900C0AA42 = {
fileRef = AB3AFABF08DF035400C0AA42;
isa = PBXBuildFile;
settings = {
};
};
AB3A002408DF064900C0AA42 = {
fileRef = AB3AFA6F08DEE50200C0AA42;
isa = PBXBuildFile;
settings = {
};
};
AB3A002508DF064900C0AA42 = {
fileRef = AB3AFA7308DEE53C00C0AA42;
isa = PBXBuildFile;
settings = {
};
};
AB3A002608DF066200C0AA42 = {
isa = PBXFileReference;
lastKnownFileType = archive.ar;
name = libeditor.a;
path = /Users/jonof/ports/build/osx/engine/build/libeditor.a;
refType = 0;
sourceTree = "<absolute>";
};
AB3A002708DF066200C0AA42 = {
fileRef = AB3A002608DF066200C0AA42;
isa = PBXBuildFile;
settings = {
};
};
AB3AF9E408DEE39200C0AA42 = {
children = (
AB3AFA5F08DEE45000C0AA42,
ABBC7AA3099344E40064C16C,
AB3AF9EE08DEE3A100C0AA42,
AB3AF9EC08DEE39A00C0AA42,
AB3AFA7908DEFECF00C0AA42,
AB3AF9F908DEE3EE00C0AA42,
);
isa = PBXGroup;
refType = 4;
sourceTree = "<group>";
};
AB3AF9E608DEE39200C0AA42 = {
buildSettings = {
COPY_PHASE_STRIP = NO;
GCC_OPTIMIZATION_LEVEL = 0;
};
isa = PBXBuildStyle;
name = Development;
};
AB3AF9E708DEE39200C0AA42 = {
buildSettings = {
COPY_PHASE_STRIP = YES;
DEPLOYMENT_POSTPROCESSING = YES;
GCC_OPTIMIZATION_LEVEL = 2;
};
isa = PBXBuildStyle;
name = Deployment;
};
AB3AF9E808DEE39200C0AA42 = {
buildSettings = {
};
buildStyles = (
AB3AF9E608DEE39200C0AA42,
AB3AF9E708DEE39200C0AA42,
);
hasScannedForEncodings = 0;
isa = PBXProject;
mainGroup = AB3AF9E408DEE39200C0AA42;
productRefGroup = AB3AF9F908DEE3EE00C0AA42;
projectDirPath = "";
projectReferences = (
{
ProductGroup = ABBC7AA5099344E60064C16C;
ProjectRef = ABBC7AA3099344E40064C16C;
},
{
ProductGroup = AB3AFA6208DEE45200C0AA42;
ProjectRef = AB3AFA5F08DEE45000C0AA42;
},
);
targets = (
AB3AFBF108DF03C900C0AA42,
AB3AF9F708DEE3EE00C0AA42,
AB3AFEC008DF04E300C0AA42,
);
};
AB3AF9EC08DEE39A00C0AA42 = {
children = (
AB3AF9ED08DEE39E00C0AA42,
AB3AFA7708DEFEC100C0AA42,
AB3AF9FB08DEE3EE00C0AA42,
);
isa = PBXGroup;
name = Game;
refType = 4;
sourceTree = "<group>";
};
AB3AF9ED08DEE39E00C0AA42 = {
children = (
AB3AFA6D08DEE4D700C0AA42,
AB3AF9F108DEE3DA00C0AA42,
AB3AF9F208DEE3DA00C0AA42,
AB3AF9F308DEE3DA00C0AA42,
ABBC7A9A099344CF0064C16C,
);
isa = PBXGroup;
name = Sources;
refType = 4;
sourceTree = "<group>";
};
AB3AF9EE08DEE3A100C0AA42 = {
children = (
AB3AF9EF08DEE3AB00C0AA42,
AB3AFEC308DF04E300C0AA42,
);
isa = PBXGroup;
name = Editor;
refType = 4;
sourceTree = "<group>";
};
AB3AF9EF08DEE3AB00C0AA42 = {
children = (
AB3AFECC08DF059E00C0AA42,
AB3AF9F008DEE3C100C0AA42,
);
isa = PBXGroup;
name = Sources;
refType = 4;
sourceTree = "<group>";
};
AB3AF9F008DEE3C100C0AA42 = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.c;
name = bstub.c;
path = ../../src/bstub.c;
refType = 2;
sourceTree = SOURCE_ROOT;
};
AB3AF9F108DEE3DA00C0AA42 = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.c;
name = config.c;
path = ../../src/config.c;
refType = 2;
sourceTree = SOURCE_ROOT;
};
AB3AF9F208DEE3DA00C0AA42 = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.c;
name = game.c;
path = ../../src/game.c;
refType = 2;
sourceTree = SOURCE_ROOT;
};
AB3AF9F308DEE3DA00C0AA42 = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.c;
name = sound.c;
path = ../../src/sound.c;
refType = 2;
sourceTree = SOURCE_ROOT;
};
AB3AF9F408DEE3EE00C0AA42 = {
buildActionMask = 2147483647;
files = (
AB3AFA7808DEFEC200C0AA42,
);
isa = PBXResourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
AB3AF9F508DEE3EE00C0AA42 = {
buildActionMask = 2147483647;
files = (
AB3AFA5C08DEE43500C0AA42,
AB3AFA5D08DEE43500C0AA42,
AB3AFA6E08DEE4D700C0AA42,
ABBC7A9B099344CF0064C16C,
);
isa = PBXSourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
AB3AF9F608DEE3EE00C0AA42 = {
buildActionMask = 2147483647;
files = (
ABBC7B6409934A410064C16C,
AB3AFAC008DF035400C0AA42,
AB3AFB5708DF037500C0AA42,
AB3AFABE08DF030B00C0AA42,
AB3AFA7008DEE50200C0AA42,
AB3AFA7408DEE53C00C0AA42,
ABBC7B6609934A5A0064C16C,
);
isa = PBXFrameworksBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
AB3AF9F708DEE3EE00C0AA42 = {
buildPhases = (
AB3AF9F408DEE3EE00C0AA42,
AB3AF9F508DEE3EE00C0AA42,
AB3AF9F608DEE3EE00C0AA42,
ABBC7B40099347230064C16C,
);
buildRules = (
);
buildSettings = {
FRAMEWORK_SEARCH_PATHS = /Users/jonof/ports/jfaud/osx/build;
GCC_CHAR_IS_UNSIGNED_CHAR = YES;
GCC_ENABLE_CPP_EXCEPTIONS = NO;
GCC_ENABLE_CPP_RTTI = NO;
GCC_PREPROCESSOR_DEFINITIONS = "SUPERBUILD POLYMOST USE_OPENGL NOASM RENDERTYPESDL=1";
HEADER_SEARCH_PATHS = "/Developer/SDKs/fmodapi3741mac/api/inc ../../include";
INFOPLIST_FILE = "game-Info.plist";
INSTALL_PATH = "$(USER_APPS_DIR)";
LIBRARY_SEARCH_PATHS = "/Developer/SDKs/fmodapi3741mac/api/lib ../engine/build";
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
OTHER_REZFLAGS = "";
PRODUCT_NAME = game;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = "-Wno-four-char-constants -Wno-unknown-pragmas";
};
dependencies = (
AB3AFAB608DF00A400C0AA42,
);
isa = PBXNativeTarget;
name = game;
productName = game;
productReference = AB3AF9F808DEE3EE00C0AA42;
productSettingsXML = "<?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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>game</string>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.game</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
";
productType = "com.apple.product-type.application";
};
AB3AF9F808DEE3EE00C0AA42 = {
explicitFileType = wrapper.application;
includeInIndex = 0;
isa = PBXFileReference;
path = game.app;
refType = 3;
sourceTree = BUILT_PRODUCTS_DIR;
};
AB3AF9F908DEE3EE00C0AA42 = {
children = (
AB3AF9F808DEE3EE00C0AA42,
AB3AFEC108DF04E300C0AA42,
);
isa = PBXGroup;
name = Products;
refType = 4;
sourceTree = "<group>";
};
AB3AF9FB08DEE3EE00C0AA42 = {
isa = PBXFileReference;
lastKnownFileType = text.xml;
path = "game-Info.plist";
refType = 2;
sourceTree = SOURCE_ROOT;
};
AB3AFA5C08DEE43500C0AA42 = {
fileRef = AB3AF9F108DEE3DA00C0AA42;
isa = PBXBuildFile;
settings = {
};
};
AB3AFA5D08DEE43500C0AA42 = {
fileRef = AB3AF9F208DEE3DA00C0AA42;
isa = PBXBuildFile;
settings = {
};
};
AB3AFA5F08DEE45000C0AA42 = {
isa = PBXFileReference;
lastKnownFileType = "wrapper.pb-project";
name = engine.xcode;
path = ../engine/engine.xcode;
refType = 2;
sourceTree = SOURCE_ROOT;
};
AB3AFA6208DEE45200C0AA42 = {
children = (
AB3AFA6308DEE45200C0AA42,
AB3AFA6408DEE45200C0AA42,
AB2B5CB408E698F600899067,
);
isa = PBXGroup;
name = Products;
refType = 4;
sourceTree = "<group>";
};
AB3AFA6308DEE45200C0AA42 = {
fileType = archive.ar;
isa = PBXReferenceProxy;
path = libengine.a;
refType = 3;
remoteRef = AB3AFA6708DEE46200C0AA42;
sourceTree = BUILT_PRODUCTS_DIR;
};
AB3AFA6408DEE45200C0AA42 = {
fileType = archive.ar;
isa = PBXReferenceProxy;
path = libeditor.a;
refType = 3;
remoteRef = AB3AFA6808DEE46200C0AA42;
sourceTree = BUILT_PRODUCTS_DIR;
};
AB3AFA6708DEE46200C0AA42 = {
containerPortal = AB3AFA5F08DEE45000C0AA42;
isa = PBXContainerItemProxy;
proxyType = 2;
remoteGlobalIDString = AB3AF5F508DEDABE00C0AA42;
remoteInfo = engine;
};
AB3AFA6808DEE46200C0AA42 = {
containerPortal = AB3AFA5F08DEE45000C0AA42;
isa = PBXContainerItemProxy;
proxyType = 2;
remoteGlobalIDString = AB3AF9DE08DEE2CF00C0AA42;
remoteInfo = editor;
};
AB3AFA6D08DEE4D700C0AA42 = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.objc;
path = game.osxmain.m;
refType = 2;
sourceTree = SOURCE_ROOT;
};
AB3AFA6E08DEE4D700C0AA42 = {
fileRef = AB3AFA6D08DEE4D700C0AA42;
isa = PBXBuildFile;
settings = {
};
};
AB3AFA6F08DEE50200C0AA42 = {
isa = PBXFileReference;
lastKnownFileType = wrapper.framework;
name = OpenGL.framework;
path = /System/Library/Frameworks/OpenGL.framework;
refType = 0;
sourceTree = "<absolute>";
};
AB3AFA7008DEE50200C0AA42 = {
fileRef = AB3AFA6F08DEE50200C0AA42;
isa = PBXBuildFile;
settings = {
};
};
AB3AFA7308DEE53C00C0AA42 = {
isa = PBXFileReference;
lastKnownFileType = wrapper.framework;
name = SDL.framework;
path = /Library/Frameworks/SDL.framework;
refType = 0;
sourceTree = "<absolute>";
};
AB3AFA7408DEE53C00C0AA42 = {
fileRef = AB3AFA7308DEE53C00C0AA42;
isa = PBXBuildFile;
settings = {
};
};
AB3AFA7708DEFEC100C0AA42 = {
isa = PBXFileReference;
lastKnownFileType = wrapper.nib;
path = osxmain.nib;
refType = 2;
sourceTree = SOURCE_ROOT;
};
AB3AFA7808DEFEC200C0AA42 = {
fileRef = AB3AFA7708DEFEC100C0AA42;
isa = PBXBuildFile;
settings = {
};
};
AB3AFA7908DEFECF00C0AA42 = {
children = (
AB3A002608DF066200C0AA42,
AB3AFABD08DF030B00C0AA42,
ABBC7AD6099345F70064C16C,
AB3AFABF08DF035400C0AA42,
AB3AFB5608DF037500C0AA42,
ABBC7B6509934A5A0064C16C,
AB3AFA6F08DEE50200C0AA42,
AB3AFA7308DEE53C00C0AA42,
);
isa = PBXGroup;
name = Frameworks;
refType = 4;
sourceTree = "<group>";
};
AB3AFAB508DF00A400C0AA42 = {
containerPortal = AB3AFA5F08DEE45000C0AA42;
isa = PBXContainerItemProxy;
proxyType = 1;
remoteGlobalIDString = AB3AF5F408DEDABE00C0AA42;
remoteInfo = engine;
};
AB3AFAB608DF00A400C0AA42 = {
isa = PBXTargetDependency;
name = "engine (from engine.xcode)";
targetProxy = AB3AFAB508DF00A400C0AA42;
};
AB3AFABD08DF030B00C0AA42 = {
isa = PBXFileReference;
lastKnownFileType = archive.ar;
name = libengine.a;
path = /Users/jonof/ports/build/osx/engine/build/libengine.a;
refType = 0;
sourceTree = "<absolute>";
};
AB3AFABE08DF030B00C0AA42 = {
fileRef = AB3AFABD08DF030B00C0AA42;
isa = PBXBuildFile;
settings = {
};
};
AB3AFABF08DF035400C0AA42 = {
isa = PBXFileReference;
lastKnownFileType = wrapper.framework;
name = AppKit.framework;
path = /System/Library/Frameworks/AppKit.framework;
refType = 0;
sourceTree = "<absolute>";
};
AB3AFAC008DF035400C0AA42 = {
fileRef = AB3AFABF08DF035400C0AA42;
isa = PBXBuildFile;
settings = {
};
};
AB3AFB5608DF037500C0AA42 = {
comments = "Needed for fmod to link.";
isa = PBXFileReference;
lastKnownFileType = wrapper.framework;
name = Carbon.framework;
path = /System/Library/Frameworks/Carbon.framework;
refType = 0;
sourceTree = "<absolute>";
};
AB3AFB5708DF037500C0AA42 = {
fileRef = AB3AFB5608DF037500C0AA42;
isa = PBXBuildFile;
settings = {
};
};
AB3AFBF108DF03C900C0AA42 = {
buildPhases = (
);
buildSettings = {
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
OTHER_REZFLAGS = "";
PRODUCT_NAME = All;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
};
dependencies = (
AB3AFBF308DF03D200C0AA42,
AB2B5D3808E69B7D00899067,
);
isa = PBXAggregateTarget;
name = All;
productName = All;
};
AB3AFBF208DF03D200C0AA42 = {
containerPortal = AB3AF9E808DEE39200C0AA42;
isa = PBXContainerItemProxy;
proxyType = 1;
remoteGlobalIDString = AB3AF9F708DEE3EE00C0AA42;
remoteInfo = game;
};
AB3AFBF308DF03D200C0AA42 = {
isa = PBXTargetDependency;
target = AB3AF9F708DEE3EE00C0AA42;
targetProxy = AB3AFBF208DF03D200C0AA42;
};
AB3AFEBD08DF04E300C0AA42 = {
buildActionMask = 2147483647;
files = (
AB3AFECE08DF05AE00C0AA42,
);
isa = PBXResourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
AB3AFEBE08DF04E300C0AA42 = {
buildActionMask = 2147483647;
files = (
AB3AFECA08DF058D00C0AA42,
AB3AFECD08DF059E00C0AA42,
);
isa = PBXSourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
AB3AFEBF08DF04E300C0AA42 = {
buildActionMask = 2147483647;
files = (
AB3A002208DF064900C0AA42,
AB3A002708DF066200C0AA42,
AB3AFECF08DF063D00C0AA42,
AB3A002408DF064900C0AA42,
AB3A002508DF064900C0AA42,
);
isa = PBXFrameworksBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
AB3AFEC008DF04E300C0AA42 = {
buildPhases = (
AB3AFEBD08DF04E300C0AA42,
AB3AFEBE08DF04E300C0AA42,
AB3AFEBF08DF04E300C0AA42,
);
buildRules = (
);
buildSettings = {
GCC_CHAR_IS_UNSIGNED_CHAR = YES;
GCC_ENABLE_CPP_EXCEPTIONS = NO;
GCC_ENABLE_CPP_RTTI = NO;
GCC_PREPROCESSOR_DEFINITIONS = "SUPERBUILD POLYMOST USE_OPENGL NOASM USE_A_C RENDERTYPESDL=1";
HEADER_SEARCH_PATHS = ../../include;
INFOPLIST_FILE = "editor-Info.plist";
INSTALL_PATH = "$(USER_APPS_DIR)";
LIBRARY_SEARCH_PATHS = ../engine/build;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
OTHER_REZFLAGS = "";
PRODUCT_NAME = build;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = "-Wno-four-char-constants -Wno-unknown-pragmas";
};
dependencies = (
AB3AFEC508DF04EB00C0AA42,
AB3AFEC708DF04EB00C0AA42,
);
isa = PBXNativeTarget;
name = editor;
productName = editor;
productReference = AB3AFEC108DF04E300C0AA42;
productSettingsXML = "<?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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>editor</string>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.editor</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
";
productType = "com.apple.product-type.application";
};
AB3AFEC108DF04E300C0AA42 = {
explicitFileType = wrapper.application;
includeInIndex = 0;
isa = PBXFileReference;
path = build.app;
refType = 3;
sourceTree = BUILT_PRODUCTS_DIR;
};
AB3AFEC308DF04E300C0AA42 = {
isa = PBXFileReference;
lastKnownFileType = text.xml;
path = "editor-Info.plist";
refType = 2;
sourceTree = SOURCE_ROOT;
};
AB3AFEC408DF04EB00C0AA42 = {
containerPortal = AB3AFA5F08DEE45000C0AA42;
isa = PBXContainerItemProxy;
proxyType = 1;
remoteGlobalIDString = AB3AF5F408DEDABE00C0AA42;
remoteInfo = engine;
};
AB3AFEC508DF04EB00C0AA42 = {
isa = PBXTargetDependency;
name = "engine (from engine.xcode)";
targetProxy = AB3AFEC408DF04EB00C0AA42;
};
AB3AFEC608DF04EB00C0AA42 = {
containerPortal = AB3AFA5F08DEE45000C0AA42;
isa = PBXContainerItemProxy;
proxyType = 1;
remoteGlobalIDString = AB3AF9DD08DEE2CF00C0AA42;
remoteInfo = editor;
};
AB3AFEC708DF04EB00C0AA42 = {
isa = PBXTargetDependency;
name = "editor (from engine.xcode)";
targetProxy = AB3AFEC608DF04EB00C0AA42;
};
AB3AFECA08DF058D00C0AA42 = {
fileRef = AB3AF9F008DEE3C100C0AA42;
isa = PBXBuildFile;
settings = {
};
};
AB3AFECC08DF059E00C0AA42 = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.objc;
path = build.osxmain.m;
refType = 2;
sourceTree = SOURCE_ROOT;
};
AB3AFECD08DF059E00C0AA42 = {
fileRef = AB3AFECC08DF059E00C0AA42;
isa = PBXBuildFile;
settings = {
};
};
AB3AFECE08DF05AE00C0AA42 = {
fileRef = AB3AFA7708DEFEC100C0AA42;
isa = PBXBuildFile;
settings = {
};
};
AB3AFECF08DF063D00C0AA42 = {
fileRef = AB3AFABD08DF030B00C0AA42;
isa = PBXBuildFile;
settings = {
};
};
ABBC7A9A099344CF0064C16C = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.cpp.cpp;
name = jfaud_sound.cpp;
path = ../../src/jfaud_sound.cpp;
refType = 2;
sourceTree = SOURCE_ROOT;
};
ABBC7A9B099344CF0064C16C = {
fileRef = ABBC7A9A099344CF0064C16C;
isa = PBXBuildFile;
settings = {
};
};
ABBC7AA3099344E40064C16C = {
isa = PBXFileReference;
lastKnownFileType = "wrapper.pb-project";
name = jfaud.xcode;
path = ../../../jfaud/osx/jfaud.xcode;
refType = 2;
sourceTree = SOURCE_ROOT;
};
ABBC7AA5099344E60064C16C = {
children = (
ABBC7AA6099344E60064C16C,
ABBC7AA7099344E60064C16C,
ABBC7AA8099344E60064C16C,
);
isa = PBXGroup;
name = Products;
refType = 4;
sourceTree = "<group>";
};
ABBC7AA6099344E60064C16C = {
fileType = wrapper.framework;
isa = PBXReferenceProxy;
path = jfaud.framework;
refType = 3;
remoteRef = ABBC7AAA099344F50064C16C;
sourceTree = BUILT_PRODUCTS_DIR;
};
ABBC7AA7099344E60064C16C = {
fileType = archive.ar;
isa = PBXReferenceProxy;
path = libmpadec.a;
refType = 3;
remoteRef = ABBC7AAB099344F50064C16C;
sourceTree = BUILT_PRODUCTS_DIR;
};
ABBC7AA8099344E60064C16C = {
fileType = wrapper.application;
isa = PBXReferenceProxy;
path = jfaudtest.app;
refType = 3;
remoteRef = ABBC7AAC099344F50064C16C;
sourceTree = BUILT_PRODUCTS_DIR;
};
ABBC7AAA099344F50064C16C = {
containerPortal = ABBC7AA3099344E40064C16C;
isa = PBXContainerItemProxy;
proxyType = 2;
remoteGlobalIDString = 8DC2EF5B0486A6940098B216;
remoteInfo = jfaud;
};
ABBC7AAB099344F50064C16C = {
containerPortal = ABBC7AA3099344E40064C16C;
isa = PBXContainerItemProxy;
proxyType = 2;
remoteGlobalIDString = ABE7399C095277C50040A74A;
remoteInfo = mpadec;
};
ABBC7AAC099344F50064C16C = {
containerPortal = ABBC7AA3099344E40064C16C;
isa = PBXContainerItemProxy;
proxyType = 2;
remoteGlobalIDString = ABE7394E09526A5B0040A74A;
remoteInfo = jfaudtest;
};
ABBC7AD6099345F70064C16C = {
isa = PBXFileReference;
lastKnownFileType = wrapper.framework;
name = jfaud.framework;
path = /Users/jonof/ports/jfaud/osx/build/jfaud.framework;
refType = 0;
sourceTree = "<absolute>";
};
ABBC7B40099347230064C16C = {
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
ABBC7B410993474A0064C16C,
);
isa = PBXCopyFilesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
ABBC7B410993474A0064C16C = {
fileRef = ABBC7AD6099345F70064C16C;
isa = PBXBuildFile;
settings = {
};
};
ABBC7B6409934A410064C16C = {
fileRef = ABBC7AD6099345F70064C16C;
isa = PBXBuildFile;
settings = {
};
};
ABBC7B6509934A5A0064C16C = {
isa = PBXFileReference;
lastKnownFileType = wrapper.framework;
name = OpenAL.framework;
path = ../../../../../../Library/Frameworks/OpenAL.framework;
refType = 2;
sourceTree = SOURCE_ROOT;
};
ABBC7B6609934A5A0064C16C = {
fileRef = ABBC7B6509934A5A0064C16C;
isa = PBXBuildFile;
settings = {
};
};
};
rootObject = AB3AF9E808DEE39200C0AA42;
}

View File

@ -0,0 +1,7 @@
{
IBClasses = (
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{ACTIONS = {}; CLASS = SDLMain; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
);
IBVersion = 1;
}

View File

@ -0,0 +1,21 @@
<?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>IBDocumentLocation</key>
<string>52 97 356 240 0 0 1024 746 </string>
<key>IBEditorPositions</key>
<dict>
<key>29</key>
<string>196 422 195 44 0 0 1024 746 </string>
</dict>
<key>IBFramework Version</key>
<string>364.0</string>
<key>IBOpenObjects</key>
<array>
<integer>29</integer>
</array>
<key>IBSystem Version</key>
<string>7W98</string>
</dict>
</plist>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -0,0 +1,192 @@
#include "sdlayer.h"
static unsigned int sdlappicon_pixels[] = {
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff654848, 0xffad8484,
0xffb18888, 0xffbb8f8f, 0xff936d6d, 0xff130303, 0xff987373, 0xff936d6d,
0xff100000, 0xff815f5f, 0xffaa8181, 0xff362020, 0xffa98080, 0xff5c3f3f,
0xff715252, 0xffb78b8b, 0xff130202, 0xff100000, 0xff2f1a1a, 0xffa07a7a,
0xffb78c8c, 0xffbd9090, 0xff856262, 0xff140303, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000,
0xff432a2a, 0xff825f5f, 0xff190808, 0xff4c3131, 0xffd5a2a2, 0xff2c1717,
0xff7e5b5b, 0xff543939, 0xff100000, 0xff674848, 0xff6e4f4f, 0xff100000,
0xffb58989, 0xff1c0a0a, 0xff513535, 0xff7f5d5d, 0xff100000, 0xff100000,
0xff100000, 0xffa97f7f, 0xff271414, 0xff220f0f, 0xffbb8d8d, 0xff442b2b,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff432a2a, 0xffba8e8e, 0xffb88d8d, 0xffc19494,
0xff987171, 0xff110101, 0xff7e5b5b, 0xff533939, 0xff100000, 0xff694949,
0xff6e4f4f, 0xff100000, 0xffb08585, 0xff1c0a0a, 0xff513535, 0xff7b5a5a,
0xff100000, 0xff100000, 0xff100000, 0xffa67c7c, 0xff261212, 0xff100000,
0xff956e6e, 0xff704f4f, 0xff100000, 0xff100000, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff4c3232, 0xff896565,
0xff261212, 0xff503535, 0xffd4a2a2, 0xff351e1e, 0xff755454, 0xff835f5f,
0xff261111, 0xff936c6c, 0xff715050, 0xff160505, 0xffb28686, 0xff241111,
0xff573a3a, 0xff836060, 0xff251111, 0xff674949, 0xff140303, 0xffa77e7e,
0xff392222, 0xff3a2222, 0xffbf9191, 0xff3b2424, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000,
0xff725252, 0xffb78a8a, 0xffc19292, 0xffba8c8c, 0xff866161, 0xff110101,
0xff2c1818, 0xffb28585, 0xffc49393, 0xffab8080, 0xff261313, 0xff3f2727,
0xffb18686, 0xff644545, 0xff7c5a5a, 0xffb98c8c, 0xffc09191, 0xffba8c8c,
0xff341e1e, 0xffa77e7e, 0xffbf9090, 0xffba8d8d, 0xff745353, 0xff110101,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff272159, 0xff383793, 0xff3e3da3, 0xff2e286b,
0xff2e296e, 0xff2a2157, 0xff100001, 0xff37358e, 0xff140611, 0xff353286,
0xff3d3ca0, 0xff3f3c9f, 0xff180a1a, 0xff323080, 0xff353285, 0xff261e51,
0xff322c75, 0xff100000, 0xff322e7b, 0xff1f153a, 0xff333284, 0xff3b3a9d,
0xff403fa8, 0xff13040b, 0xff100000, 0xff100000, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff2e296d, 0xff251c4b,
0xff1a0d25, 0xff110104, 0xff353284, 0xff5453db, 0xff1a0d22, 0xff3e3da6,
0xff231a47, 0xff332f7d, 0xff150714, 0xff2c225b, 0xff1f1333, 0xff2b2461,
0xff281f54, 0xff2a235d, 0xff5454df, 0xff251a44, 0xff38358f, 0xff211841,
0xff332f7e, 0xff1c0f29, 0xff140611, 0xff100000, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000,
0xff2f296f, 0xff3e3ca0, 0xff332e7d, 0xff100000, 0xff363287, 0xff2d2667,
0xff3f3ca0, 0xff4746bc, 0xff241b4a, 0xff2a235f, 0xff1e1436, 0xff3d3b9e,
0xff1f1231, 0xff2a225d, 0xff271f52, 0xff2a2461, 0xff30296e, 0xff4441af,
0xff4443b2, 0xff231944, 0xff3e3ea5, 0xff3c3998, 0xff1a0e25, 0xff100000,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff302a73, 0xff2e2768, 0xff241b48, 0xff1e1232,
0xff39358f, 0xff190d24, 0xff35307f, 0xff5150d4, 0xff22173f, 0xff4746b9,
0xff2a2159, 0xff4947bd, 0xff261d4d, 0xff35307f, 0xff352f7d, 0xff2d2667,
0xff261c4c, 0xff292158, 0xff5555df, 0xff231a47, 0xff38358f, 0xff251b49,
0xff261c4c, 0xff110205, 0xff100000, 0xff100000, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff221842, 0xff2f286c,
0xff2f286b, 0xff221840, 0xff383b78, 0xff292c43, 0xff2a2c43, 0xff4650a1,
0xff252633, 0xff424a92, 0xff4650a3, 0xff3d4587, 0xff252634, 0xff404990,
0xff40498f, 0xff363c6e, 0xff2f3458, 0xff252633, 0xff4851a4, 0xff1a0e26,
0xff2d2666, 0xff2f286b, 0xff2e276a, 0xff110206, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff446281, 0xff527ea5,
0xff4f799e, 0xff537fa6, 0xff517ca3, 0xff5a88b3, 0xff45698a, 0xff537fa7,
0xff4e779b, 0xff5480a8, 0xff5581a9, 0xff5683ac, 0xff5987b1, 0xff5887b0,
0xff547fa7, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff241d34, 0xff251f3c, 0xff1c101d, 0xff14080c,
0xff4d5c85, 0xff546a96, 0xff4b5f87, 0xff36475f, 0xff5b6f86, 0xff507096,
0xff405683, 0xff394d6e, 0xff51657c, 0xff556f92, 0xff405785, 0xff394e72,
0xff435d86, 0xff466094, 0xff466095, 0xff261c33, 0xff211b3a, 0xff221d3b,
0xff150913, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff100000, 0xff170b1a, 0xff505cb1, 0xff363d88,
0xff241e3f, 0xff31305e, 0xff45498c, 0xff424381, 0xff3c3c7e, 0xff2a295d,
0xff6b72a4, 0xff2c2d76, 0xff2e2f7e, 0xff252565, 0xff6771a5, 0xff2c2d78,
0xff2f3180, 0xff292970, 0xff424999, 0xff313188, 0xff2d2d7b, 0xff414a9c,
0xff343490, 0xff2f2e7f, 0xff150b1c, 0xff100000, 0xff100103, 0xff150714,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff32305e,
0xff3a3f98, 0xff394095, 0xff1e163c, 0xff3f3c77, 0xff323388, 0xff434991,
0xff303082, 0xff39438f, 0xff313385, 0xff323481, 0xff3e4598, 0xff2d2e7d,
0xff454ba0, 0xff2c2c7a, 0xff3b429e, 0xff2c2c79, 0xff4249ac, 0xff323289,
0xff191532, 0xff4c51a2, 0xff393998, 0xff211e48, 0xff100104, 0xff100000,
0xff180b1f, 0xff251c4a, 0xff100000, 0xff100000, 0xff100000, 0xff100000,
0xff100000, 0xff4751a7, 0xff3b3b9e, 0xff424ea6, 0xff1f173f, 0xff3e4293,
0xff363694, 0xff3b4598, 0xff353592, 0xff424793, 0xff373796, 0xff3b3f8f,
0xff393a9b, 0xff393a89, 0xff4244a1, 0xff2d2f7a, 0xff27225c, 0xff272460,
0xff4a50b1, 0xff3e3ea5, 0xff383b95, 0xff4b53c0, 0xff4343ae, 0xff3a3c98,
0xff100206, 0xff100000, 0xff2a225b, 0xff1d112e, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff1a0e22, 0xff545bc6, 0xff3e42a0, 0xff464db5,
0xff231b47, 0xff4f58b7, 0xff3e3ea3, 0xff4e53ab, 0xff393998, 0xff4045a8,
0xff4040a7, 0xff3d4798, 0xff4141ab, 0xff3d459a, 0xff4242ad, 0xff3a4094,
0xff4444b0, 0xff3c439c, 0xff4445b1, 0xff2d2c76, 0xff1d1736, 0xff4c54bf,
0xff36358e, 0xff11030a, 0xff0f0000, 0xff100000, 0xff4547ab, 0xff1b0f29,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff3a3671, 0xff494bb6,
0xff4c52a4, 0xff5052b1, 0xff2b2663, 0xff4b52c0, 0xff4445b1, 0xff4344af,
0xff2d2a70, 0xff4d58be, 0xff3e3ea2, 0xff4149a6, 0xff4040a7, 0xff464da6,
0xff4444b1, 0xff454ca2, 0xff4444b0, 0xff414ca1, 0xff4444b3, 0xff343585,
0xff323473, 0xff4a4cc3, 0xff3f45a1, 0xff1e182d, 0xff100000, 0xff190e26,
0xff758bf0, 0xff21173f, 0xff100000, 0xff100000, 0xff100000, 0xff100001,
0xff5052af, 0xff4545b8, 0xff4e51bd, 0xff4444b4, 0xff36378f, 0xff525ac3,
0xff333284, 0xff12050e, 0xff170915, 0xff4c52c6, 0xff4343b2, 0xff5053c2,
0xff3a3a9c, 0xff4045aa, 0xff4848be, 0xff484abf, 0xff4242b0, 0xff3f45a6,
0xff4545b7, 0xff4343b2, 0xff474cab, 0xff4545b9, 0xff4646bd, 0xff1f1a45,
0xff160918, 0xff5e65c0, 0xffc4d6f6, 0xff4244a4, 0xff100103, 0xff100000,
0xff100000, 0xff1a0e23, 0xff575cd5, 0xff4140aa, 0xff34307b, 0xff4949c3,
0xff3d439f, 0xff4b4ec4, 0xff2b2666, 0xff100000, 0xff13040a, 0xff313279,
0xff3f3fa9, 0xff3e41a5, 0xff333681, 0xff333183, 0xff4041ad, 0xff4248ae,
0xff4751b6, 0xff5467ca, 0xff556bcc, 0xff5870d1, 0xff7385d6, 0xff7b87d3,
0xff9096d5, 0xff969fd7, 0xffb6bef0, 0xffebeff9, 0xfffafafa, 0xffadc5f7,
0xff5567c8, 0xff2e2768, 0xff100000, 0xff373872, 0xff5154d4, 0xff332e7a,
0xff33326d, 0xff4d4dcf, 0xff474fa7, 0xff4444b4, 0xff2d2761, 0xff2a2751,
0xff3a4186, 0xff4b52bb, 0xff535ed5, 0xff5762df, 0xff5666e6, 0xff5a66ef,
0xff5b6bee, 0xff5b73d9, 0xff5062b6, 0xff444f9c, 0xff3d4685, 0xff373b71,
0xff373769, 0xff433b67, 0xff433c66, 0xff433e70, 0xff7179d1, 0xffccd9f6,
0xffd1dbf4, 0xff6166bd, 0xff201639, 0xff110205, 0xff100001, 0xff525abb,
0xff5050d7, 0xff231a45, 0xff3c3a63, 0xff3d3da4, 0xff3e46a1, 0xff404ba1,
0xff3f47a2, 0xff3f42a7, 0xff4545b7, 0xff4c4ccb, 0xff5050d7, 0xff4e4fd1,
0xff393792, 0xff251c4d, 0xff160a1b, 0xff100103, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000,
0xff1a0f29, 0xff6d87f4, 0xff5b67d8, 0xff150712, 0xff100000, 0xff100000,
0xff1c1227, 0xff5b66de, 0xff4646bf, 0xff261f4e, 0xff3c4389, 0xff3c4599,
0xff2f317c, 0xff2d2d7a, 0xff303081, 0xff34348f, 0xff383898, 0xff3b3b9e,
0xff2a2a64, 0xff150817, 0xff0f0000, 0xff100000, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff100103, 0xff5863e1, 0xff2e286a, 0xff100000,
0xff100000, 0xff100000, 0xff38386d, 0xff4143aa, 0xff3f499e, 0xff374089,
0xff2b2b73, 0xff2b2b75, 0xff2a2a73, 0xff2b2b74, 0xff2d2d7b, 0xff303081,
0xff2c2e75, 0xff150f1c, 0xff0f0000, 0xff100000, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff4c4bc6,
0xff150815, 0xff100000, 0xff100000, 0xff100000, 0xff3a438e, 0xff353f84,
0xff262766, 0xff262665, 0xff262666, 0xff272769, 0xff272769, 0xff28286d,
0xff292970, 0xff272769, 0xff120a0f, 0xff100000, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000,
0xff100001, 0xff3a358f, 0xff0f0000, 0xff100000, 0xff100000, 0xff100000,
0xff170e10, 0xff16060e, 0xff13050e, 0xff19060e, 0xff19070e, 0xff110103,
0xff100002, 0xff100002, 0xff100002, 0xff100001, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff13050e, 0xff28215b, 0xff100000, 0xff100000,
0xff100000, 0xff100000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000,
0xff000000, 0xff000000, 0xff000000, 0xff000000,};
static unsigned char sdlappicon_mask[] = {
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255,};
struct sdlappicon sdlappicon = {
32,32, // width,height
sdlappicon_pixels,
sdlappicon_mask
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

File diff suppressed because it is too large Load Diff

BIN
polymer/build/rsrc/game.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
polymer/build/rsrc/game.xcf Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -0,0 +1,192 @@
#include "sdlayer.h"
static unsigned int sdlappicon_pixels[] = {
0xff415f7a, 0xff364a5c, 0xff364a5c, 0xff607486, 0xff667a8c, 0xff667a8c,
0xff667a8c, 0xff667a8c, 0xff667a8c, 0xff667a8c, 0xff667a8c, 0xff667a8c,
0xff667a8c, 0xff667a8c, 0xff667a8c, 0xff667a8c, 0xff667a8c, 0xff667a8c,
0xff667a8c, 0xff667a8c, 0xff667a8c, 0xff667a8c, 0xff667a8c, 0xff667a8c,
0xff667a8c, 0xff667a8c, 0xff667a8c, 0xff667a8c, 0xff607486, 0xff364a5c,
0xff364a5c, 0xff415f7a, 0xff364a5c, 0xff202020, 0xff202020, 0xff747474,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff747474, 0xff202020, 0xff202020, 0xff364a5c, 0xff364a5c, 0xff334d66,
0xff334d66, 0xff747474, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff747474, 0xff334d66, 0xff334d66, 0xff364a5c,
0xff364a5c, 0xff334d66, 0xff334d66, 0xff747474, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff747474, 0xff334d66,
0xff334d66, 0xff364a5c, 0xff364a5c, 0xff202020, 0xff202020, 0xff5c5c5c,
0xff404040, 0xff808080, 0xff646464, 0xff686868, 0xff686868, 0xff686868,
0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868,
0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868,
0xff686868, 0xff686868, 0xff686868, 0xff646464, 0xff7c7c7c, 0xff404040,
0xff5c5c5c, 0xff202020, 0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020,
0xff202020, 0xff6c6c6c, 0xff686868, 0xff808080, 0xff686868, 0xff808080,
0xff808080, 0xff808080, 0xff6c6c6c, 0xff6a6a6a, 0xff727272, 0xff6c6c6c,
0xff6c6c6c, 0xff767676, 0xff626262, 0xff6c6c6c, 0xff808080, 0xff6c6c6c,
0xff686868, 0xff747474, 0xff808080, 0xff808080, 0xff808080, 0xff707070,
0xff787878, 0xff686868, 0xff6c6c6c, 0xff202020, 0xff202020, 0xff364a5c,
0xff364a5c, 0xff202020, 0xff202020, 0xff747474, 0xff808080, 0xff808080,
0xff686868, 0xff808080, 0xff808080, 0xff808080, 0xff6c6c6c, 0xff6a6a6a,
0xff727272, 0xff6a6a6a, 0xff6a6a6a, 0xff808080, 0xff6c6c6c, 0xff6c6c6c,
0xff808080, 0xff6c6c6c, 0xff7c7c7c, 0xff6c6c6c, 0xff808080, 0xff808080,
0xff808080, 0xff707070, 0xff787878, 0xff808080, 0xff747474, 0xff202020,
0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020, 0xff202020, 0xff747474,
0xff808080, 0xff808080, 0xff686868, 0xff808080, 0xff808080, 0xff808080,
0xff767676, 0xff6c6c6c, 0xff7c7c7c, 0xff707070, 0xff707070, 0xff767676,
0xff6c6c6c, 0xff767676, 0xff6c6c6c, 0xff767676, 0xff6c6c6c, 0xff7e7e7e,
0xff808080, 0xff808080, 0xff808080, 0xff707070, 0xff787878, 0xff808080,
0xff747474, 0xff202020, 0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020,
0xff202020, 0xff747474, 0xff808080, 0xff808080, 0xff646464, 0xff686868,
0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868,
0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868,
0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff646464,
0xff787878, 0xff808080, 0xff747474, 0xff202020, 0xff202020, 0xff364a5c,
0xff364a5c, 0xff202020, 0xff202020, 0xff747474, 0xff808080, 0xff808080,
0xff686868, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff707070, 0xff787878, 0xff808080, 0xff747474, 0xff202020,
0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020, 0xff202020, 0xff747474,
0xff808080, 0xff808080, 0xff686868, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff707070, 0xff787878, 0xff808080,
0xff747474, 0xff202020, 0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020,
0xff202020, 0xff747474, 0xff808080, 0xff808080, 0xff686868, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff707070,
0xff787878, 0xff808080, 0xff747474, 0xff202020, 0xff202020, 0xff364a5c,
0xff364a5c, 0xff202020, 0xff202020, 0xff747474, 0xff808080, 0xff808080,
0xff646464, 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868,
0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868,
0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868,
0xff686868, 0xff646464, 0xff787878, 0xff808080, 0xff747474, 0xff202020,
0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020, 0xff202020, 0xff747474,
0xff808080, 0xff808080, 0xff686868, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff707070, 0xff787878, 0xff808080,
0xff747474, 0xff202020, 0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020,
0xff202020, 0xff747474, 0xff808080, 0xff808080, 0xff686868, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff707070,
0xff787878, 0xff808080, 0xff747474, 0xff202020, 0xff202020, 0xff364a5c,
0xff364a5c, 0xff202020, 0xff202020, 0xff747474, 0xff808080, 0xff808080,
0xff686868, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff707070, 0xff787878, 0xff808080, 0xff747474, 0xff202020,
0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020, 0xff202020, 0xff747474,
0xff808080, 0xff808080, 0xff6c6c6c, 0xff686868, 0xff686868, 0xff686868,
0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868,
0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff686868,
0xff686868, 0xff686868, 0xff686868, 0xff686868, 0xff787878, 0xff808080,
0xff747474, 0xff202020, 0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020,
0xff202020, 0xff747474, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff747474, 0xff202020, 0xff202020, 0xff364a5c,
0xff364a5c, 0xff202020, 0xff202020, 0xff666666, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff808080,
0xff808080, 0xff808080, 0xff808080, 0xff808080, 0xff666666, 0xff202020,
0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020, 0xff202020, 0xff3c3c3c,
0xff666666, 0xff747474, 0xff747474, 0xff747474, 0xff747474, 0xff747474,
0xff747474, 0xff747474, 0xff747474, 0xff747474, 0xff747474, 0xff747474,
0xff747474, 0xff747474, 0xff747474, 0xff747474, 0xff747474, 0xff747474,
0xff747474, 0xff747474, 0xff747474, 0xff747474, 0xff747474, 0xff666666,
0xff3c3c3c, 0xff202020, 0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020,
0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020,
0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020,
0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020,
0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020,
0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff364a5c,
0xff364a5c, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020,
0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020,
0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020,
0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020,
0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020,
0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020, 0xff202020, 0xff202020,
0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff302424, 0xff3e3e3e,
0xff484848, 0xff444444, 0xff444444, 0xff464646, 0xff4c4c4c, 0xff484848,
0xff484848, 0xff4a4a4a, 0xff4c4c4c, 0xff4c4c4c, 0xff4c4c4c, 0xff4c4c4c,
0xff4a4a4a, 0xff404040, 0xff343434, 0xff343434, 0xff343434, 0xff343434,
0xff2c2c2c, 0xff202020, 0xff202020, 0xff364a5c, 0xff364a5c, 0xff202020,
0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020,
0xff3c3c3c, 0xff727272, 0xff707070, 0xff565656, 0xff505050, 0xff525252,
0xff6a6a6a, 0xff787878, 0xff767676, 0xff747474, 0xff7a7a7a, 0xff7c7c7c,
0xff787878, 0xff787878, 0xff7a7a7a, 0xff727272, 0xff505050, 0xff484848,
0xff484848, 0xff484848, 0xff464646, 0xff202020, 0xff202020, 0xff364a5c,
0xff364a5c, 0xff202020, 0xff202020, 0xff202020, 0xff202020, 0xff202020,
0xff202020, 0xff202020, 0xff444444, 0xff6c6c6c, 0xff6c6c6c, 0xff303030,
0xff202020, 0xff202020, 0xff545454, 0xff787878, 0xff747474, 0xff747474,
0xff787878, 0xff7c7c7c, 0xff808080, 0xff808080, 0xff7a7a7a, 0xff747474,
0xff505050, 0xff484848, 0xff484848, 0xff484848, 0xff484848, 0xff202020,
0xff202020, 0xff364a5c, 0xff364a5c, 0xff282828, 0xff606060, 0xff686868,
0xff747474, 0xff4e4e4e, 0xff565656, 0xff202020, 0xff444444, 0xff686868,
0xff6c6c6c, 0xff303030, 0xff202020, 0xff202020, 0xff545454, 0xff767676,
0xff767676, 0xff767676, 0xff7c7c7c, 0xff787878, 0xff7c7c7c, 0xff7c7c7c,
0xff7e7e7e, 0xff767676, 0xff505050, 0xff484848, 0xff484848, 0xff484848,
0xff484848, 0xff202020, 0xff202020, 0xff364a5c, 0xff364a5c, 0xff606060,
0xffa8a8a8, 0xff7e7e7e, 0xffa8a8a8, 0xff6c6c6c, 0xff7c7c7c, 0xff202020,
0xff444444, 0xff6a6a6a, 0xff6c6c6c, 0xff303030, 0xff202020, 0xff202020,
0xff545454, 0xff747474, 0xff787878, 0xff787878, 0xff7e7e7e, 0xff7c7c7c,
0xff787878, 0xff787878, 0xff828282, 0xff7c7c7c, 0xff505050, 0xff484848,
0xff484848, 0xff484848, 0xff484848, 0xff202020, 0xff202020, 0xff364a5c,
0xff364a5c, 0xff7c7c7c, 0xff808080, 0xff404040, 0xffa8a8a8, 0xffa0a0a0,
0xff7c7c7c, 0xff202020, 0xff464646, 0xff767676, 0xff727272, 0xff303030,
0xff202020, 0xff202020, 0xff545454, 0xff767676, 0xff7a7a7a, 0xff787878,
0xff7e7e7e, 0xff7c7c7c, 0xff787878, 0xff7c7c7c, 0xff8c8c8c, 0xff7e7e7e,
0xff505050, 0xff484848, 0xff484848, 0xff484848, 0xff484848, 0xff222222,
0xff25303a, 0xff364a5c, 0xff364a5c, 0xff606060, 0xffa8a8a8, 0xff7e7e7e,
0xffa8a8a8, 0xff6c6c6c, 0xff7c7c7c, 0xff202020, 0xff484848, 0xff787878,
0xff727272, 0xff303030, 0xff202020, 0xff202020, 0xff585858, 0xff808080,
0xff808080, 0xff808080, 0xff888888, 0xff868686, 0xff7e7e7e, 0xff7a7a7a,
0xff848484, 0xff747474, 0xff505050, 0xff484848, 0xff484848, 0xff484848,
0xff484848, 0xff252b30, 0xff2a4054, 0xff385168, 0xff3a5874, 0xff282c30,
0xff606060, 0xff686868, 0xff747474, 0xff4e4e4e, 0xff565656, 0xff202020,
0xff484848, 0xff787878, 0xff707070, 0xff303030, 0xff202020, 0xff202020,
0xff585858, 0xff7c7c7c, 0xff7a7a7a, 0xff787878, 0xff828282, 0xff808080,
0xff808080, 0xff7c7c7c, 0xff828282, 0xff747474, 0xff505050, 0xff484848,
0xff484848, 0xff484848, 0xff484848, 0xff242424, 0xff26394c, 0xff364a5c,
0xff4c7498, 0xff334d66, 0xff202428, 0xff202020, 0xff202020, 0xff202020,
0xff202020, 0xff202428, 0xff4c5660, 0xff747474, 0xff707070, 0xff585858,
0xff585858, 0xff5c5c5c, 0xff747474, 0xff7c7c7c, 0xff707070, 0xff787878,
0xff7c7c7c, 0xff787878, 0xff7c7c7c, 0xff868686, 0xff828282, 0xff787878,
0xff505050, 0xff484848, 0xff484848, 0xff484848, 0xff464646, 0xff202020,
0xff202020, 0xff364a5c, 0xff4c7498, 0xff4c7498, 0xff3a5874, 0xff364a5c,
0xff364a5c, 0xff364a5c, 0xff364a5c, 0xff3a5874, 0xff55738e, 0xff5a6e80,
0xff5e7284, 0xff5e7284, 0xff64788a, 0xff687c8e, 0xff6c8092, 0xff667a8c,
0xff627688, 0xff627688, 0xff627688, 0xff627688, 0xff64788a, 0xff6a7e90,
0xff667a8c, 0xff627688, 0xff4e6274, 0xff4a5e70, 0xff4a5e70, 0xff4a5e70,
0xff44586a, 0xff364a5c, 0xff364a5c, 0xff415f7a,};
static unsigned char sdlappicon_mask[] = {
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255,};
struct sdlappicon sdlappicon = {
32,32, // width,height
sdlappicon_pixels,
sdlappicon_mask
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

298
polymer/build/src/a-c.c Normal file
View File

@ -0,0 +1,298 @@
// A.ASM replacement using C
// Mainly by Ken Silverman, with things melded with my port by
// Jonathon Fowler (jonof@edgenetwork.org)
//
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
// Ken Silverman's official web site: "http://www.advsys.net/ken"
// See the included license file "BUILDLIC.TXT" for license info.
#include "a.h"
#ifndef ENGINE_USING_A_C
# error A.H has indicated that optimized code has been requested. This means a-c.c is being compiled \
when USE_A_C has not been defined.
#endif
long krecip(long num); // from engine.c
#define BITSOFPRECISION 3
#define BITSOFPRECISIONPOW 8
extern long asm1, asm2, asm3, asm4, fpuasm, globalx3, globaly3;
extern void *reciptable;
static long bpl, transmode = 0;
static long glogx, glogy, gbxinc, gbyinc, gpinc;
static char *gbuf, *gpal, *ghlinepal, *gtrans;
//Global variable functions
void setvlinebpl(long dabpl) { bpl = dabpl; }
void fixtransluscence(long datransoff) { gtrans = (char *)datransoff; }
void settransnormal(void) { transmode = 0; }
void settransreverse(void) { transmode = 1; }
//Ceiling/floor horizontal line functions
void sethlinesizes(long logx, long logy, long bufplc)
{ glogx = logx; glogy = logy; gbuf = (char *)bufplc; }
void setpalookupaddress(char *paladdr) { ghlinepal = paladdr; }
void setuphlineasm4(long bxinc, long byinc) { gbxinc = bxinc; gbyinc = byinc; }
void hlineasm4(long cnt, long skiploadincs, long paloffs, unsigned long by, unsigned long bx, long p)
{
char *palptr;
palptr = (char *)&ghlinepal[paloffs];
if (!skiploadincs) { gbxinc = asm1; gbyinc = asm2; }
for(;cnt>=0;cnt--)
{
*((char *)p) = palptr[gbuf[((bx>>(32-glogx))<<glogy)+(by>>(32-glogy))]];
bx -= gbxinc;
by -= gbyinc;
p--;
}
}
//Sloped ceiling/floor vertical line functions
void setupslopevlin(long logylogx, long bufplc, long pinc)
{
glogx = (logylogx&255); glogy = (logylogx>>8);
gbuf = (char *)bufplc; gpinc = pinc;
}
void slopevlin(long p, long i, long slopaloffs, long cnt, long bx, long by)
{
long *slopalptr, bz, bzinc;
unsigned long u, v;
bz = asm3; bzinc = (asm1>>3);
slopalptr = (long *)slopaloffs;
for(;cnt>0;cnt--)
{
i = krecip(bz>>6); bz += bzinc;
u = bx+globalx3*i;
v = by+globaly3*i;
(*(char *)p) = *(char *)(slopalptr[0]+gbuf[((u>>(32-glogx))<<glogy)+(v>>(32-glogy))]);
slopalptr--;
p += gpinc;
}
}
//Wall,face sprite/wall sprite vertical line functions
void setupvlineasm(long neglogy) { glogy = neglogy; }
void vlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufplc, long p)
{
gbuf = (char *)bufplc;
gpal = (char *)paloffs;
for(;cnt>=0;cnt--)
{
*((char *)p) = gpal[gbuf[vplc>>glogy]];
p += bpl;
vplc += vinc;
}
}
void setupmvlineasm(long neglogy) { glogy = neglogy; }
void mvlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufplc, long p)
{
char ch;
gbuf = (char *)bufplc;
gpal = (char *)paloffs;
for(;cnt>=0;cnt--)
{
ch = gbuf[vplc>>glogy]; if (ch != 255) *((char *)p) = gpal[ch];
p += bpl;
vplc += vinc;
}
}
void setuptvlineasm(long neglogy) { glogy = neglogy; }
void tvlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufplc, long p)
{
char ch;
gbuf = (char *)bufplc;
gpal = (char *)paloffs;
if (transmode)
{
for(;cnt>=0;cnt--)
{
ch = gbuf[vplc>>glogy];
if (ch != 255) *((char *)p) = gtrans[(*((char *)p))+(gpal[ch]<<8)];
p += bpl;
vplc += vinc;
}
}
else
{
for(;cnt>=0;cnt--)
{
ch = gbuf[vplc>>glogy];
if (ch != 255) *((char *)p) = gtrans[((*((char *)p))<<8)+gpal[ch]];
p += bpl;
vplc += vinc;
}
}
}
//Floor sprite horizontal line functions
void msethlineshift(long logx, long logy) { glogx = logx; glogy = logy; }
void mhline(long bufplc, unsigned long bx, long cntup16, long junk, unsigned long by, long p)
{
char ch;
gbuf = (char *)bufplc;
gpal = (char *)asm3;
for(cntup16>>=16;cntup16>0;cntup16--)
{
ch = gbuf[((bx>>(32-glogx))<<glogy)+(by>>(32-glogy))];
if (ch != 255) *((char *)p) = gpal[ch];
bx += asm1;
by += asm2;
p++;
}
}
void tsethlineshift(long logx, long logy) { glogx = logx; glogy = logy; }
void thline(long bufplc, unsigned long bx, long cntup16, long junk, unsigned long by, long p)
{
char ch;
gbuf = (char *)bufplc;
gpal = (char *)asm3;
if (transmode)
{
for(cntup16>>=16;cntup16>0;cntup16--)
{
ch = gbuf[((bx>>(32-glogx))<<glogy)+(by>>(32-glogy))];
if (ch != 255) *((char *)p) = gtrans[(*((char *)p))+(gpal[ch]<<8)];
bx += asm1;
by += asm2;
p++;
}
}
else
{
for(cntup16>>=16;cntup16>0;cntup16--)
{
ch = gbuf[((bx>>(32-glogx))<<glogy)+(by>>(32-glogy))];
if (ch != 255) *((char *)p) = gtrans[((*((char *)p))<<8)+gpal[ch]];
bx += asm1;
by += asm2;
p++;
}
}
}
//Rotatesprite vertical line functions
void setupspritevline(long paloffs, long bxinc, long byinc, long ysiz)
{
gpal = (char *)paloffs;
gbxinc = bxinc;
gbyinc = byinc;
glogy = ysiz;
}
void spritevline(long bx, long by, long cnt, long bufplc, long p)
{
gbuf = (char *)bufplc;
for(;cnt>1;cnt--)
{
(*(char *)p) = gpal[gbuf[(bx>>16)*glogy+(by>>16)]];
bx += gbxinc;
by += gbyinc;
p += bpl;
}
}
//Rotatesprite vertical line functions
void msetupspritevline(long paloffs, long bxinc, long byinc, long ysiz)
{
gpal = (char *)paloffs;
gbxinc = bxinc;
gbyinc = byinc;
glogy = ysiz;
}
void mspritevline(long bx, long by, long cnt, long bufplc, long p)
{
char ch;
gbuf = (char *)bufplc;
for(;cnt>1;cnt--)
{
ch = gbuf[(bx>>16)*glogy+(by>>16)];
if (ch != 255) (*(char *)p) = gpal[ch];
bx += gbxinc;
by += gbyinc;
p += bpl;
}
}
void tsetupspritevline(long paloffs, long bxinc, long byinc, long ysiz)
{
gpal = (char *)paloffs;
gbxinc = bxinc;
gbyinc = byinc;
glogy = ysiz;
}
void tspritevline(long bx, long by, long cnt, long bufplc, long p)
{
char ch;
gbuf = (char *)bufplc;
if (transmode)
{
for(;cnt>1;cnt--)
{
ch = gbuf[(bx>>16)*glogy+(by>>16)];
if (ch != 255) *((char *)p) = gtrans[(*((char *)p))+(gpal[ch]<<8)];
bx += gbxinc;
by += gbyinc;
p += bpl;
}
}
else
{
for(;cnt>1;cnt--)
{
ch = gbuf[(bx>>16)*glogy+(by>>16)];
if (ch != 255) *((char *)p) = gtrans[((*((char *)p))<<8)+gpal[ch]];
bx += gbxinc;
by += gbyinc;
p += bpl;
}
}
}
void setupdrawslab (long dabpl, long pal)
{ bpl = dabpl; gpal = (char *)pal; }
void drawslab (long dx, long v, long dy, long vi, long vptr, long p)
{
long x;
while (dy > 0)
{
for(x=0;x<dx;x++) *(char *)(p+x) = gpal[(long)(*(char *)((v>>16)+vptr))];
p += bpl; v += vi; dy--;
}
}
void stretchhline (long p0, long u, long cnt, long uinc, long rptr, long p)
{
p0 = p-(cnt<<2);
do
{
p--;
*(char *)p = *(char *)((u>>16)+rptr); u -= uinc;
} while (p > p0);
}
void mmxoverlay() { }
/*
* vim:ts=4:
*/

2664
polymer/build/src/a.masm Normal file

File diff suppressed because it is too large Load Diff

2751
polymer/build/src/a.nasm Normal file

File diff suppressed because it is too large Load Diff

2420
polymer/build/src/a.wasm Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,206 @@
#include "compat.h"
#include "osd.h"
#include "build.h"
#include "engineinfo.h"
#include "baselayer.h"
#ifdef RENDERTYPEWIN
#include "winlayer.h"
#endif
#ifdef USE_OPENGL
struct glinfo glinfo = {
"Unknown", // vendor
"Unknown", // renderer
"0.0.0", // version
"", // extensions
1.0, // max anisotropy
0, // brga texture format
0, // clamp-to-edge support
0, // texture compression
0, // non-power-of-two textures
0, // multisampling
0, // nvidia multisampling hint
};
#endif
static int osdfunc_dumpbuildinfo(const osdfuncparm_t *parm)
{
OSD_Printf(
"Build engine compilation:\n"
" CFLAGS: %s\n"
" LIBS: %s\n"
" Host: %s\n"
" Compiler: %s\n"
" Built: %s\n",
_engine_cflags,
_engine_libs,
_engine_uname,
_engine_compiler,
_engine_date);
return OSDCMD_OK;
}
static void onvideomodechange(int newmode) { }
void (*baselayer_onvideomodechange)(int) = onvideomodechange;
static int osdfunc_setrendermode(const osdfuncparm_t *parm)
{
int m;
char *p;
char *modestrs[] = {
"classic software", "polygonal flat-shaded software",
"polygonal textured software", "polygonal OpenGL"
};
if (parm->numparms != 1) return OSDCMD_SHOWHELP;
m = Bstrtol(parm->parms[0], &p, 10);
if (m < 0 || m > 3) return OSDCMD_SHOWHELP;
setrendermode(m);
OSD_Printf("Rendering method changed to %s\n", modestrs[ getrendermode() ] );
return OSDCMD_OK;
}
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef DEBUGGINGAIDS
static int osdcmd_hicsetpalettetint(const osdfuncparm_t *parm)
{
long pal, cols[3], eff;
char *p;
if (parm->numparms != 5) return OSDCMD_SHOWHELP;
pal = Batol(parm->parms[0]);
cols[0] = Batol(parm->parms[1]);
cols[1] = Batol(parm->parms[2]);
cols[2] = Batol(parm->parms[3]);
eff = Batol(parm->parms[4]);
hicsetpalettetint(pal,cols[0],cols[1],cols[2],eff);
return OSDCMD_OK;
}
#endif
static int osdcmd_glinfo(const osdfuncparm_t *parm)
{
char *s,*t,*u,i;
if (bpp == 8) {
OSD_Printf("glinfo: Not in OpenGL mode.\n");
return OSDCMD_OK;
}
OSD_Printf("OpenGL Information:\n"
" Version: %s\n"
" Vendor: %s\n"
" Renderer: %s\n"
" Maximum anisotropy: %.1f%s\n"
" BGRA textures: %s\n"
" Non-x^2 textures: %s\n"
" Texure compression: %s\n"
" Clamp-to-edge: %s\n"
" Multisampling: %s\n"
" Nvidia multisample hint: %s\n"
" Extensions:\n",
glinfo.version,
glinfo.vendor,
glinfo.renderer,
glinfo.maxanisotropy, glinfo.maxanisotropy>1.0?"":" (no anisotropic filtering)",
glinfo.bgra ? "supported": "not supported",
glinfo.texnpot ? "supported": "not supported",
glinfo.texcompr ? "supported": "not supported",
glinfo.clamptoedge ? "supported": "not supported",
glinfo.multisample ? "supported": "not supported",
glinfo.nvmultisamplehint ? "supported": "not supported"
);
s = Bstrdup(glinfo.extensions);
if (!s) OSD_Printf(glinfo.extensions);
else {
i = 0; t = u = s;
while (*t) {
if (*t == ' ') {
if (i&1) {
*t = 0;
OSD_Printf(" %s\n",u);
u = t+1;
}
i++;
}
t++;
}
if (i&1) OSD_Printf(" %s\n",u);
Bfree(s);
}
return OSDCMD_OK;
}
#endif
static int osdcmd_vars(const osdfuncparm_t *parm)
{
int showval = (parm->numparms < 1);
if (!Bstrcasecmp(parm->name, "screencaptureformat")) {
const char *fmts[2][2] = { {"TGA", "PCX"}, {"0", "1"} };
if (showval) { OSD_Printf("captureformat is %s\n", fmts[captureformat]); }
else {
int i,j;
for (j=0; j<2; j++)
for (i=0; i<2; i++)
if (!Bstrcasecmp(parm->parms[0], fmts[j][i])) break;
if (j == 2) return OSDCMD_SHOWHELP;
captureformat = i;
}
return OSDCMD_OK;
}
#ifdef SUPERBUILD
else if (!Bstrcasecmp(parm->name, "novoxmips")) {
if (showval) { OSD_Printf("novoxmips is %d\n", novoxmips); }
else { novoxmips = (atoi(parm->parms[0]) != 0); }
}
else if (!Bstrcasecmp(parm->name, "usevoxels")) {
if (showval) { OSD_Printf("usevoxels is %d\n", usevoxels); }
else { usevoxels = (atoi(parm->parms[0]) != 0); }
}
#endif
return OSDCMD_SHOWHELP;
}
int baselayer_init(void)
{
#ifdef POLYMOST
OSD_RegisterFunction("setrendermode","setrendermode <number>: sets the engine's rendering mode.\n"
"Mode numbers are:\n"
" 0 - Classic Build software\n"
" 1 - Polygonal flat-shaded software\n"
" 2 - Polygonal textured software\n"
#ifdef USE_OPENGL
" 3 - Polygonal OpenGL\n"
#endif
,
osdfunc_setrendermode);
#endif
OSD_RegisterFunction("dumpbuildinfo","dumpbuildinfo: outputs engine compilation information",osdfunc_dumpbuildinfo);
OSD_RegisterFunction("screencaptureformat","screencaptureformat: sets the output format for screenshots (TGA or PCX)",osdcmd_vars);
#ifdef SUPERBUILD
OSD_RegisterFunction("novoxmips","novoxmips: turn off/on the use of mipmaps when rendering 8-bit voxels",osdcmd_vars);
OSD_RegisterFunction("usevoxels","usevoxels: enable/disable automatic sprite->voxel rendering",osdcmd_vars);
#endif
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef DEBUGGINGAIDS
OSD_RegisterFunction("hicsetpalettetint","hicsetpalettetint: sets palette tinting values",osdcmd_hicsetpalettetint);
#endif
OSD_RegisterFunction("glinfo","glinfo: shows OpenGL information about the current OpenGL mode",osdcmd_glinfo);
#endif
return 0;
}

574
polymer/build/src/bstub.c Normal file
View File

@ -0,0 +1,574 @@
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
// Ken Silverman's official web site: "http://www.advsys.net/ken"
// See the included license file "BUILDLIC.TXT" for license info.
//
// This file has been modified from Ken Silverman's original release
// by Jonathon Fowler (jonof@edgenetwk.com)
#include "compat.h"
#include "a.h"
#include "build.h"
#include "editor.h"
#include "pragmas.h"
#include "baselayer.h"
#include "names.h"
#include "osd.h"
#include "cache1d.h"
static char tempbuf[256];
#define NUMOPTIONS 9
char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0};
char keys[NUMBUILDKEYS] =
{
0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39,
0x1e,0x2c,0xd1,0xc9,0x33,0x34,
0x9c,0x1c,0xd,0xc,0xf,0x45
};
//static long hang = 0;
//static long rollangle = 0;
//Detecting 2D / 3D mode:
// qsetmode is 200 in 3D mode
// qsetmode is 350/480 in 2D mode
//
//You can read these variables when F5-F8 is pressed in 3D mode only:
//
// If (searchstat == 0) WALL searchsector=sector, searchwall=wall
// If (searchstat == 1) CEILING searchsector=sector
// If (searchstat == 2) FLOOR searchsector=sector
// If (searchstat == 3) SPRITE searchsector=sector, searchwall=sprite
// If (searchstat == 4) MASKED WALL searchsector=sector, searchwall=wall
//
// searchsector is the sector of the selected item for all 5 searchstat's
//
// searchwall is undefined if searchstat is 1 or 2
// searchwall is the wall if searchstat = 0 or 4
// searchwall is the sprite if searchstat = 3 (Yeah, I know - it says wall,
// but trust me, it's the sprite number)
long averagefps;
#define AVERAGEFRAMES 32
static unsigned long frameval[AVERAGEFRAMES];
static long framecnt = 0;
char *defsfilename = "kenbuild.def";
char *startwin_labeltext = "Starting Build Editor...";
int nextvoxid = 0;
int ExtPreInit(int *argc,char ***argv)
{
return 0;
}
int ExtInit(void)
{
long i, rv = 0;
/*printf("------------------------------------------------------------------------------\n");
printf(" BUILD.EXE copyright(c) 1996 by Ken Silverman. You are granted the\n");
printf(" right to use this software for your personal use only. This is a\n");
printf(" special version to be used with \"Happy Fun KenBuild\" and may not work\n");
printf(" properly with other Build engine games. Please refer to license.doc\n");
printf(" for distribution rights\n");
printf("------------------------------------------------------------------------------\n");
getch();
*/
initgroupfile("stuff.dat");
bpp = 8;
if (loadsetup("build.cfg") < 0) initprintf("Configuration file not found, using defaults.\n"), rv = 1;
Bmemcpy((void *)buildkeys,(void *)keys,NUMBUILDKEYS); //Trick to make build use setup.dat keys
if (option[4] > 0) option[4] = 0;
if (initengine()) {
wm_msgbox("Build Engine Initialisation Error",
"There was a problem initialising the Build engine: %s", engineerrstr);
return -1;
}
initinput();
initmouse();
//You can load your own palette lookup tables here if you just
//copy the right code!
for(i=0;i<256;i++)
tempbuf[i] = ((i+32)&255); //remap colors for screwy palette sectors
makepalookup(16,tempbuf,0,0,0,1);
kensplayerheight = 32;
zmode = 0;
defaultspritecstat = 0;
pskyoff[0] = 0; pskyoff[1] = 0; pskybits = 1;
#ifdef SUPERBUILD
tiletovox[PLAYER] = nextvoxid++;
tiletovox[BROWNMONSTER] = nextvoxid++;
#endif
#ifdef _WIN32
// allowtaskswitching(0);
#endif
return rv;
}
void ExtUnInit(void)
{
uninitgroupfile();
writesetup("build.cfg");
}
void ExtSetupSpecialSpriteCols(void)
{
return;
}
//static long daviewingrange, daaspect, horizval1, horizval2;
void ExtPreCheckKeys(void)
{
long /*cosang, sinang, dx, dy, mindx,*/ i, j, k;
if (keystatus[0x3e]) //F4 - screen re-size
{
keystatus[0x3e] = 0;
//cycle through all vesa modes, then screen-buffer mode
if (keystatus[0x2a]|keystatus[0x36]) {
setgamemode(!fullscreen, xdim, ydim, bpp);
} else {
//cycle through all modes
j=-1;
// work out a mask to select the mode
for (i=0; i<validmodecnt; i++)
if ((validmode[i].xdim == xdim) &&
(validmode[i].ydim == ydim) &&
(validmode[i].fs == fullscreen) &&
(validmode[i].bpp == bpp))
{ j=i; break; }
for (k=0; k<validmodecnt; k++)
if (validmode[k].fs == fullscreen && validmode[k].bpp == bpp) break;
if (j==-1) j=k;
else {
j++;
if (j==validmodecnt) j=k;
}
setgamemode(fullscreen,validmode[j].xdim,validmode[j].ydim,bpp);
}
}
#if 0
if (keystatus[0x2a]|keystatus[0x36])
{
if (keystatus[0xcf]) hang = max(hang-1,-182);
if (keystatus[0xc7]) hang = min(hang+1,182);
}
else
{
if (keystatus[0xcf]) hang = max(hang-8,-182);
if (keystatus[0xc7]) hang = min(hang+8,182);
}
if (keystatus[0x4c]) { hang = 0; horiz = 100; }
if (hang != 0)
{
walock[4094] = 255;
// JBF 20031117: scale each dimension by a factor of 1.2, and work out
// the aspect of the screen. Anywhere you see 'i' below was the value
// '200' before I changed it. NOTE: This whole trick crashes in resolutions
// above 800x600. I'm not sure why, and fixing it is not something I intend
// to do in a real big hurry.
dx = (xdim + (xdim >> 3) + (xdim >> 4) + (xdim >> 6)) & (~7);
dy = (ydim + (ydim >> 3) + (ydim >> 4) + (ydim >> 6)) & (~7);
i = scale(320,ydim,xdim);
if (waloff[4094] == 0) allocache(&waloff[4094],/*240L*384L*/dx*dy,&walock[4094]);
setviewtotile(4094,/*240L,384L*/dy,dx);
cosang = sintable[(hang+512)&2047];
sinang = sintable[hang&2047];
dx = dmulscale1(320,cosang,i,sinang); mindx = dx;
dy = dmulscale1(-i,cosang,320,sinang);
horizval1 = dy*(320>>1)/dx-1;
dx = dmulscale1(320,cosang,-i,sinang); mindx = min(dx,mindx);
dy = dmulscale1(i,cosang,320,sinang);
horizval2 = dy*(320>>1)/dx+1;
daviewingrange = scale(65536,16384*(xdim>>1),mindx-16);
daaspect = scale(daviewingrange,scale(320,tilesizx[4094],tilesizy[4094]),horizval2+6-horizval1);
setaspect(daviewingrange,scale(daaspect,ydim*320,xdim*i));
horiz = 100-divscale15(horizval1+horizval2,daviewingrange);
}
#endif
}
#ifdef SUPERBUILD
#define MAXVOXMIPS 5
extern char *voxoff[][MAXVOXMIPS];
void ExtAnalyzeSprites(void)
{
long i, *longptr;
spritetype *tspr;
for(i=0,tspr=&tsprite[0];i<spritesortcnt;i++,tspr++)
{
if (usevoxels && tiletovox[tspr->picnum] >= 0)
{
switch(tspr->picnum)
{
case PLAYER:
if (!voxoff[ tiletovox[PLAYER] ][0]) {
if (qloadkvx(tiletovox[PLAYER],"voxel000.kvx")) {
tiletovox[PLAYER] = -1;
break;
}
}
//tspr->cstat |= 48; tspr->picnum = tiletovox[tspr->picnum];
longptr = (long *)voxoff[ tiletovox[PLAYER] ][0];
tspr->xrepeat = scale(tspr->xrepeat,56,longptr[2]);
tspr->yrepeat = scale(tspr->yrepeat,56,longptr[2]);
tspr->shade -= 6;
break;
case BROWNMONSTER:
if (!voxoff[ tiletovox[BROWNMONSTER] ][0]) {
if (qloadkvx(tiletovox[BROWNMONSTER],"voxel001.kvx")) {
tiletovox[BROWNMONSTER] = -1;
break;
}
}
//tspr->cstat |= 48; tspr->picnum = tiletovox[tspr->picnum];
break;
}
}
tspr->shade += 6;
if (sector[tspr->sectnum].ceilingstat&1)
tspr->shade += sector[tspr->sectnum].ceilingshade;
else
tspr->shade += sector[tspr->sectnum].floorshade;
}
}
#endif
void ExtCheckKeys(void)
{
long i;//, p, y, dx, dy, cosang, sinang, bufplc, tsizy, tsizyup15;
long j;
if (qsetmode == 200) //In 3D mode
{
#if 0
if (hang != 0)
{
bufplc = waloff[4094]+(mulscale16(horiz-100,xdimenscale)+(tilesizx[4094]>>1))*tilesizy[4094];
setviewback();
cosang = sintable[(hang+512)&2047];
sinang = sintable[hang&2047];
dx = dmulscale1(xdim,cosang,ydim,sinang);
dy = dmulscale1(-ydim,cosang,xdim,sinang);
begindrawing();
tsizy = tilesizy[4094];
tsizyup15 = (tsizy<<15);
dx = mulscale14(dx,daviewingrange);
dy = mulscale14(dy,daaspect);
sinang = mulscale14(sinang,daviewingrange);
cosang = mulscale14(cosang,daaspect);
p = ylookup[windowy1]+frameplace+windowx2+1;
for(y=windowy1;y<=windowy2;y++)
{
i = divscale16(tsizyup15,dx);
stretchhline(0,(xdim>>1)*i+tsizyup15,xdim>>2,i,mulscale32(i,dy)*tsizy+bufplc,p);
dx -= sinang; dy += cosang; p += ylookup[1];
}
walock[4094] = 1;
Bsprintf(tempbuf,"%d",(hang*180)>>10);
printext256(0L,8L,31,-1,tempbuf,1);
enddrawing();
}
#endif
if (keystatus[0xa]) setaspect(viewingrange+(viewingrange>>8),yxaspect+(yxaspect>>8));
if (keystatus[0xb]) setaspect(viewingrange-(viewingrange>>8),yxaspect-(yxaspect>>8));
if (keystatus[0xc]) setaspect(viewingrange,yxaspect-(yxaspect>>8));
if (keystatus[0xd]) setaspect(viewingrange,yxaspect+(yxaspect>>8));
//if (keystatus[0x38]) setrollangle(rollangle+=((keystatus[0x2a]|keystatus[0x36])*6+2));
//if (keystatus[0xb8]) setrollangle(rollangle-=((keystatus[0x2a]|keystatus[0x36])*6+2));
//if (keystatus[0x1d]|keystatus[0x9d]) setrollangle(rollangle=0);
begindrawing();
i = frameval[framecnt&(AVERAGEFRAMES-1)];
j = frameval[framecnt&(AVERAGEFRAMES-1)] = getticks(); framecnt++;
if (i != j) averagefps = ((mul3(averagefps)+((AVERAGEFRAMES*1000)/(j-i)) )>>2);
Bsprintf(tempbuf,"%ld",averagefps);
printext256(0L,0L,31,-1,tempbuf,1);
enddrawing();
editinput();
}
else
{
}
}
void ExtCleanUp(void)
{
}
void ExtPreLoadMap(void)
{
}
void ExtLoadMap(const char *mapname)
{
char title[256];
Bsprintf(title, "BUILD by Ken Silverman - %s", mapname);
wm_setapptitle(title);
}
void ExtPreSaveMap(void)
{
}
void ExtSaveMap(const char *mapname)
{
}
const char *ExtGetSectorCaption(short sectnum)
{
if ((sector[sectnum].lotag|sector[sectnum].hitag) == 0)
{
tempbuf[0] = 0;
}
else
{
Bsprintf(tempbuf,"%hu,%hu",(unsigned short)sector[sectnum].hitag,
(unsigned short)sector[sectnum].lotag);
}
return(tempbuf);
}
const char *ExtGetWallCaption(short wallnum)
{
if ((wall[wallnum].lotag|wall[wallnum].hitag) == 0)
{
tempbuf[0] = 0;
}
else
{
Bsprintf(tempbuf,"%hu,%hu",(unsigned short)wall[wallnum].hitag,
(unsigned short)wall[wallnum].lotag);
}
return(tempbuf);
}
const char *ExtGetSpriteCaption(short spritenum)
{
if ((sprite[spritenum].lotag|sprite[spritenum].hitag) == 0)
{
tempbuf[0] = 0;
}
else
{
Bsprintf(tempbuf,"%hu,%hu",(unsigned short)sprite[spritenum].hitag,
(unsigned short)sprite[spritenum].lotag);
}
return(tempbuf);
}
//printext16 parameters:
//printext16(long xpos, long ypos, short col, short backcol,
// char name[82], char fontsize)
// xpos 0-639 (top left)
// ypos 0-479 (top left)
// col 0-15
// backcol 0-15, -1 is transparent background
// name
// fontsize 0=8*8, 1=3*5
//drawline16 parameters:
// drawline16(long x1, long y1, long x2, long y2, char col)
// x1, x2 0-639
// y1, y2 0-143 (status bar is 144 high, origin is top-left of STATUS BAR)
// col 0-15
void ExtShowSectorData(short sectnum) //F5
{
int i;
if (qsetmode == 200) //In 3D mode
{
}
else
{
begindrawing();
clearmidstatbar16(); //Clear middle of status bar
Bsprintf(tempbuf,"Sector %d",sectnum);
printext16(8,ydim16+32,11,-1,tempbuf,0);
printext16(8,ydim16+48,11,-1,"8*8 font: ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789",0);
printext16(8,ydim16+56,11,-1,"3*5 font: ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789",1);
i=ydim16; ydim16=ydim;
drawline16(320,i+68,344,i+80,4); //Draw house
drawline16(344,i+80,344,i+116,4);
drawline16(344,i+116,296,i+116,4);
drawline16(296,i+116,296,i+80,4);
drawline16(296,i+80,320,i+68,4);
ydim16=i;
enddrawing();
}
}
void ExtShowWallData(short wallnum) //F6
{
if (qsetmode == 200) //In 3D mode
{
}
else
{
begindrawing();
clearmidstatbar16(); //Clear middle of status bar
Bsprintf(tempbuf,"Wall %d",wallnum);
printext16(8,ydim16+32,11,-1,tempbuf,0);
enddrawing();
}
}
void ExtShowSpriteData(short spritenum) //F6
{
if (qsetmode == 200) //In 3D mode
{
}
else
{
begindrawing();
clearmidstatbar16(); //Clear middle of status bar
Bsprintf(tempbuf,"Sprite %d",spritenum);
printext16(8,ydim16+32,11,-1,tempbuf,0);
enddrawing();
}
}
void ExtEditSectorData(short sectnum) //F7
{
short nickdata;
if (qsetmode == 200) //In 3D mode
{
//Ceiling
if (searchstat == 1)
sector[searchsector].ceilingpicnum++; //Just a stupid example
//Floor
if (searchstat == 2)
sector[searchsector].floorshade++; //Just a stupid example
}
else //In 2D mode
{
Bsprintf(tempbuf,"Sector (%d) Nick's variable: ",sectnum);
nickdata = 0;
nickdata = getnumber16(tempbuf,nickdata,65536L,0);
printmessage16(""); //Clear message box (top right of status bar)
ExtShowSectorData(sectnum);
}
}
void ExtEditWallData(short wallnum) //F8
{
short nickdata;
if (qsetmode == 200) //In 3D mode
{
}
else
{
Bsprintf(tempbuf,"Wall (%d) Nick's variable: ",wallnum);
nickdata = 0;
nickdata = getnumber16(tempbuf,nickdata,65536L,0);
printmessage16(""); //Clear message box (top right of status bar)
ExtShowWallData(wallnum);
}
}
void ExtEditSpriteData(short spritenum) //F8
{
short nickdata;
if (qsetmode == 200) //In 3D mode
{
}
else
{
Bsprintf(tempbuf,"Sprite (%d) Nick's variable: ",spritenum);
nickdata = 0;
nickdata = getnumber16(tempbuf,nickdata,65536L,0);
printmessage16("");
printmessage16(""); //Clear message box (top right of status bar)
ExtShowSpriteData(spritenum);
}
}
void faketimerhandler(void)
{
sampletimer();
}
//Just thought you might want my getnumber16 code
/*
getnumber16(char namestart[80], short num, long maxnumber)
{
char buffer[80];
long j, k, n, danum, oldnum;
danum = (long)num;
oldnum = danum;
while ((keystatus[0x1c] != 2) && (keystatus[0x1] == 0)) //Enter, ESC
{
sprintf(&buffer,"%s%ld_ ",namestart,danum);
printmessage16(buffer);
for(j=2;j<=11;j++) //Scan numbers 0-9
if (keystatus[j] > 0)
{
keystatus[j] = 0;
k = j-1;
if (k == 10) k = 0;
n = (danum*10)+k;
if (n < maxnumber) danum = n;
}
if (keystatus[0xe] > 0) // backspace
{
danum /= 10;
keystatus[0xe] = 0;
}
if (keystatus[0x1c] == 1) //L. enter
{
oldnum = danum;
keystatus[0x1c] = 2;
asksave = 1;
}
}
keystatus[0x1c] = 0;
keystatus[0x1] = 0;
return((short)oldnum);
}
*/
/*
* vim:ts=4:
*/

7422
polymer/build/src/build.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,178 @@
#ifndef RENDERTYPEWIN
#error Only for Windows
#endif
#include "build.h"
#include "editor.h"
#include "winlayer.h"
#include "compat.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
#include <stdio.h>
#define IDCFULLSCREEN 100
#define IDC2DVMODE 101
#define IDC3DVMODE 102
static void PopulateVideoModeLists(int fs, HWND list2d, HWND list3d)
{
int i,j;
char buf[64];
ComboBox_ResetContent(list2d);
ComboBox_ResetContent(list3d);
for (i=0; i<validmodecnt; i++) {
if (validmode[i].fs != fs) continue;
// all modes get added to the 3D mode list
Bsprintf(buf, "%ldx%ld %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp);
j = ComboBox_AddString(list3d, buf);
ComboBox_SetItemData(list3d, j, i);
if (xdimgame == validmode[i].xdim && ydimgame == validmode[i].ydim && bppgame == validmode[i].bpp)
ComboBox_SetCurSel(list3d, j);
// only 8-bit modes get used for 2D
if (validmode[i].bpp != 8) continue;
Bsprintf(buf, "%ldx%ld", validmode[i].xdim, validmode[i].ydim);
j = ComboBox_AddString(list2d, buf);
ComboBox_SetItemData(list2d, j, i);
if (xdim2d == validmode[i].xdim && ydim2d == validmode[i].ydim && 8 == validmode[i].bpp)
ComboBox_SetCurSel(list2d, j);
}
}
static INT_PTR CALLBACK LaunchWindowProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
case WM_INITDIALOG: {
char buf[64];
if (lParam) {
long *saferect = (long*)lParam;
RECT unresized, playbutton, exitbutton;
int dx, dy;
GetWindowRect(hwndDlg, &unresized);
GetWindowRect(GetDlgItem(hwndDlg, IDOK), &playbutton);
GetWindowRect(GetDlgItem(hwndDlg, IDCANCEL), &exitbutton);
playbutton.right = 1 + playbutton.right - playbutton.left;
playbutton.bottom = 1 + playbutton.bottom - playbutton.top;
exitbutton.right = 1 + exitbutton.right - exitbutton.left;
exitbutton.bottom = 1 + exitbutton.bottom - exitbutton.top;
playbutton.left = playbutton.left - unresized.left;
playbutton.top = playbutton.top - unresized.top;
exitbutton.left = exitbutton.left - unresized.left;
exitbutton.top = exitbutton.top - unresized.top;
dx = saferect[2] - (unresized.right - unresized.left);
dy = saferect[3] - (unresized.bottom - unresized.top);
playbutton.left += dx; exitbutton.left += dx;
playbutton.top += dy; exitbutton.top += dy;
// reposition the dialog, play and exit buttons
MoveWindow(hwndDlg, saferect[0], saferect[1], saferect[2], saferect[3], FALSE);
MoveWindow(GetDlgItem(hwndDlg, IDOK),
playbutton.left, playbutton.top, playbutton.right, playbutton.bottom, FALSE);
MoveWindow(GetDlgItem(hwndDlg, IDCANCEL),
exitbutton.left, exitbutton.top, exitbutton.right, exitbutton.bottom, FALSE);
}
// populate the controls
Button_SetCheck(GetDlgItem(hwndDlg, IDCFULLSCREEN), fullscreen ? BST_CHECKED : BST_UNCHECKED);
PopulateVideoModeLists(fullscreen, GetDlgItem(hwndDlg, IDC2DVMODE), GetDlgItem(hwndDlg, IDC3DVMODE));
ShowWindow(hwndDlg, SW_SHOW);
/*
if (GetDlgCtrlID((HWND)wParam) != IDOK) {
SetFocus(GetDlgItem(hwndDlg, IDOK));
return FALSE;
}
*/
return TRUE;
}
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDCFULLSCREEN:
fullscreen = Button_GetCheck((HWND)lParam) == BST_CHECKED ? 1:0;
PopulateVideoModeLists(fullscreen, GetDlgItem(hwndDlg, IDC2DVMODE),
GetDlgItem(hwndDlg, IDC3DVMODE));
break;
case IDC2DVMODE:
if (HIWORD(wParam) == CBN_SELCHANGE) {
int i;
i = ComboBox_GetCurSel((HWND)lParam);
if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i);
if (i != CB_ERR) {
xdim2d = validmode[i].xdim;
ydim2d = validmode[i].ydim;
}
}
break;
case IDC3DVMODE:
if (HIWORD(wParam) == CBN_SELCHANGE) {
int i;
i = ComboBox_GetCurSel((HWND)lParam);
if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i);
if (i != CB_ERR) {
xdimgame = validmode[i].xdim;
ydimgame = validmode[i].ydim;
bppgame = validmode[i].bpp;
}
}
break;
case IDCANCEL:
quitevent = 1; // fall through
case IDOK:
DestroyWindow(hwndDlg);
return TRUE;
default: break;
}
break;
default: break;
}
return FALSE;
}
int DoLaunchWindow(int initval)
{
HWND hwndStart, hwndLaunch;
MSG msg;
long saferect[4];
int x;
// only show config window if no config is loaded, or if it is, only if left control is held
if (initval == 0 /*&& !GetAsyncKeyState(VK_CONTROL)*/) return 0;
if (win_getstartupwin((long*)&hwndStart, saferect, NULL)) return 0;
hwndLaunch = CreateDialogParam((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(2000), hwndStart, LaunchWindowProc, (LPARAM)saferect);
if (hwndLaunch) {
EnableWindow(GetDlgItem(hwndStart,WIN_STARTWIN_ITEMLIST),FALSE);
#if 0
while (GetMessage(&msg, NULL, 0, 0) > 0) {
if (!IsWindow(hwndLaunch) || quitevent) break;
if (IsDialogMessage(hwndStart, &msg) /*|| IsDialogMessage(hwndLaunch, &msg)*/) continue;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
#else
while (IsWindow(hwndLaunch) && !quitevent) {
x = win_getstartupcommand();
if (x != 0) LaunchWindowProc(hwndLaunch, WM_COMMAND, x, 0);
handleevents();
}
#endif
EnableWindow(GetDlgItem(hwndStart,WIN_STARTWIN_ITEMLIST),TRUE);
}
if (quitevent) return 1;
return 0;
}

1301
polymer/build/src/cache1d.c Normal file

File diff suppressed because it is too large Load Diff

716
polymer/build/src/compat.c Normal file
View File

@ -0,0 +1,716 @@
/*
* Playing-field leveller for Build
* by Jonathon Fowler
*
* A note about this:
* 1. There is some kind of problem somewhere in the functions below because
* compiling with __compat_h_macrodef__ disabled makes stupid things happen.
* 2. The functions below, aside from the ones which aren't trivial, were never
* really intended to be used for anything except tracking anr removing ties
* to the standard C library from games. Using the Bxx versions of functions
* means we can redefine those names to link up with different runtime library
* names.
*/
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#define _WIN32_IE 0x0400
#include <windows.h>
#include <shlobj.h>
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#if defined(__WATCOMC__)
# include <direct.h>
#elif defined(_MSC_VER)
# include <io.h>
#else
# include <dirent.h>
#endif
#include "compat.h"
#ifndef __compat_h_macrodef__
int Brand(void)
{
return rand();
}
void *Bmalloc(bsize_t size)
{
return malloc(size);
}
void Bfree(void *ptr)
{
free(ptr);
}
int Bopen(const char *pathname, int flags, unsigned mode)
{
int n=0,o=0;
if (flags&BO_BINARY) n|=O_BINARY; else n|=O_TEXT;
if ((flags&BO_RDWR)==BO_RDWR) n|=O_RDWR;
else if ((flags&BO_RDWR)==BO_WRONLY) n|=O_WRONLY;
else if ((flags&BO_RDWR)==BO_RDONLY) n|=O_RDONLY;
if (flags&BO_APPEND) n|=O_APPEND;
if (flags&BO_CREAT) n|=O_CREAT;
if (flags&BO_TRUNC) n|=O_TRUNC;
if (mode&BS_IREAD) o|=S_IREAD;
if (mode&BS_IWRITE) o|=S_IWRITE;
if (mode&BS_IEXEC) o|=S_IEXEC;
return open(pathname,n,o);
}
int Bclose(int fd)
{
return close(fd);
}
bssize_t Bwrite(int fd, const void *buf, bsize_t count)
{
return write(fd,buf,count);
}
bssize_t Bread(int fd, void *buf, bsize_t count)
{
return read(fd,buf,count);
}
int Blseek(int fildes, int offset, int whence)
{
switch (whence) {
case BSEEK_SET: whence=SEEK_SET; break;
case BSEEK_CUR: whence=SEEK_CUR; break;
case BSEEK_END: whence=SEEK_END; break;
}
return lseek(fildes,offset,whence);
}
BFILE *Bfopen(const char *path, const char *mode)
{
return (BFILE*)fopen(path,mode);
}
int Bfclose(BFILE *stream)
{
return fclose((FILE*)stream);
}
void Brewind(BFILE *stream)
{
rewind((FILE*)stream);
}
int Bfgetc(BFILE *stream)
{
return fgetc((FILE*)stream);
}
char *Bfgets(char *s, int size, BFILE *stream)
{
return fgets(s,size,(FILE*)stream);
}
int Bfputc(int c, BFILE *stream)
{
return fputc(c,(FILE*)stream);
}
int Bfputs(const char *s, BFILE *stream)
{
return fputs(s,(FILE*)stream);
}
bsize_t Bfread(void *ptr, bsize_t size, bsize_t nmemb, BFILE *stream)
{
return fread(ptr,size,nmemb,(FILE*)stream);
}
bsize_t Bfwrite(const void *ptr, bsize_t size, bsize_t nmemb, BFILE *stream)
{
return fwrite(ptr,size,nmemb,(FILE*)stream);
}
char *Bstrdup(const char *s)
{
return strdup(s);
}
char *Bstrcpy(char *dest, const char *src)
{
return strcpy(dest,src);
}
char *Bstrncpy(char *dest, const char *src, bsize_t n)
{
return strncpy(dest,src,n);
}
int Bstrcmp(const char *s1, const char *s2)
{
return strcmp(s1,s2);
}
int Bstrncmp(const char *s1, const char *s2, bsize_t n)
{
return strncmp(s1,s2,n);
}
int Bstrcasecmp(const char *s1, const char *s2)
{
#ifdef _MSC_VER
return stricmp(s1,s2);
#else
return strcasecmp(s1,s2);
#endif
}
int Bstrncasecmp(const char *s1, const char *s2, bsize_t n)
{
#ifdef _MSC_VER
return strnicmp(s1,s2,n);
#else
return strncasecmp(s1,s2,n);
#endif
}
char *Bstrcat(char *dest, const char *src)
{
return strcat(dest,src);
}
char *Bstrncat(char *dest, const char *src, bsize_t n)
{
return strncat(dest,src,n);
}
bsize_t Bstrlen(const char *s)
{
return strlen(s);
}
char *Bstrchr(const char *s, int c)
{
return strchr(s,c);
}
char *Bstrrchr(const char *s, int c)
{
return strrchr(s,c);
}
int Batoi(const char *nptr)
{
return atoi(nptr);
}
long Batol(const char *nptr)
{
return atol(nptr);
}
long int Bstrtol(const char *nptr, char **endptr, int base)
{
return strtol(nptr,endptr,base);
}
unsigned long int Bstrtoul(const char *nptr, char **endptr, int base)
{
return strtoul(nptr,endptr,base);
}
void *Bmemcpy(void *dest, const void *src, bsize_t n)
{
return memcpy(dest,src,n);
}
void *Bmemmove(void *dest, const void *src, bsize_t n)
{
return memmove(dest,src,n);
}
void *Bmemchr(const void *s, int c, bsize_t n)
{
return memchr(s,c,n);
}
void *Bmemset(void *s, int c, bsize_t n)
{
return memset(s,c,n);
}
int Bprintf(const char *format, ...)
{
va_list ap;
int r;
va_start(ap,format);
#ifdef _MSC_VER
r = _vprintf(format,ap);
#else
r = vprintf(format,ap);
#endif
va_end(ap);
return r;
}
int Bsprintf(char *str, const char *format, ...)
{
va_list ap;
int r;
va_start(ap,format);
#ifdef _MSC_VER
r = _vsprintf(str,format,ap);
#else
r = vsprintf(str,format,ap);
#endif
va_end(ap);
return r;
}
int Bsnprintf(char *str, bsize_t size, const char *format, ...)
{
va_list ap;
int r;
va_start(ap,format);
#ifdef _MSC_VER
r = _vsnprintf(str,size,format,ap);
#else
r = vsnprintf(str,size,format,ap);
#endif
va_end(ap);
return r;
}
int Bvsnprintf(char *str, bsize_t size, const char *format, va_list ap)
{
#ifdef _MSC_VER
return _vsnprintf(str,size,format,ap);
#else
return vsnprintf(str,size,format,ap);
#endif
}
char *Bgetenv(const char *name)
{
return getenv(name);
}
char *Bgetcwd(char *buf, bsize_t size)
{
return getcwd(buf,size);
}
#endif // __compat_h_macrodef__
//
// Stuff which must be a function
//
char *Bgethomedir(void)
{
#ifdef _WIN32
TCHAR appdata[MAX_PATH];
//# if defined SHGetFolderPath
// if (SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_APPDATA, NULL, 0, appdata)))
//# if defined SHGetSpecialFolderPath
if (SUCCEEDED(SHGetSpecialFolderPathA(NULL, appdata, CSIDL_APPDATA, FALSE)))
//# else
//# error Cannot find SHGetFolderPath or SHGetSpecialFolderPath. Perhaps your shlobj.h is ancient?
//# endif
return strdup(appdata);
return NULL;
#else
char *e = getenv("HOME");
if (!e) return NULL;
return strdup(e);
#endif
}
int Bcorrectfilename(char *filename, int removefn)
{
char *fn;
char *tokarr[64], *first, *next, *token;
int i, ntok = 0, leadslash = 0, trailslash = 0;
fn = strdup(filename);
if (!fn) return -1;
for (first=fn; *first; first++) {
#ifdef _WIN32
if (*first == '\\') *first = '/';
#endif
}
leadslash = (*fn == '/');
trailslash = (first>fn && first[-1] == '/');
first = fn;
do {
token = Bstrtoken(first, "/", &next, 1);
first = NULL;
if (!token) break;
else if (token[0] == 0) continue;
else if (token[0] == '.' && token[1] == 0) continue;
else if (token[0] == '.' && token[1] == '.' && token[2] == 0) ntok = max(0,ntok-1);
else tokarr[ntok++] = token;
} while (1);
if (!trailslash && removefn) { ntok = max(0,ntok-1); trailslash = 1; }
if (ntok == 0 && trailslash && leadslash) trailslash = 0;
first = filename;
if (leadslash) *(first++) = '/';
for (i=0; i<ntok; i++) {
if (i>0) *(first++) = '/';
for (token=tokarr[i]; *token; token++)
*(first++) = *token;
}
if (trailslash) *(first++) = '/';
*(first++) = 0;
return 0;
}
int Bcanonicalisefilename(char *filename, int removefn)
{
char cwd[BMAX_PATH], fn[BMAX_PATH], *p;
char *fnp = filename;
#ifdef _WIN32
int drv = 0;
#endif
#ifdef _WIN32
{
if (filename[0] && filename[1] == ':') {
// filename is prefixed with a drive
drv = toupper(filename[0])-'A' + 1;
fnp += 2;
}
if (!_getdcwd(drv, cwd, sizeof(cwd))) return -1;
for (p=cwd; *p; p++) if (*p == '\\') *p = '/';
}
#else
if (!getcwd(cwd,sizeof(cwd))) return -1;
#endif
p = strrchr(cwd,'/'); if (!p || p[1]) strcat(cwd, "/");
strcpy(fn, fnp);
#ifdef _WIN32
for (p=fn; *p; p++) if (*p == '\\') *p = '/';
#endif
if (fn[0] != '/') {
// we are dealing with a path relative to the current directory
strcpy(filename, cwd);
strcat(filename, fn);
} else {
#ifdef _WIN32
filename[0] = cwd[0];
filename[1] = ':';
filename[2] = 0;
#else
filename[0] = 0;
#endif
strcat(filename, fn);
}
fnp = filename;
#ifdef _WIN32
fnp += 2; // skip the drive
#endif
return Bcorrectfilename(fnp,1);
}
char *Bgetsystemdrives(void)
{
#ifdef _WIN32
char *str, *p;
DWORD drv, mask;
int number=0;
drv = GetLogicalDrives();
if (drv == 0) return NULL;
for (mask=1; mask<0x8000000l; mask<<=1) {
if ((drv&mask) == 0) continue;
number++;
}
str = p = (char *)malloc(1 + (3*number));
if (!str) return NULL;
number = 0;
for (mask=1; mask<0x8000000l; mask<<=1, number++) {
if ((drv&mask) == 0) continue;
*(p++) = 'A' + number;
*(p++) = ':';
*(p++) = 0;
}
*(p++) = 0;
return str;
#else
// Perhaps have Unix OS's put /, /home/user, and /mnt/* in the "drives" list?
return NULL;
#endif
}
long Bfilelength(int fd)
{
struct stat st;
if (fstat(fd, &st) < 0) return -1;
return(long)(st.st_size);
}
typedef struct {
#ifdef _MSC_VER
long dir;
struct _finddata_t fid;
#else
DIR *dir;
#endif
struct Bdirent info;
int status;
char name[1];
} BDIR_real;
BDIR* Bopendir(const char *name)
{
BDIR_real *dirr;
#ifdef _MSC_VER
char *t,*tt;
t = (char*)malloc(strlen(name)+1+4);
if (!t) return NULL;
#endif
dirr = (BDIR_real*)malloc(sizeof(BDIR_real) + strlen(name));
if (!dirr) {
#ifdef _MSC_VER
free(t);
#endif
return NULL;
}
#ifdef _MSC_VER
strcpy(t,name);
tt = t+strlen(name)-1;
while (*tt == ' ' && tt>t) tt--;
if (*tt != '/' && *tt != '\\') *(++tt) = '/';
*(++tt) = '*';
*(++tt) = '.';
*(++tt) = '*';
*(++tt) = 0;
dirr->dir = _findfirst(t,&dirr->fid);
free(t);
if (dirr->dir == -1) {
free(dirr);
return NULL;
}
#else
dirr->dir = opendir(name);
if (dirr->dir == NULL) {
free(dirr);
return NULL;
}
#endif
dirr->status = 0;
strcpy(dirr->name, name);
return (BDIR*)dirr;
}
struct Bdirent* Breaddir(BDIR *dir)
{
BDIR_real *dirr = (BDIR_real*)dir;
struct dirent *de;
struct stat st;
char *fn;
#ifdef _MSC_VER
if (dirr->status > 0) {
if (_findnext(dirr->dir,&dirr->fid) != 0) {
dirr->status = -1;
return NULL;
}
}
dirr->info.namlen = strlen(dirr->fid.name);
dirr->info.name = dirr->fid.name;
dirr->status++;
#else
de = readdir(dirr->dir);
if (de == NULL) {
dirr->status = -1;
return NULL;
} else {
dirr->status++;
}
//# if defined(__WATCOMC__) || defined(__linux) || defined(__BEOS__) || defined(__QNX__) || defined(SKYOS)
dirr->info.namlen = strlen(de->d_name);
//# else
// dirr->info.namlen = de->d_namlen;
//# endif
dirr->info.name = de->d_name;
#endif
dirr->info.mode = 0;
dirr->info.size = 0;
dirr->info.mtime = 0;
fn = (char *)malloc(strlen(dirr->name) + 1 + dirr->info.namlen + 1);
if (fn) {
sprintf(fn,"%s/%s",dirr->name,dirr->info.name);
if (!stat(fn, &st)) {
dirr->info.mode = st.st_mode;
dirr->info.size = st.st_size;
dirr->info.mtime = st.st_mtime;
}
free(fn);
}
return &dirr->info;
}
int Bclosedir(BDIR *dir)
{
BDIR_real *dirr = (BDIR_real*)dir;
#ifdef _MSC_VER
_findclose(dirr->dir);
#else
closedir(dirr->dir);
#endif
free(dirr);
return 0;
}
char *Bstrtoken(char *s, char *delim, char **ptrptr, int chop)
{
char *p, *start;
if (!ptrptr) return NULL;
if (s) p = s;
else p = *ptrptr;
if (!p) return NULL;
while (*p != 0 && strchr(delim, *p)) p++;
if (*p == 0) {
*ptrptr = NULL;
return NULL;
}
start = p;
while (*p != 0 && !strchr(delim, *p)) p++;
if (*p == 0) *ptrptr = NULL;
else {
if (chop) *(p++) = 0;
*ptrptr = p;
}
return start;
}
//Brute-force case-insensitive, slash-insensitive, * and ? wildcard matcher
//Given: string i and string j. string j can have wildcards
//Returns: 1:matches, 0:doesn't match
long Bwildmatch (const char *i, const char *j)
{
const char *k;
char c0, c1;
if (!*j) return(1);
do
{
if (*j == '*')
{
for(k=i,j++;*k;k++) if (Bwildmatch(k,j)) return(1);
continue;
}
if (!*i) return(0);
if (*j == '?') { i++; j++; continue; }
c0 = *i; if ((c0 >= 'a') && (c0 <= 'z')) c0 -= 32;
c1 = *j; if ((c1 >= 'a') && (c1 <= 'z')) c1 -= 32;
#ifdef _WIN32
if (c0 == '/') c0 = '\\';
if (c1 == '/') c1 = '\\';
#endif
if (c0 != c1) return(0);
i++; j++;
} while (*j);
return(!*i);
}
#if !defined(_WIN32)
char *Bstrlwr(char *s)
{
char *t = s;
if (!s) return s;
while (*t) { *t = Btolower(*t); t++; }
return s;
}
char *Bstrupr(char *s)
{
char *t = s;
if (!s) return s;
while (*t) { *t = Btoupper(*t); t++; }
return s;
}
#endif
//
// getsysmemsize() -- gets the amount of system memory in the machine
//
unsigned int Bgetsysmemsize(void)
{
#ifdef _WIN32
MEMORYSTATUS memst;
GlobalMemoryStatus(&memst);
return (unsigned int)memst.dwTotalPhys;
#elif (defined(_SC_PAGE_SIZE) || defined(_SC_PAGESIZE)) && defined(_SC_PHYS_PAGES)
unsigned int siz = 0x7fffffff;
long scpagesiz, scphyspages;
#ifdef _SC_PAGE_SIZE
scpagesiz = sysconf(_SC_PAGE_SIZE);
#else
scpagesiz = sysconf(_SC_PAGESIZE);
#endif
scphyspages = sysconf(_SC_PHYS_PAGES);
if (scpagesiz >= 0 && scphyspages >= 0)
siz = (unsigned int)min(longlong(0x7fffffff), (int64)scpagesiz * (int64)scphyspages);
//initprintf("Bgetsysmemsize(): %d pages of %d bytes, %d bytes of system memory\n",
// scphyspages, scpagesiz, siz);
return siz;
#else
return 0x7fffffff;
#endif
}

307
polymer/build/src/config.c Normal file
View File

@ -0,0 +1,307 @@
// Evil and Nasty Configuration File Reader for KenBuild
// by Jonathon Fowler
#include "compat.h"
#include "build.h"
#include "editor.h"
#include "osd.h"
#ifdef RENDERTYPEWIN
#include "winlayer.h"
#endif
#include "baselayer.h"
static long vesares[13][2] = {{320,200},{360,200},{320,240},{360,240},{320,400},
{360,400},{640,350},{640,400},{640,480},{800,600},
{1024,768},{1280,1024},{1600,1200}};
static int readconfig(BFILE *fp, const char *key, char *value, unsigned len)
{
char buf[1000], *k, *v, *eq;
int x=0;
if (len < 1) return 0;
Brewind(fp);
while (1) {
if (!Bfgets(buf, 1000, fp)) return 0;
if (buf[0] == ';') continue;
eq = Bstrchr(buf, '=');
if (!eq) continue;
k = buf;
v = eq+1;
while (*k == ' ' || *k == '\t') k++;
*(eq--) = 0;
while ((*eq == ' ' || *eq == '\t') && eq>=k) *(eq--) = 0;
if (Bstrcasecmp(k, key)) continue;
while (*v == ' ' || *k == '\t') v++;
eq = v + Bstrlen(v)-1;
while ((*eq == ' ' || *eq == '\t' || *eq == '\r' || *eq == '\n') && eq>=v) *(eq--) = 0;
value[--len] = 0;
do value[x] = v[x]; while (v[x++] != 0 && len-- > 0);
return x-1;
}
}
extern short brightness;
extern long fullscreen;
extern char option[8];
extern char keys[NUMBUILDKEYS];
extern double msens;
/*
* SETUP.DAT
* 0 = video mode (0:chained 1:vesa 2:screen buffered 3/4/5:tseng/paradise/s3 6:red-blue)
* 1 = sound (0:none)
* 2 = music (0:none)
* 3 = input (0:keyboard 1:+mouse)
* 4 = multiplayer (0:single 1-4:com 5-11:ipx)
* 5&0xf0 = com speed
* 5&0x0f = com irq
* 6&0xf0 = chained y-res
* 6&0x0f = chained x-res or vesa mode
* 7&0xf0 = sound samplerate
* 7&0x01 = sound quality
* 7&0x02 = 8/16 bit
* 7&0x04 = mono/stereo
*
* bytes 8 to 26 are key settings:
* 0 = Forward (0xc8)
* 1 = Backward (0xd0)
* 2 = Turn left (0xcb)
* 3 = Turn right (0xcd)
* 4 = Run (0x2a)
* 5 = Strafe (0x9d)
* 6 = Fire (0x1d)
* 7 = Use (0x39)
* 8 = Stand high (0x1e)
* 9 = Stand low (0x2c)
* 10 = Look up (0xd1)
* 11 = Look down (0xc9)
* 12 = Strafe left (0x33)
* 13 = Strafe right (0x34)
* 14 = 2D/3D switch (0x9c)
* 15 = View cycle (0x1c)
* 16 = 2D Zoom in (0xd)
* 17 = 2D Zoom out (0xc)
* 18 = Chat (0xf)
*/
int loadsetup(const char *fn)
{
BFILE *fp;
#define VL 32
char val[VL];
int i;
if ((fp = Bfopen(fn, "rt")) == NULL) return -1;
if (readconfig(fp, "fullscreen", val, VL) > 0) { if (Batoi(val) != 0) fullscreen = 1; else fullscreen = 0; }
if (readconfig(fp, "resolution", val, VL) > 0) {
i = Batoi(val) & 0x0f;
if ((unsigned)i<13) { xdimgame = xdim2d = vesares[i][0]; ydimgame = ydim2d = vesares[i][1]; }
}
if (readconfig(fp, "2dresolution", val, VL) > 0) {
i = Batoi(val) & 0x0f;
if ((unsigned)i<13) { xdim2d = vesares[i][0]; ydim2d = vesares[i][1]; }
}
if (readconfig(fp, "xdim2d", val, VL) > 0) xdim2d = Batoi(val);
if (readconfig(fp, "ydim2d", val, VL) > 0) ydim2d = Batoi(val);
if (readconfig(fp, "xdim3d", val, VL) > 0) xdimgame = Batoi(val);
if (readconfig(fp, "ydim3d", val, VL) > 0) ydimgame = Batoi(val);
if (readconfig(fp, "samplerate", val, VL) > 0) option[7] = (Batoi(val) & 0x0f) << 4;
if (readconfig(fp, "music", val, VL) > 0) { if (Batoi(val) != 0) option[2] = 1; else option[2] = 0; }
if (readconfig(fp, "mouse", val, VL) > 0) { if (Batoi(val) != 0) option[3] = 1; else option[3] = 0; }
if (readconfig(fp, "bpp", val, VL) > 0) bppgame = Batoi(val);
if (readconfig(fp, "renderer", val, VL) > 0) { i = Batoi(val); setrendermode(i); }
if (readconfig(fp, "brightness", val, VL) > 0) brightness = min(max(Batoi(val),0),15);
#ifdef RENDERTYPEWIN
if (readconfig(fp, "maxrefreshfreq", val, VL) > 0) maxrefreshfreq = Batoi(val);
#endif
glusetexcache = glusetexcachecompression = -1;
if (readconfig(fp, "glusetexcache", val, VL) > 0) {
if (Batoi(val) != 0) glusetexcache = 1;
else glusetexcache = 0;
}
if (readconfig(fp, "glusetexcachecompression", val, VL) > 0) {
if (Batoi(val) != 0) glusetexcachecompression = 1;
else glusetexcachecompression = 0;
}
if(glusetexcache == -1 && glusetexcachecompression == -1)
{
i=wm_ynbox("Texture caching",
"Would you like to enable the on-disk texture cache? "
"This feature may use up to 200 megabytes of disk "
"space if you have a great deal of high resolution "
"textures and skins, but textures will load exponentially "
"faster after the first time they are loaded.");
if (i) i = 'y';
if(i == 'y' || i == 'Y' )
glusetexcompr = glusetexcache = glusetexcachecompression = 1;
else glusetexcache = glusetexcachecompression = 0;
}
option[0] = 1; // vesa all the way...
option[1] = 1; // sound all the way...
option[4] = 0; // no multiplayer
option[5] = 0;
if (readconfig(fp, "keyforward", val, VL) > 0) keys[0] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keybackward", val, VL) > 0) keys[1] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keyturnleft", val, VL) > 0) keys[2] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keyturnright", val, VL) > 0) keys[3] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keyrun", val, VL) > 0) keys[4] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keystrafe", val, VL) > 0) keys[5] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keyfire", val, VL) > 0) keys[6] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keyuse", val, VL) > 0) keys[7] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keystandhigh", val, VL) > 0) keys[8] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keystandlow", val, VL) > 0) keys[9] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keylookup", val, VL) > 0) keys[10] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keylookdown", val, VL) > 0) keys[11] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keystrafeleft", val, VL) > 0) keys[12] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keystraferight", val, VL) > 0) keys[13] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "key2dmode", val, VL) > 0) keys[14] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keyviewcycle", val, VL) > 0) keys[15] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "key2dzoomin", val, VL) > 0) keys[16] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "key2dzoomout", val, VL) > 0) keys[17] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keychat", val, VL) > 0) keys[18] = Bstrtol(val, NULL, 16);
if (readconfig(fp, "keyconsole", val, VL) > 0) { keys[19] = Bstrtol(val, NULL, 16); OSD_CaptureKey(keys[19]); }
if (readconfig(fp, "mousesensitivity", val, VL) > 0) msens = Bstrtod(val, NULL);
Bfclose(fp);
return 0;
}
int writesetup(const char *fn)
{
BFILE *fp;
fp = Bfopen(fn,"wt");
if (!fp) return -1;
Bfprintf(fp,
"; Video mode selection\n"
"; 0 - Windowed\n"
"; 1 - Fullscreen\n"
"fullscreen = %ld\n"
"\n"
"; Video resolution\n"
"xdim2d = %ld\n"
"ydim2d = %ld\n"
"xdim3d = %ld\n"
"ydim3d = %ld\n"
"\n"
"; 3D-mode colour depth\n"
"bpp = %ld\n"
"\n"
"; OpenGL mode options\n"
"glusetexcache = %ld\n"
"glusetexcachecompression = %ld\n"
"\n"
#ifdef RENDERTYPEWIN
"; Maximum OpenGL mode refresh rate (Windows only, in Hertz)\n"
"maxrefreshfreq = %d\n"
"\n"
#endif
"; 3D mode brightness setting\n"
"; 0 - lowest\n"
"; 15 - highest\n"
"brightness = %d\n"
"\n"
"; Sound sample frequency\n"
"; 0 - 6 KHz\n"
"; 1 - 8 KHz\n"
"; 2 - 11.025 KHz\n"
"; 3 - 16 KHz\n"
"; 4 - 22.05 KHz\n"
"; 5 - 32 KHz\n"
"; 6 - 44.1 KHz\n"
"samplerate = %d\n"
"\n"
"; Music playback\n"
"; 0 - Off\n"
"; 1 - On\n"
"music = %d\n"
"\n"
"; Enable mouse\n"
"; 0 - No\n"
"; 1 - Yes\n"
"mouse = %d\n"
"\n"
"; Mouse sensitivity\n"
"mousesensitivity = %g\n"
"\n"
"; Key Settings\n"
"; Here's a map of all the keyboard scan codes: NOTE: values are listed in hex!\n"
"; +---------------------------------------------------------------------------------------------+\n"
"; | 01 3B 3C 3D 3E 3F 40 41 42 43 44 57 58 46 |\n"
"; |ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SCROLL |\n"
"; | |\n"
"; |29 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E D2 C7 C9 45 B5 37 4A |\n"
"; | ` '1' '2' '3' '4' '5' '6' '7' '8' '9' '0' - = BACK INS HOME PGUP NUMLK KP/ KP* KP- |\n"
"; | |\n"
"; | 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 2B D3 CF D1 47 48 49 4E |\n"
"; |TAB Q W E R T Y U I O P [ ] \\ DEL END PGDN KP7 KP8 KP9 KP+ |\n"
"; | |\n"
"; | 3A 1E 1F 20 21 22 23 24 25 26 27 28 1C 4B 4C 4D |\n"
"; |CAPS A S D F G H J K L ; ' ENTER KP4 KP5 KP6 9C |\n"
"; | KPENTER|\n"
"; | 2A 2C 2D 2E 2F 30 31 32 33 34 35 36 C8 4F 50 51 |\n"
"; |LSHIFT Z X C V B N M , . / RSHIFT UP KP1 KP2 KP3 |\n"
"; | |\n"
"; | 1D 38 39 B8 9D CB D0 CD 52 53 |\n"
"; |LCTRL LALT SPACE RALT RCTRL LEFT DOWN RIGHT KP0 KP. |\n"
"; +---------------------------------------------------------------------------------------------+\n"
"\n"
"keyforward = %X\n"
"keybackward = %X\n"
"keyturnleft = %X\n"
"keyturnright = %X\n"
"keyrun = %X\n"
"keystrafe = %X\n"
"keyfire = %X\n"
"keyuse = %X\n"
"keystandhigh = %X\n"
"keystandlow = %X\n"
"keylookup = %X\n"
"keylookdown = %X\n"
"keystrafeleft = %X\n"
"keystraferight = %X\n"
"key2dmode = %X\n"
"keyviewcycle = %X\n"
"key2dzoomin = %X\n"
"key2dzoomout = %X\n"
"keychat = %X\n"
"keyconsole = %X\n"
"\n",
fullscreen, xdim2d, ydim2d, xdimgame, ydimgame, bppgame,
glusetexcache, glusetexcachecompression,
#ifdef RENDERTYPEWIN
maxrefreshfreq,
#endif
brightness, option[7]>>4, option[2],
option[3], msens,
keys[0], keys[1], keys[2], keys[3], keys[4], keys[5],
keys[6], keys[7], keys[8], keys[9], keys[10], keys[11],
keys[12], keys[13], keys[14], keys[15], keys[16], keys[17],
keys[18], keys[19]
);
Bfclose(fp);
return 0;
}

104
polymer/build/src/crc32.c Normal file
View File

@ -0,0 +1,104 @@
#include "crc32.h"
/*
// this table of numbers is borrowed from the InfoZip source.
static unsigned long crc32table[256] = {
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
0x2d02ef8dL
};
*/
static unsigned long crc32table[256];
void initcrc32table(void)
{
unsigned long i,j,k;
// algorithm and polynomial same as that used by infozip's zip
for (i=0; i<256; i++) {
j = i;
for (k=8; k; k--)
j = (j&1) ? (0xedb88320L ^ (j>>1)) : (j>>1);
crc32table[i] = j;
}
}
unsigned long crc32once(unsigned char *blk, unsigned long len)
{
unsigned long crc;
crc32init(&crc);
crc32block(&crc, blk, len);
return crc32finish(&crc);
}
void crc32init(unsigned long *crcvar)
{
if (!crcvar) return;
*crcvar = 0xffffffffl;
}
void crc32block(unsigned long *crcvar, unsigned char *blk, unsigned long len)
{
unsigned long crc = *crcvar;
while (len--) crc = crc32table[(crc ^ *(blk++)) & 0xffl] ^ (crc >> 8);
*crcvar = crc;
}
unsigned long crc32finish(unsigned long *crcvar)
{
*crcvar = *crcvar ^ 0xffffffffl;
return *crcvar;
}

1072
polymer/build/src/defs.c Normal file

File diff suppressed because it is too large Load Diff

11240
polymer/build/src/engine.c Normal file

File diff suppressed because it is too large Load Diff

6297
polymer/build/src/game.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,144 @@
#ifndef RENDERTYPEWIN
#error Only for Windows
#endif
#include "build.h"
#include "editor.h"
#include "winlayer.h"
#include "compat.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
#include <stdio.h>
#define IDCFULLSCREEN 100
#define IDCVMODE 101
static void PopulateVideoModeLists(int fs, HWND list3d)
{
int i,j;
char buf[64];
ComboBox_ResetContent(list3d);
for (i=0; i<validmodecnt; i++) {
if (validmode[i].fs != fs) continue;
Bsprintf(buf, "%ldx%ld %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp);
j = ComboBox_AddString(list3d, buf);
ComboBox_SetItemData(list3d, j, i);
if (xdimgame == validmode[i].xdim && ydimgame == validmode[i].ydim && bppgame == validmode[i].bpp)
ComboBox_SetCurSel(list3d, j);
}
}
static INT_PTR CALLBACK LaunchWindowProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
case WM_INITDIALOG: {
char buf[64];
if (lParam) {
long *saferect = (long*)lParam;
RECT unresized, playbutton, exitbutton;
int dx, dy;
GetWindowRect(hwndDlg, &unresized);
GetWindowRect(GetDlgItem(hwndDlg, IDOK), &playbutton);
GetWindowRect(GetDlgItem(hwndDlg, IDCANCEL), &exitbutton);
playbutton.right = 1 + playbutton.right - playbutton.left;
playbutton.bottom = 1 + playbutton.bottom - playbutton.top;
exitbutton.right = 1 + exitbutton.right - exitbutton.left;
exitbutton.bottom = 1 + exitbutton.bottom - exitbutton.top;
playbutton.left = playbutton.left - unresized.left;
playbutton.top = playbutton.top - unresized.top;
exitbutton.left = exitbutton.left - unresized.left;
exitbutton.top = exitbutton.top - unresized.top;
dx = saferect[2] - (unresized.right - unresized.left);
dy = saferect[3] - (unresized.bottom - unresized.top);
playbutton.left += dx; exitbutton.left += dx;
playbutton.top += dy; exitbutton.top += dy;
// reposition the dialog, play and exit buttons
MoveWindow(hwndDlg, saferect[0], saferect[1], saferect[2], saferect[3], FALSE);
MoveWindow(GetDlgItem(hwndDlg, IDOK),
playbutton.left, playbutton.top, playbutton.right, playbutton.bottom, FALSE);
MoveWindow(GetDlgItem(hwndDlg, IDCANCEL),
exitbutton.left, exitbutton.top, exitbutton.right, exitbutton.bottom, FALSE);
}
// populate the controls
Button_SetCheck(GetDlgItem(hwndDlg, IDCFULLSCREEN), fullscreen ? BST_CHECKED : BST_UNCHECKED);
PopulateVideoModeLists(fullscreen, GetDlgItem(hwndDlg, IDCVMODE));
ShowWindow(hwndDlg, SW_SHOW);
if (GetDlgCtrlID((HWND)wParam) != IDOK) {
SetFocus(GetDlgItem(hwndDlg, IDOK));
return FALSE;
}
return TRUE;
}
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDCFULLSCREEN:
fullscreen = Button_GetCheck((HWND)lParam) == BST_CHECKED ? 1:0;
PopulateVideoModeLists(fullscreen, GetDlgItem(hwndDlg, IDCVMODE));
break;
case IDCVMODE:
if (HIWORD(wParam) == CBN_SELCHANGE) {
int i;
i = ComboBox_GetCurSel((HWND)lParam);
if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i);
if (i != CB_ERR) {
xdimgame = validmode[i].xdim;
ydimgame = validmode[i].ydim;
bppgame = validmode[i].bpp;
}
}
break;
case IDCANCEL:
quitevent = 1; // fall through
case IDOK:
DestroyWindow(hwndDlg);
return TRUE;
default: break;
}
break;
default: break;
}
return FALSE;
}
int DoLaunchWindow(int initval)
{
HWND hwndStart, hwndLaunch;
MSG msg;
long saferect[4];
// only show config window if no config is loaded, or if it is, only if left control is held
if (initval == 0 && !GetAsyncKeyState(VK_CONTROL)) return 0;
if (win_getstartupwin((long*)&hwndStart, saferect, NULL)) return 0;
hwndLaunch = CreateDialogParam((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(2000), hwndStart, LaunchWindowProc, (LPARAM)saferect);
if (hwndLaunch) {
EnableWindow(GetDlgItem(hwndStart,WIN_STARTWIN_ITEMLIST),FALSE);
while (GetMessage(&msg, NULL, 0, 0) > 0) {
if (!IsWindow(hwndLaunch) || quitevent) break;
if (IsDialogMessage(hwndStart, &msg) /*|| IsDialogMessage(hwndLaunch, &msg)*/) continue;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
EnableWindow(GetDlgItem(hwndStart,WIN_STARTWIN_ITEMLIST),TRUE);
}
if (quitevent) return 1;
return 0;
}

359
polymer/build/src/glbuild.c Normal file
View File

@ -0,0 +1,359 @@
#include "glbuild.h"
#include "baselayer.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#if defined DYNAMIC_OPENGL && defined USE_OPENGL
#ifdef RENDERTYPESDL
#include "SDL.h"
#endif
void (APIENTRY * bglClearColor)( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
void (APIENTRY * bglClear)( GLbitfield mask );
void (APIENTRY * bglColorMask)( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha );
void (APIENTRY * bglAlphaFunc)( GLenum func, GLclampf ref );
void (APIENTRY * bglBlendFunc)( GLenum sfactor, GLenum dfactor );
void (APIENTRY * bglCullFace)( GLenum mode );
void (APIENTRY * bglFrontFace)( GLenum mode );
void (APIENTRY * bglPolygonOffset)( GLfloat factor, GLfloat units );
void (APIENTRY * bglPolygonMode)( GLenum face, GLenum mode );
void (APIENTRY * bglEnable)( GLenum cap );
void (APIENTRY * bglDisable)( GLenum cap );
void (APIENTRY * bglGetFloatv)( GLenum pname, GLfloat *params );
void (APIENTRY * bglGetIntegerv)( GLenum pname, GLint *params );
void (APIENTRY * bglPushAttrib)( GLbitfield mask );
void (APIENTRY * bglPopAttrib)( void );
GLenum (APIENTRY * bglGetError)( void );
const GLubyte* (APIENTRY * bglGetString)( GLenum name );
void (APIENTRY * bglHint)( GLenum target, GLenum mode );
// Depth
void (APIENTRY * bglDepthFunc)( GLenum func );
void (APIENTRY * bglDepthMask)( GLboolean flag );
void (APIENTRY * bglDepthRange)( GLclampd near_val, GLclampd far_val );
// Matrix
void (APIENTRY * bglMatrixMode)( GLenum mode );
void (APIENTRY * bglOrtho)( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val );
void (APIENTRY * bglFrustum)( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val );
void (APIENTRY * bglViewport)( GLint x, GLint y, GLsizei width, GLsizei height );
void (APIENTRY * bglPushMatrix)( void );
void (APIENTRY * bglPopMatrix)( void );
void (APIENTRY * bglLoadIdentity)( void );
void (APIENTRY * bglLoadMatrixf)( const GLfloat *m );
// Drawing
void (APIENTRY * bglBegin)( GLenum mode );
void (APIENTRY * bglEnd)( void );
void (APIENTRY * bglVertex2f)( GLfloat x, GLfloat y );
void (APIENTRY * bglVertex2i)( GLint x, GLint y );
void (APIENTRY * bglVertex3d)( GLdouble x, GLdouble y, GLdouble z );
void (APIENTRY * bglVertex3fv)( const GLfloat *v );
void (APIENTRY * bglColor4f)( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
void (APIENTRY * bglColor4ub)( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha );
void (APIENTRY * bglTexCoord2d)( GLdouble s, GLdouble t );
void (APIENTRY * bglTexCoord2f)( GLfloat s, GLfloat t );
// Lighting
void (APIENTRY * bglShadeModel)( GLenum mode );
// Raster funcs
void (APIENTRY * bglReadPixels)( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels );
// Texture mapping
void (APIENTRY * bglTexEnvf)( GLenum target, GLenum pname, GLfloat param );
void (APIENTRY * bglGenTextures)( GLsizei n, GLuint *textures ); // 1.1
void (APIENTRY * bglDeleteTextures)( GLsizei n, const GLuint *textures); // 1.1
void (APIENTRY * bglBindTexture)( GLenum target, GLuint texture ); // 1.1
void (APIENTRY * bglTexImage2D)( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels );
void (APIENTRY * bglTexSubImage2D)( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ); // 1.1
void (APIENTRY * bglTexParameterf)( GLenum target, GLenum pname, GLfloat param );
void (APIENTRY * bglTexParameteri)( GLenum target, GLenum pname, GLint param );
void (APIENTRY * bglGetTexLevelParameteriv)( GLenum target, GLint level, GLenum pname, GLint *params );
void (APIENTRY * bglCompressedTexImage2DARB)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
void (APIENTRY * bglGetCompressedTexImageARB)(GLenum, GLint, GLvoid *);
// Fog
void (APIENTRY * bglFogf)( GLenum pname, GLfloat param );
void (APIENTRY * bglFogi)( GLenum pname, GLint param );
void (APIENTRY * bglFogfv)( GLenum pname, const GLfloat *params );
#ifdef RENDERTYPEWIN
// Windows
HGLRC (WINAPI * bwglCreateContext)(HDC);
BOOL (WINAPI * bwglDeleteContext)(HGLRC);
PROC (WINAPI * bwglGetProcAddress)(LPCSTR);
BOOL (WINAPI * bwglMakeCurrent)(HDC,HGLRC);
BOOL (WINAPI * bwglSwapBuffers)(HDC);
int (WINAPI * bwglChoosePixelFormat)(HDC,CONST PIXELFORMATDESCRIPTOR*);
int (WINAPI * bwglDescribePixelFormat)(HDC,int,UINT,LPPIXELFORMATDESCRIPTOR);
int (WINAPI * bwglGetPixelFormat)(HDC);
BOOL (WINAPI * bwglSetPixelFormat)(HDC,int,const PIXELFORMATDESCRIPTOR*);
static HANDLE hGLDLL;
#endif
char *gldriver = NULL;
static void * getproc_(const char *s, int *err, int fatal, int extension)
{
void *t;
#if defined RENDERTYPESDL
t = (void*)SDL_GL_GetProcAddress(s);
#elif defined _WIN32
if (extension) t = (void*)bwglGetProcAddress(s);
else t = (void*)GetProcAddress(hGLDLL,s);
#else
#error Need a dynamic loader for this platform...
#endif
if (!t && fatal) {
initprintf("Failed to find %s in %s\n", s, gldriver);
*err = 1;
}
return t;
}
#define GETPROC(s) getproc_(s,&err,1,0)
#define GETPROCSOFT(s) getproc_(s,&err,0,0)
#define GETPROCEXT(s) getproc_(s,&err,1,1)
#define GETPROCEXTSOFT(s) getproc_(s,&err,0,1)
int loadgldriver(const char *driver)
{
void *t;
int err=0;
#ifdef RENDERTYPEWIN
if (hGLDLL) return 0;
#endif
if (!driver) {
#ifdef _WIN32
driver = "OPENGL32.DLL";
#else
driver = "libGL.so";
#endif
}
initprintf("Loading %s\n",driver);
#if defined RENDERTYPESDL
if (SDL_GL_LoadLibrary(driver)) return -1;
#elif defined _WIN32
hGLDLL = LoadLibrary(driver);
if (!hGLDLL) return -1;
#endif
gldriver = strdup(driver);
#ifdef RENDERTYPEWIN
bwglCreateContext = GETPROC("wglCreateContext");
bwglDeleteContext = GETPROC("wglDeleteContext");
bwglGetProcAddress = GETPROC("wglGetProcAddress");
bwglMakeCurrent = GETPROC("wglMakeCurrent");
bwglSwapBuffers = GETPROC("wglSwapBuffers");
bwglChoosePixelFormat = GETPROC("wglChoosePixelFormat");
bwglDescribePixelFormat = GETPROC("wglDescribePixelFormat");
bwglGetPixelFormat = GETPROC("wglGetPixelFormat");
bwglSetPixelFormat = GETPROC("wglSetPixelFormat");
#endif
bglClearColor = GETPROC("glClearColor");
bglClear = GETPROC("glClear");
bglColorMask = GETPROC("glColorMask");
bglAlphaFunc = GETPROC("glAlphaFunc");
bglBlendFunc = GETPROC("glBlendFunc");
bglCullFace = GETPROC("glCullFace");
bglFrontFace = GETPROC("glFrontFace");
bglPolygonOffset = GETPROC("glPolygonOffset");
bglPolygonMode = GETPROC("glPolygonMode");
bglEnable = GETPROC("glEnable");
bglDisable = GETPROC("glDisable");
bglGetFloatv = GETPROC("glGetFloatv");
bglGetIntegerv = GETPROC("glGetIntegerv");
bglPushAttrib = GETPROC("glPushAttrib");
bglPopAttrib = GETPROC("glPopAttrib");
bglGetError = GETPROC("glGetError");
bglGetString = GETPROC("glGetString");
bglHint = GETPROC("glHint");
// Depth
bglDepthFunc = GETPROC("glDepthFunc");
bglDepthMask = GETPROC("glDepthMask");
bglDepthRange = GETPROC("glDepthRange");
// Matrix
bglMatrixMode = GETPROC("glMatrixMode");
bglOrtho = GETPROC("glOrtho");
bglFrustum = GETPROC("glFrustum");
bglViewport = GETPROC("glViewport");
bglPushMatrix = GETPROC("glPushMatrix");
bglPopMatrix = GETPROC("glPopMatrix");
bglLoadIdentity = GETPROC("glLoadIdentity");
bglLoadMatrixf = GETPROC("glLoadMatrixf");
// Drawing
bglBegin = GETPROC("glBegin");
bglEnd = GETPROC("glEnd");
bglVertex2f = GETPROC("glVertex2f");
bglVertex2i = GETPROC("glVertex2i");
bglVertex3d = GETPROC("glVertex3d");
bglVertex3fv = GETPROC("glVertex3fv");
bglColor4f = GETPROC("glColor4f");
bglColor4ub = GETPROC("glColor4ub");
bglTexCoord2d = GETPROC("glTexCoord2d");
bglTexCoord2f = GETPROC("glTexCoord2f");
// Lighting
bglShadeModel = GETPROC("glShadeModel");
// Raster funcs
bglReadPixels = GETPROC("glReadPixels");
// Texture mapping
bglTexEnvf = GETPROC("glTexEnvf");
bglGenTextures = GETPROC("glGenTextures");
bglDeleteTextures = GETPROC("glDeleteTextures");
bglBindTexture = GETPROC("glBindTexture");
bglTexImage2D = GETPROC("glTexImage2D");
bglTexSubImage2D = GETPROC("glTexSubImage2D");
bglTexParameterf = GETPROC("glTexParameterf");
bglTexParameteri = GETPROC("glTexParameteri");
bglGetTexLevelParameteriv = GETPROC("glGetTexLevelParameteriv");
// Fog
bglFogf = GETPROC("glFogf");
bglFogi = GETPROC("glFogi");
bglFogfv = GETPROC("glFogfv");
loadglextensions();
if (err) unloadgldriver();
return err;
}
int loadglextensions(void)
{
int err = 0;
#ifdef RENDERTYPEWIN
if (!hGLDLL) return 0;
#endif
bglCompressedTexImage2DARB = GETPROCEXTSOFT("glCompressedTexImage2DARB");
bglGetCompressedTexImageARB = GETPROCEXTSOFT("glGetCompressedTexImageARB");
return err;
}
int unloadgldriver(void)
{
#ifdef RENDERTYPEWIN
if (!hGLDLL) return 0;
#endif
free(gldriver);
gldriver = NULL;
#ifdef RENDERTYPEWIN
FreeLibrary(hGLDLL);
hGLDLL = NULL;
#endif
bglClearColor = NULL;
bglClear = NULL;
bglColorMask = NULL;
bglAlphaFunc = NULL;
bglBlendFunc = NULL;
bglCullFace = NULL;
bglFrontFace = NULL;
bglPolygonOffset = NULL;
bglPolygonMode = NULL;
bglEnable = NULL;
bglDisable = NULL;
bglGetFloatv = NULL;
bglGetIntegerv = NULL;
bglPushAttrib = NULL;
bglPopAttrib = NULL;
bglGetError = NULL;
bglGetString = NULL;
bglHint = NULL;
// Depth
bglDepthFunc = NULL;
bglDepthMask = NULL;
bglDepthRange = NULL;
// Matrix
bglMatrixMode = NULL;
bglOrtho = NULL;
bglFrustum = NULL;
bglViewport = NULL;
bglPushMatrix = NULL;
bglPopMatrix = NULL;
bglLoadIdentity = NULL;
bglLoadMatrixf = NULL;
// Drawing
bglBegin = NULL;
bglEnd = NULL;
bglVertex2f = NULL;
bglVertex2i = NULL;
bglVertex3d = NULL;
bglVertex3fv = NULL;
bglColor4f = NULL;
bglColor4ub = NULL;
bglTexCoord2d = NULL;
bglTexCoord2f = NULL;
// Lighting
bglShadeModel = NULL;
// Raster funcs
bglReadPixels = NULL;
// Texture mapping
bglTexEnvf = NULL;
bglGenTextures = NULL;
bglDeleteTextures = NULL;
bglBindTexture = NULL;
bglTexImage2D = NULL;
bglTexSubImage2D = NULL;
bglTexParameterf = NULL;
bglTexParameteri = NULL;
bglGetTexLevelParameteriv = NULL;
bglCompressedTexImage2DARB = NULL;
bglGetCompressedTexImageARB = NULL;
// Fog
bglFogf = NULL;
bglFogi = NULL;
bglFogfv = NULL;
#ifdef RENDERTYPEWIN
bwglCreateContext = NULL;
bwglDeleteContext = NULL;
bwglGetProcAddress = NULL;
bwglMakeCurrent = NULL;
bwglSwapBuffers = NULL;
bwglChoosePixelFormat = NULL;
bwglDescribePixelFormat = NULL;
bwglGetPixelFormat = NULL;
bwglSetPixelFormat = NULL;
#endif
return 0;
}
#else
char *gldriver = "<statically linked>";
int loadgldriver(const char *a) { return 0; }
int unloadgldriver(void) { return 0; }
#endif

238
polymer/build/src/gtkbits.c Normal file
View File

@ -0,0 +1,238 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <gdk-pixbuf/gdk-pixdata.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include "baselayer.h"
#include "build.h"
static int gtkenabled = 0;
extern const GdkPixdata startbanner_pixdata;
static GtkWidget *startwin = NULL;
static GdkPixbuf *appicon = NULL;
#define GLADE_HOOKUP_OBJECT(component,widget,name) \
g_object_set_data_full (G_OBJECT (component), name, \
gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
g_object_set_data (G_OBJECT (component), name, widget)
#define lookup_widget(x,w) \
(GtkWidget*) g_object_get_data(G_OBJECT(x), w)
static gboolean on_startwin_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
quitevent++;
return TRUE; // FALSE would let the event go through. we want the game to decide when to close
}
void gtkbuild_create_startwin(void)
{
GtkWidget *banner, *label, *content, *scroll;
GtkWidget *hbox1, *fixed1;
GdkPixbuf *startbanner_pixbuf;
if (!gtkenabled) return;
startwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (startwin), apptitle);
gtk_window_set_position (GTK_WINDOW (startwin), GTK_WIN_POS_CENTER);
gtk_window_set_resizable (GTK_WINDOW (startwin), FALSE);
gtk_window_set_type_hint (GTK_WINDOW (startwin), GDK_WINDOW_TYPE_HINT_DIALOG);
hbox1 = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox1);
gtk_container_add (GTK_CONTAINER (startwin), hbox1);
startbanner_pixbuf = gdk_pixbuf_from_pixdata(&startbanner_pixdata, FALSE, NULL);
banner = gtk_image_new_from_pixbuf(startbanner_pixbuf);
g_object_unref((gpointer)startbanner_pixbuf);
gtk_widget_show (banner);
gtk_box_pack_start (GTK_BOX (hbox1), banner, FALSE, FALSE, 0);
fixed1 = gtk_fixed_new ();
gtk_widget_show (fixed1);
gtk_box_pack_start (GTK_BOX (hbox1), fixed1, TRUE, TRUE, 0);
gtk_widget_set_size_request (fixed1, 390, -1);
label = gtk_label_new (startwin_labeltext);
gtk_widget_show (label);
gtk_fixed_put (GTK_FIXED (fixed1), label, 6, 6);
gtk_widget_set_size_request (label, 378, 16);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
scroll = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_show (scroll);
gtk_fixed_put (GTK_FIXED (fixed1), scroll, 6, 28);
gtk_widget_set_size_request (scroll, 378, 248);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
content = gtk_text_view_new ();
gtk_widget_show (content);
gtk_container_add (GTK_CONTAINER(scroll), content);
//gtk_fixed_put (GTK_FIXED (fixed1), content, 6, 28);
gtk_widget_set_size_request (content, 378, 248);
gtk_text_view_set_editable (GTK_TEXT_VIEW (content), FALSE);
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (content), GTK_WRAP_WORD);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (content), FALSE);
g_signal_connect ((gpointer) startwin, "delete_event",
G_CALLBACK (on_startwin_delete_event),
NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
GLADE_HOOKUP_OBJECT_NO_REF (startwin, startwin, "startwin");
GLADE_HOOKUP_OBJECT (startwin, banner, "banner");
GLADE_HOOKUP_OBJECT (startwin, label, "label");
GLADE_HOOKUP_OBJECT (startwin, scroll, "scroll");
GLADE_HOOKUP_OBJECT (startwin, content, "content");
g_signal_connect((gpointer)startwin, "destroy", G_CALLBACK(gtk_widget_destroyed), (gpointer)&startwin);
gtk_widget_show (startwin);
gtk_main_iteration_do (FALSE);
}
void gtkbuild_settitle_startwin(const char *title)
{
if (!gtkenabled || !startwin) return;
gtk_window_set_title (GTK_WINDOW (startwin), title);
}
void gtkbuild_puts_startwin(const char *str)
{
GtkWidget *textview;
GtkTextBuffer *textbuffer;
GtkTextIter enditer;
GtkTextMark *mark;
const char *aptr, *bptr;
if (!gtkenabled || !startwin || !str) return;
if (!(textview = lookup_widget(startwin, "content"))) return;
textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
gtk_text_buffer_get_end_iter(textbuffer, &enditer);
for (aptr = bptr = str; *aptr != 0; ) {
switch (*bptr) {
case '\b':
if (bptr > aptr)
gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)-1);
#if GTK_CHECK_VERSION(2,6,0)
gtk_text_buffer_backspace(textbuffer, &enditer, FALSE, TRUE);
#else
{
GtkTextIter iter2 = enditer;
gtk_text_iter_backward_cursor_position(&iter2);
//FIXME: this seems be deleting one too many chars somewhere!
if (!gtk_text_iter_equal(&iter2, &enditer))
gtk_text_buffer_delete_interactive(textbuffer, &iter2, &enditer, TRUE);
}
#endif
aptr = ++bptr;
break;
case 0:
if (bptr > aptr)
gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr));
aptr = bptr;
break;
case '\r': // FIXME
default:
bptr++;
break;
}
}
mark = gtk_text_buffer_create_mark(textbuffer, NULL, &enditer, 1);
gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(textview), mark, 0.0, FALSE, 0.0, 1.0);
gtk_text_buffer_delete_mark(textbuffer, mark);
}
void gtkbuild_close_startwin(void)
{
if (!gtkenabled) return;
if (startwin) {
gtk_widget_destroy (startwin);
startwin = NULL;
}
}
void gtkbuild_update_startwin(void)
{
if (!gtkenabled) return;
gtk_main_iteration_do (FALSE);
}
int gtkbuild_msgbox(char *name, char *msg)
{
GtkWidget *dialog;
if (!gtkenabled) return -1;
dialog = gtk_message_dialog_new(NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
msg);
gtk_window_set_title(GTK_WINDOW(dialog), name);
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
return 1;
}
int gtkbuild_ynbox(char *name, char *msg)
{
int r;
GtkWidget *dialog;
if (!gtkenabled) return -1;
dialog = gtk_message_dialog_new(NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_YES_NO,
msg);
gtk_window_set_title(GTK_WINDOW(dialog), name);
r = gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
if (r == GTK_RESPONSE_YES) return 1;
return 0;
}
#ifdef RENDERTYPESDL
#include "sdlayer.h"
extern struct sdlappicon sdlappicon;
#endif
void gtkbuild_init(int argc, char **argv)
{
gtkenabled = gtk_init_check(argc, argv);
if (!gtkenabled) return;
#ifdef RENDERTYPESDL
appicon = gdk_pixbuf_new_from_data((const guchar *)sdlappicon.pixels,
GDK_COLORSPACE_RGB, TRUE, 8, sdlappicon.width, sdlappicon.height,
sdlappicon.width*4, NULL, NULL);
#endif
if (appicon) gtk_window_set_default_icon(appicon);
}
void gtkbuild_exit(int r)
{
if (!gtkenabled) return;
if (appicon) g_object_unref((gpointer)appicon);
//gtk_exit(r);
}
void *gtkbuild_get_app_icon(void)
{
return appicon;
}

View File

@ -0,0 +1,254 @@
/*
* High-colour textures support for Polymost
* by Jonathon Fowler
* See the included license file "BUILDLIC.TXT" for license info.
*/
#include "kplib.h"
#define HICEFFECTMASK (1|2)
static palette_t hictinting[MAXPALOOKUPS];
struct hicskybox_t {
long ignore;
char *face[6];
};
typedef struct hicreplc_t {
struct hicreplc_t *next;
char palnum, ignore, flags, filler;
char *filename;
float alphacut;
struct hicskybox_t *skybox;
} hicreplctyp;
static hicreplctyp *hicreplc[MAXTILES];
static char hicfirstinit = 0;
//
// find the index into hicreplc[] which contains the replacement tile particulars
//
static hicreplctyp * hicfindsubst(long picnum, long palnum, long skybox)
{
hicreplctyp *hr;
if (!hicfirstinit) return NULL;
if ((unsigned long)picnum >= (unsigned long)MAXTILES) return NULL;
do {
for (hr = hicreplc[picnum]; hr; hr = hr->next) {
if (hr->palnum == palnum) {
if (skybox) {
if (hr->skybox && !hr->skybox->ignore) return hr;
} else {
if (!hr->ignore) return hr;
}
}
}
if (!palnum) break;
palnum = 0;
} while (1);
return NULL; // no replacement found
}
//
// hicinit()
// Initialise the high-colour stuff to default.
//
void hicinit(void)
{
long i,j;
hicreplctyp *hr, *next;
for (i=0;i<MAXPALOOKUPS;i++) { // all tints should be 100%
hictinting[i].r = hictinting[i].g = hictinting[i].b = 0xff;
hictinting[i].f = 0;
}
if (hicfirstinit)
for (i=MAXTILES-1;i>=0;i--) {
for (hr=hicreplc[i]; hr; ) {
next = hr->next;
if (hr->skybox) {
for (j=5;j>=0;j--) {
if (hr->skybox->face[j]) {
free(hr->skybox->face[j]);
}
}
free(hr->skybox);
}
if (hr->filename) free(hr->filename);
free(hr);
hr = next;
}
}
memset(hicreplc,0,sizeof(hicreplc));
hicfirstinit = 1;
}
//
// hicsetpalettetint(pal,r,g,b,effect)
// The tinting values represent a mechanism for emulating the effect of global sector
// palette shifts on true-colour textures and only true-colour textures.
// effect bitset: 1 = greyscale, 2 = invert
//
void hicsetpalettetint(long palnum, unsigned char r, unsigned char g, unsigned char b, unsigned char effect)
{
if ((unsigned long)palnum >= (unsigned long)MAXPALOOKUPS) return;
if (!hicfirstinit) hicinit();
hictinting[palnum].r = r;
hictinting[palnum].g = g;
hictinting[palnum].b = b;
hictinting[palnum].f = effect & HICEFFECTMASK;
}
//
// hicsetsubsttex(picnum,pal,filen,alphacut)
// Specifies a replacement graphic file for an ART tile.
//
int hicsetsubsttex(long picnum, long palnum, char *filen, float alphacut, char flags)
{
hicreplctyp *hr, *hrn;
if ((unsigned long)picnum >= (unsigned long)MAXTILES) return -1;
if ((unsigned long)palnum >= (unsigned long)MAXPALOOKUPS) return -1;
if (!hicfirstinit) hicinit();
for (hr = hicreplc[picnum]; hr; hr = hr->next) {
if (hr->palnum == palnum)
break;
}
if (!hr) {
// no replacement yet defined
hrn = (hicreplctyp *)calloc(1,sizeof(hicreplctyp));
if (!hrn) return -1;
hrn->palnum = palnum;
} else hrn = hr;
// store into hicreplc the details for this replacement
if (hrn->filename) free(hrn->filename);
hrn->filename = strdup(filen);
if (!hrn->filename) {
if (hrn->skybox) return -1; // don't free the base structure if there's a skybox defined
if (hr == NULL) free(hrn); // not yet a link in the chain
return -1;
}
hrn->ignore = 0;
hrn->alphacut = min(alphacut,1.0);
hrn->flags = flags;
if (hr == NULL) {
hrn->next = hicreplc[picnum];
hicreplc[picnum] = hrn;
}
//printf("Replacement [%d,%d]: %s\n", picnum, palnum, hicreplc[i]->filename);
return 0;
}
//
// hicsetskybox(picnum,pal,faces[6])
// Specifies a graphic files making up a skybox.
//
int hicsetskybox(long picnum, long palnum, char *faces[6])
{
hicreplctyp *hr, *hrn;
long j;
if ((unsigned long)picnum >= (unsigned long)MAXTILES) return -1;
if ((unsigned long)palnum >= (unsigned long)MAXPALOOKUPS) return -1;
for (j=5;j>=0;j--) if (!faces[j]) return -1;
if (!hicfirstinit) hicinit();
for (hr = hicreplc[picnum]; hr; hr = hr->next) {
if (hr->palnum == palnum)
break;
}
if (!hr) {
// no replacement yet defined
hrn = (hicreplctyp *)calloc(1,sizeof(hicreplctyp));
if (!hrn) return -1;
hrn->palnum = palnum;
} else hrn = hr;
if (!hrn->skybox) {
hrn->skybox = (struct hicskybox_t *)calloc(1,sizeof(struct hicskybox_t));
if (!hrn->skybox) {
if (hr == NULL) free(hrn); // not yet a link in the chain
return -1;
}
} else {
for (j=5;j>=0;j--) {
if (hrn->skybox->face[j])
free(hrn->skybox->face[j]);
}
}
// store each face's filename
for (j=0;j<6;j++) {
hrn->skybox->face[j] = strdup(faces[j]);
if (!hrn->skybox->face[j]) {
for (--j; j>=0; --j) // free any previous faces
free(hrn->skybox->face[j]);
free(hrn->skybox);
hrn->skybox = NULL;
if (hr == NULL) free(hrn);
return -1;
}
}
hrn->skybox->ignore = 0;
if (hr == NULL) {
hrn->next = hicreplc[picnum];
hicreplc[picnum] = hrn;
}
return 0;
}
//
// hicclearsubst(picnum,pal)
// Clears a replacement for an ART tile, including skybox faces.
//
int hicclearsubst(long picnum, long palnum)
{
hicreplctyp *hr, *hrn = NULL;
if ((unsigned long)picnum >= (unsigned long)MAXTILES) return -1;
if ((unsigned long)palnum >= (unsigned long)MAXPALOOKUPS) return -1;
if (!hicfirstinit) return 0;
for (hr = hicreplc[picnum]; hr; hrn = hr, hr = hr->next) {
if (hr->palnum == palnum)
break;
}
if (!hr) return 0;
if (hr->filename) free(hr->filename);
if (hr->skybox) {
int i;
for (i=5;i>=0;i--)
if (hr->skybox->face[i])
free(hr->skybox->face[i]);
free(hr->skybox);
}
if (hrn) hrn->next = hr->next;
else hicreplc[picnum] = hr->next;
free(hr);
return 0;
}

View File

@ -0,0 +1,378 @@
#ifdef __APPLE__
# include <jfaud/jfaud.hpp>
#else
# include "jfaud.hpp"
#endif
#include <ctype.h>
#include "compat.h"
#include "baselayer.h"
#include "cache1d.h"
extern "C" {
void initsb(char,char,long,char,char,char,char);
void uninitsb(void);
void setears(long,long,long,long);
void wsayfollow(char *,long,long,long *,long *,char);
void wsay(char *,long,long,long);
void loadwaves(void);
void loadsong(char *);
void musicon(void);
void musicoff(void);
void refreshaudio(void);
}
#define NUMCHANNELS 16
#define UNITSPERMTR 640.0
#define WAVESFILE "WAVES.KWV"
static char musistat = 0;
static char songname[BMAX_PATH] = "";
static JFAud *jfaud = NULL;
static int kwvnumwaves = 0;
static struct _kwvitem {
char instname[16];
long wavleng;
long repstart;
long repleng;
long finetune;
long datastart;
} *kwvitems = NULL;
static struct {
long *posx, *posy;
JFAudMixerChannel *handle;
} sfxchans[NUMCHANNELS];
class KenFile : public JFAudFile {
private:
int fh;
public:
KenFile(const char *filename, const char *subfilename)
: JFAudFile(filename, subfilename)
{
fh = kopen4load(const_cast<char*>(filename), 0);
}
virtual ~KenFile()
{
if (fh >= 0) kclose(fh);
}
virtual bool IsOpen(void) const { return fh >= 0; }
virtual long Read(long nbytes, void *buf)
{
if (fh < 0) return -1;
return kread(fh, buf, nbytes);
}
virtual long Seek(long pos, SeekFrom where)
{
int when;
if (fh < 0) return -1;
switch (where) {
case JFAudFile::Set: when = SEEK_SET; break;
case JFAudFile::Cur: when = SEEK_CUR; break;
case JFAudFile::End: when = SEEK_END; break;
default: return -1;
}
return klseek(fh, pos, when);
}
virtual long Tell(void) const
{
if (fh < 0) return -1;
return klseek(fh, 0, SEEK_CUR);
}
virtual long Length(void) const
{
if (fh < 0) return -1;
return kfilelength(fh);
}
};
class KWVFile : public JFAudFile {
private:
int fh;
long datastart, datalen, datapos;
public:
KWVFile(const char *filename, const char *subfilename = NULL)
: JFAudFile(filename, NULL),
datastart(-1), datalen(-1), datapos(-1)
{
long i,j;
bool found = false;
if (!subfilename) return;
for (i=0;i<kwvnumwaves;i++) {
for (j=0;j<16 && subfilename[j];j++) {
if (tolower(subfilename[j]) != tolower(kwvitems[i].instname[j])) {
found = false;
break;
} else found = true;
}
if (found) {
fh = kopen4load(const_cast<char *>(filename), 0);
if (fh < 0) return;
datastart = kwvitems[i].datastart;
datalen = kwvitems[i].wavleng;
datapos = 0;
klseek(fh, datastart, SEEK_SET);
return;
}
}
}
virtual ~KWVFile()
{
if (fh >= 0) kclose(fh);
}
virtual bool IsOpen(void) const
{
return datalen > 0 && fh >= 0;
}
virtual long Read(long nbytes, void *buf)
{
if (!IsOpen()) return -1;
if (datalen - datapos < nbytes) nbytes = datalen - datapos;
if (nbytes <= 0) return 0;
nbytes = kread(fh, buf, nbytes);
if (nbytes > 0) datapos += nbytes;
return nbytes;
}
virtual long Seek(long pos, SeekFrom where)
{
long newpos;
if (!IsOpen()) return -1;
switch (where) {
case JFAudFile::Set: newpos = pos; break;
case JFAudFile::Cur: newpos = datapos + pos; break;
case JFAudFile::End: newpos = datalen + pos; break;
default: return -1;
}
if (newpos < 0) newpos = 0;
else if (newpos > datalen) newpos = datalen;
return klseek(fh, datastart + newpos, SEEK_SET);
}
virtual long Tell(void) const
{
if (!IsOpen()) return -1;
return datapos;
}
virtual long Length(void) const
{
if (!IsOpen()) return -1;
return datalen;
}
};
static JFAudFile *openfile(const char *fn, const char *subfn)
{
char *ext;
bool loadkwv = false;
ext = Bstrrchr(fn,'.');
if (!ext || Bstrcasecmp(ext, ".kwv"))
return static_cast<JFAudFile*>(new KenFile(fn,subfn));
if (!subfn) return NULL; // KWV files need a sub name
return static_cast<JFAudFile*>(new KWVFile(fn, subfn));
}
static void logfunc(const char *s) { initprintf("%s", s); }
void loadwaves(void)
{
long fh, i, datastart;
fh = kopen4load(WAVESFILE, 0);
if (fh < 0) return;
if (kread(fh, &i, 4) != 4 || i != 0) return;
if (kread(fh, &kwvnumwaves, 4) != 4) return; kwvnumwaves = B_LITTLE32(kwvnumwaves);
kwvitems = new struct _kwvitem [kwvnumwaves];
if (!kwvitems) {
kclose(fh);
return;
}
datastart = (4+4) + kwvnumwaves * (16+4*4);
for (i=0;i<kwvnumwaves;i++) {
if (kread(fh, kwvitems[i].instname, 16) != 16) return;
if (kread(fh, &kwvitems[i].wavleng, 4) != 4) return; kwvitems[i].wavleng = B_LITTLE32(kwvitems[i].wavleng);
if (kread(fh, &kwvitems[i].repstart, 4) != 4) return; kwvitems[i].repstart = B_LITTLE32(kwvitems[i].repstart);
if (kread(fh, &kwvitems[i].repleng, 4) != 4) return; kwvitems[i].repleng = B_LITTLE32(kwvitems[i].repleng);
if (kread(fh, &kwvitems[i].finetune, 4) != 4) return; kwvitems[i].finetune = B_LITTLE32(kwvitems[i].finetune);
kwvitems[i].datastart = datastart;
datastart += kwvitems[i].wavleng;
}
kclose(fh);
}
void initsb(char dadigistat, char damusistat, long dasamplerate, char danumspeakers,
char dabytespersample, char daintspersec, char daquality)
{
int i;
if (jfaud) return;
JFAud_SetLogFunc(logfunc);
jfaud = new JFAud();
if (!jfaud) return;
jfaud->SetUserOpenFunc(openfile);
musistat = 0;
if (!jfaud->InitWave(NULL, NUMCHANNELS, dasamplerate)) {
delete jfaud;
jfaud = NULL;
return;
}
musistat = damusistat;
for (i=NUMCHANNELS-1;i>=0;i--) sfxchans[i].handle = NULL;
loadwaves();
}
void uninitsb(void)
{
if (!jfaud) return;
delete jfaud;
jfaud = NULL;
if (kwvitems) delete [] kwvitems;
}
void setears(long daposx, long daposy, long daxvect, long dayvect)
{
JFAudMixer *mixer;
if (!jfaud) return;
mixer = jfaud->GetWave();
if (!mixer) return;
mixer->SetListenerPosition((float)daposx/UNITSPERMTR, 0.0, (float)-daposy/UNITSPERMTR);
mixer->SetListenerOrientation((float)daxvect/UNITSPERMTR, 0.0, (float)-dayvect/UNITSPERMTR,
0.0, 1.0, 0.0);
}
static int storehandle(JFAudMixerChannel *handle, long *daxplc, long *dayplc)
{
int i,empty = -1;
for (i=NUMCHANNELS-1;i>=0;i--) {
if (!sfxchans[i].handle && empty<0) empty = i;
if (sfxchans[i].handle == handle) {
empty = i;
break;
}
}
if (empty < 0) return -1;
sfxchans[empty].handle = handle;
sfxchans[empty].posx = daxplc;
sfxchans[empty].posy = dayplc;
return empty;
}
static void stopcb(int r)
{
jfaud->FreeSound(sfxchans[r].handle);
sfxchans[r].handle = NULL;
}
void wsayfollow(char *dafilename, long dafreq, long davol, long *daxplc, long *dayplc, char followstat)
{
JFAudMixerChannel *handl;
int r;
if (!jfaud) return;
handl = jfaud->PlayRawSound(WAVESFILE, dafilename, 1, 11025, 1, 1, false);
if (!handl) return;
if (followstat) r = storehandle(handl, daxplc, dayplc);
else r = storehandle(handl, NULL, NULL);
if (r >= 0) handl->SetStopCallback(stopcb, r);
handl->SetPitch((float)dafreq / 4096.0);
handl->SetGain((float)davol / 256.0);
handl->SetPosition((float)(*daxplc) / UNITSPERMTR, 0.0, (float)(-*dayplc) / UNITSPERMTR);
handl->SetFollowListener(false);
handl->SetRolloff(1.0);
handl->Play();
}
void wsay(char *dafilename, long dafreq, long volume1, long volume2)
{
JFAudMixerChannel *handl;
int r;
if (!jfaud) return;
handl = jfaud->PlayRawSound(WAVESFILE, dafilename, 1, 11025, 1, 1, false);
if (!handl) return;
r = storehandle(handl, NULL, NULL);
if (r >= 0) handl->SetStopCallback(stopcb, r);
handl->SetPitch((float)dafreq / 4096.0);
handl->SetGain((float)volume1 / 256.0);
handl->SetPosition(0.0, 0.0, 0.0);
handl->SetFollowListener(true);
handl->SetRolloff(0.0);
handl->Play();
}
void loadsong(char *filename)
{
if (!jfaud) return;
strcpy(songname,filename);
}
void musicon(void)
{
if (!jfaud || !musistat || !songname[0]) return;
jfaud->PlayMusic(songname);
}
void musicoff(void)
{
if (!jfaud || !musistat) return;
jfaud->StopMusic();
}
void refreshaudio(void)
{
int i;
if (!jfaud) return;
for (i=NUMCHANNELS-1;i>=0;i--) {
if (!sfxchans[i].handle || !jfaud->IsValidSound(sfxchans[i].handle)) continue;
if (!sfxchans[i].posx || !sfxchans[i].posy) continue;
sfxchans[i].handle->SetPosition(
(float)(*sfxchans[i].posx)/UNITSPERMTR,
0.0,
(float)(-*sfxchans[i].posy)/UNITSPERMTR);
}
jfaud->Update();
}

3117
polymer/build/src/kplib.c Normal file

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More